translations: rename enums and avoid macros

This commit is contained in:
Alexis Murzeau 2022-08-27 22:22:09 +02:00
parent ead8ac2c18
commit ea4e143405
13 changed files with 7576 additions and 7534 deletions

View File

@ -290,7 +290,7 @@ void TPinballTable::tilt(float time)
{
pinball::InfoTextBox->Clear();
pinball::MissTextBox->Clear();
pinball::InfoTextBox->Display(pinball::get_rc_string(translation_id_e::STRING136), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING136), -1.0);
loader::play_sound(SoundIndex3, nullptr, "TPinballTable1");
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
@ -369,9 +369,9 @@ int TPinballTable::Message(int code, float value)
LightGroup->Message(20, 0.0);
Plunger->Message(1016, 0.0);
if (Demo && Demo->ActiveFlag)
rc_text = pinball::get_rc_string(translation_id_e::STRING131);
rc_text = pinball::get_rc_string(Msg::STRING131);
else
rc_text = pinball::get_rc_string(translation_id_e::STRING127);
rc_text = pinball::get_rc_string(Msg::STRING127);
pinball::InfoTextBox->Display(rc_text, -1.0);
if (Demo)
Demo->Message(1014, 0.0);
@ -468,9 +468,9 @@ int TPinballTable::Message(int code, float value)
{
const char* textboxText;
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(translation_id_e::STRING131);
textboxText = pinball::get_rc_string(Msg::STRING131);
else
textboxText = pinball::get_rc_string(translation_id_e::STRING127);
textboxText = pinball::get_rc_string(Msg::STRING127);
pinball::InfoTextBox->Display(textboxText, -1.0);
break;
}
@ -512,27 +512,27 @@ int TPinballTable::Message(int code, float value)
{
case 0:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(translation_id_e::STRING131);
textboxText = pinball::get_rc_string(Msg::STRING131);
else
textboxText = pinball::get_rc_string(translation_id_e::STRING127);
textboxText = pinball::get_rc_string(Msg::STRING127);
break;
case 1:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(translation_id_e::STRING132);
textboxText = pinball::get_rc_string(Msg::STRING132);
else
textboxText = pinball::get_rc_string(translation_id_e::STRING128);
textboxText = pinball::get_rc_string(Msg::STRING128);
break;
case 2:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(translation_id_e::STRING133);
textboxText = pinball::get_rc_string(Msg::STRING133);
else
textboxText = pinball::get_rc_string(translation_id_e::STRING129);
textboxText = pinball::get_rc_string(Msg::STRING129);
break;
case 3:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(translation_id_e::STRING134);
textboxText = pinball::get_rc_string(Msg::STRING134);
else
textboxText = pinball::get_rc_string(translation_id_e::STRING130);
textboxText = pinball::get_rc_string(Msg::STRING130);
break;
default:
break;
@ -549,7 +549,7 @@ int TPinballTable::Message(int code, float value)
case 1022:
loader::play_sound(SoundIndex2, nullptr, "TPinballTable3");
pinball::MissTextBox->Clear();
pinball::InfoTextBox->Display(pinball::get_rc_string(translation_id_e::STRING135), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING135), -1.0);
EndGameTimeoutTimer = timer::set(3.0, this, EndGame_timeout);
break;
case 1024:
@ -661,7 +661,7 @@ void TPinballTable::EndGame_timeout(int timerId, void* caller)
if (table->Demo)
table->Demo->Message(1022, 0.0);
control::handler(67, pinball::MissTextBox);
pinball::InfoTextBox->Display(pinball::get_rc_string(translation_id_e::STRING125), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING125), -1.0);
}
void TPinballTable::LightShow_timeout(int timerId, void* caller)

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ public:
static component_tag_base* simple_components[145];
static int waiting_deployment_flag;
static bool table_unlimited_balls;
static translation_id_e RankRcArray[9], MissionRcArray[17];
static Msg RankRcArray[9], MissionRcArray[17];
static int mission_select_scores[17];
static component_tag_base *wormhole_tag_array1[3], *wormhole_tag_array2[3], *wormhole_tag_array3[3];

View File

