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->SpriteP = nullptr;
|
||||||
pp->PlayerSprite = -1;
|
pp->PlayerSprite = -1;
|
||||||
|
|
||||||
pp->UnderSpriteP = nullptr;
|
pp->PlayerUnderActor = nullptr;
|
||||||
pp->PlayerUnderSprite = -1;
|
|
||||||
|
|
||||||
memset(pp->HasKey, 0, sizeof(pp->HasKey));
|
memset(pp->HasKey, 0, sizeof(pp->HasKey));
|
||||||
|
|
||||||
|
|
|
@ -834,8 +834,9 @@ struct PLAYERstruct
|
||||||
binangle RevolveAng;
|
binangle RevolveAng;
|
||||||
|
|
||||||
// under vars are for wading and swimming
|
// under vars are for wading and swimming
|
||||||
short PlayerSprite, PlayerUnderSprite;
|
short PlayerSprite;
|
||||||
SPRITEp SpriteP, UnderSpriteP;
|
SPRITEp SpriteP;
|
||||||
|
DSWActor* PlayerUnderActor;
|
||||||
|
|
||||||
|
|
||||||
short pnum; // carry along the player number
|
short pnum; // carry along the player number
|
||||||
|
|
|
@ -2405,8 +2405,7 @@ void InitPlayerSprite(PLAYERp pp)
|
||||||
|
|
||||||
NewStateGroup(pp->Actor(), u->ActorActionSet->Run);
|
NewStateGroup(pp->Actor(), u->ActorActionSet->Run);
|
||||||
|
|
||||||
pp->PlayerUnderSprite = -1;
|
pp->PlayerUnderActor = nullptr;
|
||||||
pp->UnderSpriteP = nullptr;
|
|
||||||
|
|
||||||
DoPlayerZrange(pp);
|
DoPlayerZrange(pp);
|
||||||
|
|
||||||
|
@ -2440,22 +2439,20 @@ void SpawnPlayerUnderSprite(PLAYERp pp)
|
||||||
USERp pu = pp->Actor()->u(), u;
|
USERp pu = pp->Actor()->u(), u;
|
||||||
|
|
||||||
SPRITEp sp;
|
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);
|
NINJA_RUN_R0, nullptr, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
|
||||||
|
|
||||||
sp = &sprite[sp_num];
|
sp = &pp->PlayerUnderActor->s();
|
||||||
u = User[sp_num].Data();
|
u = pp->PlayerUnderActor->u();
|
||||||
|
|
||||||
pp->UnderSpriteP = sp;
|
|
||||||
|
|
||||||
SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
|
SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
|
||||||
|
|
||||||
u->Rot = sg_NinjaRun;
|
u->Rot = sg_NinjaRun;
|
||||||
u->RotNum = pu->RotNum;
|
u->RotNum = pu->RotNum;
|
||||||
NewStateGroup_(sp_num, pu->Rot);
|
NewStateGroup(pp->PlayerUnderActor, pu->Rot);
|
||||||
|
|
||||||
u->Radius = pu->Radius;
|
u->Radius = pu->Radius;
|
||||||
u->PlayerP = pp;
|
u->PlayerP = pp;
|
||||||
|
|
|
@ -1360,8 +1360,9 @@ void DoSpawnTeleporterEffectPlace(DSWActor* actor)
|
||||||
|
|
||||||
void DoPlayerWarpTeleporter(PLAYERp pp)
|
void DoPlayerWarpTeleporter(PLAYERp pp)
|
||||||
{
|
{
|
||||||
USERp u = pp->Actor()->u();
|
auto ppActor = pp->Actor();
|
||||||
SPRITEp sp = &pp->Actor()->s();
|
USERp u = ppActor->u();
|
||||||
|
SPRITEp sp = &ppActor->s();
|
||||||
short pnum;
|
short pnum;
|
||||||
SPRITEp sp_warp;
|
SPRITEp sp_warp;
|
||||||
|
|
||||||
|
@ -1398,10 +1399,10 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
|
||||||
//DoPlayerStand(pp);
|
//DoPlayerStand(pp);
|
||||||
pp->DoPlayerAction = DoPlayerTeleportPause;
|
pp->DoPlayerAction = DoPlayerTeleportPause;
|
||||||
|
|
||||||
NewStateGroup(pp->Actor(), pp->Actor()->u()->ActorActionSet->Stand);
|
NewStateGroup(ppActor, ppActor->u()->ActorActionSet->Stand);
|
||||||
|
|
||||||
UpdatePlayerSprite(pp);
|
UpdatePlayerSprite(pp);
|
||||||
DoSpawnTeleporterEffect(pp->Actor());
|
DoSpawnTeleporterEffect(ppActor);
|
||||||
|
|
||||||
TRAVERSE_CONNECT(pnum)
|
TRAVERSE_CONNECT(pnum)
|
||||||
{
|
{
|
||||||
|
@ -1412,9 +1413,8 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
|
||||||
// if someone already standing there
|
// if someone already standing there
|
||||||
if (npp->cursectnum == pp->cursectnum)
|
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
|
// telefraged by teleporting player
|
||||||
//PlayerCheckDeath(npp, npp->PlayerSprite);
|
|
||||||
PlayerCheckDeath(npp, pp->PlayerSprite);
|
PlayerCheckDeath(npp, pp->PlayerSprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1477,13 +1477,15 @@ void DoPlayerCrawlHeight(PLAYERp pp)
|
||||||
|
|
||||||
void UpdatePlayerSpriteAngle(PLAYERp pp)
|
void UpdatePlayerSpriteAngle(PLAYERp pp)
|
||||||
{
|
{
|
||||||
sprite[pp->PlayerSprite].backupang();
|
auto psp = &pp->Actor()->s();
|
||||||
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
|
psp->backupang();
|
||||||
|
psp->ang = pp->angle.ang.asbuild();
|
||||||
|
|
||||||
if (!Prediction && pp->PlayerUnderSprite >= 0)
|
if (!Prediction && pp->PlayerUnderActor != nullptr)
|
||||||
{
|
{
|
||||||
sprite[pp->PlayerUnderSprite].backupang();
|
auto usp = &pp->PlayerUnderActor->s();
|
||||||
sprite[pp->PlayerUnderSprite].ang = pp->angle.ang.asbuild();
|
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 under sprite exists and not in a dive area - Kill it
|
||||||
if (pp->PlayerUnderSprite >= 0)
|
if (pp->PlayerUnderActor != nullptr)
|
||||||
{
|
{
|
||||||
KillSprite(pp->PlayerUnderSprite);
|
KillActor(pp->PlayerUnderActor);
|
||||||
pp->PlayerUnderSprite = -1;
|
pp->PlayerUnderActor = nullptr;
|
||||||
pp->UnderSpriteP = nullptr;
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if in a dive area and a under sprite does not exist - create it
|
// if in a dive area and a under sprite does not exist - create it
|
||||||
if (pp->PlayerUnderSprite < 0)
|
if (pp->PlayerUnderActor == nullptr)
|
||||||
{
|
{
|
||||||
SpawnPlayerUnderSprite(pp);
|
SpawnPlayerUnderSprite(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sp = pp->UnderSpriteP;
|
sp = &pp->PlayerUnderActor->s();
|
||||||
u = User[pp->PlayerUnderSprite].Data();
|
u = pp->PlayerUnderActor->u();
|
||||||
|
|
||||||
SpriteNum = pp->PlayerUnderSprite;
|
|
||||||
|
|
||||||
sp->x = over_sp->x;
|
sp->x = over_sp->x;
|
||||||
sp->y = over_sp->y;
|
sp->y = over_sp->y;
|
||||||
sp->z = over_sp->z;
|
sp->z = over_sp->z;
|
||||||
changespritesect(SpriteNum, over_sp->sectnum);
|
ChangeActorSect(pp->PlayerUnderActor, over_sp->sectnum);
|
||||||
|
|
||||||
SpriteWarpToUnderwater(sp);
|
SpriteWarpToUnderwater(sp);
|
||||||
|
|
||||||
|
|
|
@ -500,9 +500,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
|
||||||
("RevolveDeltaAng", w.RevolveDeltaAng)
|
("RevolveDeltaAng", w.RevolveDeltaAng)
|
||||||
("RevolveAng", w.RevolveAng)
|
("RevolveAng", w.RevolveAng)
|
||||||
("PlayerSprite", w.PlayerSprite)
|
("PlayerSprite", w.PlayerSprite)
|
||||||
("PlayerUnderSprite", w.PlayerUnderSprite)
|
("PlayerUnderSprite", w.PlayerUnderActor)
|
||||||
("SpriteP", w.SpriteP)
|
("SpriteP", w.SpriteP)
|
||||||
("UnderSpriteP", w.UnderSpriteP)
|
|
||||||
("pnum", w.pnum)
|
("pnum", w.pnum)
|
||||||
("LadderSector", w.LadderSector)
|
("LadderSector", w.LadderSector)
|
||||||
("lx", w.lx)
|
("lx", w.lx)
|
||||||
|
|
Loading…
Reference in a new issue