- made on_crane a pointer as well.

This commit is contained in:
Christoph Oelckers 2020-10-17 10:44:00 +02:00
parent 7c88de0b42
commit d7604a3160
10 changed files with 20 additions and 20 deletions

View file

@ -369,7 +369,7 @@ void movedummyplayers(void)
auto hti = &hittype[i]; auto hti = &hittype[i];
p = sprite[spri->owner].yvel; p = sprite[spri->owner].yvel;
if ((!isRR() && ps[p].on_crane >= 0) || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0) if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0)
{ {
ps[p].dummyplayersprite = -1; ps[p].dummyplayersprite = -1;
deletesprite(i); deletesprite(i);
@ -715,8 +715,8 @@ void movecrane(int i, int crane)
{ {
auto p = findplayer(s, &x); auto p = findplayer(s, &x);
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i); S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
if (ps[p].on_crane == i) if (ps[p].on_crane == &hittype[i])
ps[p].on_crane = -1; ps[p].on_crane = nullptr;
} }
t[0]++; t[0]++;
s->owner = -1; s->owner = -1;
@ -733,7 +733,7 @@ void movecrane(int i, int crane)
if (p >= 0 && ps[p].on_ground) if (p >= 0 && ps[p].on_ground)
{ {
s->owner = -2; s->owner = -2;
ps[p].on_crane = i; ps[p].on_crane = &hittype[i];
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i); S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
ps[p].angle.addadjustment(s->ang + 1024); ps[p].angle.addadjustment(s->ang + 1024);
} }
@ -802,8 +802,8 @@ void movecrane(int i, int crane)
if (j >= 0) if (j >= 0)
{ {
if (s->owner == -2) if (s->owner == -2)
if (ps[p].on_crane == i) if (ps[p].on_crane == &hittype[i])
ps[p].on_crane = -1; ps[p].on_crane = nullptr;
s->owner = -1; s->owner = -1;
s->picnum = crane; s->picnum = crane;
return; return;

View file

@ -403,7 +403,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
goto PALONLY; goto PALONLY;
} }
if (ps[p].on_crane == -1 && (sector[s->sectnum].lotag & 0x7ff) != 1) if (ps[p].on_crane == nullptr && (sector[s->sectnum].lotag & 0x7ff) != 1)
{ {
l = s->z - hittype[ps[p].i].floorz + (3 << 8); l = s->z - hittype[ps[p].i].floorz + (3 << 8);
if (l > 1024 && s->yrepeat > 32 && s->extra > 0) if (l > 1024 && s->yrepeat > 32 && s->extra > 0)

View file

@ -454,7 +454,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
goto PALONLY; goto PALONLY;
} }
if (ps[p].on_crane == -1 && (sector[s->sectnum].lotag & 0x7ff) != 1) if (ps[p].on_crane == nullptr && (sector[s->sectnum].lotag & 0x7ff) != 1)
{ {
l = s->z - hittype[ps[p].i].floorz + (3 << 8); l = s->z - hittype[ps[p].i].floorz + (3 << 8);
if (l > 1024 && s->yrepeat > 32 && s->extra > 0) if (l > 1024 && s->yrepeat > 32 && s->extra > 0)

View file

@ -607,8 +607,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_ON_CRANE: case PLAYER_ON_CRANE:
if (bSet) ps[iPlayer].on_crane = lValue; if (bSet) ps[iPlayer].on_crane = ScriptIndexToActor(lValue);
else SetGameVarID((int)lVar2, ps[iPlayer].on_crane, sActor, sPlayer); else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].on_crane), sActor, sPlayer);
break; break;
case PLAYER_I: // This is dangerous!!! case PLAYER_I: // This is dangerous!!!
@ -2259,7 +2259,7 @@ int ParseState::parse(void)
ps[g_p].last_extra = g_sp->extra = max_player_health; ps[g_p].last_extra = g_sp->extra = max_player_health;
ps[g_p].wantweaponfire = -1; ps[g_p].wantweaponfire = -1;
ps[g_p].horizon.ohoriz = ps[g_p].horizon.horiz = q16horiz(0); ps[g_p].horizon.ohoriz = ps[g_p].horizon.horiz = q16horiz(0);
ps[g_p].on_crane = -1; ps[g_p].on_crane = nullptr;
ps[g_p].frag_ps = g_p; ps[g_p].frag_ps = g_p;
ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = q16horiz(0); ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = q16horiz(0);
ps[g_p].opyoff = 0; ps[g_p].opyoff = 0;

