- Change wrapper internals for current yaw to the actor's sprite DRotator and make sure all the games load a level.

This commit is contained in:
Mitchell Richters 2022-11-27 11:34:39 +11:00 committed by Christoph Oelckers
parent 16a48cba17
commit a84e09048e
10 changed files with 31 additions and 34 deletions

View file

@ -11,8 +11,7 @@ struct PlayerAngles
// Temporary wrappers.
DAngle& ZzHORIZON() { return pActor->spr.Angles.Pitch; }
DAngle& ZzOLDHORIZON() { return pActor->PrevAngles.Pitch; }
DAngle thisAngle;
DAngle& ZzANGLE() { return thisAngle; }
DAngle& ZzANGLE() { return pActor->spr.Angles.Yaw; }
DAngle prevAngle;
DAngle& ZzOLDANGLE() { return prevAngle; }

View file

@ -504,7 +504,7 @@ void resetprestat(int snum,int g)
//
//---------------------------------------------------------------------------
void resetpspritevars(int g, const DVector3& startpos)
void resetpspritevars(int g, const DVector3& startpos, const DAngle startang)
{
int i, j;
int circ;
@ -512,7 +512,7 @@ void resetpspritevars(int g, const DVector3& startpos)
STATUSBARTYPE tsbar[MAXPLAYERS];
auto newActor = CreateActor(ps[0].cursector, startpos.plusZ(gs.playerheight),
TILE_APLAYER, 0, DVector2(0, 0), ps[0].Angles.ZzANGLE(), 0., 0., nullptr, 10);
TILE_APLAYER, 0, DVector2(0, 0), startang, 0., 0., nullptr, 10);
newActor->spr.Angles.Pitch = DAngle::fromDeg(-17.354);
newActor->viewzoffset = -gs.playerheight;
@ -627,7 +627,6 @@ void resetpspritevars(int g, const DVector3& startpos)
act->SetOwner(act);
ps[j].setbobpos();
ps[j].Angles.ZzOLDANGLE() = ps[j].Angles.ZzANGLE() = act->spr.Angles.Yaw; // check me out later.
updatesector(act->spr.pos, &ps[j].cursector);
@ -982,8 +981,6 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode)
SECRET_SetMapName(mi->DisplayName(), mi->name);
STAT_NewLevel(mi->fileName);
TITLE_InformName(mi->name);
p->Angles.ZzANGLE() = mapangle(lbang);
gotpic.Zero();
@ -995,7 +992,7 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode)
SpawnPortals();
allignwarpelevators();
resetpspritevars(gamemode, pos);
resetpspritevars(gamemode, pos, mapangle(lbang));
if (isRR()) cacheit_r(); else cacheit_d();
return 0;

View file

@ -348,13 +348,18 @@ void S_GetCamera(DVector3* c, DAngle* ca, sectortype** cs)
if (ud.cameraactor == nullptr)
{
auto p = &ps[screenpeek];
auto pact = p->GetActor();
if (c)
{
if (p->GetActor()) *c = p->GetActor()->getPosWithOffsetZ();
if (pact) *c = pact->getPosWithOffsetZ();
else c->Zero();
}
if (cs) *cs = p->cursector;
if (ca) *ca = p->Angles.ZzANGLE();
if (ca)
{
if (pact) *ca = pact->spr.Angles.Yaw;
else *ca = nullAngle;
}
}
else
{

View file

@ -296,8 +296,7 @@ void RestartPlayer(int nPlayer)
pActor->spr.pos = nNStartSprite->spr.pos;
ChangeActorSect(pActor, nNStartSprite->sector());
plr->Angles.ZzANGLE() = nNStartSprite->spr.Angles.Yaw; // check me out later.
pActor->spr.Angles.Yaw = plr->Angles.ZzANGLE(); // check me out later.
pActor->spr.Angles.Yaw = nNStartSprite->spr.Angles.Yaw;
floorsprt = insertActor(pActor->sector(), 0);
@ -310,13 +309,12 @@ void RestartPlayer(int nPlayer)
{
pActor->spr.pos.XY() = plr->sPlayerSave.pos.XY();
pActor->spr.pos.Z = plr->sPlayerSave.pSector->floorz;
plr->Angles.ZzANGLE() = plr->sPlayerSave.nAngle;
pActor->spr.Angles.Yaw = plr->Angles.ZzANGLE(); // check me out later.
pActor->spr.Angles.Yaw = plr->sPlayerSave.nAngle;
floorsprt = nullptr;
}
plr->Angles.backupYaw();
pActor->backuploc();
plr->pPlayerFloorSprite = floorsprt;

View file

@ -414,7 +414,6 @@ void InitLevel(MapRecord *maprec)
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
STAT_NewLevel(currentLevel->fileName);
TITLE_InformName(currentLevel->name);
Player[0].Angles.ZzANGLE() = DAngle::fromBuild(ang);
auto vissect = &sector[0]; // hack alert!
if (vissect->extra != -1)
@ -433,8 +432,8 @@ void InitLevel(MapRecord *maprec)
QueueReset();
PreMapCombineFloors();
InitMultiPlayerInfo(ppos);
InitAllPlayerSprites(ppos);
InitMultiPlayerInfo(ppos, mapangle(ang));
InitAllPlayerSprites(ppos, mapangle(ang));
//
// Do setup for sprite, track, panel, sector, etc

View file

@ -71,8 +71,8 @@ int DoActorSectorDamage(DSWActor* actor);
int DoScaleSprite(DSWActor* actor);
int DoActorStopFall(DSWActor* actor);
void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos);
void InitAllPlayerSprites(const DVector3& spawnpos);
void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos, const DAngle startang);
void InitAllPlayerSprites(const DVector3& spawnpos, const DAngle startang);
void PlayerPanelSetup(void);
void PlayerDeathReset(PLAYER* pp);
void SpawnPlayerUnderSprite(PLAYER* pp);

