2020-11-06 14:56:32 +01:00
|
|
|
#pragma once
|
2020-12-12 14:36:20 +01:00
|
|
|
#include "high_score.h"
|
2020-11-06 14:56:32 +01:00
|
|
|
|
2021-10-17 17:18:29 +02:00
|
|
|
struct GameInput;
|
2021-09-21 12:14:39 +02:00
|
|
|
class TPinballTable;
|
|
|
|
class DatFile;
|
2021-01-06 15:06:13 +01:00
|
|
|
class TBall;
|
2022-08-31 14:18:22 +02:00
|
|
|
class TTextBox;
|
|
|
|
enum class Msg : int;
|
2021-01-06 15:06:13 +01:00
|
|
|
|
2022-01-05 09:38:50 +01:00
|
|
|
enum class GameModes
|
|
|
|
{
|
|
|
|
InGame = 1,
|
|
|
|
GameOver = 2,
|
|
|
|
};
|
|
|
|
|
2021-09-23 11:16:58 +02:00
|
|
|
class UsingSdlHint
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit UsingSdlHint(const char* name, const char* value)
|
|
|
|
: HintName(name)
|
|
|
|
{
|
|
|
|
auto originalValue = SDL_GetHint(name);
|
|
|
|
if (originalValue)
|
|
|
|
strncpy(OriginalValue, originalValue, sizeof OriginalValue - 1);
|
|
|
|
|
|
|
|
SDL_SetHint(name, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
~UsingSdlHint()
|
|
|
|
{
|
|
|
|
if (OriginalValue[0])
|
|
|
|
SDL_SetHint(HintName, OriginalValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
char OriginalValue[40]{};
|
|
|
|
const char* HintName;
|
|
|
|
};
|
|
|
|
|
2020-11-06 14:56:32 +01:00
|
|
|
class pb
|
|
|
|
{
|
|
|
|
public:
|
2020-11-29 16:50:49 +01:00
|
|
|
static int time_ticks;
|
2021-10-03 17:06:19 +02:00
|
|
|
static float ball_speed_limit, time_now, time_next, time_ticks_remainder;
|
2022-01-05 09:38:50 +01:00
|
|
|
static GameModes game_mode;
|
2021-10-05 15:48:13 +02:00
|
|
|
static bool cheat_mode;
|
2021-09-21 12:14:39 +02:00
|
|
|
static DatFile* record_table;
|
2020-11-29 16:50:49 +01:00
|
|
|
static TPinballTable* MainTable;
|
2021-11-24 15:25:23 +01:00
|
|
|
static bool FullTiltMode, FullTiltDemoMode;
|
2022-08-31 14:18:22 +02:00
|
|
|
static std::string DatFileName, BasePath;
|
2022-08-31 10:11:21 +02:00
|
|
|
static ImU32 TextBoxColor;
|
2022-08-31 14:18:22 +02:00
|
|
|
static int quickFlag;
|
|
|
|
static TTextBox *InfoTextBox, *MissTextBox;
|
2020-11-29 16:50:49 +01:00
|
|
|
|
2021-09-01 10:02:57 +02:00
|
|
|
static int init();
|
2020-12-04 16:35:47 +01:00
|
|
|
static int uninit();
|
2021-12-08 13:55:49 +01:00
|
|
|
static void SelectDatFile(const std::vector<const char*>& dataSearchPaths);
|
2020-11-06 14:56:32 +01:00
|
|
|
static void reset_table();
|
|
|
|
static void firsttime_setup();
|
2022-01-05 09:38:50 +01:00
|
|
|
static void mode_change(GameModes mode);
|
2020-11-29 16:50:49 +01:00
|
|
|
static void toggle_demo();
|
2022-01-05 09:38:50 +01:00
|
|
|
static void replay_level(bool demoMode);
|
2021-10-10 16:13:43 +02:00
|
|
|
static void ballset(float dx, float dy);
|
2021-10-03 17:06:19 +02:00
|
|
|
static void frame(float dtMilliSec);
|
2021-01-06 15:06:13 +01:00
|
|
|
static void timed_frame(float timeNow, float timeDelta, bool drawBalls);
|
2020-12-02 18:12:34 +01:00
|
|
|
static void pause_continue();
|
|
|
|
static void loose_focus();
|
2021-10-17 17:18:29 +02:00
|
|
|
static void InputUp(GameInput input);
|
|
|
|
static void InputDown(GameInput input);
|
2020-12-02 18:12:34 +01:00
|
|
|
static void launch_ball();
|
2021-01-06 15:06:13 +01:00
|
|
|
static void end_game();
|
2020-12-02 18:12:34 +01:00
|
|
|
static void high_scores();
|
2020-12-27 16:19:36 +01:00
|
|
|
static void tilt_no_more();
|
|
|
|
static bool chk_highscore();
|
2021-01-06 15:06:13 +01:00
|
|
|
static float collide(float timeNow, float timeDelta, TBall* ball);
|
2021-10-05 15:48:13 +02:00
|
|
|
static void PushCheat(const std::string& cheat);
|
2022-08-31 14:18:22 +02:00
|
|
|
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);
|
2022-12-02 06:21:08 +01:00
|
|
|
static void ShowMessageBox(Uint32 flags, LPCSTR title, LPCSTR message);
|
2021-02-06 14:53:47 +01:00
|
|
|
private:
|
2022-01-05 09:38:50 +01:00
|
|
|
static bool demo_mode;
|
2021-10-17 17:18:29 +02:00
|
|
|
|
|
|
|
static bool AnyBindingMatchesInput(GameInput (&options)[3], GameInput key);
|
2020-11-06 14:56:32 +01:00
|
|
|
};
|