- floatified Blood’s startpos

This commit is contained in:
Christoph Oelckers 2022-08-22 18:25:40 +02:00
parent 35693ec399
commit e7ec2c072a
4 changed files with 15 additions and 30 deletions

View file

@ -110,7 +110,6 @@ int gChokeCounter = 0;
int blood_globalflags;
PLAYER gPlayerTemp[kMaxPlayers];
int gHealthTemp[kMaxPlayers];
vec3_t startpos;
int16_t startang;
sectortype* startsector;
@ -251,7 +250,9 @@ void StartLevel(MapRecord* level, bool newgame)
//drawLoadingScreen();
BloodSpawnSpriteDef sprites;
int startsectno;
dbLoadMap(currentLevel->fileName, (int*)&startpos.X, (int*)&startpos.Y, (int*)&startpos.Z, &startang, &startsectno, nullptr, sprites);
vec3_t startposi;
dbLoadMap(currentLevel->fileName, (int*)&startposi.X, (int*)&startposi.Y, (int*)&startposi.Z, &startang, &startsectno, nullptr, sprites);
DVector3 startpos(startposi.X * maptoworld, startposi.Y * maptoworld, startposi.Z * maptoworld);
startsector = &sector[startsectno];
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
STAT_NewLevel(currentLevel->fileName);
@ -290,26 +291,20 @@ void StartLevel(MapRecord* level, bool newgame)
Printf(PRINT_NONOTIFY, "> Modern types erased: %d.\n", modernTypesErased);
#endif
startpos.Z = getflorzofslopeptr(startsector, startpos.X, startpos.Y);
startpos.Z = getflorzofslopeptrf(startsector, startpos.X, startpos.Y);
for (int i = 0; i < kMaxPlayers; i++) {
gStartZone[i].x = startpos.X;
gStartZone[i].y = startpos.Y;
gStartZone[i].z = startpos.Z;
gStartZone[i].pos = startpos;
gStartZone[i].sector = startsector;
gStartZone[i].ang = startang;
#ifdef NOONE_EXTENSIONS
// Create spawn zones for players in teams mode.
if (gModernMap && i <= kMaxPlayers / 2) {
gStartZoneTeam1[i].x = startpos.X;
gStartZoneTeam1[i].y = startpos.Y;
gStartZoneTeam1[i].z = startpos.Z;
gStartZoneTeam1[i].pos = startpos;
gStartZoneTeam1[i].sector = startsector;
gStartZoneTeam1[i].ang = startang;
gStartZoneTeam2[i].x = startpos.X;
gStartZoneTeam2[i].y = startpos.Y;
gStartZoneTeam2[i].z = startpos.Z;
gStartZoneTeam2[i].pos = startpos;
gStartZoneTeam2[i].sector = startsector;
gStartZoneTeam2[i].ang = startang;
}

View file

@ -58,7 +58,7 @@ void teslaHit(DBloodActor* pMissile, int a2);
void WeaponPrecache();
struct ZONE {
int x, y, z;
DVector3 pos;
sectortype* sector;
short ang;
};

View file

@ -778,7 +778,7 @@ void playerStart(int nPlayer, int bNewLevel)
BloodSectIterator it(pStartZone->sector);
while (auto act = it.Next())
{
if (pStartZone->x == act->int_pos().X && pStartZone->y == act->int_pos().Y && act->IsPlayerActor()) {
if (pStartZone->pos.XY() == act->spr.pos.XY() && act->IsPlayerActor()) {
pStartZone = NULL;
break;
}
@ -795,7 +795,7 @@ void playerStart(int nPlayer, int bNewLevel)
pStartZone = &gStartZone[Random(8)];
}
auto actor = actSpawnSprite(pStartZone->sector, {pStartZone->x * inttoworld, pStartZone->y * inttoworld, pStartZone->z * zinttoworld}, 6, 1);
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->pos, 6, 1);
assert(actor->hasX());
pPlayer->actor = actor;
DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];

View file

@ -83,9 +83,7 @@ void warpInit(TArray<DBloodActor*>& actors)
case kMarkerSPStart:
if (gGameOptions.nGameType < 2 && actor->xspr.data1 >= 0 && actor->xspr.data1 < kMaxPlayers) {
ZONE* pZone = &gStartZone[actor->xspr.data1];
pZone->x = actor->int_pos().X;
pZone->y = actor->int_pos().Y;
pZone->z = actor->int_pos().Z;
pZone->pos = actor->spr.pos;
pZone->sector = actor->sector();
pZone->ang = actor->int_ang();
}
@ -96,9 +94,7 @@ void warpInit(TArray<DBloodActor*>& actors)
if (gGameOptions.nGameType >= 2) {
// default if BB or teams without data2 specified
ZONE* pZone = &gStartZone[actor->xspr.data1];
pZone->x = actor->int_pos().X;
pZone->y = actor->int_pos().Y;
pZone->z = actor->int_pos().Z;
pZone->pos = actor->spr.pos;
pZone->sector = actor->sector();
pZone->ang = actor->int_ang();
@ -107,9 +103,7 @@ void warpInit(TArray<DBloodActor*>& actors)
if (gModernMap && gGameOptions.nGameType == 3) {
if (actor->xspr.data2 == 1) {
pZone = &gStartZoneTeam1[team1];
pZone->x = actor->int_pos().X;
pZone->y = actor->int_pos().Y;
pZone->z = actor->int_pos().Z;
pZone->pos = actor->spr.pos;
pZone->sector = actor->sector();
pZone->ang = actor->int_ang();
team1++;
@ -117,9 +111,7 @@ void warpInit(TArray<DBloodActor*>& actors)
}
else if (actor->xspr.data2 == 2) {
pZone = &gStartZoneTeam2[team2];
pZone->x = actor->int_pos().X;
pZone->y = actor->int_pos().Y;
pZone->z = actor->int_pos().Z;
pZone->pos = actor->spr.pos;
pZone->sector = actor->sector();
pZone->ang = actor->int_ang();
team2++;
@ -333,9 +325,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ZONE& w, ZONE* def
{
if (arc.BeginObject(keyname))
{
arc("x", w.x)
("y", w.y)
("z", w.z)
arc("pos", w.pos)
("sector", w.sector)
("angle", w.ang)
.EndObject();