Simplified get_rc_string, merged pinball and pb.
This commit is contained in:
1 parent
88f835d068
commit
42226a14c9
15 files changed
+278
-333
No files matched your search
@@ -4,7 +4,6 @@
|
||||
#include "control.h"
|
||||
#include "fullscrn.h"
|
||||
#include "midi.h"
|
||||
#include "pinball.h"
|
||||
#include "options.h"
|
||||
#include "pb.h"
|
||||
#include "render.h"
|
||||
@@ -61,12 +60,12 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
||||
return 1;
|
||||
}
|
||||
|
||||
pinball::quickFlag = strstr(lpCmdLine, "-quick") != nullptr;
|
||||
pb::quickFlag = strstr(lpCmdLine, "-quick") != nullptr;
|
||||
|
||||
// SDL window
|
||||
SDL_Window* window = SDL_CreateWindow
|
||||
(
|
||||
pinball::get_rc_string(Msg::STRING139),
|
||||
pb::get_rc_string(Msg::STRING139),
|
||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
800, 556,
|
||||
SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE
|
||||
@@ -169,7 +168,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
||||
if (!Sound::Init(Options.SoundChannels, Options.Sounds, Options.SoundVolume))
|
||||
Options.Sounds = false;
|
||||
|
||||
if (!pinball::quickFlag && !midi::music_init(Options.MusicVolume))
|
||||
if (!pb::quickFlag && !midi::music_init(Options.MusicVolume))
|
||||
Options.Music = false;
|
||||
|
||||
if (pb::init())
|
||||
@@ -405,34 +404,34 @@ void winmain::RenderUi()
|
||||
fullscrn::window_size_changed();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Game)))
|
||||
if (ImGui::BeginMenu(pb::get_rc_string(Msg::Menu1_Game)))
|
||||
{
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_New_Game), "F2"))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_New_Game), "F2"))
|
||||
{
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Launch_Ball), nullptr, false, LaunchBallEnabled))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Launch_Ball), nullptr, false, LaunchBallEnabled))
|
||||
{
|
||||
end_pause();
|
||||
pb::launch_ball();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Pause_Resume_Game), "F3"))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Pause_Resume_Game), "F3"))
|
||||
{
|
||||
pause();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_High_Scores), nullptr, false, HighScoresEnabled))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_High_Scores), nullptr, false, HighScoresEnabled))
|
||||
{
|
||||
pause(false);
|
||||
pb::high_scores();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Demo), nullptr, DemoActive))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Demo), nullptr, DemoActive))
|
||||
{
|
||||
end_pause();
|
||||
pb::toggle_demo();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Exit)))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Exit)))
|
||||
{
|
||||
SDL_Event event{SDL_QUIT};
|
||||
SDL_PushEvent(&event);
|
||||
@@ -440,41 +439,41 @@ void winmain::RenderUi()
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Options)))
|
||||
if (ImGui::BeginMenu(pb::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(Msg::Menu1_Full_Screen), "F4", Options.FullScreen))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Full_Screen), "F4", Options.FullScreen))
|
||||
{
|
||||
options::toggle(Menu1::Full_Screen);
|
||||
}
|
||||
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Select_Players)))
|
||||
if (ImGui::BeginMenu(pb::get_rc_string(Msg::Menu1_Select_Players)))
|
||||
{
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_1Player), nullptr, Options.Players == 1))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_1Player), nullptr, Options.Players == 1))
|
||||
{
|
||||
options::toggle(Menu1::OnePlayer);
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_2Players), nullptr, Options.Players == 2))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_2Players), nullptr, Options.Players == 2))
|
||||
{
|
||||
options::toggle(Menu1::TwoPlayers);
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_3Players), nullptr, Options.Players == 3))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_3Players), nullptr, Options.Players == 3))
|
||||
{
|
||||
options::toggle(Menu1::ThreePlayers);
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_4Players), nullptr, Options.Players == 4))
|
||||
if (ImGui::MenuItem(pb::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(Msg::Menu1_Player_Controls), "F8"))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Player_Controls), "F8"))
|
||||
{
|
||||
pause(false);
|
||||
options::ShowControlDialog();
|
||||
@@ -518,7 +517,7 @@ void winmain::RenderUi()
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_Music), "F6", Options.Music))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Music), "F6", Options.Music))
|
||||
{
|
||||
options::toggle(Menu1::Music);
|
||||
}
|
||||
@@ -537,7 +536,7 @@ void winmain::RenderUi()
|
||||
{
|
||||
font_selection::ShowDialog();
|
||||
}
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_WindowUniformScale), nullptr, Options.UniformScaling))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_WindowUniformScale), nullptr, Options.UniformScaling))
|
||||
{
|
||||
options::toggle(Menu1::WindowUniformScale);
|
||||
}
|
||||
@@ -593,7 +592,7 @@ void winmain::RenderUi()
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Table_Resolution)))
|
||||
if (ImGui::BeginMenu(pb::get_rc_string(Msg::Menu1_Table_Resolution)))
|
||||
{
|
||||
char buffer[20]{};
|
||||
Msg resolutionStringId = Msg::Menu1_UseMaxResolution_640x480;
|
||||
@@ -604,7 +603,7 @@ void winmain::RenderUi()
|
||||
case 2: resolutionStringId = Msg::Menu1_UseMaxResolution_1024x768; break;
|
||||
}
|
||||
|
||||
auto maxResText = pinball::get_rc_string(resolutionStringId);
|
||||
auto maxResText = pb::get_rc_string(resolutionStringId);
|
||||
if (ImGui::MenuItem(maxResText, nullptr, Options.Resolution == -1))
|
||||
{
|
||||
options::toggle(Menu1::MaximumResolution);
|
||||
@@ -632,7 +631,7 @@ void winmain::RenderUi()
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu(pinball::get_rc_string(Msg::Menu1_Help)))
|
||||
if (ImGui::BeginMenu(pb::get_rc_string(Msg::Menu1_Help)))
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if (ImGui::MenuItem("ImGui Demo", nullptr, ShowImGuiDemo))
|
||||
@@ -691,7 +690,7 @@ void winmain::RenderUi()
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem(pinball::get_rc_string(Msg::Menu1_About_Pinball)))
|
||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_About_Pinball)))
|
||||
{
|
||||
pause(false);
|
||||
ShowAboutDialog = true;
|
||||
@@ -986,8 +985,8 @@ void winmain::memalloc_failure()
|
||||
{
|
||||
midi::music_stop();
|
||||
Sound::Close();
|
||||
const char* caption = pinball::get_rc_string(Msg::STRING270);
|
||||
const char* text = pinball::get_rc_string(Msg::STRING279);
|
||||
const char* caption = pb::get_rc_string(Msg::STRING270);
|
||||
const char* text = pb::get_rc_string(Msg::STRING279);
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, caption, text, MainWindow);
|
||||
std::exit(1);
|
||||
}
|
||||
@@ -997,13 +996,13 @@ void winmain::a_dialog()
|
||||
if (ShowAboutDialog == true)
|
||||
{
|
||||
ShowAboutDialog = false;
|
||||
ImGui::OpenPopup(pinball::get_rc_string(Msg::STRING204));
|
||||
ImGui::OpenPopup(pb::get_rc_string(Msg::STRING204));
|
||||
}
|
||||
|
||||
bool unused_open = true;
|
||||
if (ImGui::BeginPopupModal(pinball::get_rc_string(Msg::STRING204), &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
if (ImGui::BeginPopupModal(pb::get_rc_string(Msg::STRING204), &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::TextUnformatted(pinball::get_rc_string(Msg::STRING139));
|
||||
ImGui::TextUnformatted(pb::get_rc_string(Msg::STRING139));
|
||||
ImGui::TextUnformatted("Original game by Cinematronics, Microsoft");
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
Reference in new issue
Block a user