mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- PlayerUnderSprite.
This commit is contained in:
parent
dd684f36a4
commit
02671dbe2f
5 changed files with 31 additions and 36 deletions
|
@ -473,8 +473,7 @@ void TerminateLevel(void)
|
|||
pp->SpriteP = nullptr;
|
||||
pp->PlayerSprite = -1;
|
||||
|
||||
pp->UnderSpriteP = nullptr;
|
||||
pp->PlayerUnderSprite = -1;
|
||||
pp->PlayerUnderActor = nullptr;
|
||||
|
||||
memset(pp->HasKey, 0, sizeof(pp->HasKey));
|
||||
|
||||
|
|
|
@ -834,8 +834,9 @@ struct PLAYERstruct
|
|||
binangle RevolveAng;
|
||||
|
||||
// under vars are for wading and swimming
|
||||
short PlayerSprite, PlayerUnderSprite;
|
||||
SPRITEp SpriteP, UnderSpriteP;
|
||||
short PlayerSprite;
|
||||
SPRITEp SpriteP;
|
||||
DSWActor* PlayerUnderActor;
|
||||
|
||||
|
||||
short pnum; // carry along the player number
|
||||
|
|
|
@ -2405,8 +2405,7 @@ void InitPlayerSprite(PLAYERp pp)
|
|||
|
||||
NewStateGroup(pp->Actor(), u->ActorActionSet->Run);
|
||||
|
||||
pp->PlayerUnderSprite = -1;
|
||||
pp->UnderSpriteP = nullptr;
|
||||
pp->PlayerUnderActor = nullptr;
|
||||
|
||||
DoPlayerZrange(pp);
|
||||
|
||||
|
@ -2440,22 +2439,20 @@ void SpawnPlayerUnderSprite(PLAYERp pp)
|
|||
USERp pu = pp->Actor()->u(), u;
|
||||
|
||||
SPRITEp sp;
|
||||
int pnum = int(pp - Player), sp_num;
|
||||
int pnum = int(pp - Player);
|
||||
|
||||
sp_num = pp->PlayerUnderSprite = SpawnSprite(STAT_PLAYER_UNDER0 + pnum,
|
||||
pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum,
|
||||
NINJA_RUN_R0, nullptr, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
|
||||
|
||||
sp = &sprite[sp_num];
|
||||
u = User[sp_num].Data();
|
||||
|
||||
pp->UnderSpriteP = sp;
|
||||
sp = &pp->PlayerUnderActor->s();
|
||||
u = pp->PlayerUnderActor->u();
|
||||
|
||||
SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
|
||||
|
||||
u->Rot = sg_NinjaRun;
|
||||
u->RotNum = pu->RotNum;
|
||||
NewStateGroup_(sp_num, pu->Rot);
|
||||
NewStateGroup(pp->PlayerUnderActor, pu->Rot);
|
||||
|
||||
u->Radius = pu->Radius;
|
||||
u->PlayerP = pp;
|
||||
|
|
|
@ -1360,8 +1360,9 @@ void DoSpawnTeleporterEffectPlace(DSWActor* actor)
|
|||
|
||||
void DoPlayerWarpTeleporter(PLAYERp pp)
|
||||
{
|
||||
USERp u = pp->Actor()->u();
|
||||
SPRITEp sp = &pp->Actor()->s();
|
||||
auto ppActor = pp->Actor();
|
||||
USERp u = ppActor->u();
|
||||
SPRITEp sp = &ppActor->s();
|
||||
short pnum;
|
||||
SPRITEp sp_warp;
|
||||
|
||||
|
@ -1398,10 +1399,10 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
|
|||
//DoPlayerStand(pp);
|
||||
pp->DoPlayerAction = DoPlayerTeleportPause;
|
||||
|
||||
NewStateGroup(pp->Actor(), pp->Actor()->u()->ActorActionSet->Stand);
|
||||
NewStateGroup(ppActor, ppActor->u()->ActorActionSet->Stand);
|
||||
|
||||
UpdatePlayerSprite(pp);
|
||||
DoSpawnTeleporterEffect(pp->Actor());
|
||||
DoSpawnTeleporterEffect(ppActor);
|
||||
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
|
@ -1412,9 +1413,8 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
|
|||
// if someone already standing there
|
||||
if (npp->cursectnum == pp->cursectnum)
|
||||
{
|
||||
PlayerUpdateHealth(npp, -User[npp->PlayerSprite]->Health); // Make sure he dies!
|
||||
PlayerUpdateHealth(npp, -npp->Actor()->u()->Health); // Make sure he dies!
|
||||
// telefraged by teleporting player
|
||||
//PlayerCheckDeath(npp, npp->PlayerSprite);
|
||||
PlayerCheckDeath(npp, pp->PlayerSprite);
|
||||
}
|
||||
}
|
||||
|
@ -1477,13 +1477,15 @@ void DoPlayerCrawlHeight(PLAYERp pp)
|
|||
|
||||
void UpdatePlayerSpriteAngle(PLAYERp pp)
|
||||
{
|
||||
sprite[pp->PlayerSprite].backupang();
|
||||
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
|
||||
auto psp = &pp->Actor()->s();
|
||||
psp->backupang();
|
||||
psp->ang = pp->angle.ang.asbuild();
|
||||
|
||||
if (!Prediction && pp->PlayerUnderSprite >= 0)
|
||||
if (!Prediction && pp->PlayerUnderActor != nullptr)
|
||||
{
|
||||
sprite[pp->PlayerUnderSprite].backupang();
|
||||
sprite[pp->PlayerUnderSprite].ang = pp->angle.ang.asbuild();
|
||||
auto usp = &pp->PlayerUnderActor->s();
|
||||
usp->backupang();
|
||||
usp->ang = pp->angle.ang.asbuild();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1749,32 +1751,29 @@ void UpdatePlayerUnderSprite(PLAYERp pp)
|
|||
{
|
||||
|
||||
// if under sprite exists and not in a dive area - Kill it
|
||||
if (pp->PlayerUnderSprite >= 0)
|
||||
if (pp->PlayerUnderActor != nullptr)
|
||||
{
|
||||
KillSprite(pp->PlayerUnderSprite);
|
||||
pp->PlayerUnderSprite = -1;
|
||||
pp->UnderSpriteP = nullptr;
|
||||
KillActor(pp->PlayerUnderActor);
|
||||
pp->PlayerUnderActor = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if in a dive area and a under sprite does not exist - create it
|
||||
if (pp->PlayerUnderSprite < 0)
|
||||
if (pp->PlayerUnderActor == nullptr)
|
||||
{
|
||||
SpawnPlayerUnderSprite(pp);
|
||||
}
|
||||
}
|
||||
|
||||
sp = pp->UnderSpriteP;
|
||||
u = User[pp->PlayerUnderSprite].Data();
|
||||
|
||||
SpriteNum = pp->PlayerUnderSprite;
|
||||
sp = &pp->PlayerUnderActor->s();
|
||||
u = pp->PlayerUnderActor->u();
|
||||
|
||||
sp->x = over_sp->x;
|
||||
sp->y = over_sp->y;
|
||||
sp->z = over_sp->z;
|
||||
changespritesect(SpriteNum, over_sp->sectnum);
|
||||
ChangeActorSect(pp->PlayerUnderActor, over_sp->sectnum);
|
||||
|
||||
SpriteWarpToUnderwater(sp);
|
||||
|
||||
|
|
|
@ -500,9 +500,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
|
|||
("RevolveDeltaAng", w.RevolveDeltaAng)
|
||||
("RevolveAng", w.RevolveAng)
|
||||
("PlayerSprite", w.PlayerSprite)
|
||||
("PlayerUnderSprite", w.PlayerUnderSprite)
|
||||
("PlayerUnderSprite", w.PlayerUnderActor)
|
||||
("SpriteP", w.SpriteP)
|
||||
("UnderSpriteP", w.UnderSpriteP)
|
||||
("pnum", w.pnum)
|
||||
("LadderSector", w.LadderSector)
|
||||
("lx", w.lx)
|
||||
|
|
Loading…
Reference in a new issue