aboutsummaryrefslogtreecommitdiff
path: root/src/GameInitDispose.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-06-22 12:15:04 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-06-22 12:15:04 +0700
commitc639165380a56616e8dab4c09490f763d4da00c1 (patch)
tree27eb7d68fc360c4ed6b9823ce20d9bd17c7f4e1d /src/GameInitDispose.cpp
parent865c51c497f776cce046a04915563f730a54d411 (diff)
downloadblackshades-c639165380a56616e8dab4c09490f763d4da00c1.tar.gz
Give VIP a short hand
Zig build's crash point is somehow here but it seems irrelevant.
Diffstat (limited to 'src/GameInitDispose.cpp')
-rw-r--r--src/GameInitDispose.cpp77
1 files changed, 39 insertions, 38 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index c11f3c1..d99eeee 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -850,7 +850,6 @@ void Game::InitGame()
camera.position.z=num_blocks/2*block_spacing+block_spacing/2;
camera.position.y=30;
camera.oldposition=camera.position;
- numpeople=1;
//Setup path to walk around blocks
path.load((unsigned char *)":Data:Models:path.solid");
@@ -864,51 +863,53 @@ void Game::InitGame()
person[0].speedmult=1.3;
//Add vip
- person[numpeople].playerrotation=0;
- person[numpeople].whichcostume=vipcostume;
- person[numpeople].whichblockx=((person[0].playercoords.x+block_spacing/2)/block_spacing);
- person[numpeople].whichblocky=((person[0].playercoords.x+block_spacing/2)/block_spacing);
- person[numpeople].pathnum=-1;
- person[numpeople].oldpathnum=-1;
- person[numpeople].oldoldpathnum=-1;
- person[numpeople].oldoldoldpathnum=-1;
-
- while(person[numpeople].pathnum<0||person[numpeople].pathnum>=path.vertexNum||person[numpeople].pathnum==1){
- person[numpeople].pathnum=Random()%path.vertexNum;
- }
-
- person[numpeople].pathtarget.x=path.vertex[person[numpeople].pathnum].x;
- person[numpeople].pathtarget.z=path.vertex[person[numpeople].pathnum].z;
- person[numpeople].pathsize=.98+float(abs(Random()%20))/400;
- person[numpeople].pathtarget*=person[numpeople].pathsize;
- person[numpeople].pathtarget.x+=person[numpeople].whichblockx*block_spacing;
- person[numpeople].pathtarget.z+=person[numpeople].whichblocky*block_spacing;
- person[numpeople].playercoords=person[numpeople].pathtarget;
- person[numpeople].oldplayercoords=person[numpeople].playercoords;
-
- person[0].playercoords=person[numpeople].playercoords;
+ auto vip = person[1];
+ vip.playerrotation=0;
+ vip.whichcostume=vipcostume;
+ vip.whichblockx=((person[0].playercoords.x+block_spacing/2)/block_spacing);
+ vip.whichblocky=((person[0].playercoords.x+block_spacing/2)/block_spacing);
+ vip.pathnum=-1;
+ vip.oldpathnum=-1;
+ vip.oldoldpathnum=-1;
+ vip.oldoldoldpathnum=-1;
+
+ while (vip.pathnum < 0
+ || vip.pathnum >= path.vertexNum
+ || vip.pathnum == 1)
+ vip.pathnum = Random() % path.vertexNum;
+
+ vip.pathtarget.x=path.vertex[vip.pathnum].x;
+ vip.pathtarget.z=path.vertex[vip.pathnum].z;
+ vip.pathsize=.98+float(abs(Random()%20))/400;
+ vip.pathtarget*=vip.pathsize;
+ vip.pathtarget.x+=vip.whichblockx*block_spacing;
+ vip.pathtarget.z+=vip.whichblocky*block_spacing;
+ vip.playercoords=vip.pathtarget;
+ vip.oldplayercoords=vip.playercoords;
+
+ person[0].playercoords=vip.playercoords;
person[0].playercoords.x+=1;
person[0].playercoords.z+=1;
person[0].oldplayercoords=person[0].playercoords;
- person[numpeople].skeleton.free=0;
- person[numpeople].targetanimation=walkanim;
- person[numpeople].speed=1;
- person[numpeople].existing=0;
- person[numpeople].speedmult=1;
- if(type==zombie_type)person[numpeople].speedmult=.8;
+ vip.skeleton.free=0;
+ vip.targetanimation=walkanim;
+ vip.speed=1;
+ vip.existing=0;
+ vip.speedmult=1;
+ if(type==zombie_type)vip.speedmult=.8;
- person[numpeople].health=100;
- person[numpeople].playerrotation2=0;//20;
- person[numpeople].lastdistancevictim=200000;
+ vip.health=100;
+ vip.playerrotation2=0;//20;
+ vip.lastdistancevictim=200000;
- if(person[numpeople].skeleton.broken)person[numpeople].skeleton.Load((char *)":Data:Skeleton:Basic Figure");
+ if(vip.skeleton.broken)vip.skeleton.Load((char *)":Data:Skeleton:Basic Figure");
- person[numpeople].type=viptype;
- person[numpeople].whichgun=nogun; person[numpeople].aiming=0; person[numpeople].killtarget=-1;
- person[numpeople].existing=1;
+ vip.type=viptype;
+ vip.whichgun=nogun; vip.aiming=0; vip.killtarget=-1;
+ vip.existing=1;
- citypeoplenum[person[numpeople].whichblockx][person[numpeople].whichblocky]++;
+ citypeoplenum[vip.whichblockx][vip.whichblocky]++;
numpeople++;
spawndelay=.1;