mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-24 18:12:00 +00:00
- cleanup of voxel init code.
The voxreserve array was never properly set up so it is gone now. nextvoxid now gets set right before loading .def files.
This commit is contained in:
parent
8a789b9015
commit
c34756e5f2
6 changed files with 12 additions and 16 deletions
|
@ -855,21 +855,20 @@ static int lastvoxid = -1;
|
|||
void parseDefineVoxel(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
sc.MustGetString();
|
||||
while (nextvoxid < MAXVOXELS && voxreserve[nextvoxid]) nextvoxid++;
|
||||
|
||||
if (nextvoxid == MAXVOXELS)
|
||||
if (tbuild->nextvoxid == MAXVOXELS)
|
||||
{
|
||||
pos.Message(MSG_ERROR, "Maximum number of voxels (%d) already defined.", MAXVOXELS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (voxDefine(nextvoxid, sc.String))
|
||||
if (voxDefine(tbuild->nextvoxid, sc.String))
|
||||
{
|
||||
pos.Message(MSG_ERROR, "Unable to load voxel file \"%s\"", sc.String);
|
||||
return;
|
||||
}
|
||||
|
||||
lastvoxid = nextvoxid++;
|
||||
lastvoxid = tbuild->nextvoxid++;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -908,20 +907,18 @@ void parseVoxel(FScanner& sc, FScriptPosition& pos)
|
|||
|
||||
if (!sc.GetString(fn)) return;
|
||||
|
||||
while (nextvoxid < MAXVOXELS && voxreserve[nextvoxid]) nextvoxid++;
|
||||
|
||||
if (nextvoxid == MAXVOXELS)
|
||||
if (tbuild->nextvoxid == MAXVOXELS)
|
||||
{
|
||||
pos.Message(MSG_ERROR, "Maximum number of voxels (%d) already defined.", MAXVOXELS);
|
||||
error = true;
|
||||
}
|
||||
else if (voxDefine(nextvoxid, fn))
|
||||
else if (voxDefine(tbuild->nextvoxid, fn))
|
||||
{
|
||||
pos.Message(MSG_ERROR, "Unable to load voxel file \"%s\"", fn.GetChars());
|
||||
error = true;
|
||||
}
|
||||
|
||||
int lastvoxid = nextvoxid++;
|
||||
int lastvoxid = tbuild->nextvoxid++;
|
||||
|
||||
if (sc.StartBraces(&blockend)) return;
|
||||
while (!sc.FoundEndBrace(blockend))
|
||||
|
|
|
@ -22,9 +22,6 @@ extern float voxscale[];
|
|||
extern voxmodel_t* voxmodels[MAXVOXELS];
|
||||
extern FixedBitArray<MAXVOXELS> voxrotate;
|
||||
|
||||
inline int32_t nextvoxid;
|
||||
inline FixedBitArray<MAXVOXELS>voxreserve;
|
||||
|
||||
void voxInit();
|
||||
void voxClear();
|
||||
int voxDefine(int voxindex, const char* filename);
|
||||
|
|
|
@ -100,6 +100,11 @@ CCMD(tilecrc)
|
|||
|
||||
static void LoadDefinitions(TilesetBuildInfo& info)
|
||||
{
|
||||
for (unsigned i = 0; i < info.tile.Size(); i++)
|
||||
{
|
||||
if (info.tile[i].extinfo.tiletovox > info.nextvoxid) info.nextvoxid = info.tile[i].extinfo.tiletovox;
|
||||
}
|
||||
info.nextvoxid++;
|
||||
const char* defsfile = G_DefFile();
|
||||
FString razedefsfile = defsfile;
|
||||
razedefsfile.Substitute(".def", "-raze.def");
|
||||
|
|
|
@ -22,6 +22,7 @@ struct TilesetBuildInfo
|
|||
TArray<TileBuildDesc> tile;
|
||||
unsigned maxtileofart;
|
||||
TArray <std::pair<FName, int>> aliases;
|
||||
int32_t nextvoxid;
|
||||
void addName(const char* name, int index)
|
||||
{
|
||||
aliases.Push(std::make_pair(name, index));
|
||||
|
|
|
@ -86,7 +86,6 @@ void GameInterface::LoadTextureInfo(TilesetBuildInfo& info)
|
|||
{
|
||||
info.tile[i].extinfo.tiletovox = voxindex;
|
||||
}
|
||||
if (nextvoxid <= voxindex) nextvoxid = voxindex + 1;
|
||||
}
|
||||
}
|
||||
hFile = fileSystem.OpenFileReader("SHADE.DAT");
|
||||
|
|
|
@ -220,9 +220,6 @@ void LoadKVXFromScript(TilesetBuildInfo& info, const char* filename)
|
|||
{
|
||||
info.tile[lTile].extinfo.tiletovox = lNumber;
|
||||
}
|
||||
|
||||
if (lNumber >= nextvoxid) // JBF: so voxels in the def file append to the list
|
||||
nextvoxid = lNumber + 1;
|
||||
}
|
||||
while (script_p < scriptend_p);
|
||||
|
||||
|
|
Loading…
Reference in a new issue