1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 15:40:00 +00:00

Original GXT support

This commit is contained in:
Sergeanur 2021-01-08 15:34:21 +02:00
parent a99457ee29
commit d68ffc2da6
2 changed files with 23 additions and 4 deletions

View file

@ -13,7 +13,7 @@
static wchar WideErrorString[25]; static wchar WideErrorString[25];
CText TheText; CText *CText::msInstance = nil;
CText::CText(void) CText::CText(void)
{ {
@ -41,7 +41,7 @@ CText::Load(void)
CFileMgr::SetDir("TEXT"); CFileMgr::SetDir("TEXT");
switch(FrontEndMenuManager.m_PrefsLanguage){ switch(FrontEndMenuManager.m_PrefsLanguage){
case CMenuManager::LANGUAGE_AMERICAN: case CMenuManager::LANGUAGE_AMERICAN:
sprintf(filename, "AMERICAN.GXT"); sprintf(filename, "ENGLISH.GXT");
break; break;
case CMenuManager::LANGUAGE_FRENCH: case CMenuManager::LANGUAGE_FRENCH:
sprintf(filename, "FRENCH.GXT"); sprintf(filename, "FRENCH.GXT");
@ -93,11 +93,13 @@ CText::Load(void)
keyArray.Update(data.chars); keyArray.Update(data.chars);
CFileMgr::CloseFile(file); CFileMgr::CloseFile(file);
CFileMgr::SetDir(""); CFileMgr::SetDir("");
bIsLoaded = true;
} }
void void
CText::Unload(void) CText::Unload(void)
{ {
bIsLoaded = false;
CMessages::ClearAllMessagesDisplayedByGame(); CMessages::ClearAllMessagesDisplayedByGame();
keyArray.Unload(); keyArray.Unload();
data.Unload(); data.Unload();
@ -307,6 +309,11 @@ CText::LoadMissionText(char *MissionTableName)
bIsMissionTextLoaded = true; bIsMissionTextLoaded = true;
} }
bool
CText::IsLoaded()
{
return bIsLoaded;
}
void void
CKeyArray::Load(size_t length, int file, size_t* offset) CKeyArray::Load(size_t length, int file, size_t* offset)

View file

@ -58,7 +58,7 @@ public:
uint32 offset; uint32 offset;
}; };
enum {MAX_MISSION_TEXTS = 90}; // beware that LCS has more enum {MAX_MISSION_TEXTS = 200};
Entry data[MAX_MISSION_TEXTS]; Entry data[MAX_MISSION_TEXTS];
uint16 size; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready. uint16 size; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready.
@ -84,6 +84,9 @@ class CText
bool bIsMissionTextLoaded; bool bIsMissionTextLoaded;
char szMissionTableName[8]; char szMissionTableName[8];
CMissionTextOffsets MissionTextOffsets; CMissionTextOffsets MissionTextOffsets;
bool bIsLoaded;
static CText *msInstance;
public: public:
CText(void); CText(void);
void Load(void); void Load(void);
@ -94,6 +97,15 @@ public:
void GetNameOfLoadedMissionText(char *outName); void GetNameOfLoadedMissionText(char *outName);
void ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *bytes_read); void ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *bytes_read);
void LoadMissionText(char *MissionTableName); void LoadMissionText(char *MissionTableName);
bool IsLoaded();
void GetUTF8(const char*, char*, int); // TODO but unused
static CText &Instance()
{
if (!msInstance)
msInstance = new CText;
return *msInstance;
}
}; };
extern CText TheText; #define TheText CText::Instance()