mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 12:01:05 +00:00
Delete translations in G_InitialState
This commit is contained in:
parent
3bb3223dbd
commit
1aab7ffa2d
4 changed files with 65 additions and 1 deletions
|
@ -1800,6 +1800,9 @@ void D_ReloadFiles(void)
|
|||
Patch_FreeTag(PU_PATCH_ROTATED);
|
||||
Patch_FreeTag(PU_SPRITE);
|
||||
|
||||
// Reinit the palette remaps
|
||||
PaletteRemap_Init();
|
||||
|
||||
// Load SOC and Lua.
|
||||
for (INT32 i = 0; i < numwadfiles; i++)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "p_local.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_main.h"
|
||||
#include "r_translation.h"
|
||||
#include "s_sound.h"
|
||||
#include "g_game.h"
|
||||
#include "g_demo.h"
|
||||
|
@ -4392,6 +4393,10 @@ void G_InitialState(void)
|
|||
// Delete all skins.
|
||||
R_DelSkins();
|
||||
|
||||
// Delete all translations
|
||||
R_DeleteCustomTranslations();
|
||||
PaletteRemap_DeleteAll();
|
||||
|
||||
// Clear all added sound effects.
|
||||
for (INT32 i = sfx_freeslot0; i <= sfx_lastskinsoundslot; i++)
|
||||
{
|
||||
|
|
|
@ -139,6 +139,48 @@ unsigned PaletteRemap_Add(remaptable_t *tr)
|
|||
return numpaletteremaps - 1;
|
||||
}
|
||||
|
||||
static void DeleteSkincolorRemaps(colorcache_t **remaps)
|
||||
{
|
||||
for (unsigned i = 0; i < MAXSKINCOLORS - 1; i++)
|
||||
{
|
||||
if (remaps[i])
|
||||
Z_Free(remaps[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void PaletteRemap_Delete(remaptable_t *tr)
|
||||
{
|
||||
if (tr->skincolor_remaps)
|
||||
{
|
||||
for (unsigned i = 0; i < TT_CACHE_SIZE; i++)
|
||||
{
|
||||
colorcache_t **remaps = tr->skincolor_remaps[i];
|
||||
if (remaps)
|
||||
{
|
||||
DeleteSkincolorRemaps(remaps);
|
||||
Z_Free(remaps);
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free(tr->skincolor_remaps);
|
||||
}
|
||||
|
||||
Z_Free(tr->sources);
|
||||
|
||||
Z_Free(tr);
|
||||
}
|
||||
|
||||
void PaletteRemap_DeleteAll(void)
|
||||
{
|
||||
for (unsigned i = 0; i < numpaletteremaps; i++)
|
||||
PaletteRemap_Delete(paletteremaps[i]);
|
||||
|
||||
Z_Free(paletteremaps);
|
||||
|
||||
paletteremaps = NULL;
|
||||
numpaletteremaps = 0;
|
||||
}
|
||||
|
||||
static void MakeGrayscaleRemap(void)
|
||||
{
|
||||
remaptable_t *grayscale = PaletteRemap_New();
|
||||
|
@ -1129,7 +1171,7 @@ UINT8 *R_GetTranslationRemap(int id, skincolornum_t skincolor, INT32 skinnum)
|
|||
INT32 index = R_SkinTranslationToCacheIndex(skinnum);
|
||||
|
||||
if (!tr->skincolor_remaps[index])
|
||||
tr->skincolor_remaps[index] = Z_Calloc(NUM_PALETTE_ENTRIES * (MAXSKINCOLORS - 1), PU_LEVEL, NULL);
|
||||
tr->skincolor_remaps[index] = Z_Calloc(sizeof(colorcache_t *) * (MAXSKINCOLORS - 1), PU_LEVEL, NULL);
|
||||
|
||||
colorcache_t *cache = tr->skincolor_remaps[index][skincolor - 1];
|
||||
if (!cache)
|
||||
|
@ -1179,3 +1221,15 @@ remaptable_t *R_GetBuiltInTranslation(SINT8 tc)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void R_DeleteCustomTranslations(void)
|
||||
{
|
||||
for (unsigned i = 0; i < numcustomtranslations; i++)
|
||||
{
|
||||
Z_Free(customtranslations[i].name);
|
||||
}
|
||||
|
||||
Z_Free(customtranslations);
|
||||
customtranslations = NULL;
|
||||
numcustomtranslations = 0;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ boolean PaletteRemap_Equal(remaptable_t *a, remaptable_t *b);
|
|||
void PaletteRemap_SetIdentity(remaptable_t *tr);
|
||||
boolean PaletteRemap_IsIdentity(remaptable_t *tr);
|
||||
unsigned PaletteRemap_Add(remaptable_t *tr);
|
||||
void PaletteRemap_DeleteAll(void);
|
||||
|
||||
int R_FindCustomTranslation(const char *name);
|
||||
int R_FindCustomTranslation_CaseInsensitive(const char *name);
|
||||
|
@ -89,6 +90,7 @@ remaptable_t *R_GetTranslationByID(int id);
|
|||
UINT8 *R_GetTranslationRemap(int id, skincolornum_t skincolor, INT32 skinnum);
|
||||
void R_UpdateTranslationRemaps(skincolornum_t skincolor, INT32 skinnum);
|
||||
boolean R_TranslationIsValid(int id);
|
||||
void R_DeleteCustomTranslations(void);
|
||||
|
||||
void R_ParseTrnslate(INT32 wadNum, UINT16 lumpnum);
|
||||
void R_LoadParsedTranslations(void);
|
||||
|
|
Loading…
Reference in a new issue