- Duke: made player.i a real pointer

How could I overlook this one.
This commit is contained in:
Christoph Oelckers 2021-11-28 09:16:50 +01:00
parent d33ae89c4a
commit 75b36cbd1c
7 changed files with 7 additions and 13 deletions

View file

@ -12,12 +12,12 @@ using DukeLinearSpriteIterator = TLinearSpriteIterator<DDukeActor>;
inline DDukeActor* player_struct::GetActor()
{
return &hittype[i];
return actor;
}
inline int player_struct::GetPlayerNum()
{
return GetActor()->s->yvel;
return actor->s->yvel;
}
inline int ActorToScriptIndex(DDukeActor* a)

View file

@ -591,11 +591,6 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].on_crane), sActor, sPlayer);
break;
case PLAYER_I: // This is dangerous!!!
if (bSet) ps[iPlayer].i = lValue;
else SetGameVarID(lVar2, ps[iPlayer].i, sActor, sPlayer);
break;
case PLAYER_OVER_SHOULDER_ON:
if (bSet) ps[iPlayer].over_shoulder_on = lValue;
else SetGameVarID(lVar2, ps[iPlayer].over_shoulder_on, sActor, sPlayer);

View file

@ -1113,7 +1113,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, access_wall)
DEFINE_FIELD_X(DukePlayer, player_struct, got_access)
DEFINE_FIELD_X(DukePlayer, player_struct, weapon_ang)
DEFINE_FIELD_X(DukePlayer, player_struct, firstaid_amount)
DEFINE_FIELD_X(DukePlayer, player_struct, i)
DEFINE_FIELD_X(DukePlayer, player_struct, actor)
DEFINE_FIELD_X(DukePlayer, player_struct, one_parallax_sectnum)
DEFINE_FIELD_X(DukePlayer, player_struct, over_shoulder_on)
DEFINE_FIELD_X(DukePlayer, player_struct, fist_incs)

View file

@ -624,7 +624,7 @@ void resetpspritevars(int g)
else
s->pal = ps[j].palookup = ud.user_pals[j];
ps[j].i = act->GetSpriteIndex();
ps[j].actor = act;
ps[j].frag_ps = j;
act->SetOwner(act);

View file

@ -159,7 +159,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("firstaid_amount", w.firstaid_amount)
("somethingonplayer", w.somethingonplayer)
("on_crane", w.on_crane)
("i", w.i)
("i", w.actor)
("one_parallax_sectnum", w.one_parallax_sectnum)
("over_shoulder_on", w.over_shoulder_on)
("random_club_frame", w.random_club_frame)

View file

@ -216,6 +216,7 @@ struct player_struct
sectortype* cursector;
sectortype* one_parallax_sectnum; // wall + sector references. Make them pointers later?
walltype* access_wall;
DDukeActor* actor;
short last_extra, subweapon;
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
@ -225,7 +226,6 @@ struct player_struct
short jumping_counter, airleft, knee_incs, access_incs;
short ftq;
short got_access, weapon_ang, firstaid_amount;
short i;
short over_shoulder_on, fist_incs;
short cheat_phase;
short extra_extra8, quick_kick, last_quick_kick;

View file

@ -170,12 +170,11 @@ struct DukePlayer
native int16 jumping_counter, airleft, knee_incs, access_incs;
native int16 ftq;
native int16 got_access, weapon_ang, firstaid_amount;
native int16 i;
native int16 over_shoulder_on, fist_incs;
native int16 cheat_phase;
native int16 extra_extra8, quick_kick, last_quick_kick;
native int16 heat_amount, timebeforeexit, customexitsound;
//DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum, *dummyplayersprite, *newOwner; // later
//DDukeActor* actor, actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum, *dummyplayersprite, *newOwner; // later
native voidptr holoduke_on; // cannot do it as a proper actor pointer yet - but the status bar needs it.
native int16 weaprecs[256], weapreccnt;