- replaced PLAYER::PlayerSprite with PLAYER::actor

# Conflicts:
#	source/games/sw/src/save.cpp
This commit is contained in:
Christoph Oelckers 2021-11-06 10:24:11 +01:00
parent 5b10e9f2d5
commit 2f1e23a654
7 changed files with 16 additions and 22 deletions

View file

@ -733,8 +733,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
ShadeSprite(tsp);
// sw if its your playersprite
//if ((Player + screenpeek)->PlayerSprite == SpriteNum)
if ((Player + screenpeek)->PlayerSprite == tu->SpriteNum)
if (Player[screenpeek].Actor() == tActor)
{
PLAYERp pp = Player + screenpeek;
if (display_mirror || TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE|PF_VIEW_FROM_CAMERA))
@ -837,7 +836,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
{
if (TEST(tu->Flags2, SPR2_VIS_SHADING))
{
if ((Player + screenpeek)->PlayerSprite != tu->SpriteNum)
if (Player[screenpeek].Actor() != tActor)
{
if (!TEST(tu->PlayerP->Flags, PF_VIEW_FROM_OUTSIDE))
{

View file

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

View file

@ -733,7 +733,6 @@ typedef struct
struct PLAYERstruct
{
DSWActor* Actor();
// variable that fit in the sprite or user structure
union
{
@ -741,12 +740,18 @@ struct PLAYERstruct
vec3_t pos;
};
DSWActor* actor;
DSWActor* lowActor, * highActor;
DSWActor* remoteActor;
DSWActor* PlayerUnderActor;
DSWActor* KillerActor; //who killed me
DSWActor* HitBy; // SpriteNum of whatever player was last hit by
DSWActor* Actor() const
{
return actor;
}
// interpolation
int oposx, oposy, oposz;
@ -800,9 +805,6 @@ struct PLAYERstruct
short RevolveDeltaAng;
binangle RevolveAng;
// under vars are for wading and swimming
short PlayerSprite;
short pnum; // carry along the player number
short LadderSector;
@ -2231,10 +2233,6 @@ END_SW_NS
#include "swactor.h"
BEGIN_SW_NS
DSWActor* PLAYERstruct::Actor()
{
return &swActors[PlayerSprite];
}
inline int ActorUpper(DSWActor* actor)
{

View file

@ -162,7 +162,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
{
PLAYERp pp = &Player[myconnectindex];
if (paused || M_Active() || pp->PlayerSprite <= -1)
if (paused || M_Active() || pp->Actor() == nullptr)
{
loc = {};
return;

View file

@ -2283,13 +2283,10 @@ void PlayerPanelSetup(void)
{
pp = Player + pnum;
u = User[pp->PlayerSprite].Data();
u = pp->Actor()->u();
ASSERT(u != nullptr);
//u->WeaponNum = WPN_STAR;
//pp->WpnFirstType = WPN_SWORD;
PlayerUpdateWeapon(pp, u->WeaponNum);
}
}
@ -2366,7 +2363,7 @@ void InitPlayerSprite(PLAYERp pp)
auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursectnum, pp->posx,
pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
pp->PlayerSprite = actor->GetSpriteIndex();
pp->actor = actor;
sp = &actor->s();
pp->pnum = pnum;

View file

@ -497,7 +497,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
("revolvey", w.RevolveY)
("RevolveDeltaAng", w.RevolveDeltaAng)
("RevolveAng", w.RevolveAng)
("PlayerSprite", w.PlayerSprite)
("PlayerSprite", w.actor)
#ifdef OLD_SAVEGAME
; // need to write out UnderSpriteP so that older revisions still load it.
if (arc.isWriting()) arc("UnderSpriteP", w.PlayerUnderActor);
@ -581,7 +581,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
("chops", w.Chops);
if (arc.isWriting()) // we need this for loading saves in older builds for debugging.
arc("SpriteP", w.PlayerSprite);
arc("SpriteP", w.actor);
SerializeCodePtr(arc, "DoPlayerAction", (void**)&w.DoPlayerAction);

View file

@ -6146,7 +6146,7 @@ KeyMain:
case ICON_FLAG:
{
if (sp->pal == sprite[pp->PlayerSprite].pal) break; // Can't pick up your own flag!
if (sp->pal == pp->Actor()->s().pal) break; // Can't pick up your own flag!
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
@ -6167,7 +6167,7 @@ KeyMain:
RESET(np->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
SET(np->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
SetAttach(pp->Actor(), actorNew);
nu->sz = SPRITEp_MID(&sprite[pp->PlayerSprite]); // Set mid way up who it hit
nu->sz = SPRITEp_MID(&pp->Actor()->s()); // Set mid way up who it hit
nu->spal = np->pal = sp->pal; // Set the palette of the flag
SetOwner(pp->Actor(), actorNew); // Player now owns the flag