diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 9d6386c549..08d97bbd76 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -1,3 +1,6 @@ +# STR_XXXX part is read and XXXX becomes the string id number. +# Everything after the colon and before the new line will be saved as the string. +# Use # at the beginning of a line to leave a comment. STR_0000 : STR_0001 :{STRINGID} {COMMA16} STR_0002 :Ride @@ -2758,6 +2761,7 @@ STR_2756 :??? STR_2757 :??? STR_2758 :??? STR_2759 :??? +# New strings used in the cheats window previously these were ??? STR_2760 :+5K Money STR_2761 :Pay For Entrance STR_2762 :Pay For Rides @@ -2777,6 +2781,7 @@ STR_2775 :??? STR_2776 :Language STR_2777 :{MOVE_X}{SMALLFONT}{STRING} STR_2778 :{RIGHTGUILLEMET}{MOVE_X}{SMALLFONT}{STRING} +# End of new strings STR_2779 :??? STR_2780 :??? STR_2781 :{STRINGID}:{MOVE_X}{195}{STRINGID}{STRINGID} diff --git a/data/language/english_us.txt b/data/language/english_us.txt index 623d4a5149..ad3f71c398 100644 --- a/data/language/english_us.txt +++ b/data/language/english_us.txt @@ -1,3 +1,6 @@ +# STR_XXXX part is read and XXXX becomes the string id number. +# Everything after the colon and before the new line will be saved as the string. +# Use # at the beginning of a line to leave a comment. STR_0000 : STR_0001 :{STRINGID} {COMMA16} STR_0002 :Ride @@ -2758,6 +2761,7 @@ STR_2756 :??? STR_2757 :??? STR_2758 :??? STR_2759 :??? +# New strings used in the cheats window previously these were ??? STR_2760 :+5K Money STR_2761 :Pay For Entrance STR_2762 :Pay For Rides @@ -2771,6 +2775,7 @@ STR_2769 :Open Park STR_2770 :Close Park STR_2771 :Slower Gamespeed STR_2772 :Faster Gamespeed +# End of new strings STR_2773 :??? STR_2774 :??? STR_2775 :??? diff --git a/src/language.c b/src/language.c index 1d41dd923c..14265f6081 100644 --- a/src/language.c +++ b/src/language.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include +#include #include "addresses.h" #include "language.h" #include "string_ids.h" @@ -86,8 +87,9 @@ int language_open(int id) * read / write strings in some way is decompiled. The original game used a DIY extended 8-bit extended ASCII set for special * characters, format codes and accents. * - * In terms of reading the language files, the STR_XXXX part is completely ignored at the moment. It just parses each line from - * the colon and thus not allowing gaps in the string indices. + * In terms of reading the language files, the STR_XXXX part is read and XXXX becomes the string id number. Everything after the + * colon and before the new line will be saved as the string. Tokens are written with inside curly braces {TOKEN}. + * Use # at the beginning of a line to leave a comment. */ static int language_open_file(const char *filename) { @@ -106,17 +108,26 @@ static int language_open_file(const char *filename) char *dst, *token; char tokenBuffer[64]; - int i, stringIndex = 0, mode = 0; + int i, stringIndex = 0, mode = 0, string_no; for (i = 0; i < language_buffer_size; i++) { char *src = &language_buffer[i]; switch (mode) { case 0: - // Search for colon - if (*src == ':') { + // Search for a comment + if (*src == '#') { + mode = 3; + } else if (*src == ':' && string_no != -1) { + // Search for colon dst = src + 1; - language_strings[stringIndex++] = dst; + language_strings[string_no] = dst; + stringIndex++; mode = 1; + } else if (!strncmp(src, "STR_", 4)){ + // Copy in the string number, 4 characters only + if (sscanf(src, "STR_%4d", &string_no) != 1) { + string_no = -1; + } } break; case 1: @@ -144,6 +155,10 @@ static int language_open_file(const char *filename) mode = 1; } break; + case 3: + if (*src == '\n' || *src == '\r') { + mode = 0; + } } } language_num_strings = stringIndex; diff --git a/src/object.c b/src/object.c index e503fd9f88..1df31a9b79 100644 --- a/src/object.c +++ b/src/object.c @@ -94,8 +94,34 @@ static int object_calculate_checksum(rct_object_entry *entry, char *data, int da return checksum; } +/** + * rct2: 0x66B355 part + * If al is 0 + * chunk : esi + */ +int object_scenario_load_custom_text(char* chunk){ + int ebp = (int)(&((uint32*)chunk)[2]); + int edx = 0; + int eax, ebx, ecx, edi; + RCT2_CALLFUNC_X(0x6A9E24, &eax, &ebx, &ecx, &edx, (int*)&chunk, &edi, &ebp); + *((uint16*)chunk) = eax; + edx++; + RCT2_CALLFUNC_X(0x6A9E24, &eax, &ebx, &ecx, &edx, (int*)&chunk, &edi, &ebp); + *((uint16*)chunk + 1) = eax; + edx++; + RCT2_CALLFUNC_X(0x6A9E24, &eax, &ebx, &ecx, &edx, (int*)&chunk, &edi, &ebp); + *((uint16*)chunk + 2) = eax; + + if (RCT2_GLOBAL(0x9ADAF4, int) == -1)return 0; + else *(RCT2_GLOBAL(0x9ADAF4, uint32*)) = 0; + return 1; +} + int object_paint(int type, int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp) { + if (type == 10){ + if (eax == 0) return object_scenario_load_custom_text((char*)esi); + } RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098D9D4, uint32)[type], eax, ebx, ecx, edx, esi, edi, ebp); #ifdef _MSC_VER __asm jb success