From f673971c50ca968d3ddb16b780a389f5627418e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Tue, 22 Jun 2021 14:58:38 +0700 Subject: Fix possible division by zero and clean up --- src/GameTick.cpp | 109 ------------------------------------------------------- 1 file changed, 109 deletions(-) (limited to 'src/GameTick.cpp') diff --git a/src/GameTick.cpp b/src/GameTick.cpp index 045f903..3350634 100644 --- a/src/GameTick.cpp +++ b/src/GameTick.cpp @@ -1,51 +1,28 @@ #include "Game.h" extern double multiplier; - extern int thirdperson; - extern int visions; - extern Sprites sprites; - extern unsigned int gSourceID[100]; - extern unsigned int gSampleSet[100]; - extern Camera camera; - extern float camerashake; - extern Fog fog; - extern int environment; - extern float precipitationhorz; - extern float precipitationvert; - extern float snowdelay; - extern float precipitationdensity; - extern float soundscalefactor; - extern int slomo; - extern int forwardskey; - extern int backwardskey; - extern int leftkey; - extern int rightkey; - extern int aimkey; - extern int psychicaimkey; - extern int psychickey; - extern Decals decals; /********************> Tick() <*****/ @@ -54,58 +31,35 @@ extern Decals decals; void Game::Splat(int k){ if(k!=0||visions==0){ - person[k].health=0; - person[k].DoAnimations(k); - person[k].skeleton.offset=0; - person[k].skeleton.free=1; - person[k].longdead=1; - person[k].bleeding=1; - person[k].bleeddelay=1; - person[k].bjoint1=&person[k].skeleton.joints[person[k].skeleton.jointlabels[head]]; - person[k].bjoint2=&person[k].skeleton.joints[person[k].skeleton.jointlabels[neck]]; for(int j=0;j0&&person[i].health<=0){ - if(i==1)alSourcePlay(gSourceID[losesound]); - if(person[i].type==civiliantype){ - alSourcePlay(gSourceID[disguisekillsound]); - score-=300; - } if(person[i].type==eviltype){ - alSourcePlay(gSourceID[soulinsound]); - score+=75; - if(person[i].whichgun==knife)score+=50; - } - person[i].firstlongdead=0; - } - person[i].oldhealth=person[i].health; - } if(slomo==2){ - psychicpower-=multiplier*15; - if(psychicpower<0){ - soundscalefactor=soundscalefactordefault; - alSourceStop(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 0); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 0); - if(person[0].whichgun==knife)whichsong=knifesong; - if(person[0].whichgun!=knife)whichsong=shootsong; - if(type==zombie_type)whichsong=zombiesong; - alSourcef(gSourceID[whichsong], AL_PITCH, 1); - alSourcePlay(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 1); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 1); - slomo=0; - alSourcePlay(gSourceID[soulinsound]); - psychicpower=0; - flashamount=.5; - flashr=1;flashg=1;flashb=1; - } - } psychicpower+=multiplier*5; - if(psychicpower>10)psychicpower=10; //3d sound float gLoc[3]; - gLoc[0]=camera.position.x/soundscalefactor; - gLoc[1]=camera.position.y/soundscalefactor; - gLoc[2]=camera.position.z/soundscalefactor; //Set listener position - alListenerfv(AL_POSITION, gLoc); //Set orientation with forward and up vectors - XYZ upvector; - upvector=0; - upvector.z=-1; - upvector=DoRotation(upvector,-camera.rotation2+90,0,0); - upvector=DoRotation(upvector,0,0-camera.rotation,0); float ori[6]; - ori[0] = -facing.x; - ori[1] = facing.y; - ori[2] = facing.z; - ori[3] = -upvector.x; - ori[4] = upvector.y; - ori[5] = upvector.z; - alListenerfv(AL_ORIENTATION, ori); if(person[0].currentanimation==throwanim||person[0].currentanimation==diveanim||paused){ - MoveMouse(oldmouseloc.h,oldmouseloc.v,&mouseloc); - GetMouse(&mouseloc); - } oldmouseloc=mouseloc; - if(score<0)score=0; - } } -- cgit v1.2.3