X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameDraw.cpp;h=e01f46ce516c498ce6019bda1c2f8abcfd1ea52a;hb=f250ee8330a466b35a7ba2975d3d3fed508068c2;hp=12100d7b9a2da2c2769ba403213a524957137ec1;hpb=9b2b1b257c8e3f01c4c414fbaab03f59284eef03;p=lugaru.git diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 12100d7..e01f46c 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -175,6 +175,8 @@ extern float accountcampaigntime[10]; extern bool gamestarted; +extern bool showdamagebar; + extern OPENAL_SAMPLE *samp[100]; extern int channels[100]; extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused); @@ -1226,6 +1228,90 @@ int Game::DrawGLScene(void) text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768); glColor4f(1,0,0,1); text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768); + if(showdamagebar) { + glDisable(GL_DEPTH_TEST); // Disables Depth Testing + glDisable(GL_CULL_FACE); + glDisable(GL_LIGHTING); + glDisable(GL_TEXTURE_2D); + 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 + glTranslatef(15,screenheight*17.5/20,0); + glScalef(screenwidth/3+20,screenheight/20,1); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(0.0,0.4,0.0,0.7); + float bar=((float)player[0].damage)/player[0].damagetolerance; + glBegin(GL_QUADS); + glVertex3f((bar<1?bar:1),0,0.0f); + glVertex3f(1,0,0.0f); + glVertex3f(1,1,0.0f); + glVertex3f((bar<1?bar:1),1,0.0f); + glEnd(); + glColor4f(0.1,0.0,0.0,1); + bar = ((float)player[0].bloodloss)/player[0].damagetolerance; + glBegin(GL_QUADS); + glVertex3f(0,0,0.0f); + glVertex3f((bar<1?bar:1),0,0.0f); + glVertex3f((bar<1?bar:1),1,0.0f); + glVertex3f(0,1,0.0f); + glEnd(); + glColor4f(0.4,0.0,0.0,0.7); + bar = ((float)player[0].damage)/player[0].damagetolerance; + glBegin(GL_QUADS); + glVertex3f(0,0,0.0f); + glVertex3f((bar<1?bar:1),0,0.0f); + glVertex3f((bar<1?bar:1),1,0.0f); + glVertex3f(0,1,0.0f); + glEnd(); + glColor4f(0.4,0.0,0.0,0.7); + bar = ((float)player[0].permanentdamage)/player[0].damagetolerance; + glBegin(GL_QUADS); + glVertex3f(0,0,0.0f); + glVertex3f((bar<1?bar:1),0,0.0f); + glVertex3f((bar<1?bar:1),1,0.0f); + glVertex3f(0,1,0.0f); + glEnd(); + glColor4f(0.4,0.0,0.0,0.7); + bar = ((float)player[0].superpermanentdamage)/player[0].damagetolerance; + glBegin(GL_QUADS); + glVertex3f(0,0,0.0f); + glVertex3f((bar<1?bar:1),0,0.0f); + glVertex3f((bar<1?bar:1),1,0.0f); + glVertex3f(0,1,0.0f); + glEnd(); + glColor4f(0.0,0.0,0.0,0.7); + glLineWidth(2.0); + glBegin(GL_LINE_STRIP); + glVertex3f(0,0,0.0f); + glVertex3f(1,0,0.0f); + glVertex3f(1,1,0.0f); + glVertex3f(0,1,0.0f); + glVertex3f(0,0,0.0f); + glEnd(); + + 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); + glEnable(GL_TEXTURE_2D); + + // writing the numbers : + sprintf (string, "Damages : %d/%d (%d)",(int)(player[0].damage),(int)(player[0].damagetolerance),(int)(player[0].bloodloss)); + glColor4f(0,0,0,1); + text.glPrintOutline(1024/40-4,768/16-4+768*14/16-40,string,1,1.5*1.25,1024,768); + glColor4f(1,0,0,1); + text.glPrint(1024/40,768/16+768*14/16-40,string,1,1.5,1024,768); + } } glColor4f(.5,.5,.5,1); @@ -2253,29 +2339,29 @@ int Game::DrawGLScene(void) if(texdetail>2)texdetail=2; if(mainmenu!=oldmainmenu&&oldmainmenu!=0){ if(mainmenu==1){ - LoadTexture("Data/Textures/Newgame.png",&Mainmenuitems[1],0,0); - LoadTexture("Data/Textures/Quit.png",&Mainmenuitems[3],0,0); + 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); + 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); + 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); + 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")); + ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt")); //campaignnumlevels=0; //accountcampaignchoicesmade[accountactive]=0; ipstream.ignore(256,':');