From d829b93fab6bd86601646a2251f35ff24374ec10 Mon Sep 17 00:00:00 2001 From: avolkov Date: Tue, 24 Jan 2006 23:55:00 +0000 Subject: [PATCH] Removed many hardcoded strings (bug #778, from zap) git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2233 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/content/lbm/starcon.txt | 409 +++++++++++++++++++++++++++++++++ sc2/src/sc2code/comm.c | 13 +- sc2/src/sc2code/confirm.c | 7 +- sc2/src/sc2code/encount.c | 3 +- sc2/src/sc2code/gameopt.c | 12 +- sc2/src/sc2code/gamestr.h | 19 +- sc2/src/sc2code/menu.c | 86 ++----- sc2/src/sc2code/planets/scan.c | 64 ++++-- sc2/src/sc2code/sis.c | 58 ++--- sc2/src/sc2code/sis.h | 8 +- 10 files changed, 534 insertions(+), 145 deletions(-) diff --git a/sc2/content/lbm/starcon.txt b/sc2/content/lbm/starcon.txt index 02d15751e..9578eee57 100755 --- a/sc2/content/lbm/starcon.txt +++ b/sc2/content/lbm/starcon.txt @@ -921,6 +921,7 @@ Cerium #(Praseo- dymium) Praseo- dymium + #(Neodymium) Neodymium @@ -1677,6 +1678,10 @@ DEC (In response to your statement) +#(MORE) +MORE + + #(Starbase) Starbase @@ -1817,6 +1822,14 @@ Loading . . . Unable to save game! +#(Empty Slot) +Empty Slot + + +#(Saved Game - Date:) +Saved Game - Date: + + #(Sound) Sound @@ -1837,3 +1850,399 @@ OFF ON +#(Really Quit) +Really Quit? + + +#(Yes) +Yes + + +#(No) +No + + +#(Don't Quit) +Don't Quit + + +#(Quit Game) +Quit Game + + +#(Cr) +Cr + + +#(RU) +RU + + +#(UNLIMITED) +UNLIMITED + + +#(FUEL) +FUEL + + +#(CREW) +CREW + + +#(CAPTAIN) +CAPTAIN + + +#(nose:) +nose: + + +#(spread:) +spread: + + +#(side:) +side: + + +#(tail:) +tail: + + +#(maximum velocity:) +maximum velocity: + + +#(turning rate:) +turning rate: + + +#(combat energy:) +combat energy: + + +#(maximum fuel:) +maximum fuel: + + +#(gun) +gun + + +#(blaster) +blaster + + +#(cannon) +cannon + + +#(n/a) +n/a + + +#(none) +none + + +#(Orbit: ) +Orbit: + + +#( a.u.) + a.u. + + +#(Atmo: ) +Atmo: + + +#(Super Thick) +Super Thick + + +#(Vacuum) +Vacuum + + +#( atm) + atm + + +#(Temp: ) +Temp: + + +#(Weather: ) +Weather: + + +#(None) +None + + +#(Class) +Class + + +#(Tectonics: ) +Tectonics: + + +#(Mass: ) +Mass: + + +#( e.s.) + e.s. + + +#(Radius: ) +Radius: + + +#(Gravity: ) +Gravity: + + +#( g.) + g. + + +#(Day: ) +Day: + + +#( days) + days + + +#(Tilt: ) +Tilt: + + +#(scan) +scan + + +#(starmap) +starmap + + +#(devices) +devices + + +#(cargo) +cargo + + +#(roster) +roster + + +#(game) +game + + +#(navigate) +navigate + + +#(mineral) +mineral + + +#(energy) +energy + + +#(biological) +biological + + +#(exit menu) +exit menu + + +#(autoscan) +autoscan + + +#(dispatch) +dispatch + + +#(save game) +save game + + +#(load game) +load game + + +#(quit game) +quit game + + +#(settings) +settings + + +#(exit menu) +exit menu + + +#(converse) +converse + + +#(attack!) +attack! + + +#(game) +game + + +#(fuel) +fuel + + +#(module) +module + + +#(game) +game + + +#(exit menu) +exit menu + + +#(crew) +crew + + +#(game) +game + + +#(exit menu) +exit menu + + +#(sound) +sound + + +#(music) +music + + +#(cyborg) +cyborg + + +#(captain) +captain + + +#(flagship) +flagship + + +#(exit menu) +exit menu + + +#() + + + +#() + + + +#() + + + +#() + + + +#() + + + +#(no, play!) +no, play! + + +#(yes, quit!) +yes, quit! + + +#(scan) +scan + + +#(starmap) +starmap + + +#(manifest) +manifest + + +#(game) +game + + +#(navigate) +navigate + + +#(cargo) +cargo + + +#(devices) +devices + + +#(roster) +roster + + +#(exit menu) +exit menu + + +#(mineral) +mineral + + +#(energy) +energy + + +#(biological) +biological + + +#(autoscan) +autoscan + + +#(dispatch) +dispatch + + +#(exit menu) +exit menu + + diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index 6ae98c868..f1439ce1a 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -1597,7 +1597,11 @@ DoCommunication (PENCOUNTER_STATE pES) { t.baseline.x = SIS_SCREEN_WIDTH >> 1; t.align = ALIGN_CENTER; - t.pStr = STR_MIDDLE_DOT "MORE" STR_MIDDLE_DOT; + snprintf (buffer, sizeof (buffer), "%s%s%s", // "MORE" + STR_MIDDLE_DOT, + GAME_STRING (FEEDBACK_STRING_BASE + 1), + STR_MIDDLE_DOT); + t.pStr = buffer; SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x17, 0x00), 0x01)); LockMutex (GraphicsLock); font_DrawText (&t); @@ -1628,10 +1632,13 @@ DoCommunication (PENCOUNTER_STATE pES) col++; if (col > MAX_COLS && curr->next != NULL) { - t.baseline.x = SIS_SCREEN_WIDTH >> 1; t.align = ALIGN_CENTER; - t.pStr = STR_MIDDLE_DOT "MORE" STR_MIDDLE_DOT; + snprintf (buffer, sizeof (buffer), "%s%s%s", // "MORE" + STR_MIDDLE_DOT, + GAME_STRING (FEEDBACK_STRING_BASE + 1), + STR_MIDDLE_DOT); + t.pStr = buffer; SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x17, 0x00), 0x01)); LockMutex (GraphicsLock); font_DrawText (&t); diff --git a/sc2/src/sc2code/confirm.c b/sc2/src/sc2code/confirm.c index 553933161..254206b45 100644 --- a/sc2/src/sc2code/confirm.c +++ b/sc2/src/sc2code/confirm.c @@ -23,6 +23,7 @@ #include "settings.h" #include "setup.h" #include "sounds.h" +#include "gamestr.h" #include "libs/graphics/widgets.h" #include "libs/inplib.h" #include "libs/sound/trackplayer.h" @@ -55,18 +56,18 @@ DrawConfirmationWindow (BOOLEAN answer) t.baseline.x = r.corner.x + (r.extent.width >> 1); t.baseline.y = r.corner.y + 8; - t.pStr = "Really Quit?"; + t.pStr = GAME_STRING (QUITMENU_STRING_BASE); // "Really Quit?" t.align = ALIGN_CENTER; t.valign = VALIGN_BOTTOM; t.CharCount = (COUNT)~0; font_DrawText (&t); t.baseline.y += 10; t.baseline.x = r.corner.x + (r.extent.width >> 2); - t.pStr = "Yes"; + t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 1); // "Yes" SetContextForeGroundColor (answer ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR); font_DrawText (&t); t.baseline.x += (r.extent.width >> 1); - t.pStr = "No"; + t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); font_DrawText (&t); diff --git a/sc2/src/sc2code/encount.c b/sc2/src/sc2code/encount.c index 0f99dd109..291e11bd0 100644 --- a/sc2/src/sc2code/encount.c +++ b/sc2/src/sc2code/encount.c @@ -681,7 +681,8 @@ UninitEncounter (void) r.corner.x = scavenge_r.corner.x + 10; r.extent.width = 132; DrawFilledRectangle (&r); - sprintf (buf, "%u %s", RecycleAmount, "RU"); + sprintf (buf, "%u %s", RecycleAmount, + GAME_STRING (STATUS_STRING_BASE + 1)); // "RU" t.baseline.x = r.corner.x + (r.extent.width >> 1); t.baseline.y = r.corner.y + 14; t.align = ALIGN_CENTER; diff --git a/sc2/src/sc2code/gameopt.c b/sc2/src/sc2code/gameopt.c index 11057d0c2..cea8e6f3b 100644 --- a/sc2/src/sc2code/gameopt.c +++ b/sc2/src/sc2code/gameopt.c @@ -192,15 +192,15 @@ FeedbackSetting (BYTE which_setting) static void FeedbackQuit (BYTE which_setting) { - UNICODE buf[80]; - buf[0] = '\0'; + const UNICODE *buf = ""; + switch (which_setting) { case NO_QUIT_MENU: - utf8StringCopy (buf, sizeof (buf), "Don't Quit"); + buf = GAME_STRING (QUITMENU_STRING_BASE + 3); // "Don't Quit" break; case YES_QUIT_MENU: - utf8StringCopy (buf, sizeof (buf), "Quit Game"); + buf = GAME_STRING (QUITMENU_STRING_BASE + 4); // "Quit Game" break; } @@ -1147,14 +1147,14 @@ ChangeGameSelection: t.baseline.x = r.corner.x + 3; if (((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index == 0) - utf8StringCopy (buf, sizeof (buf), "Empty Slot"); + sprintf (buf, GAME_STRING (SAVEGAME_STRING_BASE + 3)); // "Empty Slot" else { DateToString (buf2, sizeof buf2, ((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].month_index, ((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].day_index, ((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index); - sprintf (buf, "%s %s", "Saved Game - Date:", buf2); + sprintf (buf, "%s %s", GAME_STRING (SAVEGAME_STRING_BASE + 4), buf2); // "Saved Game - Date:" } font_DrawText (&t); } diff --git a/sc2/src/sc2code/gamestr.h b/sc2/src/sc2code/gamestr.h index d2fb4806f..fa0676ccd 100644 --- a/sc2/src/sc2code/gamestr.h +++ b/sc2/src/sc2code/gamestr.h @@ -34,13 +34,18 @@ #define PLANET_NUMBER_BASE 375 #define MONTHS_STRING_BASE 407 #define FEEDBACK_STRING_BASE 419 -#define STARBASE_STRING_BASE 420 -#define ENCOUNTER_STRING_BASE 425 -#define NAVIGATION_STRING_BASE 433 -#define NAMING_STRING_BASE 439 -#define MELEE_STRING_BASE 443 -#define SAVEGAME_STRING_BASE 452 -#define OPTION_STRING_BASE 455 +#define STARBASE_STRING_BASE 421 +#define ENCOUNTER_STRING_BASE 426 +#define NAVIGATION_STRING_BASE 434 +#define NAMING_STRING_BASE 440 +#define MELEE_STRING_BASE 444 +#define SAVEGAME_STRING_BASE 453 +#define OPTION_STRING_BASE 458 +#define QUITMENU_STRING_BASE 463 +#define STATUS_STRING_BASE 468 +#define FLAGSHIP_STRING_BASE 474 +#define ORBITSCAN_STRING_BASE 487 +#define MAINMENU_STRING_BASE 506 #define GAME_STRING(i) ((UNICODE *)GetStringAddress (SetAbsStringTableIndex (GameStrings, (i)))) diff --git a/sc2/src/sc2code/menu.c b/sc2/src/sc2code/menu.c index b1ca4db25..6be1c0f1f 100644 --- a/sc2/src/sc2code/menu.c +++ b/sc2/src/sc2code/menu.c @@ -20,6 +20,7 @@ #include "controls.h" #include "options.h" #include "setup.h" +#include "gamestr.h" #include "libs/graphics/gfx_common.h" #include "libs/tasklib.h" @@ -57,76 +58,8 @@ DrawPCMenuFrame (RECT *r) #define ALT_MANIFEST 0x80 #define ALT_EXIT_MENU0 0x81 -/* Define all menu text. There is 1 item for each PM_* enum*/ -static char menu_string[][11] = { - "scan", - "starmap", - "devices", - "cargo", - "roster", - "game", - "navigate", - - "mineral", - "energy", - "biological", - "exit menu", - "autoscan", - "dispatch", - - "save game", - "load game", - "quit game", - "settings", - "exit menu", - - "converse", - "attack!", - "game", - - "fuel", - "module", - "game", - "exit menu", - - "crew", - "game", - "exit menu", - - "sound", - "music", - "cyborg", - "captain", - "flagship", - "exit menu", - "", - "", - "", - "", - "", -//PM_QUIT - "no, play!", - "yes, quit!", -//PM_ALTSCAN - "scan", - "starmap", - "manifest", - "game", - "navigate", -//PM_ALTERNATE_2 - "cargo", - "devices", - "roster", - "exit menu", -//PM_ALTERNATE3 replaces PM_MIN_SCAN - "mineral", - "energy", - "biological", - "autoscan", - "dispatch", - "exit menu" - - }; +static UNICODE pm_crew_str[128]; +static UNICODE pm_fuel_str[128]; /* Actually display the menu text */ static void @@ -162,7 +95,10 @@ DrawPCMenu (BYTE beg_index, BYTE end_index, BYTE NewState, BYTE hilite, RECT *r) SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x15, 0x15), 0x08)); for (i = beg_index; i <= end_index; i++) { - utf8StringCopy (buf, sizeof (buf), menu_string[i]); + utf8StringCopy (buf, sizeof (buf), + (i == PM_FUEL) ? pm_fuel_str : + (i == PM_CREW) ? pm_crew_str : + GAME_STRING (MAINMENU_STRING_BASE + i)); if (hilite && pos == i) { SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x1F), 0x08)); @@ -540,9 +476,13 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState) if (s.frame && optWhichMenu == OPT_PC) { if (beg_index == PM_CREW) - sprintf (menu_string[PM_CREW], "%s(%d)", "crew", GLOBAL (CrewCost)); + sprintf (pm_crew_str, "%s(%d)", + GAME_STRING (MAINMENU_STRING_BASE + PM_CREW), + GLOBAL (CrewCost)); if (beg_index == PM_FUEL) - sprintf (menu_string[PM_FUEL], "%s(%d)", "fuel", GLOBAL (FuelCost)); + sprintf (pm_fuel_str, "%s(%d)", + GAME_STRING (MAINMENU_STRING_BASE + PM_FUEL), + GLOBAL (FuelCost)); if (beg_index == PM_SOUND_ON) { end_index = beg_index + 5; diff --git a/sc2/src/sc2code/planets/scan.c b/sc2/src/sc2code/planets/scan.c index aa741a51d..d38317581 100644 --- a/sc2/src/sc2code/planets/scan.c +++ b/sc2/src/sc2code/planets/scan.c @@ -215,10 +215,12 @@ PrintCoarseScanPC (void) t.align = ALIGN_LEFT; LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Orbit: ", LEFT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE), + LEFT_SIDE_BASELINE_X_PC); // "Orbit: " val = ((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L + (EARTH_RADIUS >> 1)) / EARTH_RADIUS); - MakeScanValue (buf, val, " a.u."); + MakeScanValue (buf, val, + GAME_STRING (ORBITSCAN_STRING_BASE + 1)); // " a.u." t.pStr = buf; t.CharCount = (COUNT)~0; font_DrawText (&t); @@ -226,16 +228,20 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Atmo: ", LEFT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 2), + LEFT_SIDE_BASELINE_X_PC); // "Atmo: " if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE) - utf8StringCopy (buf, sizeof (buf), "Super Thick"); + utf8StringCopy (buf, sizeof (buf), + GAME_STRING (ORBITSCAN_STRING_BASE + 3)); // "Super Thick" else if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0) - utf8StringCopy (buf, sizeof (buf), "Vacuum"); + utf8StringCopy (buf, sizeof (buf), + GAME_STRING (ORBITSCAN_STRING_BASE + 4)); // "Vacuum" else { val = (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity * 100 + (EARTH_ATMOSPHERE >> 1)) / EARTH_ATMOSPHERE; - MakeScanValue (buf, val, " atm"); + MakeScanValue (buf, val, + GAME_STRING (ORBITSCAN_STRING_BASE + 5)); // " atm" } t.pStr = buf; t.CharCount = (COUNT)~0; @@ -244,7 +250,8 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Temp: ", LEFT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 6), + LEFT_SIDE_BASELINE_X_PC); // "Temp: " sprintf (buf, "%d" STR_DEGREE_SIGN " c", pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature); t.pStr = buf; @@ -254,12 +261,14 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Weather: ", LEFT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 7), + LEFT_SIDE_BASELINE_X_PC); // "Weather: " if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0) - t.pStr = "None"; + t.pStr = GAME_STRING (ORBITSCAN_STRING_BASE + 8); // "None" else { - sprintf (buf, "%s %u", "Class", + sprintf (buf, "%s %u", + GAME_STRING (ORBITSCAN_STRING_BASE + 9), // "Class" pSolarSysState->SysInfo.PlanetInfo.Weather + 1); t.pStr = buf; } @@ -269,13 +278,15 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Tectonics: ", LEFT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 10), + LEFT_SIDE_BASELINE_X_PC); // "Tectonics: " if (PLANSIZE (pSolarSysState->SysInfo.PlanetInfo.PlanDataPtr->Type) == GAS_GIANT) - t.pStr = "None"; + t.pStr = GAME_STRING (ORBITSCAN_STRING_BASE + 8); // "None" else { - sprintf (buf, "%s %u", "Class", + sprintf (buf, "%s %u", + GAME_STRING (ORBITSCAN_STRING_BASE + 9), // "Class" pSolarSysState->SysInfo.PlanetInfo.Tectonics + 1); t.pStr = buf; } @@ -286,14 +297,16 @@ PrintCoarseScanPC (void) t.baseline.y = SCAN_BASELINE_Y_PC; LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Mass: ", RIGHT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 11), + RIGHT_SIDE_BASELINE_X_PC); // "Mass: " val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius; val = (val * val * val / 100L * pSolarSysState->SysInfo.PlanetInfo.PlanetDensity + ((100L * 100L) >> 1)) / (100L * 100L); if (val == 0) val = 1; - MakeScanValue (buf, val, " e.s."); + MakeScanValue (buf, val, + GAME_STRING (ORBITSCAN_STRING_BASE + 12)); // " e.s." t.pStr = buf; t.CharCount = (COUNT)~0; font_DrawText (&t); @@ -301,9 +314,11 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Radius: ", RIGHT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 13), + RIGHT_SIDE_BASELINE_X_PC); // "Radius: " val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius; - MakeScanValue (buf, val, " e.s."); + MakeScanValue (buf, val, + GAME_STRING (ORBITSCAN_STRING_BASE + 12)); // " e.s." t.pStr = buf; t.CharCount = (COUNT)~0; font_DrawText (&t); @@ -311,11 +326,13 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Gravity: ", RIGHT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 14), + RIGHT_SIDE_BASELINE_X_PC); // "Gravity: " val = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity; if (val == 0) val = 1; - MakeScanValue (buf, val, " g."); + MakeScanValue (buf, val, + GAME_STRING (ORBITSCAN_STRING_BASE + 15)); // " g." t.pStr = buf; t.CharCount = (COUNT)~0; font_DrawText (&t); @@ -323,10 +340,12 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Day: ", RIGHT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 16), + RIGHT_SIDE_BASELINE_X_PC); // "Day: " val = (SDWORD)pSolarSysState->SysInfo.PlanetInfo.RotationPeriod * 10 / 24; - MakeScanValue (buf, val, " days"); + MakeScanValue (buf, val, + GAME_STRING (ORBITSCAN_STRING_BASE + 17)); // " days" t.pStr = buf; t.CharCount = (COUNT)~0; font_DrawText (&t); @@ -334,7 +353,8 @@ PrintCoarseScanPC (void) UnlockMutex (GraphicsLock); LockMutex (GraphicsLock); - PrintScanTitlePC (&t, &r, "Tilt: ", RIGHT_SIDE_BASELINE_X_PC); + PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE), + RIGHT_SIDE_BASELINE_X_PC); // "Tilt: " val = pSolarSysState->SysInfo.PlanetInfo.AxialTilt; if (val < 0) val = -val; diff --git a/sc2/src/sc2code/sis.c b/sc2/src/sc2code/sis.c index b4e73478a..f77551e42 100644 --- a/sc2/src/sc2code/sis.c +++ b/sc2/src/sc2code/sis.c @@ -154,13 +154,13 @@ DrawHyperCoords (POINT universe) } void -DrawSISMessage (UNICODE *pStr) +DrawSISMessage (const UNICODE *pStr) { DrawSISMessageEx (pStr, -1, -1, DSME_NONE); } BOOLEAN -DrawSISMessageEx (UNICODE *pStr, SIZE CurPos, SIZE ExPos, COUNT flags) +DrawSISMessageEx (const UNICODE *pStr, SIZE CurPos, SIZE ExPos, COUNT flags) { UNICODE buf[256]; CONTEXT OldContext; @@ -338,7 +338,7 @@ DateToString (unsigned char *buf, size_t bufLen, } void -DrawStatusMessage (UNICODE *pStr) +DrawStatusMessage (const UNICODE *pStr) { RECT r; TEXT t; @@ -367,13 +367,16 @@ DrawStatusMessage (UNICODE *pStr) sprintf (buf, "%u %s", MAKE_WORD ( GET_GAME_STATE (MELNORME_CREDIT0), GET_GAME_STATE (MELNORME_CREDIT1) - ), "Cr"); + ), GAME_STRING (STATUS_STRING_BASE + 0)); // "Cr" else if (GET_GAME_STATE (CHMMR_BOMB_STATE) < 2) - sprintf (buf, "%lu %s", GLOBAL_SIS (ResUnits), "RU"); + sprintf (buf, "%lu %s", GLOBAL_SIS (ResUnits), + GAME_STRING (STATUS_STRING_BASE + 1)); // "RU" else sprintf (buf, "%s %s", - (optWhichMenu == OPT_PC) ? "UNLIMITED" : STR_INFINITY_SIGN, - "RU"); + (optWhichMenu == OPT_PC) ? + GAME_STRING (STATUS_STRING_BASE + 2) + : STR_INFINITY_SIGN, // "UNLIMITED" + GAME_STRING (STATUS_STRING_BASE + 1)); // "RU" pStr = buf; } else if (pStr == 0) @@ -569,7 +572,6 @@ DrawFlagshipStats (void) fact that the leading is way more than is generally needed. */ leading -= 3; - t.pStr = buf; t.baseline.x = SIS_SCREEN_WIDTH / 6; //wild-assed guess, but it worked t.baseline.y = r.corner.y + leading + 3; t.align = ALIGN_RIGHT; @@ -577,21 +579,22 @@ DrawFlagshipStats (void) SetContextFontEffect (SetAbsFrameIndex (FontGradFrame, 4)); - utf8StringCopy (buf, sizeof (buf), "nose:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 0); // "nose:" font_DrawText (&t); t.baseline.y += leading; - utf8StringCopy (buf, sizeof (buf), "spread:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 1); // "spread:" font_DrawText (&t); t.baseline.y += leading; - utf8StringCopy (buf, sizeof (buf), "side:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 2); // "side:" font_DrawText (&t); t.baseline.y += leading; - utf8StringCopy (buf, sizeof (buf), "tail:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 3); // "tail:" font_DrawText (&t); t.baseline.x += 5; t.baseline.y = r.corner.y + leading + 3; t.align = ALIGN_LEFT; + t.pStr = buf; sprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[15]))); font_DrawText (&t); @@ -611,20 +614,21 @@ DrawFlagshipStats (void) SetContextFontEffect (SetAbsFrameIndex (FontGradFrame, 5)); - utf8StringCopy (buf, sizeof (buf), "maximum velocity:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 4); // "maximum velocity:" font_DrawText (&t); t.baseline.y += leading; - utf8StringCopy (buf, sizeof (buf), "turning rate:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 5); // "turning rate:" font_DrawText (&t); t.baseline.y += leading; - utf8StringCopy (buf, sizeof (buf), "combat energy:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 6); // "combat energy:" font_DrawText (&t); t.baseline.y += leading; - utf8StringCopy (buf, sizeof (buf), "maximum fuel:"); + t.pStr = GAME_STRING (FLAGSHIP_STRING_BASE + 7); // "maximum fuel:" font_DrawText (&t); t.baseline.x = r.extent.width - 2; t.baseline.y = r.corner.y + leading + 3; + t.pStr = buf; sprintf (buf, "%4u", max_thrust * 4); font_DrawText (&t); @@ -652,23 +656,25 @@ DrawFlagshipStats (void) } static const UNICODE * -describeWeapon (BYTE moduleType) { - switch (moduleType) { +describeWeapon (BYTE moduleType) +{ + switch (moduleType) + { case GUN_WEAPON: - return "gun"; + return GAME_STRING (FLAGSHIP_STRING_BASE + 8); // "gun" case BLASTER_WEAPON: - return "blaster"; + return GAME_STRING (FLAGSHIP_STRING_BASE + 9); // "blaster" case CANNON_WEAPON: - return "cannon"; + return GAME_STRING (FLAGSHIP_STRING_BASE + 10); // "cannon" case BOMB_MODULE_0: case BOMB_MODULE_1: case BOMB_MODULE_2: case BOMB_MODULE_3: case BOMB_MODULE_4: case BOMB_MODULE_5: - return "n/a"; + return GAME_STRING (FLAGSHIP_STRING_BASE + 11); // "n/a" default: - return "none"; + return GAME_STRING (FLAGSHIP_STRING_BASE + 12); // "none" } } @@ -806,7 +812,7 @@ DrawPC_SIS (void) DrawFilledRectangle (&r); SetContextFontEffect (SetAbsFrameIndex (FontGradFrame, 1)); - t.pStr = "FUEL"; + t.pStr = GAME_STRING (STATUS_STRING_BASE + 3); // "FUEL" font_DrawText (&t); r.corner.y += 79; @@ -814,7 +820,7 @@ DrawPC_SIS (void) DrawFilledRectangle (&r); SetContextFontEffect (SetAbsFrameIndex (FontGradFrame, 2)); - t.pStr = "CREW"; + t.pStr = GAME_STRING (STATUS_STRING_BASE + 4); // "CREW" font_DrawText (&t); SetContextFontEffect (NULL); @@ -826,7 +832,7 @@ DrawPC_SIS (void) DrawFilledRectangle (&r); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x02, 0x04, 0x1E), 0x38)); t.baseline.y = r.corner.y + 6; - t.pStr = "CAPTAIN"; + t.pStr = GAME_STRING (STATUS_STRING_BASE + 5); // "CAPTAIN" font_DrawText (&t); } diff --git a/sc2/src/sc2code/sis.h b/sc2/src/sc2code/sis.h index 8060b552e..25b3f3d5a 100644 --- a/sc2/src/sc2code/sis.h +++ b/sc2/src/sc2code/sis.h @@ -254,17 +254,17 @@ extern void ClearSISRect (BYTE ClearFlags); extern void SetFlashRect (PRECT pRect, FRAME f); extern void DrawHyperCoords (POINT puniverse); extern void DrawSISTitle (UNICODE *pStr); -extern BOOLEAN DrawSISMessageEx (UNICODE *pStr, SIZE CurPos, SIZE ExPos, - COUNT flags); +extern BOOLEAN DrawSISMessageEx (const UNICODE *pStr, SIZE CurPos, + SIZE ExPos, COUNT flags); #define DSME_NONE 0 #define DSME_SETFR (1 << 0) #define DSME_CLEARFR (1 << 1) #define DSME_BLOCKCUR (1 << 2) -extern void DrawSISMessage (UNICODE *pStr); +extern void DrawSISMessage (const UNICODE *pStr); extern void DrawGameDate (void); extern void DateToString (unsigned char *buf, size_t bufLen, BYTE month_index, BYTE day_index, COUNT year_index); -extern void DrawStatusMessage (UNICODE *pStr); +extern void DrawStatusMessage (const UNICODE *pStr); extern void DrawLanders (void); extern void DrawStorageBays (BOOLEAN Refresh); extern void GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect);