SpaceCadetPinball/SpaceCadetPinball/pb.h

89 lines
2.2 KiB
C
Raw Normal View History

2020-11-06 14:56:32 +01:00
#pragma once
#include "high_score.h"
2020-11-06 14:56:32 +01:00
class TEdgeSegment;
struct ray_type;
struct GameInput;
class TPinballTable;
class DatFile;
class TBall;
class TTextBox;
enum class Msg : int;
2022-01-05 09:38:50 +01:00
enum class GameModes
{
InGame = 1,
GameOver = 2,
};
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:
static int time_ticks;
2022-12-28 06:47:44 +01:00
static float time_now, time_next, time_ticks_remainder;
static float BallMaxSpeed, BallHalfRadius, BallToBallCollisionDistance;
2022-01-05 09:38:50 +01:00
static GameModes game_mode;
static bool cheat_mode, CreditsActive;
static DatFile* record_table;
static TPinballTable* MainTable;
static bool FullTiltMode, FullTiltDemoMode;
static std::string DatFileName, BasePath;
static ImU32 TextBoxColor;
static int quickFlag;
static TTextBox *InfoTextBox, *MissTextBox;
static int init();
static int uninit();
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);
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);
static void frame(float dtMilliSec);
2023-03-13 08:54:33 +01:00
static void timed_frame(float timeDelta);
2020-12-02 18:12:34 +01:00
static void pause_continue();
static void loose_focus();
static void InputUp(GameInput input);
static void InputDown(GameInput input);
2020-12-02 18:12:34 +01:00
static void launch_ball();
static void end_game();
2020-12-02 18:12:34 +01:00
static void high_scores();
static void tilt_no_more();
static bool chk_highscore();
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);
static void ShowMessageBox(Uint32 flags, LPCSTR title, LPCSTR message);
private:
2022-01-05 09:38:50 +01:00
static bool demo_mode;
static float IdleTimerMs;
static float BallToBallCollision(const ray_type& ray, const TBall& ball, TEdgeSegment** edge, float collisionDistance);
2020-11-06 14:56:32 +01:00
};