2020-06-20 15:52:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
bool System_WantGuiCapture(); // During playing this tells us whether the game must be paused due to active GUI elememts.
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-07-04 13:51:02 +00:00
|
|
|
#include "vectors.h"
|
2020-07-18 19:28:57 +00:00
|
|
|
#include "engineerrors.h"
|
2020-08-28 07:07:36 +00:00
|
|
|
#include "stats.h"
|
2020-08-29 19:20:10 +00:00
|
|
|
#include "packet.h"
|
2022-09-28 03:39:01 +00:00
|
|
|
#include "serializer.h"
|
2020-09-06 10:17:54 +00:00
|
|
|
#include "inputstate.h"
|
2022-08-07 08:25:15 +00:00
|
|
|
#include "maptypes.h"
|
2020-06-20 15:52:10 +00:00
|
|
|
|
2020-09-02 22:29:17 +00:00
|
|
|
class FSerializer;
|
2021-03-25 15:45:40 +00:00
|
|
|
struct FRenderViewpoint;
|
2021-11-18 18:33:32 +00:00
|
|
|
struct sectortype;
|
2021-12-04 18:08:50 +00:00
|
|
|
struct tspritetype;
|
2021-12-22 22:27:32 +00:00
|
|
|
class DCoreActor;
|
2021-12-27 08:26:56 +00:00
|
|
|
struct MapRecord;
|
2023-03-18 08:48:18 +00:00
|
|
|
struct PlayerAngles;
|
|
|
|
|
2023-03-18 10:16:50 +00:00
|
|
|
void processMovement(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const int drink_amt = 0, const bool allowstrafe = true, const double turnscale = 1.);
|
2020-09-02 22:29:17 +00:00
|
|
|
|
2020-06-20 15:52:10 +00:00
|
|
|
struct GameStats
|
|
|
|
{
|
|
|
|
int kill, tkill;
|
|
|
|
int secret, tsecret;
|
|
|
|
int timesecnd;
|
|
|
|
int frags;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FNewGameStartup
|
|
|
|
{
|
2021-12-27 08:26:56 +00:00
|
|
|
MapRecord* Map;
|
2020-06-20 15:52:10 +00:00
|
|
|
int Episode;
|
|
|
|
int Level;
|
|
|
|
int Skill;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FSavegameInfo
|
|
|
|
{
|
|
|
|
const char *savesig;
|
|
|
|
int minsavever;
|
|
|
|
int currentsavever;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EMenuSounds : int;
|
2020-09-03 21:10:28 +00:00
|
|
|
struct MapRecord;
|
2022-12-07 16:10:27 +00:00
|
|
|
struct TilesetBuildInfo;
|
2020-06-20 15:52:10 +00:00
|
|
|
|
2020-08-30 22:09:56 +00:00
|
|
|
extern cycle_t drawtime, actortime, thinktime, gameupdatetime;
|
2020-08-28 07:07:36 +00:00
|
|
|
|
2021-04-02 20:52:46 +00:00
|
|
|
struct GeoEffect
|
|
|
|
{
|
2021-11-21 08:08:05 +00:00
|
|
|
sectortype** geosectorwarp;
|
|
|
|
sectortype** geosectorwarp2;
|
|
|
|
sectortype** geosector;
|
2022-01-27 17:40:17 +00:00
|
|
|
double* geox;
|
|
|
|
double* geoy;
|
|
|
|
double* geox2;
|
|
|
|
double* geoy2;
|
2021-04-02 20:52:46 +00:00
|
|
|
int geocnt;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-06-20 15:52:10 +00:00
|
|
|
struct GameInterface
|
|
|
|
{
|
|
|
|
virtual const char* Name() { return "$"; }
|
|
|
|
virtual ~GameInterface() {}
|
|
|
|
virtual bool GenerateSavePic() { return false; }
|
2020-08-23 15:47:05 +00:00
|
|
|
virtual void app_init() = 0;
|
2022-12-07 16:10:27 +00:00
|
|
|
virtual void LoadTextureInfo(TilesetBuildInfo& info) {}
|
|
|
|
virtual void SetupSpecialTextures(TilesetBuildInfo&) {}
|
2020-11-10 21:07:45 +00:00
|
|
|
virtual void loadPalette();
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void UpdateScreenSize() {}
|
2020-09-03 21:10:28 +00:00
|
|
|
virtual void FreeLevelData();
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void FreeGameData() {}
|
2020-07-15 17:48:04 +00:00
|
|
|
virtual void PlayHudSound() {}
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual GameStats getStats() { return {}; }
|
|
|
|
virtual void MainMenuOpened() {}
|
|
|
|
virtual void MenuOpened() {}
|
|
|
|
virtual void MenuClosed() {}
|
|
|
|
virtual void MenuSound(EMenuSounds snd) {}
|
|
|
|
virtual bool CanSave() { return true; }
|
|
|
|
virtual void CustomMenuSelection(int menu, int item) {}
|
2021-05-01 22:58:54 +00:00
|
|
|
virtual bool StartGame(FNewGameStartup& gs) { return true; }
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
|
2020-07-02 08:59:22 +00:00
|
|
|
virtual double SmallFontScale() { return 1; }
|
2020-07-20 22:07:02 +00:00
|
|
|
virtual void SerializeGameState(FSerializer& arc) {}
|
2020-06-20 15:52:10 +00:00
|
|
|
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
|
|
|
|
virtual void SetAmbience(bool on) {}
|
2020-07-18 19:28:57 +00:00
|
|
|
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
2020-08-29 22:55:49 +00:00
|
|
|
virtual void UpdateSounds() {}
|
|
|
|
virtual void ErrorCleanup() {}
|
2020-08-30 07:32:34 +00:00
|
|
|
virtual void Startup() {}
|
|
|
|
virtual void DrawBackground() {}
|
2020-08-29 22:55:49 +00:00
|
|
|
virtual void Render() {}
|
2020-08-30 06:03:03 +00:00
|
|
|
virtual void Ticker() {}
|
2020-08-30 07:32:34 +00:00
|
|
|
virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; }
|
2020-09-02 22:29:17 +00:00
|
|
|
virtual const char *CheckCheatMode() { return nullptr; }
|
|
|
|
virtual const char* GenericCheat(int player, int cheat) = 0;
|
2020-09-03 21:10:28 +00:00
|
|
|
virtual void NextLevel(MapRecord* map, int skill) {}
|
2021-04-15 16:50:48 +00:00
|
|
|
virtual void NewGame(MapRecord* map, int skill, bool special = false) {}
|
2020-09-03 21:10:28 +00:00
|
|
|
virtual void LevelCompleted(MapRecord* map, int skill) {}
|
2022-09-07 09:37:50 +00:00
|
|
|
virtual bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) { return false; }
|
2022-10-11 06:46:56 +00:00
|
|
|
virtual DAngle playerPitchMin() { return DAngle::fromDeg(57.375); }
|
|
|
|
virtual DAngle playerPitchMax() { return DAngle::fromDeg(-57.375); }
|
2023-03-17 06:28:04 +00:00
|
|
|
virtual DCoreActor* getConsoleActor() = 0;
|
2023-03-18 08:48:18 +00:00
|
|
|
virtual PlayerAngles* getConsoleAngles() = 0;
|
2020-11-29 11:23:31 +00:00
|
|
|
virtual void ToggleThirdPerson() { }
|
|
|
|
virtual void SwitchCoopView() { Printf("Unsupported command\n"); }
|
|
|
|
virtual void ToggleShowWeapon() { Printf("Unsupported command\n"); }
|
2022-09-16 17:20:35 +00:00
|
|
|
virtual void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) = 0;
|
2021-03-28 17:22:51 +00:00
|
|
|
virtual void UpdateCameras(double smoothratio) {}
|
2021-12-22 22:27:32 +00:00
|
|
|
virtual void EnterPortal(DCoreActor* viewer, int type) {}
|
|
|
|
virtual void LeavePortal(DCoreActor* viewer, int type) {}
|
2021-11-18 18:33:32 +00:00
|
|
|
virtual bool GetGeoEffect(GeoEffect* eff, sectortype* viewsector) { return false; }
|
2021-04-11 11:38:23 +00:00
|
|
|
virtual int Voxelize(int sprnum) { return -1; }
|
2021-11-14 21:56:49 +00:00
|
|
|
virtual void AddExcludedEpisode(const FString& episode) {}
|
2021-07-20 08:50:46 +00:00
|
|
|
virtual int GetCurrentSkill() { return -1; }
|
2021-08-22 23:00:30 +00:00
|
|
|
virtual bool IsQAVInterpTypeValid(const FString& type) { return false; }
|
2021-11-14 21:52:20 +00:00
|
|
|
virtual void AddQAVInterpProps(const int res_id, const FString& interptype, const bool loopable, const TMap<int, TArray<int>>&& ignoredata) { }
|
|
|
|
virtual void RemoveQAVInterpProps(const int res_id) { }
|
2022-11-19 17:26:17 +00:00
|
|
|
virtual bool WantEscape() { return false; }
|
2022-11-24 20:27:08 +00:00
|
|
|
virtual void StartSoundEngine() = 0;
|
2023-03-19 00:13:48 +00:00
|
|
|
virtual void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust)
|
|
|
|
{
|
|
|
|
processMovement(hidInput, inputBuffer, currInput, scaleAdjust);
|
|
|
|
}
|
2020-08-24 18:20:15 +00:00
|
|
|
|
2020-08-28 07:07:36 +00:00
|
|
|
virtual FString statFPS()
|
|
|
|
{
|
|
|
|
FString output;
|
|
|
|
|
|
|
|
output.AppendFormat("Actor think time: %.3f ms\n", actortime.TimeMS());
|
|
|
|
output.AppendFormat("Total think time: %.3f ms\n", thinktime.TimeMS());
|
|
|
|
output.AppendFormat("Game Update: %.3f ms\n", gameupdatetime.TimeMS());
|
|
|
|
output.AppendFormat("Draw time: %.3f ms\n", drawtime.TimeMS());
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
2020-08-24 18:20:15 +00:00
|
|
|
|
2020-06-20 15:52:10 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
extern GameInterface* gi;
|
|
|
|
|
|
|
|
|
|
|
|
void ImGui_Begin_Frame();
|
|
|
|
|