X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameDraw.cpp;h=2b5ebf681c4ffafbb0d2a586ff5125f0ccd949b4;hb=617a36f729718c59c2f886fd4a1d145388e7c8bc;hp=f67ae5f2ba0ce90a2c13828a6b7c161c36b394a3;hpb=eaa718daa2eb9d1bb8a7f91bf8dc9e51cd099bf0;p=lugaru.git diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index f67ae5f..2b5ebf6 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -159,7 +159,6 @@ 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); @@ -171,37 +170,6 @@ void Game::flash() { // shouldn't be that way, these should be attributes and Pe flashdelay=1; } /*********************> DrawGLScene() <*****/ -long long Game::MD5_string (char* string){ - char temp[256]=""; - char temp2[256]=""; - long long num=90814; - - sprintf (temp, "%s",string); - - int i=0; - while (i<256&&temp[i]!='\0'){ - if(temp[i]%3==0)num+=temp[i]*124; - else if(temp[i]%3==1)num-=temp[i]*temp[i]; - else num*=temp[i]; - i++; - } - - num=longlongabs(num); - if(num==0)num+=1452; - - while(numLONGLONGCONST(9900000000000000)){ - num/=1.235421521; - } - - return num; - - //return 1111111111111111; -} - int Game::DrawGLScene(StereoSide side) { static float texcoordwidth,texcoordheight; @@ -293,16 +261,15 @@ int Game::DrawGLScene(StereoSide side) if(winfreeze||mainmenu)drawmode=normalmode; - //drawmode=glowmode; +#if PLATFORM_MACOSX if(drawmode==glowmode){ RGBColor color2; color2.red=0; color2.green=0; color2.blue=0; -#if PLATFORM_MACOSX DSpContext_FadeGamma(NULL,200,&color2); -#endif } +#endif if(drawtoggle!=2)drawtoggle=1-drawtoggle; @@ -322,20 +289,18 @@ int Game::DrawGLScene(StereoSide side) glDrawBuffer(GL_BACK); glReadBuffer(GL_BACK); - /*if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, (float)(abs(Random()%100))/50 ); - else glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0); - */ if(abs(blurness-targetblurness)2){ blurness=targetblurness; targetblurness=(float)(abs(Random()%100))/40; } - if(blurnesstargetblurness)blurness-=multiplier*5; + if(blurness=typesleeping)&&player[k].playerdetail) @@ -426,20 +387,19 @@ int Game::DrawGLScene(StereoSide side) opacity=.2+.2*sin(smoketex*6+i)-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/10; } terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation); - if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz]) - for(l=0;l'z'||string[i]<' '||string[i]=='\0'){ @@ -1128,11 +1085,9 @@ int Game::DrawGLScene(StereoSide side) if(dialogueboxlocation[whichdialogue][indialogue]==1)starty=screenheight/16+screenheight*4/5; if(dialogueboxlocation[whichdialogue][indialogue]==2)starty=screenheight*1/5-screenheight/16; -// char tempname[64]; char tempname[264]; bool goodchar; int tempnum=0; -// for(i=0;i<64;i++){ for(i=0;i<264;i++){ tempname[i]='\0'; } @@ -1141,10 +1096,10 @@ int Game::DrawGLScene(StereoSide side) tempname[tempnum]=dialoguename[whichdialogue][indialogue][i]; goodchar=1; if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0; - //if(tempnum>2)if(tempname[tempnum-2]=='e'&&tempname[tempnum-1]=='r')goodchar=0; - //if(tempnum>2)if(tempname[tempnum]=='r'&&tempname[0]=='a')goodchar=0; - if(goodchar)tempnum++; - else tempname[tempnum]='\0'; + if(goodchar) + tempnum++; + else + tempname[tempnum]='\0'; } sprintf (string, "%s: ", tempname); @@ -1159,7 +1114,6 @@ int Game::DrawGLScene(StereoSide side) { glColor4f(0,0,0,tutorialopac); text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight); - } tempnum=0; @@ -1168,14 +1122,11 @@ int Game::DrawGLScene(StereoSide side) if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++; } - sprintf (string, "%s", tempname); - - int lastline; - int line=0; - bool done=0; - lastline=0; + int lastline = 0; + int line = 0; + bool done = false; i=0; while(!done){ if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){ @@ -1201,8 +1152,10 @@ int Game::DrawGLScene(StereoSide side) if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){ if(campaign){ - if(!scoreadded)sprintf (string, "Score: %d", (int)accountactive->getCampaignScore()+(int)bonustotal);//(int)bonustotal); - if(scoreadded)sprintf (string, "Score: %d", (int)accountactive->getCampaignScore());//(int)bonustotal); + if(scoreadded) + sprintf (string, "Score: %d", (int)accountactive->getCampaignScore()); + else + sprintf (string, "Score: %d", (int)accountactive->getCampaignScore()+(int)bonustotal); } if(!campaign)sprintf (string, "Score: %d", (int)bonustotal); glColor4f(0,0,0,1); @@ -1306,8 +1259,10 @@ int Game::DrawGLScene(StereoSide side) text.glPrint(10,260,string,0,.8,1024,768); - if(editorenabled)sprintf (string, "Map editor enabled."); - if(!editorenabled)sprintf (string, "Map editor Disabled."); + if(editorenabled) + sprintf (string, "Map editor enabled."); + else + sprintf (string, "Map editor disabled."); text.glPrint(10,60,string,0,.8,1024,768); if(editorenabled){ sprintf (string, "Object size: %f",editorsize); @@ -1320,18 +1275,44 @@ int Game::DrawGLScene(StereoSide side) text.glPrint(10,105,string,0,.8,1024,768); sprintf (string, "Object type: %d",editortype); text.glPrint(10,120,string,0,.8,1024,768); - if(editortype==boxtype)sprintf (string, "(box)"); - if(editortype==treetrunktype)sprintf (string, "(tree)"); - if(editortype==walltype)sprintf (string, "(wall)"); - if(editortype==weirdtype)sprintf (string, "(weird)"); - if(editortype==spiketype)sprintf (string, "(spike)"); - if(editortype==rocktype)sprintf (string, "(rock)"); - if(editortype==bushtype)sprintf (string, "(bush)"); - if(editortype==tunneltype)sprintf (string, "(tunnel)"); - if(editortype==chimneytype)sprintf (string, "(chimney)"); - if(editortype==platformtype)sprintf (string, "(platform)"); - if(editortype==cooltype)sprintf (string, "(cool)"); - if(editortype==firetype)sprintf (string, "(fire)"); + switch(editortype) { + case boxtype: + sprintf (string, "(box)"); + break; + case treetrunktype: + sprintf (string, "(tree)"); + break; + case walltype: + sprintf (string, "(wall)"); + break; + case weirdtype: + sprintf (string, "(weird)"); + break; + case spiketype: + sprintf (string, "(spike)"); + break; + case rocktype: + sprintf (string, "(rock)"); + break; + case bushtype: + sprintf (string, "(bush)"); + break; + case tunneltype: + sprintf (string, "(tunnel)"); + break; + case chimneytype: + sprintf (string, "(chimney)"); + break; + case platformtype: + sprintf (string, "(platform)"); + break; + case cooltype: + sprintf (string, "(cool)"); + break; + case firetype: + sprintf (string, "(fire)"); + break; + } text.glPrint(130,120,string,0,.8,1024,768); sprintf (string, "Numplayers: %d",numplayers); @@ -1339,17 +1320,8 @@ int Game::DrawGLScene(StereoSide side) sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints); text.glPrint(10,140,string,0,.8,1024,768); } - /*sprintf (string, "Coords are: %f %f %f",player[0].coords.x,player[0].coords.y,player[0].coords.z); - text.glPrint(10,200,string,0,.8,1024,768);*/ sprintf (string, "Difficulty: %d",difficulty); text.glPrint(10,240,string,0,.8,1024,768); - /* - sprintf (string, "lasthotspot: %d",hotspottype[numhotspots-1]); - text.glPrint(10,240,string,0,.8,1024,768); - sprintf (string, "killhotspot: %d",killhotspot); - text.glPrint(10,220,string,0,.8,1024,768); - sprintf (string, "winhotspot: %d",winhotspot); - text.glPrint(10,200,string,0,.8,1024,768);*/ } } @@ -1495,8 +1467,7 @@ int Game::DrawGLScene(StereoSide side) } if(minimap&&indialogue==-1){ - float mapviewdist; - mapviewdist=20000; + float mapviewdist = 20000; glDisable(GL_DEPTH_TEST); glColor3f (1.0, 1.0, 1.0); // no coloring @@ -1521,19 +1492,17 @@ int Game::DrawGLScene(StereoSide side) glEnable(GL_BLEND); glColor4f(1,1,1,1); glPushMatrix(); - float opac; - opac=.7; + float opac = .7; XYZ center; float radius; float distcheck; - center=0; int numliveplayers=0; + center = 0; for(i=0;i=60)offset=consoleselected-60; - sprintf (string, " ]"); - text.glPrint(10,30,string,0,1,1024,768); - if(consoleblink){ - sprintf (string, "_"); - text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768); - } - for(i=0;i<15;i++){ - for(j=0;j=60) + offset=consoleselected-60; + sprintf (string, " ]"); + text.glPrint(10,30,string,0,1,1024,768); + if(consoleblink){ + sprintf (string, "_"); + text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768); + } + for(i=0;i<15;i++){ + for(j=0;jgetHighScore(j)); - strcat(menustring[j],temp); - for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' '; - menustring[j][32]='\0'; - sprintf (temp, "%d:",(int)(((int)accountactive->getFastTime(j)-(int)(accountactive->getFastTime(j))%60)/60)); - strcat(menustring[j],temp); - if((int)(accountactive->getFastTime(j))%60<10)strcat(menustring[j],"0"); - sprintf (temp, "%d",(int)(accountactive->getFastTime(j))%60); - strcat(menustring[j],temp); - - startx[j]=10; - starty[j]=360-j*40; - endx[j]=startx[j]+strlen(menustring[j])*10; - endy[j]=starty[j]+20; - movex[j]=0; - movey[j]=0; - } - - sprintf (menustring[numchallengelevels], "Back"); - startx[numchallengelevels]=10; - endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10; - starty[numchallengelevels]=10; - endy[numchallengelevels]=starty[numchallengelevels]+20; - movex[numchallengelevels]=0; - movey[numchallengelevels]=0; - - sprintf (menustring[numchallengelevels+1], " High Score Best Time"); - startx[numchallengelevels+1]=10; - starty[numchallengelevels+1]=400; - endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10; - endy[numchallengelevels+1]=starty[numchallengelevels+1]+20; - movex[numchallengelevels+1]=0; - movey[numchallengelevels+1]=0; - } if(mainmenu==10){ nummenuitems=6; @@ -3193,13 +3110,12 @@ int Game::DrawGLScene(StereoSide side) } } - if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==11||mainmenu==13||mainmenu==17||mainmenu==18) + if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==18) for(i=0;istartx[i]&&(mousecoordh/screenwidth*640)starty[i]&&480-(mousecoordv/screenheight*480)accountactive->getProgress()&&jaccountactive->getProgress()&&j0){ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); if(mainmenu!=7||j!=0||!entername) @@ -3407,10 +3321,7 @@ int Game::DrawGLScene(StereoSide side) if(mainmenu==7&&(j!=0||!entername)) text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); if(mainmenu==8)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); if(mainmenu==9)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); - if(mainmenu==11)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); if(mainmenu==10)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); - if(mainmenu==17)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); - if(mainmenu==13&&j!=1)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); if(mainmenu==18)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4,starty[j]+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480); } }