- 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];
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;
deletesprite(i);
@ -715,8 +715,8 @@ void movecrane(int i, int crane)
{
auto p = findplayer(s, &x);
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
if (ps[p].on_crane == i)
ps[p].on_crane = -1;
if (ps[p].on_crane == &hittype[i])
ps[p].on_crane = nullptr;
}
t[0]++;
s->owner = -1;
@ -733,7 +733,7 @@ void movecrane(int i, int crane)
if (p >= 0 && ps[p].on_ground)
{
s->owner = -2;
ps[p].on_crane = i;
ps[p].on_crane = &hittype[i];
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
ps[p].angle.addadjustment(s->ang + 1024);
}
@ -802,8 +802,8 @@ void movecrane(int i, int crane)
if (j >= 0)
{
if (s->owner == -2)
if (ps[p].on_crane == i)
ps[p].on_crane = -1;
if (ps[p].on_crane == &hittype[i])
ps[p].on_crane = nullptr;
s->owner = -1;
s->picnum = crane;
return;

View file

@ -403,7 +403,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
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);
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;
}
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);
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;
case PLAYER_ON_CRANE:
if (bSet) ps[iPlayer].on_crane = lValue;
else SetGameVarID((int)lVar2, ps[iPlayer].on_crane, sActor, sPlayer);
if (bSet) ps[iPlayer].on_crane = ScriptIndexToActor(lValue);
else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].on_crane), sActor, sPlayer);
break;
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].wantweaponfire = -1;
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].horizon.ohorizoff = ps[g_p].horizon.horizoff = q16horiz(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);
OnEvent(EVENT_TURNAROUND, -1, snum, -1);
@ -827,7 +827,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
}
else
{
if (p->on_crane < 0)
if (p->on_crane == nullptr)
{
if (!vehicle)
{
@ -843,7 +843,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
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()
loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL);

View file

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

View file

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

View file

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

View file

@ -152,7 +152,7 @@ void resetplayerstats(int snum)
p->somethingonplayer =-1;
p->angle.spin = bamlook(0);
p->on_crane = -1;
p->on_crane = nullptr;
if(p->curr_weapon == PISTOL_WEAPON)
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 ftq, access_wallnum, access_spritenum;
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 cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick;
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;
unsigned int interface_toggle_flag;