1 //---------------------------------------------------------------------------- 2 // EDGE Game Handling Code 3 //---------------------------------------------------------------------------- 4 // 5 // Copyright (c) 1999-2009 The EDGE Team. 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License 9 // as published by the Free Software Foundation; either version 2 10 // of the License, or (at your option) any later version. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 //---------------------------------------------------------------------------- 18 // 19 // Based on the DOOM source code, released by Id Software under the 20 // following copyright: 21 // 22 // Copyright (C) 1993-1996 by id Software, Inc. 23 // 24 //---------------------------------------------------------------------------- 25 26 #ifndef __G_GAME__ 27 #define __G_GAME__ 28 29 #include "ddf/main.h" 30 #include "dm_defs.h" 31 #include "e_event.h" 32 #include "e_player.h" 33 34 35 extern int random_seed; // for demo code 36 extern int starttime; // 37 38 extern int exittime; // for savegame code 39 40 // -KM- 1998/11/25 Added support for finales before levels 41 typedef enum 42 { 43 ga_nothing = 0, 44 ga_newgame, 45 ga_loadlevel, 46 ga_loadgame, 47 ga_savegame, 48 ga_playdemo, 49 ga_recorddemo, 50 ga_intermission, 51 ga_finale, 52 ga_endgame 53 } 54 gameaction_e; 55 56 extern gameaction_e gameaction; 57 58 // Game action variables: 59 // ga_newgame : defer_params 60 // ga_loadgame : defer_load_slot 61 // ga_savegame : defer_save_slot, defer_save_desc 62 // ga_playdemo : defer_demoname, timingdemo, singledemo 63 // ga_recorddemo : defer_demoname, defer_demo_parm 64 // 65 // ga_loadlevel : currmap, players, gameskill+dm+level_flags ETC 66 // ga_intermission: currmap, nextmap, players, wi_stats ETC 67 // ga_finale : nextmap, players 68 69 70 class newgame_params_c 71 { 72 public: 73 skill_t skill; 74 int deathmatch; 75 76 const mapdef_c *map; 77 // gamedef_c is implied (== map->episode) 78 79 int random_seed; 80 int total_players; 81 82 playerflag_e players[MAXPLAYERS]; 83 net_node_c *nodes[MAXPLAYERS]; 84 85 gameflags_t *flags; // can be NULL 86 87 public: 88 newgame_params_c(); 89 newgame_params_c(const newgame_params_c& src); 90 ~newgame_params_c(); 91 92 public: 93 /* methods */ 94 95 void SinglePlayer(int num_bots = 0); 96 // setup for single player (no netgame) and possibly some bots. 97 98 void CopyFlags(const gameflags_t *F); 99 }; 100 101 102 // 103 // Called by the Startup code & M_Responder; A normal game 104 // is started by calling the beginning map. The level jump 105 // cheat can get us anywhere. 106 // 107 // -ACB- 1998/08/10 New DDF Structure, Use map reference name. 108 // 109 void G_DeferredNewGame(newgame_params_c& params); 110 111 // Can be called by the startup code or M_Responder, 112 // calls P_SetupLevel or W_EnterWorld. 113 void G_DeferredLoadGame(int slot); 114 void G_DeferredSaveGame(int slot, const char *description); 115 void G_DeferredScreenShot(void); 116 void G_DeferredEndGame(void); 117 118 bool G_MapExists(const mapdef_c *map); 119 120 // -KM- 1998/11/25 Added Time param 121 void G_ExitLevel(int time); 122 void G_SecretExitLevel(int time); 123 void G_ExitToLevel(char *name, int time, bool skip_all); 124 void G_ExitToHub(const char *map_name, int tag); 125 void G_ExitToHub(int map_number, int tag); 126 127 void G_BigStuff(void); 128 void G_Ticker(void); 129 bool G_Responder(event_t * ev); 130 131 bool G_CheckWhenAppear(when_appear_e appear); 132 133 extern const mapdef_c* currmap; 134 extern const mapdef_c* nextmap; 135 136 mapdef_c* G_LookupMap(const char *refname); 137 138 void G_DoLoadLevel(void); // for demo code 139 void G_SpawnInitialPlayers(void); // 140 141 #endif /* __G_GAME__ */ 142 143 //--- editor settings --- 144 // vi:ts=4:sw=4:noexpandtab 145