1
0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-22 02:32:39 +01:00

Added in-game credits from Full Tilt.

This was kind-of requested a long time ago.
This commit is contained in:
Muzychenko Andrey 2023-03-17 16:38:08 +03:00
parent 43e2ab896b
commit 34a1e32843
7 changed files with 97 additions and 29 deletions

View File

@ -71,7 +71,7 @@ void TTextBox::TimerExpired(int timerId, void* caller)
} }
} }
void TTextBox::Clear() void TTextBox::Clear(bool lowPriorityOnly)
{ {
gdrv_bitmap8* bmp = BgBmp; gdrv_bitmap8* bmp = BgBmp;
if (bmp) if (bmp)
@ -92,16 +92,17 @@ void TTextBox::Clear()
timer::kill(Timer); timer::kill(Timer);
Timer = 0; Timer = 0;
} }
while (CurrentMessage) while (CurrentMessage && (!lowPriorityOnly || CurrentMessage->LowPriority))
{ {
TTextBoxMessage* message = CurrentMessage; auto message = CurrentMessage;
TTextBoxMessage* nextMessage = message->NextMessage; CurrentMessage = message->NextMessage;
delete message; delete message;
CurrentMessage = nextMessage;
} }
if (CurrentMessage)
Draw();
} }
void TTextBox::Display(const char* text, float time) void TTextBox::Display(const char* text, float time, bool lowPriority)
{ {
if (!text) if (!text)
return; return;
@ -124,23 +125,20 @@ void TTextBox::Display(const char* text, float time)
if (Timer == -1) if (Timer == -1)
Clear(); Clear();
auto message = new TTextBoxMessage(text, time); auto message = new TTextBoxMessage(text, time, lowPriority);
if (message) if (message->Text)
{ {
if (message->Text) if (CurrentMessage)
{ PreviousMessage->NextMessage = message;
if (CurrentMessage)
PreviousMessage->NextMessage = message;
else
CurrentMessage = message;
PreviousMessage = message;
if (Timer == 0)
Draw();
}
else else
{ CurrentMessage = message;
delete message; PreviousMessage = message;
} if (Timer == 0)
Draw();
}
else
{
delete message;
} }
} }
} }

View File

@ -20,8 +20,8 @@ public:
TTextBox(TPinballTable* table, int groupIndex); TTextBox(TPinballTable* table, int groupIndex);
~TTextBox() override; ~TTextBox() override;
int Message(MessageCode code, float value) override; int Message(MessageCode code, float value) override;
void Clear(); void Clear(bool lowPriorityOnly = false);
void Display(const char* text, float time); void Display(const char* text, float time, bool lowPriority = false);
void DrawImGui(); void DrawImGui();
private: private:

View File

@ -2,11 +2,12 @@
#include "TTextBoxMessage.h" #include "TTextBoxMessage.h"
#include "pb.h" #include "pb.h"
TTextBoxMessage::TTextBoxMessage(const char* text, float time) TTextBoxMessage::TTextBoxMessage(const char* text, float time, bool lowPriority)
{ {
NextMessage = nullptr; NextMessage = nullptr;
Time = time; Time = time;
EndTicks = pb::time_ticks + static_cast<int>(time * 1000.0f); EndTicks = pb::time_ticks + static_cast<int>(time * 1000.0f);
LowPriority = lowPriority;
if (text) if (text)
{ {
const auto textLen = strlen(text) + 1; const auto textLen = strlen(text) + 1;

View File

@ -6,8 +6,9 @@ public:
char* Text; char* Text;
float Time; float Time;
int EndTicks; int EndTicks;
bool LowPriority;
TTextBoxMessage(const char* text, float time); TTextBoxMessage(const char* text, float time, bool lowPriority);
~TTextBoxMessage(); ~TTextBoxMessage();
float TimeLeft() const; float TimeLeft() const;
void Refresh(float time); void Refresh(float time);

View File

@ -916,6 +916,44 @@ void control::pbctrl_bdoor_controller(char key)
"I knew it worked too good to be right.", "I knew it worked too good to be right.",
"World's most expensive flippers" "World's most expensive flippers"
}; };
static const char* credits[35]
{
"Full Tilt! was created by Cinematronics",
"for Maxis.",
"Cinematronics Team:",
"Programming\nMichael Sandige\nJohn Taylor",
"Art\nJohn Frantz Jr.\nRyan Medeiros",
"Design\nKevin Gliner",
"Sound Effects\nMatt Ridgeway",
"Donald S. Griffin",
"Design Consultant\nMark Sprenger",
"Music\nMatt Ridgeway",
"Producer\nKevin Gliner",
"Voices\nMike McGeary\nWilliam Rice",
"Grand Poobah\nDavid Stafford",
"Special Thanks\nPaula Sandige\nAlex St. John",
"Brad Silverberg\nJeff Camp",
"Danny Thorpe\nGreg Hospelhorn",
"Maxis Team:",
"Producer\nJohn Csicsery",
"Product Manager\nLarry Lee",
"Lead Tester\nMichael Gilmartin",
"QA Manager\nAlan Barton",
"Additional Testing\nJoe Longworth\nScott Shicoff",
"Owen Nelson\nJohn \"Jussi\" Ylinen",
"John Landes\nMarc Meyer",
"Cathy Castro\nKeith Meyer",
"Additional Art\nOcean Quigley",
"Rick Macaraeg\nCharlie Aquilina",
"Art Director\nSharon Barr",
"Install Program\nKevin O'Hare",
"Intro Music",
"Brian Conrad",
"John Csicsery",
"Special Thanks\nSam Poole\nJoe Scirica",
"Jeff Braun\nBob Derber\nAshley Csicsery",
"Tom Forge\nWill \"Burr\" Wright",
};
// Original allowed to enter cheats only before the first launch. // Original allowed to enter cheats only before the first launch.
std::memmove(&cheatBuffer[0], &cheatBuffer[1], 10); std::memmove(&cheatBuffer[0], &cheatBuffer[1], 10);
@ -944,10 +982,19 @@ void control::pbctrl_bdoor_controller(char key)
} }
else if (pb::FullTiltMode && strcmp(bufferEnd - 5, "quote") == 0) else if (pb::FullTiltMode && strcmp(bufferEnd - 5, "quote") == 0)
{ {
// A sad developer easter egg type 'cheat' from Full Tilt // Developer easter egg type 'cheat' from Full Tilt
float time = 0; float time = 0;
for (auto quote : quotes) for (auto quote : quotes)
mission_text_box->Display(quote, time += 3); mission_text_box->Display(quote, time += 3, true);
return;
}
else if (pb::FullTiltMode && strcmp(bufferEnd - 7, "credits") == 0)
{
// Full Tilt in-game credits, shown when idle for 60sec
float time = 0;
for (auto line : credits)
mission_text_box->Display(line, time += 2, true);
pb::CreditsActive = true;
return; return;
} }
else if (strcmp(bufferEnd - 9, "easy mode") == 0) else if (strcmp(bufferEnd - 9, "easy mode") == 0)

