diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GameTick.cpp | 141 |
1 files changed, 61 insertions, 80 deletions
diff --git a/src/GameTick.cpp b/src/GameTick.cpp index dd23dc9..f3ca51a 100644 --- a/src/GameTick.cpp +++ b/src/GameTick.cpp @@ -2223,94 +2223,81 @@ void Game::Tick(){ } } - //Fire/wing + // Fire/wing + bool firing = false; + if (!Button()) { + oldbutton = 0; + } else if (oldbutton) { + } else if (person[0].ammo <= 0 && person[0].aiming + && person[0].targetanimation != joganim + && person[0].whichgun != nogun + && person[0].whichgun != knife + && person[0].whichgun != grenade) { + auto& coords = person[0].playercoords; + float gLoc[3] { + coords.x / soundscalefactor, + coords.y / soundscalefactor, + coords.z / soundscalefactor, + }; + alSourcefv(gSourceID[clicksound], AL_POSITION, gLoc); + alSourcePlay(gSourceID[clicksound]); + oldbutton = 1; + } else if (visions == 1) { + alSourcePlay(gSourceID[soulinsound]); + } else { + firing = true; + // Assault rifles are automatic. + if (person[0].whichgun != assaultrifle) + oldbutton = 1; + } XYZ wallhit; - XYZ start; - XYZ finalwallhit; - - bool firing; - float inaccuracy = 0.0; - int numshots; - XYZ hitnorm; - XYZ hitmove; - - int hitpoly=0; - + int hitpoly = 0; float hitrotation = 0.0f; - - Model *model = NULL; - - for(int j=0;j<numpeople;j++){ - - if(person[j].type==playertype||person[j].type==eviltype){ - - firing=0; - - if(person[j].ammo>0&&person[j].reloading<=0&&person[j].targetanimation!=joganim){ - - if(Button()&&!oldbutton&&j==0)firing=1; - - if(j!=0)firing=0; - - if(j!=0&&person[j].whichgun!=nogun&&person[j].whichgun!=knife&&person[j].killtargetvisible&&person[j].shotdelay<0)firing=1; - - if(j!=0&&person[j].whichgun!=nogun&&person[j].whichgun!=knife&&person[j].killtargetvisible&&person[j].shotdelay>0)person[j].shotdelay-=multiplier*.9; - - if(person[j].skeleton.free==1||person[j].targetanimation==getupfrontanim||person[j].targetanimation==getupbackanim)person[j].shotdelay=shotdelayamount/difficulty; - - if(j!=0&&person[j].whichgun!=nogun&&person[j].whichgun!=knife&&person[j].killtargetvisible)person[j].aiming=1; - - if(person[0].whichgun!=assaultrifle)oldbutton=1; - + Model* model = NULL; + + for (int j = 0; j < numpeople; j++) { + if (j && person[j].type != eviltype) + continue; + + if (person[j].ammo <= 0 + || person[j].reloading > 0 + || person[j].targetanimation == joganim + || person[j].aimamount < 1) + firing = false; + else if (j) + firing = person[j].whichgun != nogun + && person[j].whichgun != knife + && person[j].killtargetvisible + && person[j].shotdelay < 0; + + if (j && person[j].killtargetvisible + && person[j].whichgun != nogun + && person[j].whichgun != knife) { + person[j].aiming = 1; + if (person[j].shotdelay > 0) + person[j].shotdelay -= multiplier * 0.9; } - if(person[j].ammo==0&&person[j].reloads[person[j].whichgun]>0){ - - person[j].ammo=-1; - - person[j].aiming=0; - - firing=0; - - } - - if(person[0].ammo<=0&&Button()&&!oldbutton&&person[0].targetanimation!=joganim&&person[0].whichgun!=nogun&&person[0].whichgun!=knife&&person[0].whichgun!=grenade&&person[0].aiming){ - - oldbutton=1; - - float gLoc[3]; - - gLoc[0]=person[0].playercoords.x/soundscalefactor; - - gLoc[1]=person[0].playercoords.y/soundscalefactor; - - gLoc[2]=person[0].playercoords.z/soundscalefactor; - - alSourcefv(gSourceID[clicksound], AL_POSITION, gLoc); - - alSourcePlay(gSourceID[clicksound]); - - } - - if(j==0&&visions==1&&firing){ - - firing=0; - - alSourcePlay(gSourceID[soulinsound]); + if (person[j].skeleton.free == 1 + || person[j].targetanimation == getupfrontanim + || person[j].targetanimation == getupbackanim) + person[j].shotdelay = shotdelayamount + / difficulty; + if (person[j].ammo == 0 + && person[j].reloads[person[j].whichgun] > 0) { + person[j].ammo = -1; + person[j].aiming = 0; } - if(person[j].aimamount<1)firing=0; - - if(firing){ - + if (firing) { if(person[j].whichgun==handgun1||person[j].whichgun==handgun2)inaccuracy=8; if(person[j].whichgun==assaultrifle)inaccuracy=6; @@ -3200,15 +3187,9 @@ void Game::Tick(){ } } - - } - } - } - if(!Button())oldbutton=0; - if(lasersight&&person[0].whichgun!=grenade){ for(int j=0;j<numpeople;j++){ |