@ -34,7 +34,7 @@ void font_selection::RenderDialog()
ImGui::SameLine();
ImGui::InputText("", DialogInputBuffer, IM_ARRAYSIZE(DialogInputBuffer));
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Ok)))
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Ok)))
{
options::Options.FontFileName = DialogInputBuffer;
ImGui::CloseCurrentPopup();
@ -42,7 +42,7 @@ void font_selection::RenderDialog()
}
ImGui::SameLine();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Cancel)))
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Cancel)))
ImGui::CloseCurrentPopup();
ImGui::EndPopup();

View File

@ -121,7 +121,7 @@ void high_score::RenderHighScoreDialog()
if (ShowDialog == true)
{
ShowDialog = false;
if (!ImGui::IsPopupOpen(pinball::get_rc_string(translation_id_e::HIGHSCORES_Caption)))
if (!ImGui::IsPopupOpen(pinball::get_rc_string(Msg::HIGHSCORES_Caption)))
{
dlg_enter_name = false;
while (!ScoreQueue.empty())
@ -140,19 +140,19 @@ void high_score::RenderHighScoreDialog()
}
}
ImGui::OpenPopup(pinball::get_rc_string(translation_id_e::HIGHSCORES_Caption));
ImGui::OpenPopup(pinball::get_rc_string(Msg::HIGHSCORES_Caption));
}
}
bool unused_open = true;
if (ImGui::BeginPopupModal(pinball::get_rc_string(translation_id_e::HIGHSCORES_Caption), &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
if (ImGui::BeginPopupModal(pinball::get_rc_string(Msg::HIGHSCORES_Caption), &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
{
if (ImGui::BeginTable("table1", 3, ImGuiTableFlags_Borders))
{
char buf[36];
ImGui::TableSetupColumn(pinball::get_rc_string(translation_id_e::HIGHSCORES_Rank));
ImGui::TableSetupColumn(pinball::get_rc_string(translation_id_e::HIGHSCORES_Name));
ImGui::TableSetupColumn(pinball::get_rc_string(translation_id_e::HIGHSCORES_Score));
ImGui::TableSetupColumn(pinball::get_rc_string(Msg::HIGHSCORES_Rank));
ImGui::TableSetupColumn(pinball::get_rc_string(Msg::HIGHSCORES_Name));
ImGui::TableSetupColumn(pinball::get_rc_string(Msg::HIGHSCORES_Score));
ImGui::TableHeadersRow();
for (int offset = 0, row = 0; row < 5; row++)
@ -184,7 +184,7 @@ void high_score::RenderHighScoreDialog()
ImGui::EndTable();
}
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Ok)))
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Ok)))
{
if (dlg_enter_name)
{
@ -194,23 +194,23 @@ void high_score::RenderHighScoreDialog()
}
ImGui::SameLine();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Cancel)))
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Cancel)))
ImGui::CloseCurrentPopup();
ImGui::SameLine();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Clear)))
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Clear)))
ImGui::OpenPopup("Confirm");
if (ImGui::BeginPopupModal("Confirm", nullptr, ImGuiWindowFlags_MenuBar))
{
ImGui::TextUnformatted(pinball::get_rc_string(translation_id_e::STRING141));
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Ok), ImVec2(120, 0)))
ImGui::TextUnformatted(pinball::get_rc_string(Msg::STRING141));
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Ok), ImVec2(120, 0)))
{
clear_table();
ImGui::CloseCurrentPopup();
}
ImGui::SetItemDefaultFocus();
ImGui::SameLine();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Cancel), ImVec2(120, 0)))
if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Cancel), ImVec2(120, 0)))
{
ImGui::CloseCurrentPopup();
}
@ -220,7 +220,7 @@ void high_score::RenderHighScoreDialog()
ImGui::EndPopup();
// Reenter dialog for the next score in the queue
if (!ImGui::IsPopupOpen(pinball::get_rc_string(translation_id_e::HIGHSCORES_Caption)) && !ScoreQueue.empty())
if (!ImGui::IsPopupOpen(pinball::get_rc_string(Msg::HIGHSCORES_Caption)) && !ScoreQueue.empty())
{
ShowDialog = true;
}

View File