View file

@ -2166,13 +2166,13 @@ int DoNinjaCeiling(DSWActor* actor)
// too convienent to put it here.
//
void InitAllPlayerSprites(const DVector3& spawnpos)
void InitAllPlayerSprites(const DVector3& spawnpos, const DAngle startang)
{
short i;
TRAVERSE_CONNECT(i)
{
InitPlayerSprite(Player + i, spawnpos);
InitPlayerSprite(Player + i, spawnpos, startang);
}
}
@ -2385,7 +2385,7 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet;
//
//---------------------------------------------------------------------------
void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos)
void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos, const DAngle startang)
{
int pnum = int(pp - Player);
double fz,cz;
@ -2393,7 +2393,7 @@ void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos)
COVER_SetReverb(0); // Turn off any echoing that may have been going before
pp->Reverb = 0;
auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), pp->Angles.ZzANGLE());
auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), startang);
actor->viewzoffset = -PLAYER_HEIGHTF;
// if too close to the floor - stand up
@ -2402,7 +2402,7 @@ void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos)
{
actor->spr.pos.Z = fz;
}
actor->backuppos();
actor->backuploc();
pp->actor = actor;
pp->pnum = pnum;

View file

@ -7045,7 +7045,6 @@ void InitAllPlayers(void)
// Initialize all [MAX_SW_PLAYERS] arrays here!
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
{
pp->Angles.ZzANGLE() = pp->Angles.ZzOLDANGLE() = pfirst->Angles.ZzANGLE();
pp->cursector = pfirst->cursector;
// set like this so that player can trigger something on start of the level
pp->lastcursector = pfirst->cursector+1;
@ -7200,14 +7199,14 @@ void PlayerSpawnPosition(PLAYER* pp)
ASSERT(spawn_sprite != nullptr);
pp->Angles.ZzANGLE() = pp->Angles.ZzOLDANGLE() = spawn_sprite->spr.Angles.Yaw; // check me out later.
pp->setcursector(spawn_sprite->sector());
if (pp->actor)
{
pp->actor->spr.Angles.Yaw = spawn_sprite->spr.Angles.Yaw;
pp->actor->spr.pos = spawn_sprite->spr.pos;
pp->actor->viewzoffset = spawn_sprite->viewzoffset;
pp->actor->backuppos();
pp->actor->backuploc();
}
}
@ -7217,7 +7216,7 @@ void PlayerSpawnPosition(PLAYER* pp)
//
//---------------------------------------------------------------------------
void InitMultiPlayerInfo(const DVector3& spawnpos)
void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang)
{
PLAYER* pp;
short pnum;
@ -7263,7 +7262,7 @@ void InitMultiPlayerInfo(const DVector3& spawnpos)
continue;
}
auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), pp->Angles.ZzANGLE());
auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), startang);
start0->viewzoffset = -PLAYER_HEIGHTF;
// if too close to the floor - stand up
@ -7272,7 +7271,7 @@ void InitMultiPlayerInfo(const DVector3& spawnpos)
{
start0->spr.pos.Z = fz;
}
start0->backuppos();
start0->backuploc();
start0->clearUser();
start0->spr.picnum = ST1;
}

View file

@ -130,7 +130,7 @@ void HeadBobStateControl(void);
void DoPlayer(void);
void domovethings(void);
void InitAllPlayers(void);
void InitMultiPlayerInfo(const DVector3& spawnpos);
void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang);
void MoveScrollMode2D(PLAYER* pp, ControlInfo* const hidInput);
void DoPlayerDivePalette(PLAYER* pp);
void DoPlayerNightVisionPalette(PLAYER* pp);

View file

@ -598,12 +598,12 @@ void GameInterface::UpdateSounds(void)
if (pp->sop_remote)
{
DSWActor* rsp = pp->remoteActor;
if (TEST_BOOL1(rsp))
if (rsp && TEST_BOOL1(rsp))
tang = rsp->spr.Angles.Yaw;
else
tang = (pp->sop_remote->pmid.XY() - pp->actor->spr.pos.XY()).Angle();
}
else tang = pp->Angles.ZzANGLE();
else tang = pp->actor ? pp->actor->spr.Angles.Yaw : nullAngle;
listener.angle = float(-tang.Radians());
listener.velocity.Zero();