View File

@ -34,7 +34,8 @@ int pb::time_ticks = 0;
GameModes pb::game_mode = GameModes::GameOver; GameModes pb::game_mode = GameModes::GameOver;
float pb::time_now = 0, pb::time_next = 0, pb::time_ticks_remainder = 0; float pb::time_now = 0, pb::time_next = 0, pb::time_ticks_remainder = 0;
float pb::BallMaxSpeed, pb::BallHalfRadius, pb::BallToBallCollisionDistance; float pb::BallMaxSpeed, pb::BallHalfRadius, pb::BallToBallCollisionDistance;
bool pb::FullTiltMode = false, pb::FullTiltDemoMode = false, pb::cheat_mode = false, pb::demo_mode = false; float pb::IdleTimerMs = 0;
bool pb::FullTiltMode = false, pb::FullTiltDemoMode = false, pb::cheat_mode = false, pb::demo_mode = false, pb::CreditsActive = false;
std::string pb::DatFileName, pb::BasePath; std::string pb::DatFileName, pb::BasePath;
ImU32 pb::TextBoxColor; ImU32 pb::TextBoxColor;
int pb::quickFlag = 0; int pb::quickFlag = 0;
@ -194,6 +195,11 @@ void pb::firsttime_setup()
void pb::mode_change(GameModes mode) void pb::mode_change(GameModes mode)
{ {
if (CreditsActive)
MissTextBox->Clear(true);
CreditsActive = false;
IdleTimerMs = 0;
switch (mode) switch (mode)
{ {
case GameModes::InGame: case GameModes::InGame:
@ -283,6 +289,15 @@ void pb::frame(float dtMilliSec)
if (dtMilliSec <= 0) if (dtMilliSec <= 0)
return; return;
if (FullTiltMode && !demo_mode)
{
IdleTimerMs += dtMilliSec;
if (IdleTimerMs >= 60000 && !CreditsActive)
{
PushCheat("credits");
}
}
float dtSec = dtMilliSec * 0.001f; float dtSec = dtMilliSec * 0.001f;
time_next = time_now + dtSec; time_next = time_now + dtSec;
timed_frame(dtSec); timed_frame(dtSec);
@ -563,6 +578,11 @@ void pb::InputDown(GameInput input)
if (game_mode != GameModes::InGame || winmain::single_step || demo_mode) if (game_mode != GameModes::InGame || winmain::single_step || demo_mode)
return; return;
if (CreditsActive)
MissTextBox->Clear(true);
CreditsActive = false;
IdleTimerMs = 0;
if (input.Type == InputTypes::Keyboard) if (input.Type == InputTypes::Keyboard)
control::pbctrl_bdoor_controller(static_cast<char>(input.Value)); control::pbctrl_bdoor_controller(static_cast<char>(input.Value));

View File

@ -47,7 +47,7 @@ public:
static float time_now, time_next, time_ticks_remainder; static float time_now, time_next, time_ticks_remainder;
static float BallMaxSpeed, BallHalfRadius, BallToBallCollisionDistance; static float BallMaxSpeed, BallHalfRadius, BallToBallCollisionDistance;
static GameModes game_mode; static GameModes game_mode;
static bool cheat_mode; static bool cheat_mode, CreditsActive;
static DatFile* record_table; static DatFile* record_table;
static TPinballTable* MainTable; static TPinballTable* MainTable;
static bool FullTiltMode, FullTiltDemoMode; static bool FullTiltMode, FullTiltDemoMode;
@ -83,5 +83,6 @@ public:
static void ShowMessageBox(Uint32 flags, LPCSTR title, LPCSTR message); static void ShowMessageBox(Uint32 flags, LPCSTR title, LPCSTR message);
private: private:
static bool demo_mode; static bool demo_mode;
static float IdleTimerMs;
static float BallToBallCollision(const ray_type& ray, const TBall& ball, TEdgeSegment** edge, float collisionDistance); static float BallToBallCollision(const ray_type& ray, const TBall& ball, TEdgeSegment** edge, float collisionDistance);
}; };