@ -19,12 +19,12 @@ bool options::ShowDialog = false;
GameInput* options::ControlWaitingForInput = nullptr;
const ControlRef options::Controls[6]
{
{translation_id_e::KEYMAPPER_FlipperL, RebindControls.LeftFlipper},
{translation_id_e::KEYMAPPER_FlipperR, RebindControls.RightFlipper},
{translation_id_e::KEYMAPPER_BumpLeft, RebindControls.LeftTableBump},
{translation_id_e::KEYMAPPER_BumpRight, RebindControls.RightTableBump},
{translation_id_e::KEYMAPPER_BumpBottom, RebindControls.BottomTableBump},
{translation_id_e::KEYMAPPER_Plunger, RebindControls.Plunger},
{Msg::KEYMAPPER_FlipperL, RebindControls.LeftFlipper},
{Msg::KEYMAPPER_FlipperR, RebindControls.RightFlipper},
{Msg::KEYMAPPER_BumpLeft, RebindControls.LeftTableBump},
{Msg::KEYMAPPER_BumpRight, RebindControls.RightTableBump},
{Msg::KEYMAPPER_BumpBottom, RebindControls.BottomTableBump},
{Msg::KEYMAPPER_Plunger, RebindControls.Plunger},
};
@ -114,7 +114,7 @@ void options::InitPrimary()
Options.DebugOverlayCollisionMask = get_int("Debug Overlay Collision Mask", true);
Options.DebugOverlaySprites = get_int("Debug Overlay Sprites", true);
Options.DebugOverlaySounds = get_int("Debug Overlay Sounds", true);
translations::set_current_language(get_string("Language", translations::get_current_language()).c_str());
translations::set_current_language(get_string("Language", translations::get_current_language()->short_name).c_str());
Options.FontFileName = get_string("FontFileName", "");
}
@ -164,7 +164,7 @@ void options::uninit()
set_int("Debug Overlay Collision Mask", Options.DebugOverlayCollisionMask);
set_int("Debug Overlay Sprites", Options.DebugOverlaySprites);
set_int("Debug Overlay Sounds", Options.DebugOverlaySounds);
set_string("Language", translations::get_current_language());
set_string("Language", translations::get_current_language()->short_name);
set_string("FontFileName", Options.FontFileName.c_str());
}
@ -344,16 +344,16 @@ void options::RenderControlDialog()
return;
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2{550, 450});
if (ImGui::Begin(pinball::get_rc_string(translation_id_e::KEYMAPPER_Caption), &ShowDialog))
if (ImGui::Begin(pinball::get_rc_string(Msg::KEYMAPPER_Caption), &ShowDialog))
{
ImGui::TextUnformatted(pinball::get_rc_string(translation_id_e::KEYMAPPER_Groupbox2));
ImGui::TextUnformatted(pinball::get_rc_string(Msg::KEYMAPPER_Groupbox2));
ImGui::Separator();
ImGui::TextWrapped(pinball::get_rc_string(translation_id_e::KEYMAPPER_Help1));
ImGui::TextWrapped(pinball::get_rc_string(translation_id_e::KEYMAPPER_Help2));
ImGui::TextWrapped(pinball::get_rc_string(Msg::KEYMAPPER_Help1));
ImGui::TextWrapped(pinball::get_rc_string(Msg::KEYMAPPER_Help2));
ImGui::Spacing();
ImGui::TextUnformatted(pinball::get_rc_string(translation_id_e::KEYMAPPER_Groupbox1));
ImGui::TextUnformatted(pinball::get_rc_string(Msg::KEYMAPPER_Groupbox1));
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{5, 10});
if (ImGui::BeginTable("Controls", 4, ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders))
@ -422,20 +422,20 @@ void options::RenderControlDialog()
ImGui::PopStyleVar();
ImGui::Spacing();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::KEYMAPPER_Ok)))
if (ImGui::Button(pinball::get_rc_string(Msg::KEYMAPPER_Ok)))
{
Options.Key = RebindControls;
ShowDialog = false;
}
ImGui::SameLine();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::KEYMAPPER_Cancel)))
if (ImGui::Button(pinball::get_rc_string(Msg::KEYMAPPER_Cancel)))
{
ShowDialog = false;
}
ImGui::SameLine();
if (ImGui::Button(pinball::get_rc_string(translation_id_e::KEYMAPPER_Default)))
if (ImGui::Button(pinball::get_rc_string(Msg::KEYMAPPER_Default)))
{
RebindControls = Options.KeyDft;
ControlWaitingForInput = nullptr;

View File

@ -97,7 +97,7 @@ struct optionsStruct
struct ControlRef
{
translation_id_e NameStringId;
Msg NameStringId;
GameInput (&Option)[3];
};

View File

@ -47,7 +47,7 @@ int pb::init()
record_table = partman::load_records(dataFilePath.c_str(), FullTiltMode);
auto useBmpFont = 0;
pinball::get_rc_int(translation_id_e::STRING258, &useBmpFont);
pinball::get_rc_int(Msg::STRING258, &useBmpFont);
if (useBmpFont)
score::load_msg_font("pbmsg_ft");
@ -124,7 +124,7 @@ void pb::SelectDatFile(const std::vector<const char*>& dataSearchPaths)
std::string datFileNames[3]
{
"CADET.DAT",
options::get_string("Pinball Data", pinball::get_rc_string(translation_id_e::STRING268)),
options::get_string("Pinball Data", pinball::get_rc_string(Msg::STRING268)),
"DEMO.DAT",
};
@ -219,7 +219,7 @@ void pb::toggle_demo()
MainTable->Message(1024, 0.0);
mode_change(GameModes::GameOver);
pinball::MissTextBox->Clear();
auto text = pinball::get_rc_string(translation_id_e::STRING125);
auto text = pinball::get_rc_string(Msg::STRING125);
pinball::InfoTextBox->Display(text, -1.0);
}
else
@ -288,7 +288,7 @@ void pb::frame(float dtMilliSec)
{
if (nudge::nudge_count > 0.5f)
{
pinball::InfoTextBox->Display(pinball::get_rc_string(translation_id_e::STRING126), 2.0);
pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING126), 2.0);
}
if (nudge::nudge_count > 1.0f)
MainTable->tilt(time_now);
@ -366,7 +366,7 @@ void pb::pause_continue()
{
if (MainTable)
MainTable->Message(1008, time_now);
pinball::InfoTextBox->Display(pinball::get_rc_string(translation_id_e::STRING123), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING123), -1.0);
midi::music_stop();
Sound::Deactivate();
}
@ -381,12 +381,12 @@ void pb::pause_continue()
if (game_mode == GameModes::GameOver)
{
textTime = -1.0;
text = pinball::get_rc_string(translation_id_e::STRING125);
text = pinball::get_rc_string(Msg::STRING125);
}
else
{
textTime = 5.0;
text = pinball::get_rc_string(translation_id_e::STRING124);
text = pinball::get_rc_string(Msg::STRING124);
}
pinball::InfoTextBox->Display(text, textTime);
}
@ -481,7 +481,7 @@ void pb::InputDown(GameInput input)
case 'h':
{
high_score_struct entry{ {0}, 1000000000 };
strncpy(entry.Name, pinball::get_rc_string(translation_id_e::STRING127), sizeof entry.Name - 1);
strncpy(entry.Name, pinball::get_rc_string(Msg::STRING127), sizeof entry.Name - 1);
high_score::show_and_set_high_score_dialog({ entry, 1 });
break;
}
@ -553,10 +553,10 @@ void pb::end_game()
const char* playerName = "Player";
switch(scoreIndex[i]) {
case 0: playerName = pinball::get_rc_string(translation_id_e::STRING127); break;
case 1: playerName = pinball::get_rc_string(translation_id_e::STRING128); break;
case 2: playerName = pinball::get_rc_string(translation_id_e::STRING129); break;
case 3: playerName = pinball::get_rc_string(translation_id_e::STRING130); break;
case 0: playerName = pinball::get_rc_string(Msg::STRING127); break;
case 1: playerName = pinball::get_rc_string(Msg::STRING128); break;
case 2: playerName = pinball::get_rc_string(Msg::STRING129); break;
case 3: playerName = pinball::get_rc_string(Msg::STRING130); break;
}
strncpy(entry.Name, playerName, sizeof entry.Name - 1);

