diff --git a/common.h b/common.h index 4e907fc..a94b56e 100644 --- a/common.h +++ b/common.h @@ -50,8 +50,6 @@ // Added Ty 07Jan2000 for error details #define MAX_STATEMENT_LENGTH 4096 -#define MAX_LANGUAGES 256 - #define MAX_FUNCTION_COUNT 256 #define MAX_IMPORTS 256 diff --git a/error.c b/error.c index 6dba806..6f0c758 100644 --- a/error.c +++ b/error.c @@ -135,12 +135,6 @@ static struct { ERR_SCRIPT_ALREADY_DEFINED, "Script already has a body." }, { ERR_FUNCTION_ALREADY_DEFINED, "Function already has a body." }, { ERR_PARM_MUST_BE_VAR, "Parameter must be a variable." }, - { ERR_LANGCODE_SIZE, "Language code must be 2 or 3 characters long." }, - { ERR_MISSING_LBRACE_LOC, "Missing opening '{' in localization definition." }, - { ERR_MISSING_RBRACE_LOC, "Missing closing '}' in localization definition." }, - { ERR_MISSING_LOCALIZED, "Missing localized string." }, - { ERR_BAD_LANGCODE, "Language code must be all letters." }, - { ERR_MISSING_LANGCODE, "Missing language code in localization definiton." }, { ERR_MISSING_FONT_NAME, "Missing font name." }, { ERR_MISSING_LBRACE_FONTS, "Missing opening '{' in font list." }, { ERR_MISSING_RBRACE_FONTS, "Missing closing '}' in font list." }, diff --git a/error.h b/error.h index 09a617d..d9d7c2b 100644 --- a/error.h +++ b/error.h @@ -101,12 +101,6 @@ typedef enum ERR_SCRIPT_ALREADY_DEFINED, ERR_FUNCTION_ALREADY_DEFINED, ERR_PARM_MUST_BE_VAR, - ERR_LANGCODE_SIZE, - ERR_MISSING_LBRACE_LOC, - ERR_MISSING_RBRACE_LOC, - ERR_MISSING_LOCALIZED, - ERR_BAD_LANGCODE, - ERR_MISSING_LANGCODE, ERR_MISSING_FONT_NAME, ERR_MISSING_LBRACE_FONTS, ERR_MISSING_RBRACE_FONTS, diff --git a/pcode.c b/pcode.c index 847bcdb..2590106 100644 --- a/pcode.c +++ b/pcode.c @@ -543,7 +543,7 @@ void PC_CloseObject(void) { PC_AppendByte (0); } - if(!pc_NoShrink || (NumLanguages > 1) || (NumStringLists > 0) || + if(!pc_NoShrink || (NumStringLists > 0) || (pc_FunctionCount > 0) || MapVariablesInit || NumArrays != 0 || pc_EncryptStrings || NumImports != 0 || HaveExtendedScripts || HaveScriptArrays) @@ -749,16 +749,9 @@ static void CloseNew(void) } - if(NumLanguages > 1) + if(STR_ListSize() > 0) { - for(i = 0; i < NumLanguages; i++) - { - STR_WriteChunk(i, pc_EncryptStrings); - } - } - else if(STR_ListSize(0) > 0) - { - STR_WriteChunk(0, pc_EncryptStrings); + STR_WriteChunk(pc_EncryptStrings); } STR_WriteListChunk(STRLIST_PICS, MAKE4CC('P','I','C','S'), NO); diff --git a/strlist.c b/strlist.c index dab89a6..daec46c 100644 --- a/strlist.c +++ b/strlist.c @@ -31,12 +31,6 @@ typedef struct stringInfo_t strings[MAX_STRINGS]; } stringList_t; -typedef struct -{ - char name[4]; - stringList_t list; -} languageInfo_t; - // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -57,7 +51,7 @@ int NumLanguages, NumStringLists; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static languageInfo_t *LanguageInfo[MAX_LANGUAGES]; +static stringList_t MainStringList; static stringList_t *StringLists[NUM_STRLISTS]; // CODE -------------------------------------------------------------------- @@ -70,54 +64,8 @@ static stringList_t *StringLists[NUM_STRLISTS]; void STR_Init(void) { - NumLanguages = NumStringLists = 0; - STR_FindLanguage(NULL); // Default language is always number 0 -} - -//========================================================================== -// -// STR_FindLanguage -// -//========================================================================== - -int STR_FindLanguage(char *name) -{ - int i; - - if (name == NULL) - { - if (NumLanguages > 0) - { - return 0; - } - i = 0; - } - else - { - for(i = 0; i < NumLanguages; i++) - { - if (strcmp (name, LanguageInfo[i]->name) == 0) - { - return i; - } - } - } - if(i == NumLanguages) - { - LanguageInfo[i] = MS_Alloc(sizeof(languageInfo_t), ERR_OUT_OF_MEMORY); - memset(LanguageInfo[i]->name, 0, 4); - if(name != NULL) - { - strncpy(LanguageInfo[i]->name, name, 3); - } - LanguageInfo[i]->list.stringCount = 0; - NumLanguages++; - if(NumLanguages > 1 && pc_EnforceHexen) - { - ERR_Error(ERR_HEXEN_COMPAT, YES); - } - } - return i; + NumStringLists = 0; + MainStringList.stringCount = 0; } //========================================================================== @@ -128,7 +76,7 @@ int STR_FindLanguage(char *name) char *STR_Get(int num) { - return LanguageInfo[0]->list.strings[num].name; + return MainStringList.strings[num].name; } //========================================================================== @@ -139,18 +87,7 @@ char *STR_Get(int num) int STR_Find(char *name) { - return STR_FindInLanguage(0, name); -} - -//========================================================================== -// -// STR_FindInLanguage -// -//========================================================================== - -int STR_FindInLanguage(int language, char *name) -{ - return STR_FindInSomeList (&LanguageInfo[language]->list, name); + return STR_FindInSomeList(&MainStringList, name); } //========================================================================== @@ -320,9 +257,9 @@ static int STR_PutStringInSomeList(stringList_t *list, int index, char *name) // //========================================================================== -int STR_ListSize(int list) +int STR_ListSize() { - return LanguageInfo[list]->list.stringCount; + return MainStringList.stringCount; } //========================================================================== @@ -339,10 +276,10 @@ void STR_WriteStrings(void) U_INT pad; MS_Message(MSG_DEBUG, "---- STR_WriteStrings ----\n"); - for(i = 0; i < LanguageInfo[0]->list.stringCount; i++) + for(i = 0; i < MainStringList.stringCount; i++) { - LanguageInfo[0]->list.strings[i].address = pc_Address; - PC_AppendString(LanguageInfo[0]->list.strings[i].name); + MainStringList.strings[i].address = pc_Address; + PC_AppendString(MainStringList.strings[i].name); } if(pc_Address%4 != 0) { // Need to align @@ -362,10 +299,10 @@ void STR_WriteList(void) int i; MS_Message(MSG_DEBUG, "---- STR_WriteList ----\n"); - PC_AppendInt((U_INT)LanguageInfo[0]->list.stringCount); - for(i = 0; i < LanguageInfo[0]->list.stringCount; i++) + PC_AppendInt((U_INT)MainStringList.stringCount); + for(i = 0; i < MainStringList.stringCount; i++) { - PC_AppendInt((U_INT)LanguageInfo[0]->list.strings[i].address); + PC_AppendInt((U_INT)MainStringList.strings[i].address); } } @@ -375,20 +312,19 @@ void STR_WriteList(void) // //========================================================================== -void STR_WriteChunk(int language, boolean encrypt) +void STR_WriteChunk(boolean encrypt) { - languageInfo_t *lang = LanguageInfo[language]; int lenadr; - MS_Message(MSG_DEBUG, "---- STR_WriteChunk %d ----\n", language); + MS_Message(MSG_DEBUG, "---- STR_WriteChunk ----\n"); PC_Append(encrypt ? "STRE" : "STRL", 4); lenadr = pc_Address; PC_SkipInt(); - PC_Append(&lang->name, 4); - PC_AppendInt(lang->list.stringCount); - PC_AppendInt(0); // Used in-game for stringing lists together + PC_AppendInt(0); + PC_AppendInt(MainStringList.stringCount); + PC_AppendInt(0); // Used in-game for stringing lists together (NOT!) - DumpStrings (&lang->list, lenadr, NO, encrypt); + DumpStrings (&MainStringList, lenadr, NO, encrypt); } //========================================================================== diff --git a/strlist.h b/strlist.h index 0c001b0..668d264 100644 --- a/strlist.h +++ b/strlist.h @@ -23,18 +23,16 @@ int STR_Find(char *name); char *STR_Get(int index); void STR_WriteStrings(void); void STR_WriteList(void); -int STR_FindLanguage(char *name); -int STR_FindInLanguage(int language, char *name); int STR_FindInList(int list, char *name); int STR_FindInListInsensitive(int list, char *name); int STR_AppendToList(int list, char *name); const char *STR_GetString(int list, int index); -void STR_WriteChunk(int language, boolean encrypt); +void STR_WriteChunk(boolean encrypt); void STR_WriteListChunk(int list, int id, boolean quad); -int STR_ListSize(int list); +int STR_ListSize(); // PUBLIC DATA DECLARATIONS ------------------------------------------------ -extern int NumLanguages, NumStringLists; +extern int NumStringLists; #endif