X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameDraw.cpp;h=807c1e3b89e60d1a4c2ba9167b02761d15bd5836;hb=dbfda93cad232a7f6e9b6f88a0235040f587ab51;hp=97c2b66925dee2bc129e6fc4e3a90f6293ea6e40;hpb=5e808c58a6397c2cb1ae08293d2ba1fc91b15a0a;p=lugaru.git diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 97c2b66..807c1e3 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -30,7 +30,7 @@ extern int environment; extern float texscale; extern Light light; extern Terrain terrain; -extern Sprites sprites; +//extern Sprites sprites; extern float multiplier; extern float sps; extern float viewdistance; @@ -171,7 +171,7 @@ void Game::flash() { // shouldn't be that way, these should be attributes and Pe flashdelay=1; } /*********************> DrawGLScene() <*****/ -long long Game::MD5_string (char *string){ +long long Game::MD5_string (char* string){ char temp[256]=""; char temp2[256]=""; long long num=90814; @@ -598,7 +598,7 @@ int Game::DrawGLScene(StereoSide side) glDepthMask(0); - sprites.Draw(); + Sprite::Draw(); if(editorenabled){ glEnable(GL_BLEND); @@ -1574,17 +1574,6 @@ int Game::DrawGLScene(StereoSide side) glScalef(.25/radius*256*terrain.scale*.4,.25/radius*256*terrain.scale*.4,1); glPushMatrix(); glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1); - /*float startx,starty,endx,endy; - glBegin(GL_QUADS); - glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256); - glVertex3f(-1, -1, 0.0f); - glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256); - glVertex3f(1, -1, 0.0f); - glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256); - glVertex3f(1, 1, 0.0f); - glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256); - glVertex3f(-1, 1, 0.0f); - glEnd();*/ glPopMatrix(); glRotatef(player[0].lookrotation*-1+180,0,0,1); glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0); @@ -1678,27 +1667,9 @@ int Game::DrawGLScene(StereoSide side) glTexCoord2f(0,1); glVertex3f(-1, 1, 0.0f); glEnd(); - /*glBegin(GL_TRIANGLES); - glTexCoord2f(0,0); - glVertex3f(-1, -1, 0.0f); - glTexCoord2f(1,0); - glVertex3f(1, -1, 0.0f); - glTexCoord2f(1,1); - glVertex3f(0, 1, 0.0f); - glEnd();*/ glPopMatrix(); } } - /*glBegin(GL_QUADS); - glTexCoord2f(0,0); - glVertex3f(-1, -1, 0.0f); - glTexCoord2f(1,0); - glVertex3f(1, -1, 0.0f); - glTexCoord2f(1,1); - glVertex3f(1, 1, 0.0f); - glTexCoord2f(0,1); - glVertex3f(-1, 1, 0.0f); - glEnd();*/ glPopMatrix(); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix @@ -1711,12 +1682,6 @@ int Game::DrawGLScene(StereoSide side) glDepthMask(1); } - /*if(loading){ - loading=2; - drawmode=normalmode; - }*/ - - if(loading&&!stealthloading&&(!campaign||player[0].dead)){ glDisable(GL_DEPTH_TEST); // Disables Depth Testing glDisable(GL_CULL_FACE); @@ -1754,47 +1719,6 @@ int Game::DrawGLScene(StereoSide side) glColor3f (1.0, 1.0, 1.0); // no coloring glEnable(GL_TEXTURE_2D); - /*glBindTexture( GL_TEXTURE_2D, logotexture); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); - glDisable(GL_DEPTH_TEST); // Disables Depth Testing - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glDepthMask(0); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPushMatrix(); // Store The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPushMatrix(); // Store The Modelview Matrix - glLoadIdentity(); // Reset The Modelview Matrix - glScalef((float)screenwidth/2,(float)screenwidth/2,1); - glTranslatef(1.8,1.25,0); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1,1,1,1); - glPushMatrix(); - glScalef(.25,.25,.25); - glBegin(GL_QUADS); - glTexCoord2f(0,0); - glVertex3f(-1, -1, 0.0f); - glTexCoord2f(1,0); - glVertex3f(1, -1, 0.0f); - glTexCoord2f(1,1); - glVertex3f(1, 1, 0.0f); - glTexCoord2f(0,1); - glVertex3f(-1, 1, 0.0f); - glEnd(); - glPopMatrix(); - glDisable(GL_TEXTURE_2D); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPopMatrix(); // Restore The Old Projection Matrix - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPopMatrix(); // Restore The Old Projection Matrix - glEnable(GL_DEPTH_TEST); // Enables Depth Testing - glEnable(GL_CULL_FACE); - glDisable(GL_BLEND); - glDepthMask(1);*/ //Minimap @@ -1846,47 +1770,6 @@ int Game::DrawGLScene(StereoSide side) glColor3f (1.0, 1.0, 1.0); // no coloring glEnable(GL_TEXTURE_2D); - /*glBindTexture( GL_TEXTURE_2D, logotexture); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); - glDisable(GL_DEPTH_TEST); // Disables Depth Testing - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glDepthMask(0); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPushMatrix(); // Store The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPushMatrix(); // Store The Modelview Matrix - glLoadIdentity(); // Reset The Modelview Matrix - glScalef((float)screenwidth/2,(float)screenwidth/2,1); - glTranslatef(1.8,1.25,0); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1,1,1,1); - glPushMatrix(); - glScalef(.25,.25,.25); - glBegin(GL_QUADS); - glTexCoord2f(0,0); - glVertex3f(-1, -1, 0.0f); - glTexCoord2f(1,0); - glVertex3f(1, -1, 0.0f); - glTexCoord2f(1,1); - glVertex3f(1, 1, 0.0f); - glTexCoord2f(0,1); - glVertex3f(-1, 1, 0.0f); - glEnd(); - glPopMatrix(); - glDisable(GL_TEXTURE_2D); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glPopMatrix(); // Restore The Old Projection Matrix - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glPopMatrix(); // Restore The Old Projection Matrix - glEnable(GL_DEPTH_TEST); // Enables Depth Testing - glEnable(GL_CULL_FACE); - glDisable(GL_BLEND); - glDepthMask(1);*/ //Awards int numawards; @@ -1899,76 +1782,73 @@ int Game::DrawGLScene(StereoSide side) } bool alldead; alldead=1; - if(numplayers>1) - for(i=1;i1) - for(i=1;i0){ - awards[numawards]=awardbojutsu; - numawards++; - } - if(numattacks==numswordattack&&numattacks>0){ - awards[numawards]=awardswordsman; - numawards++; - } - if(numattacks==numknifeattack&&numattacks>0){ - awards[numawards]=awardknifefighter; - numawards++; - } - if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){ - awards[numawards]=awardkungfu; - numawards++; - } - if(numescaped>0){ - awards[numawards]=awardevasion; - numawards++; - } - if(numflipfail==0&&numflipped+numwallflipped*2>20){ - awards[numawards]=awardacrobat; - numawards++; - } - if(numthrowkill==numplayers-1){ - awards[numawards]=awardlongrange; - numawards++; - } - alldead=1; - if(numplayers>1) - for(i=1;i0&&alldead){ - awards[numawards]=awardbrutal; - numawards++; - } - if(numreversals>((float)numattacks)*.8&&numreversals>3){ - awards[numawards]=awardaikido; - numawards++; - } - if(maxalarmed==1&&numplayers>2){ - awards[numawards]=awardstrategy; - numawards++; - } - if(numflipfail>3){ - awards[numawards]=awardklutz; - numawards++; - } + for(i=1;i0){ + awards[numawards]=awardbojutsu; + numawards++; + } + if(numattacks==numswordattack&&numattacks>0){ + awards[numawards]=awardswordsman; + numawards++; + } + if(numattacks==numknifeattack&&numattacks>0){ + awards[numawards]=awardknifefighter; + numawards++; + } + if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){ + awards[numawards]=awardkungfu; + numawards++; + } + if(numescaped>0){ + awards[numawards]=awardevasion; + numawards++; + } + if(numflipfail==0&&numflipped+numwallflipped*2>20){ + awards[numawards]=awardacrobat; + numawards++; + } + if(numthrowkill==numplayers-1){ + awards[numawards]=awardlongrange; + numawards++; + } + alldead=1; + for(i=1;i0&&alldead){ + awards[numawards]=awardbrutal; + numawards++; + } + if(numreversals>((float)numattacks)*.8&&numreversals>3){ + awards[numawards]=awardaikido; + numawards++; + } + if(maxalarmed==1&&numplayers>2){ + awards[numawards]=awardstrategy; + numawards++; + } + if(numflipfail>3){ + awards[numawards]=awardklutz; + numawards++; + } //Win Screen Won Victory @@ -2322,29 +2202,15 @@ int Game::DrawGLScene(StereoSide side) if(mainmenu==1){ LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0); LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0); - /*if(oldmainmenu==1||oldmainmenu==0){ - LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); - LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0); - LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0); - loaddistrib=0; - }*/ } if(mainmenu==2){ LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0); LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0); - /*if(oldmainmenu==2||oldmainmenu==0){ - LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); - LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0); - LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0); - loaddistrib=0; - }*/ } } if(lastcheck>.5||oldmainmenu!=mainmenu){ if(mainmenu==5){ ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt")); - //campaignnumlevels=0; - //accountactive->getCampaignChoicesMade()=0; ipstream.ignore(256,':'); ipstream >> campaignnumlevels; for(i=0;i> campaignchoosenext[i]; ipstream.ignore(256,':'); ipstream >> campaignnumnext[i]; - if(campaignnumnext[i]) - for(j=0;j> campaignnextlevel[i][j]; - campaignnextlevel[i][j]-=1; - } - ipstream.ignore(256,':'); - ipstream >> campaignlocationx[i]; - //campaignlocationx[i]-=30; + for(j=0;j> campaignlocationy[i]; - //campaignlocationy[i]+=30; + ipstream >> campaignnextlevel[i][j]; + campaignnextlevel[i][j]-=1; + } + ipstream.ignore(256,':'); + ipstream >> campaignlocationx[i]; + ipstream.ignore(256,':'); + ipstream >> campaignlocationy[i]; } ipstream.close(); @@ -2383,36 +2246,26 @@ int Game::DrawGLScene(StereoSide side) levelorder[0]=0; levelvisible[0]=1; - if(accountactive->getCampaignChoicesMade()) - for(i=0;igetCampaignChoicesMade();i++){ - levelorder[i+1]=campaignnextlevel[levelorder[i]][accountactive->getCampaignChoice(i)]; - levelvisible[levelorder[i+1]]=1; - } - int whichlevelstart; - whichlevelstart=accountactive->getCampaignChoicesMade()-1; - if(whichlevelstart<0){ - accountactive->setCampaignScore(0); - accountactive->resetFasttime(); - campaignchoicenum=1; - campaignchoicewhich[0]=0; - } - else - { - campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]]; - if(campaignchoicenum==0){ - //if(accountactive->getCampaignFasttime()==0||accountcampaigntime[accountactive]getCampaignFasttime())accountactive->getCampaignFasttime()=accountcampaigntime[accountactive]; - } - if(campaignchoicenum) - for(i=0;igetCampaignChoicesMade();i++){ + levelorder[i+1]=campaignnextlevel[levelorder[i]][accountactive->getCampaignChoice(i)]; + levelvisible[levelorder[i+1]]=1; + } + int whichlevelstart = accountactive->getCampaignChoicesMade()-1; + if(whichlevelstart<0){ + accountactive->setCampaignScore(0); + accountactive->resetFasttime(); + campaignchoicenum=1; + campaignchoicewhich[0]=0; + } + else + { + campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]]; + for(i=0;i