View File

@ -3,7 +3,7 @@
#include "translations.h"
#include "winmain.h"
int LoadStringAlt(translation_id_e uID, LPSTR lpBuffer, int cchBufferMax)
int LoadStringAlt(Msg uID, LPSTR lpBuffer, int cchBufferMax)
{
const char* text = translations::get_translation(uID);
@ -20,7 +20,7 @@ int pinball::LeftShift = -1;
int pinball::RightShift = -1;
std::string pinball::BasePath;
char* pinball::get_rc_string(translation_id_e uID)
char* pinball::get_rc_string(Msg uID)
{
char* result = &getRcBuffer[256 * rc_string_slot];
if (!LoadStringAlt(uID, &getRcBuffer[256 * rc_string_slot], 255))
@ -31,7 +31,7 @@ char* pinball::get_rc_string(translation_id_e uID)
return result;
}
int pinball::get_rc_int(translation_id_e uID, int* dst)
int pinball::get_rc_int(Msg uID, int* dst)
{
char buffer[255];
int result = LoadStringAlt(uID, buffer, 255);

View File

@ -14,8 +14,8 @@ public:
static int LeftShift;
static std::string BasePath;
static char* get_rc_string(translation_id_e uID);
static int get_rc_int(translation_id_e uID, int* dst);
static char* get_rc_string(Msg uID);
static int get_rc_int(Msg uID, int* dst);
static std::string make_path_name(const std::string& fileName);
private:
static char getRcBuffer[256 * 6];

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
#pragma once
enum class translation_id_e
enum class Msg
{
STRING101,
STRING102,
@ -257,11 +257,16 @@ enum class translation_id_e
NUMBER,
};
struct languageInfo {
const char* short_name;
const char* display_name;
};
class translations {
public:
static std::vector<const char*> Languages;
static const char* get_translation(translation_id_e id);
static void set_current_language(const char* language_name);
static const char* get_current_language();
static const languageInfo* get_languages(size_t* languages_number);
static const char* get_translation(Msg id);
static void set_current_language(const char* short_name);
static const languageInfo* get_current_language();
static void get_glyph_range(ImVector<ImWchar>* ranges);
};

View File

@ -66,7 +66,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
// SDL window
SDL_Window* window = SDL_CreateWindow
(
pinball::get_rc_string(translation_id_e::STRING139),
pinball::get_rc_string(Msg::STRING139),
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
800, 556,
SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE
@ -390,34 +390,34 @@ void winmain::RenderUi()
fullscrn::window_size_changed();
}
if (ImGui::BeginMenu(pinball::get_rc_string(translation_id_e::Menu1_Game)))
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Game)))
{
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_New_Game), "F2"))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_New_Game), "F2"))
{
new_game();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Launch_Ball), nullptr, false, LaunchBallEnabled))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Launch_Ball), nullptr, false, LaunchBallEnabled))
{
end_pause();
pb::launch_ball();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Pause_Resume_Game), "F3"))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Pause_Resume_Game), "F3"))
{
pause();
}
ImGui::Separator();
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_High_Scores), nullptr, false, HighScoresEnabled))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_High_Scores), nullptr, false, HighScoresEnabled))
{
pause(false);
pb::high_scores();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Demo), nullptr, DemoActive))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Demo), nullptr, DemoActive))
{
end_pause();
pb::toggle_demo();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Exit)))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Exit)))
{
SDL_Event event{SDL_QUIT};
SDL_PushEvent(&event);
@ -425,53 +425,57 @@ void winmain::RenderUi()
ImGui::EndMenu();
}
if (ImGui::BeginMenu(pinball::get_rc_string(translation_id_e::Menu1_Options)))
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Options)))
{
if (ImGui::MenuItem("Show Menu", "F9", Options.ShowMenu))
{
options::toggle(Menu1::Show_Menu);
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Full_Screen), "F4", Options.FullScreen))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Full_Screen), "F4", Options.FullScreen))
{
options::toggle(Menu1::Full_Screen);
}
if (ImGui::BeginMenu(pinball::get_rc_string(translation_id_e::Menu1_Select_Players)))
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Select_Players)))
{
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_1Player), nullptr, Options.Players == 1))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_1Player), nullptr, Options.Players == 1))
{
options::toggle(Menu1::OnePlayer);
new_game();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_2Players), nullptr, Options.Players == 2))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_2Players), nullptr, Options.Players == 2))
{
options::toggle(Menu1::TwoPlayers);
new_game();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_3Players), nullptr, Options.Players == 3))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_3Players), nullptr, Options.Players == 3))
{
options::toggle(Menu1::ThreePlayers);
new_game();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_4Players), nullptr, Options.Players == 4))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_4Players), nullptr, Options.Players == 4))
{
options::toggle(Menu1::FourPlayers);
new_game();
}
ImGui::EndMenu();
}
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Player_Controls), "F8"))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Player_Controls), "F8"))
{
pause(false);
options::ShowControlDialog();
}
if (ImGui::BeginMenu("Language"))
{
std::string current_language = translations::get_current_language();
for(const auto& item : translations::Languages)
std::string current_language = translations::get_current_language()->short_name;
size_t language_number;
const languageInfo* languages = translations::get_languages(&language_number);
for(size_t i = 0; i < language_number; i++)
{
if (ImGui::MenuItem(item, nullptr, current_language == item))
const languageInfo* item = &languages[i];
if (ImGui::MenuItem(item->display_name, nullptr, current_language == item->short_name))
{
translations::set_current_language(item);
translations::set_current_language(item->short_name);
winmain::Restart();
}
}
@ -503,7 +507,7 @@ void winmain::RenderUi()
}
ImGui::Separator();
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_Music), "F6", Options.Music))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Music), "F6", Options.Music))
{
options::toggle(Menu1::Music);
}
@ -578,15 +582,15 @@ void winmain::RenderUi()
ImGui::EndMenu();
}
if (ImGui::BeginMenu(pinball::get_rc_string(translation_id_e::Menu1_Table_Resolution)))
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Table_Resolution)))
{
char buffer[20]{};
translation_id_e resolutionStringId = translation_id_e::Menu1_UseMaxResolution_640x480;
Msg resolutionStringId = Msg::Menu1_UseMaxResolution_640x480;
switch(fullscrn::GetMaxResolution()) {
case 0: resolutionStringId = translation_id_e::Menu1_UseMaxResolution_640x480; break;
case 1: resolutionStringId = translation_id_e::Menu1_UseMaxResolution_800x600; break;
case 2: resolutionStringId = translation_id_e::Menu1_UseMaxResolution_1024x768; break;
case 0: resolutionStringId = Msg::Menu1_UseMaxResolution_640x480; break;
case 1: resolutionStringId = Msg::Menu1_UseMaxResolution_800x600; break;
case 2: resolutionStringId = Msg::Menu1_UseMaxResolution_1024x768; break;
}
auto maxResText = pinball::get_rc_string(resolutionStringId);
@ -617,7 +621,7 @@ void winmain::RenderUi()
ImGui::EndMenu();
}
if (ImGui::BeginMenu(pinball::get_rc_string(translation_id_e::Menu1_Help)))
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Help)))
{
#ifndef NDEBUG
if (ImGui::MenuItem("ImGui Demo", nullptr, ShowImGuiDemo))
@ -676,7 +680,7 @@ void winmain::RenderUi()
}
ImGui::Separator();
if (ImGui::MenuItem(pinball::get_rc_string(translation_id_e::Menu1_About_Pinball)))
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_About_Pinball)))
{
pause(false);
ShowAboutDialog = true;
@ -977,8 +981,8 @@ void winmain::memalloc_failure()
{
midi::music_stop();
Sound::Close();
const char* caption = pinball::get_rc_string(translation_id_e::STRING270);
const char* text = pinball::get_rc_string(translation_id_e::STRING279);
const char* caption = pinball::get_rc_string(Msg::STRING270);
const char* text = pinball::get_rc_string(Msg::STRING279);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, caption, text, MainWindow);
std::exit(1);
}
@ -988,13 +992,13 @@ void winmain::a_dialog()
if (ShowAboutDialog == true)
{
ShowAboutDialog = false;
ImGui::OpenPopup(pinball::get_rc_string(translation_id_e::STRING204));
ImGui::OpenPopup(pinball::get_rc_string(Msg::STRING204));
}
bool unused_open = true;
if (ImGui::BeginPopupModal(pinball::get_rc_string(translation_id_e::STRING204), &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
if (ImGui::BeginPopupModal(pinball::get_rc_string(Msg::STRING204), &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::TextUnformatted(pinball::get_rc_string(translation_id_e::STRING139));
ImGui::TextUnformatted(pinball::get_rc_string(Msg::STRING139));
ImGui::TextUnformatted("Original game by Cinematronics, Microsoft");
ImGui::Separator();