2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2018-11-25 12:35:38 +00:00
|
|
|
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file g_game.h
|
|
|
|
/// \brief Game loop, events handling.
|
|
|
|
|
|
|
|
#ifndef __G_GAME__
|
|
|
|
#define __G_GAME__
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "d_event.h"
|
|
|
|
|
|
|
|
extern char gamedatafilename[64];
|
|
|
|
extern char timeattackfolder[64];
|
|
|
|
extern char customversionstring[32];
|
|
|
|
#define GAMEDATASIZE (4*8192)
|
|
|
|
|
|
|
|
#ifdef SEENAMES
|
|
|
|
extern player_t *seenplayer;
|
|
|
|
#endif
|
|
|
|
extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
|
|
|
|
|
|
|
extern player_t players[MAXPLAYERS];
|
|
|
|
extern boolean playeringame[MAXPLAYERS];
|
|
|
|
|
|
|
|
// ======================================
|
|
|
|
// DEMO playback/recording related stuff.
|
|
|
|
// ======================================
|
|
|
|
|
|
|
|
// demoplaying back and demo recording
|
2018-11-14 02:01:59 +00:00
|
|
|
extern boolean demoplayback, titledemo, fromtitledemo, demorecording, timingdemo;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Quit after playing a demo from cmdline.
|
|
|
|
extern boolean singledemo;
|
|
|
|
extern boolean demo_start;
|
|
|
|
|
2014-03-23 16:00:29 +00:00
|
|
|
extern mobj_t *metalplayback;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// gametic at level start
|
|
|
|
extern tic_t levelstarttic;
|
|
|
|
|
|
|
|
// for modding?
|
|
|
|
extern INT16 prevmap, nextmap;
|
|
|
|
extern INT32 gameovertics;
|
|
|
|
extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
|
|
|
|
extern INT16 rw_maximums[NUM_WEAPONS];
|
|
|
|
|
|
|
|
// used in game menu
|
2018-08-09 21:59:52 +00:00
|
|
|
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatspamprotection, cv_chatbacktint;
|
2018-10-01 11:21:02 +00:00
|
|
|
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
2018-11-29 13:49:50 +00:00
|
|
|
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
|
|
|
|
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
|
2018-11-07 21:15:14 +00:00
|
|
|
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
|
|
|
|
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
|
2018-03-11 22:07:28 +00:00
|
|
|
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis;
|
|
|
|
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2;
|
|
|
|
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3;
|
|
|
|
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4;
|
2018-01-22 00:15:26 +00:00
|
|
|
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
2018-09-30 22:07:05 +00:00
|
|
|
extern consvar_t cv_splitplayers;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-02-09 02:24:44 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
AXISNONE = 0,
|
|
|
|
AXISTURN,
|
|
|
|
AXISMOVE,
|
2018-03-11 22:07:28 +00:00
|
|
|
AXISBRAKE,
|
|
|
|
AXISAIM,
|
2018-02-09 02:24:44 +00:00
|
|
|
AXISLOOK,
|
|
|
|
AXISDEAD, //Axises that don't want deadzones
|
|
|
|
AXISFIRE,
|
2018-03-11 22:07:28 +00:00
|
|
|
AXISDRIFT,
|
2018-02-09 02:24:44 +00:00
|
|
|
} axis_input_e;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// mouseaiming (looking up/down with the mouse or keyboard)
|
|
|
|
#define KB_LOOKSPEED (1<<25)
|
|
|
|
#define MAXPLMOVE (50)
|
|
|
|
#define SLOWTURNTICS (6)
|
|
|
|
|
|
|
|
// build an internal map name MAPxx from map number
|
|
|
|
const char *G_BuildMapName(INT32 map);
|
2017-12-17 03:32:43 +00:00
|
|
|
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// copy ticcmd_t to and fro the normal way
|
|
|
|
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n);
|
|
|
|
// copy ticcmd_t to and fro network packets
|
|
|
|
ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n);
|
|
|
|
|
|
|
|
// clip the console player aiming to the view
|
|
|
|
INT16 G_ClipAimingPitch(INT32 *aiming);
|
|
|
|
INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
|
|
|
|
|
2018-02-09 21:04:52 +00:00
|
|
|
boolean InputDown(INT32 gc, UINT8 p);
|
2018-02-09 02:24:44 +00:00
|
|
|
INT32 JoyAxis(axis_input_e axissel, UINT8 p);
|
|
|
|
|
2017-12-11 06:12:38 +00:00
|
|
|
extern angle_t localangle, localangle2, localangle3, localangle4;
|
2017-12-17 03:32:43 +00:00
|
|
|
extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed
|
2018-01-22 22:08:31 +00:00
|
|
|
extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// GAME
|
|
|
|
//
|
|
|
|
void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo);
|
|
|
|
void G_DoReborn(INT32 playernum);
|
|
|
|
void G_PlayerReborn(INT32 player);
|
2018-08-11 21:23:40 +00:00
|
|
|
void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer,
|
2014-03-15 16:59:03 +00:00
|
|
|
boolean skipprecutscene);
|
|
|
|
char *G_BuildMapTitle(INT32 mapnum);
|
|
|
|
|
|
|
|
// XMOD spawning
|
|
|
|
mapthing_t *G_FindCTFStart(INT32 playernum);
|
|
|
|
mapthing_t *G_FindMatchStart(INT32 playernum);
|
2018-02-28 00:53:12 +00:00
|
|
|
mapthing_t *G_FindRaceStart(INT32 playernum);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_SpawnPlayer(INT32 playernum, boolean starpost);
|
|
|
|
|
|
|
|
// Can be called by the startup code or M_Responder.
|
|
|
|
// A normal game starts at map 1, but a warp test can start elsewhere
|
2018-08-11 21:23:40 +00:00
|
|
|
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar,
|
2017-12-17 03:32:43 +00:00
|
|
|
UINT8 ssplayers, boolean FLS);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_DoLoadLevel(boolean resetplayer);
|
|
|
|
|
|
|
|
void G_DeferedPlayDemo(const char *demo);
|
|
|
|
|
|
|
|
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
|
|
|
void G_LoadGame(UINT32 slot, INT16 mapoverride);
|
|
|
|
|
2018-03-30 16:16:15 +00:00
|
|
|
void G_SaveGameData(boolean force);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
void G_SaveGame(UINT32 slot);
|
|
|
|
|
|
|
|
// Only called by startup code.
|
|
|
|
void G_RecordDemo(const char *name);
|
|
|
|
void G_RecordMetal(void);
|
|
|
|
void G_BeginRecording(void);
|
|
|
|
void G_BeginMetal(void);
|
|
|
|
|
|
|
|
// Only called by shutdown code.
|
2018-01-22 00:15:26 +00:00
|
|
|
void G_SetDemoTime(UINT32 ptime, UINT32 plap);
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 G_CmpDemoTime(char *oldname, char *newname);
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GHC_NORMAL = 0,
|
|
|
|
GHC_SUPER,
|
|
|
|
GHC_FIREFLOWER,
|
|
|
|
GHC_INVINCIBLE
|
|
|
|
} ghostcolor_t;
|
|
|
|
|
|
|
|
// Record/playback tics
|
|
|
|
void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
|
|
|
void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
|
|
|
void G_GhostAddThok(void);
|
|
|
|
void G_GhostAddSpin(void);
|
2014-04-14 05:14:58 +00:00
|
|
|
void G_GhostAddRev(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_GhostAddColor(ghostcolor_t color);
|
|
|
|
void G_GhostAddFlip(void);
|
2017-10-16 11:11:48 +00:00
|
|
|
void G_GhostAddScale(fixed_t scale);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_GhostAddHit(mobj_t *victim);
|
|
|
|
void G_WriteGhostTic(mobj_t *ghost);
|
|
|
|
void G_ConsGhostTic(void);
|
|
|
|
void G_GhostTicker(void);
|
|
|
|
void G_ReadMetalTic(mobj_t *metal);
|
|
|
|
void G_WriteMetalTic(mobj_t *metal);
|
2014-11-12 00:55:07 +00:00
|
|
|
void G_SaveMetal(UINT8 **buffer);
|
|
|
|
void G_LoadMetal(UINT8 **buffer);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-07-01 18:29:13 +00:00
|
|
|
// Your naming conventions are stupid and useless.
|
|
|
|
// There is no conflict here.
|
|
|
|
typedef struct demoghost {
|
|
|
|
UINT8 checksum[16];
|
|
|
|
UINT8 *buffer, *p, color;
|
|
|
|
UINT16 version;
|
|
|
|
mobj_t oldmo, *mo;
|
|
|
|
struct demoghost *next;
|
|
|
|
} demoghost;
|
|
|
|
extern demoghost *ghosts;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_DoPlayDemo(char *defdemoname);
|
|
|
|
void G_TimeDemo(const char *name);
|
|
|
|
void G_AddGhost(char *defdemoname);
|
2018-11-04 01:00:17 +00:00
|
|
|
void G_UpdateStaffGhostName(lumpnum_t l);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_DoPlayMetal(void);
|
|
|
|
void G_DoneLevelLoad(void);
|
2014-03-23 16:00:29 +00:00
|
|
|
void G_StopMetalDemo(void);
|
|
|
|
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_StopDemo(void);
|
|
|
|
boolean G_CheckDemoStatus(void);
|
|
|
|
|
|
|
|
boolean G_IsSpecialStage(INT32 mapnum);
|
|
|
|
boolean G_GametypeUsesLives(void);
|
|
|
|
boolean G_GametypeHasTeams(void);
|
|
|
|
boolean G_GametypeHasSpectators(void);
|
2018-02-08 22:13:06 +00:00
|
|
|
boolean G_BattleGametype(void);
|
2018-06-28 14:47:56 +00:00
|
|
|
INT16 G_SometimesGetDifferentGametype(void);
|
|
|
|
UINT8 G_GetGametypeColor(INT16 gt);
|
2018-02-08 22:13:06 +00:00
|
|
|
boolean G_RaceGametype(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
boolean G_TagGametype(void);
|
|
|
|
void G_ExitLevel(void);
|
|
|
|
void G_NextLevel(void);
|
|
|
|
void G_Continue(void);
|
|
|
|
void G_UseContinue(void);
|
2018-01-28 01:59:29 +00:00
|
|
|
void G_AfterIntermission(void);
|
2017-05-18 15:54:58 +00:00
|
|
|
void G_EndGame(void); // moved from y_inter.c/h and renamed
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
void G_Ticker(boolean run);
|
|
|
|
boolean G_Responder(event_t *ev);
|
|
|
|
|
|
|
|
void G_AddPlayer(INT32 playernum);
|
|
|
|
|
|
|
|
void G_SetExitGameFlag(void);
|
|
|
|
void G_ClearExitGameFlag(void);
|
|
|
|
boolean G_GetExitGameFlag(void);
|
|
|
|
void G_SetRetryFlag(void);
|
|
|
|
void G_ClearRetryFlag(void);
|
|
|
|
boolean G_GetRetryFlag(void);
|
|
|
|
|
|
|
|
|
|
|
|
void G_LoadGameData(void);
|
|
|
|
void G_LoadGameSettings(void);
|
|
|
|
|
|
|
|
void G_SetGameModified(boolean silent);
|
|
|
|
|
|
|
|
void G_SetGamestate(gamestate_t newstate);
|
|
|
|
|
|
|
|
// Gamedata record shit
|
|
|
|
void G_AllocMainRecordData(INT16 i);
|
2018-01-22 00:15:26 +00:00
|
|
|
//void G_AllocNightsRecordData(INT16 i);
|
2014-03-15 16:59:03 +00:00
|
|
|
void G_ClearRecords(void);
|
|
|
|
|
2018-01-22 00:15:26 +00:00
|
|
|
//UINT32 G_GetBestScore(INT16 map);
|
2014-03-15 16:59:03 +00:00
|
|
|
tic_t G_GetBestTime(INT16 map);
|
2018-01-22 00:15:26 +00:00
|
|
|
//tic_t G_GetBestLap(INT16 map);
|
|
|
|
//UINT16 G_GetBestRings(INT16 map);
|
|
|
|
//UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare);
|
|
|
|
//tic_t G_GetBestNightsTime(INT16 map, UINT8 mare);
|
|
|
|
//UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare);
|
|
|
|
|
|
|
|
//void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare);
|
|
|
|
//void G_SetNightsRecords(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
FUNCMATH INT32 G_TicsToHours(tic_t tics);
|
|
|
|
FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full);
|
|
|
|
FUNCMATH INT32 G_TicsToSeconds(tic_t tics);
|
|
|
|
FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
|
|
|
|
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
|
|
|
|
|
|
|
// Don't split up TOL handling
|
|
|
|
INT16 G_TOLFlag(INT32 pgametype);
|
2018-02-04 04:47:47 +00:00
|
|
|
|
2018-11-26 09:28:39 +00:00
|
|
|
INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
|
2018-11-20 05:13:08 +00:00
|
|
|
void G_AddMapToBuffer(INT16 map);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#endif
|