Path: blob/master/SonicMania/Objects/Global/Localization.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: Localization Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectLocalization *Localization;1011void Localization_Update(void) {}1213void Localization_LateUpdate(void) {}1415void Localization_StaticUpdate(void) {}1617void Localization_Draw(void) {}1819void Localization_Create(void *data) {}2021void Localization_StageLoad(void)22{23OptionsRAM *options = Options_GetOptionsRAM();24if (globals->optionsLoaded >= STATUS_OK && options->overrideLanguage) {25Localization->language = options->language;26Localization_LoadStrings();27}28else {29Localization->language = sku_language;30Localization_LoadStrings();31}32}3334void Localization_LoadStrings(void)35{36RSDK.InitString(&Localization->text, "", 0);3738switch (Localization->language) {39case LANGUAGE_EN:40LogHelpers_Print("Loading EN strings...");41RSDK.LoadStringList(&Localization->text, "StringsEN.txt", 16);42break;4344case LANGUAGE_FR:45LogHelpers_Print("Loading FR strings...");46RSDK.LoadStringList(&Localization->text, "StringsFR.txt", 16);47break;4849case LANGUAGE_IT:50LogHelpers_Print("Loading IT strings...");51RSDK.LoadStringList(&Localization->text, "StringsIT.txt", 16);52break;5354case LANGUAGE_GE:55LogHelpers_Print("Loading GE strings...");56RSDK.LoadStringList(&Localization->text, "StringsGE.txt", 16);57break;5859case LANGUAGE_SP:60LogHelpers_Print("Loading SP strings...");61RSDK.LoadStringList(&Localization->text, "StringsSP.txt", 16);62break;6364case LANGUAGE_JP:65LogHelpers_Print("Loading JP strings...");66RSDK.LoadStringList(&Localization->text, "StringsJP.txt", 16);67break;6869#if GAME_VERSION != VER_10070case LANGUAGE_KO:71LogHelpers_Print("Loading KO strings...");72RSDK.LoadStringList(&Localization->text, "StringsKO.txt", 16);73break;7475case LANGUAGE_SC:76LogHelpers_Print("Loading Simp Chinese strings...");77RSDK.LoadStringList(&Localization->text, "StringsSC.txt", 16);78break;7980case LANGUAGE_TC:81LogHelpers_Print("Loading Trad Chinese strings...");82RSDK.LoadStringList(&Localization->text, "StringsTC.txt", 16);83break;84#endif8586default: break;87}8889RSDK.SplitStringList(Localization->strings, &Localization->text, 0, STR_STRING_COUNT);90Localization->loaded = true;9192#if MANIA_USE_EGS93if (API.CheckAchievementsEnabled()) {94String *names[STR_STRING_COUNT - STR_ACHIEVEMENT];95for (int32 i = 0; i < (STR_STRING_COUNT - STR_ACHIEVEMENT); ++i) {96names[i] = &Localization->strings[i + STR_ACHIEVEMENT];97}9899API.SetAchievementNames(names, STR_STRING_COUNT - STR_ACHIEVEMENT);100}101#endif102}103104void Localization_GetString(String *string, uint8 id)105{106memset(string, 0, sizeof(String));107RSDK.InitString(string, "", 0);108RSDK.CopyString(string, &Localization->strings[id]);109for (int32 c = 0; c < string->length; ++c) {110if (string->chars[c] == '\\')111string->chars[c] = '\n';112}113}114115void Localization_GetZoneName(String *string, uint8 zone)116{117switch (zone) {118case ZONE_GHZ: RSDK.InitString(string, "GREEN HILL", 0); break;119case ZONE_CPZ: RSDK.InitString(string, "CHEMICAL PLANT", 0); break;120case ZONE_SPZ: RSDK.InitString(string, "STUDIOPOLIS", 0); break;121case ZONE_FBZ: RSDK.InitString(string, "FLYING BATTERY", 0); break;122case ZONE_PGZ: RSDK.InitString(string, "PRESS GARDEN", 0); break;123case ZONE_SSZ: RSDK.InitString(string, "STARDUST SPEEDWAY", 0); break;124case ZONE_HCZ: RSDK.InitString(string, "HYDROCITY", 0); break;125case ZONE_MSZ: RSDK.InitString(string, "MIRAGE SALOON", 0); break;126case ZONE_OOZ: RSDK.InitString(string, "OIL OCEAN", 0); break;127case ZONE_LRZ: RSDK.InitString(string, "LAVA REEF", 0); break;128case ZONE_MMZ: RSDK.InitString(string, "METALLIC MADNESS", 0); break;129case ZONE_TMZ: RSDK.InitString(string, "TITANIC MONARCH", 0); break;130case ZONE_ERZ: RSDK.InitString(string, "???", 0); break;131default: break;132}133}134void Localization_GetZoneInitials(String *string, uint8 zone)135{136switch (zone) {137case ZONE_GHZ: RSDK.InitString(string, "GHZ", 0); break;138case ZONE_CPZ: RSDK.InitString(string, "CPZ", 0); break;139case ZONE_SPZ: RSDK.InitString(string, "SPZ", 0); break;140case ZONE_FBZ: RSDK.InitString(string, "FBZ", 0); break;141case ZONE_PGZ: RSDK.InitString(string, "PGZ", 0); break;142case ZONE_SSZ: RSDK.InitString(string, "SSZ", 0); break;143case ZONE_HCZ: RSDK.InitString(string, "HCZ", 0); break;144case ZONE_MSZ: RSDK.InitString(string, "MSZ", 0); break;145case ZONE_OOZ: RSDK.InitString(string, "OOZ", 0); break;146case ZONE_LRZ: RSDK.InitString(string, "LRZ", 0); break;147case ZONE_MMZ: RSDK.InitString(string, "MMZ", 0); break;148case ZONE_TMZ: RSDK.InitString(string, "TMZ", 0); break;149case ZONE_ERZ: RSDK.InitString(string, "???", 0); break;150default: break;151}152}153154#if GAME_INCLUDE_EDITOR155void Localization_EditorDraw(void) {}156157void Localization_EditorLoad(void) {}158#endif159160void Localization_Serialize(void) {}161162163