From 42226a14c96f6d570c63dccdfc36e2b487ad8075 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Wed, 31 Aug 2022 15:18:22 +0300 Subject: [PATCH] Simplified get_rc_string, merged pinball and pb. --- CMakeLists.txt | 2 - SpaceCadetPinball/GroupData.cpp | 3 +- SpaceCadetPinball/TPinballTable.cpp | 55 +++--- SpaceCadetPinball/control.cpp | 283 +++++++++++++-------------- SpaceCadetPinball/font_selection.cpp | 6 +- SpaceCadetPinball/gdrv.cpp | 3 +- SpaceCadetPinball/high_score.cpp | 28 +-- SpaceCadetPinball/loader.cpp | 5 +- SpaceCadetPinball/midi.cpp | 3 +- SpaceCadetPinball/options.cpp | 20 +- SpaceCadetPinball/pb.cpp | 66 ++++--- SpaceCadetPinball/pb.h | 9 +- SpaceCadetPinball/pinball.cpp | 47 ----- SpaceCadetPinball/pinball.h | 22 --- SpaceCadetPinball/winmain.cpp | 59 +++--- 15 files changed, 278 insertions(+), 333 deletions(-) delete mode 100644 SpaceCadetPinball/pinball.cpp delete mode 100644 SpaceCadetPinball/pinball.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f2be7a..6f087e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,8 +63,6 @@ set(SOURCE_FILES SpaceCadetPinball/pb.cpp SpaceCadetPinball/pb.h SpaceCadetPinball/pch.h - SpaceCadetPinball/pinball.cpp - SpaceCadetPinball/pinball.h SpaceCadetPinball/proj.cpp SpaceCadetPinball/proj.h SpaceCadetPinball/render.cpp diff --git a/SpaceCadetPinball/GroupData.cpp b/SpaceCadetPinball/GroupData.cpp index eda4d73..ef96427 100644 --- a/SpaceCadetPinball/GroupData.cpp +++ b/SpaceCadetPinball/GroupData.cpp @@ -6,7 +6,6 @@ #include "fullscrn.h" #include "gdrv.h" #include "pb.h" -#include "pinball.h" #include "zdrv.h" @@ -296,7 +295,7 @@ void DatFile::Finalize() // PINBALL2.MID is an alternative font provided in 3DPB data // Scaled down because it is too large for top text box - /*auto file = pinball::make_path_name("PINBALL2.MID"); + /*auto file = pb::make_path_name("PINBALL2.MID"); auto fileHandle = fopenu(file.c_str(), "rb"); fseek(fileHandle, 0, SEEK_END); auto fileSize = static_cast(ftell(fileHandle)); diff --git a/SpaceCadetPinball/TPinballTable.cpp b/SpaceCadetPinball/TPinballTable.cpp index eaeac21..45cb5dc 100644 --- a/SpaceCadetPinball/TPinballTable.cpp +++ b/SpaceCadetPinball/TPinballTable.cpp @@ -6,7 +6,6 @@ #include "loader.h" #include "midi.h" #include "pb.h" -#include "pinball.h" #include "render.h" #include "TBall.h" #include "TBlocker.h" @@ -186,8 +185,8 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false) } render::build_occlude_list(); - pinball::InfoTextBox = dynamic_cast(find_component("info_text_box")); - pinball::MissTextBox = dynamic_cast(find_component("mission_text_box")); + pb::InfoTextBox = dynamic_cast(find_component("info_text_box")); + pb::MissTextBox = dynamic_cast(find_component("mission_text_box")); control::make_links(this); } @@ -215,7 +214,7 @@ TPinballTable::~TPinballTable() delete ComponentList[0]; } control::ClearLinks(); - pinball::InfoTextBox = pinball::MissTextBox = nullptr; + pb::InfoTextBox = pb::MissTextBox = nullptr; } TPinballComponent* TPinballTable::find_component(LPCSTR componentName) @@ -290,9 +289,9 @@ void TPinballTable::tilt(float time) { if (!TiltLockFlag && !BallInDrainFlag) { - pinball::InfoTextBox->Clear(); - pinball::MissTextBox->Clear(); - pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING136), -1.0); + pb::InfoTextBox->Clear(); + pb::MissTextBox->Clear(); + pb::InfoTextBox->Display(pb::get_rc_string(Msg::STRING136), -1.0); loader::play_sound(SoundIndex3, nullptr, "TPinballTable1"); TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout); @@ -371,10 +370,10 @@ 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(Msg::STRING131); + rc_text = pb::get_rc_string(Msg::STRING131); else - rc_text = pinball::get_rc_string(Msg::STRING127); - pinball::InfoTextBox->Display(rc_text, -1.0); + rc_text = pb::get_rc_string(Msg::STRING127); + pb::InfoTextBox->Display(rc_text, -1.0); if (Demo) Demo->Message(1014, 0.0); break; @@ -444,8 +443,8 @@ int TPinballTable::Message(int code, float value) ScoreSpecial3Flag = 0; ScoreSpecial2Flag = 0; UnknownP71 = 0; - pinball::InfoTextBox->Clear(); - pinball::MissTextBox->Clear(); + pb::InfoTextBox->Clear(); + pb::MissTextBox->Clear(); LightGroup->Message(28, 0.2f); auto time = loader::play_sound(SoundIndex1, nullptr, "TPinballTable2"); if (time < 0) @@ -470,10 +469,10 @@ int TPinballTable::Message(int code, float value) { const char* textboxText; if (Demo->ActiveFlag) - textboxText = pinball::get_rc_string(Msg::STRING131); + textboxText = pb::get_rc_string(Msg::STRING131); else - textboxText = pinball::get_rc_string(Msg::STRING127); - pinball::InfoTextBox->Display(textboxText, -1.0); + textboxText = pb::get_rc_string(Msg::STRING127); + pb::InfoTextBox->Display(textboxText, -1.0); break; } @@ -514,34 +513,34 @@ int TPinballTable::Message(int code, float value) { case 0: if (Demo->ActiveFlag) - textboxText = pinball::get_rc_string(Msg::STRING131); + textboxText = pb::get_rc_string(Msg::STRING131); else - textboxText = pinball::get_rc_string(Msg::STRING127); + textboxText = pb::get_rc_string(Msg::STRING127); break; case 1: if (Demo->ActiveFlag) - textboxText = pinball::get_rc_string(Msg::STRING132); + textboxText = pb::get_rc_string(Msg::STRING132); else - textboxText = pinball::get_rc_string(Msg::STRING128); + textboxText = pb::get_rc_string(Msg::STRING128); break; case 2: if (Demo->ActiveFlag) - textboxText = pinball::get_rc_string(Msg::STRING133); + textboxText = pb::get_rc_string(Msg::STRING133); else - textboxText = pinball::get_rc_string(Msg::STRING129); + textboxText = pb::get_rc_string(Msg::STRING129); break; case 3: if (Demo->ActiveFlag) - textboxText = pinball::get_rc_string(Msg::STRING134); + textboxText = pb::get_rc_string(Msg::STRING134); else - textboxText = pinball::get_rc_string(Msg::STRING130); + textboxText = pb::get_rc_string(Msg::STRING130); break; default: break; } if (textboxText != nullptr) - pinball::InfoTextBox->Display(textboxText, -1); + pb::InfoTextBox->Display(textboxText, -1); ScoreSpecial3Flag = 0; ScoreSpecial2Flag = 0; UnknownP71 = 0; @@ -550,8 +549,8 @@ int TPinballTable::Message(int code, float value) break; case 1022: loader::play_sound(SoundIndex2, nullptr, "TPinballTable3"); - pinball::MissTextBox->Clear(); - pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING135), -1.0); + pb::MissTextBox->Clear(); + pb::InfoTextBox->Display(pb::get_rc_string(Msg::STRING135), -1.0); EndGameTimeoutTimer = timer::set(3.0, this, EndGame_timeout); break; case 1024: @@ -662,8 +661,8 @@ 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(Msg::STRING125), -1.0); + control::handler(67, pb::MissTextBox); + pb::InfoTextBox->Display(pb::get_rc_string(Msg::STRING125), -1.0); } void TPinballTable::LightShow_timeout(int timerId, void* caller) diff --git a/SpaceCadetPinball/control.cpp b/SpaceCadetPinball/control.cpp index d44ffef..c3a64a7 100644 --- a/SpaceCadetPinball/control.cpp +++ b/SpaceCadetPinball/control.cpp @@ -3,7 +3,6 @@ #include "midi.h" #include "pb.h" -#include "pinball.h" #include "TBlocker.h" #include "TBumper.h" #include "TComponentGroup.h" @@ -961,28 +960,27 @@ void control::table_add_extra_ball(float count) { ++TableG->ExtraBalls; soundwave28->Play(nullptr, "table_add_extra_ball"); - auto msg = pinball::get_rc_string(Msg::STRING110); - info_text_box->Display(msg, count); + info_text_box->Display(pb::get_rc_string(Msg::STRING110), count); } void control::table_set_bonus_hold() { lite58->Message(19, 0.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING153), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING153), 2.0); } void control::table_set_bonus() { TableG->ScoreSpecial2Flag = 1; lite59->Message(9, 60.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING105), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING105), 2.0); } void control::table_set_jackpot() { TableG->ScoreSpecial3Flag = 1; lite60->Message(9, 60.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING116), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING116), 2.0); } void control::table_set_flag_lights() @@ -990,7 +988,7 @@ void control::table_set_flag_lights() lite20->Message(9, 60.0); lite19->Message(9, 60.0); lite61->Message(9, 60.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING152), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING152), 2.0); } void control::table_set_multiball(float time) @@ -1004,7 +1002,7 @@ void control::table_set_multiball(float time) lite38->Message(7, -1.0f); lite39->Message(7, -1.0f); lite40->Message(7, -1.0f); - info_text_box->Display(pinball::get_rc_string(Msg::STRING117), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING117), 2.0); midi::play_track(MidiTracks::Track3, true); } } @@ -1024,7 +1022,7 @@ void control::table_bump_ball_sink_lock() { TableG->BallLockedCounter = TableG->BallLockedCounter + 1; soundwave44->Play(nullptr, "table_bump_ball_sink_lock"); - info_text_box->Display(pinball::get_rc_string(Msg::STRING102), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING102), 2.0); TableG->Plunger->Message(1018, 2.0f); } } @@ -1033,7 +1031,7 @@ void control::table_bump_ball_sink_lock() void control::table_set_replay(float value) { lite199->Message(19, 0.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING101), value); + info_text_box->Display(pb::get_rc_string(Msg::STRING101), value); } void control::cheat_bump_rank() @@ -1044,8 +1042,8 @@ void control::cheat_bump_rank() if (rank < 9) { middle_circle->Message(41, 2.0f); - auto rankText = pinball::get_rc_string(RankRcArray[rank]); - snprintf(Buffer,sizeof Buffer, pinball::get_rc_string(Msg::STRING184), rankText); + auto rankText = pb::get_rc_string(RankRcArray[rank]); + snprintf(Buffer,sizeof Buffer, pb::get_rc_string(Msg::STRING184), rankText); mission_text_box->Display(Buffer, 8.0); soundwave10->Play(nullptr, "cheat_bump_rank"); } @@ -1095,8 +1093,8 @@ int control::AddRankProgress(int rank) if (midActiveCount < 9) { middle_circle->Message(41, 5.0); - auto rankText = pinball::get_rc_string(RankRcArray[midActiveCount]); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING184), rankText); + auto rankText = pb::get_rc_string(RankRcArray[midActiveCount]); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING184), rankText); mission_text_box->Display(Buffer, 8.0); soundwave10->Play(nullptr, "AddRankProgress"); } @@ -1220,7 +1218,7 @@ void control::DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballCompon { soundwave3->Play(nullptr, "DeploymentChuteToEscapeChuteOneWayControl"); int score = TableG->AddScore(caller->get_scoring(count - 1)); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING122), score); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING122), score); info_text_box->Display(Buffer, 2.0); if (!light_on(&control_lite56_tag)) { @@ -1283,7 +1281,7 @@ void control::LaunchRampControl(int code, TPinballComponent* caller) { someFlag = 1; int addedScore = SpecialAddScore(TableG->ScoreSpecial1); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING111), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING111), addedScore); info_text_box->Display(Buffer, 2.0); } if (light_on(&control_lite55_tag)) @@ -1369,7 +1367,7 @@ void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller) if (bump1->BmpIndex < 3) { attack_bump->Message(12, 0.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING106), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING106), 2.0); } attack_bump->Message(48, 60.0); } @@ -1425,7 +1423,7 @@ void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller) if (bump5->BmpIndex < 3) { launch_bump->Message(12, 0.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING107), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING107), 2.0); } launch_bump->Message(48, 60.0); } @@ -1523,7 +1521,7 @@ void control::BonusLaneRolloverControl(int code, TPinballComponent* caller) if (light_on(&control_lite16_tag)) { int addedScore = SpecialAddScore(TableG->ScoreSpecial2); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING104), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING104), addedScore); info_text_box->Display(Buffer, 2.0); lite16->Message(20, 0.0); soundwave50_1->Play(caller, "BonusLaneRolloverControl1"); @@ -1532,7 +1530,7 @@ void control::BonusLaneRolloverControl(int code, TPinballComponent* caller) { TableG->AddScore(caller->get_scoring(0)); soundwave25->Play(caller, "BonusLaneRolloverControl2"); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } fuel_bargraph->Message(45, 11.0); } @@ -1549,7 +1547,7 @@ void control::FuelRollover1Control(int code, TPinballComponent* caller) else { fuel_bargraph->Message(45, 1.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1566,7 +1564,7 @@ void control::FuelRollover2Control(int code, TPinballComponent* caller) else { fuel_bargraph->Message(45, 3.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1583,7 +1581,7 @@ void control::FuelRollover3Control(int code, TPinballComponent* caller) else { fuel_bargraph->Message(45, 5.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1600,7 +1598,7 @@ void control::FuelRollover4Control(int code, TPinballComponent* caller) else { fuel_bargraph->Message(45, 7.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1617,7 +1615,7 @@ void control::FuelRollover5Control(int code, TPinballComponent* caller) else { fuel_bargraph->Message(45, 9.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1634,7 +1632,7 @@ void control::FuelRollover6Control(int code, TPinballComponent* caller) else { fuel_bargraph->Message(45, 11.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1704,7 +1702,7 @@ void control::WormHoleControl(int code, TPinballComponent* caller) TableG->AddScore(sink->get_scoring(1)); } - info_text_box->Display(pinball::get_rc_string(Msg::STRING150), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING150), 2.0); wormhole_tag_array2[sinkFlag]->GetComponent()->Message(16, sink->TimerTime); wormhole_tag_array3[sinkFlag]->GetComponent()->Message(11, static_cast(2 - sinkFlag)); wormhole_tag_array3[sinkFlag]->GetComponent()->Message(16, sink->TimerTime); @@ -1724,7 +1722,7 @@ void control::WormHoleControl(int code, TPinballComponent* caller) wormhole_tag_array3[sinkFlag2]->GetComponent()->Message(11, static_cast(2 - sinkFlag2)); wormhole_tag_array3[sinkFlag2]->GetComponent()->Message(16, sink->TimerTime); wormhole_tag_array1[sinkFlag2]->GetComponent()->Message(56, sink->TimerTime); - info_text_box->Display(pinball::get_rc_string(Msg::STRING150), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING150), 2.0); } } @@ -1864,7 +1862,7 @@ void control::MultiplierLightGroupControl(int code, TPinballComponent* caller) TableG->ScoreMultiplier = 4; caller->Message(19, 0.0); caller->Message(43, 30.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING160), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING160), 2.0); break; case 65: TableG->ScoreMultiplier = 0; @@ -1899,7 +1897,7 @@ void control::FuelSpotTargetControl(int code, TPinballComponent* caller) top_circle_tgt_lights->Message(16, 2.0); fuel_bargraph->Message(45, 11.0); soundwave25->Play(caller, "FuelSpotTargetControl1"); - info_text_box->Display(pinball::get_rc_string(Msg::STRING145), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING145), 2.0); } else { @@ -2023,7 +2021,7 @@ void control::WormHoleDestinationControl(int code, TPinballComponent* caller) if (!light_on(&control_lite110_tag)) { lite110->Message(15, 3.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING194), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING194), 2.0); } TableG->AddScore(caller->get_scoring(0)); AdvanceWormHoleDestination(1); @@ -2037,7 +2035,7 @@ void control::BlackHoleKickoutControl(int code, TPinballComponent* caller) if (code == 63) { int addedScore = TableG->AddScore(caller->get_scoring(0)); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING181), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING181), addedScore); info_text_box->Display(Buffer, 2.0); caller->Message(55, -1.0); } @@ -2065,7 +2063,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller) case 63: { auto addedScore = TableG->AddScore(caller->get_scoring(0)); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING182), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING182), addedScore); info_text_box->Display(Buffer, 2.0); lite62->Message(20, 0.0); caller->ActiveFlag = 0; @@ -2078,11 +2076,11 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller) auto score = reinterpret_cast(caller); if (score) { - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING183), score); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING183), score); } else { - snprintf(Buffer, sizeof Buffer, "%s", pinball::get_rc_string(Msg::STRING146)); + snprintf(Buffer, sizeof Buffer, "%s", pb::get_rc_string(Msg::STRING146)); } info_text_box->Display(Buffer, 2.0); lite62->Message(4, 0.0); @@ -2210,7 +2208,7 @@ void control::MissionControl(int code, TPinballComponent* caller) l_trek_lights->Message(20, 0.0); r_trek_lights->Message(34, 0.0); r_trek_lights->Message(20, 0.0); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING210), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING210), 4.0); lite198->MessageField = 1; MissionControl(66, nullptr); } @@ -2220,7 +2218,7 @@ void control::MissionControl(int code, TPinballComponent* caller) { if (fuel_bargraph->Message(37, 0.0) == 1) { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING217), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING217), 4.0); } break; } @@ -2352,14 +2350,14 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) case 0: { auto addedScore = TableG->AddScore(caller->get_scoring(0)); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING113), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING113), addedScore); info_text_box->Display(Buffer, 2.0); break; } case 1: { auto addedScore = SpecialAddScore(TableG->ScoreSpecial3); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING115), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING115), addedScore); info_text_box->Display(Buffer, 2.0); TableG->ScoreSpecial3 = 20000; break; @@ -2368,7 +2366,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) { DrainBallBlockerControl(52, block1); auto addedScore = TableG->AddScore(caller->get_scoring(2)); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING103), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING103), addedScore); info_text_box->Display(Buffer, 2.0); break; } @@ -2376,7 +2374,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) { ExtraBallLightControl(19, nullptr); auto addedScore = TableG->AddScore(caller->get_scoring(3)); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING109), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING109), addedScore); info_text_box->Display(Buffer, 2.0); break; } @@ -2396,7 +2394,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) { someFlag = 1; auto addedScore = SpecialAddScore(TableG->ScoreSpecial1); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING111), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING111), addedScore); info_text_box->Display(Buffer, 2.0); } if (light_on(&control_lite26_tag)) @@ -2524,15 +2522,15 @@ void control::MedalTargetControl(int code, TPinballComponent* caller) { case 0: TableG->AddScore(caller->get_scoring(1)); - text = pinball::get_rc_string(Msg::STRING154); + text = pb::get_rc_string(Msg::STRING154); break; case 1: TableG->AddScore(caller->get_scoring(2)); - text = pinball::get_rc_string(Msg::STRING155); + text = pb::get_rc_string(Msg::STRING155); break; default: table_add_extra_ball(4.0); - text = pinball::get_rc_string(Msg::STRING156); + text = pb::get_rc_string(Msg::STRING156); break; } info_text_box->Display(text, 2.0); @@ -2563,19 +2561,19 @@ void control::MultiplierTargetControl(int code, TPinballComponent* caller) { case 1: TableG->ScoreMultiplier = 1; - text = pinball::get_rc_string(Msg::STRING157); + text = pb::get_rc_string(Msg::STRING157); break; case 2: TableG->ScoreMultiplier = 2; - text = pinball::get_rc_string(Msg::STRING158); + text = pb::get_rc_string(Msg::STRING158); break; case 3: TableG->ScoreMultiplier = 3; - text = pinball::get_rc_string(Msg::STRING159); + text = pb::get_rc_string(Msg::STRING159); break; default: TableG->ScoreMultiplier = 4; - text = pinball::get_rc_string(Msg::STRING160); + text = pb::get_rc_string(Msg::STRING160); break; } @@ -2607,8 +2605,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller) { soundwave3->Play(nullptr, "BallDrainControl1"); TableG->LightGroup->Message(16, 3.0); - const char* v11 = pinball::get_rc_string(Msg::STRING277); - mission_text_box->Display(v11, -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING277), -1.0); } } else @@ -2635,7 +2632,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller) { soundwave27->Play(nullptr, "BallDrainControl2"); lite200->Message(19, 0.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING197), -1.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING197), -1.0); soundwave59->Play(nullptr, "BallDrainControl3"); } else if (light_on(&control_lite199_tag)) @@ -2643,7 +2640,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller) soundwave27->Play(nullptr, "BallDrainControl4"); lite199->Message(20, 0.0); lite200->Message(19, 0.0); - info_text_box->Display(pinball::get_rc_string(Msg::STRING196), 2.0); + info_text_box->Display(pb::get_rc_string(Msg::STRING196), 2.0); soundwave59->Play(nullptr, "BallDrainControl5"); --TableG->UnknownP78; } @@ -2665,7 +2662,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller) if (!TableG->TiltLockFlag) { int time = SpecialAddScore(TableG->ScoreSpecial2); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING195), time); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING195), time); info_text_box->Display(Buffer, 2.0); } if (TableG->ExtraBalls) @@ -2677,17 +2674,17 @@ void control::BallDrainControl(int code, TPinballComponent* caller) switch (TableG->CurrentPlayer) { case 0: - shootAgainText = pinball::get_rc_string(Msg::STRING198); + shootAgainText = pb::get_rc_string(Msg::STRING198); break; case 1: - shootAgainText = pinball::get_rc_string(Msg::STRING199); + shootAgainText = pb::get_rc_string(Msg::STRING199); break; case 2: - shootAgainText = pinball::get_rc_string(Msg::STRING200); + shootAgainText = pb::get_rc_string(Msg::STRING200); break; default: case 3: - shootAgainText = pinball::get_rc_string(Msg::STRING201); + shootAgainText = pb::get_rc_string(Msg::STRING201); break; } info_text_box->Display(shootAgainText, -1.0); @@ -2814,7 +2811,7 @@ void control::AlienMenaceController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING275), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING275), -1.0); return; } if (bump1 == caller) @@ -2848,7 +2845,7 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING208), + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING208), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; @@ -2869,9 +2866,9 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller) lite311->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING231), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING231), 4.0); int addedScore = SpecialAddScore(750000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(7)) { mission_text_box->Display(Buffer, 8.0); @@ -2901,9 +2898,9 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) lite314->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING225), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING225), 4.0); int addedScore = SpecialAddScore(1000000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(8)) { mission_text_box->Display(Buffer, 8.0); @@ -2923,7 +2920,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) } if (bump5->BmpIndex) { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING224), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING224), -1.0); if (light_on(&control_lite316_tag)) lite316->Message(20, 0.0); if (!light_on(&control_lite314_tag)) @@ -2933,7 +2930,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) } else { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING223), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING223), -1.0); if (light_on(&control_lite314_tag)) lite314->Message(20, 0.0); if (!light_on(&control_lite316_tag)) @@ -2985,7 +2982,7 @@ void control::BugHuntController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING226), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING226), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3026,9 +3023,9 @@ void control::BugHuntController(int code, TPinballComponent* caller) lite319->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING227), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING227), 4.0); int addedScore = SpecialAddScore(750000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(7)) { mission_text_box->Display(Buffer, 8.0); @@ -3056,7 +3053,7 @@ void control::CosmicPlagueController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING240), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING240), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3093,7 +3090,7 @@ void control::CosmicPlaguePartTwoController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING241), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING241), -1.0); return; } if (roll9 == caller) @@ -3101,9 +3098,9 @@ void control::CosmicPlaguePartTwoController(int code, TPinballComponent* caller) lite310->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING242), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING242), 4.0); int addedScore = SpecialAddScore(1750000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(11)) { mission_text_box->Display(Buffer, 8.0); @@ -3128,7 +3125,7 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING238), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING238), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3145,9 +3142,9 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller) lite320->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING239), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING239), 4.0); int addedScore = SpecialAddScore(1250000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(9)) { mission_text_box->Display(Buffer, 8.0); @@ -3186,16 +3183,16 @@ void control::GameoverController(int code, TPinballComponent* caller) switch (nextPlayerId) { case 1: - playerNScoreText = pinball::get_rc_string(Msg::STRING280); + playerNScoreText = pb::get_rc_string(Msg::STRING280); break; case 2: - playerNScoreText = pinball::get_rc_string(Msg::STRING281); + playerNScoreText = pb::get_rc_string(Msg::STRING281); break; case 3: - playerNScoreText = pinball::get_rc_string(Msg::STRING282); + playerNScoreText = pb::get_rc_string(Msg::STRING282); break; case 4: - playerNScoreText = pinball::get_rc_string(Msg::STRING283); + playerNScoreText = pb::get_rc_string(Msg::STRING283); break; default: break; @@ -3223,19 +3220,19 @@ void control::GameoverController(int code, TPinballComponent* caller) switch (nextHidhscoreId) { case 1: - highScoreNText = pinball::get_rc_string(Msg::STRING284); + highScoreNText = pb::get_rc_string(Msg::STRING284); break; case 2: - highScoreNText = pinball::get_rc_string(Msg::STRING285); + highScoreNText = pb::get_rc_string(Msg::STRING285); break; case 3: - highScoreNText = pinball::get_rc_string(Msg::STRING286); + highScoreNText = pb::get_rc_string(Msg::STRING286); break; case 4: - highScoreNText = pinball::get_rc_string(Msg::STRING287); + highScoreNText = pb::get_rc_string(Msg::STRING287); break; case 5: - highScoreNText = pinball::get_rc_string(Msg::STRING288); + highScoreNText = pb::get_rc_string(Msg::STRING288); break; default: break; @@ -3252,7 +3249,7 @@ void control::GameoverController(int code, TPinballComponent* caller) } mission_text_box->MessageField = 0x100; - mission_text_box->Display(pinball::get_rc_string(Msg::STRING272), 10.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING272), 10.0); } void control::LaunchTrainingController(int code, TPinballComponent* caller) @@ -3270,7 +3267,7 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING211), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING211), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3286,9 +3283,9 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller) lite317->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING212), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING212), 4.0); int addedScore = SpecialAddScore(500000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(6)) { mission_text_box->Display(Buffer, 8.0); @@ -3315,7 +3312,7 @@ void control::MaelstromController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING249), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING249), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3360,7 +3357,7 @@ void control::MaelstromPartEightController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING256), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING256), -1.0); return; } if (kickout2 == caller) @@ -3370,8 +3367,8 @@ void control::MaelstromPartEightController(int code, TPinballComponent* caller) lite198->MessageField = 1; MissionControl(66, nullptr); int addedScore = SpecialAddScore(5000000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); - info_text_box->Display(pinball::get_rc_string(Msg::STRING149), 4.0); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); + info_text_box->Display(pb::get_rc_string(Msg::STRING149), 4.0); if (!AddRankProgress(18)) { mission_text_box->Display(Buffer, 8.0); @@ -3392,7 +3389,7 @@ void control::MaelstromPartFiveController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING253), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING253), -1.0); return; } if (ramp == caller) @@ -3416,7 +3413,7 @@ void control::MaelstromPartFourController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING252), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING252), -1.0); return; } if (roll184 == caller) @@ -3442,7 +3439,7 @@ void control::MaelstromPartSevenController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING255), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING255), -1.0); return; } if (sink1 == caller @@ -3469,7 +3466,7 @@ void control::MaelstromPartSixController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING254), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING254), -1.0); return; } if (flag1 == caller || flag2 == caller) @@ -3503,7 +3500,7 @@ void control::MaelstromPartThreeController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING251), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING251), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3557,7 +3554,7 @@ void control::MaelstromPartTwoController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING250), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING250), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3609,7 +3606,7 @@ void control::PracticeMissionController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING208), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING208), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3630,9 +3627,9 @@ void control::PracticeMissionController(int code, TPinballComponent* caller) lite311->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING209), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING209), 4.0); int addedScore = SpecialAddScore(500000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(6)) { mission_text_box->Display(Buffer, 8.0); @@ -3662,7 +3659,7 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING235), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING235), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3693,9 +3690,9 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller) lite321->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING237), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING237), 4.0); int addedScore = SpecialAddScore(1250000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(9)) { mission_text_box->Display(Buffer, 8.0); @@ -3726,7 +3723,7 @@ void control::ReentryTrainingController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING213), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING213), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3744,9 +3741,9 @@ void control::ReentryTrainingController(int code, TPinballComponent* caller) lite307->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING214), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING214), 4.0); int addedScore = SpecialAddScore(500000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(6)) { mission_text_box->Display(Buffer, 8.0); @@ -3785,9 +3782,9 @@ void control::RescueMissionController(int code, TPinballComponent* caller) lite304->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING230), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING230), 4.0); int addedScore = SpecialAddScore(750000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(7)) { mission_text_box->Display(Buffer, 8.0); @@ -3803,7 +3800,7 @@ void control::RescueMissionController(int code, TPinballComponent* caller) case 67: if (light_on(&control_lite20_tag)) { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING229), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING229), -1.0); if (light_on(&control_lite303_tag)) lite303->Message(20, 0.0); if (!light_on(&control_lite304_tag)) @@ -3813,7 +3810,7 @@ void control::RescueMissionController(int code, TPinballComponent* caller) } else { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING228), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING228), -1.0); if (light_on(&control_lite304_tag)) lite304->Message(20, 0.0); if (!light_on(&control_lite303_tag)) @@ -3842,7 +3839,7 @@ void control::SatelliteController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING233), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING233), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3858,9 +3855,9 @@ void control::SatelliteController(int code, TPinballComponent* caller) lite308->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING234), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING234), 4.0); int addedScore = SpecialAddScore(1250000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(9)) { mission_text_box->Display(Buffer, 8.0); @@ -3905,7 +3902,7 @@ void control::ScienceMissionController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING215), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING215), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -3931,9 +3928,9 @@ void control::ScienceMissionController(int code, TPinballComponent* caller) lite315->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING216), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING216), 4.0); int addedScore = SpecialAddScore(750000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(9)) { mission_text_box->Display(Buffer, 8.0); @@ -3960,7 +3957,7 @@ void control::SecretMissionGreenController(int code, TPinballComponent* caller) { return; } - const char* v2 = pinball::get_rc_string(Msg::STRING245); + const char* v2 = pb::get_rc_string(Msg::STRING245); mission_text_box->Display(v2, -1.0); return; } @@ -3968,9 +3965,9 @@ void control::SecretMissionGreenController(int code, TPinballComponent* caller) { lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING246), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING246), 4.0); int addedScore = SpecialAddScore(1500000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(10)) { mission_text_box->Display(Buffer, 8.0); @@ -3994,7 +3991,7 @@ void control::SecretMissionRedController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING244), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING244), -1.0); return; } if (sink1 == caller) @@ -4023,7 +4020,7 @@ void control::SecretMissionYellowController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING243), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING243), -1.0); return; } if (sink3 == caller) @@ -4073,7 +4070,7 @@ void control::SelectMissionController(int code, TPinballComponent* caller) auto scoreId = lite56->MessageField - 2; MissionControl(66, nullptr); int addedScore = SpecialAddScore(mission_select_scores[scoreId]); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING178), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING178), addedScore); mission_text_box->Display(Buffer, 4.0); midi::play_track(MidiTracks::Track2, true); } @@ -4213,8 +4210,8 @@ void control::SelectMissionController(int code, TPinballComponent* caller) { if (light_on(&control_lite56_tag)) { - auto missionText = pinball::get_rc_string(MissionRcArray[lite56->MessageField - 2]); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING207), missionText); + auto missionText = pb::get_rc_string(MissionRcArray[lite56->MessageField - 2]); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING207), missionText); mission_text_box->Display(Buffer, -1.0); if (light_on(&control_lite318_tag)) lite318->Message(20, 0.0); @@ -4225,7 +4222,7 @@ void control::SelectMissionController(int code, TPinballComponent* caller) } else { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING205), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING205), -1.0); if (light_on(&control_lite317_tag)) lite317->Message(20, 0.0); if (light_on(&control_lite318_tag)) @@ -4238,7 +4235,7 @@ void control::SelectMissionController(int code, TPinballComponent* caller) } else { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING206), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING206), -1.0); if (light_on(&control_lite317_tag)) lite317->Message(20, 0.0); if (light_on(&control_lite319_tag)) @@ -4276,9 +4273,9 @@ void control::SpaceRadiationController(int code, TPinballComponent* caller) { lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING222), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING222), 4.0); int addedScore = SpecialAddScore(1000000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(8)) { mission_text_box->Display(Buffer, 8.0); @@ -4298,9 +4295,9 @@ void control::SpaceRadiationController(int code, TPinballComponent* caller) { const char* text; if (lite104->MessageField == 15) - text = pinball::get_rc_string(Msg::STRING221); + text = pb::get_rc_string(Msg::STRING221); else - text = pinball::get_rc_string(Msg::STRING276); + text = pb::get_rc_string(Msg::STRING276); mission_text_box->Display(text, -1.0); } } @@ -4329,9 +4326,9 @@ void control::StrayCometController(int code, TPinballComponent* caller) lite304->Message(20, 0.0); lite198->MessageField = 1; MissionControl(66, nullptr); - mission_text_box->Display(pinball::get_rc_string(Msg::STRING220), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING220), 4.0); int addedScore = SpecialAddScore(1000000); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING179), addedScore); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING179), addedScore); if (!AddRankProgress(8)) { mission_text_box->Display(Buffer, 8.0); @@ -4351,9 +4348,9 @@ void control::StrayCometController(int code, TPinballComponent* caller) { const char* text; if (lite107->MessageField == 15) - text = pinball::get_rc_string(Msg::STRING219); + text = pb::get_rc_string(Msg::STRING219); else - text = pinball::get_rc_string(Msg::STRING218); + text = pb::get_rc_string(Msg::STRING218); mission_text_box->Display(text, -1.0); } } @@ -4375,7 +4372,7 @@ void control::TimeWarpController(int code, TPinballComponent* caller) { return; } - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING247), lite56->MessageField); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING247), lite56->MessageField); mission_text_box->Display(Buffer, -1.0); return; } @@ -4416,17 +4413,17 @@ void control::TimeWarpPartTwoController(int code, TPinballComponent* caller) { return; } - mission_text_box->Display(pinball::get_rc_string(Msg::STRING248), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING248), -1.0); return; } if (kickout2 == caller) { - mission_text_box->Display(pinball::get_rc_string(Msg::STRING148), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING148), 4.0); if (middle_circle->Message(37, 0.0) > 1) { middle_circle->Message(33, 5.0); int rank = middle_circle->Message(37, 0.0); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING274), pinball::get_rc_string(RankRcArray[rank - 1])); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING274), pb::get_rc_string(RankRcArray[rank - 1])); mission_text_box->Display(Buffer, 8.0); } } @@ -4434,12 +4431,12 @@ void control::TimeWarpPartTwoController(int code, TPinballComponent* caller) { if (ramp != caller) return; - mission_text_box->Display(pinball::get_rc_string(Msg::STRING147), 4.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING147), 4.0); if (middle_circle->Message(37, 0.0) < 9) { int rank = middle_circle->Message(37, 0.0); middle_circle->Message(41, 5.0); - snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(Msg::STRING273), pinball::get_rc_string(RankRcArray[rank])); + snprintf(Buffer, sizeof Buffer, pb::get_rc_string(Msg::STRING273), pb::get_rc_string(RankRcArray[rank])); } if (!AddRankProgress(12)) { @@ -4480,7 +4477,7 @@ void control::WaitingDeploymentController(int code, TPinballComponent* caller) midi::play_track(MidiTracks::Track1, false); break; case 67: - mission_text_box->Display(pinball::get_rc_string(Msg::STRING151), -1.0); + mission_text_box->Display(pb::get_rc_string(Msg::STRING151), -1.0); break; default: break; diff --git a/SpaceCadetPinball/font_selection.cpp b/SpaceCadetPinball/font_selection.cpp index c0eb092..ac0cfe8 100644 --- a/SpaceCadetPinball/font_selection.cpp +++ b/SpaceCadetPinball/font_selection.cpp @@ -2,7 +2,7 @@ #include "font_selection.h" #include "options.h" -#include "pinball.h" +#include "pb.h" #include "score.h" #include "winmain.h" #include "translations.h" @@ -35,7 +35,7 @@ void font_selection::RenderDialog() ImGui::SameLine(); ImGui::InputText("", DialogInputBuffer, IM_ARRAYSIZE(DialogInputBuffer)); - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Ok))) + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Ok))) { options::Options.FontFileName = DialogInputBuffer; ImGui::CloseCurrentPopup(); @@ -43,7 +43,7 @@ void font_selection::RenderDialog() } ImGui::SameLine(); - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Cancel))) + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Cancel))) ImGui::CloseCurrentPopup(); ImGui::EndPopup(); diff --git a/SpaceCadetPinball/gdrv.cpp b/SpaceCadetPinball/gdrv.cpp index 46dfb3a..57f5a07 100644 --- a/SpaceCadetPinball/gdrv.cpp +++ b/SpaceCadetPinball/gdrv.cpp @@ -8,7 +8,6 @@ #include "winmain.h" #include "TTextBox.h" #include "fullscrn.h" -#include "pinball.h" ColorRgba gdrv::current_palette[256]{}; @@ -274,7 +273,7 @@ void gdrv::ScrollBitmapHorizontal(gdrv_bitmap8* bmp, int xStart) void gdrv::grtext_draw_ttext_in_box() { - for (const auto textBox : { pinball::InfoTextBox, pinball::MissTextBox }) + for (const auto textBox : { pb::InfoTextBox, pb::MissTextBox }) { if (textBox) { diff --git a/SpaceCadetPinball/high_score.cpp b/SpaceCadetPinball/high_score.cpp index 5398e1b..e2c48ce 100644 --- a/SpaceCadetPinball/high_score.cpp +++ b/SpaceCadetPinball/high_score.cpp @@ -2,7 +2,7 @@ #include "high_score.h" #include "options.h" -#include "pinball.h" +#include "pb.h" #include "score.h" #include "translations.h" @@ -122,7 +122,7 @@ void high_score::RenderHighScoreDialog() if (ShowDialog == true) { ShowDialog = false; - if (!ImGui::IsPopupOpen(pinball::get_rc_string(Msg::HIGHSCORES_Caption))) + if (!ImGui::IsPopupOpen(pb::get_rc_string(Msg::HIGHSCORES_Caption))) { dlg_enter_name = false; while (!ScoreQueue.empty()) @@ -141,19 +141,19 @@ void high_score::RenderHighScoreDialog() } } - ImGui::OpenPopup(pinball::get_rc_string(Msg::HIGHSCORES_Caption)); + ImGui::OpenPopup(pb::get_rc_string(Msg::HIGHSCORES_Caption)); } } bool unused_open = true; - if (ImGui::BeginPopupModal(pinball::get_rc_string(Msg::HIGHSCORES_Caption), &unused_open, ImGuiWindowFlags_AlwaysAutoResize)) + if (ImGui::BeginPopupModal(pb::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(Msg::HIGHSCORES_Rank)); - ImGui::TableSetupColumn(pinball::get_rc_string(Msg::HIGHSCORES_Name)); - ImGui::TableSetupColumn(pinball::get_rc_string(Msg::HIGHSCORES_Score)); + ImGui::TableSetupColumn(pb::get_rc_string(Msg::HIGHSCORES_Rank)); + ImGui::TableSetupColumn(pb::get_rc_string(Msg::HIGHSCORES_Name)); + ImGui::TableSetupColumn(pb::get_rc_string(Msg::HIGHSCORES_Score)); ImGui::TableHeadersRow(); for (int offset = 0, row = 0; row < 5; row++) @@ -185,7 +185,7 @@ void high_score::RenderHighScoreDialog() ImGui::EndTable(); } - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Ok))) + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Ok))) { if (dlg_enter_name) { @@ -195,23 +195,23 @@ void high_score::RenderHighScoreDialog() } ImGui::SameLine(); - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Cancel))) + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Cancel))) ImGui::CloseCurrentPopup(); ImGui::SameLine(); - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Clear))) + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Clear))) ImGui::OpenPopup("Confirm"); if (ImGui::BeginPopupModal("Confirm", nullptr, ImGuiWindowFlags_MenuBar)) { - ImGui::TextUnformatted(pinball::get_rc_string(Msg::STRING141)); - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Ok), ImVec2(120, 0))) + ImGui::TextUnformatted(pb::get_rc_string(Msg::STRING141)); + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Ok), ImVec2(120, 0))) { clear_table(); ImGui::CloseCurrentPopup(); } ImGui::SetItemDefaultFocus(); ImGui::SameLine(); - if (ImGui::Button(pinball::get_rc_string(Msg::HIGHSCORES_Cancel), ImVec2(120, 0))) + if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Cancel), ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); } @@ -221,7 +221,7 @@ void high_score::RenderHighScoreDialog() ImGui::EndPopup(); // Reenter dialog for the next score in the queue - if (!ImGui::IsPopupOpen(pinball::get_rc_string(Msg::HIGHSCORES_Caption)) && !ScoreQueue.empty()) + if (!ImGui::IsPopupOpen(pb::get_rc_string(Msg::HIGHSCORES_Caption)) && !ScoreQueue.empty()) { ShowDialog = true; } diff --git a/SpaceCadetPinball/loader.cpp b/SpaceCadetPinball/loader.cpp index e123a9b..df5a572 100644 --- a/SpaceCadetPinball/loader.cpp +++ b/SpaceCadetPinball/loader.cpp @@ -3,7 +3,6 @@ #include "GroupData.h" #include "TPinballComponent.h" #include "pb.h" -#include "pinball.h" #include "Sound.h" #include "zdrv.h" @@ -138,7 +137,7 @@ int loader::get_sound_id(int groupIndex) int soundGroupId = sound_list[soundIndex].GroupIndex; sound_list[soundIndex].Duration = 0.0; - if (soundGroupId > 0 && !pinball::quickFlag) + if (soundGroupId > 0 && !pb::quickFlag) { auto value = reinterpret_cast(loader_table->field(soundGroupId, FieldTypes::ShortValue)); @@ -157,7 +156,7 @@ int loader::get_sound_id(int groupIndex) } float duration = -1; - auto filePath = pinball::make_path_name(fileName); + auto filePath = pb::make_path_name(fileName); auto file = fopenu(filePath.c_str(), "rb"); if (file) { diff --git a/SpaceCadetPinball/midi.cpp b/SpaceCadetPinball/midi.cpp index 3e51f91..8138f54 100644 --- a/SpaceCadetPinball/midi.cpp +++ b/SpaceCadetPinball/midi.cpp @@ -3,7 +3,6 @@ #include "pb.h" -#include "pinball.h" std::vector midi::LoadedTracks{}; @@ -118,7 +117,7 @@ Mix_Music* midi::load_track(std::string fileName) // FT has music in two formats, depending on game version: MIDI in 16bit, MIDS in 32bit. // 3DPB music is MIDI only. - auto basePath = pinball::make_path_name(fileName); + auto basePath = pb::make_path_name(fileName); for (int i = 0; i <= 1 && !audio; i++) { if (i == 0) diff --git a/SpaceCadetPinball/options.cpp b/SpaceCadetPinball/options.cpp index a239953..7a9b4e2 100644 --- a/SpaceCadetPinball/options.cpp +++ b/SpaceCadetPinball/options.cpp @@ -3,7 +3,7 @@ #include "fullscrn.h" #include "midi.h" -#include "pinball.h" +#include "pb.h" #include "render.h" #include "Sound.h" #include "winmain.h" @@ -345,16 +345,16 @@ void options::RenderControlDialog() return; ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2{550, 450}); - if (ImGui::Begin(pinball::get_rc_string(Msg::KEYMAPPER_Caption), &ShowDialog)) + if (ImGui::Begin(pb::get_rc_string(Msg::KEYMAPPER_Caption), &ShowDialog)) { - ImGui::TextUnformatted(pinball::get_rc_string(Msg::KEYMAPPER_Groupbox2)); + ImGui::TextUnformatted(pb::get_rc_string(Msg::KEYMAPPER_Groupbox2)); ImGui::Separator(); - ImGui::TextWrapped("%s", pinball::get_rc_string(Msg::KEYMAPPER_Help1)); - ImGui::TextWrapped("%s", pinball::get_rc_string(Msg::KEYMAPPER_Help2)); + ImGui::TextWrapped("%s", pb::get_rc_string(Msg::KEYMAPPER_Help1)); + ImGui::TextWrapped("%s", pb::get_rc_string(Msg::KEYMAPPER_Help2)); ImGui::Spacing(); - ImGui::TextUnformatted(pinball::get_rc_string(Msg::KEYMAPPER_Groupbox1)); + ImGui::TextUnformatted(pb::get_rc_string(Msg::KEYMAPPER_Groupbox1)); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{5, 10}); if (ImGui::BeginTable("Controls", 4, ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) @@ -370,7 +370,7 @@ void options::RenderControlDialog() { ImGui::TableNextColumn(); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{0.5, 0, 0, 1}); - if (ImGui::Button(pinball::get_rc_string(row.NameStringId))) + if (ImGui::Button(pb::get_rc_string(row.NameStringId))) { for (auto i = 0u; i <= 2; i++) row.Option[i] = {}; @@ -423,20 +423,20 @@ void options::RenderControlDialog() ImGui::PopStyleVar(); ImGui::Spacing(); - if (ImGui::Button(pinball::get_rc_string(Msg::KEYMAPPER_Ok))) + if (ImGui::Button(pb::get_rc_string(Msg::KEYMAPPER_Ok))) { Options.Key = RebindControls; ShowDialog = false; } ImGui::SameLine(); - if (ImGui::Button(pinball::get_rc_string(Msg::KEYMAPPER_Cancel))) + if (ImGui::Button(pb::get_rc_string(Msg::KEYMAPPER_Cancel))) { ShowDialog = false; } ImGui::SameLine(); - if (ImGui::Button(pinball::get_rc_string(Msg::KEYMAPPER_Default))) + if (ImGui::Button(pb::get_rc_string(Msg::KEYMAPPER_Default))) { RebindControls = Options.KeyDft; ControlWaitingForInput = nullptr; diff --git a/SpaceCadetPinball/pb.cpp b/SpaceCadetPinball/pb.cpp index 7c5ab7c..e583d98 100644 --- a/SpaceCadetPinball/pb.cpp +++ b/SpaceCadetPinball/pb.cpp @@ -5,7 +5,6 @@ #include "control.h" #include "fullscrn.h" #include "high_score.h" -#include "pinball.h" #include "proj.h" #include "render.h" #include "loader.h" @@ -35,8 +34,10 @@ int pb::time_ticks = 0; GameModes pb::game_mode = GameModes::GameOver; float pb::time_now = 0, pb::time_next = 0, pb::ball_speed_limit, pb::time_ticks_remainder = 0; bool pb::FullTiltMode = false, pb::FullTiltDemoMode = false, pb::cheat_mode = false, pb::demo_mode = false; -std::string pb::DatFileName; +std::string pb::DatFileName, pb::BasePath; ImU32 pb::TextBoxColor; +int pb::quickFlag = 0; +TTextBox *pb::InfoTextBox, *pb::MissTextBox; int pb::init() @@ -45,11 +46,11 @@ int pb::init() if (DatFileName.empty()) return 1; - auto dataFilePath = pinball::make_path_name(DatFileName); + auto dataFilePath = make_path_name(DatFileName); record_table = partman::load_records(dataFilePath.c_str(), FullTiltMode); auto useBmpFont = 0; - pinball::get_rc_int(Msg::TextBoxUseBitmapFont, &useBmpFont); + get_rc_int(Msg::TextBoxUseBitmapFont, &useBmpFont); if (useBmpFont) score::load_msg_font("pbmsg_ft"); @@ -104,7 +105,7 @@ int pb::init() ball_speed_limit = MainTable->BallList.at(0)->Offset * 200.0f; int red = 255, green = 255, blue = 255; - auto fontColor = pinball::get_rc_string(Msg::TextBoxColor); + auto fontColor = get_rc_string(Msg::TextBoxColor); if (fontColor) sscanf(fontColor, "%d %d %d", &red, &green, &blue); TextBoxColor = IM_COL32(red, green, blue, 255); @@ -144,10 +145,10 @@ void pb::SelectDatFile(const std::vector& dataSearchPaths) { if (DatFileName.empty() && path) { - pinball::BasePath = path; + BasePath = path; for (auto datFileName : datFileNames) { - auto datFilePath = pinball::make_path_name(datFileName); + auto datFilePath = make_path_name(datFileName); auto datFile = fopenu(datFilePath.c_str(), "r"); if (datFile) { @@ -227,9 +228,8 @@ void pb::toggle_demo() demo_mode = false; MainTable->Message(1024, 0.0); mode_change(GameModes::GameOver); - pinball::MissTextBox->Clear(); - auto text = pinball::get_rc_string(Msg::STRING125); - pinball::InfoTextBox->Display(text, -1.0); + MissTextBox->Clear(); + InfoTextBox->Display(get_rc_string(Msg::STRING125), -1.0); } else { @@ -297,7 +297,7 @@ void pb::frame(float dtMilliSec) { if (nudge::nudge_count > 0.5f) { - pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING126), 2.0); + InfoTextBox->Display(get_rc_string(Msg::STRING126), 2.0); } if (nudge::nudge_count > 1.0f) MainTable->tilt(time_now); @@ -369,13 +369,13 @@ void pb::window_size(int* width, int* height) void pb::pause_continue() { winmain::single_step ^= true; - pinball::InfoTextBox->Clear(); - pinball::MissTextBox->Clear(); + InfoTextBox->Clear(); + MissTextBox->Clear(); if (winmain::single_step) { if (MainTable) MainTable->Message(1008, time_now); - pinball::InfoTextBox->Display(pinball::get_rc_string(Msg::STRING123), -1.0); + InfoTextBox->Display(get_rc_string(Msg::STRING123), -1.0); midi::music_stop(); Sound::Deactivate(); } @@ -390,14 +390,14 @@ void pb::pause_continue() if (game_mode == GameModes::GameOver) { textTime = -1.0; - text = pinball::get_rc_string(Msg::STRING125); + text = get_rc_string(Msg::STRING125); } else { textTime = 5.0; - text = pinball::get_rc_string(Msg::STRING124); + text = get_rc_string(Msg::STRING124); } - pinball::InfoTextBox->Display(text, textTime); + InfoTextBox->Display(text, textTime); } if (options::Options.Music && !winmain::single_step) midi::music_play(); @@ -490,7 +490,7 @@ void pb::InputDown(GameInput input) case 'h': { high_score_struct entry{ {0}, 1000000000 }; - strncpy(entry.Name, pinball::get_rc_string(Msg::STRING127), sizeof entry.Name - 1); + strncpy(entry.Name, get_rc_string(Msg::STRING127), sizeof entry.Name - 1); high_score::show_and_set_high_score_dialog({ entry, 1 }); break; } @@ -561,11 +561,13 @@ void pb::end_game() high_score_struct entry{ {0}, scores[i] }; const char* playerName = "Player"; - switch(scoreIndex[i]) { - 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; + switch(scoreIndex[i]) + { + default: + case 0: playerName = get_rc_string(Msg::STRING127); break; + case 1: playerName = get_rc_string(Msg::STRING128); break; + case 2: playerName = get_rc_string(Msg::STRING129); break; + case 3: playerName = get_rc_string(Msg::STRING130); break; } strncpy(entry.Name, playerName, sizeof entry.Name - 1); @@ -583,7 +585,7 @@ void pb::high_scores() void pb::tilt_no_more() { if (MainTable->TiltLockFlag) - pinball::InfoTextBox->Clear(); + InfoTextBox->Clear(); MainTable->TiltLockFlag = 0; nudge::nudge_count = -2.0; } @@ -657,3 +659,19 @@ bool pb::AnyBindingMatchesInput(GameInput (&options)[3], GameInput key) return true; return false; } + +LPCSTR pb::get_rc_string(Msg uID) +{ + return translations::GetTranslation(uID); +} + +int pb::get_rc_int(Msg uID, int* dst) +{ + *dst = atoi(get_rc_string(uID)); + return 1; +} + +std::string pb::make_path_name(const std::string& fileName) +{ + return BasePath + fileName; +} diff --git a/SpaceCadetPinball/pb.h b/SpaceCadetPinball/pb.h index 2a189e5..2e6c3d6 100644 --- a/SpaceCadetPinball/pb.h +++ b/SpaceCadetPinball/pb.h @@ -5,6 +5,8 @@ struct GameInput; class TPinballTable; class DatFile; class TBall; +class TTextBox; +enum class Msg : int; enum class GameModes { @@ -46,8 +48,10 @@ public: static DatFile* record_table; static TPinballTable* MainTable; static bool FullTiltMode, FullTiltDemoMode; - static std::string DatFileName; + static std::string DatFileName, BasePath; static ImU32 TextBoxColor; + static int quickFlag; + static TTextBox *InfoTextBox, *MissTextBox; static int init(); static int uninit(); @@ -72,6 +76,9 @@ public: static bool chk_highscore(); static float collide(float timeNow, float timeDelta, TBall* ball); static void PushCheat(const std::string& cheat); + static LPCSTR 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 bool demo_mode; diff --git a/SpaceCadetPinball/pinball.cpp b/SpaceCadetPinball/pinball.cpp deleted file mode 100644 index 5bba1ff..0000000 --- a/SpaceCadetPinball/pinball.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "pch.h" -#include "pinball.h" -#include "translations.h" -#include "winmain.h" - -int LoadStringAlt(Msg uID, LPSTR lpBuffer, int cchBufferMax) -{ - const char* text = translations::GetTranslation(uID); - - strncpy(lpBuffer, text, cchBufferMax); - return 1; -} - -int pinball::quickFlag = 0; -TTextBox* pinball::InfoTextBox; -TTextBox* pinball::MissTextBox; -char pinball::getRcBuffer[6 * 256]; -int pinball::rc_string_slot = 0; -int pinball::LeftShift = -1; -int pinball::RightShift = -1; -std::string pinball::BasePath; - -char* pinball::get_rc_string(Msg uID) -{ - char* result = &getRcBuffer[256 * rc_string_slot]; - if (!LoadStringAlt(uID, &getRcBuffer[256 * rc_string_slot], 255)) - *result = 0; - - if (++rc_string_slot >= 6) - rc_string_slot = 0; - return result; -} - -int pinball::get_rc_int(Msg uID, int* dst) -{ - char buffer[255]; - int result = LoadStringAlt(uID, buffer, 255); - if (!result) - return result; - *dst = atoi(buffer); - return 1; -} - -std::string pinball::make_path_name(const std::string& fileName) -{ - return BasePath + fileName; -} diff --git a/SpaceCadetPinball/pinball.h b/SpaceCadetPinball/pinball.h deleted file mode 100644 index 5d88fa2..0000000 --- a/SpaceCadetPinball/pinball.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -class TTextBox; -enum class Msg : int; - -class pinball -{ -public: - static int quickFlag; - static TTextBox* InfoTextBox; - static TTextBox* MissTextBox; - static int RightShift; - static int LeftShift; - static std::string BasePath; - - 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]; - static int rc_string_slot; -}; diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp index 9ff7f7c..0a1ab50 100644 --- a/SpaceCadetPinball/winmain.cpp +++ b/SpaceCadetPinball/winmain.cpp @@ -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();