View file

@ -477,7 +477,7 @@ void hud_input(int snum)
} }
} }
if (PlayerInput(snum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane < 0) if (PlayerInput(snum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane == nullptr)
{ {
SetGameVarID(g_iReturnVarID, 0, -1, snum); SetGameVarID(g_iReturnVarID, 0, -1, snum);
OnEvent(EVENT_TURNAROUND, -1, snum, -1); OnEvent(EVENT_TURNAROUND, -1, snum, -1);
@ -827,7 +827,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
} }
else else
{ {
if (p->on_crane < 0) if (p->on_crane == nullptr)
{ {
if (!vehicle) if (!vehicle)
{ {
@ -843,7 +843,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
loc.svel = input.svel = 0; loc.svel = input.svel = 0;
} }
if (p->on_crane < 0 && p->newowner == -1) if (p->on_crane == nullptr && p->newowner == -1)
{ {
// input.avel already added to loc in processMovement() // input.avel already added to loc in processMovement()
loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL); loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL);

View file

@ -2844,7 +2844,7 @@ void processinput_d(int snum)
checklook(snum,actions); checklook(snum,actions);
if (p->on_crane >= 0) if (p->on_crane != nullptr)
goto HORIZONLY; goto HORIZONLY;
playerweaponsway(p, s); playerweaponsway(p, s);

View file

@ -3701,7 +3701,7 @@ void processinput_r(int snum)
checklook(snum, actions); checklook(snum, actions);
if (p->on_crane >= 0) if (p->on_crane != nullptr)
goto HORIZONLY; goto HORIZONLY;
playerweaponsway(p, s); playerweaponsway(p, s);

View file

@ -212,7 +212,7 @@ void fakedomovethings(void)
doubvel = TICSPERFRAME; doubvel = TICSPERFRAME;
if(p->on_crane >= 0) goto FAKEHORIZONLY; if(p->on_crane != nullptr) goto FAKEHORIZONLY;
if(p->angle.spin.asbam() < 0) myang += 128; if(p->angle.spin.asbam() < 0) myang += 128;

View file

@ -152,7 +152,7 @@ void resetplayerstats(int snum)
p->somethingonplayer =-1; p->somethingonplayer =-1;
p->angle.spin = bamlook(0); p->angle.spin = bamlook(0);
p->on_crane = -1; p->on_crane = nullptr;
if(p->curr_weapon == PISTOL_WEAPON) if(p->curr_weapon == PISTOL_WEAPON)
p->okickback_pic = p->kickback_pic = isRR()? 22 : 5; p->okickback_pic = p->kickback_pic = isRR()? 22 : 5;

View file

@ -203,12 +203,12 @@ struct player_struct
short jumping_counter, airleft, knee_incs, access_incs; short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum, access_spritenum; short ftq, access_wallnum, access_spritenum;
short got_access, weapon_ang, firstaid_amount; short got_access, weapon_ang, firstaid_amount;
short somethingonplayer, on_crane, i, one_parallax_sectnum; short somethingonplayer, i, one_parallax_sectnum;
short over_shoulder_on, fist_incs; short over_shoulder_on, fist_incs;
short cheat_phase; short cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound; short heat_amount, timebeforeexit, customexitsound;
DDukeActor* actorsqu;//, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer; DDukeActor* actorsqu, *on_crane;//, *wackedbyactor, *holoduke_on, *somethingonplayer;
short weaprecs[256], weapreccnt; short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag; unsigned int interface_toggle_flag;