diff --git a/Makefile b/Makefile index 596dfd6a..af4716f5 100644 --- a/Makefile +++ b/Makefile @@ -223,7 +223,7 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h))) # Directories containing source files # Hi, I'm a PC -SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes +SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/text src/text/libs src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes ifeq ($(DISCORDRPC),1) SRC_DIRS += src/pc/discord @@ -607,6 +607,7 @@ $(BASEPACK_LST): $(EXE) @find actors -name \*.png -exec echo "{} gfx/{}" >> $(BASEPACK_LST) \; @find levels -name \*.png -exec echo "{} gfx/{}" >> $(BASEPACK_LST) \; @find textures -name \*.png -exec echo "{} gfx/{}" >> $(BASEPACK_LST) \; + @find texts -name \*.json -exec echo "{} {}" >> $(BASEPACK_LST) \; # prepares the resource ZIP with base data $(BASEPACK_PATH): $(BASEPACK_LST) diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index 7ae9f1e7..2c812fea 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -31,6 +31,8 @@ #include "options_menu.h" #endif +#include "text/text-loader.h" + u16 gDialogColorFadeTimer; s8 gLastDialogLineNum; s32 gDialogVariable; @@ -1691,31 +1693,10 @@ s8 gDialogCourseActNum = 1; #endif void render_dialog_entries(void) { -#ifdef VERSION_EU + + struct DialogEntry * dialog; + dialog = segmented_to_virtual(dialogPool[gDialogID]); s8 lowerBound; -#endif - void **dialogTable; - struct DialogEntry *dialog; -#ifdef VERSION_US - s8 lowerBound; -#endif -#ifdef VERSION_EU - gInGameLanguage = eu_get_language(); - switch (gInGameLanguage) { - case LANGUAGE_ENGLISH: - dialogTable = segmented_to_virtual(dialog_table_eu_en); - break; - case LANGUAGE_FRENCH: - dialogTable = segmented_to_virtual(dialog_table_eu_fr); - break; - case LANGUAGE_GERMAN: - dialogTable = segmented_to_virtual(dialog_table_eu_de); - break; - } -#else - dialogTable = segmented_to_virtual(seg2_dialog_table); -#endif - dialog = segmented_to_virtual(dialogTable[gDialogID]); // if the dialog entry is invalid, set the ID to -1. if (segmented_to_virtual(NULL) == dialog) { @@ -2010,26 +1991,9 @@ void do_cutscene_handler(void) { // "Dear Mario" message handler void print_peach_letter_message(void) { - void **dialogTable; struct DialogEntry *dialog; u8 *str; -#ifdef VERSION_EU - gInGameLanguage = eu_get_language(); - switch (gInGameLanguage) { - case LANGUAGE_ENGLISH: - dialogTable = segmented_to_virtual(dialog_table_eu_en); - break; - case LANGUAGE_FRENCH: - dialogTable = segmented_to_virtual(dialog_table_eu_fr); - break; - case LANGUAGE_GERMAN: - dialogTable = segmented_to_virtual(dialog_table_eu_de); - break; - } -#else - dialogTable = segmented_to_virtual(seg2_dialog_table); -#endif - dialog = segmented_to_virtual(dialogTable[gDialogID]); + dialog = segmented_to_virtual(dialogPool[gDialogID]); str = segmented_to_virtual(dialog->str); @@ -2042,15 +2006,10 @@ void print_peach_letter_message(void) { gDPSetEnvColor(gDisplayListHead++, 20, 20, 20, gCutsceneMsgFade); print_generic_string(STR_X, STR_Y, str); -#if defined(VERSION_JP) || defined(VERSION_SH) - gSPDisplayList(gDisplayListHead++, dl_ia_text_end); -#endif gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); -#ifndef VERSION_JP gSPDisplayList(gDisplayListHead++, dl_ia_text_end); gDPSetEnvColor(gDisplayListHead++, 200, 80, 120, gCutsceneMsgFade); gSPDisplayList(gDisplayListHead++, castle_grounds_seg7_us_dl_0700F2E8); -#endif // at the start/end of message, reset the fade. if (gCutsceneMsgTimer == 0) { diff --git a/src/game/skybox.c b/src/game/skybox.c index 09deeaf0..67339508 100644 --- a/src/game/skybox.c +++ b/src/game/skybox.c @@ -60,30 +60,17 @@ struct Skybox { struct Skybox sSkyBoxInfo[2]; -typedef const u8 *const SkyboxTexture[80]; - -extern SkyboxTexture bbh_skybox_ptrlist; -extern SkyboxTexture bidw_skybox_ptrlist; -extern SkyboxTexture bitfs_skybox_ptrlist; -extern SkyboxTexture bits_skybox_ptrlist; -extern SkyboxTexture ccm_skybox_ptrlist; -extern SkyboxTexture cloud_floor_skybox_ptrlist; -extern SkyboxTexture clouds_skybox_ptrlist; -extern SkyboxTexture ssl_skybox_ptrlist; -extern SkyboxTexture water_skybox_ptrlist; -extern SkyboxTexture wdw_skybox_ptrlist; - -SkyboxTexture *sSkyboxTextures[10] = { - &water_skybox_ptrlist, - &bitfs_skybox_ptrlist, - &wdw_skybox_ptrlist, - &cloud_floor_skybox_ptrlist, - &ccm_skybox_ptrlist, - &ssl_skybox_ptrlist, - &bbh_skybox_ptrlist, - &bidw_skybox_ptrlist, - &clouds_skybox_ptrlist, - &bits_skybox_ptrlist, +char * sSkyboxTextures[10] = { + "textures/skyboxes/water", + "textures/skyboxes/bitfs", + "textures/skyboxes/wdw", + "textures/skyboxes/cloud_floor", + "textures/skyboxes/ccm", + "textures/skyboxes/ssl", + "textures/skyboxes/bbh", + "textures/skyboxes/bidw", + "textures/skyboxes/clouds", + "textures/skyboxes/bits", }; /** @@ -98,31 +85,31 @@ u8 sSkyboxColors[][3] = { /** * Constant used to scale the skybox horizontally to a multiple of the screen's width */ -#define SKYBOX_WIDTH (4 * SCREEN_WIDTH) +#define SKYBOX_WIDTH (2 * SCREEN_WIDTH) /** * Constant used to scale the skybox vertically to a multiple of the screen's height */ -#define SKYBOX_HEIGHT (4 * SCREEN_HEIGHT) +#define SKYBOX_HEIGHT (2 * SCREEN_HEIGHT) /** * The tile's width in world space. * By default, two full tiles can fit in the screen. */ -#define SKYBOX_TILE_WIDTH (SCREEN_WIDTH / 2) +#define SKYBOX_TILE_WIDTH SKYBOX_WIDTH /** * The tile's height in world space. * By default, two full tiles can fit in the screen. */ -#define SKYBOX_TILE_HEIGHT (SCREEN_HEIGHT / 2) +#define SKYBOX_TILE_HEIGHT SKYBOX_HEIGHT /** * The horizontal length of the skybox tilemap in tiles. */ -#define SKYBOX_COLS (10) +#define SKYBOX_COLS 1 /** * The vertical length of the skybox tilemap in tiles. */ -#define SKYBOX_ROWS (8) +#define SKYBOX_ROWS 1 /** @@ -144,7 +131,7 @@ f32 calculate_skybox_scaled_x(s8 player, f32 fov) { if (scaledX > SKYBOX_WIDTH) { scaledX -= (s32) scaledX / SKYBOX_WIDTH * SKYBOX_WIDTH; } - return SKYBOX_WIDTH - scaledX; + return 0; } /** @@ -162,7 +149,7 @@ f32 calculate_skybox_scaled_y(s8 player, UNUSED f32 fov) { // Since pitch can be negative, and the tile grid starts 1 octant above the camera's focus, add // 5 octants to the y position - f32 scaledY = degreesToScale + 5 * SKYBOX_TILE_HEIGHT; + f32 scaledY = degreesToScale + 5 * SKYBOX_TILE_HEIGHT / 4; if (scaledY > SKYBOX_HEIGHT) { scaledY = SKYBOX_HEIGHT; @@ -180,7 +167,7 @@ static int get_top_left_tile_idx(s8 player) { s32 tileCol = sSkyBoxInfo[player].scaledX / SKYBOX_TILE_WIDTH; s32 tileRow = (SKYBOX_HEIGHT - sSkyBoxInfo[player].scaledY) / SKYBOX_TILE_HEIGHT; - return tileRow * SKYBOX_COLS + tileCol; + return 0; } /** @@ -218,18 +205,12 @@ void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex) s32 row; s32 col; - for (row = 0; row < 3; row++) { - for (col = 0; col < 3; col++) { - s32 tileIndex = sSkyBoxInfo[player].upperLeftTile + row * SKYBOX_COLS + col; - const u8 *const texture = - (*(SkyboxTexture *) segmented_to_virtual(sSkyboxTextures[background]))[tileIndex]; - Vtx *vertices = make_skybox_rect(tileIndex, colorIndex); + const u8 *const texture = sSkyboxTextures[background]; + Vtx *vertices = make_skybox_rect(0, colorIndex); - gLoadBlockTexture((*dlist)++, 32, 32, G_IM_FMT_RGBA, texture); - gSPVertex((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0); - gSPDisplayList((*dlist)++, dl_draw_quad_verts_0123); - } - } + gLoadBlockTexture((*dlist)++, 32, 32, G_IM_FMT_RGBA, texture); + gSPVertex((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0); + gSPDisplayList((*dlist)++, dl_draw_quad_verts_0123); } void *create_skybox_ortho_matrix(s8 player) { diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 5de4f09c..84d4b479 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -39,6 +39,8 @@ #include "pc/discord/discordrpc.h" #endif +#include "text/text-loader.h" + OSMesg D_80339BEC; OSMesgQueue gSIEventMesgQueue; @@ -179,7 +181,7 @@ void main_func(void) { const char *gamedir = gCLIOpts.GameDir[0] ? gCLIOpts.GameDir : FS_BASEDIR; const char *userpath = gCLIOpts.SavePath[0] ? gCLIOpts.SavePath : sys_user_path(); fs_init(sys_ropaths, gamedir, userpath); - + alloc_dialog_pool(); configfile_load(configfile_name()); if (gCLIOpts.FullScreen == 1) diff --git a/src/text/libs/cJSON.c b/src/text/libs/cJSON.c new file mode 100644 index 00000000..7518389b --- /dev/null +++ b/src/text/libs/cJSON.c @@ -0,0 +1,3096 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +/* cJSON */ +/* JSON parser in C. */ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ENABLE_LOCALES +#include +#endif + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUC__ +#pragma GCC visibility pop +#endif + +#include "cJSON.h" + +/* define our own boolean type */ +#ifdef true +#undef true +#endif +#define true ((cJSON_bool)1) + +#ifdef false +#undef false +#endif +#define false ((cJSON_bool)0) + +/* define isnan and isinf for ANSI C, if in C99 or above, isnan and isinf has been defined in math.h */ +#ifndef isinf +#define isinf(d) (isnan((d - d)) && !isnan(d)) +#endif +#ifndef isnan +#define isnan(d) (d != d) +#endif + +#ifndef NAN +#define NAN 0.0/0.0 +#endif + +typedef struct { + const unsigned char *json; + size_t position; +} error; +static error global_error = { NULL, 0 }; + +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +{ + return (const char*) (global_error.json + global_error.position); +} + +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) +{ + if (!cJSON_IsString(item)) + { + return NULL; + } + + return item->valuestring; +} + +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item) +{ + if (!cJSON_IsNumber(item)) + { + return (double) NAN; + } + + return item->valuedouble; +} + +/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 13) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#endif + +CJSON_PUBLIC(const char*) cJSON_Version(void) +{ + static char version[15]; + sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + + return version; +} + +/* Case insensitive string comparison, doesn't consider two NULL pointers equal though */ +static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +typedef struct internal_hooks +{ + void *(CJSON_CDECL *allocate)(size_t size); + void (CJSON_CDECL *deallocate)(void *pointer); + void *(CJSON_CDECL *reallocate)(void *pointer, size_t size); +} internal_hooks; + +#if defined(_MSC_VER) +/* work around MSVC error C2322: '...' address of dllimport '...' is not static */ +static void * CJSON_CDECL internal_malloc(size_t size) +{ + return malloc(size); +} +static void CJSON_CDECL internal_free(void *pointer) +{ + free(pointer); +} +static void * CJSON_CDECL internal_realloc(void *pointer, size_t size) +{ + return realloc(pointer, size); +} +#else +#define internal_malloc malloc +#define internal_free free +#define internal_realloc realloc +#endif + +/* strlen of character literals resolved at compile time */ +#define static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) + +static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; + +static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +{ + size_t length = 0; + unsigned char *copy = NULL; + + if (string == NULL) + { + return NULL; + } + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*)hooks->allocate(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) +{ + if (hooks == NULL) + { + /* Reset hooks */ + global_hooks.allocate = malloc; + global_hooks.deallocate = free; + global_hooks.reallocate = realloc; + return; + } + + global_hooks.allocate = malloc; + if (hooks->malloc_fn != NULL) + { + global_hooks.allocate = hooks->malloc_fn; + } + + global_hooks.deallocate = free; + if (hooks->free_fn != NULL) + { + global_hooks.deallocate = hooks->free_fn; + } + + /* use realloc only if both free and malloc are used */ + global_hooks.reallocate = NULL; + if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) + { + global_hooks.reallocate = realloc; + } +} + +/* Internal constructor. */ +static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +{ + cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + if (node) + { + memset(node, '\0', sizeof(cJSON)); + } + + return node; +} + +/* Delete a cJSON structure. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) +{ + cJSON *next = NULL; + while (item != NULL) + { + next = item->next; + if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + { + cJSON_Delete(item->child); + } + if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + { + global_hooks.deallocate(item->valuestring); + } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + global_hooks.deallocate(item->string); + } + global_hooks.deallocate(item); + item = next; + } +} + +/* get the decimal point character of the current locale */ +static unsigned char get_decimal_point(void) +{ +#ifdef ENABLE_LOCALES + struct lconv *lconv = localeconv(); + return (unsigned char) lconv->decimal_point[0]; +#else + return '.'; +#endif +} + +typedef struct +{ + const unsigned char *content; + size_t length; + size_t offset; + size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ + internal_hooks hooks; +} parse_buffer; + +/* check if the given size is left to read in a given parse buffer (starting with 1) */ +#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) +/* check if the buffer can be accessed at the given index (starting with 0) */ +#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) +#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) +/* get a pointer to the buffer at the position */ +#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) + +/* Parse the input text to generate a number, and populate the result into item. */ +static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +{ + double number = 0; + unsigned char *after_end = NULL; + unsigned char number_c_string[64]; + unsigned char decimal_point = get_decimal_point(); + size_t i = 0; + + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; + } + + /* copy the number into a temporary buffer and replace '.' with the decimal point + * of the current locale (for strtod) + * This also takes care of '\0' not necessarily being available for marking the end of the input */ + for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) + { + switch (buffer_at_offset(input_buffer)[i]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '+': + case '-': + case 'e': + case 'E': + number_c_string[i] = buffer_at_offset(input_buffer)[i]; + break; + + case '.': + number_c_string[i] = decimal_point; + break; + + default: + goto loop_end; + } + } +loop_end: + number_c_string[i] = '\0'; + + number = strtod((const char*)number_c_string, (char**)&after_end); + if (number_c_string == after_end) + { + return false; /* parse_error */ + } + + item->valuedouble = number; + + /* use saturation in case of overflow */ + if (number >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (number <= (double)INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)number; + } + + item->type = cJSON_Number; + + input_buffer->offset += (size_t)(after_end - number_c_string); + return true; +} + +/* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) +{ + if (number >= INT_MAX) + { + object->valueint = INT_MAX; + } + else if (number <= (double)INT_MIN) + { + object->valueint = INT_MIN; + } + else + { + object->valueint = (int)number; + } + + return object->valuedouble = number; +} + +CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring) +{ + char *copy = NULL; + /* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */ + if (!(object->type & cJSON_String) || (object->type & cJSON_IsReference)) + { + return NULL; + } + if (strlen(valuestring) <= strlen(object->valuestring)) + { + strcpy(object->valuestring, valuestring); + return object->valuestring; + } + copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks); + if (copy == NULL) + { + return NULL; + } + if (object->valuestring != NULL) + { + cJSON_free(object->valuestring); + } + object->valuestring = copy; + + return copy; +} + +typedef struct +{ + unsigned char *buffer; + size_t length; + size_t offset; + size_t depth; /* current nesting depth (for formatted printing) */ + cJSON_bool noalloc; + cJSON_bool format; /* is this print a formatted print */ + internal_hooks hooks; +} printbuffer; + +/* realloc printbuffer if necessary to have at least "needed" bytes more */ +static unsigned char* ensure(printbuffer * const p, size_t needed) +{ + unsigned char *newbuffer = NULL; + size_t newsize = 0; + + if ((p == NULL) || (p->buffer == NULL)) + { + return NULL; + } + + if ((p->length > 0) && (p->offset >= p->length)) + { + /* make sure that offset is valid */ + return NULL; + } + + if (needed > INT_MAX) + { + /* sizes bigger than INT_MAX are currently not supported */ + return NULL; + } + + needed += p->offset + 1; + if (needed <= p->length) + { + return p->buffer + p->offset; + } + + if (p->noalloc) { + return NULL; + } + + /* calculate new buffer size */ + if (needed > (INT_MAX / 2)) + { + /* overflow of int, use INT_MAX if possible */ + if (needed <= INT_MAX) + { + newsize = INT_MAX; + } + else + { + return NULL; + } + } + else + { + newsize = needed * 2; + } + + if (p->hooks.reallocate != NULL) + { + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); + if (newbuffer == NULL) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + } + else + { + /* otherwise reallocate manually */ + newbuffer = (unsigned char*)p->hooks.allocate(newsize); + if (!newbuffer) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + if (newbuffer) + { + memcpy(newbuffer, p->buffer, p->offset + 1); + } + p->hooks.deallocate(p->buffer); + } + p->length = newsize; + p->buffer = newbuffer; + + return newbuffer + p->offset; +} + +/* calculate the new length of the string in a printbuffer and update the offset */ +static void update_offset(printbuffer * const buffer) +{ + const unsigned char *buffer_pointer = NULL; + if ((buffer == NULL) || (buffer->buffer == NULL)) + { + return; + } + buffer_pointer = buffer->buffer + buffer->offset; + + buffer->offset += strlen((const char*)buffer_pointer); +} + +/* securely comparison of floating-point variables */ +static cJSON_bool compare_double(double a, double b) +{ + double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b); + return (fabs(a - b) <= maxVal * DBL_EPSILON); +} + +/* Render the number nicely from the given item into a string. */ +static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + double d = item->valuedouble; + int length = 0; + size_t i = 0; + unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */ + unsigned char decimal_point = get_decimal_point(); + double test = 0.0; + + if (output_buffer == NULL) + { + return false; + } + + /* This checks for NaN and Infinity */ + if (isnan(d) || isinf(d)) + { + length = sprintf((char*)number_buffer, "null"); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ + length = sprintf((char*)number_buffer, "%1.15g", d); + + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d)) + { + /* If not, print with 17 decimal places of precision */ + length = sprintf((char*)number_buffer, "%1.17g", d); + } + } + + /* sprintf failed or buffer overrun occurred */ + if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) + { + return false; + } + + /* reserve appropriate space in the output */ + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + if (output_pointer == NULL) + { + return false; + } + + /* copy the printed number to the output and replace locale + * dependent decimal point with '.' */ + for (i = 0; i < ((size_t)length); i++) + { + if (number_buffer[i] == decimal_point) + { + output_pointer[i] = '.'; + continue; + } + + output_pointer[i] = number_buffer[i]; + } + output_pointer[i] = '\0'; + + output_buffer->offset += (size_t)length; + + return true; +} + +/* parse 4 digit hexadecimal number */ +static unsigned parse_hex4(const unsigned char * const input) +{ + unsigned int h = 0; + size_t i = 0; + + for (i = 0; i < 4; i++) + { + /* parse digit */ + if ((input[i] >= '0') && (input[i] <= '9')) + { + h += (unsigned int) input[i] - '0'; + } + else if ((input[i] >= 'A') && (input[i] <= 'F')) + { + h += (unsigned int) 10 + input[i] - 'A'; + } + else if ((input[i] >= 'a') && (input[i] <= 'f')) + { + h += (unsigned int) 10 + input[i] - 'a'; + } + else /* invalid */ + { + return 0; + } + + if (i < 3) + { + /* shift left to make place for the next nibble */ + h = h << 4; + } + } + + return h; +} + +/* converts a UTF-16 literal to UTF-8 + * A literal can be one or two sequences of the form \uXXXX */ +static unsigned char utf16_literal_to_utf8(const unsigned char * const input_pointer, const unsigned char * const input_end, unsigned char **output_pointer) +{ + long unsigned int codepoint = 0; + unsigned int first_code = 0; + const unsigned char *first_sequence = input_pointer; + unsigned char utf8_length = 0; + unsigned char utf8_position = 0; + unsigned char sequence_length = 0; + unsigned char first_byte_mark = 0; + + if ((input_end - first_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + /* get the first utf16 sequence */ + first_code = parse_hex4(first_sequence + 2); + + /* check that the code is valid */ + if (((first_code >= 0xDC00) && (first_code <= 0xDFFF))) + { + goto fail; + } + + /* UTF16 surrogate pair */ + if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) + { + const unsigned char *second_sequence = first_sequence + 6; + unsigned int second_code = 0; + sequence_length = 12; /* \uXXXX\uXXXX */ + + if ((input_end - second_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) + { + /* missing second half of the surrogate pair */ + goto fail; + } + + /* get the second utf16 sequence */ + second_code = parse_hex4(second_sequence + 2); + /* check that the code is valid */ + if ((second_code < 0xDC00) || (second_code > 0xDFFF)) + { + /* invalid second half of the surrogate pair */ + goto fail; + } + + + /* calculate the unicode codepoint from the surrogate pair */ + codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF)); + } + else + { + sequence_length = 6; /* \uXXXX */ + codepoint = first_code; + } + + /* encode as UTF-8 + * takes at maximum 4 bytes to encode: + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + if (codepoint < 0x80) + { + /* normal ascii, encoding 0xxxxxxx */ + utf8_length = 1; + } + else if (codepoint < 0x800) + { + /* two bytes, encoding 110xxxxx 10xxxxxx */ + utf8_length = 2; + first_byte_mark = 0xC0; /* 11000000 */ + } + else if (codepoint < 0x10000) + { + /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ + utf8_length = 3; + first_byte_mark = 0xE0; /* 11100000 */ + } + else if (codepoint <= 0x10FFFF) + { + /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + utf8_length = 4; + first_byte_mark = 0xF0; /* 11110000 */ + } + else + { + /* invalid unicode codepoint */ + goto fail; + } + + /* encode as utf8 */ + for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) + { + /* 10xxxxxx */ + (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF); + codepoint >>= 6; + } + /* encode first byte */ + if (utf8_length > 1) + { + (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF); + } + else + { + (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F); + } + + *output_pointer += utf8_length; + + return sequence_length; + +fail: + return 0; +} + +/* Parse the input text into an unescaped cinput, and populate item. */ +static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +{ + const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; + const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; + unsigned char *output_pointer = NULL; + unsigned char *output = NULL; + + /* not a string */ + if (buffer_at_offset(input_buffer)[0] != '\"') + { + goto fail; + } + + { + /* calculate approximate size of the output (overestimate) */ + size_t allocation_length = 0; + size_t skipped_bytes = 0; + while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"')) + { + /* is escape sequence */ + if (input_end[0] == '\\') + { + if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length) + { + /* prevent buffer overflow when last input character is a backslash */ + goto fail; + } + skipped_bytes++; + input_end++; + } + input_end++; + } + if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"')) + { + goto fail; /* string ended unexpectedly */ + } + + /* This is at most how much we need for the output */ + allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes; + output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + if (output == NULL) + { + goto fail; /* allocation failure */ + } + } + + output_pointer = output; + /* loop through the string literal */ + while (input_pointer < input_end) + { + if (*input_pointer != '\\') + { + *output_pointer++ = *input_pointer++; + } + /* escape sequence */ + else + { + unsigned char sequence_length = 2; + if ((input_end - input_pointer) < 1) + { + goto fail; + } + + switch (input_pointer[1]) + { + case 'b': + *output_pointer++ = '\b'; + break; + case 'f': + *output_pointer++ = '\f'; + break; + case 'n': + *output_pointer++ = '\n'; + break; + case 'r': + *output_pointer++ = '\r'; + break; + case 't': + *output_pointer++ = '\t'; + break; + case '\"': + case '\\': + case '/': + *output_pointer++ = input_pointer[1]; + break; + + /* UTF-16 literal */ + case 'u': + sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer); + if (sequence_length == 0) + { + /* failed to convert UTF16-literal to UTF-8 */ + goto fail; + } + break; + + default: + goto fail; + } + input_pointer += sequence_length; + } + } + + /* zero terminate the output */ + *output_pointer = '\0'; + + item->type = cJSON_String; + item->valuestring = (char*)output; + + input_buffer->offset = (size_t) (input_end - input_buffer->content); + input_buffer->offset++; + + return true; + +fail: + if (output != NULL) + { + input_buffer->hooks.deallocate(output); + } + + if (input_pointer != NULL) + { + input_buffer->offset = (size_t)(input_pointer - input_buffer->content); + } + + return false; +} + +/* Render the cstring provided to an escaped version that can be printed. */ +static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +{ + const unsigned char *input_pointer = NULL; + unsigned char *output = NULL; + unsigned char *output_pointer = NULL; + size_t output_length = 0; + /* numbers of additional characters needed for escaping */ + size_t escape_characters = 0; + + if (output_buffer == NULL) + { + return false; + } + + /* empty string */ + if (input == NULL) + { + output = ensure(output_buffer, sizeof("\"\"")); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "\"\""); + + return true; + } + + /* set "flag" to 1 if something needs to be escaped */ + for (input_pointer = input; *input_pointer; input_pointer++) + { + switch (*input_pointer) + { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + /* one character escape sequence */ + escape_characters++; + break; + default: + if (*input_pointer < 32) + { + /* UTF-16 escape sequence uXXXX */ + escape_characters += 5; + } + break; + } + } + output_length = (size_t)(input_pointer - input) + escape_characters; + + output = ensure(output_buffer, output_length + sizeof("\"\"")); + if (output == NULL) + { + return false; + } + + /* no characters have to be escaped */ + if (escape_characters == 0) + { + output[0] = '\"'; + memcpy(output + 1, input, output_length); + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; + } + + output[0] = '\"'; + output_pointer = output + 1; + /* copy the string */ + for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++) + { + if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\')) + { + /* normal character, copy */ + *output_pointer = *input_pointer; + } + else + { + /* character needs to be escaped */ + *output_pointer++ = '\\'; + switch (*input_pointer) + { + case '\\': + *output_pointer = '\\'; + break; + case '\"': + *output_pointer = '\"'; + break; + case '\b': + *output_pointer = 'b'; + break; + case '\f': + *output_pointer = 'f'; + break; + case '\n': + *output_pointer = 'n'; + break; + case '\r': + *output_pointer = 'r'; + break; + case '\t': + *output_pointer = 't'; + break; + default: + /* escape and print as unicode codepoint */ + sprintf((char*)output_pointer, "u%04x", *input_pointer); + output_pointer += 4; + break; + } + } + } + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; +} + +/* Invoke print_string_ptr (which is useful) on an item. */ +static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +{ + return print_string_ptr((unsigned char*)item->valuestring, p); +} + +/* Predeclare these prototypes. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); + +/* Utility to jump whitespace and cr/lf */ +static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL)) + { + return NULL; + } + + if (cannot_access_at_index(buffer, 0)) + { + return buffer; + } + + while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) + { + buffer->offset++; + } + + if (buffer->offset == buffer->length) + { + buffer->offset--; + } + + return buffer; +} + +/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ +static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) + { + return NULL; + } + + if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) + { + buffer->offset += 3; + } + + return buffer; +} + +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + size_t buffer_length; + + if (NULL == value) + { + return NULL; + } + + /* Adding null character size due to require_null_terminated. */ + buffer_length = strlen(value) + sizeof(""); + + return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated); +} + +/* Parse an object - create a new root, and populate. */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; + cJSON *item = NULL; + + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; + + if (value == NULL || 0 == buffer_length) + { + goto fail; + } + + buffer.content = (const unsigned char*)value; + buffer.length = buffer_length; + buffer.offset = 0; + buffer.hooks = global_hooks; + + item = cJSON_New_Item(&global_hooks); + if (item == NULL) /* memory fail */ + { + goto fail; + } + + if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) + { + /* parse failure. ep is set. */ + goto fail; + } + + /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ + if (require_null_terminated) + { + buffer_skip_whitespace(&buffer); + if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0') + { + goto fail; + } + } + if (return_parse_end) + { + *return_parse_end = (const char*)buffer_at_offset(&buffer); + } + + return item; + +fail: + if (item != NULL) + { + cJSON_Delete(item); + } + + if (value != NULL) + { + error local_error; + local_error.json = (const unsigned char*)value; + local_error.position = 0; + + if (buffer.offset < buffer.length) + { + local_error.position = buffer.offset; + } + else if (buffer.length > 0) + { + local_error.position = buffer.length - 1; + } + + if (return_parse_end != NULL) + { + *return_parse_end = (const char*)local_error.json + local_error.position; + } + + global_error = local_error; + } + + return NULL; +} + +/* Default options for cJSON_Parse */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) +{ + return cJSON_ParseWithOpts(value, 0, 0); +} + +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length) +{ + return cJSON_ParseWithLengthOpts(value, buffer_length, 0, 0); +} + +#define cjson_min(a, b) (((a) < (b)) ? (a) : (b)) + +static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +{ + static const size_t default_buffer_size = 256; + printbuffer buffer[1]; + unsigned char *printed = NULL; + + memset(buffer, 0, sizeof(buffer)); + + /* create buffer */ + buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); + buffer->length = default_buffer_size; + buffer->format = format; + buffer->hooks = *hooks; + if (buffer->buffer == NULL) + { + goto fail; + } + + /* print the value */ + if (!print_value(item, buffer)) + { + goto fail; + } + update_offset(buffer); + + /* check if reallocate is available */ + if (hooks->reallocate != NULL) + { + printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { + goto fail; + } + buffer->buffer = NULL; + } + else /* otherwise copy the JSON over to a new buffer */ + { + printed = (unsigned char*) hooks->allocate(buffer->offset + 1); + if (printed == NULL) + { + goto fail; + } + memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); + printed[buffer->offset] = '\0'; /* just to be sure */ + + /* free the buffer */ + hooks->deallocate(buffer->buffer); + } + + return printed; + +fail: + if (buffer->buffer != NULL) + { + hooks->deallocate(buffer->buffer); + } + + if (printed != NULL) + { + hooks->deallocate(printed); + } + + return NULL; +} + +/* Render a cJSON item/entity/structure to text. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) +{ + return (char*)print(item, true, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) +{ + return (char*)print(item, false, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if (prebuffer < 0) + { + return NULL; + } + + p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + if (!p.buffer) + { + return NULL; + } + + p.length = (size_t)prebuffer; + p.offset = 0; + p.noalloc = false; + p.format = fmt; + p.hooks = global_hooks; + + if (!print_value(item, &p)) + { + global_hooks.deallocate(p.buffer); + return NULL; + } + + return (char*)p.buffer; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if ((length < 0) || (buffer == NULL)) + { + return false; + } + + p.buffer = (unsigned char*)buffer; + p.length = (size_t)length; + p.offset = 0; + p.noalloc = true; + p.format = format; + p.hooks = global_hooks; + + return print_value(item, &p); +} + +/* Parser core - when encountering text, process appropriately. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +{ + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; /* no input */ + } + + /* parse the different types of values */ + /* null */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) + { + item->type = cJSON_NULL; + input_buffer->offset += 4; + return true; + } + /* false */ + if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) + { + item->type = cJSON_False; + input_buffer->offset += 5; + return true; + } + /* true */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) + { + item->type = cJSON_True; + item->valueint = 1; + input_buffer->offset += 4; + return true; + } + /* string */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"')) + { + return parse_string(item, input_buffer); + } + /* number */ + if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9')))) + { + return parse_number(item, input_buffer); + } + /* array */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '[')) + { + return parse_array(item, input_buffer); + } + /* object */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{')) + { + return parse_object(item, input_buffer); + } + + return false; +} + +/* Render a value to text. */ +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output = NULL; + + if ((item == NULL) || (output_buffer == NULL)) + { + return false; + } + + switch ((item->type) & 0xFF) + { + case cJSON_NULL: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "null"); + return true; + + case cJSON_False: + output = ensure(output_buffer, 6); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "false"); + return true; + + case cJSON_True: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "true"); + return true; + + case cJSON_Number: + return print_number(item, output_buffer); + + case cJSON_Raw: + { + size_t raw_length = 0; + if (item->valuestring == NULL) + { + return false; + } + + raw_length = strlen(item->valuestring) + sizeof(""); + output = ensure(output_buffer, raw_length); + if (output == NULL) + { + return false; + } + memcpy(output, item->valuestring, raw_length); + return true; + } + + case cJSON_String: + return print_string(item, output_buffer); + + case cJSON_Array: + return print_array(item, output_buffer); + + case cJSON_Object: + return print_object(item, output_buffer); + + default: + return false; + } +} + +/* Build an array from input text. */ +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* head of the linked list */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (buffer_at_offset(input_buffer)[0] != '[') + { + /* not an array */ + goto fail; + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']')) + { + /* empty array */ + goto success; + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse next value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']') + { + goto fail; /* expected end of array */ + } + +success: + input_buffer->depth--; + + if (head != NULL) { + head->prev = current_item; + } + + item->type = cJSON_Array; + item->child = head; + + input_buffer->offset++; + + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an array to text */ +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_element = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output array. */ + /* opening square bracket */ + output_pointer = ensure(output_buffer, 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer = '['; + output_buffer->offset++; + output_buffer->depth++; + + while (current_element != NULL) + { + if (!print_value(current_element, output_buffer)) + { + return false; + } + update_offset(output_buffer); + if (current_element->next) + { + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ','; + if(output_buffer->format) + { + *output_pointer++ = ' '; + } + *output_pointer = '\0'; + output_buffer->offset += length; + } + current_element = current_element->next; + } + + output_pointer = ensure(output_buffer, 2); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ']'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Build an object from the text. */ +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* linked list head */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{')) + { + goto fail; /* not an object */ + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}')) + { + goto success; /* empty object */ + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse the name of the child */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_string(current_item, input_buffer)) + { + goto fail; /* failed to parse name */ + } + buffer_skip_whitespace(input_buffer); + + /* swap valuestring and string, because we parsed the name */ + current_item->string = current_item->valuestring; + current_item->valuestring = NULL; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':')) + { + goto fail; /* invalid object */ + } + + /* parse the value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}')) + { + goto fail; /* expected end of object */ + } + +success: + input_buffer->depth--; + + if (head != NULL) { + head->prev = current_item; + } + + item->type = cJSON_Object; + item->child = head; + + input_buffer->offset++; + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an object to text. */ +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_item = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output: */ + length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer++ = '{'; + output_buffer->depth++; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + output_buffer->offset += length; + + while (current_item) + { + if (output_buffer->format) + { + size_t i; + output_pointer = ensure(output_buffer, output_buffer->depth); + if (output_pointer == NULL) + { + return false; + } + for (i = 0; i < output_buffer->depth; i++) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += output_buffer->depth; + } + + /* print key */ + if (!print_string_ptr((unsigned char*)current_item->string, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ':'; + if (output_buffer->format) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += length; + + /* print value */ + if (!print_value(current_item, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + /* print comma if not last */ + length = ((size_t)(output_buffer->format ? 1 : 0) + (size_t)(current_item->next ? 1 : 0)); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + if (current_item->next) + { + *output_pointer++ = ','; + } + + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + *output_pointer = '\0'; + output_buffer->offset += length; + + current_item = current_item->next; + } + + output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2); + if (output_pointer == NULL) + { + return false; + } + if (output_buffer->format) + { + size_t i; + for (i = 0; i < (output_buffer->depth - 1); i++) + { + *output_pointer++ = '\t'; + } + } + *output_pointer++ = '}'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Get Array size/item / object item. */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) +{ + cJSON *child = NULL; + size_t size = 0; + + if (array == NULL) + { + return 0; + } + + child = array->child; + + while(child != NULL) + { + size++; + child = child->next; + } + + /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ + + return (int)size; +} + +static cJSON* get_array_item(const cJSON *array, size_t index) +{ + cJSON *current_child = NULL; + + if (array == NULL) + { + return NULL; + } + + current_child = array->child; + while ((current_child != NULL) && (index > 0)) + { + index--; + current_child = current_child->next; + } + + return current_child; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) +{ + if (index < 0) + { + return NULL; + } + + return get_array_item(array, (size_t)index); +} + +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) +{ + cJSON *current_element = NULL; + + if ((object == NULL) || (name == NULL)) + { + return NULL; + } + + current_element = object->child; + if (case_sensitive) + { + while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0)) + { + current_element = current_element->next; + } + } + else + { + while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) + { + current_element = current_element->next; + } + } + + if ((current_element == NULL) || (current_element->string == NULL)) { + return NULL; + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, false); +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +{ + return cJSON_GetObjectItem(object, string) ? 1 : 0; +} + +/* Utility for array list handling. */ +static void suffix_object(cJSON *prev, cJSON *item) +{ + prev->next = item; + item->prev = prev; +} + +/* Utility for handling references. */ +static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) +{ + cJSON *reference = NULL; + if (item == NULL) + { + return NULL; + } + + reference = cJSON_New_Item(hooks); + if (reference == NULL) + { + return NULL; + } + + memcpy(reference, item, sizeof(cJSON)); + reference->string = NULL; + reference->type |= cJSON_IsReference; + reference->next = reference->prev = NULL; + return reference; +} + +static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +{ + cJSON *child = NULL; + + if ((item == NULL) || (array == NULL) || (array == item)) + { + return false; + } + + child = array->child; + /* + * To find the last item in array quickly, we use prev in array + */ + if (child == NULL) + { + /* list is empty, start new one */ + array->child = item; + item->prev = item; + item->next = NULL; + } + else + { + /* append to the end */ + if (child->prev) + { + suffix_object(child->prev, item); + array->child->prev = item; + } + else + { + while (child->next) + { + child = child->next; + } + suffix_object(child, item); + array->child->prev = item; + } + } + + return true; +} + +/* Add item to array/object. */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item) +{ + return add_item_to_array(array, item); +} + +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic push +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif +/* helper function to cast away const */ +static void* cast_away_const(const void* string) +{ + return (void*)string; +} +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic pop +#endif + + +static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) +{ + char *new_key = NULL; + int new_type = cJSON_Invalid; + + if ((object == NULL) || (string == NULL) || (item == NULL) || (object == item)) + { + return false; + } + + if (constant_key) + { + new_key = (char*)cast_away_const(string); + new_type = item->type | cJSON_StringIsConst; + } + else + { + new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + if (new_key == NULL) + { + return false; + } + + new_type = item->type & ~cJSON_StringIsConst; + } + + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + hooks->deallocate(item->string); + } + + item->string = new_key; + item->type = new_type; + + return add_item_to_array(object, item); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) +{ + return add_item_to_object(object, string, item, &global_hooks, false); +} + +/* Add an item to an object with constant string as key */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) +{ + return add_item_to_object(object, string, item, &global_hooks, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) +{ + if (array == NULL) + { + return false; + } + + return add_item_to_array(array, create_reference(item, &global_hooks)); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) +{ + if ((object == NULL) || (string == NULL)) + { + return false; + } + + return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) +{ + cJSON *null = cJSON_CreateNull(); + if (add_item_to_object(object, name, null, &global_hooks, false)) + { + return null; + } + + cJSON_Delete(null); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) +{ + cJSON *true_item = cJSON_CreateTrue(); + if (add_item_to_object(object, name, true_item, &global_hooks, false)) + { + return true_item; + } + + cJSON_Delete(true_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) +{ + cJSON *false_item = cJSON_CreateFalse(); + if (add_item_to_object(object, name, false_item, &global_hooks, false)) + { + return false_item; + } + + cJSON_Delete(false_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) +{ + cJSON *bool_item = cJSON_CreateBool(boolean); + if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + { + return bool_item; + } + + cJSON_Delete(bool_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) +{ + cJSON *number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, &global_hooks, false)) + { + return number_item; + } + + cJSON_Delete(number_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) +{ + cJSON *string_item = cJSON_CreateString(string); + if (add_item_to_object(object, name, string_item, &global_hooks, false)) + { + return string_item; + } + + cJSON_Delete(string_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) +{ + cJSON *raw_item = cJSON_CreateRaw(raw); + if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + { + return raw_item; + } + + cJSON_Delete(raw_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) +{ + cJSON *object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, &global_hooks, false)) + { + return object_item; + } + + cJSON_Delete(object_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) +{ + cJSON *array = cJSON_CreateArray(); + if (add_item_to_object(object, name, array, &global_hooks, false)) + { + return array; + } + + cJSON_Delete(array); + return NULL; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) +{ + if ((parent == NULL) || (item == NULL)) + { + return NULL; + } + + if (item != parent->child) + { + /* not the first element */ + item->prev->next = item->next; + } + if (item->next != NULL) + { + /* not the last element */ + item->next->prev = item->prev; + } + + if (item == parent->child) + { + /* first element */ + parent->child = item->next; + } + else if (item->next == NULL) + { + /* last element */ + parent->child->prev = item->prev; + } + + /* make sure the detached item doesn't point anywhere anymore */ + item->prev = NULL; + item->next = NULL; + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) +{ + if (which < 0) + { + return NULL; + } + + return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) +{ + cJSON_Delete(cJSON_DetachItemFromArray(array, which)); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItem(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObject(object, string)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); +} + +/* Replace array/object items with new ones. */ +CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) +{ + cJSON *after_inserted = NULL; + + if (which < 0) + { + return false; + } + + after_inserted = get_array_item(array, (size_t)which); + if (after_inserted == NULL) + { + return add_item_to_array(array, newitem); + } + + newitem->next = after_inserted; + newitem->prev = after_inserted->prev; + after_inserted->prev = newitem; + if (after_inserted == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } + return true; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) +{ + if ((parent == NULL) || (replacement == NULL) || (item == NULL)) + { + return false; + } + + if (replacement == item) + { + return true; + } + + replacement->next = item->next; + replacement->prev = item->prev; + + if (replacement->next != NULL) + { + replacement->next->prev = replacement; + } + if (parent->child == item) + { + if (parent->child->prev == parent->child) + { + replacement->prev = replacement; + } + parent->child = replacement; + } + else + { /* + * To find the last item in array quickly, we use prev in array. + * We can't modify the last item's next pointer where this item was the parent's child + */ + if (replacement->prev != NULL) + { + replacement->prev->next = replacement; + } + if (replacement->next == NULL) + { + parent->child->prev = replacement; + } + } + + item->next = NULL; + item->prev = NULL; + cJSON_Delete(item); + + return true; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) +{ + if (which < 0) + { + return false; + } + + return cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); +} + +static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +{ + if ((replacement == NULL) || (string == NULL)) + { + return false; + } + + /* replace the name in the replacement */ + if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + { + cJSON_free(replacement->string); + } + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + replacement->type &= ~cJSON_StringIsConst; + + return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) +{ + return replace_item_in_object(object, string, newitem, false); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) +{ + return replace_item_in_object(object, string, newitem, true); +} + +/* Create basic types: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_NULL; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_True; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = boolean ? cJSON_True : cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Number; + item->valuedouble = num; + + /* use saturation in case of overflow */ + if (num >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (num <= (double)INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)num; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_String; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) + { + item->type = cJSON_String | cJSON_IsReference; + item->valuestring = (char*)cast_away_const(string); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Object | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Array | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Raw; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type=cJSON_Array; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item) + { + item->type = cJSON_Object; + } + + return item; +} + +/* Create Arrays: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if (!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber((double)numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0;a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (strings == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for (i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateString(strings[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p,n); + } + p = n; + } + + return a; +} + +/* Duplication */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) +{ + cJSON *newitem = NULL; + cJSON *child = NULL; + cJSON *next = NULL; + cJSON *newchild = NULL; + + /* Bail on bad ptr */ + if (!item) + { + goto fail; + } + /* Create new item */ + newitem = cJSON_New_Item(&global_hooks); + if (!newitem) + { + goto fail; + } + /* Copy over all vars */ + newitem->type = item->type & (~cJSON_IsReference); + newitem->valueint = item->valueint; + newitem->valuedouble = item->valuedouble; + if (item->valuestring) + { + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + if (!newitem->valuestring) + { + goto fail; + } + } + if (item->string) + { + newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + if (!newitem->string) + { + goto fail; + } + } + /* If non-recursive, then we're done! */ + if (!recurse) + { + return newitem; + } + /* Walk the ->next chain for the child. */ + child = item->child; + while (child != NULL) + { + newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + if (!newchild) + { + goto fail; + } + if (next != NULL) + { + /* If newitem->child already set, then crosswire ->prev and ->next and move on */ + next->next = newchild; + newchild->prev = next; + next = newchild; + } + else + { + /* Set newitem->child and move to it */ + newitem->child = newchild; + next = newchild; + } + child = child->next; + } + + return newitem; + +fail: + if (newitem != NULL) + { + cJSON_Delete(newitem); + } + + return NULL; +} + +static void skip_oneline_comment(char **input) +{ + *input += static_strlen("//"); + + for (; (*input)[0] != '\0'; ++(*input)) + { + if ((*input)[0] == '\n') { + *input += static_strlen("\n"); + return; + } + } +} + +static void skip_multiline_comment(char **input) +{ + *input += static_strlen("/*"); + + for (; (*input)[0] != '\0'; ++(*input)) + { + if (((*input)[0] == '*') && ((*input)[1] == '/')) + { + *input += static_strlen("*/"); + return; + } + } +} + +static void minify_string(char **input, char **output) { + (*output)[0] = (*input)[0]; + *input += static_strlen("\""); + *output += static_strlen("\""); + + + for (; (*input)[0] != '\0'; (void)++(*input), ++(*output)) { + (*output)[0] = (*input)[0]; + + if ((*input)[0] == '\"') { + (*output)[0] = '\"'; + *input += static_strlen("\""); + *output += static_strlen("\""); + return; + } else if (((*input)[0] == '\\') && ((*input)[1] == '\"')) { + (*output)[1] = (*input)[1]; + *input += static_strlen("\""); + *output += static_strlen("\""); + } + } +} + +CJSON_PUBLIC(void) cJSON_Minify(char *json) +{ + char *into = json; + + if (json == NULL) + { + return; + } + + while (json[0] != '\0') + { + switch (json[0]) + { + case ' ': + case '\t': + case '\r': + case '\n': + json++; + break; + + case '/': + if (json[1] == '/') + { + skip_oneline_comment(&json); + } + else if (json[1] == '*') + { + skip_multiline_comment(&json); + } else { + json++; + } + break; + + case '\"': + minify_string(&json, (char**)&into); + break; + + default: + into[0] = json[0]; + json++; + into++; + } + } + + /* and null-terminate. */ + *into = '\0'; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Invalid; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_False; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xff) == cJSON_True; +} + + +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & (cJSON_True | cJSON_False)) != 0; +} +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_NULL; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Number; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_String; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Array; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Object; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Raw; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) + { + return false; + } + + /* check if type is valid */ + switch (a->type & 0xFF) + { + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + case cJSON_Number: + case cJSON_String: + case cJSON_Raw: + case cJSON_Array: + case cJSON_Object: + break; + + default: + return false; + } + + /* identical objects are equal */ + if (a == b) + { + return true; + } + + switch (a->type & 0xFF) + { + /* in these cases and equal type is enough */ + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + return true; + + case cJSON_Number: + if (compare_double(a->valuedouble, b->valuedouble)) + { + return true; + } + return false; + + case cJSON_String: + case cJSON_Raw: + if ((a->valuestring == NULL) || (b->valuestring == NULL)) + { + return false; + } + if (strcmp(a->valuestring, b->valuestring) == 0) + { + return true; + } + + return false; + + case cJSON_Array: + { + cJSON *a_element = a->child; + cJSON *b_element = b->child; + + for (; (a_element != NULL) && (b_element != NULL);) + { + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + + a_element = a_element->next; + b_element = b_element->next; + } + + /* one of the arrays is longer than the other */ + if (a_element != b_element) { + return false; + } + + return true; + } + + case cJSON_Object: + { + cJSON *a_element = NULL; + cJSON *b_element = NULL; + cJSON_ArrayForEach(a_element, a) + { + /* TODO This has O(n^2) runtime, which is horrible! */ + b_element = get_object_item(b, a_element->string, case_sensitive); + if (b_element == NULL) + { + return false; + } + + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + } + + /* doing this twice, once on a and b to prevent true comparison if a subset of b + * TODO: Do this the proper way, this is just a fix for now */ + cJSON_ArrayForEach(b_element, b) + { + a_element = get_object_item(a, b_element->string, case_sensitive); + if (a_element == NULL) + { + return false; + } + + if (!cJSON_Compare(b_element, a_element, case_sensitive)) + { + return false; + } + } + + return true; + } + + default: + return false; + } +} + +CJSON_PUBLIC(void *) cJSON_malloc(size_t size) +{ + return global_hooks.allocate(size); +} + +CJSON_PUBLIC(void) cJSON_free(void *object) +{ + global_hooks.deallocate(object); +} diff --git a/src/text/libs/cJSON.h b/src/text/libs/cJSON.h new file mode 100644 index 00000000..b5ceb290 --- /dev/null +++ b/src/text/libs/cJSON.h @@ -0,0 +1,293 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef cJSON__h +#define cJSON__h + +#ifdef __cplusplus +extern "C" +{ +#endif + +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) +#define __WINDOWS__ +#endif + +#ifdef __WINDOWS__ + +/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options: + +CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols +CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) +CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol + +For *nix builds that support visibility attribute, you can define similar behavior by + +setting default visibility to hidden by adding +-fvisibility=hidden (for gcc) +or +-xldscope=hidden (for sun cc) +to CFLAGS + +then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does + +*/ + +#define CJSON_CDECL __cdecl +#define CJSON_STDCALL __stdcall + +/* export symbols by default, this is necessary for copy pasting the C and header file */ +#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_EXPORT_SYMBOLS +#endif + +#if defined(CJSON_HIDE_SYMBOLS) +#define CJSON_PUBLIC(type) type CJSON_STDCALL +#elif defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL +#elif defined(CJSON_IMPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL +#endif +#else /* !__WINDOWS__ */ +#define CJSON_CDECL +#define CJSON_STDCALL + +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) +#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type +#else +#define CJSON_PUBLIC(type) type +#endif +#endif + +/* project version */ +#define CJSON_VERSION_MAJOR 1 +#define CJSON_VERSION_MINOR 7 +#define CJSON_VERSION_PATCH 13 + +#include + +/* cJSON Types: */ +#define cJSON_Invalid (0) +#define cJSON_False (1 << 0) +#define cJSON_True (1 << 1) +#define cJSON_NULL (1 << 2) +#define cJSON_Number (1 << 3) +#define cJSON_String (1 << 4) +#define cJSON_Array (1 << 5) +#define cJSON_Object (1 << 6) +#define cJSON_Raw (1 << 7) /* raw json */ + +#define cJSON_IsReference 256 +#define cJSON_StringIsConst 512 + +/* The cJSON structure: */ +typedef struct cJSON +{ + /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ + struct cJSON *next; + struct cJSON *prev; + /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + struct cJSON *child; + + /* The type of the item, as above. */ + int type; + + /* The item's string, if type==cJSON_String and type == cJSON_Raw */ + char *valuestring; + /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ + int valueint; + /* The item's number, if type==cJSON_Number */ + double valuedouble; + + /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ + char *string; +} cJSON; + +typedef struct cJSON_Hooks +{ + /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */ + void *(CJSON_CDECL *malloc_fn)(size_t sz); + void (CJSON_CDECL *free_fn)(void *ptr); +} cJSON_Hooks; + +typedef int cJSON_bool; + +/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. + * This is to prevent stack overflows. */ +#ifndef CJSON_NESTING_LIMIT +#define CJSON_NESTING_LIMIT 1000 +#endif + +/* returns the version of cJSON as a string */ +CJSON_PUBLIC(const char*) cJSON_Version(void); + +/* Supply malloc, realloc and free functions to cJSON */ +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks); + +/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ +/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length); +/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ +/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); + +/* Render a cJSON entity to text for transfer/storage. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); +/* Render a cJSON entity to text for transfer/storage without any formatting. */ +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); +/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); +/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ +/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); +/* Delete a cJSON entity and all subentities. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item); + +/* Returns the number of items in an array (or object). */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); +/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); +/* Get item "string" from object. Case insensitive. */ +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); +/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); + +/* Check item type and return its value */ +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item); +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item); + +/* These functions check the type of an item */ +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); + +/* These calls create a cJSON item of the appropriate type. */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); +/* raw json */ +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); + +/* Create a string where valuestring references a string so + * it will not be freed by cJSON_Delete */ +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); +/* Create an object/array that only references it's elements so + * they will not be freed by cJSON_Delete */ +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); + +/* These utilities create an Array of count items. + * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count); + +/* Append item to the specified array/object. */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. + * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before + * writing to `item->string` */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); + +/* Remove/Detach items from Arrays/Objects. */ +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); + +/* Update array items. */ +CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); + +/* Duplicate a cJSON item */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); +/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will + * need to be released. With recurse!=0, it will duplicate any children connected to the item. + * The item->next and ->prev pointers are always zero on return from Duplicate. */ +/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. + * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); + +/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. + * The input pointer json cannot point to a read-only address area, such as a string constant, + * but should point to a readable and writable adress area. */ +CJSON_PUBLIC(void) cJSON_Minify(char *json); + +/* Helper functions for creating and adding items to an object at the same time. + * They return the added item or NULL on failure. */ +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); + +/* When assigning an integer value, it needs to be propagated to valuedouble too. */ +#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) +/* helper for the cJSON_SetNumberValue macro */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); +#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) +/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */ +CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring); + +/* Macro for iterating over an array or object */ +#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) + +/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ +CJSON_PUBLIC(void *) cJSON_malloc(size_t size); +CJSON_PUBLIC(void) cJSON_free(void *object); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/text/text-loader.c b/src/text/text-loader.c new file mode 100644 index 00000000..f50eb813 --- /dev/null +++ b/src/text/text-loader.c @@ -0,0 +1,97 @@ +#include "text-loader.h" +#include "txtconv.h" +#include "libs/cJSON.h" +#include +#include +#include "dialog_ids.h" +#include "game/ingame_menu.h" + +struct DialogEntry* * dialogPool; + +char* load_file(char const* path) { + char* buffer = 0; + long length = 0; + FILE * f = fopen (path, "rb"); + + if (f) { + fseek (f, 0, SEEK_END); + length = ftell (f); + fseek (f, 0, SEEK_SET); + buffer = (char*) malloc((length+1)*sizeof(char)); + if (buffer) { + fread(buffer, sizeof(char), length, f); + } + fclose(f); + } + buffer[length] = '\0'; + + return buffer; +} + +void preloadTexts(){ + char * jsonTxt = load_file("res/texts/es.json"); + + cJSON *json = cJSON_Parse(jsonTxt); + if (json == NULL) { + const char *error_ptr = cJSON_GetErrorPtr(); + if (error_ptr != NULL) + { + fprintf(stderr, "Error before: %s\n", error_ptr); + } + exit(1); + } + const cJSON *dialog = NULL; + const cJSON *dialogs = NULL; + + dialogs = cJSON_GetObjectItemCaseSensitive(json, "dialogs"); + + cJSON_ArrayForEach(dialog, dialogs) { + int id = cJSON_GetObjectItemCaseSensitive(dialog, "ID")->valueint; + + struct DialogEntry *entry = malloc (sizeof (struct DialogEntry)); + + entry->unused = 1; + entry->linesPerBox = cJSON_GetObjectItemCaseSensitive(dialog, "linesPerBox")->valueint; + entry->leftOffset = cJSON_GetObjectItemCaseSensitive(dialog, "leftOffset")->valueint; + entry->width = cJSON_GetObjectItemCaseSensitive(dialog, "width")->valueint; + + const cJSON *line = NULL; + const cJSON *lines = NULL; + lines = cJSON_GetObjectItemCaseSensitive(dialog, "lines"); + + int lineAmount = cJSON_GetArraySize(lines); + int dialogSize = lineAmount * 45; + char* dialogTxt = malloc(dialogSize * sizeof(char)); + strcpy(dialogTxt, ""); + int currLine = 0; + cJSON_ArrayForEach(line, lines) { + char * str = line->valuestring; + strcat(dialogTxt, str); + if(currLine < lineAmount - 1) { + strcat(dialogTxt, "\n"); + currLine++; + } + } + entry->str = getTranslatedText(dialogTxt); + free(dialogTxt); + dialogPool[id] = entry; + } + free(jsonTxt); +} + +void alloc_dialog_pool(void){ + dialogPool = malloc(DIALOG_COUNT * sizeof(struct DialogEntry)); + + for(int i = 0; i < DIALOG_COUNT; i++){ + struct DialogEntry *entry = malloc (sizeof (struct DialogEntry)); + + entry->unused = 1; + entry->linesPerBox = 6; + entry->leftOffset = 95; + entry->width = 200; + entry->str = getTranslatedText("You are not supposed\nto be here.\n\nKeep this as a secret\n\n- Render96 Team"); + dialogPool[i] = entry; + } + + preloadTexts(); +} \ No newline at end of file diff --git a/src/text/text-loader.h b/src/text/text-loader.h new file mode 100644 index 00000000..a21a5dff --- /dev/null +++ b/src/text/text-loader.h @@ -0,0 +1,9 @@ +#ifndef TXTLOADER +#define TXTLOADER + +#include "types.h" + +extern struct DialogEntry ** dialogPool; + +extern void alloc_dialog_pool(void); +#endif \ No newline at end of file diff --git a/src/text/txtconv.c b/src/text/txtconv.c new file mode 100644 index 00000000..3f80c4b4 --- /dev/null +++ b/src/text/txtconv.c @@ -0,0 +1,95 @@ +#include "txtconv.h" + +struct Character charmap[340] = { + {"0", 0x00}, {"0", 0x00}, {"1", 0x01}, {"1", 0x01}, {"2", 0x02}, {"2", 0x02}, {"3", 0x03}, {"3", 0x03}, {"4", 0x04}, + {"4", 0x04}, {"5", 0x05}, {"5", 0x05}, {"6", 0x06}, {"6", 0x06}, {"7", 0x07}, {"7", 0x07}, {"8", 0x08}, {"8", 0x08}, + {"9", 0x09}, {"9", 0x09}, {"A", 0x0A}, {"A", 0x0A}, {"B", 0x0B}, {"B", 0x0B}, {"C", 0x0C}, {"C", 0x0C}, {"D", 0x0D}, + {"D", 0x0D}, {"E", 0x0E}, {"E", 0x0E}, {"F", 0x0F}, {"F", 0x0F}, {"G", 0x10}, {"G", 0x10}, {"H", 0x11}, {"H", 0x11}, + {"I", 0x12}, {"I", 0x12}, {"J", 0x13}, {"J", 0x13}, {"K", 0x14}, {"K", 0x14}, {"L", 0x15}, {"L", 0x15}, {"M", 0x16}, + {"M", 0x16}, {"N", 0x17}, {"N", 0x17}, {"O", 0x18}, {"O", 0x18}, {"P", 0x19}, {"P", 0x19}, {"Q", 0x1A}, {"Q", 0x1A}, + {"R", 0x1B}, {"R", 0x1B}, {"S", 0x1C}, {"S", 0x1C}, {"T", 0x1D}, {"T", 0x1D}, {"U", 0x1E}, {"U", 0x1E}, {"V", 0x1F}, + {"V", 0x1F}, {"W", 0x20}, {"W", 0x20}, {"X", 0x21}, {"X", 0x21}, {"Y", 0x22}, {"Y", 0x22}, {"Z", 0x23}, {"Z", 0x23}, + {"a", 0x24}, {"b", 0x25}, {"c", 0x26}, {"d", 0x27}, {"e", 0x28}, {"f", 0x29}, {"g", 0x2A}, {"h", 0x2B}, {"i", 0x2C}, + {"j", 0x2D}, {"k", 0x2E}, {"l", 0x2F}, {"m", 0x30}, {"n", 0x31}, {"o", 0x32}, {"p", 0x33}, {"q", 0x34}, {"r", 0x35}, + {"s", 0x36}, {"t", 0x37}, {"u", 0x38}, {"v", 0x39}, {"w", 0x3A}, {"x", 0x3B}, {"y", 0x3C}, {"z", 0x3D}, {"\\", 0x3E}, + {".", 0x3F}, {"☺", 0x41}, {"あ", 0x40}, {"い", 0x41}, {"う", 0x42}, {"え", 0x43}, {"お", 0x44}, {"か", 0x45}, {"き", 0x46}, + {"く", 0x47}, {"け", 0x48}, {"こ", 0x49}, {"さ", 0x4A}, {"し", 0x4B}, {"す", 0x4C}, {"せ", 0x4D}, {"そ", 0x4E}, {"た", 0x4F}, + {"ち", 0x50}, {"つ", 0x51}, {"て", 0x52}, {"と", 0x53}, {"な", 0x54}, {"に", 0x55}, {"ぬ", 0x56}, {"ね", 0x57}, {"の", 0x58}, + {"は", 0x59}, {"ひ", 0x5A}, {"ふ", 0x5B}, {"へ", 0x5C}, {"ほ", 0x5D}, {"ま", 0x5E}, {"み", 0x5F}, {"む", 0x60}, {"め", 0x61}, + {"も", 0x62}, {"や", 0x63}, {"ゆ", 0x64}, {"よ", 0x65}, {"ら", 0x66}, {"り", 0x67}, {"る", 0x68}, {"れ", 0x69}, {"ろ", 0x6A}, + {"わ", 0x6B}, {"を", 0x6C}, {"ん", 0x6D}, {"。", 0x6E}, {",", 0x6F}, {"、", 0x6F}, {"ア", 0x70}, {"イ", 0x71}, {"ウ", 0x72}, + {"エ", 0x73}, {"オ", 0x74}, {"カ", 0x75}, {"キ", 0x76}, {"ク", 0x77}, {"ケ", 0x78}, {"コ", 0x79}, {"サ", 0x7A}, {"シ", 0x7B}, + {"ス", 0x7C}, {"セ", 0x7D}, {"ソ", 0x7E}, {"タ", 0x7F}, {"チ", 0x80}, {"ツ", 0x81}, {"テ", 0x82}, {"ト", 0x83}, {"ナ", 0x84}, + {"ニ", 0x85}, {"ヌ", 0x86}, {"ネ", 0x87}, {"ノ", 0x88}, {"ハ", 0x89}, {"ヒ", 0x8A}, {"フ", 0x8B}, {"ヘ", 0x8C}, {"ホ", 0x8D}, + {"マ", 0x8E}, {"ミ", 0x8F}, {"ム", 0x90}, {"メ", 0x91}, {"モ", 0x92}, {"ヤ", 0x93}, {"ユ", 0x94}, {"ヨ", 0x95}, {"ラ", 0x96}, + {"リ", 0x97}, {"ル", 0x98}, {"レ", 0x99}, {"ロ", 0x9A}, {"ワ", 0x9B}, {"ヲ", 0x9C}, {"ン", 0x9D}, {" ", 0x9E}, {" ", 0x9E}, + {"-", 0x9F}, {"ー", 0x9F}, {"ぇ", 0xA0}, {"っ", 0xA1}, {"ゃ", 0xA2}, {"ゅ", 0xA3}, {"ょ", 0xA4}, {"ぁ", 0xA5}, {"ぃ", 0xA6}, + {"ぅ", 0xA7}, {"ぉ", 0xA8}, {"ェ", 0xD0}, {"ッ", 0xD1}, {"ャ", 0xD2}, {"ュ", 0xD3}, {"ョ", 0xD4}, {"ァ", 0xD5}, {"ィ", 0xD6}, + {"ゥ", 0xD7}, {"ォ", 0xD8}, {"[%]", 0xE0}, {"(", 0xE1}, {"(", 0xE1}, {")(", 0xE2}, {")(", 0xE2}, {")", 0xE3}, {")", 0xE3}, + {"+", 0xE4}, {"↔", 0xE4}, {"&", 0xE5}, {":", 0xE6}, {"゛", 0xF0}, {"゜", 0xF1}, {"!", 0xF2}, {"!", 0xF2}, {"%", 0xF3}, + {"%", 0xF3}, {"?", 0xF4}, {"?", 0xF4}, {"『", 0xF5}, {"』", 0xF6}, {"~", 0xF7}, {"~", 0xF7}, {"…", 0xF8}, {"$", 0xF9}, + {"★", 0xFA}, {"×", 0xFB}, {"・", 0xFC}, {"☆", 0xFD}, {"\n", 0xFE}, {"が", 0x45}, {"ぎ", 0x46}, {"ぐ", 0x47}, {"げ", 0x48}, + {"ご", 0x49}, {"ざ", 0x4A}, {"じ", 0x4B}, {"ず", 0x4C}, {"ぜ", 0x4D}, {"ぞ", 0x4E}, {"だ", 0x4F}, {"ぢ", 0x50}, {"づ", 0x51}, + {"で", 0x52}, {"ど", 0x53}, {"ば", 0x59}, {"び", 0x5A}, {"ぶ", 0x5B}, {"べ", 0x5C}, {"ぼ", 0x5D}, {"ガ", 0x75}, {"ギ", 0x76}, + {"グ", 0x77}, {"ゲ", 0x78}, {"ゴ", 0x79}, {"ザ", 0x7A}, {"ジ", 0x7B}, {"ズ", 0x7C}, {"ゼ", 0x7D}, {"ゾ", 0x7E}, {"ダ", 0x7F}, + {"ヂ", 0x80}, {"ヅ", 0x81}, {"デ", 0x82}, {"ド", 0x83}, {"バ", 0x89}, {"ビ", 0x8A}, {"ブ", 0x8B}, {"ベ", 0x8C}, {"ボ", 0x8D}, + {"ぱ", 0x59}, {"ぴ", 0x5A}, {"ぷ", 0x5B}, {"ぺ", 0x5C}, {"ぽ", 0x5D}, {"パ", 0x89}, {"ピ", 0x8A}, {"プ", 0x8B}, {"ペ", 0x8C}, + {"ポ", 0x8D}, {"^", 0x50}, {"|", 0x51}, {"<", 0x52}, {">", 0x53}, {"[A]", 0x54}, {"[B]", 0x55}, {"[C]", 0x56}, {"[Z]", 0x57}, + {"[R]", 0x58}, {"/", 0xD0}, {"the", 0xD1}, {"you", 0xD2}, {"à", 0x60}, {"â", 0x61}, {"ä", 0x62}, {"À", 0x64}, {"Â", 0x65}, + {"Ä", 0x66}, {"è", 0x70}, {"ê", 0x71}, {"ë", 0x72}, {"é", 0x73}, {"È", 0x74}, {"Ê", 0x75}, {"Ë", 0x76}, {"É", 0x77}, + {"ù", 0x80}, {"û", 0x81}, {"ü", 0x82}, {"Ù", 0x84}, {"Û", 0x85}, {"Ü", 0x86}, {"ô", 0x91}, {"ö", 0x92}, {"Ô", 0x95}, + {"Ö", 0x96}, {"î", 0xA1}, {"ï", 0xA2}, {"ß", 0xEC}, {"Ç", 0xED}, {"ç", 0xEE}, {"„", 0xF0} +}; + +struct Character getCharacter(char* ch){ + struct Character tmp = {NULL, 0}; + for(s32 cmid = 0; cmid < 340; cmid++){ + if(strcmp(charmap[cmid].txt, ch) == 0) { + tmp = charmap[cmid]; + break; + } + } + return tmp; +} + +u8 * getTranslatedText(char * txt){ + s32 cid; + s32 strSize = strlen(txt); + u8 * tmp = malloc((strSize + 1) * sizeof(u8)); + u8 icon = FALSE; + + s32 shiftArr = 0; + + char tmpId = 0; + char tmpIcon[3]; + s32 ignoreUntil = 0; + for(cid = 0; cid < strSize; cid++){ + char ch = txt[cid]; + + if(ch == '['){ + tmpIcon[0] = ch; + tmpIcon[1] = txt[cid + 1]; + tmpIcon[2] = txt[cid + 2]; + struct Character ctm = getCharacter(tmpIcon); + if(ctm.value != NULL){ + tmp[cid - shiftArr] = ctm.value; + shiftArr += 2; + cid += 2; + memset(tmpIcon, 0, sizeof(tmpIcon)); + } + }else{ + char findTxt[1] = {ch}; + struct Character ctm = getCharacter(findTxt); + if(ctm.value != NULL){ + tmp[cid - shiftArr] = ctm.value; + }else{ + tmp[cid - shiftArr] = 0x9E; + } + } + } + + tmp = realloc(tmp, (strSize - shiftArr + 1) * sizeof(u8)); + tmp[strSize - shiftArr] = 0xFF; + + return tmp; +} diff --git a/src/text/txtconv.h b/src/text/txtconv.h new file mode 100644 index 00000000..cf05aa89 --- /dev/null +++ b/src/text/txtconv.h @@ -0,0 +1,15 @@ +#ifndef TXTDATA +#define TXTDATA + +#include "types.h" + +struct Character{ + char * txt; + s32 value; +}; + +extern struct Character charmap[340]; + +u8 * getTranslatedText(char * txt); + +#endif \ No newline at end of file diff --git a/texts/es.json b/texts/es.json new file mode 100644 index 00000000..eea01112 --- /dev/null +++ b/texts/es.json @@ -0,0 +1,3100 @@ +{ + "dialogs": [ + { + "ID": 0, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Wow! Caíste en medio", + "de un campo de batalla.", + "Encontrarás el Poder", + "Estelar que Bowser se robó", + "Dentro de los mundos", + "de las pinturas.", + "Primero, habla con el", + "Bob-omb amigo. (Presiona [B]", + "para hablar.) Él te va a", + "ayudar, como también", + "su camaradas en otras", + "áreas.", + "Para leer letreros, detente, míralos", + "y presiona [B]. Presiona [A]", + "o [B] para seguir leyendo. Puedes", + "hablar con otros", + "personajes con mirarlos", + "y presionar [B]." + ] + }, + { + "ID": 1, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Cuidado! Si caminas", + "por aquí, eres propenso a", + "que te peguen por una", + "bomba de agua!", + "Estos Bomb-ombs enemigos", + "les gusta pelear, y hayarán", + "alguna forma de", + "atacarte.", + "Esta pradera se ha convertido", + "en un campo de batalla desde", + "que el Gran Bomb-omb tuvo sus", + "manos en la Estrella de Poder.", + "¿Puedes recuperar la Estrella", + "por nosotros? Cruza el puente", + "y vé por el camino de la izquierda", + "Para encontrar el Gran Bomb-omb.", + "¡Por favor ven a verme", + "después que hayas recuperado", + "la Estrella de Poder!" + ] + }, + { + "ID": 2, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Oye, tú! Adelante es ", + "peligroso, ¡Así que escucha!", + "Toma mi consejo.", + "", + "Cruza los dos", + "puentes venideros, y", + "fíjate por las bombas", + "de agua que caen.", + "El Gran Bob-omb está en", + "el tope de la montaña es", + "muy poderoso-- ¡No le dejes", + "que te agarre!", + "Somos Bomb-omb amigables,", + "y estamos de tu lado.", + "¡Puedes hablar con nosotros", + "de lo que gustes!" + ] + }, + { + "ID": 3, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Gracias, Mario! ¡El Gran", + "Bob-omb no es más que un", + "gran fracaso! pero la", + "batalla por el castillo solo", + "ha empezado.", + "Otros enemigos tienen", + "Las demás Estrellas de Poder. Si", + "recuperas más Estrellas,", + "Puedes abrir más puertas", + "que te lleven a nuevos mundos!", + "Mis Bob-omb amigos te están", + "esperando. Ten seguridad", + "de hablar con ellos--Ellos", + "te prepararán los cañones." + ] + }, + { + "ID": 4, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Somos Bomb-ombs amantes", + "de la paz, así que no usamos", + "cañones.", + "Pero si quieres ser", + "lanzado, no nos preocupamos.", + "Te ayudamos.", + "Prepararemos todos los", + "cañones en este nivel para", + "que los uses. Bon Voyage!" + ] + }, + { + "ID": 5, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Oye, Mario! ¿Es verdad", + "Que venciste al Gran", + "Bob-omb? ¡Genial!", + "Debes ser fuerte. Y", + "muy veloz. Así que, ¿Qué", + "tan veloz eres?", + "Lo suficiente para vencer a...", + "Koopa El Veloz? No lo", + "creo. Sólo inténtalo.", + "Te parece una carrera a lo", + "más alto de la montaña, Donde", + "el Gran Bomb-omb estuvo?", + "¿Qué dices? ¡Cuándo diga", + "『Ya,』 la carrerá empezará!", + "", + "Listo....", + "", + "//¡Ya!//No aún" + ] + }, + { + "ID": 6, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡¡¡Oye!!! No intentes engañarme", + "Tienes que correr", + "toda la pista.", + "Luego. Ven a verme", + "cuando quieras una verdadera", + "carrera." + ] + }, + { + "ID": 7, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Ufff...fff...ufff...", + "Guau! Si...Que...eres...", + "veloz! Una bala humana!", + "Aquí tienes--¡Te la ganaste,", + "legalmente!" + ] + }, + { + "ID": 8, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "CUIDADO CON EL CHAIN CHOMP", + "¡Peligro extremo!", + "Acércate y presiona [C]^", + "para verlo mejor.", + "Da miedo, verdad?", + "¿Ves la moneda roja", + "sobre la estaca?", + "", + "Cuando recolectes ocho de", + "ellas, una Estrella de Poder", + "aparecerá en el prado", + "por el puente." + ] + }, + { + "ID": 9, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Tiempo de no vernos! ¡Vaya,", + "te has puesto veloz!", + "Has estado entrenando", + "a escondidas, o es el", + "poder de las Estrellas?", + "Me he sentido mal", + "por perder la última", + "carrera. Esta es mi pista", + "de origen--¿Te parece", + "una revancha?", + "La meta está en el", + "Valle Ventoso.", + "¿Listo?", + "", + "//¡Ya!// No aún" + ] + }, + { + "ID": 10, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Has apretado el", + "Interruptor de la Gorra Alada.", + "Poniéndotela, podrás", + "surcar por los cielos.", + "Ahora las Gorras Aladas saldrán", + "de los bloques rojos", + "que encuentres.", + "", + "¿Quieres guardar?", + "", + "//Sí//No" + ] + }, + { + "ID": 11, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Has apretado el interruptor", + "De la Gorra Metálica!", + "Con ella hace que", + "Mario sea invencible.", + "Ahora las Gorras Metálicas", + "saldrán de los", + "bloques verdes que encuentres.", + "", + "¿Quieres guardar?", + "", + "//Sí//No" + ] + }, + { + "ID": 12, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Has apretado el Interruptor", + "de la Gorra Transparente.", + "Con la Gorra Transparente", + "Mario desaparecerá.", + "Ahora las Gorras Transparentes", + "Saldrán de los bloques", + "azules que encuentres.", + "", + "¿Quieres guardar?", + "", + "//Sí//No" + ] + }, + { + "ID": 13, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Has conseguido 100", + "monedas! Mario obtiene", + "poder del castillo.", + "¿Quieres guardar?", + "//Sí//No" + ] + }, + { + "ID": 14, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Genial! ¡Otra Estrella de Poder!", + "Mario consigue más coraje", + "del poder del", + "castillo.", + "¿Quieres guardar?", + "", + "//¡Claro!//No ahora mismo" + ] + }, + { + "ID": 15, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Puedes pegarle a los enemigos", + "hasta que caiga. Presiona [A]", + "para saltar, [B] para pegar.", + "Presiona [A] luego [B] para patear.", + "Para agarrar algo,", + "presiona [B], también. Para tirar", + "algo que sostienes,", + "presiona [B] otra vez." + ] + }, + { + "ID": 16, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Súbete al caparazón brillante y", + "condúcelo a donde quiera que", + "vaya! ¡Tritura esos enemigos!" + ] + }, + { + "ID": 17, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Soy el Gran Bomb-omb, señor", + "de toda la materia explosiva,", + "¡Rey de las explosiones de", + "todo el mundo!", + "¿Cómo te atreves escalar", + " mi montaña? Con que derecho", + "pisas la cima de mi", + "montaña imperial?", + "Puede que hayas evitado mis", + "guardias, pero nunca escaparás", + "De mi alcance...", + "", + "...y nunca me quitarás", + "mi Estrella de Poder.", + "Por la presente razón", + "te desafío, Mario!", + "Si quieres la Estrella que", + "poseo, debes demostrar", + "tu valor en batalla.", + "", + "¿Puedes levantarme desde", + "atrás y lanzarme a este", + "suelo real? Creo que", + "no podrás!" + ] + }, + { + "ID": 18, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Estoy durmiendo porque...", + "...tengo sueño. Y no me", + "gusta ser molestado.", + "Camina lentamente por favor." + ] + }, + { + "ID": 19, + "linesPerBox": 2, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Shhh! ¡Por favor camina", + "lentamente por el pasillo!" + ] + }, + { + "ID": 20, + "linesPerBox": 6, + "leftOffset": 95, + "width": 150, + "lines": [ + "Querido Mario:", + "Por favor ven al", + "castillo. He horneado", + "un pastel para tí.", + "Atentamente--", + "Princesa Toadstool" + ] + }, + { + "ID": 21, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Bienvenido.", + "¡No hay nadie en casa!", + "¡Ahora lárgate--", + "y no regreses!", + "¡Gwa ja ja!" + ] + }, + { + "ID": 22, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ocupas unas llave para", + "abrir esta puerta." + ] + }, + { + "ID": 23, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Esta llave no entra!", + "Tal vez es la del", + "sótano..." + ] + }, + { + "ID": 24, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Necesitas poder Estelar para", + "abrir esta puerta. Recupera una", + "Estrella de Poder de un enemigo", + "dentro de los cuadro dels", + "castillo." + ] + }, + { + "ID": 25, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Se necesitan el poder de", + "3 Estrellas para abrir esta", + "Puerta. Necesitas otras [%]", + "Estrellas." + ] + }, + { + "ID": 26, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Se necesitan el poder de", + "8 Estrellas para abrir esta", + "Puerta. Necesitas otras [%]", + "Estrellas." + ] + }, + { + "ID": 27, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Se necesitan el poder de", + "30 Estrellas para abrir esta", + "Puerta. Necesitas otras [%]", + "Estrellas." + ] + }, + { + "ID": 28, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Se necesitan el poder de", + "50 Estrellas para abrir esta", + "Puerta. Necesitas otras [%]", + "Estrellas." + ] + }, + { + "ID": 29, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Para abrir esta puerta", + "que llevan a las escaleras", + "『infinitas』, necesitas 70", + "Estrellas.", + "¡Bwa ja ja!" + ] + }, + { + "ID": 30, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Hola! Los Hermanos Lakitu,", + "grabando en vivo una", + "actualización en el", + "progreso de Mario. Va ha", + "aprender una técnica para", + "escurridirse por los enemigos.", + "El truco es este: Tiene que", + "caminar lentamente para", + "caminar con cautela.", + "", + "", + "", + "Y para acabar las técnicas", + "de cámara antes mensionadas,", + "para echar un vistazo alrededor", + "Usa [C]> y []C<.", + "Presiona [C]| para ver la", + "acción desde una distancia.", + "Cuando no puedas mover la", + "cámara más lejos, el", + "pitido sonará. Hemos sido", + "los Hermanos Lakitu,", + "cerrando señal." + ] + }, + { + "ID": 31, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡No puede ser! Me venciste...", + "¡¡de nuevo!! ¡Y que gasté", + "todos mis ahorros en", + "estas nuevas tenis para", + "correr Koopa Mach 1!", + "Aquí, creo que tendré que", + "darle esta Estrella al", + "ganador de la carrera.", + "¡Felicidades, Mario!" + ] + }, + { + "ID": 32, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Si tienes la Gorra Alada,", + "¡Podrás volar! Ponte la", + "gorra, entonces has un Triple", + "Salto--salta tres veces", + "en cadena--para dejar el suelo.", + "Puedes volar aún más alto", + "si eres disparado desde", + "un cañón portando", + "la Gorra Alada!", + "", + "Usa los Botones [C] para mirar", + "alrededor mientras vuelas,", + "y presiona [Z] para aterrizar." + ] + }, + { + "ID": 33, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Ciao! Has llegado al", + "Castillo de la Princesa Toadstool", + "por medio de una tubería warp.", + "Usar el control es pan comido.", + "Presiona [A] para saltar", + "[B] para atacar.", + "Presiona [B] también para leer", + "letreros. Usa el Stick de Control", + "en el centro del", + "control para mover a Mario", + "alrededor. Ahora, ve hacia", + "el castillo." + ] + }, + { + "ID": 34, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Buenas Tardes. Los", + "Hermanos Lakitu, presentes,", + "reportando en vivo desde", + "las afueras del castillo de", + "la Princesa.", + "", + "Mario acaba de llegar", + "a la escena, y estaremos", + "la acción en vivo", + "y va en la misión de recuperar", + "y perseguir las Estrellas", + "de Poder perdidas.", + "Como camarógrafos experimentados,", + "grabaremos desde el ángulo", + "recomendado, pero", + "puedes cambiar el ángulo de", + "la cámara con presionar", + "los Botones [C].", + "Si no puedes ajustar la cámara", + "más lejos, sonaremos el", + "pitido. Para observar los", + "alrededores, detente", + "y presiona [C]^.", + "", + "Presiona [A] para seguir jugando.", + "Cambia los modos de cámara", + "con el Botón [R]. Las instrucciones", + "serán revisitadas más", + "adelante.", + "", + "Por ahora, reportando en vivo,", + "estos han sido los", + "Hermanos Lakitu." + ] + }, + { + "ID": 35, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hay 4 cámaras, o", + "Botones『[C],』. Presiona [C]^", + "para mirar alrededor usando el", + "Stick de Control.", + "", + "Usualmente verás a Mario", + "através de la cámara de Lakitu.", + "Esta es la cámara", + "recomendada para jugar", + "normalmente.", + "Puedes cambiar los ángulos", + "presionando [C]>. Si presionas", + "[R], la vista intercambia", + "a la cámara de Mario, la cuál", + "está directamente detrás de él.", + "Presiona [R] de nuevo para volver", + "a la cámara de Lakitu. Presiona", + "[C]| para ver a Mario", + "desde lejos, usando tanto", + "la vista de Lakitu's o Mario." + ] + }, + { + "ID": 36, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "OBSERVATION PLATFORM", + "Presiona [C]^ para mirar", + "alrededor. No te pierdas", + "de nada!", + "", + "Presiona [R] para cambiar a la", + "cámara de Mario. Esta", + "siempre seguirá a Mario.", + "Presiona [R] otra vez para cambiar", + "a la cámara de Lakitu.", + "Pausa el juego y cambia la cámara", + "de Mario al modo『arreglado』", + "la cámara estará estática al", + "mantener [R]. ¡Pruébalo!" + ] + }, + { + "ID": 37, + "linesPerBox": 2, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Gané! ¡Perdiste!", + "¡Ja ja ja ja!", + "¡No eres perezoso, pero soy", + "el mejor en la resbaladilla!", + "¡Buena a la próxima!" + ] + }, + { + "ID": 38, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Reaccionando al poder", + "Estelar, la puerta abre", + "lantamente." + ] + }, + { + "ID": 39, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "No se permiten visitantes,", + "por decreto del", + "Gran Bob-omb", + "", + "Nunca daré mis Estrellas,", + "porqué contienen el", + "poder del castillo en", + "su brillo.", + "Son un regalo de", + "Bowser, el mismisimo Rey", + "de los Koopa, y están bien", + "ocultas en mi reino.", + "Ninguna pista de su", + "paradero saldrá de", + "mi boca. Oh, está bien,", + "tal vez una pista:", + "Presta atención de los", + "nombres de las Estrellas", + "al inicio de un mundo.", + "//--El Gran Bob-omb" + ] + }, + { + "ID": 40, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Cuidado!", + "¡Grieta muy fría", + "abajo!" + ] + }, + { + "ID": 41, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Gané! ¡Perdiste!", + "¡Ja ja ja!", + "", + "Eso te pasa por meterte", + "con Koopa el", + "Veloz.¡Buena suerte", + "la próxima vez!" + ] + }, + { + "ID": 42, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Precuación! ¡Puente angosto!", + "¡Cruce lentamente!", + "", + "", + "Puedes saltar al borde", + "del ancantilado y sostente,", + "y escalarás del borde", + "si te mueves lentamente.", + "Si te quieres soltar,", + "puedes presionar [Z] o mover", + "el Stick de Control a la", + "dirección contraria a Mario.", + "Para escalar, mueve el Stick", + "de Control hacia adelante.", + "Para escalar más rápido,", + "presiona el Botón [A]." + ] + }, + { + "ID": 43, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Si saltas y mantienes el botón", + "[A], puedes sostenerte a", + "objetos sobre de tí.", + "¡Igual como a agarrarte", + "una ave volando!" + ] + }, + { + "ID": 44, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "¿Quién anda ahí? ¿Quién", + "me despertóoo? Aún hay luz", + "solar--¡Debería estar", + "durmiendo!", + "", + "Oye, mientras esté", + "despierto, ¿Por qué haces", + "pequeño vuelo conmigo?", + "Presiona y mantén [A] para", + "agarrarte. Suelta [A] para soltarte.", + "Te llevaré a donde quieras,", + "Mientras tanto que mis", + "alas aguanten.", + "Observa y sombra, y", + "sostente." + ] + }, + { + "ID": 45, + "linesPerBox": 6, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Vaya! Casi me canso.", + "¡Deberías dejar las pastas", + "Mario! Eso es todo por el", + "momento. Presiona [A]", + "para soltarte. Esta bien,", + "¡Nos vemoooooos!" + ] + }, + { + "ID": 46, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Debes amaestrar las tres", + "más importantes técnicas", + "de salto.", + "Primero el Tripe Salto.", + "", + "Corre rápido, entonces salta tres", + "veces, una, dos, tres.", + "Si coordinas tus saltos", + "correctamente, entonces salta,", + "y saltarás bien alto.", + "Después, vé por distancia", + "con el Salto Largo. Corre,", + "presiona [Z] para agacharte luego", + "[A] para saltar bien lejos.", + "", + "Para hacer un Salto de Pared,", + "presiona [A] para saltar desde una", + "pared, entonces salta justo", + "cuando toques la otra pared.", + "", + "¿Entendido? Triple Salto,", + "Salto Largo, Salto de Pared.", + "Practica, practica,", + "practica. Y no podrás vivir", + "sin usarlos." + ] + }, + { + "ID": 47, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Hola! ¡Prepararé el", + "cañón para tí!" + ] + }, + { + "ID": 48, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Cumbre de la montaña de nieve", + "¡Cuidado con las condiciones", + "resbaladisas! Por favor", + "entra a la cabaña antes." + ] + }, + { + "ID": 49, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¿Recuerdas ese truco de", + "Salto de Pared? Es una técnica", + "que tienes que amaestrar", + "para poder alcanzar zonas", + "bien altas.", + "Úsala de saltar de pared", + "a pared. Presiona el", + "Stick de Control en la", + "dirección que quieras", + "rebotar para ganar momentum.", + "¡Práctica hace al maestro!" + ] + }, + { + "ID": 50, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mantén [Z] para agacharte y", + "deslizarte por una resbaladilla.", + "O presiona [Z] en el aire para", + "hacer un Salto Bomba!", + "Si te detienes, agáchate,", + "entonces salta, ¡Harás el", + "Salto Mortal hacia atrás!", + "¿Entiendes?", + "Hay más. ¡Agáchate y", + "luego salta para hacer", + "Salto Largo! O agáchate", + "para caminar a...Olvídalo." + ] + }, + { + "ID": 51, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Escalar es fácil! Cuando", + "te subes a los árboles, postes o", + "pilares, te agarrarás a ellos", + "automáticamente. Presiona [A]", + "para saltar al contrario.", + "", + "Para rotar alrededor del", + "objeto, mueve a la Derecha o", + "Izquierda en el Stick de Control.", + "¡Cuándo llegues al tope,", + "mueve hacia Arriba para", + "hacer una parada de manos!", + "Salta de la parada", + "de manos para una desmontura,", + "bastante estilosa." + ] + }, + { + "ID": 52, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Detente y presiona [Z]", + "para agacharte, luego presiona", + "[A] para hacer una, Salto", + "Mortal hacia atrás!", + "", + "Para hacer un Salto", + "Mortal Lateral, corre,", + "has una vuelta en U y salta.", + "Puedes tomar bastante altura", + "con los dos saltos." + ] + }, + { + "ID": 53, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "A veces, si pasas por", + "Através por un anillo de monedas", + "o encuentras un secreto en", + "el nivel, un número rojo", + "aparecerá.", + "Si activas 5 de estos", + "números, una Estrella secreta", + "aparecerá." + ] + }, + { + "ID": 54, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Bienvenido a la resbaladilla", + "nevada! ¡Súbete! Para acelerar,", + "mueve hacia adelante en el", + "Stick de Control. Para descelerar,", + "muévelo para atrás." + ] + }, + { + "ID": 55, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¿O-ye, Mario, amigo,", + "como 'tas? Atrévete.", + "Pareces el tipo que es", + "veloz deslizándose.", + "Sé de la velocidad cuando", + "la veo, Sí señoorr--Soy el", + "deslizante campeón,", + "sabes. ¿Qué dices?", + "¿Te parece una carrera?", + "Listo...", + "", + "//Ya// No aún" + ] + }, + { + "ID": 56, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Rrrompiste mi récord!", + "¡Increíble! Sabía que", + "eras el más genial.", + "¡Has demostrado que", + "tambíen eres el más", + "rápido!", + "No te puedo dar una medalla", + "dorada, pero ten, toma esta", + "Estrella en cambio. ¡Te la", + "ganaste!" + ] + }, + { + "ID": 57, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Dios Mío! ¡¡Mi bebé!!", + "¿¿¿Has visto a mi bebé???", + "Ella es la bebé más bella", + "de todo este basto mundo.", + "(Dicen que tiene mi", + "pico...) Sólo, no", + "recuerdo donde la", + "dejé.", + "Veamos...Me detuve por", + "arenque y cubos de hielo,", + "entonces yo...¡oohh! ¡Sólo", + "no lo sé!" + ] + }, + { + "ID": 58, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Encontraste a mi pequeña,", + "¡Preciosa Bebé! ¿Dónde", + "has estado? ¿Cómo", + "podré agradecerte, Mario?", + "Oh, Yo si que tengo...", + "...esta Estrella. Aquí, tómala", + "con mi eterna", + "gratitud." + ] + }, + { + "ID": 59, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Esa no es mi beé! ¡Ni", + "se parece nada a mí!", + "¡Sus padres deben estar", + "muy preocupados!" + ] + }, + { + "ID": 60, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡ATENCIÓN!", + "¡Léalo antes de entrar al agua!", + "", + "", + "Si se mantiene bajo el", + "agua por mucho tiempo,", + "se quedará sin oxígeno", + "", + "Regrese a la superficie por", + "aire o encuentre burbujas", + "o monedas para respirar un poco", + "más bajo el agua.", + "Presiona [A] para nadar. mantenga [A]", + "para nadar lentamente.", + "Presione [A] repetídamente con", + "buen tiempo para ganar velocidad.", + "Mueva para arriba en el", + "Stick de Control y presione [A]", + "para bucear.", + "", + "Mueva hacia abajo en el Stick", + "de Control y presione [A]", + "para regresar a la superficie.", + "", + "Mantenga abajo y presione [A]", + "en la superficie cerca de un", + "borde del agua para", + "saltar fuera." + ] + }, + { + "ID": 61, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡BRRR! ¡Peligro de Congelarse!", + "No nade aquí.", + "Enserio.", + "/--La Pingüina" + ] + }, + { + "ID": 62, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Ocultos dentro de los bloques", + "está la azombrosa", + "Gorra Metálica.", + "Portándola, no recibás daños,", + "prenderte en fuego, o ser", + "dañado por ataques enemigos.", + "No necesitas respirar", + "mientras la usas.", + "", + "El único problema:", + "No puedes nadar." + ] + }, + { + "ID": 63, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "La Gorra Invisible dentro", + "de los Bloques Azules.", + "¡Te sorprenderás, porque", + "serás invisible al", + "portarla!", + "Incluso el Gran Boo será", + "engañado--y también puedes", + "caminar por las paredes." + ] + }, + { + "ID": 64, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Cuando te pones la Gorra", + "Alada que sale de los", + "Bloques Rojos, has el Triple", + "Salto para despegar alto", + "en el cielo.", + "Usa el Stick de Control para", + "guiar a Mario. Muévelo para", + "abajo para volar alto, y adelante", + "para descender, y presiona [Z]", + "para aterrizar." + ] + }, + { + "ID": 65, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Lecciones de Natación!", + "Toca [A] para hacer el golpe", + "de pecho. Si calculas los", + "toques bien, nadarás más", + "rápido.", + "", + "Presiona y mantén [A] para", + "hacer un lento, nadado constante.", + "Mueve hacia arriba en el Stick", + "de control para busear, y muévelo", + "hacia atrás para sacar la cabeza", + "a la superficie.", + "Para saltar fuera del agua,", + "mantén abajo en el Stick", + "de Control, y presiona [A].", + "Pan comido, ¿Cierto?", + "", + "", + "Pero recuerda:", + "¡Mario no puede respirar bajo", + "el agua! Regresa a la", + "superficie por aire cuando el", + "Medidor de Poder escasee.", + "", + "Y una última cosa: No", + "puedes abrir puertas", + "bajo el agua." + ] + }, + { + "ID": 66, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Mario, Es Peach!", + "¡Por favor sé cuidadoso! ¡Bowser", + "es muy malvado! Tratará", + "de quemarte con su", + "horrible aliento de fuego.", + "Rodéalo y agárralo por", + "su cola usando el Botón", + "[B]. Una vez le agarres,", + "Muévelo haciendo grandes", + "circulos. Rota el Stick de", + "Control para ir rápido y", + "más rápido.", + "Mientras más rápido lo muevas,", + "más lejos lo mandarás a volar.", + "", + "Usa los Botones [C] para ver", + "alrededor, Mario. Tienes", + "que tirar a Bowser a una", + "de las bombas en las", + "cuatro esquinas.", + "Apunta bien, luego presiona [B]", + "para lanzar a Bowser.", + "¡Buena suerte, Mario! Nuestro", + "destino está en tus manos." + ] + }, + { + "ID": 67, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Mala Suerte, Mario!", + "La Princesa Toadstool no", + "está aquí...¡¡Gwa ja ja!!", + "¡Acércate--intenta agarrarme", + "por la cola!", + "¡Nunca serás capaz de", + "mecerme! ¡Un debilucho", + "como tú nunca me tiraría", + "fuera de aquí! ¡Nunca! ¡Ja!" + ] + }, + { + "ID": 68, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Es la Tierra de Lava Letal!", + "Si te quemas o te caes a", + "una piscina de flamas,", + "vas a salir volando, pero", + "no pierdas la calma.", + "Aún podrás controlar a", + "Mario--¡Solo mantén la", + "calma!" + ] + }, + { + "ID": 69, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "A veces chocarás con", + "paredes invisibles en los", + "bordes de los mundos de las", + "pinturas. Si chocas contra", + "una mientras vuelas, solo", + "rebotarás de vuelta." + ] + }, + { + "ID": 70, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Puedes regresar al salón", + "principal del castillo en", + "cualquier momento desde los", + "mundos de las pinturas donde", + "los enemigos viven.", + "Solo detente, quédate quieto,", + "presiona Start para pausar", + "el juego, entonces selecciona", + "『Salir Nivel.』", + "", + "No tienes que recoger", + "todas las Estrellas de Poder", + "en un nivel antes de ir a", + "la siguiente.", + "", + "Regresa después, cuando seas", + "más experimentado, para", + "escoger las más difíciles.", + "", + "", + "Cuando encuentres una Estrella,", + "una pista de como encontrar", + "la siguiente aparecerá al", + "iniciar el nivel otra vez.", + "", + "También puedes, recoger", + "cualquier Estrella restante", + "a la próxima. No necesitas", + "recoger la descrita por", + "la pista." + ] + }, + { + "ID": 71, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Peligro adelante!", + "¡Cuidado con la nube", + "extraña! ¡No inale!", + "¡Si se siente debil, busque", + "suelo alto y aire", + "fresco!", + "Círculo: Refugio", + "Flecha: Entrada-Salida" + ] + }, + { + "ID": 72, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Vientos violentos adelante!", + "Soténgase el gorro fuerte.", + "Si sale volando, Tendrás", + "que encontrala en la", + "montaña." + ] + }, + { + "ID": 73, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Aarrgh! Ahoy, amigo.", + "Aquí tengo un", + "tesoro hundido.", + "", + "Pero para hacer el saqueo,", + "deberás abrir los Cofres", + "del Tesoro en el orden", + "correcto.", + "¿En cuál orden,", + "dices?", + "", + "", + "¡Nunca diré!", + "", + "//--El Capitán" + ] + }, + { + "ID": 74, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Puedes sostenerte del", + "borde de una ancantilado", + "o un borde, con tus dedos", + "y soltarte de eso.", + "", + "Para soltarte del borde,", + "puedes mover el Stick de", + "Control al lado contrario a", + "Mario o presionar el Botón", + "[Z].", + "Para escalar del borde,", + "Puedes mover el Stick de", + "Control Hacia arriba o presionar", + "[A] al momento de colgarte", + "del borde para escalarlo." + ] + }, + { + "ID": 75, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡¡Mario!! Mi castillo está", + "en grave peligro. Sé que", + "Bowser es la causa...y", + "¡Sé que lo puedes detener!", + "", + "Las puertas del castillo", + "que han sido selladas por", + "Bowser pueden ser abiertas", + "con Poder Estelar.", + "", + "Pero hay pasadisos", + "secretos en el castillo,", + "pasadisos que Bowser no", + "encontró.", + "", + "Uno de esos pasillos está", + "en esta habitación, ¡Y contiene", + "una Estrella oculta del", + "Castillo!", + "", + "¡Encuentra la Estrella", + "oculta, Mario! Te ayudará", + "en tu aventura. Por Favor,", + "Mario, ¡Tienes que", + "ayudarnos!", + "¡Reúne todas las Estrellas", + "de Poder en el castillo", + "liberanos de esta", + "horrible prisión!", + "¡Por favor!" + ] + }, + { + "ID": 76, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Gracias por el poder", + "de las Estrellas, la vida", + "ha regresado al castillo.", + "¡Por favor, Mario, tienes que", + "darle a Bowser su merecido!", + "", + "Mira, déjame contarte una", + "pequeña cosita sobre el", + "castillo. En la habitación", + "de los espejos, mira atentamente", + "por algo que no se refleje", + "en el espejo.", + "Y cuando vayas al pueblo", + "acuático, puedes inundarlo", + "con un gran salto a la", + "pintura. ¡Oh, además,", + "Mira que encontré!" + ] + }, + { + "ID": 77, + "linesPerBox": 2, + "leftOffset": 150, + "width": 200, + "lines": [ + "Desenderá para aquel que se", + "atreva a bajar los pilares." + ] + }, + { + "ID": 78, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Abre el bloque de monedas", + "azules con Golpear el", + "Suelo con el Botón [Z].", + "Una Moneda Azúl equivale a", + "cinco Monedas Amarillas.", + "¡Pero debes apurarte!", + "¡Las monedas desaparecerán si", + "no eres lo veloz suficiente", + "para agarrarlas! ¡Qué mal!" + ] + }, + { + "ID": 79, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Owwwuu! ¡Déjame ir!", + "¡Uukee-kee! ¡Solo estaba", + "jugando! ¿No puedes tomarlo", + "como una broma?", + "Te digo que, hagamos un", + "intercambio. Si me dejas ir,", + "te daré algo muy bueno.", + "", + "Así que, ¿Te perece bien?", + "", + "//Liberarlo/ Sostenerlo" + ] + }, + { + "ID": 80, + "linesPerBox": 1, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Eeeh jee jee jee!" + ] + }, + { + "ID": 81, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "El misterio de lo Seco", + "o Húmedo.", + "¿Dónde recae", + "la solución?", + "La ciudad da la bienvenida", + "con el deseo profundo", + "cuando ellos entren." + ] + }, + { + "ID": 82, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Sostén bien tu Gorra! Si", + "lo pierdes, recibirás", + "más daños fácilmente.", + "", + "Si pierdes tu Gorra,", + "tendrás que buscarla en", + "el nivel que la", + "perdiste.", + "Oh, chico, Esto no se ve", + "bien por Peach. Ella", + "sigue encerrada", + "dentro del castillo.", + "¡Por favor, Mario, tienes que", + "ayudarla! ¿Sabías", + "que hay mundos enemigos", + "dentro del castillo?", + "Sip. Es verdad. Las tropas", + "de Bowser están ahí, también.", + "Oh, aquí, toma esto. Lo", + "estaba guardando para tí." + ] + }, + { + "ID": 83, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hay algo extraño", + "acerca de ese reloj. Cuando", + "saltas dentro, mira la", + "pisoción de la aguja pequeña.", + "Oh, ¡Mira lo que encontré!", + "¡Aquí, Mario, atrapa!" + ] + }, + { + "ID": 84, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Yaaouu! ¡Suéltame,", + "bruto! Voy tarde, muy tarde,", + "¡Debo apurarme!", + "¿Esta cosa brillante? ¡Mía!", + "Es mía. El que se lo", + "encuentra se lo queda,", + "Tarde, tarde, tarde...", + "¡Auch! ¡Tómala entonces! Un", + "regalo de Bowser, Era.", + "Ahora suéltame! ¡Qué tengo", + "una cita! ¡No puedo llegar", + "tarde por té!" + ] + }, + { + "ID": 85, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "No tendrás ninguna chance", + "ante un fantasma en esta mansión.", + "Si sales de aquí,", + "te mereces...", + "...una medalla fantasmal..." + ] + }, + { + "ID": 86, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Dando vueltas en círculos,", + "hace a cualquiera sus", + "ojos girar." + ] + }, + { + "ID": 87, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Santa Clos no el el único", + "que puede bajar por mi", + "chimenea! ¡Ven entra!", + "/-Propietario de la cabaña" + ] + }, + { + "ID": 88, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Elevador funcionando", + "Para aquellos que bajen", + "aquí: Agárrece del poste", + "a su izquiera y se deslíza", + "con cuidado." + ] + }, + { + "ID": 89, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Ambos caminos tienen", + "peligros! ¡Cuidando donde", + "pisa! Aquellos que no", + "pueden hacer el Salto Largo,", + "tsk, vaya por la derecha.", + "Derecha: Elevador Funcionando", + "/// Laberinto nuboso", + "Izquierda: Agujero negro", + "///Laguna subterránea", + "", + "Círculo Rojo: Elevador 2", + "// Laguna subterránea", + "Flecha: Usted está aquí" + ] + }, + { + "ID": 90, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Bwa ja ja ja!", + "¡Has caído en mi trampa,", + "justo como lo supuse", + "que harías! Te lo advertí,", + "『Amigo,』 ¡Mira por", + "donde pisas!" + ] + }, + { + "ID": 91, + "linesPerBox": 2, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Peligro!", + "¡Vientos fuertes!", + "Pero el viento lo hace", + "un viaje cómodo." + ] + }, + { + "ID": 92, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Molestándome de nuevo,", + "¿verdad, Mario? ¿No ves que", + "estoy divirtiéndome un", + "poco, haciendo desorden", + "con mis secuaces?", + "Ahora, ¡Regresa las estrellas!", + "¡Mis tropas en las pinturas", + "las necesitan! ¡Bwa ja ja!" + ] + }, + { + "ID": 93, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Mario! ¡Otra vez tú! Bueno", + "eso está bien--¡Estaba", + "buscando algo para", + "freír con mi Aliento", + "de Fuego!", + "¡Tu Estrella de Poder", + "es inútil contra mí!", + "Todos tus amigos están", + "atrapados dentro de", + "estas paredes...", + "¡Y no volverás a", + "ver a la Princesa!", + "¡Bwa ja ja ja!" + ] + }, + { + "ID": 94, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Buen intento subiendo", + "la pendiente! ¿Recuerdas", + "el Salto Largo? Corre,", + "presiona [Z], y ¡Salta!" + ] + }, + { + "ID": 95, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Para leer letreros, pónte", + "al frente de uno y presiona [B],", + "como hiciste ahora.", + "", + "Cuando quieras hablar con", + "un Koopa Troopa u otro", + "animal, Pónte al frente", + "de ellos.", + "Por favor recupera las", + "Estrellas robadas por", + "Bowser en este nivel." + ] + }, + { + "ID": 96, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Aquí el camino es angosto.", + "¡Así de fácil! ¡Nadie tiene", + "permitido subir a la", + "cima de la montaña!", + "¡Y si sabes que es", + "bueno para tí, No despertarías", + "alguien que esté", + "durmiendo!", + "Múevete lentamente,", + "pise con cuidado." + ] + }, + { + "ID": 97, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡No te dejes seducir!", + "Si alguien intenta", + "empujarte, ¡Empuja de regreso!", + "¡Es uno a uno, con un fin", + "flamante para el perdedor!" + ] + }, + { + "ID": 98, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ven aquí...", + "...jeh, jeh, jeh..." + ] + }, + { + "ID": 99, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Eh je je...", + "Ahora, eres mío, ¡jee jee!", + "Pasaré através de esta", + "pared. ¿Puedes hacer", + "eso? Jeh, jeh, jeh!" + ] + }, + { + "ID": 100, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ukkiki...Wakkiki...¡kee kee!", + "¡Ja! ¡Te la quité!", + "¡Es mía! ¡Jeejeejeeee!" + ] + }, + { + "ID": 101, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Ackk! Suél...tame...", + "Me...estás...ahorcando...", + "Cough...¡He sido engañado!", + "¿Esta Gorra? Oh, está bien,", + "tómala. Es una buena Gorra,", + "pero te la devolveré.", + "¡Creo que se ve mejor", + "en mí que en tí!", + "¡Eeeee! ¡Kee keee!" + ] + }, + { + "ID": 102, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Pssst! Los Boos son súper", + "tímidos. Si les miras", + "a los ojos, desaparecerán,", + "pero si te das vuelta,", + "ellos reaparecerán.", + "Es inútil pegarles cuando", + "se están desapareciendo.", + "En cambio, escabúllete", + "por detrás y pégales." + ] + }, + { + "ID": 103, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Una vez los cuatro", + "pilares se alineen...", + "Entonces el pico", + "deberá iluminarse..." + ] + }, + { + "ID": 104, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "La sombra estellada frente", + "a tí es una『Marca", + "Estrellas.』 Cuando recolectes", + "las 8 Monedas Rojas, la Estrella", + "aparecerá aquí." + ] + }, + { + "ID": 105, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Listo para el despegue!", + "¡Entra, salta al cañón!", + "", + "Alcanzarás la estrella en", + "la isla flotante con", + "usar los cuatro cañones.", + "Usa el Stick de Control para", + "apuntar, y presiona [A]", + "para disparar", + "Te será útil, puedes", + "agarrarte de postes o árboles", + "al aterrizar." + ] + }, + { + "ID": 106, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Listo para el despegue!", + "¡Vamos, salta al cañón!" + ] + }, + { + "ID": 107, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Fantasmas...", + "...no...", + "...¡Mueren!", + "¡Jeh, jeh, jeh!", + "¿Podrás salir de aquí...", + "...con vida?" + ] + }, + { + "ID": 108, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Boooooo-m! Aquí viene", + "el Maestro del Desorden,", + "la torre del terror,", + "¡El Gran Boo!", + "Ka ja ja ja..." + ] + }, + { + "ID": 109, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Ooooo Nooooo!", + "Hablando de experiencias", + "Fuera-del-cuerpo--", + "¡Mi cuerpo se derritió!", + "¿¿Has encontrado a alguien", + "sin cabeza últimamente??", + "¡Podría usar un nuevo", + "cuerpo!", + "¡Brrr! ¡Mi cara se va", + "a congelar si sigo así!" + ] + }, + { + "ID": 110, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ocupo una buena cabeza sobre", + "mis hombros. ¿Sabes de", + "alguien que ocupe un buen", + "cuerpo? ¡Por Favor! ¡Te", + "seguré si sabes!" + ] + }, + { + "ID": 111, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Perfecto! ¡Qué buen", + "cuerpo! Aquí--Este es un", + "regalo para tí. Seguro", + "te calentará." + ] + }, + { + "ID": 112, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Obtén todas las monedas", + "posibles! Rellenarán", + "tu Medidor de Poder.", + "", + "Puedes fijarte cuantas", + "monedas has recolectado", + "en todos los 15 mundos", + "enemigos.", + "También puedes recuperar", + "poder tocando el", + "Corazón rotatorio.", + "", + "Mientras más veloz", + "atravezcas el corazón,", + "más poder recuperarás." + ] + }, + { + "ID": 113, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hay Gorras especiales en", + "los bloques rojos, azules,", + "y verdes. Ponte sobre los", + "Interruptores en los", + "niveles ocultos para activar", + "los bloques de Gorras." + ] + }, + { + "ID": 114, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Esto me enoja! Construimos", + "sus casas, sus castillos.", + "Pavimentamos sus", + "caminos, y aún así caminan", + "sobre todos nosotros.", + "¿Siquiera dices gracias?", + "¡No! Bueno, no vas a", + "limpiarte los zapatos", + "sobre mí! ¡Creo que te", + "aplasaré por diversión!", + "¿Algún problema con", + "ello? Solo trata de", + "pegarme, ¡Debilucho! ¡Ja!" + ] + }, + { + "ID": 115, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡No! ¡Pisado de nuevo!", + "Solo soy una piedra más,", + "después de todo. No me agravaré,", + "er, arrastraré. Ten, ganaste.", + "¡Toma esto contigo!" + ] + }, + { + "ID": 116, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "¿Quu....Quéeee?", + "¿¿¿Cómo alguien tan", + "débil como tú pudo", + "desactivar al Rey", + "Bomb-Omb????", + "Puedes ser lo veloz suficiente", + "para vencerme, pero tendrás", + "que acelerar el paso", + "si quieres agarrar al Rey", + "Bowser por la cola.", + "¡Puede que mis tropas", + "aprendan una lección de tí!", + "Aquí está tu estrella, como", + "lo prometí, Mario.", + "", + "Si quieres verme otra", + "vez, selecciona la Estrella", + "desde el menú. Por ahora,", + "nos vemos." + ] + }, + { + "ID": 117, + "linesPerBox": 1, + "leftOffset": 95, + "width": 200, + "lines": [ + "¿Quién...camina...aquí?", + "¿Quién...rompió...sello?", + "¿Despertó..los..antiguos?", + "Nos nos gusta la luz...", + "Tieeeemblaaaaa...", + "¡No nos gustan los...intrusos!", + "¡Ahora pelea...", + "...mano...", + "...a...", + "...mano!" + ] + }, + { + "ID": 118, + "linesPerBox": 6, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Tieeemblooo!", + "¿Qué...pasó?", + "Fuimos...vencidos por un débil.", + "¡Eres fuerte!", + "¡Mandas la pirámide antigua!", + "Por hoy...", + "Ahora, ten la Estrella de Poder.", + "Dormiremos...a...oscuras." + ] + }, + { + "ID": 119, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Grrr! Fuí muy poco", + "cuidadoso. Esto no lo tenía", + "planeado...pero aún así", + "tengo el poder de las", + "Estrellas, y aún tengo a", + "Peach.", + "¡Bwa ja ja! ¡No tendrás", + "más Estrellas de mí! Aún", + "no he acabado contigo,", + "te dejaré ir por ahora", + "¡Pagarás por esto...", + "luego!" + ] + }, + { + "ID": 120, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Ooowaah! ¿¿¿Cómo pude", + "perder??? El poder de", + "las Estrellas me fallaron...", + "esta vez.", + "Considera esto un empate.", + "La próxima, Estaré en", + "perfecta condición.", + "", + "Ahora, si quieres ver a", + "tu preciosa princesa,", + "ven a lo más alto de", + "la torre.", + "¡Estaré esperando!", + "¡Gwa ja ja ja!" + ] + }, + { + "ID": 121, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Nooo! ¡No puede ser!", + "¡¡¿Enserio me venciste,", + "Mario?!! ¡Les dí poder", + "a mis tropas, pero ahora", + "me desasparezco!", + "¡Arrgghh! ¡Puedo ver paz", + "regresar al mundo!", + "¡No puedo verlo! Hmmm...", + "Pero no he acabado...", + "", + "¡Vamos tropas! ¡Vamos a ver", + "el desenlane juntos!", + "¡Bwa ja ja!" + ] + }, + { + "ID": 122, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "El Agujero Negro", + "Derecha: Elevador en funcionamiento", + "/// Laberinto Nublado", + "Izquierda: Lago Subterráneo" + ] + }, + { + "ID": 123, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Caverna Metálica", + "Derecha: A la Cascada", + "Izquierda: Interruptor de la Gorra Metálica" + ] + }, + { + "ID": 124, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Elevador en funcionamiento", + "¡¡Peligro!!", + "¡Lea las instrucciones", + "\\ncon cuidado!", + "El elevador se mueve en", + "la dirección de la flecha", + "activada." + ] + }, + { + "ID": 125, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Salida-Laberinto Vagante", + "¡Peligro! Cerrado.", + "De la vuelta." + ] + }, + { + "ID": 126, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Arriba: Agujero Negro", + "Derecha: Elevador en funcionamiento", + "/// Laberinto Vagante" + ] + }, + { + "ID": 127, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Lago subterráneo", + "Derecha: Cueva Metálica", + "izquiera: Mina Abandonada", + "///(Cerrado)", + "Una gentíl dragona vive", + "aquí. Gopéale en la espalda", + "para que baje su cabeza.", + "No te vuelvas en su almuerzo." + ] + }, + { + "ID": 128, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "¡Deberás pelear con", + "honor! Va contras las", + "reglas reales tirar al", + "rey fuera del cuadrilátero!" + ] + }, + { + "ID": 129, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Bienvenido al nivel", + "de la Gorra Invisible! Todos", + "los bloques azúles que encuentres", + "se volverán sólidos una vez", + "preciones el interruptor.", + "Desaparecerás cuando", + "te pongas la Gorra Invisible,", + "con ella serás capaz de eludir", + "enemigos y caminar através", + "de muchas cosas. ¡Pruébalo!" + ] + }, + { + "ID": 130, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Bienvenido al nivel", + "de la Gorra Metálica! Una vez", + "el interruptor de la Gorra,", + "los bloques verdes se", + "volverán solidos.", + "Cuando tu cuerpo se vuelve", + "metálico con la Gorra", + "Metálica, ¡Puedes caminar", + "bajo el agua! ¡Pruébalo!" + ] + }, + { + "ID": 131, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Bienvenido al nivel de la", + "Gorra Alada! Párate en el", + "interruptor en lo más", + "alto de la torre, en el centro", + "del anillo arcoíris.", + "Cuando actives el", + "interruptor, todos los bloques", + "rojos que encuentres se", + "volverán sólidos.", + "", + "¡Prueba la Gorra Alada! Haz el", + "Triple Salto para salir volando", + "y preciona [Z] para aterrizar.", + "", + "", + "Mueve para atrás el Stick", + "de Control para subir, y muévelo", + "hacia abajo para ir en picada,", + "justo como harías si", + "volaras un avión." + ] + }, + { + "ID": 132, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Whoa, Mario, amigo, ¿Acaso", + "intentas hacer trampa?", + "Los atajos no están", + "permitidos.", + "Ahora, ¡Sé más que tú", + "que estás descalificado!", + "¡A la próxima,", + "juega limpio!" + ] + }, + { + "ID": 133, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "¡Estoy muy contento de verte!", + "La Princesa...y yo...y,", + "bueno, Todos...estamos", + "atrapados en las paredes", + "del castillo.", + "", + "Bowser ha robado", + "las Estrellas del castillo,", + "y está usando su poder", + "para crear sus mundos dentro", + "de las pinturas y de los muros.", + "", + "¡Por favor, recoge las Estrellas", + "de Poder! Mientras las encuentras,", + "puedes usar sus poderes", + "para abrir puertas que", + "Bowser ha sellado.", + "", + "Hay 4 habitaciones en el", + "primer piso. Inicia con", + "la que tiene la pintura que", + "contiene Bomb-omb en ella. Es", + "la única habitación que Bowser", + "no selló.", + "Cuando obtengas ocho", + "Estrellas de Poder, serás", + "capaz de abrir la puerta", + "con la gran estrella. ¡La", + "Princesa debe estar ahí!" + ] + }, + { + "ID": 134, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "The names of the Stars", + "are also hints for", + "finding them. They are", + "displayed at the beginning", + "of each course.", + "You can collect the Stars", + "in any order. You won't", + "find some Stars, enemies", + "or items unless you select", + "a specific Star.", + "After you collect some", + "Stars, you can try", + "another course.", + "We're all waiting for", + "your help!" + ] + }, + { + "ID": 135, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "It was Bowser who stole", + "the Stars. I saw him with", + "my own eyes!", + "", + "", + "He's hidden six Stars in", + "each course, but you", + "won't find all of them in", + "some courses until you", + "press the Cap Switches.", + "The Stars you've found", + "will show on each course's", + "starting screen.", + "", + "", + "If you want to see some", + "of the enemies you've", + "already defeated, select", + "the Stars you recovered", + "from them." + ] + }, + { + "ID": 136, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Wow! You've already", + "recovered that many", + "Stars? Way to go, Mario!", + "I'll bet you'll have us out", + "of here in no time!", + "", + "Be careful, though.", + "Bowser and his band", + "wrote the book on 『bad.』", + "Take my advice: When you", + "need to recover from", + "injuries, collect coins.", + "Yellow Coins refill one", + "piece of the Power Meter,", + "Red Coins refill two", + "pieces, and Blue Coins", + "refill five.", + "", + "To make Blue Coins", + "appear, pound on Blue", + "Coin Blocks.", + "", + "", + "", + "Also, if you fall from", + "high places, you'll", + "minimize damage if you", + "Pound the Ground as you", + "land." + ] + }, + { + "ID": 137, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Thanks, Mario! The castle", + "is recovering its energy", + "as you retrieve Power", + "Stars, and you've chased", + "Bowser right out of here,", + "on to some area ahead.", + "Oh, by the by, are you", + "collecting coins? Special", + "Stars appear when you", + "collect 100 coins in each", + "of the 15 courses!" + ] + }, + { + "ID": 138, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Down: Underground Lake", + "Left: Black Hole", + "Right: Hazy Maze (Closed)" + ] + }, + { + "ID": 139, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Above: Automatic Elevator", + "Elevator begins", + "automatically and follows", + "pre-set course.", + "It disappears", + "automatically, too." + ] + }, + { + "ID": 140, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Elevator Area", + "Right: Hazy Maze", + "/// Entrance", + "Left: Black Hole", + "///Elevator 1", + "Arrow: You are here" + ] + }, + { + "ID": 141, + "linesPerBox": 5, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered one of", + "the stolen Power Stars!", + "Now you can open some of", + "the sealed doors in the", + "castle.", + "Try the Princess's room", + "on the second floor and", + "the room with the", + "painting of Whomp's", + "Fortress on Floor 1.", + "Bowser's troops are still", + "gaining power, so you", + "can't give up. Save us,", + "Mario! Keep searching for", + "Stars!" + ] + }, + { + "ID": 142, + "linesPerBox": 5, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered three", + "Power Stars! Now you can", + "open any door with a 3", + "on its star.", + "", + "You can come and go from", + "the open courses as you", + "please. The enemies ahead", + "are even meaner, so be", + "careful!" + ] + }, + { + "ID": 143, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered eight of", + "the Power Stars! Now you", + "can open the door with", + "the big Star! But Bowser", + "is just ahead...can you", + "hear the Princess calling?" + ] + }, + { + "ID": 144, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered 30", + "Power Stars! Now you can", + "open the door with the", + "big Star! But before you", + "move on, how's it going", + "otherwise?", + "Did you pound the two", + "columns down? You didn't", + "lose your hat, did you?", + "If you did, you'll have to", + "stomp on the condor to", + "get it back!", + "They say that Bowser has", + "sneaked out of the sea", + "and into the underground.", + "Have you finally", + "cornered him?" + ] + }, + { + "ID": 145, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered 50", + "Power Stars! Now you can", + "open the Star Door on the", + "third floor. Bowser's", + "there, you know.", + "", + "Oh! You've found all of", + "the Cap Switches, haven't", + "you? Red, green and blue?", + "The Caps you get from the", + "colored blocks are really", + "helpful.", + "Hurry along, now. The", + "third floor is just ahead." + ] + }, + { + "ID": 146, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've found 70 Power", + "Stars! The mystery of the", + "endless stairs is solved,", + "thanks to you--and is", + "Bowser ever upset! Now,", + "on to the final bout!" + ] + }, + { + "ID": 147, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Are you using the Cap", + "Blocks? You really should,", + "you know.", + "", + "", + "To make them solid so you", + "can break them, you have", + "to press the colored Cap", + "Switches in the castle's", + "hidden courses.", + "You'll find the hidden", + "courses only after", + "regaining some of the", + "Power Stars.", + "", + "The Cap Blocks are a big", + "help! Red for the Wing", + "Cap, green for the Metal", + "Cap, blue for the Vanish", + "Cap." + ] + }, + { + "ID": 148, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Snowman Mountain ahead.", + "Keep out! And don't try", + "the Triple Jump over the", + "ice block shooter.", + "", + "", + "If you fall into the", + "freezing pond, your power", + "decreases quickly, and", + "you won't recover", + "automatically.", + "//--The Snowman" + ] + }, + { + "ID": 149, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Welcome to", + "Princess Toadstool's", + "secret slide!", + "There's a Star hidden", + "here that Bowser couldn't", + "find.", + "When you slide, press", + "forward to speed up,", + "pull back to slow down.", + "If you slide really", + "fast, you'll win the Star!" + ] + }, + { + "ID": 150, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Waaaa! You've flooded my", + "house! Wh-why?? Look at", + "this mess! What am I", + "going to do now?", + "", + "The ceiling's ruined, the", + "floor is soaked...what to", + "do, what to do? Huff...", + "huff...it makes me so...", + "MAD!!!", + "Everything's been going", + "wrong ever since I got", + "this Star...It's so shiny,", + "but it makes me feel...", + "strange..." + ] + }, + { + "ID": 151, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "I can't take this", + "anymore! First you get", + "me all wet, then you", + "stomp on me!", + "Now I'm really, really,", + "REALLY mad!", + "Waaaaaaaaaaaaaaaaa!!!" + ] + }, + { + "ID": 152, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Owwch! Uncle! Uncle!", + "Okay, I rindete. Take this", + "Star!", + "Whew! I feel better now.", + "I don't really need it", + "anymore, anyway--", + "I can see the stars", + "through my ceiling at", + "night.", + "They make me feel...", + "...peaceful. Please, come", + "back and visit anytime." + ] + }, + { + "ID": 153, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hey! Who's there?", + "What's climbing on me?", + "Is it an ice ant?", + "A snow flea?", + "Whatever it is, it's", + "bugging me! I think I'll", + "blow it away!" + ] + }, + { + "ID": 154, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hold on to your hat! If", + "you lose it, you'll be", + "easily injured. If you", + "lose it, look for it in the", + "course where you lost it.", + "Speaking of lost, the", + "Princess is still stuck in", + "the walls somewhere.", + "Please help, Mario!", + "", + "Oh, you know that there", + "are secret worlds in the", + "walls as well as in the", + "paintings, right?" + ] + }, + { + "ID": 155, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Thanks to the power of", + "the Stars, life is", + "returning to the castle.", + "Please, Mario, you have", + "to give Bowser the boot!", + "", + "Here, let me tell you a", + "little something about the", + "castle. In the room with", + "the mirrors, look carefully", + "for anything that's not", + "reflected in the mirror.", + "And when you go to the", + "water town, you can flood", + "it with a high jump into", + "the painting." + ] + }, + { + "ID": 156, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "The world inside the", + "clock is so strange!", + "When you jump inside,", + "watch the position of", + "the big hand!" + ] + }, + { + "ID": 157, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Watch out! Don't let", + "yourself be swallowed by", + "quicksand.", + "", + "", + "If you sink into the sand,", + "you won't be able to", + "jump, and if your head", + "goes under, you'll be", + "smothered.", + "The dark areas are", + "bottomless pits." + ] + }, + { + "ID": 158, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "1. If you jump repeatedly", + "and time it right, you'll", + "jump higher and higher.", + "If you run really fast and", + "time three jumps right,", + "you can do a Triple Jump.", + "2. Jump into a solid wall,", + "then jump again when you", + "hit the wall. You can", + "bounce to a higher level", + "using this Wall Kick." + ] + }, + { + "ID": 159, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "3. If you stop, press [Z]", + "to crouch, then jump, you", + "can perform a Backward", + "Somersault. To do a Long", + "Jump, run fast, press [Z],", + "then jump." + ] + }, + { + "ID": 160, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Press [B] while running", + "fast to do a Body Slide", + "attack. To stand while", + "sliding, press [A] or [B]." + ] + }, + { + "ID": 161, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario!!!", + "It that really you???", + "It has been so long since", + "our last adventure!", + "They told me that I might", + "see you if I waited here,", + "but I'd just about given", + "up hope!", + "Is it true? Have you", + "really beaten Bowser? And", + "restored the Stars to the", + "castle?", + "And saved the Princess?", + "I knew you could do it!", + "Now I have a very special", + "message for you.", + "『Thanks for playing Super", + "Mario 64! This is the", + "end of the game, but not", + "the end of the fun. We want you to keep on", + "playing, so we have a", + "little something for you.", + "We hope that you like it!", + "Enjoy!!! 』", + "", + "The Super Mario 64 Team" + ] + }, + { + "ID": 162, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "No, no, no! Not you", + "again! I'm in a great", + "hurry, can't you see?", + "", + "I've no time to squabble", + "over Stars. Here, have it.", + "I never meant to hide it", + "from you...", + "It's just that I'm in such", + "a rush. That's it, that's", + "all. Now, I must be off.", + "Owww! Let me go!" + ] + }, + { + "ID": 163, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Noooo! You've really", + "beaten me this time,", + "Mario! I can't stand", + "losing to you!", + "", + "My troops...worthless!", + "They've turned over all", + "the Power Stars! What?!", + "There are 120 in all???", + "", + "Amazing! There were some", + "in the castle that I", + "missed??!!", + "", + "", + "Now I see peace", + "returning to the world...", + "Oooo! I really hate that!", + "I can't watch--", + "I'm outta here!", + "Just you wait until next", + "time. Until then, keep", + "that Control Stick", + "smokin'!", + "Buwaa ha ha!" + ] + }, + { + "ID": 164, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario! What's up, pal?", + "I haven't been on the", + "slide lately, so I'm out", + "of shape.", + "Still, I'm always up for a", + "good race, especially", + "against an old sleddin'", + "buddy.", + "Whaddya say?", + "Ready...set...", + "", + "//Go// Don't Go" + ] + }, + { + "ID": 165, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "I take no responsibility", + "whatsoever for those who", + "get dizzy and pass out", + "from running around", + "this post." + ] + }, + { + "ID": 166, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "I'll be back soon.", + "I'm out training now,", + "so come back later.", + "//--Koopa the Quick" + ] + }, + { + "ID": 167, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Princess Toadstool's", + "castle is just ahead.", + "", + "", + "Press [A] to jump, [Z] to", + "crouch, and [B] to punch,", + "read a sign, or grab", + "something.", + "Press [B] again to throw", + "something you're holding." + ] + }, + { + "ID": 168, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hey! Knock it off! That's", + "the second time you've", + "nailed me. Now you're", + "asking for it, linguine", + "breath!" + ] + }, + { + "ID": 169, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Keep out!", + "That means you!", + "Arrgghh!", + "", + "Anyone entering this cave", + "without permission will", + "meet certain disaster." + ] + } + ] +} \ No newline at end of file diff --git a/texts/us.json b/texts/us.json new file mode 100644 index 00000000..d2b57a28 --- /dev/null +++ b/texts/us.json @@ -0,0 +1,3074 @@ +{ + "dialogs": [ + { + "ID": 0, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Wow! You're smack in the", + "middle of the battlefield.", + "You'll find the Power", + "Stars that Bowser stole", + "inside the painting", + "worlds.", + "First, talk to the", + "Bob-omb Buddy. (Press [B]", + "to talk.) He'll certainly", + "help you out, and so will", + "his comrades in other", + "areas.", + "To read signs, stop, face", + "them and press [B]. Press [A]", + "or [B] to scroll ahead. You", + "can talk to some other", + "characters by facing them", + "and pressing [B]." + ] + }, + { + "ID": 1, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Watch out! If you wander", + "around here, you're liable", + "to be plastered by a", + "water bomb!", + "Those enemy Bob-ombs love", + "to fight, and they're", + "always finding ways to", + "attack.", + "This meadow has become", + "a battlefield ever since", + "the Big Bob-omb got his", + "paws on the Power Star.", + "Can you recover the Star", + "for us? Cross the bridge", + "and go left up the path", + "to find the Big Bob-omb.", + "Please come back to see", + "me after you've retrieved", + "the Power Star!" + ] + }, + { + "ID": 2, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Hey, you! It's dangerous", + "ahead, so listen up! Take", + "my advice.", + "", + "Cross the two", + "bridges ahead, then", + "watch for falling", + "water bombs.", + "The Big Bob-omb at the", + "top of the mountain is", + "very powerful--don't let", + "him grab you!", + "We're Bob-omb Buddies,", + "and we're on your side.", + "You can talk to us", + "whenever you'd like to!" + ] + }, + { + "ID": 3, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Thank you, Mario! The Big", + "Bob-omb is nothing but a", + "big dud now! But the", + "battle for the castle has", + "just begun.", + "Other enemies are holding", + "the other Power Stars. If", + "you recover more Stars,", + "you can open new doors", + "that lead to new worlds!", + "My Bob-omb Buddies are", + "waiting for you. Be sure", + "to talk to them--they'll", + "set up cannons for you." + ] + }, + { + "ID": 4, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "We're peace-loving", + "Bob-ombs, so we don't use", + "cannons.", + "But if you'd like", + "to blast off, we don't", + "mind. Help yourself.", + "We'll prepare all of the", + "cannons in this course for", + "you to use. Bon Voyage!" + ] + }, + { + "ID": 6, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hey!!! Don't try to scam", + "ME.", + "You've gotta run", + "the whole course.", + "Later. Look me up when", + "you want to race for", + "real." + ] + }, + { + "ID": 7, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hufff...fff...pufff...", + "Whoa! You...really...are...", + "fast! A human blur!", + "Here you go--you've won", + "it, fair and square!" + ] + }, + { + "ID": 8, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "BEWARE OF CHAIN CHOMP", + "Extreme Danger!", + "Get close and press [C]^", + "for a better look.", + "Scary, huh?", + "See the Red Coin on top", + "of the stake?", + "", + "When you collect eight of", + "them, a Power Star will", + "appear in the meadow", + "across the bridge." + ] + }, + { + "ID": 9, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Long time, no see! Wow,", + "have you gotten fast!", + "Have you been training", + "on the sly, or is it the", + "power of the Stars?", + "I've been feeling down", + "about losing the last", + "race. This is my home", + "course--how about a", + "rematch?", + "The goal is in", + "Windswept Valley.", + "Ready?", + "", + "//Go// Don't Go" + ] + }, + { + "ID": 10, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "You've stepped on the", + "Wing Cap Switch. Wearing", + "the Wing Cap, you can", + "soar through the sky.", + "Now Wing Caps will pop", + "out of all the red blocks", + "you find.", + "", + "Would you like to Save?", + "", + "//Yes//No" + ] + }, + { + "ID": 11, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "You've just stepped on", + "the Metal Cap Switch!", + "The Metal Cap makes", + "Mario invincible.", + "Now Metal Caps will", + "pop out of all of the", + "green blocks you find.", + "", + "Would you like to Save?", + "", + "//Yes//No" + ] + }, + { + "ID": 12, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "You've just stepped on", + "the Vanish Cap Switch.", + "The Vanish Cap makes", + "Mario disappear.", + "Now Vanish Caps will pop", + "from all of the blue", + "blocks you find.", + "", + "Would you like to Save?", + "", + "//Yes//No" + ] + }, + { + "ID": 13, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "You've collected 100", + "coins! Mario gains more", + "power from the castle.", + "Do you want to Save?", + "//Yes//No" + ] + }, + { + "ID": 14, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Wow! Another Power Star!", + "Mario gains more courage", + "from the power of the", + "castle.", + "Do you want to Save?", + "", + "//You Bet//Not Now" + ] + }, + { + "ID": 15, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "You can punch enemies to", + "knock them down. Press [A]", + "to jump, [B] to punch.", + "Press [A] then [B] to Kick.", + "To pick something up,", + "press [B], too. To throw", + "something you're holding,", + "press [B] again." + ] + }, + { + "ID": 16, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hop on the shiny shell and", + "ride wherever you want to", + "go! Shred those enemies!" + ] + }, + { + "ID": 17, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "I'm the Big Bob-omb, lord", + "of all blasting matter,", + "king of ka-booms the", + "world over!", + "How dare you scale my", + "mountain? By what right", + "do you set foot on my", + "imperial mountaintop?", + "You may have eluded my", + "guards, but you'll never", + "escape my grasp...", + "", + "...and you'll never take", + "away my Power Star. I", + "hereby challenge you,", + "Mario!", + "If you want the Star I", + "hold, you must prove", + "yourself in battle.", + "", + "Can you pick me up from", + "the back and hurl me to", + "this royal turf? I think", + "that you cannot!" + ] + }, + { + "ID": 18, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "I'm sleeping because...", + "...I'm sleepy. I don't", + "like being disturbed.", + "Please walk quietly." + ] + }, + { + "ID": 19, + "linesPerBox": 2, + "leftOffset": 30, + "width": 200, + "lines": [ + "Shhh! Please walk", + "quietly in the hallway!" + ] + }, + { + "ID": 20, + "linesPerBox": 6, + "leftOffset": 95, + "width": 150, + "lines": [ + "Dear Mario:", + "Please come to the", + "castle. I've baked", + "a cake for you.", + "Yours truly--", + "Princess Toadstool" + ] + }, + { + "ID": 21, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Welcome.", + "No one's home!", + "Now scram--", + "and don't come back!", + "Gwa ha ha!" + ] + }, + { + "ID": 22, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "You need a key to open", + "this door." + ] + }, + { + "ID": 23, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "This key doesn't fit!", + "Maybe it's for the", + "basement..." + ] + }, + { + "ID": 24, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "You need Star power to", + "open this door. Recover a", + "Power Star from an enemy", + "inside one of the castle's", + "paintings." + ] + }, + { + "ID": 25, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "It takes the power of", + "3 Stars to open this", + "door. You need [%] more", + "Stars." + ] + }, + { + "ID": 26, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "It takes the power of", + "8 Stars to open this", + "door. You need [%] more", + "Stars." + ] + }, + { + "ID": 27, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "It takes the power of", + "30 Stars to open this", + "door. You need [%] more", + "Stars." + ] + }, + { + "ID": 28, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "It takes the power of", + "50 Stars to open this", + "door. You need [%] more", + "Stars." + ] + }, + { + "ID": 29, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "To open the door that", + "leads to the 『endless』", + "stairs, you need 70", + "Stars.", + "Bwa ha ha!" + ] + }, + { + "ID": 30, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hello! The Lakitu Bros.,", + "cutting in with a live", + "update on Mario's", + "progress. He's about to", + "learn a technique for", + "sneaking up on enemies.", + "The trick is this: He has", + "to walk very slowly in", + "order to walk quietly.", + "", + "", + "", + "And wrapping up filming", + "techniques reported on", + "earlier, you can take a", + "look around using [C]> and", + "[C]<. Press [C]| to view the", + "action from a distance.", + "When you can't move the", + "camera any farther, the", + "buzzer will sound. This is", + "the Lakitu Bros.,", + "signing off." + ] + }, + { + "ID": 31, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "No way! You beat me...", + "again!! And I just spent", + "my entire savings on", + "these new Koopa", + "Mach 1 Sprint shoes!", + "Here, I guess I have to", + "hand over this Star to", + "the winner of the race.", + "Congrats, Mario!" + ] + }, + { + "ID": 32, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "If you get the Wing Cap,", + "you can fly! Put the cap", + "on, then do a Triple", + "Jump--jump three times", + "in a row--to take off.", + "You can fly even higher", + "if you blast out of a", + "cannon wearing the", + "Wing Cap!", + "", + "Use the [C] Buttons to look", + "around while flying, and", + "press [Z] to land." + ] + }, + { + "ID": 33, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Ciao! You've reached", + "Princess Toadstool's", + "castle via a warp pipe.", + "Using the controller is a", + "piece of cake. Press [A] to", + "jump and [B] to attack.", + "Press [B] to read signs,", + "too. Use the Control Stick", + "in the center of the", + "controller to move Mario", + "around. Now, head for", + "the castle." + ] + }, + { + "ID": 34, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Good afternoon. The", + "Lakitu Bros., here,", + "reporting live from just", + "outside the Princess's", + "castle.", + "", + "Mario has just arrived", + "on the scene, and we'll", + "be filming the action live", + "as he enters the castle", + "and pursues the missing", + "Power Stars.", + "As seasoned cameramen,", + "we'll be shooting from the", + "recommended angle, but", + "you can change the", + "camera angle by pressing", + "the [C] Buttons.", + "If we can't adjust the", + "view any further, we'll", + "buzz. To take a look at", + "the surroundings, stop", + "and press [C]^.", + "", + "Press [A] to resume play.", + "Switch camera modes with", + "the [R] Button. Signs along", + "the way will review these", + "instructions.", + "", + "For now, reporting live,", + "this has been the", + "Lakitu Bros." + ] + }, + { + "ID": 35, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "There are four camera, or", + "『[C],』 Buttons. Press [C]^", + "to look around using the", + "Control Stick.", + "", + "You'll usually see Mario", + "through Lakitu's camera.", + "It is the camera", + "recommended for normal", + "play.", + "You can change angles by", + "pressing [C]>. If you press", + "[R], the view switches to", + "Mario's camera, which", + "is directly behind him.", + "Press [R] again to return", + "to Lakitu's camera. Press", + "[C]| to see Mario from", + "afar, using either", + "Lakitu's or Mario's view." + ] + }, + { + "ID": 36, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "OBSERVATION PLATFORM", + "Press [C]^ to take a look", + "around. Don't miss", + "anything!", + "", + "Press [R] to switch to", + "Mario's camera. It", + "always follows Mario.", + "Press [R] again to switch", + "to Lakitu's camera.", + "Pause the game and", + "switch the mode to 『fix』", + "the camera in place while", + "holding [R]. Give it a try!" + ] + }, + { + "ID": 37, + "linesPerBox": 2, + "leftOffset": 30, + "width": 200, + "lines": [ + "I win! You lose!", + "Ha ha ha ha!", + "You're no slouch, but I'm", + "a better sledder!", + "Better luck next time!" + ] + }, + { + "ID": 38, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Reacting to the Star", + "power, the door slowly", + "opens." + ] + }, + { + "ID": 39, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "No visitors allowed,", + "by decree of", + "the Big Bob-omb", + "", + "I shall never surrender my", + "Stars, for they hold the", + "power of the castle in", + "their glow.", + "They were a gift from", + "Bowser, the Koopa King", + "himself, and they lie well", + "hidden within my realm.", + "Not a whisper of their", + "whereabouts shall leave", + "my lips. Oh, all right,", + "perhaps one hint:", + "Heed the Star names at", + "the beginning of the", + "course.", + "//--The Big Bob-omb" + ] + }, + { + "ID": 40, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Warning!", + "Cold, Cold Crevasse", + "Below!" + ] + }, + { + "ID": 41, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "I win! You lose!", + "Ha ha ha!", + "", + "That's what you get for", + "messin' with Koopa the", + "Quick.", + "Better luck next time!" + ] + }, + { + "ID": 42, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Caution! Narrow Bridge!", + "Cross slowly!", + "", + "", + "You can jump to the edge", + "of the cliff and hang on,", + "and you can climb off the", + "edge if you move slowly.", + "When you want to let go,", + "either press [Z] or press", + "the Control Stick in the", + "direction of Mario's back.", + "To climb up, press Up on", + "the Control Stick. To", + "scurry up quickly, press", + "the [A] Button." + ] + }, + { + "ID": 43, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "If you jump and hold the", + "[A] Button, you can hang on", + "to some objects overhead.", + "It's the same as grabbing", + "a flying bird!" + ] + }, + { + "ID": 44, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Whooo's there? Whooo", + "woke me up? It's still", + "daylight--I should be", + "sleeping!", + "", + "Hey, as long as I'm", + "awake, why not take a", + "short flight with me?", + "Press and hold [A] to grab", + "on. Release [A] to let go.", + "I'll take you wherever", + "you want to go, as long", + "as my wings hold out.", + "Watch my shadow, and", + "grab on." + ] + }, + { + "ID": 45, + "linesPerBox": 6, + "leftOffset": 95, + "width": 200, + "lines": [ + "Whew! I'm just about", + "flapped out. You should", + "lay off the pasta, Mario!", + "That's it for now. Press", + "[A] to let go. Okay,", + "bye byyyyyyeeee!" + ] + }, + { + "ID": 46, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "You have to master three", + "important jumping", + "techniques.", + "First try the Triple Jump.", + "", + "Run fast, then jump three", + "times, one, two, three.", + "If you time the jumps", + "right, you'll hop, skip,", + "then jump really high.", + "Next, go for distance", + "with the Long Jump. Run,", + "press [Z] to crouch then [A]", + "to jump really far.", + "", + "To do the Wall Kick, press", + "[A] to jump at a wall, then", + "jump again when you hit", + "the wall.", + "", + "Got that? Triple Jump,", + "Long Jump, Wall Kick.", + "Practice, practice,", + "practice. You don't stand", + "a chance without them." + ] + }, + { + "ID": 47, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "Hi! I'll prepare the", + "cannon for you!" + ] + }, + { + "ID": 48, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Snow Mountain Summit", + "Watch for slippery", + "conditions! Please enter", + "the cottage first." + ] + }, + { + "ID": 49, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Remember that tricky Wall", + "Kick jump? It's a", + "technique you'll have to", + "master in order to reach", + "high places.", + "Use it to jump from wall", + "to wall. Press the", + "Control Stick in the", + "direction you want to", + "bounce to gain momentum.", + "Practice makes perfect!" + ] + }, + { + "ID": 50, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hold [Z] to crouch and", + "slide down a slope.", + "Or press [Z] while in the", + "air to Pound the Ground!", + "If you stop, crouch, then", + "jump, you'll do a", + "Backward Somersault!", + "Got that?", + "There's more. Crouch and", + "then jump to do a", + "Long Jump! Or crouch and", + "walk to...never mind." + ] + }, + { + "ID": 51, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Climbing's easy! When you", + "jump at trees, poles or", + "pillars, you'll grab them", + "automatically. Press [A] to", + "jump off backward.", + "", + "To rotate around the", + "object, press Right or", + "Left on the Control Stick.", + "When you reach the top,", + "press Up to do a", + "handstand!", + "Jump off from the", + "handstand for a high,", + "stylin' dismount." + ] + }, + { + "ID": 52, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Stop and press [Z] to", + "crouch, then press [A]", + "to do a high, Backward", + "Somersault!", + "", + "To perform a Side", + "Somersault, run, do a", + "sharp U-turn and jump.", + "You can catch lots of", + "air with both jumps." + ] + }, + { + "ID": 53, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Sometimes, if you pass", + "through a coin ring or", + "find a secret point in a", + "course, a red number will", + "appear.", + "If you trigger five red", + "numbers, a secret Star", + "will show up." + ] + }, + { + "ID": 54, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Welcome to the snow", + "slide! Hop on! To speed", + "up, press forward on the", + "Control Stick. To slow", + "down, pull back." + ] + }, + { + "ID": 55, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hey-ey, Mario, buddy,", + "howzit goin'? Step right", + "up. You look like a fast", + "sleddin' kind of guy.", + "I know speed when I see", + "it, yes siree--I'm the", + "world champion sledder,", + "you know. Whaddya say?", + "How about a race?", + "Ready...", + "", + "//Go// Don't Go" + ] + }, + { + "ID": 56, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "You brrrr-oke my record!", + "Unbelievable! I knew", + "that you were the coolest.", + "Now you've proven", + "that you're also the", + "fastest!", + "I can't award you a gold", + "medal, but here, take this", + "Star instead. You've", + "earned it!" + ] + }, + { + "ID": 57, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Egad! My baby!! Have you", + "seen my baby??? She's", + "the most precious baby in", + "the whole wide world.", + "(They say she has my", + "beak...) I just can't", + "remember where I left", + "her.", + "Let's see...I stopped", + "for herring and ice cubes,", + "then I...oohh! I just", + "don't know!" + ] + }, + { + "ID": 58, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "You found my precious,", + "precious baby! Where", + "have you been? How can", + "I ever thank you, Mario?", + "Oh, I do have this...", + "...Star. Here, take it", + "with my eternal", + "gratitude." + ] + }, + { + "ID": 59, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "That's not my baby! She", + "looks nothing like me!", + "Her parents must be", + "worried sick!" + ] + }, + { + "ID": 60, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "ATTENTION!", + "Read Before Diving In!", + "", + "", + "If you stay under the", + "water for too long, you'll", + "run out of oxygen.", + "", + "Return to the surface for", + "air or find an air bubble", + "or coins to breathe while", + "underwater.", + "Press [A] to swim. Hold [A]", + "to swim slow and steady.", + "Tap [A] with smooth timing", + "to gain speed.", + "Press Up on the", + "Control Stick and press [A]", + "to dive.", + "", + "Press Down on the Control", + "Stick and press [A] to", + "return to the surface.", + "", + "Hold Down and press [A]", + "while on the surface near", + "the edge of the water to", + "jump out." + ] + }, + { + "ID": 61, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "BRRR! Frostbite Danger!", + "Do not swim here.", + "I'm serious.", + "/--The Penguin" + ] + }, + { + "ID": 62, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hidden inside the green", + "block is the amazing", + "Metal Cap.", + "Wearing it, you won't", + "catch fire or be hurt", + "by enemy attacks.", + "You don't even have to", + "breathe while wearing it.", + "", + "The only problem:", + "You can't swim in it." + ] + }, + { + "ID": 63, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "The Vanish Cap is inside", + "the blue block. Mr. I.", + "will be surprised, since", + "you'll be invisible when", + "you wear it!", + "Even the Big Boo will be", + "fooled--and you can walk", + "through secret walls, too." + ] + }, + { + "ID": 64, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "When you put on the Wing", + "Cap that comes from a", + "red block, do the Triple", + "Jump to soar high into", + "the sky.", + "Use the Control Stick to", + "guide Mario. Pull back to", + "to fly up, press forward", + "to nose down, and press [Z]", + "to land." + ] + }, + { + "ID": 65, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Swimming Lessons!", + "Tap [A] to do the breast", + "stroke. If you time the", + "taps right, you'll swim", + "fast.", + "", + "Press and hold [A] to do a", + "slow, steady flutter kick.", + "Press Up on the Control", + "Stick to dive, and pull", + "back on the stick to head", + "for the surface.", + "To jump out of the water,", + "hold Down on the Control", + "Stick, then press [A].", + "Easy as pie, right?", + "", + "", + "But remember:", + "Mario can't breathe under", + "the water! Return to the", + "surface for air when the", + "Power Meter runs low.", + "", + "And one last thing: You", + "can't open doors that", + "are underwater." + ] + }, + { + "ID": 66, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario, it's Peach!", + "Please be careful! Bowser", + "is so wicked! He will try", + "to burn you with his", + "horrible flame breath.", + "Run around behind and", + "grab him by the tail with", + "the [B] Button. Once you", + "grab hold, swing him", + "around in great circles.", + "Rotate the Control Stick", + "to go faster and faster.", + "The faster you swing him,", + "the farther he'll fly.", + "", + "Use the [C] Buttons to look", + "around, Mario. You have", + "to throw Bowser into one", + "of the bombs in the four", + "corners.", + "Aim well, then press [B]", + "again to launch Bowser.", + "Good luck, Mario! Our", + "fate is in your hands." + ] + }, + { + "ID": 67, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Tough luck, Mario!", + "Princess Toadstool isn't", + "here...Gwa ha ha!! Go", + "ahead--just try to grab", + "me by the tail!", + "You'll never be able to", + "swing ME around! A wimp", + "like you won't throw me", + "out of here! Never! Ha!" + ] + }, + { + "ID": 68, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "It's Lethal Lava Land!", + "If you catch fire or fall", + "into a pool of flames,", + "you'll be hopping mad, but", + "don't lose your cool.", + "You can still control", + "Mario--just try to keep", + "calm!" + ] + }, + { + "ID": 69, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Sometimes you'll bump into", + "invisible walls at the", + "edges of the painting", + "worlds. If you hit a wall", + "while flying, you'll bounce", + "back." + ] + }, + { + "ID": 70, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "You can return to the", + "castle's main hall at any", + "time from the painting", + "worlds where the enemies", + "live.", + "Just stop, stand still,", + "press Start to pause the", + "game, then select", + "『Exit Course.』", + "", + "You don't have to collect", + "all Power Stars in one", + "course before going on to", + "the next.", + "", + "Return later, when you're", + "more experienced, to pick", + "up difficult ones.", + "", + "", + "Whenever you find a Star,", + "a hint for finding the", + "next one will appear on", + "the course's start screen.", + "", + "You can, however, collect", + "any of the remaining", + "Stars next. You don't", + "have to recover the one", + "described by the hint." + ] + }, + { + "ID": 71, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Danger Ahead!", + "Beware of the strange", + "cloud! Don't inhale!", + "If you feel faint, run for", + "higher ground and fresh", + "air!", + "Circle: Shelter", + "Arrow: Entrance-Exit" + ] + }, + { + "ID": 72, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "High winds ahead!", + "Pull your Cap down tight.", + "If it blows off, you'll", + "have to find it on this", + "mountain." + ] + }, + { + "ID": 73, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Aarrgh! Ahoy, matey. I", + "have sunken treasure,", + "here, I do.", + "", + "But to pluck the plunder,", + "you must open the", + "Treasure Chests in the", + "right order.", + "What order is that,", + "ye say?", + "", + "", + "I'll never tell!", + "", + "//--The Cap'n" + ] + }, + { + "ID": 74, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "You can grab on to the", + "edge of a cliff or ledge", + "with your fingertips and", + "hang down from it.", + "", + "To drop from the edge,", + "either press the Control", + "Stick in the direction of", + "Mario's back or press the", + "[Z] Button.", + "To get up onto the ledge,", + "either press Up on the", + "Control Stick or press [A]", + "as soon as you grab the", + "ledge to climb up quickly." + ] + }, + { + "ID": 75, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario!! My castle is in", + "great peril. I know that", + "Bowser is the cause...and", + "I know that only you can", + "stop him!", + "The doors in the castle", + "that have been sealed by", + "Bowser can be opened only", + "with Star Power.", + "", + "But there are secret", + "paths in the castle,", + "paths that Bowser hasn't", + "found.", + "", + "One of those paths is in", + "this room, and it holds", + "one of the castle's Secret", + "Stars!", + "", + "Find that Secret Star,", + "Mario! It will help you", + "on your quest. Please,", + "Mario, you have to", + "help us!", + "Retrieve all of the", + "Power Stars in the castle", + "and free us from this", + "awful prison!", + "Please!" + ] + }, + { + "ID": 76, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Thanks to the power of", + "the Stars, life is", + "returning to the castle.", + "Please, Mario, you have", + "to give Bowser the boot!", + "", + "Here, let me tell you a", + "little something about the", + "castle. In the room with", + "the mirrors, look carefully", + "for anything that's not", + "reflected in the mirror.", + "And when you go to the", + "water town, you can flood", + "it with a high jump into", + "the painting. Oh, by the", + "way, look what I found!" + ] + }, + { + "ID": 77, + "linesPerBox": 2, + "leftOffset": 150, + "width": 200, + "lines": [ + "It is decreed that one", + "shall pound the pillars." + ] + }, + { + "ID": 78, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Break open the Blue Coin", + "Block by Pounding the", + "Ground with the [Z] Button.", + "One Blue Coin is worth", + "five Yellow Coins.", + "But you have to hurry!", + "The coins will disappear", + "if you're not quick to", + "collect them! Too bad." + ] + }, + { + "ID": 79, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Owwwuu! Let me go!", + "Uukee-kee! I was only", + "teasing! Can't you take", + "a joke?", + "I'll tell you what, let's", + "trade. If you let me go,", + "I'll give you something", + "really good.", + "So, how about it?", + "", + "//Free him/ Hold on" + ] + }, + { + "ID": 80, + "linesPerBox": 1, + "leftOffset": 30, + "width": 200, + "lines": [ + "Eeeh hee hee hee!" + ] + }, + { + "ID": 81, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "The mystery is of Wet", + "or Dry.", + "And where does the", + "solution lie?", + "The city welcomes visitors", + "with the depth they bring", + "as they enter." + ] + }, + { + "ID": 82, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hold on to your hat! If", + "you lose it, you'll be", + "injured easily.", + "", + "If you do lose your Cap,", + "you'll have to find it in", + "the course where you", + "lost it.", + "Oh, boy, it's not looking", + "good for Peach. She's", + "still trapped somewhere", + "inside the walls.", + "Please, Mario, you have", + "to help her! Did you know", + "that there are enemy", + "worlds inside the walls?", + "Yup. It's true. Bowser's", + "troops are there, too.", + "Oh, here, take this. I've", + "been keeping it for you." + ] + }, + { + "ID": 83, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "There's something strange", + "about that clock. As you", + "jump inside, watch the", + "position of the big hand.", + "Oh, look what I found!", + "Here, Mario, catch!" + ] + }, + { + "ID": 84, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Yeeoww! Unhand me,", + "brute! I'm late, so late,", + "I must make haste!", + "This shiny thing? Mine!", + "It's mine. Finders,", + "keepers, losers...", + "Late, late, late...", + "Ouch! Take it then! A", + "gift from Bowser, it was.", + "Now let me be! I have a", + "date! I cannot be late", + "for tea!" + ] + }, + { + "ID": 85, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "You don't stand a ghost", + "of a chance in this house.", + "If you walk out of here,", + "you deserve...", + "...a Ghoul Medal..." + ] + }, + { + "ID": 86, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Running around in circles", + "makes some bad guys roll", + "their eyes." + ] + }, + { + "ID": 87, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Santa Claus isn't the only", + "one who can go down a", + "chimney! Come on in!", + "/--Cabin Proprietor" + ] + }, + { + "ID": 88, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Work Elevator", + "For those who get off", + "here: Grab the pole to the", + "left and slide carefully", + "down." + ] + }, + { + "ID": 89, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Both ways fraught with", + "danger! Watch your feet!", + "Those who can't do the", + "Long Jump, tsk, tsk. Make", + "your way to the right.", + "Right: Work Elevator", + "/// Cloudy Maze", + "Left: Black Hole", + "///Underground Lake", + "", + "Red Circle: Elevator 2", + "// Underground Lake", + "Arrow: You are here" + ] + }, + { + "ID": 90, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Bwa ha ha ha!", + "You've stepped right into", + "my trap, just as I knew", + "you would! I warn you,", + "『Friend,』 watch your", + "step!" + ] + }, + { + "ID": 91, + "linesPerBox": 2, + "leftOffset": 30, + "width": 200, + "lines": [ + "Danger!", + "Strong Gusts!", + "But the wind makes a", + "comfy ride." + ] + }, + { + "ID": 92, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Pestering me again, are", + "you, Mario? Can't you see", + "that I'm having a merry", + "little time, making", + "mischief with my minions?", + "Now, return those Stars!", + "My troops in the walls", + "need them! Bwa ha ha!" + ] + }, + { + "ID": 93, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario! You again! Well", + "that's just fine--I've", + "been looking for something", + "to fry with my fire", + "breath!", + "Your Star Power is", + "useless against me!", + "Your friends are all", + "trapped within the", + "walls...", + "And you'll never see the", + "Princess again!", + "Bwa ha ha ha!" + ] + }, + { + "ID": 94, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Get a good run up the", + "slope! Do you remember", + "the Long Jump? Run, press", + "[Z], then jump!" + ] + }, + { + "ID": 95, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "To read a sign, stand in", + "front of it and press [B],", + "like you did just now.", + "", + "When you want to talk to", + "a Koopa Troopa or other", + "animal, stand right in", + "front of it.", + "Please recover the Stars", + "that were stolen by", + "Bowser in this course." + ] + }, + { + "ID": 96, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "The path is narrow here.", + "Easy does it! No one is", + "allowed on top of the", + "mountain!", + "And if you know what's", + "good for you, you won't", + "wake anyone who's", + "sleeping!", + "Move slowly,", + "tread lightly." + ] + }, + { + "ID": 97, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Don't be a pushover!", + "If anyone tries to shove", + "you around, push back!", + "It's one-on-one, with a", + "fiery finish for the loser!" + ] + }, + { + "ID": 98, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "Come on in here...", + "...heh, heh, heh..." + ] + }, + { + "ID": 99, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Eh he he...", + "You're mine, now, hee hee!", + "I'll pass right through", + "this wall. Can you do", + "that? Heh, heh, heh!" + ] + }, + { + "ID": 100, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ukkiki...Wakkiki...kee kee!", + "Ha! I snagged it!", + "It's mine! Heeheeheeee!" + ] + }, + { + "ID": 101, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ackk! Let...go...", + "You're...choking...me...", + "Cough...I've been framed!", + "This Cap? Oh, all right,", + "take it. It's a cool Cap,", + "but I'll give it back.", + "I think it looks better on", + "me than it does on you,", + "though! Eeeee! Kee keee!" + ] + }, + { + "ID": 102, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Pssst! The Boos are super", + "shy. If you look them", + "in the eyes, they fade", + "away, but if you turn", + "your back, they reappear.", + "It's no use trying to hit", + "them when they're fading", + "away. Instead, sneak up", + "behind them and punch." + ] + }, + { + "ID": 103, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Upon four towers", + "one must alight...", + "Then at the peak", + "shall shine the light..." + ] + }, + { + "ID": 104, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "The shadowy star in front", + "of you is a 『Star", + "Marker.』 When you collect", + "all 8 Red Coins, the Star", + "will appear here." + ] + }, + { + "ID": 105, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ready for blastoff! Come", + "on, hop into the cannon!", + "", + "You can reach the Star on", + "the floating island by", + "using the four cannons.", + "Use the Control Stick to", + "aim, then press [A] to fire.", + "", + "If you're handy, you can", + "grab on to trees or poles", + "to land." + ] + }, + { + "ID": 106, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ready for blastoff! Come", + "on, hop into the cannon!" + ] + }, + { + "ID": 107, + "linesPerBox": 3, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ghosts...", + "...don't...", + "...DIE!", + "Heh, heh, heh!", + "Can you get out of here...", + "...alive?" + ] + }, + { + "ID": 108, + "linesPerBox": 2, + "leftOffset": 95, + "width": 200, + "lines": [ + "Boooooo-m! Here comes", + "the master of mischief,", + "the tower of terror,", + "the Big Boo!", + "Ka ha ha ha..." + ] + }, + { + "ID": 109, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Ooooo Nooooo!", + "Talk about out-of-body", + "experiences--my body", + "has melted away!", + "Have you run in to any", + "headhunters lately??", + "I could sure use a new", + "body!", + "Brrr! My face might", + "freeze like this!" + ] + }, + { + "ID": 110, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "I need a good head on my", + "shoulders. Do you know of", + "anybody in need of a good", + "body? Please! I'll follow", + "you if you do!" + ] + }, + { + "ID": 111, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "Perfect! What a great", + "new body! Here--this is a", + "present for you. It's sure", + "to warm you up." + ] + }, + { + "ID": 112, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Collect as many coins as", + "possible! They'll refill", + "your Power Meter.", + "", + "You can check to see how", + "many coins you've", + "collected in each of the", + "15 enemy worlds.", + "You can also recover", + "power by touching the", + "Spinning Heart.", + "", + "The faster you run", + "through the heart, the", + "more power you'll recover." + ] + }, + { + "ID": 113, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "There are special Caps in", + "the red, green and blue", + "blocks. Step on the", + "switches in the hidden", + "courses to activate the", + "Cap Blocks." + ] + }, + { + "ID": 114, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "It makes me so mad! We", + "build your houses, your", + "castles. We pave your", + "roads, and still you", + "walk all over us.", + "Do you ever say thank", + "you? No! Well, you're not", + "going to wipe your feet", + "on me! I think I'll crush", + "you just for fun!", + "Do you have a problem", + "with that? Just try to", + "pound me, wimp! Ha!" + ] + }, + { + "ID": 115, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "No! Crushed again!", + "I'm just a stepping stone,", + "after all. I won't gravel,", + "er, grovel. Here, you win.", + "Take this with you!" + ] + }, + { + "ID": 116, + "linesPerBox": 5, + "leftOffset": 95, + "width": 200, + "lines": [ + "Whaaa....Whaaat?", + "Can it be that a", + "pipsqueak like you has", + "defused the Bob-omb", + "king????", + "You might be fast enough", + "to ground me, but you'll", + "have to pick up the pace", + "if you want to take King", + "Bowser by the tail.", + "Methinks my troops could", + "learn a lesson from you!", + "Here is your Star, as I", + "promised, Mario.", + "", + "If you want to see me", + "again, select this Star", + "from the menu. For now,", + "farewell." + ] + }, + { + "ID": 117, + "linesPerBox": 1, + "leftOffset": 95, + "width": 200, + "lines": [ + "Who...walk...here?", + "Who...break...seal?", + "Wake..ancient..ones?", + "We no like light...", + "Rrrrummbbble...", + "We no like...intruders!", + "Now battle...", + "...hand...", + "...to...", + "...hand!" + ] + }, + { + "ID": 118, + "linesPerBox": 6, + "leftOffset": 95, + "width": 200, + "lines": [ + "Grrrrumbbble!", + "What...happen?", + "We...crushed like pebble.", + "You so strong!", + "You rule ancient pyramid!", + "For today...", + "Now, take Star of Power.", + "We...sleep...darkness." + ] + }, + { + "ID": 119, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Grrr! I was a bit", + "careless. This is not as I", + "had planned...but I still", + "hold the power of the", + "Stars, and I still have", + "Peach.", + "Bwa ha ha! You'll get no", + "more Stars from me! I'm", + "not finished with you yet,", + "but I'll let you go for", + "now. You'll pay for this...", + "later!" + ] + }, + { + "ID": 120, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Ooowaah! Can it be that", + "I've lost??? The power of", + "the Stars has failed me...", + "this time.", + "Consider this a draw.", + "Next time, I'll be in", + "perfect condition.", + "", + "Now, if you want to see", + "your precious Princess,", + "come to the top of the", + "tower.", + "I'll be waiting!", + "Gwa ha ha ha!" + ] + }, + { + "ID": 121, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Nooo! It can't be!", + "You've really beaten me,", + "Mario?!! I gave those", + "troops power, but now", + "it's fading away!", + "Arrgghh! I can see peace", + "returning to the world! I", + "can't stand it! Hmmm...", + "It's not over yet...", + "", + "C'mon troops! Let's watch", + "the ending together!", + "Bwa ha ha!" + ] + }, + { + "ID": 122, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "The Black Hole", + "Right: Work Elevator", + "/// Cloudy Maze", + "Left: Underground Lake" + ] + }, + { + "ID": 123, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Metal Cavern", + "Right: To Waterfall", + "Left: Metal Cap Switch" + ] + }, + { + "ID": 124, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Work Elevator", + "Danger!!", + "Read instructions", + "thoroughly!", + "Elevator continues in the", + "direction of the arrow", + "activated." + ] + }, + { + "ID": 125, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hazy Maze-Exit", + "Danger! Closed.", + "Turn back now." + ] + }, + { + "ID": 126, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Up: Black Hole", + "Right: Work Elevator", + "/// Hazy Maze" + ] + }, + { + "ID": 127, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Underground Lake", + "Right: Metal Cave", + "Left: Abandoned Mine", + "///(Closed)", + "A gentle sea dragon lives", + "here. Pound on his back to", + "make him lower his head.", + "Don't become his lunch." + ] + }, + { + "ID": 128, + "linesPerBox": 4, + "leftOffset": 95, + "width": 200, + "lines": [ + "You must fight with", + "honor! It is against the", + "royal rules to throw the", + "king out of the ring!" + ] + }, + { + "ID": 129, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Welcome to the Vanish", + "Cap Switch Course! All of", + "the blue blocks you find", + "will become solid once you", + "step on the Cap Switch.", + "You'll disappear when you", + "put on the Vanish Cap, so", + "you'll be able to elude", + "enemies and walk through", + "many things. Try it out!" + ] + }, + { + "ID": 130, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Welcome to the Metal Cap", + "Switch Course! Once you", + "step on the Cap Switch,", + "the green blocks will", + "become solid.", + "When you turn your body", + "into metal with the Metal", + "Cap, you can walk", + "underwater! Try it!" + ] + }, + { + "ID": 131, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Welcome to the Wing Cap", + "Course! Step on the red", + "switch at the top of the", + "tower, in the center of", + "the rainbow ring.", + "When you trigger the", + "switch, all of the red", + "blocks you find will", + "become solid.", + "", + "Try out the Wing Cap! Do", + "the Triple Jump to take", + "off and press [Z] to land.", + "", + "", + "Pull back on the Control", + "Stick to go up and push", + "forward to nose down,", + "just as you would when", + "flying an airplane." + ] + }, + { + "ID": 132, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Whoa, Mario, pal, you", + "aren't trying to cheat,", + "are you? Shortcuts aren't", + "allowed.", + "Now, I know that you", + "know better. You're", + "disqualified! Next time,", + "play fair!" + ] + }, + { + "ID": 133, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Am I glad to see you! The", + "Princess...and I...and,", + "well, everybody...we're all", + "trapped inside the castle", + "walls.", + "", + "Bowser has stolen the", + "castle's Stars, and he's", + "using their power to", + "create his own world in", + "the paintings and walls.", + "", + "Please recover the Power", + "Stars! As you find them,", + "you can use their power", + "to open the doors that", + "Bowser has sealed.", + "", + "There are four rooms on", + "the first floor. Start in", + "the one with the painting", + "of Bob-omb inside. It's", + "the only room that Bowser", + "hasn't sealed.", + "When you collect eight", + "Power Stars, you'll be", + "able to open the door", + "with the big star. The", + "Princess must be inside!" + ] + }, + { + "ID": 134, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "The names of the Stars", + "are also hints for", + "finding them. They are", + "displayed at the beginning", + "of each course.", + "You can collect the Stars", + "in any order. You won't", + "find some Stars, enemies", + "or items unless you select", + "a specific Star.", + "After you collect some", + "Stars, you can try", + "another course.", + "We're all waiting for", + "your help!" + ] + }, + { + "ID": 135, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "It was Bowser who stole", + "the Stars. I saw him with", + "my own eyes!", + "", + "", + "He's hidden six Stars in", + "each course, but you", + "won't find all of them in", + "some courses until you", + "press the Cap Switches.", + "The Stars you've found", + "will show on each course's", + "starting screen.", + "", + "", + "If you want to see some", + "of the enemies you've", + "already defeated, select", + "the Stars you recovered", + "from them." + ] + }, + { + "ID": 136, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Wow! You've already", + "recovered that many", + "Stars? Way to go, Mario!", + "I'll bet you'll have us out", + "of here in no time!", + "", + "Be careful, though.", + "Bowser and his band", + "wrote the book on 『bad.』", + "Take my advice: When you", + "need to recover from", + "injuries, collect coins.", + "Yellow Coins refill one", + "piece of the Power Meter,", + "Red Coins refill two", + "pieces, and Blue Coins", + "refill five.", + "", + "To make Blue Coins", + "appear, pound on Blue", + "Coin Blocks.", + "", + "", + "", + "Also, if you fall from", + "high places, you'll", + "minimize damage if you", + "Pound the Ground as you", + "land." + ] + }, + { + "ID": 137, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Thanks, Mario! The castle", + "is recovering its energy", + "as you retrieve Power", + "Stars, and you've chased", + "Bowser right out of here,", + "on to some area ahead.", + "Oh, by the by, are you", + "collecting coins? Special", + "Stars appear when you", + "collect 100 coins in each", + "of the 15 courses!" + ] + }, + { + "ID": 138, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Down: Underground Lake", + "Left: Black Hole", + "Right: Hazy Maze (Closed)" + ] + }, + { + "ID": 139, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Above: Automatic Elevator", + "Elevator begins", + "automatically and follows", + "pre-set course.", + "It disappears", + "automatically, too." + ] + }, + { + "ID": 140, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Elevator Area", + "Right: Hazy Maze", + "/// Entrance", + "Left: Black Hole", + "///Elevator 1", + "Arrow: You are here" + ] + }, + { + "ID": 141, + "linesPerBox": 5, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered one of", + "the stolen Power Stars!", + "Now you can open some of", + "the sealed doors in the", + "castle.", + "Try the Princess's room", + "on the second floor and", + "the room with the", + "painting of Whomp's", + "Fortress on Floor 1.", + "Bowser's troops are still", + "gaining power, so you", + "can't give up. Save us,", + "Mario! Keep searching for", + "Stars!" + ] + }, + { + "ID": 142, + "linesPerBox": 5, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered three", + "Power Stars! Now you can", + "open any door with a 3", + "on its star.", + "", + "You can come and go from", + "the open courses as you", + "please. The enemies ahead", + "are even meaner, so be", + "careful!" + ] + }, + { + "ID": 143, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered eight of", + "the Power Stars! Now you", + "can open the door with", + "the big Star! But Bowser", + "is just ahead...can you", + "hear the Princess calling?" + ] + }, + { + "ID": 144, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered 30", + "Power Stars! Now you can", + "open the door with the", + "big Star! But before you", + "move on, how's it going", + "otherwise?", + "Did you pound the two", + "columns down? You didn't", + "lose your hat, did you?", + "If you did, you'll have to", + "stomp on the condor to", + "get it back!", + "They say that Bowser has", + "sneaked out of the sea", + "and into the underground.", + "Have you finally", + "cornered him?" + ] + }, + { + "ID": 145, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've recovered 50", + "Power Stars! Now you can", + "open the Star Door on the", + "third floor. Bowser's", + "there, you know.", + "", + "Oh! You've found all of", + "the Cap Switches, haven't", + "you? Red, green and blue?", + "The Caps you get from the", + "colored blocks are really", + "helpful.", + "Hurry along, now. The", + "third floor is just ahead." + ] + }, + { + "ID": 146, + "linesPerBox": 6, + "leftOffset": 150, + "width": 200, + "lines": [ + "You've found 70 Power", + "Stars! The mystery of the", + "endless stairs is solved,", + "thanks to you--and is", + "Bowser ever upset! Now,", + "on to the final bout!" + ] + }, + { + "ID": 147, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Are you using the Cap", + "Blocks? You really should,", + "you know.", + "", + "", + "To make them solid so you", + "can break them, you have", + "to press the colored Cap", + "Switches in the castle's", + "hidden courses.", + "You'll find the hidden", + "courses only after", + "regaining some of the", + "Power Stars.", + "", + "The Cap Blocks are a big", + "help! Red for the Wing", + "Cap, green for the Metal", + "Cap, blue for the Vanish", + "Cap." + ] + }, + { + "ID": 148, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Snowman Mountain ahead.", + "Keep out! And don't try", + "the Triple Jump over the", + "ice block shooter.", + "", + "", + "If you fall into the", + "freezing pond, your power", + "decreases quickly, and", + "you won't recover", + "automatically.", + "//--The Snowman" + ] + }, + { + "ID": 149, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Welcome to", + "Princess Toadstool's", + "secret slide!", + "There's a Star hidden", + "here that Bowser couldn't", + "find.", + "When you slide, press", + "forward to speed up,", + "pull back to slow down.", + "If you slide really", + "fast, you'll win the Star!" + ] + }, + { + "ID": 150, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Waaaa! You've flooded my", + "house! Wh-why?? Look at", + "this mess! What am I", + "going to do now?", + "", + "The ceiling's ruined, the", + "floor is soaked...what to", + "do, what to do? Huff...", + "huff...it makes me so...", + "MAD!!!", + "Everything's been going", + "wrong ever since I got", + "this Star...It's so shiny,", + "but it makes me feel...", + "strange..." + ] + }, + { + "ID": 151, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "I can't take this", + "anymore! First you get", + "me all wet, then you", + "stomp on me!", + "Now I'm really, really,", + "REALLY mad!", + "Waaaaaaaaaaaaaaaaa!!!" + ] + }, + { + "ID": 152, + "linesPerBox": 3, + "leftOffset": 30, + "width": 200, + "lines": [ + "Owwch! Uncle! Uncle!", + "Okay, I give. Take this", + "Star!", + "Whew! I feel better now.", + "I don't really need it", + "anymore, anyway--", + "I can see the stars", + "through my ceiling at", + "night.", + "They make me feel...", + "...peaceful. Please, come", + "back and visit anytime." + ] + }, + { + "ID": 153, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hey! Who's there?", + "What's climbing on me?", + "Is it an ice ant?", + "A snow flea?", + "Whatever it is, it's", + "bugging me! I think I'll", + "blow it away!" + ] + }, + { + "ID": 154, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hold on to your hat! If", + "you lose it, you'll be", + "easily injured. If you", + "lose it, look for it in the", + "course where you lost it.", + "Speaking of lost, the", + "Princess is still stuck in", + "the walls somewhere.", + "Please help, Mario!", + "", + "Oh, you know that there", + "are secret worlds in the", + "walls as well as in the", + "paintings, right?" + ] + }, + { + "ID": 155, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "Thanks to the power of", + "the Stars, life is", + "returning to the castle.", + "Please, Mario, you have", + "to give Bowser the boot!", + "", + "Here, let me tell you a", + "little something about the", + "castle. In the room with", + "the mirrors, look carefully", + "for anything that's not", + "reflected in the mirror.", + "And when you go to the", + "water town, you can flood", + "it with a high jump into", + "the painting." + ] + }, + { + "ID": 156, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "The world inside the", + "clock is so strange!", + "When you jump inside,", + "watch the position of", + "the big hand!" + ] + }, + { + "ID": 157, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Watch out! Don't let", + "yourself be swallowed by", + "quicksand.", + "", + "", + "If you sink into the sand,", + "you won't be able to", + "jump, and if your head", + "goes under, you'll be", + "smothered.", + "The dark areas are", + "bottomless pits." + ] + }, + { + "ID": 158, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "1. If you jump repeatedly", + "and time it right, you'll", + "jump higher and higher.", + "If you run really fast and", + "time three jumps right,", + "you can do a Triple Jump.", + "2. Jump into a solid wall,", + "then jump again when you", + "hit the wall. You can", + "bounce to a higher level", + "using this Wall Kick." + ] + }, + { + "ID": 159, + "linesPerBox": 6, + "leftOffset": 30, + "width": 200, + "lines": [ + "3. If you stop, press [Z]", + "to crouch, then jump, you", + "can perform a Backward", + "Somersault. To do a Long", + "Jump, run fast, press [Z],", + "then jump." + ] + }, + { + "ID": 160, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Press [B] while running", + "fast to do a Body Slide", + "attack. To stand while", + "sliding, press [A] or [B]." + ] + }, + { + "ID": 161, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario!!!", + "It that really you???", + "It has been so long since", + "our last adventure!", + "They told me that I might", + "see you if I waited here,", + "but I'd just about given", + "up hope!", + "Is it true? Have you", + "really beaten Bowser? And", + "restored the Stars to the", + "castle?", + "And saved the Princess?", + "I knew you could do it!", + "Now I have a very special", + "message for you.", + "『Thanks for playing Super", + "Mario 64! This is the", + "end of the game, but not", + "the end of the fun.』", + "", + "The Super Mario 64 Team" + ] + }, + { + "ID": 162, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "No, no, no! Not you", + "again! I'm in a great", + "hurry, can't you see?", + "", + "I've no time to squabble", + "over Stars. Here, have it.", + "I never meant to hide it", + "from you...", + "It's just that I'm in such", + "a rush. That's it, that's", + "all. Now, I must be off.", + "Owww! Let me go!" + ] + }, + { + "ID": 163, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Noooo! You've really", + "beaten me this time,", + "Mario! I can't stand", + "losing to you!", + "", + "My troops...worthless!", + "They've turned over all", + "the Power Stars! What?!", + "There are 120 in all???", + "", + "Amazing! There were some", + "in the castle that I", + "missed??!!", + "", + "", + "Now I see peace", + "returning to the world...", + "Oooo! I really hate that!", + "I can't watch--", + "I'm outta here!", + "Just you wait until next", + "time. Until then, keep", + "that Control Stick", + "smokin'!", + "Buwaa ha ha!" + ] + }, + { + "ID": 164, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Mario! What's up, pal?", + "I haven't been on the", + "slide lately, so I'm out", + "of shape.", + "Still, I'm always up for a", + "good race, especially", + "against an old sleddin'", + "buddy.", + "Whaddya say?", + "Ready...set...", + "", + "//Go// Don't Go" + ] + }, + { + "ID": 165, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "I take no responsibility", + "whatsoever for those who", + "get dizzy and pass out", + "from running around", + "this post." + ] + }, + { + "ID": 166, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "I'll be back soon.", + "I'm out training now,", + "so come back later.", + "//--Koopa the Quick" + ] + }, + { + "ID": 167, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Princess Toadstool's", + "castle is just ahead.", + "", + "", + "Press [A] to jump, [Z] to", + "crouch, and [B] to punch,", + "read a sign, or grab", + "something.", + "Press [B] again to throw", + "something you're holding." + ] + }, + { + "ID": 168, + "linesPerBox": 5, + "leftOffset": 30, + "width": 200, + "lines": [ + "Hey! Knock it off! That's", + "the second time you've", + "nailed me. Now you're", + "asking for it, linguine", + "breath!" + ] + }, + { + "ID": 169, + "linesPerBox": 4, + "leftOffset": 30, + "width": 200, + "lines": [ + "Keep out!", + "That means you!", + "Arrgghh!", + "", + "Anyone entering this cave", + "without permission will", + "meet certain disaster." + ] + } + ], + "courses": { + + } +} \ No newline at end of file diff --git a/tools/text2ascii.py b/tools/text2ascii.py new file mode 100644 index 00000000..39a10878 --- /dev/null +++ b/tools/text2ascii.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +import sys +import os +import os.path +import glob +import re +from pathlib import Path + +path = "/home/alex/Documents/Projects/Render96/Render96ex - FastBuild/charmap.txt" +lines = open(os.path.abspath(path), 'r').readlines() + +lineID = {} + +for lineIndex, uline in enumerate(lines, 0): + line = uline.strip() + if(line.startswith("'")): + unf = line.split(" = ") + char = unf[0].replace("'", "") + value = unf[1] if len(unf[1].split(", ")) < 2 else unf[1].split(", ")[1] + lineID[lineIndex] = "{"+f"\"{char}\", {value}"+"}, " + +print(f"Array size: {len(lineID)}") + +lines = 0 +counter = 0 + +for b in lineID: + a = lineID[b] + print(a, end = '' if counter < 8 else '\n') + counter += 1 + lines += 1 + if counter > 8: + counter = 0 +print('\n') +print(f' LINES {lines}\n') \ No newline at end of file