- got rid of SpriteP pointers in PLAYER and USER.

This commit is contained in:
Christoph Oelckers 2021-11-06 10:17:12 +01:00
parent 8d95b9cb98
commit 5b10e9f2d5
8 changed files with 21 additions and 23 deletions

View file

@ -885,7 +885,7 @@ int DoBunnyBeginJumpAttack(DSWActor* actor)
int DoBunnyMoveJump(DSWActor* actor)
{
USER* u = actor->u();
SPRITEp sp = u->s();
SPRITEp sp = &actor->s();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{

View file

@ -469,7 +469,6 @@ void TerminateLevel(void)
memset(pp->cookieQuote, 0, sizeof(pp->cookieQuote));
pp->DoPlayerAction = nullptr;
pp->SpriteP = nullptr;
pp->PlayerSprite = -1;
pp->PlayerUnderActor = nullptr;

View file

@ -802,8 +802,6 @@ struct PLAYERstruct
// under vars are for wading and swimming
short PlayerSprite;
SPRITEp SpriteP;
short pnum; // carry along the player number
@ -1135,8 +1133,6 @@ struct USER
int active_range;
short SpriteNum;
SPRITEp SpriteP;
SPRITEp s() { return SpriteP;}
// if a player's sprite points to player structure
PLAYERp PlayerP;

View file

@ -869,7 +869,7 @@ int PachinkoCheckWin(DSWActor* actor)
int Pachinko1Operate(DSWActor* actor)
{
USER* u = actor->u();
SPRITEp sp = u->s();
SPRITEp sp = &actor->s();
short rnd;
rnd = RandomRange(1000);

View file

@ -2367,7 +2367,7 @@ void InitPlayerSprite(PLAYERp pp)
pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
pp->PlayerSprite = actor->GetSpriteIndex();
pp->SpriteP = sp = &actor->s();
sp = &actor->s();
pp->pnum = pnum;
SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);

View file

@ -504,7 +504,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
arc
#endif
("PlayerUnderSprite", w.PlayerUnderActor)
("SpriteP", w.SpriteP)
("pnum", w.pnum)
("LadderSector", w.LadderSector)
("lx", w.lx)
@ -581,6 +580,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
("keypressbits", w.KeyPressBits)
("chops", w.Chops);
if (arc.isWriting()) // we need this for loading saves in older builds for debugging.
arc("SpriteP", w.PlayerSprite);
SerializeCodePtr(arc, "DoPlayerAction", (void**)&w.DoPlayerAction);
arc.EndObject();
}
@ -869,7 +872,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
("active_range", w.active_range, def->active_range)
("SpriteNum", w.SpriteNum, def->SpriteNum)
("Attach", w.attachActor, def->attachActor)
("SpriteP", w.SpriteP, def->SpriteP)
("PlayerP", w.PlayerP, def->PlayerP)
("Sibling", w.Sibling, def->Sibling)
("xchange", w.xchange, def->xchange)
@ -927,6 +929,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
("rotator", w.rotator)
("oz", w.oz, def->oz);
if (arc.isWriting()) // we need this for loading saves in older builds for debugging.
arc("SpriteP", w.SpriteNum, def->SpriteNum);
SerializeCodePtr(arc, "ActorActionFunc", (void**)&w.ActorActionFunc);
arc.EndObject();

View file

@ -888,7 +888,6 @@ USERp SpawnUser(DSWActor* actor, short id, STATEp state)
u->targetActor = Player[0].Actor();
u->Radius = 220;
u->Sibling = -1;
u->SpriteP = &actor->s();
u->SpriteNum = actor->GetSpriteIndex();
u->WaitTics = 0;
u->OverlapZ = Z(4);
@ -5306,7 +5305,7 @@ DoGet(DSWActor* actor)
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
USERp pu;
SPRITEp sp = u->SpriteP;
SPRITEp sp = &actor->s();
PLAYERp pp;
short pnum, key_num;
int dist, a,b,c;
@ -5684,7 +5683,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum <= WPN_STAR && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum <= WPN_STAR && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponStar(pp);
break;
@ -5712,7 +5711,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_MINE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_MINE && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponMine(pp);
break;
@ -5756,7 +5755,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_UZI && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_UZI && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponUzi(pp);
@ -5798,7 +5797,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_MICRO && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_MICRO && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponMicro(pp);
break;
@ -5867,7 +5866,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_GRENADE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_GRENADE && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponGrenade(pp);
break;
@ -5941,7 +5940,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_RAIL && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_RAIL && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponRail(pp);
break;
@ -5983,7 +5982,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_SHOTGUN && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_SHOTGUN && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponShotgun(pp);
break;
@ -6051,7 +6050,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_HOTHEAD && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_HOTHEAD && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponHothead(pp);
break;
@ -6097,7 +6096,7 @@ KeyMain:
if (!cl_weaponswitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_HEART && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
if (pu->WeaponNum > WPN_HEART && pu->WeaponNum != WPN_SWORD)
break;
InitWeaponHeart(pp);
@ -6334,7 +6333,6 @@ int StateControl(DSWActor* actor)
}
else
{
//u->SpriteP->picnum = u->State->Pic;
if (u->RotNum > 1)
sp->picnum = u->Rot[0]->Pic;
else

View file

@ -27,7 +27,6 @@ public:
{
User[index].Alloc();
User[index]->SpriteNum = GetSpriteIndex();
User[index]->SpriteP = &sprite[index];
return User[index].Data();
}