mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
- store UnchangedSpriteNames in Dehacked in a less hacky manner.
This commit is contained in:
parent
d937c50726
commit
faa4bb45c9
1 changed files with 19 additions and 45 deletions
|
@ -223,8 +223,7 @@ DEFINE_FIELD_X(DehInfo, DehInfo, BlueAC)
|
||||||
|
|
||||||
TArray<PClassActor *> TouchedActors;
|
TArray<PClassActor *> TouchedActors;
|
||||||
|
|
||||||
char *UnchangedSpriteNames;
|
TArray<uint32_t> UnchangedSpriteNames;
|
||||||
int NumUnchangedSprites;
|
|
||||||
bool changedStates;
|
bool changedStates;
|
||||||
|
|
||||||
// Sprite<->Class map for DehackedPickup::DetermineType
|
// Sprite<->Class map for DehackedPickup::DetermineType
|
||||||
|
@ -395,17 +394,10 @@ static bool HandleKey (const struct Key *keys, void *structure, const char *key,
|
||||||
|
|
||||||
static int FindSprite (const char *sprname)
|
static int FindSprite (const char *sprname)
|
||||||
{
|
{
|
||||||
int i;
|
uint32_t nameint;
|
||||||
uint32_t nameint = *((uint32_t *)sprname);
|
memcpy(&nameint, sprname, 4);
|
||||||
|
auto f = UnchangedSpriteNames.Find(nameint);
|
||||||
for (i = 0; i < NumUnchangedSprites; ++i)
|
return f == UnchangedSpriteNames.Size() ? -1 : f;
|
||||||
{
|
|
||||||
if (*((uint32_t *)&UnchangedSpriteNames[i*4]) == nameint)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static FState *FindState (int statenum)
|
static FState *FindState (int statenum)
|
||||||
|
@ -2665,31 +2657,16 @@ static void UnloadDehSupp ()
|
||||||
// that was altered by the first. So we need to keep the
|
// that was altered by the first. So we need to keep the
|
||||||
// StateMap around until all patches have been applied.
|
// StateMap around until all patches have been applied.
|
||||||
DehUseCount = 0;
|
DehUseCount = 0;
|
||||||
Actions.Clear();
|
Actions.Reset();
|
||||||
Actions.ShrinkToFit();
|
OrgHeights.Reset();
|
||||||
OrgHeights.Clear();
|
CodePConv.Reset();
|
||||||
OrgHeights.ShrinkToFit();
|
OrgSprNames.Reset();
|
||||||
CodePConv.Clear();
|
SoundMap.Reset();
|
||||||
CodePConv.ShrinkToFit();
|
InfoNames.Reset();
|
||||||
OrgSprNames.Clear();
|
BitNames.Reset();
|
||||||
OrgSprNames.ShrinkToFit();
|
StyleNames.Reset();
|
||||||
SoundMap.Clear();
|
AmmoNames.Reset();
|
||||||
SoundMap.ShrinkToFit();
|
UnchangedSpriteNames.Reset();
|
||||||
InfoNames.Clear();
|
|
||||||
InfoNames.ShrinkToFit();
|
|
||||||
BitNames.Clear();
|
|
||||||
BitNames.ShrinkToFit();
|
|
||||||
StyleNames.Clear();
|
|
||||||
StyleNames.ShrinkToFit();
|
|
||||||
AmmoNames.Clear();
|
|
||||||
AmmoNames.ShrinkToFit();
|
|
||||||
|
|
||||||
if (UnchangedSpriteNames != NULL)
|
|
||||||
{
|
|
||||||
delete[] UnchangedSpriteNames;
|
|
||||||
UnchangedSpriteNames = NULL;
|
|
||||||
NumUnchangedSprites = 0;
|
|
||||||
}
|
|
||||||
if (EnglishStrings != NULL)
|
if (EnglishStrings != NULL)
|
||||||
{
|
{
|
||||||
delete EnglishStrings;
|
delete EnglishStrings;
|
||||||
|
@ -2731,14 +2708,11 @@ static bool LoadDehSupp ()
|
||||||
EnglishStrings->LoadStrings (true);
|
EnglishStrings->LoadStrings (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UnchangedSpriteNames == NULL)
|
|
||||||
|
UnchangedSpriteNames.Resize(sprites.Size());
|
||||||
|
for (unsigned i = 0; i < UnchangedSpriteNames.Size(); ++i)
|
||||||
{
|
{
|
||||||
UnchangedSpriteNames = new char[sprites.Size()*4];
|
memcpy (&UnchangedSpriteNames[i], &sprites[i].name, 4);
|
||||||
NumUnchangedSprites = sprites.Size();
|
|
||||||
for (i = 0; i < NumUnchangedSprites; ++i)
|
|
||||||
{
|
|
||||||
memcpy (UnchangedSpriteNames+i*4, &sprites[i].name, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FScanner sc;
|
FScanner sc;
|
||||||
|
|
Loading…
Reference in a new issue