1 /* 2 Copyright (C) 1994-1995 Apogee Software, Ltd. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 20 //*************************************************************************** 21 // 22 // RT_STAT.C (static object functions) 23 // 24 //*************************************************************************** 25 #ifndef _rt_stat_public 26 #define _rt_stat_public 27 28 #include "rt_ted.h" 29 30 #define MAXSWITCHES 64 31 #define MAXANIMWALLS 17 32 #define NUMSTATS 91 33 34 typedef enum { 35 stat_ylight, 36 stat_rlight, 37 stat_glight, 38 stat_blight, 39 stat_chandelier, 40 stat_lamp, 41 stat_pedgoldkey, 42 stat_pedsilverkey, 43 stat_pedironkey, 44 stat_pedcrystalkey, 45 stat_gibs1, 46 stat_gibs2, 47 stat_gibs3, 48 stat_monkmeal, 49 stat_priestporridge, 50 stat_monkcrystal1, 51 stat_monkcrystal2, 52 stat_oneup, 53 stat_threeup, 54 stat_altbrazier1, 55 stat_altbrazier2, 56 stat_healingbasin, 57 stat_emptybasin, 58 stat_bat, 59 stat_knifestatue, 60 stat_twopistol, 61 stat_mp40, 62 stat_bazooka, 63 stat_firebomb, 64 stat_heatseeker, 65 stat_drunkmissile, 66 stat_firewall, 67 stat_splitmissile, 68 stat_kes, 69 stat_lifeitem1, 70 stat_lifeitem2, 71 stat_lifeitem3, 72 stat_lifeitem4, 73 stat_tntcrate, 74 stat_bonusbarrel, 75 stat_torch, 76 stat_floorfire, 77 stat_dipball1, 78 stat_dipball2, 79 stat_dipball3, 80 stat_touch1, 81 stat_touch2, 82 stat_touch3, 83 stat_touch4, 84 stat_dariantouch, 85 stat_scotthead, 86 stat_garb1, 87 stat_garb2, 88 stat_garb3, 89 stat_shit, 90 stat_grate, 91 stat_metalshards, 92 stat_emptypedestal, 93 stat_emptytable, 94 stat_stool, 95 stat_bcolumn, 96 stat_gcolumn, 97 stat_icolumn, 98 stat_tree, 99 stat_plant, 100 stat_urn, 101 stat_haystack, 102 stat_ironbarrel, 103 stat_heatgrate, 104 stat_standardpole, 105 stat_pit, 106 stat_godmode, 107 stat_dogmode, 108 stat_fleetfeet, 109 stat_elastic, 110 stat_mushroom, 111 stat_gasmask, 112 stat_bulletproof, 113 stat_asbesto, 114 stat_random, 115 stat_rubble, 116 stat_woodfrag, 117 stat_metalfrag, 118 stat_emptystatue, 119 stat_tomlarva, 120 stat_bullethole, 121 stat_collector, 122 stat_mine, 123 stat_missmoke, 124 stat_disk, 125 stat_badstatic 126 } stat_t; 127 128 typedef struct awall 129 { 130 byte active; 131 byte count; 132 signed char ticcount; 133 int texture; 134 int basetexture; 135 } animwall_t; 136 137 typedef struct statstruct 138 { 139 thingtype which; 140 byte tilex,tiley; 141 fixed x,y,z; 142 int shapenum; 143 unsigned flags; 144 signed char ticcount; 145 signed char ammo; 146 byte *visspot; 147 signed char count; 148 byte numanims; 149 stat_t itemnumber; 150 short int hitpoints; 151 short int whichstat; 152 short int areanumber; 153 154 int linked_to; 155 struct statstruct *statnext; 156 struct statstruct *statprev; 157 struct statstruct *nextactive; 158 struct statstruct *prevactive; 159 160 } statobj_t; 161 162 typedef struct respstruct 163 { 164 byte tilex,tiley; 165 int ticcount; 166 stat_t itemnumber; 167 int spawnz; 168 struct respstruct *next; 169 struct respstruct *prev; 170 int linked_to; 171 172 } respawn_t; 173 174 175 typedef struct 176 { 177 short heightoffset; 178 int picnum; 179 stat_t type; 180 unsigned flags; 181 byte tictime; 182 byte numanims; 183 byte hitpoints; 184 byte damage; 185 signed char ammo; 186 } statinfo; 187 188 extern statobj_t *lastactivestat,*firstactivestat; 189 extern statobj_t *firstemptystat,*lastemptystat; 190 extern int spritestart; 191 extern wall_t switches[MAXSWITCHES],*lastswitch; 192 193 extern respawn_t *firstrespawn,*lastrespawn; 194 extern statobj_t *FIRSTSTAT,*LASTSTAT,*sprites[MAPSIZE][MAPSIZE]; 195 extern statinfo stats[NUMSTATS]; 196 extern dirtype diagonal[9][9]; 197 extern dirtype opposite[9]; 198 199 extern int statcount; 200 201 extern int animwallstart; 202 extern animwall_t animwalls[MAXANIMWALLS]; 203 204 205 void Set_NewZ_to_MapValue(fixed*,int,const char*,int,int); 206 void RemoveFromFreeStaticList(statobj_t*); 207 void CheckCriticalStatics(void); 208 void ActivateLight(int); 209 void DeactivateLight(int); 210 void TurnOnLight(int,int); 211 void TurnOffLight(int,int); 212 void MakeStatActive(statobj_t*); 213 void MakeStatInactive(statobj_t*); 214 void AddStatic(statobj_t *); 215 void RemoveStatic(statobj_t *); 216 217 218 void SpawnSwitchThingy(int,int); 219 void InitStaticList (void); 220 void InitAnimatedWallList(void); 221 void SetupAnimatedWall(int which); 222 void SpawnStatic (int tilex, int tiley, int mtype, int zoffset); 223 void SpawnSolidStatic (statobj_t * temp); 224 void AnimateWalls(void); 225 void DoSprites(void); 226 227 void SaveAnimWalls(byte ** buf, int * size); 228 void SaveStatics(byte ** buf, int * size); 229 230 void LoadAnimWalls(byte * buf, int size); 231 void LoadStatics(byte * buf, int size); 232 233 void SaveSwitches(byte ** buf, int * size); 234 void LoadSwitches(byte * buf, int size); 235 236 void SpawnInertStatic (int x, int y, int z, int mtype); 237 void SpawnStaticDamage(statobj_t * stat, int angle); 238 239 #endif 240