1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-23 09:20:19 +01:00

Compare commits

..

No commits in common. "1391eeba81b973ca6c8dd1c7a0955329cd453772" and "80947888a06767b06ce92b73bd7503ee2f4fd65c" have entirely different histories.

7 changed files with 35 additions and 54 deletions

View file

@ -1,5 +1,5 @@
#include "pch.h"
#include "options.h"
#include "pch.h"
#include "Sound.h"
#include "maths.h"

View file

@ -1,4 +1,8 @@
// SpaceCadetPinball.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include "winmain.h"
int main(int argc, char* argv[])

View file

@ -48,9 +48,7 @@ int TBlocker::Message(MessageCode code, float value)
SpriteSet(0);
if (Timer)
timer::kill(Timer);
Timer = 0;
if (value >= 0)
Timer = timer::set(value, this, TimerExpired);
Timer = timer::set(std::max(value, 0.0f), this, TimerExpired);
break;
case MessageCode::TBlockerRestartTimeout:
if (Timer)

View file

@ -393,8 +393,6 @@ int TPinballTable::Message(MessageCode code, float value)
}
else
{
// Some of the control cheats persist across games.
// Was this loose anti-cheat by design?
CheatsUsed = 0;
Message(MessageCode::Reset, 0.0);
auto ball = BallList[0];

View file

@ -771,7 +771,7 @@ component_tag_base* control::simple_components[145]
};
int control::waiting_deployment_flag;
bool control::table_unlimited_balls = false, control::easyMode = false;
bool control::table_unlimited_balls = false;
int control::extraball_light_flag;
Msg control::RankRcArray[9] =
{
@ -903,7 +903,7 @@ void control::pbctrl_bdoor_controller(char key)
{
// Buffer large enough for longest cheat + null
static char cheatBuffer[11 + 1]{};
static const char* bufferEnd = &cheatBuffer[11];
static char* bufferEnd = &cheatBuffer[11];
static const char* quotes[8]
{
"Hey, is that a screen saver?",
@ -949,18 +949,6 @@ void control::pbctrl_bdoor_controller(char key)
mission_text_box->Display(quote, time += 3);
return;
}
else if (strcmp(bufferEnd - 9, "easy mode") == 0)
{
easyMode ^= true;
if (easyMode)
{
DrainBallBlockerControl(MessageCode::TBlockerEnable, block1);
gate1->Message(MessageCode::TGateDisable, 0.0);
gate2->Message(MessageCode::TGateDisable, 0.0);
}
else
DrainBallBlockerControl(MessageCode::ControlTimerExpired, block1);
}
else
{
return;
@ -1177,13 +1165,13 @@ void control::BumperControl(MessageCode code, TPinballComponent* caller)
void control::LeftKickerControl(MessageCode code, TPinballComponent* caller)
{
if (code == MessageCode::ControlTimerExpired && !easyMode)
if (code == MessageCode::ControlTimerExpired)
gate1->Message(MessageCode::TGateEnable, 0.0);
}
void control::RightKickerControl(MessageCode code, TPinballComponent* caller)
{
if (code == MessageCode::ControlTimerExpired && !easyMode)
if (code == MessageCode::ControlTimerExpired)
gate2->Message(MessageCode::TGateEnable, 0.0);
}
@ -1247,36 +1235,33 @@ void control::DeploymentChuteToTableOneWayControl(MessageCode code, TPinballComp
void control::DrainBallBlockerControl(MessageCode code, TPinballComponent* caller)
{
MessageCode lightMessage;
float blockerDuration;
auto block = static_cast<TBlocker*>(caller);
switch (code)
{
case MessageCode::TBlockerEnable:
if (code == MessageCode::TBlockerEnable)
{
block->MessageField = 1;
auto blockerDuration = !easyMode ? static_cast<float>(block->InitialDuration) : -1;
blockerDuration = static_cast<float>(block->InitialDuration);
block->Message(MessageCode::TBlockerEnable, blockerDuration);
lite1->Message(MessageCode::TLightTurnOnTimed, blockerDuration);
break;
}
case MessageCode::ControlTimerExpired:
{
if (block->MessageField == 1)
{
block->MessageField = 2;
auto blockerDuration = static_cast<float>(block->ExtendedDuration);
block->Message(MessageCode::TBlockerRestartTimeout, blockerDuration);
lite1->Message(MessageCode::TLightFlasherStartTimed, blockerDuration);
break;
lightMessage = MessageCode::TLightTurnOnTimed;
}
else
{
if (code != MessageCode::ControlTimerExpired)
return;
if (block->MessageField != 1)
{
block->MessageField = 0;
block->Message(MessageCode::TBlockerDisable, 0.0);
break;
return;
}
block->MessageField = 2;
blockerDuration = static_cast<float>(block->ExtendedDuration);
block->Message(MessageCode::TBlockerRestartTimeout, blockerDuration);
lightMessage = MessageCode::TLightFlasherStartTimed;
}
default: break;
}
lite1->Message(lightMessage, blockerDuration);
}
void control::LaunchRampControl(MessageCode code, TPinballComponent* caller)
@ -2493,8 +2478,6 @@ void control::PlungerControl(MessageCode code, TPinballComponent* caller)
if (code == MessageCode::PlungerFeedBall)
{
MissionControl(MessageCode::ControlMissionStarted, nullptr);
if (easyMode && !block1->ActiveFlag)
DrainBallBlockerControl(MessageCode::TBlockerEnable, block1);
}
else if (code == MessageCode::PlungerStartFeedTimer)
{

View file

@ -68,7 +68,7 @@ public:
static component_info score_components[88];
static component_tag_base* simple_components[145];
static int waiting_deployment_flag;
static bool table_unlimited_balls, easyMode;
static bool table_unlimited_balls;
static Msg RankRcArray[9], MissionRcArray[17];
static int mission_select_scores[17];
static std::reference_wrapper<TSink*> WormholeSinkArray[3];

View file

@ -732,8 +732,6 @@ void winmain::RenderUi()
pb::PushCheat("rmax");
if (pb::FullTiltMode && ImGui::MenuItem("quote"))
pb::PushCheat("quote");
if (ImGui::MenuItem("easy mode", nullptr, control::easyMode))
pb::PushCheat("easy mode");
ImGui::EndMenu();
}