1 // SONIC ROBO BLAST 2
2 //-----------------------------------------------------------------------------
3 // Copyright (C) 1993-1996 by id Software, Inc.
4 // Copyright (C) 1998-2000 by DooM Legacy Team.
5 // Copyright (C) 1999-2020 by Sonic Team Junior.
6 //
7 // This program is free software distributed under the
8 // terms of the GNU General Public License, version 2.
9 // See the 'LICENSE' file for more details.
10 //-----------------------------------------------------------------------------
11 /// \file  p_setup.h
12 /// \brief Setup a game, startup stuff
13 
14 #ifndef __P_SETUP__
15 #define __P_SETUP__
16 
17 #include "doomdata.h"
18 #include "doomstat.h"
19 #include "r_defs.h"
20 
21 // map md5, sent to players via PT_SERVERINFO
22 extern unsigned char mapmd5[16];
23 
24 // Player spawn spots for deathmatch.
25 #define MAX_DM_STARTS 64
26 extern mapthing_t *deathmatchstarts[MAX_DM_STARTS];
27 extern INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts;
28 
29 extern boolean levelloading;
30 extern UINT8 levelfadecol;
31 
32 extern lumpnum_t lastloadedmaplumpnum; // for comparative savegame
33 
34 /* for levelflat type */
35 enum
36 {
37 	LEVELFLAT_NONE,/* HOM time my friend */
38 	LEVELFLAT_FLAT,
39 	LEVELFLAT_PATCH,
40 	LEVELFLAT_PNG,
41 	LEVELFLAT_TEXTURE,
42 };
43 
44 //
45 // MAP used flats lookup table
46 //
47 typedef struct
48 {
49 	char name[9]; // resource name from wad
50 
51 	UINT8  type;
52 	union
53 	{
54 		struct
55 		{
56 			lumpnum_t     lumpnum; // lump number of the flat
57 			// for flat animation
58 			lumpnum_t baselumpnum;
59 		}
60 		flat;
61 		struct
62 		{
63 			INT32             num;
64 			INT32         lastnum; // texture number of the flat
65 			// for flat animation
66 			INT32         basenum;
67 		}
68 		texture;
69 	}
70 	u;
71 
72 	UINT16 width, height;
73 
74 	// for flat animation
75 	INT32 animseq; // start pos. in the anim sequence
76 	INT32 numpics;
77 	INT32 speed;
78 
79 	// for textures
80 	UINT8 *picture;
81 #ifdef HWRENDER
82 	void *mipmap;
83 	void *mippic;
84 #endif
85 } levelflat_t;
86 
87 extern size_t numlevelflats;
88 extern levelflat_t *levelflats;
89 INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat);
90 INT32 P_AddLevelFlatRuntime(const char *flatname);
91 INT32 P_CheckLevelFlat(const char *flatname);
92 
93 extern size_t nummapthings;
94 extern mapthing_t *mapthings;
95 
96 void P_SetupLevelSky(INT32 skynum, boolean global);
97 #ifdef SCANTHINGS
98 void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
99 #endif
100 void P_RespawnThings(void);
101 boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate);
102 #ifdef HWRENDER
103 void HWR_LoadLevel(void);
104 #endif
105 boolean P_AddWadFile(const char *wadfilename);
106 boolean P_RunSOC(const char *socfilename);
107 void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
108 void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num);
109 void P_WriteThings(void);
110 size_t P_PrecacheLevelFlats(void);
111 void P_AllocMapHeader(INT16 i);
112 
113 void P_SetDemoFlickies(INT16 i);
114 void P_DeleteFlickies(INT16 i);
115 
116 // Needed for NiGHTS
117 void P_ReloadRings(void);
118 void P_SwitchSpheresBonusMode(boolean bonustime);
119 void P_DeleteGrades(INT16 i);
120 void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext);
121 UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
122 UINT8 P_HasGrades(INT16 map, UINT8 mare);
123 UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
124 
125 #endif
126