aboutsummaryrefslogtreecommitdiff
path: root/src/GameTick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GameTick.cpp')
-rw-r--r--src/GameTick.cpp410
1 files changed, 47 insertions, 363 deletions
diff --git a/src/GameTick.cpp b/src/GameTick.cpp
index 6b28436..4249b05 100644
--- a/src/GameTick.cpp
+++ b/src/GameTick.cpp
@@ -1,6 +1,4 @@
-#include "Game.h"
-
-
+#include "Game.h"
extern double multiplier;
@@ -10,8 +8,6 @@ extern int visions;
extern Sprites sprites;
-
-
extern unsigned int gSourceID[100];
extern unsigned int gSampleSet[100];
@@ -36,8 +32,6 @@ extern float soundscalefactor;
extern int slomo;
-
-
extern int forwardskey;
extern int backwardskey;
@@ -52,18 +46,13 @@ extern int psychicaimkey;
extern int psychickey;
-
-
extern Decals decals;
/********************> Tick() <*****/
#define maxfallvel 40
-
-
void Game::Splat(int k){
-
if(k!=0||visions==0){
person[k].health=0;
@@ -76,8 +65,6 @@ void Game::Splat(int k){
person[k].longdead=1;
-
-
person[k].bleeding=1;
person[k].bleeddelay=1;
@@ -86,8 +73,6 @@ void Game::Splat(int k){
person[k].bjoint2=&person[k].skeleton.joints[person[k].skeleton.jointlabels[neck]];
-
-
for(int j=0;j<person[k].skeleton.num_joints;j++){
person[k].skeleton.joints[j].position+=person[k].skeleton.joints[j].offset;
@@ -101,11 +86,8 @@ void Game::Splat(int k){
person[k].skeleton.joints[j].velocity=0;
person[k].skeleton.joints[j].velocity.y+=person[k].velocity.y;
-
}
-
-
float gLoc[3];
gLoc[0]=person[k].skeleton.joints[person[k].skeleton.jointlabels[head]].position.x/soundscalefactor;
@@ -118,32 +100,24 @@ void Game::Splat(int k){
alSourcePlay(gSourceID[headwhacksound]);
- }
+ }
}
-
-
void Game::Tick(){
if(mainmenu){
-
-
unsigned char theKeyMap[16];
GetKeys( ( unsigned long * )theKeyMap );
-
-
if(IsKeyDown(theKeyMap, MAC_SPACE_KEY)){
mainmenu=0;
}
-
-
GetMouse(&mouseloc);
float mousex=mouseloc.h;
@@ -153,7 +127,6 @@ void Game::Tick(){
mousex=(float)mouseloc.h*640/screenwidth;
mousey=480-(float)mouseloc.v*480/screenheight;
-
oldmouseoverbutton=mouseoverbutton;
@@ -269,8 +242,8 @@ void Game::Tick(){
highscore=score;
-#ifdef OS9
- ofstream opstream(":Data:Highscore");
+#ifdef OS9
+ ofstream opstream(":Data:Highscore");
#else
/* TODO */
ofstream opstream("Data/Highscore");
@@ -301,8 +274,8 @@ void Game::Tick(){
highscore=score;
-#ifdef OS9
- ofstream opstream(":Data:Highscore");
+#ifdef OS9
+ ofstream opstream(":Data:Highscore");
#else
/* TODO */
ofstream opstream("Data/Highscore");
@@ -319,8 +292,6 @@ void Game::Tick(){
}
-
-
if(Button())oldbutton=1;
if(!Button())oldbutton=0;
@@ -335,8 +306,6 @@ void Game::Tick(){
losedelay-=multiplier/6;
}
-
-
if(person[1].health>0&&person[0].health>0&&!killedinnocent)timeremaining-=multiplier*25/40;
if(timeremaining<=0){
@@ -361,8 +330,6 @@ void Game::Tick(){
alSourcePause(gSourceID[rainsound]);
-
-
alSourceStop(gSourceID[visionsound]);
alSourceStop(gSourceID[whichsong]);
@@ -387,8 +354,8 @@ void Game::Tick(){
highscore=score;
-#ifdef OS9
- ofstream opstream(":Data:Highscore");
+#ifdef OS9
+ ofstream opstream(":Data:Highscore");
#else
/* TODO */
ofstream opstream("Data/Highscore");
@@ -467,48 +434,34 @@ void Game::Tick(){
}
-
-
unsigned char theKeyMap[16];
GetKeys( ( unsigned long * )theKeyMap );
-
-
//Sprites
sprites.DoStuff();
-
-
//Decals
decals.DoStuff();
-
-
//Facing
facing=0;
facing.z=-1;
-
-
facing=DoRotation(facing,-camera.rotation2,0,0);
facing=DoRotation(facing,0,0-camera.rotation,0);
-
-
flatfacing=facing;
flatfacing.y=0;
Normalise(&flatfacing);
-
-
if(IsKeyDown(theKeyMap, psychickey)&&!oldvisionkey){
oldvisionkey=1;
@@ -543,9 +496,7 @@ void Game::Tick(){
}
-
-
- person[0].playercoords=bodycoords;
+ person[0].playercoords=bodycoords;
person[0].oldplayercoords=bodycoords;
@@ -553,7 +504,7 @@ void Game::Tick(){
alSourcePlay(gSourceID[soulinsound]);
- alSourceStop(gSourceID[visionsound]);
+ alSourceStop(gSourceID[visionsound]);
alSourcef(gSourceID[knifesong], AL_PITCH, (ALfloat)(1));
@@ -593,8 +544,6 @@ void Game::Tick(){
}
-
-
if(IsKeyDown(theKeyMap, MAC_TAB_KEY)&&!tabkeydown&&debug){
thirdperson++;
@@ -605,14 +554,10 @@ void Game::Tick(){
}
-
-
if(!IsKeyDown(theKeyMap, MAC_TAB_KEY))
tabkeydown=0;
-
-
if(IsKeyDown(theKeyMap, aimkey)&&!aimtoggle){
person[0].aiming=1-person[0].aiming;
@@ -621,14 +566,10 @@ void Game::Tick(){
}
-
-
if(!IsKeyDown(theKeyMap, aimkey))
aimtoggle=0;
-
-
if(IsKeyDown(theKeyMap, MAC_R_KEY)&&!reloadtoggle){
if(person[0].reloads[person[0].whichgun]>0&&person[0].reloading<=0)person[0].ammo=-1;
@@ -637,14 +578,10 @@ void Game::Tick(){
}
-
-
if(!IsKeyDown(theKeyMap, MAC_R_KEY))
reloadtoggle=0;
-
-
if(IsKeyDown(theKeyMap, psychicaimkey)&&!slomokeydown&&slomo==0){
alSourcePlay(gSourceID[souloutsound]);
@@ -667,18 +604,12 @@ void Game::Tick(){
}
-
-
if(!IsKeyDown(theKeyMap, psychicaimkey))
slomokeydown=0;
-
-
//Mouse look
-
-
if((person[0].aimamount<=0&&person[0].targetanimation!=crouchanim)){
camera.rotation=camera.visrotation;
@@ -720,8 +651,6 @@ void Game::Tick(){
GetMouseRel(&mouseloc);
#endif
-
-
#if 0 // DDOI
oldmouserotation=(oldmouseloc.h/1.3888)*mousesensitivity;
@@ -732,8 +661,6 @@ void Game::Tick(){
mouserotation2=(mouseloc.v/1.3888)*mousesensitivity;
-
-
#if 0 // DDOI
if(abs(oldmouseloc.h-mouseloc.h)<400)camera.rotation+=mouserotation-oldmouserotation;
@@ -757,22 +684,16 @@ void Game::Tick(){
if(mouseloc.v<-200)camera.rotation2+=mouserotation2+(300/1.3888*mousesensitivity);
#endif
-
-
if(camera.rotation2>89){camera.rotation2=89;}
if(camera.rotation2<-89){camera.rotation2=-89;}
-
-
//Smooth
camera.rotation=(camera.oldoldrotation+((camera.rotation-camera.oldoldrotation)*.7+(camera.oldrotation-camera.oldoldrotation)*.3));
camera.rotation2=(camera.oldoldrotation2+((camera.rotation2-camera.oldoldrotation2)*.7+(camera.oldrotation2-camera.oldoldrotation2)*.3));
-
-
if(camera.visrotation<camera.rotation-7)camera.visrotation=camera.rotation-7;
if(camera.visrotation>camera.rotation+7)camera.visrotation=camera.rotation+7;
@@ -781,8 +702,6 @@ void Game::Tick(){
if(camera.visrotation2>camera.rotation2+15)camera.visrotation2=camera.rotation2+15;
-
-
if(zoom||person[0].aimamount<=0||person[0].whichgun==nogun||visions||person[0].whichgun==grenade||person[0].whichgun==knife){
camera.visrotation=camera.rotation;
@@ -793,8 +712,6 @@ void Game::Tick(){
oldzoom=zoom;
-
-
camera.oldoldrotation=camera.oldrotation;
camera.oldoldrotation2=camera.oldrotation2;
@@ -803,12 +720,8 @@ void Game::Tick(){
camera.oldrotation2=camera.rotation2;
-
-
//Check collision with buildings
-
-
int beginx,endx;
int beginz,endz;
@@ -831,21 +744,15 @@ void Game::Tick(){
bool inblock;
-
-
-
-
person[0].playerrotation=180-camera.rotation;
-
-
//Check people collisions
for(int k=0;k<numpeople;k++){
// SBF - backing up the old coordinates makes
// the most sense here.
person[k].oldplayercoords=person[k].playercoords;
-
+
person[k].DoStuff(k);
if(person[k].skeleton.free<1){
@@ -862,8 +769,6 @@ void Game::Tick(){
underpoint.y-=3000;
-
-
beginx=(person[k].playercoords.x+block_spacing/2)/block_spacing;
if(beginx<0)beginx=0;
@@ -872,8 +777,6 @@ void Game::Tick(){
if(beginz<0)beginz=0;
-
-
endx=(person[k].playercoords.x+block_spacing/2)/block_spacing+1;
if(endx>num_blocks-1)endx=num_blocks-1;
@@ -882,8 +785,6 @@ void Game::Tick(){
if(endz>num_blocks-1)endz=num_blocks-1;
-
-
if(k!=0){
/* TODO: huh? */
beginx==person[k].whichblockx;
@@ -896,8 +797,6 @@ void Game::Tick(){
}
-
-
if(beginx<=endx&&beginz<=endz)
for(int i=beginx;i<=endx;i++)
@@ -1047,8 +946,6 @@ void Game::Tick(){
}
-
-
if(IsKeyDown( theKeyMap, MAC_SPACE_KEY )){
if(visions==0&&person[0].targetanimation==joganim&&person[0].currentanimation==joganim&&person[0].backwardsanim==0&&person[0].playerrotation==person[0].playerlowrotation){
@@ -1065,8 +962,6 @@ void Game::Tick(){
}
-
-
//Camera
camera.oldposition=camera.position;
@@ -1075,10 +970,6 @@ void Game::Tick(){
camera.targetoffset.z=-5;
-
-
-
-
//Spawn people
spawndelay-=multiplier;
@@ -1103,7 +994,7 @@ void Game::Tick(){
}
- if(cyclenum<10){
+ if(cyclenum<10){
if(spawndelay<0&&numpeople<max_people){
@@ -1121,8 +1012,6 @@ void Game::Tick(){
}
-
-
if(person[numpeople].type!=civiliantype&&blockspawnx==person[1].whichblockx&&blockspawny==person[1].whichblocky){
while((citypeoplenum[blockspawnx][blockspawny]>=max_people_block&&cyclenum<10)||blockspawnx==0||(blockspawnx==person[1].whichblockx&&blockspawny==person[1].whichblocky)){
@@ -1137,22 +1026,14 @@ void Game::Tick(){
}
-
-
person[numpeople].playerrotation=0;
-
-
person[numpeople].whichcostume=casualcostumes+abs(Random())%numcasual;
-
-
person[numpeople].whichblockx=blockspawnx;
person[numpeople].whichblocky=blockspawny;
-
-
person[numpeople].pathnum=-1;
person[numpeople].oldpathnum=-1;
@@ -1169,7 +1050,7 @@ void Game::Tick(){
person[numpeople].pathtarget.x=path.vertex[person[numpeople].pathnum].x;
- person[numpeople].pathtarget.z=path.vertex[person[numpeople].pathnum].z;
+ person[numpeople].pathtarget.z=path.vertex[person[numpeople].pathnum].z;
person[numpeople].pathsize=.98+float(abs(Random()%20))/400;
@@ -1179,18 +1060,12 @@ void Game::Tick(){
person[numpeople].pathtarget.z+=person[numpeople].whichblocky*block_spacing;
-
-
-
-
person[numpeople].playercoords=person[numpeople].pathtarget;
person[numpeople].oldplayercoords=person[numpeople].playercoords;
person[numpeople].skeleton.free=0;
-
-
person[numpeople].targetanimation=walkanim;
if(person[numpeople].type==zombietype)person[numpeople].targetanimation=zombiewalkanim;
@@ -1201,48 +1076,30 @@ void Game::Tick(){
person[numpeople].speedmult=.8+float(abs(Random()%20))/50;
- person[numpeople].health=100;
+ person[numpeople].health=100;
- person[numpeople].maxhealth=100;
+ person[numpeople].maxhealth=100;
person[numpeople].playerrotation2=0;
-
-
person[numpeople].lastdistancevictim=200000;
-
-
if(person[numpeople].skeleton.broken)person[numpeople].skeleton.Load((char *)":Data:Skeleton:Basic Figure");
-
-
if(numpeople==1)person[numpeople].type=viptype;
-
-
person[numpeople].killtarget=-1;
-
-
if(person[numpeople].type==eviltype){person[numpeople].existing=1; person[numpeople].pathsize=1.04; person[numpeople].whichgun=nogun; person[numpeople].aiming=1; person[numpeople].killtarget=-1; person[numpeople].speedmult=1+.3*difficulty;}
if(person[numpeople].type==zombietype){person[numpeople].existing=1; person[numpeople].pathsize=1.04; person[numpeople].whichgun=nogun; person[numpeople].aiming=0; person[numpeople].killtarget=-1; person[numpeople].speedmult=0.7+.2*difficulty;}
else {person[numpeople].whichgun=nogun; person[numpeople].aiming=0; person[numpeople].killtarget=-1;}
-
-
if(person[numpeople].type==viptype){person[numpeople].existing=1;}
-
-
-
-
if(enemystate==2)person[numpeople].killtarget=1;
-
-
numpeople++;
citypeoplenum[blockspawnx][blockspawny]++;
@@ -1299,20 +1156,14 @@ void Game::Tick(){
person[cycle].playerrotation=0;
-
-
person[cycle].whichcostume=casualcostumes+abs(Random())%numcasual;
-
-
citypeoplenum[person[cycle].whichblockx][person[cycle].whichblocky]--;
person[cycle].whichblockx=blockspawnx;
person[cycle].whichblocky=blockspawny;
-
-
person[cycle].pathnum=-1;
person[cycle].oldpathnum=-1;
@@ -1329,7 +1180,7 @@ void Game::Tick(){
person[cycle].pathtarget.x=path.vertex[person[cycle].pathnum].x;
- person[cycle].pathtarget.z=path.vertex[person[cycle].pathnum].z;
+ person[cycle].pathtarget.z=path.vertex[person[cycle].pathnum].z;
person[cycle].pathsize=.98+float(abs(Random()%20))/400;
@@ -1339,16 +1190,12 @@ void Game::Tick(){
person[cycle].pathtarget.z+=person[cycle].whichblocky*block_spacing;
-
-
person[cycle].playercoords=person[cycle].pathtarget;
person[cycle].oldplayercoords=person[cycle].playercoords;
person[cycle].skeleton.free=0;
-
-
person[cycle].targetanimation=walkanim;
if(person[cycle].type==zombietype)person[cycle].targetanimation=zombiewalkanim;
@@ -1365,48 +1212,32 @@ void Game::Tick(){
person[cycle].playerrotation2=0;
-
-
if(person[cycle].skeleton.broken)person[cycle].skeleton.Load((char *)":Data:Skeleton:Basic Figure");
-
-
if(enemystate==1)person[cycle].killtarget=-1;
-
-
if(person[cycle].type==eviltype){person[cycle].existing=1; person[cycle].pathsize=1.04; person[cycle].whichgun=nogun; person[cycle].aiming=1; person[cycle].killtarget=-1; person[cycle].speedmult=1+.3*difficulty;}
if(person[cycle].type==zombietype){person[cycle].existing=1; person[cycle].pathsize=1.04; person[cycle].whichgun=nogun; person[cycle].aiming=0; person[cycle].killtarget=-1; person[cycle].speedmult=.7+.2*difficulty;}
else {person[cycle].whichgun=nogun; person[cycle].aiming=0; person[cycle].killtarget=-1;}
-
-
person[cycle].lastdistancevictim=200000;
-
-
if(enemystate==2)person[cycle].killtarget=1;
-
-
if(numpeople<max_people)numpeople++;
citypeoplenum[blockspawnx][blockspawny]++;
cycle++;
-
-
spawndelay=.1;
}
}}
-
-
XYZ towards;
XYZ finaltarget;
@@ -1417,22 +1248,14 @@ void Game::Tick(){
float leastdistance = 0.0;
-
-
-
-
XYZ bleedloc;
XYZ vel;
-
-
float tooclose;
float toofar;
-
-
//People
for(int i=0;i<numpeople;i++){
@@ -1539,8 +1362,6 @@ void Game::Tick(){
}
-
-
if(person[i].maxhealth<100&&person[i].type==zombietype){
person[i].maxhealth+=multiplier*2;
@@ -1675,14 +1496,10 @@ void Game::Tick(){
person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[rightshoulder]].locked=0;
-
-
person[person[i].killtarget].longdead=1;
}
-
-
if(i>0&&enemystate!=1&&person[i].type==zombietype&&person[i].speedmult>.7){
if(findDistancefast(person[i].playercoords,person[1].playercoords)<20000)person[i].killtarget=1;
@@ -1697,8 +1514,6 @@ void Game::Tick(){
}
-
-
bool realcheck = false;
//Pathfinding
@@ -1711,7 +1526,7 @@ void Game::Tick(){
// b) we're moving away from our target
realcheck=(abs(person[i].playercoords.x-person[i].pathtarget.x)<1&&abs(person[i].playercoords.z-person[i].pathtarget.z)<1)
||findDistancefast(person[i].playercoords,person[i].pathtarget)>findDistancefast(person[i].oldplayercoords,person[i].pathtarget);
-
+
if(person[i].targetanimation==idleanim&&person[i].killtargetvisible==0){
person[i].targetanimation=walkanim;
@@ -1736,9 +1551,9 @@ void Game::Tick(){
person[i].pathtarget.x=path.vertex[j].x;
- person[i].pathtarget.z=path.vertex[j].z;
+ person[i].pathtarget.z=path.vertex[j].z;
- person[i].pathtarget.y=path.vertex[j].y;
+ person[i].pathtarget.y=path.vertex[j].y;
person[i].pathtarget*=person[i].pathsize;
@@ -1752,7 +1567,7 @@ void Game::Tick(){
closesttarget=j;
- }
+ }
}
@@ -1768,7 +1583,7 @@ void Game::Tick(){
person[i].pathtarget.x=path.vertex[person[i].pathnum].x;
- person[i].pathtarget.z=path.vertex[person[i].pathnum].z;
+ person[i].pathtarget.z=path.vertex[person[i].pathnum].z;
person[i].pathtarget*=person[i].pathsize;
@@ -1796,8 +1611,6 @@ void Game::Tick(){
person[i].killtarget=1;
-
-
//If pathfind
if(realcheck){
@@ -1824,8 +1637,6 @@ void Game::Tick(){
if(beginz<0)beginz=0;
-
-
endx=person[i].whichblockx+2;
if(endx>num_blocks-1)endx=num_blocks-1;
@@ -1834,8 +1645,6 @@ void Game::Tick(){
if(endz>num_blocks-1)endz=num_blocks-1;
-
-
leastdistance=2000000;
for(int l=beginx;l<=endx;l++){
@@ -1848,7 +1657,7 @@ void Game::Tick(){
person[i].pathtarget.y=path.vertex[j].y;
- person[i].pathtarget.z=path.vertex[j].z;
+ person[i].pathtarget.z=path.vertex[j].z;
person[i].pathtarget*=person[i].pathsize;
@@ -1958,8 +1767,6 @@ void Game::Tick(){
}
-
-
//If pathfind
if(realcheck){
@@ -1976,9 +1783,9 @@ void Game::Tick(){
person[i].pathtarget.x=path.vertex[j].x;
- person[i].pathtarget.z=path.vertex[j].z;
+ person[i].pathtarget.z=path.vertex[j].z;
- person[i].pathtarget.y=path.vertex[j].y;
+ person[i].pathtarget.y=path.vertex[j].y;
person[i].pathtarget*=person[i].pathsize;
@@ -1996,7 +1803,7 @@ void Game::Tick(){
finaltarget=person[i].pathtarget;
- }
+ }
}
@@ -2006,9 +1813,9 @@ void Game::Tick(){
person[i].pathtarget.x=path.vertex[j].x;
- person[i].pathtarget.z=path.vertex[j].z;
+ person[i].pathtarget.z=path.vertex[j].z;
- person[i].pathtarget.y=path.vertex[j].y;
+ person[i].pathtarget.y=path.vertex[j].y;
person[i].pathtarget*=person[i].pathsize;
@@ -2026,7 +1833,7 @@ void Game::Tick(){
finaltarget=person[i].pathtarget;
- }
+ }
}
@@ -2042,8 +1849,6 @@ void Game::Tick(){
if(beginz<0)beginz=0;
-
-
endx=person[i].whichblockx+2;
if(endx>num_blocks-1)endx=num_blocks-1;
@@ -2052,8 +1857,6 @@ void Game::Tick(){
if(endz>num_blocks-1)endz=num_blocks-1;
-
-
leastdistance=2000000;
for(int l=beginx;l<=endx;l++){
@@ -2068,7 +1871,7 @@ void Game::Tick(){
person[i].pathtarget.y=path.vertex[j].y;
- person[i].pathtarget.z=path.vertex[j].z;
+ person[i].pathtarget.z=path.vertex[j].z;
person[i].pathtarget*=person[i].pathsize;
@@ -2132,8 +1935,6 @@ void Game::Tick(){
if(beginz<0)beginz=0;
-
-
endx=person[i].whichblockx+2;
if(endx>num_blocks-1)endx=num_blocks-1;
@@ -2142,8 +1943,6 @@ void Game::Tick(){
if(endz>num_blocks-1)endz=num_blocks-1;
-
-
for(int l=beginx;l<=endx;l++){
for(int m=beginx;m<=endx;m++){
@@ -2366,14 +2165,12 @@ void Game::Tick(){
if(person[i].killtargetvisible||realcheck)person[i].pathtarget=finaltarget;
- if(realcheck)person[i].lastdistancevictim=findDistancefast(person[i].pathtarget,person[person[i].killtarget].playercoords);
+ if(realcheck)person[i].lastdistancevictim=findDistancefast(person[i].pathtarget,person[person[i].killtarget].playercoords);
}
}
-
-
if(person[i].targetanimation!=zombieeatanim||person[i].type!=zombietype){
towards=person[i].playercoords-person[i].pathtarget;
@@ -2394,8 +2191,6 @@ void Game::Tick(){
person[i].whichblocky=((person[i].playercoords.z+block_spacing/2)/block_spacing);
-
-
if(!person[i].onground)person[i].velocity.y+=multiplier*gravity;
if(!person[i].onground&&(i!=0||visions!=1))person[i].playercoords+=person[i].velocity*multiplier;
@@ -2534,8 +2329,6 @@ void Game::Tick(){
}
-
-
//Grenade
if(Button()&&person[0].whichgun==grenade&&person[0].ammo>0&&person[0].reloading<=0&&person[0].attackframe<0&&person[0].targetanimation!=crouchanim){
@@ -2602,8 +2395,6 @@ void Game::Tick(){
}
-
-
//Get gun
int temp;
@@ -2626,14 +2417,10 @@ void Game::Tick(){
gLoc[2]=person[0].playercoords.z/soundscalefactor;
-
-
alSourcefv(gSourceID[clicksound], AL_POSITION, gLoc);
alSourcePlay(gSourceID[clicksound]);
-
-
temp=person[0].whichgun;
temp2=person[0].ammo;
@@ -2650,8 +2437,6 @@ void Game::Tick(){
person[0].aimamount=0;
-
-
switched=1;
}
@@ -2660,8 +2445,6 @@ void Game::Tick(){
}
-
-
//Throw
if(Button()&&person[0].attackframe<0&&((person[0].whichgun==nogun||person[0].aiming==0)&&person[0].whichgun!=knife)&&person[0].currentanimation!=crouchanim&&person[0].targetanimation!=crouchanim&&person[0].targetanimation!=throwanim&&visions==0){
@@ -2674,7 +2457,7 @@ void Game::Tick(){
float closedistance=-1;
- for(int i=1;i<numpeople;i++){
+ for(int i=1;i<numpeople;i++){
if(person[i].skeleton.free<1&&(person[i].whichgun!=nogun)&&findDistancefast(person[i].playercoords,person[0].playercoords+flatfacing)<12){
@@ -2734,8 +2517,6 @@ void Game::Tick(){
}
-
-
//Gun whacking
if(Button()&&(person[0].aiming==0||person[0].ammo<=0||person[0].whichgun==nogun||person[0].whichgun==knife||person[0].targetanimation==joganim)&&person[0].currentanimation!=crouchanim&&person[0].targetanimation!=throwanim&&person[0].whichgun!=grenade&&person[0].targetanimation!=crouchanim&&visions==0){
@@ -2748,7 +2529,7 @@ void Game::Tick(){
float closedistance=-1;
- for(int i=1;i<numpeople;i++){
+ for(int i=1;i<numpeople;i++){
if(person[i].existing&&person[i].type!=viptype&&person[i].skeleton.free<1&&findDistancefast(person[i].playercoords,person[0].playercoords+flatfacing)<12+(person[0].whichgun==knife)*10){
@@ -2780,12 +2561,8 @@ void Game::Tick(){
}
-
-
XYZ velocity;
-
-
if(person[0].attackframe>1||(person[0].attackframe>=0&&person[0].currentanimation==joganim)){
if(person[person[0].killtarget].skeleton.free<1&&person[0].killtarget!=0&&(person[0].aiming<1||person[0].whichgun==nogun||person[0].whichgun==knife||person[0].targetanimation==joganim)){
@@ -2840,7 +2617,7 @@ void Game::Tick(){
sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.2, 3);
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
}
@@ -2924,7 +2701,7 @@ void Game::Tick(){
sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.2, 3);
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
}
@@ -2970,13 +2747,11 @@ void Game::Tick(){
}
-
-
//Tackle
if(person[0].currentanimation==diveanim&&visions==0){
- for(int i=1;i<numpeople;i++){
+ for(int i=1;i<numpeople;i++){
if(person[i].skeleton.free<1&&findDistancefast(person[i].playercoords,person[0].playercoords+flatfacing)<22){
@@ -3022,8 +2797,6 @@ void Game::Tick(){
}
-
-
//Fire/wing
XYZ wallhit;
@@ -3094,8 +2867,6 @@ void Game::Tick(){
gLoc[2]=person[0].playercoords.z/soundscalefactor;
-
-
alSourcefv(gSourceID[clicksound], AL_POSITION, gLoc);
alSourcePlay(gSourceID[clicksound]);
@@ -3124,8 +2895,6 @@ void Game::Tick(){
if(person[person[j].killtarget].skeleton.free==1)inaccuracy*=3;
-
-
person[j].shotdelay=shotdelayamount/difficulty;
if(person[j].aiming>=1&&person[j].recoil<=0){
@@ -3198,12 +2967,8 @@ void Game::Tick(){
float gLoc[3];
-
-
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*.35;
-
-
gLoc[0]=(camera.position.x+(start.x-camera.position.x)/4)/soundscalefactor;
gLoc[1]=(camera.position.y+(start.y-camera.position.y)/4)/soundscalefactor;
@@ -3230,12 +2995,8 @@ void Game::Tick(){
float gLoc[3];
-
-
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*.35;
-
-
if(p==numshots-1){
gLoc[0]=(camera.position.x+(start.x-camera.position.x)/4)/soundscalefactor;
@@ -3266,12 +3027,8 @@ void Game::Tick(){
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*.55;
-
-
float gLoc[3];
-
-
gLoc[0]=(camera.position.x+(start.x-camera.position.x)/4)/soundscalefactor;
gLoc[1]=(camera.position.y+(start.y-camera.position.y)/4)/soundscalefactor;
@@ -3298,12 +3055,8 @@ void Game::Tick(){
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*.55;
-
-
float gLoc[3];
-
-
gLoc[0]=(camera.position.x+(start.x-camera.position.x)/4)/soundscalefactor;
gLoc[1]=(camera.position.y+(start.y-camera.position.y)/4)/soundscalefactor;
@@ -3330,8 +3083,6 @@ void Game::Tick(){
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*.25;
-
-
float gLoc[3];
gLoc[0]=(camera.position.x+(start.x-camera.position.x)/4)/soundscalefactor;
@@ -3396,7 +3147,7 @@ void Game::Tick(){
if(i!=j&&i!=firstpass&&person[i].existing){
- temphitstruct=person[i].BulletCollideWithPlayer(i, start, end);
+ temphitstruct=person[i].BulletCollideWithPlayer(i, start, end);
if(temphitstruct.collision){
@@ -3432,8 +3183,6 @@ void Game::Tick(){
if(beginz<0)beginz=0;
-
-
endx=(person[j].playercoords.x+block_spacing/2)/block_spacing+3;
if(endx>num_blocks-1)endx=num_blocks-1;
@@ -3442,8 +3191,6 @@ void Game::Tick(){
if(endz>num_blocks-1)endz=num_blocks-1;
-
-
if(beginx<endx&&beginz<endz)
finalwallhit=0;
@@ -3664,8 +3411,6 @@ void Game::Tick(){
person[whichhit].longdead=1;
-
-
if(person[whichhit].health<=0){
person[whichhit].skeleton.offset=0;
@@ -3814,8 +3559,6 @@ void Game::Tick(){
}
-
-
XYZ velocity;
velocity=aim*-8;
@@ -3854,8 +3597,6 @@ void Game::Tick(){
}
-
-
person[whichhit].bjoint1=hitstruct.joint1;
person[whichhit].bjoint2=hitstruct.joint2;
@@ -3976,7 +3717,7 @@ void Game::Tick(){
if(j!=0||zoom==0)sprites.MakeSprite(bullet, .07, 1, 1, .7, lastshot[0]+aim*1, lastshot[1], .2);
- //Nearby bullet whoosh
+ //Nearby bullet whoosh
long dot_ta,dot_tb;
@@ -3998,8 +3739,6 @@ void Game::Tick(){
if (!dot_ta <= 0&&!dot_tb <= 0){
-
-
nearest.x = a->x + ((b->x - a->x) * dot_ta)/(dot_ta + dot_tb);
nearest.y = a->y + ((b->y - a->y) * dot_ta)/(dot_ta +dot_tb);
@@ -4008,16 +3747,12 @@ void Game::Tick(){
}
-
-
if(nearest.x){
if(findDistancefast(nearest,camera.position)<10&&(thirdperson==2||j!=0)){
float gLoc[3];
-
-
gLoc[0]=(camera.position.x+(nearest.x-camera.position.x))/soundscalefactor;
gLoc[1]=(camera.position.y+(nearest.y-camera.position.y))/soundscalefactor;
@@ -4046,12 +3781,8 @@ void Game::Tick(){
}
-
-
if(!Button())oldbutton=0;
-
-
if(lasersight&&person[0].whichgun!=grenade){
for(int j=0;j<numpeople;j++){
@@ -4154,8 +3885,6 @@ void Game::Tick(){
if(beginz<0)beginz=0;
-
-
endx=(person[j].playercoords.x+block_spacing/2)/block_spacing+2;
if(endx>num_blocks-1)endx=num_blocks-1;
@@ -4164,8 +3893,6 @@ void Game::Tick(){
if(endz>num_blocks-1)endz=num_blocks-1;
-
-
if(beginx<endx&&beginz<endz)
finalwallhit=0;
@@ -4216,7 +3943,7 @@ void Game::Tick(){
if(i!=j&&findDistancefast(person[j].playercoords,person[i].playercoords)<20000){
- temphitstruct=person[i].BulletCollideWithPlayer(i, start, end);
+ temphitstruct=person[i].BulletCollideWithPlayer(i, start, end);
if(temphitstruct.collision){
@@ -4246,8 +3973,6 @@ void Game::Tick(){
sprites.MakeSprite(bulletinstant, .4, 1, 0, 0, aimer[0], aimer[1], .2);
-
-
}
}
@@ -4256,8 +3981,6 @@ void Game::Tick(){
}
-
-
//Snow
snowdelay-=multiplier;
@@ -4300,9 +4023,7 @@ void Game::Tick(){
sprites.MakeSprite(rainsprite, .5, 1, 1, 1, start, velocity, 2.00);
- }
-
-
+ }
//Grenade collision
@@ -4322,8 +4043,6 @@ void Game::Tick(){
}
-
-
if(findLengthfast(sprites.velocity[i])>0){
wherex=(sprites.location[i].x+block_spacing/2)/block_spacing;
@@ -4366,7 +4085,7 @@ void Game::Tick(){
alSourcefv(gSourceID[bouncesound+whichsound], AL_POSITION, gLoc);
- if(sprites.size[i]<=1)alSourcePlay(gSourceID[bouncesound+whichsound]);
+ if(sprites.size[i]<=1)alSourcePlay(gSourceID[bouncesound+whichsound]);
}
@@ -4414,7 +4133,7 @@ void Game::Tick(){
alSourcefv(gSourceID[bouncesound+whichsound], AL_POSITION, gLoc);
- if(sprites.size[i]<=1)alSourcePlay(gSourceID[bouncesound+whichsound]);
+ if(sprites.size[i]<=1)alSourcePlay(gSourceID[bouncesound+whichsound]);
}
@@ -4430,7 +4149,7 @@ void Game::Tick(){
if((j!=0||sprites.brightness[i]<.9)&&person[j].existing){
- hitstruct=person[j].BulletCollideWithPlayer(j, sprites.oldlocation[i], sprites.location[i]);
+ hitstruct=person[j].BulletCollideWithPlayer(j, sprites.oldlocation[i], sprites.location[i]);
if(hitstruct.collision){
@@ -4622,9 +4341,9 @@ void Game::Tick(){
//}
- for(int k=0;k<numpeople;k++){
+ for(int k=0;k<numpeople;k++){
- if(person[k].existing&&(person[k].longdead!=-1||person[k].skeleton.free<1)){
+ if(person[k].existing&&(person[k].longdead!=-1||person[k].skeleton.free<1)){
if((findDistancefast(person[k].playercoords,sprites.location[i])<700&&person[k].skeleton.free<1)||(findDistancefast(person[k].averageloc,sprites.location[i])<700&&person[k].skeleton.free>=1)){
@@ -4650,18 +4369,12 @@ void Game::Tick(){
person[k].longdead=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;j<person[k].skeleton.num_joints;j++){
person[k].skeleton.joints[j].position=DoRotation(person[k].skeleton.joints[j].position,0,person[k].playerrotation,0);
@@ -4722,8 +4435,6 @@ void Game::Tick(){
}
-
-
}
}
@@ -4732,16 +4443,12 @@ void Game::Tick(){
}
-
-
//camera shake
camerashake-=multiplier;
if(camerashake<0)camerashake=0;
-
-
//camera position
XYZ average;
@@ -4750,20 +4457,14 @@ void Game::Tick(){
if(zoom)average=person[0].skeleton.joints[(person[0].skeleton.jointlabels[righthand])].position;
-
-
if(person[0].skeleton.free==0&&thirdperson!=2)camera.position=person[0].playercoords+DoRotation(average,0,person[0].playerrotation,0);
if(person[0].skeleton.free==1&&thirdperson!=2)camera.position=average;
-
-
//Restraints
if(camera.position.y<.1)camera.position.y=.1;
-
-
if(thirdperson!=2){
oldrot=camera.visrotation;
@@ -4772,27 +4473,25 @@ void Game::Tick(){
}
-
-
//Kill count
for(int i=0;i<numpeople;i++){
if(person[i].oldhealth>0&&person[i].health<=0){
- if(i==1)alSourcePlay(gSourceID[losesound]);
+ if(i==1)alSourcePlay(gSourceID[losesound]);
if(person[i].type==civiliantype){
alSourcePlay(gSourceID[disguisekillsound]);
- score-=300;
+ score-=300;
}
if(person[i].type==eviltype){
- alSourcePlay(gSourceID[soulinsound]);
+ alSourcePlay(gSourceID[soulinsound]);
score+=75;
@@ -4808,8 +4507,6 @@ void Game::Tick(){
}
-
-
if(slomo==2){
psychicpower-=multiplier*15;
@@ -4856,8 +4553,6 @@ void Game::Tick(){
if(psychicpower>10)psychicpower=10;
-
-
//3d sound
float gLoc[3];
@@ -4871,8 +4566,6 @@ void Game::Tick(){
alListenerfv(AL_POSITION, gLoc);
-
-
//Set orientation with forward and up vectors
XYZ upvector;
@@ -4881,14 +4574,10 @@ void Game::Tick(){
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;
@@ -4905,8 +4594,6 @@ void Game::Tick(){
alListenerfv(AL_ORIENTATION, ori);
-
-
if(person[0].currentanimation==throwanim||person[0].currentanimation==diveanim||paused){
MoveMouse(oldmouseloc.h,oldmouseloc.v,&mouseloc);
@@ -4917,10 +4604,7 @@ void Game::Tick(){
oldmouseloc=mouseloc;
-
-
if(score<0)score=0;
}
-
}