mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- got rid of all deprecated updatesector variants.
This required a few changes in the map loader and render interface.
This commit is contained in:
parent
e4ca397898
commit
ac2a3c443f
16 changed files with 40 additions and 50 deletions
|
@ -295,14 +295,6 @@ static int32_t getwalldist(vec2_t const in, int const wallnum)
|
|||
|
||||
static void clipupdatesector(vec2_t const pos, int * const sectnum, int walldist)
|
||||
{
|
||||
#if 0
|
||||
if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE)
|
||||
{
|
||||
updatesector(pos.x, pos.y, sectnum);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (inside_p(pos.X, pos.Y, *sectnum))
|
||||
return;
|
||||
|
||||
|
@ -722,7 +714,11 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
|
|||
if ((tempint ^ tempint2) < 0)
|
||||
{
|
||||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_19961112)
|
||||
updatesector(pos->X, pos->Y, sectnum);
|
||||
{
|
||||
auto sectp = §or[*sectnum];
|
||||
updatesector(DVector2(pos->X * inttoworld, pos->Y * inttoworld), §p);
|
||||
*sectnum = sectp ? ::sectnum(sectp) : -1;
|
||||
}
|
||||
return clipReturn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -432,29 +432,29 @@ void fixSectors()
|
|||
}
|
||||
}
|
||||
|
||||
void validateStartSector(const char* filename, const DVector3& pos, int* cursectnum, unsigned numsectors, bool noabort)
|
||||
void validateStartSector(const char* filename, const DVector3& pos, sectortype** cursect, unsigned numsectors, bool noabort)
|
||||
{
|
||||
|
||||
if ((unsigned)(*cursectnum) >= numsectors)
|
||||
if (*cursect == nullptr)
|
||||
{
|
||||
sectortype* sect = nullptr;
|
||||
updatesectorz(pos, §);
|
||||
if (!sect) updatesector(pos, §);
|
||||
if (sect || noabort)
|
||||
{
|
||||
Printf(PRINT_HIGH, "Error in map %s: Start sector %d out of range. Max. sector is %d\n", filename, *cursectnum, numsectors);
|
||||
*cursectnum = sect? sectnum(sect) : 0;
|
||||
Printf(PRINT_HIGH, "Error in map %s: Start sector %d out of range. Max. sector is %d\n", filename, sectnum(*cursect), numsectors);
|
||||
*cursect = sect? sect : §or[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
I_Error("Unable to start map %s: Start sector %d out of range. Max. sector is %d. No valid location at start spot\n", filename, *cursectnum, numsectors);
|
||||
I_Error("Unable to start map %s: Start sector %d out of range. Max. sector is %d. No valid location at start spot\n", filename, sectnum(*cursect), numsectors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, int* cursectnum, SpawnSpriteDef& sprites)
|
||||
void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, sectortype** cursect, SpawnSpriteDef& sprites)
|
||||
{
|
||||
inputState.ClearAllInput();
|
||||
|
||||
|
@ -470,7 +470,8 @@ void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, int*
|
|||
pos->Y = fr.ReadInt32() * maptoworld;
|
||||
pos->Z = fr.ReadInt32() * zmaptoworld;
|
||||
*ang = fr.ReadInt16() & 2047;
|
||||
*cursectnum = fr.ReadUInt16();
|
||||
|
||||
int cursectnum = fr.ReadUInt16();
|
||||
|
||||
// Get the basics out before loading the data so that we can set up the global storage.
|
||||
unsigned numsectors = fr.ReadUInt16();
|
||||
|
@ -533,7 +534,8 @@ void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, int*
|
|||
|
||||
//Must be last.
|
||||
fixSectors();
|
||||
updatesector(*pos, cursectnum);
|
||||
*cursect = validSectorIndex(cursectnum) ? §or[cursectnum] : nullptr;
|
||||
updatesector(*pos, cursect);
|
||||
guniqhudid = 0;
|
||||
fr.Seek(0, FileReader::SeekSet);
|
||||
auto buffer = fr.Read();
|
||||
|
@ -547,7 +549,7 @@ void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, int*
|
|||
|
||||
wallbackup = wall;
|
||||
sectorbackup = sector;
|
||||
validateStartSector(filename, *pos, cursectnum, numsectors);
|
||||
validateStartSector(filename, *pos, cursect, numsectors);
|
||||
}
|
||||
|
||||
|
||||
|
@ -725,7 +727,7 @@ void loadMapBackup(const char* filename)
|
|||
{
|
||||
DVector3 fpos;
|
||||
int16_t scratch;
|
||||
int scratch2;
|
||||
sectortype* scratch2;
|
||||
SpawnSpriteDef scratch3;
|
||||
|
||||
if (isBlood())
|
||||
|
|
|
@ -722,11 +722,11 @@ struct SpawnSpriteDef;
|
|||
void allocateMapArrays(int numwall, int numsector, int numsprites);
|
||||
void validateSprite(spritetype& spr, int secno, int index);
|
||||
void fixSectors();
|
||||
void loadMap(const char *filename, int flags, DVector3 *pos, int16_t *ang, int *cursectnum, SpawnSpriteDef& sprites);
|
||||
void loadMap(const char *filename, int flags, DVector3 *pos, int16_t *ang, sectortype** cursect, SpawnSpriteDef& sprites);
|
||||
TArray<walltype> loadMapWalls(const char* filename);
|
||||
void loadMapBackup(const char* filename);
|
||||
void loadMapHack(const char* filename, const uint8_t*, SpawnSpriteDef& sprites);
|
||||
void validateStartSector(const char* filename, const DVector3& pos, int* cursectnum, unsigned numsectors, bool noabort = false);
|
||||
void validateStartSector(const char* filename, const DVector3& pos, sectortype** cursectnum, unsigned numsectors, bool noabort = false);
|
||||
|
||||
// should only be used to read angles from map-loaded data (for proper documentation)
|
||||
constexpr DAngle mapangle(int mapang)
|
||||
|
|
|
@ -305,12 +305,12 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
void animatecamsprite(double s);
|
||||
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double interpfrac, float fov)
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, double interpfrac, float fov)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
updatesector(position, §num);
|
||||
if (sectnum < 0) return;
|
||||
updatesector(position.XY(), §);
|
||||
if (sectnum == nullptr) return;
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
checkBenchActive();
|
||||
|
@ -319,7 +319,7 @@ void render_drawrooms(DCoreActor* playersprite, const DVector3& position, int se
|
|||
ResetProfilingData();
|
||||
|
||||
// Get this before everything else
|
||||
FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum, angle, horizon, rollang, fov);
|
||||
FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum(sect), angle, horizon, rollang, fov);
|
||||
r_viewpoint.TicFrac = !cl_capfps ? interpfrac : 1.;
|
||||
|
||||
screen->mLights->Clear();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
class FSerializer;
|
||||
struct IntRect;
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double interpfrac, float fov = -1);
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, sectortype* sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double interpfrac, float fov = -1);
|
||||
void render_camtex(DCoreActor* playersprite, const DVector3& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, FGameTexture* camtex, IntRect& rect, double interpfrac);
|
||||
|
||||
struct PortalDesc
|
||||
|
|
|
@ -95,12 +95,6 @@ inline void updatesector(const DVector2& pos, sectortype** const sectp)
|
|||
}
|
||||
|
||||
|
||||
// This is still needed for map startup.
|
||||
inline void updatesector(const DVector3& pos, int* sectno)
|
||||
{
|
||||
DoUpdateSector(pos.X, pos.Y, pos.Z, sectno, MAXUPDATESECTORDIST, inside0);
|
||||
}
|
||||
|
||||
inline void updatesectorz(const DVector3& pos, sectortype** const sectp)
|
||||
{
|
||||
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
|
||||
|
|
|
@ -251,10 +251,8 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
#endif
|
||||
//drawLoadingScreen();
|
||||
BloodSpawnSpriteDef sprites;
|
||||
int startsectno;
|
||||
DVector3 startpos;
|
||||
dbLoadMap(currentLevel->fileName, startpos, &startang, &startsectno, nullptr, sprites);
|
||||
startsector = §or[startsectno];
|
||||
dbLoadMap(currentLevel->fileName, startpos, &startang, &startsector, nullptr, sprites);
|
||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||
STAT_NewLevel(currentLevel->fileName);
|
||||
TITLE_InformName(currentLevel->name);
|
||||
|
|
|
@ -130,7 +130,7 @@ unsigned int dbReadMapCRC(const char* pPath)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum, unsigned int* pCRC, BloodSpawnSpriteDef& sprites)
|
||||
void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cursect, unsigned int* pCRC, BloodSpawnSpriteDef& sprites)
|
||||
{
|
||||
const int nXSectorSize = 60;
|
||||
const int nXSpriteSize = 56;
|
||||
|
@ -216,7 +216,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum,
|
|||
}
|
||||
gMapRev = mapHeader.revision;
|
||||
allocateMapArrays(mapHeader.numwalls, mapHeader.numsectors, mapHeader.numsprites);
|
||||
*cursectnum = mapHeader.sect;
|
||||
*cursect = validSectorIndex(mapHeader.sect)? §or[mapHeader.sect] : nullptr;
|
||||
|
||||
if (encrypted)
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum,
|
|||
sectionGeometry.SetSize(sections.Size());
|
||||
wallbackup = wall;
|
||||
sectorbackup = sector;
|
||||
validateStartSector(mapname.GetChars(), pos, cursectnum, mapHeader.numsectors, true);
|
||||
validateStartSector(mapname.GetChars(), pos, cursect, mapHeader.numsectors, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -679,6 +679,6 @@ END_BLD_NS
|
|||
void qloadboard(const char* filename, uint8_t flags, DVector3* dapos, int16_t* daang)
|
||||
{
|
||||
Blood::BloodSpawnSpriteDef sprites;
|
||||
int sp;
|
||||
sectortype* sp;
|
||||
Blood::dbLoadMap(filename, *dapos, daang, &sp, nullptr, sprites);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ DBloodActor* InsertSprite(sectortype* pSector, int nStat);
|
|||
int DeleteSprite(DBloodActor* actor);
|
||||
|
||||
unsigned int dbReadMapCRC(const char* pPath);
|
||||
void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* pSector, unsigned int* pCRC, BloodSpawnSpriteDef& sprites);
|
||||
void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** pSector, unsigned int* pCRC, BloodSpawnSpriteDef& sprites);
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -739,7 +739,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
fixedhoriz deliriumPitchI = interpolatedvalue(q16horiz(deliriumPitchO), q16horiz(deliriumPitch), interpfrac);
|
||||
auto bakCstat = pPlayer->actor->spr.cstat;
|
||||
pPlayer->actor->spr.cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
render_drawrooms(pPlayer->actor, cPos, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, interpfrac);
|
||||
render_drawrooms(pPlayer->actor, cPos, pSector, cA, cH + deliriumPitchI, rotscrnang, interpfrac);
|
||||
pPlayer->actor->spr.cstat = bakCstat;
|
||||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
|
|
|
@ -994,12 +994,12 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode)
|
|||
}
|
||||
|
||||
currentLevel = mi;
|
||||
int sect;
|
||||
sectortype* sect;
|
||||
SpawnSpriteDef sprites;
|
||||
DVector3 pos;
|
||||
loadMap(mi->fileName, isShareware(), &pos, &lbang, §, sprites);
|
||||
p->pos = pos;
|
||||
p->cursector = §or[sect];
|
||||
p->cursector = sect;
|
||||
|
||||
SECRET_SetMapName(mi->DisplayName(), mi->name);
|
||||
STAT_NewLevel(mi->fileName);
|
||||
|
|
|
@ -364,7 +364,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
|
|||
auto cstat = viewer->spr.cstat;
|
||||
if (camview) viewer->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||
if (!sceneonly) drawweapon(interpfrac);
|
||||
render_drawrooms(viewer, cpos, sectnum(sect), cang, choriz, rotscrnang, interpfrac, fov);
|
||||
render_drawrooms(viewer, cpos, sect, cang, choriz, rotscrnang, interpfrac, fov);
|
||||
viewer->spr.cstat = cstat;
|
||||
|
||||
//GLInterface.SetMapFog(false);
|
||||
|
|
|
@ -143,12 +143,12 @@ uint8_t LoadLevel(MapRecord* map)
|
|||
nStopSound = 66;
|
||||
}
|
||||
|
||||
int initsect;
|
||||
sectortype* initsect;
|
||||
SpawnSpriteDef spawned;
|
||||
int16_t mapang;
|
||||
loadMap(currentLevel->fileName, 0, &initpos, &mapang, &initsect, spawned);
|
||||
inita = DAngle::fromBuild(mapang);
|
||||
initsectp = §or[initsect];
|
||||
initsectp = initsect;
|
||||
auto actors = spawnactors(spawned);
|
||||
|
||||
int i;
|
||||
|
|
|
@ -316,7 +316,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
|
||||
if (!nFreeze && !sceneonly)
|
||||
DrawWeapons(interpfrac);
|
||||
render_drawrooms(nullptr, nCamerapos, sectnum(pSector), nCameraang, nCamerapan, rotscrnang, interpfrac);
|
||||
render_drawrooms(nullptr, nCamerapos, pSector, nCameraang, nCamerapan, rotscrnang, interpfrac);
|
||||
|
||||
if (HavePLURemap())
|
||||
{
|
||||
|
|
|
@ -1324,7 +1324,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
|
|||
UpdatePanel(interpfrac);
|
||||
|
||||
UpdateWallPortalState();
|
||||
render_drawrooms(pp->actor, tpos, sectnum(tsect), tang, thoriz, trotscrnang, interpfrac);
|
||||
render_drawrooms(pp->actor, tpos, tsect, tang, thoriz, trotscrnang, interpfrac);
|
||||
RestorePortalState();
|
||||
|
||||
if (sceneonly)
|
||||
|
|
|
@ -404,13 +404,13 @@ void InitLevel(MapRecord *maprec)
|
|||
|
||||
int16_t ang;
|
||||
currentLevel = maprec;
|
||||
int cursect;
|
||||
sectortype* cursect;
|
||||
SpawnSpriteDef sprites;
|
||||
DVector3 ppos;
|
||||
loadMap(maprec->fileName, SW_SHAREWARE ? 1 : 0, &ppos, &ang, &cursect, sprites);
|
||||
Player[0].pos = ppos;
|
||||
spawnactors(sprites);
|
||||
Player[0].cursector = §or[cursect];
|
||||
Player[0].cursector = cursect;
|
||||
|
||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||
STAT_NewLevel(currentLevel->fileName);
|
||||
|
|
Loading…
Reference in a new issue