mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- made wall a TArray.
This commit is contained in:
parent
fded90c491
commit
8cca55c24a
11 changed files with 14 additions and 25 deletions
|
@ -148,7 +148,7 @@ extern spriteext_t spriteext[MAXSPRITES];
|
|||
extern spritesmooth_t spritesmooth[MAXSPRITES + MAXUNIQHUDID];
|
||||
|
||||
extern TArray<sectortype> sector;
|
||||
extern walltype wall[MAXWALLS];
|
||||
extern TArray<walltype> wall;
|
||||
extern spritetype sprite[MAXSPRITES];
|
||||
EXTERN int leveltimer;
|
||||
|
||||
|
@ -183,8 +183,7 @@ inline walltype* sectortype::firstWall() const
|
|||
|
||||
|
||||
extern TArray<sectortype> sectorbackup;
|
||||
//extern TArray<walltype> wallbackup;
|
||||
extern walltype wallbackup[MAXWALLS];
|
||||
extern TArray<walltype> wallbackup;
|
||||
|
||||
inline tspriteptr_t renderAddTSpriteFromSprite(spritetype* tsprite, int& spritesortcnt, uint16_t const spritenum)
|
||||
{
|
||||
|
|
|
@ -56,11 +56,6 @@ BEGIN_BLD_NS
|
|||
class DBloodActor;
|
||||
END_BLD_NS
|
||||
|
||||
namespace ShadowWarrior
|
||||
{
|
||||
struct SECT_USER;
|
||||
};
|
||||
|
||||
//40 bytes
|
||||
struct walltype;
|
||||
struct sectortype
|
||||
|
|
|
@ -44,7 +44,7 @@ spriteext_t spriteext[MAXSPRITES];
|
|||
spritesmooth_t spritesmooth[MAXSPRITES + MAXUNIQHUDID];
|
||||
|
||||
TArray<sectortype> sector;
|
||||
walltype wall[MAXWALLS];
|
||||
TArray<walltype> wall;
|
||||
spritetype sprite[MAXSPRITES];
|
||||
|
||||
int32_t r_rortexture = 0;
|
||||
|
|
|
@ -2268,7 +2268,7 @@ void polymost_drawrooms()
|
|||
maskwallcnt = 0;
|
||||
|
||||
// NOTE: globalcursectnum has been already adjusted in ADJUST_GLOBALCURSECTNUM.
|
||||
assert((unsigned)globalcursectnum < MAXSECTORS);
|
||||
assert(validSectorIndex(globalcursectnum));
|
||||
polymost_scansector(globalcursectnum);
|
||||
|
||||
grhalfxdown10x = grhalfxdown10;
|
||||
|
|
|
@ -265,7 +265,7 @@ inline TArrayView<walltype> wallsofsector(int sec)
|
|||
// these are mainly meant as refactoring aids to mark function calls to work on.
|
||||
inline int wallnum(const walltype* wal)
|
||||
{
|
||||
return int(wal - wall);
|
||||
return wall.IndexOf(wal);
|
||||
}
|
||||
|
||||
inline int sectnum(const sectortype* sect)
|
||||
|
|
|
@ -117,7 +117,7 @@ static int32_t LoadMapHack(const char *filename)
|
|||
if (sc.CheckNumber())
|
||||
{
|
||||
currentwall = sc.Number;
|
||||
if (currentwall < 0 || currentwall >= MAXWALLS)
|
||||
if (!validWallIndex(currentwall))
|
||||
{
|
||||
sc.ScriptMessage("Invalid wall number %d", currentwall);
|
||||
currentwall = -1;
|
||||
|
@ -132,7 +132,7 @@ static int32_t LoadMapHack(const char *filename)
|
|||
if (sc.CheckNumber())
|
||||
{
|
||||
currentsector = sc.Number;
|
||||
if (currentsector < 0 || currentsector >= MAXSECTORS)
|
||||
if (!validSectorIndex(currentsector))
|
||||
{
|
||||
sc.ScriptMessage("Invalid sector number %d", currentsector);
|
||||
currentsector = -1;
|
||||
|
|
|
@ -414,7 +414,8 @@ void allocateMapArrays(int numsprites)
|
|||
mapDataArena.FreeAll();
|
||||
sector.Resize(numsectors);
|
||||
memset(sector.Data(), 0, sizeof(sectortype) * numsectors);
|
||||
memset(wall, 0, sizeof(*wall) * MAXWALLS);
|
||||
wall.Resize(numwalls);
|
||||
memset(wall.Data(), 0, sizeof(walltype) * numwalls);
|
||||
memset(sprite, 0, sizeof(*sprite) * MAXSPRITES);
|
||||
memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
|
||||
memset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES + MAXUNIQHUDID));
|
||||
|
@ -443,11 +444,9 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
|
||||
// Get the basics out before loading the data so that we can set up the global storage.
|
||||
numsectors = fr.ReadUInt16();
|
||||
if ((unsigned)numsectors > MAXSECTORS) I_Error("%s: Invalid map, too many sectors", filename);
|
||||
auto sectorpos = fr.Tell();
|
||||
fr.Seek((mapversion == 5 ? sectorsize5 : mapversion == 6 ? sectorsize6 : sectorsize7) * numsectors, FileReader::SeekCur);
|
||||
numwalls = fr.ReadUInt16();
|
||||
if ((unsigned)numwalls > MAXWALLS) I_Error("%s: Invalid map, too many walls", filename);
|
||||
auto wallpos = fr.Tell();
|
||||
fr.Seek((mapversion == 5 ? wallsize5 : mapversion == 6 ? wallsize6 : wallsize7)* numwalls, FileReader::SeekCur);
|
||||
int numsprites = fr.ReadUInt16();
|
||||
|
@ -521,7 +520,7 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
sectorGeometry.SetSize(numsections);
|
||||
|
||||
|
||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||
wallbackup = wall;
|
||||
sectorbackup = sector;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,7 @@
|
|||
|
||||
|
||||
TArray<sectortype> sectorbackup;
|
||||
//TArray<walltype> wallbackup;
|
||||
walltype wallbackup[MAXWALLS];
|
||||
TArray<walltype> wallbackup;
|
||||
|
||||
void WriteSavePic(FileWriter* file, int width, int height);
|
||||
bool WriteZip(const char* filename, TArray<FString>& filenames, TArray<FCompressedBuffer>& content);
|
||||
|
@ -692,7 +691,7 @@ void SerializeMap(FSerializer& arc)
|
|||
("numsectors", numsectors)
|
||||
("sectors", sector, sectorbackup)
|
||||
("numwalls", numwalls)
|
||||
.Array("walls", wall, wallbackup, numwalls)
|
||||
("walls", wall, wallbackup)
|
||||
.Array("headspritestat", headspritestat, MAXSTATUS + 1)
|
||||
.Array("nextspritestat", nextspritestat, MAXSPRITES)
|
||||
.Array("prevspritestat", prevspritestat, MAXSPRITES)
|
||||
|
|
|
@ -958,7 +958,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
setWallSectors();
|
||||
hw_BuildSections();
|
||||
sectorGeometry.SetSize(numsections);
|
||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||
wallbackup = wall;
|
||||
sectorbackup = sector;
|
||||
}
|
||||
|
||||
|
|
|
@ -710,7 +710,6 @@ void SerializeState(FSerializer& arc)
|
|||
arc("visibility", gVisibility)
|
||||
("frameclock", PlayClock)
|
||||
("framecount", gFrameCount)
|
||||
.Array("basewall", baseWall, numwalls)
|
||||
("hitinfo", gHitInfo)
|
||||
.Array("statcount", gStatCount, kMaxStatus + 1)
|
||||
("fogmode", gFogMode)
|
||||
|
|
|
@ -454,11 +454,9 @@ void TerminateLevel(void)
|
|||
KillActor(actor);
|
||||
}
|
||||
|
||||
// Free SectUser memory
|
||||
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
PLAYERp pp = Player + pnum;
|
||||
PLAYERp pp = &Player[pnum];
|
||||
|
||||
// Free panel sprites for players
|
||||
pClearSpriteList(pp);
|
||||
|
|
Loading…
Reference in a new issue