1 /* Emacs style mode select   -*- C++ -*-
2  *-----------------------------------------------------------------------------
3  *
4  *
5  *  PrBoom: a Doom port merged with LxDoom and LSDLDoom
6  *  based on BOOM, a modified and improved DOOM engine
7  *  Copyright (C) 1999 by
8  *  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9  *  Copyright (C) 1999-2000 by
10  *  Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
11  *  Copyright 2005, 2006 by
12  *  Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13  *
14  *  This program is free software; you can redistribute it and/or
15  *  modify it under the terms of the GNU General Public License
16  *  as published by the Free Software Foundation; either version 2
17  *  of the License, or (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27  *  02111-1307, USA.
28  *
29  * DESCRIPTION: Main game control interface.
30  *-----------------------------------------------------------------------------*/
31 
32 #ifndef __G_GAME__
33 #define __G_GAME__
34 
35 #include "doomdef.h"
36 #include "d_event.h"
37 #include "d_ticcmd.h"
38 
39 //
40 // GAME
41 //
42 
43 // killough 5/2/98: number of bytes reserved for saving options
44 #define GAME_OPTION_SIZE 64
45 
46 // maximum number of episodes
47 #define MAX_EPISODE_NUM 7
48 
49 dbool   G_Responder(event_t *ev);
50 dbool   G_CheckDemoStatus(void);
51 void G_DeathMatchSpawnPlayer(int playernum);
52 void G_InitNew(skill_t skill, int episode, int map);
53 void G_DeferedInitNew(skill_t skill, int episode, int map);
54 void G_DeferedPlayDemo(const char *demo); // CPhipps - const
55 void G_LoadGame(int slot, dbool   is_command); // killough 5/15/98
56 void G_ForcedLoadGame(void);           // killough 5/15/98: forced loadgames
57 void G_DoLoadGame(void);
58 bool G_DoLoadGameFromBuffer(void *data, size_t length);
59 bool G_DoSaveGameToBuffer(void *buf, size_t size);
60 void G_SaveGame(int slot, char *description); // Called by M_Responder.
61 void G_ExitLevel(void);
62 void G_SecretExitLevel(void);
63 void G_WorldDone(void);
64 void G_EndGame(void); /* cph - make m_menu.c call a G_* function for this */
65 void G_Ticker(void);
66 void G_ReloadDefaults(void);     // killough 3/1/98: loads game defaults
67 void G_SaveGameName(char *, size_t, int, dbool); /* killough 3/22/98: sets savegame filename */
68 void G_SetFastParms(int);        // killough 4/10/98: sets -fast parameters
69 void G_ScaleMovementToFramerate (void);
70 void G_DoNewGame(void);
71 void G_DoReborn(int playernum);
72 void G_DoPlayDemo(void);
73 void G_DoCompleted(void);
74 void G_ReadDemoTiccmd(ticcmd_t *cmd);
75 void G_DoWorldDone(void);
76 void G_Compatibility(void);
77 const uint8_t *G_ReadOptions(const uint8_t *demo_p);   /* killough 3/1/98 - cph: const uint8_t* */
78 uint8_t *G_WriteOptions(uint8_t *demo_p);        // killough 3/1/98
79 void G_PlayerReborn(int player);
80 void G_RestartLevel(void); // CPhipps - menu involked level restart
81 void G_DoVictory(void);
82 void G_BuildTiccmd (ticcmd_t* cmd); // CPhipps - move decl to header
83 void G_ChangedPlayerColour(int pn, int cl); // CPhipps - On-the-fly player colour changing
84 void G_MakeSpecialEvent(buttoncode_t bc, ...); /* cph - new event stuff */
85 int  G_CheckNumForLevel(int episode, int map);
86 int  G_ValidateMapName(const char *mapname, int *pEpi, int *pMap);
87 
88 // killough 1/18/98: Doom-style printf;   killough 4/25/98: add gcc attributes
89 // CPhipps - renames to doom_printf to avoid name collision with glibc
90 void doom_printf(const char *, ...) __attribute__((format(printf,1,2)));
91 
92 // killough 5/2/98: moved from m_misc.c:
93 
94 extern int  key_right;
95 extern int  key_left;
96 extern int  key_up;
97 extern int  key_down;
98 extern int  key_menu_right;                                  // phares 3/7/98
99 extern int  key_menu_left;                                   //     |
100 extern int  key_menu_up;                                     //     V
101 extern int  key_menu_down;
102 extern int  key_menu_backspace;                              //     ^
103 extern int  key_menu_escape;                                 //     |
104 extern int  key_menu_enter;                                  // phares 3/7/98
105 extern int  key_strafeleft;
106 extern int  key_straferight;
107 
108 extern int  key_fire;
109 extern int  key_use;
110 extern int  key_strafe;
111 extern int  key_speed;
112 extern int  key_escape;                                             // phares
113 extern int  key_savegame;                                           //    |
114 extern int  key_loadgame;                                           //    V
115 extern int  key_autorun;
116 extern int  key_reverse;
117 extern int  key_zoomin;
118 extern int  key_zoomout;
119 extern int  key_chat;
120 extern int  key_backspace;
121 extern int  key_enter;
122 extern int  key_help;
123 extern int  key_soundvolume;
124 extern int  key_hud;
125 extern int  key_quicksave;
126 extern int  key_endgame;
127 extern int  key_messages;
128 extern int  key_quickload;
129 extern int  key_quit;
130 extern int  key_gamma;
131 extern int  key_spy;
132 extern int  key_pause;
133 extern int  key_setup;
134 extern int  key_forward;
135 extern int  key_leftturn;
136 extern int  key_rightturn;
137 extern int  key_backward;
138 extern int  key_weapontoggle;
139 extern int  key_weaponcycleup;
140 extern int  key_weaponcycledown;
141 extern int  key_weapon1;
142 extern int  key_weapon2;
143 extern int  key_weapon3;
144 extern int  key_weapon4;
145 extern int  key_weapon5;
146 extern int  key_weapon6;
147 extern int  key_weapon7;
148 extern int  key_weapon8;
149 extern int  key_weapon9;
150 extern int  destination_keys[MAXPLAYERS];
151 extern int  key_map_right;
152 extern int  key_map_left;
153 extern int  key_map_up;
154 extern int  key_map_down;
155 extern int  key_map_zoomin;
156 extern int  key_map_zoomout;
157 extern int  key_map;
158 extern int  key_map_gobig;
159 extern int  key_map_follow;
160 extern int  key_map_mark;                                           //    ^
161 extern int  key_map_clear;                                          //    |
162 extern int  key_map_grid;                                           // phares
163 extern int  key_map_rotate; // cph - map rotation
164 extern int  key_map_overlay;// cph - map overlay
165 extern int  key_screenshot;    // killough 2/22/98 -- add key for screenshot
166 extern int  autorun;           // always running?                   // phares
167 extern int  turnheld;
168 extern int  mousebfire;
169 extern int  mousebstrafe;
170 extern int  mousebforward;
171 extern int  mousebbackward;
172 extern int  mouse_double_click_use;
173 extern int  mlooky;
174 extern int FinaleStage; // cph -
175 extern int FinaleCount; // made static
176 
177 extern int  defaultskill;      //jff 3/24/98 default skill
178 extern dbool   haswolflevels;  //jff 4/18/98 wolf levels present
179 
180 extern int  bodyquesize;       // killough 2/8/98: adustable corpse limit
181 
182 // killough 5/2/98: moved from d_deh.c:
183 // Par times (new item with BOOM) - from g_game.c
184 extern int pars[4][10];  // hardcoded array size
185 extern int cpars[32];    // hardcoded array size
186 // CPhipps - Make savedesciption visible in wider scope
187 #define SAVEDESCLEN 32
188 extern char savedescription[SAVEDESCLEN];  // Description to save in savegame
189 
190 /* cph - compatibility level strings */
191 extern const char * comp_lev_str[];
192 
193 #endif
194