mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- took the translation slot definition out of the container and use a dynamic array to store the data.
This commit is contained in:
parent
cf757ba834
commit
66a837f983
3 changed files with 25 additions and 25 deletions
|
@ -62,7 +62,7 @@ PaletteContainer palMgr;
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void PaletteContainer::Init() // This cannot be a constructor!!!
|
||||
void PaletteContainer::Init(int numslots) // This cannot be a constructor!!!
|
||||
{
|
||||
Clear();
|
||||
// Make sure that index 0 is always the identity translation.
|
||||
|
@ -70,6 +70,7 @@ void PaletteContainer::Init() // This cannot be a constructor!!!
|
|||
remap.MakeIdentity();
|
||||
remap.Inactive = true;
|
||||
AddRemap(&remap);
|
||||
TranslationTables.Resize(numslots);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -82,7 +83,7 @@ void PaletteContainer::Clear()
|
|||
{
|
||||
remapArena.FreeAllBlocks();
|
||||
uniqueRemaps.Reset();
|
||||
for (auto& slot : TranslationTables) slot.Reset();
|
||||
TranslationTables.Reset();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -160,7 +161,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation)
|
|||
unsigned int type = GetTranslationType(translation);
|
||||
unsigned int index = GetTranslationIndex(translation);
|
||||
|
||||
if (type <= 0 || type >= NUM_TRANSLATION_TABLES || index >= NumTranslations(type))
|
||||
if (type <= 0 || type >= TranslationTables.Size() || index >= NumTranslations(type))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,25 @@
|
|||
|
||||
class FSerializer;
|
||||
|
||||
enum
|
||||
{
|
||||
TRANSLATION_Invalid,
|
||||
TRANSLATION_Players,
|
||||
TRANSLATION_PlayersExtra,
|
||||
TRANSLATION_Standard,
|
||||
TRANSLATION_LevelScripted,
|
||||
TRANSLATION_Decals,
|
||||
TRANSLATION_PlayerCorpses,
|
||||
TRANSLATION_Decorate,
|
||||
TRANSLATION_Blood,
|
||||
TRANSLATION_RainPillar,
|
||||
TRANSLATION_Custom,
|
||||
TRANSLATION_Font,
|
||||
|
||||
NUM_TRANSLATION_TABLES
|
||||
};
|
||||
|
||||
|
||||
enum EStandardTranslations
|
||||
{
|
||||
STD_Ice = 7,
|
||||
|
|
|
@ -72,33 +72,13 @@ inline int GetTranslationIndex(uint32_t trans)
|
|||
return (trans & TRANSLATION_MASK);
|
||||
}
|
||||
|
||||
// Fixme: This should avoid hard game content dependencies!
|
||||
enum
|
||||
{
|
||||
TRANSLATION_Invalid,
|
||||
TRANSLATION_Players,
|
||||
TRANSLATION_PlayersExtra,
|
||||
TRANSLATION_Standard,
|
||||
TRANSLATION_LevelScripted,
|
||||
TRANSLATION_Decals,
|
||||
TRANSLATION_PlayerCorpses,
|
||||
TRANSLATION_Decorate,
|
||||
TRANSLATION_Blood,
|
||||
TRANSLATION_RainPillar,
|
||||
TRANSLATION_Custom,
|
||||
TRANSLATION_Font,
|
||||
|
||||
NUM_TRANSLATION_TABLES
|
||||
};
|
||||
|
||||
|
||||
class PaletteContainer
|
||||
{
|
||||
FMemArena remapArena;
|
||||
TArray<FRemapTable*> uniqueRemaps;
|
||||
TAutoGrowArray<FRemapTablePtr, FRemapTable*> TranslationTables[NUM_TRANSLATION_TABLES];
|
||||
TArray<TAutoGrowArray<FRemapTablePtr, FRemapTable*>> TranslationTables;
|
||||
public:
|
||||
void Init(); // This cannot be a constructor!!!
|
||||
void Init(int numslots); // This cannot be a constructor!!!
|
||||
void Clear();
|
||||
FRemapTable* AddRemap(FRemapTable* remap);
|
||||
void UpdateTranslation(int trans, FRemapTable* remap);
|
||||
|
|
Loading…
Reference in a new issue