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_PLAYR.C - Player movement and stuff 23 // 24 //*************************************************************************** 25 26 #ifndef _rt_playr_public 27 #define _rt_playr_public 28 29 #include "rt_actor.h" 30 #include "rt_stat.h" 31 #include "states.h" 32 #include "rottnet.h" 33 #include "rt_battl.h" 34 #include "develop.h" 35 36 37 38 extern int mouse_ry_input_scale; 39 40 #define LOW_GRAVITY 10000 41 #define NORMAL_GRAVITY 30000 42 #define HIGH_GRAVITY 250000 43 #define TAGHANDHEIGHT 40 44 45 #define MAXDEAD 32 46 #define MAXBULLETS 64 47 48 #define MAXCODENAMELENGTH 9 49 50 #define ARMED(x) ( \ 51 (gamestate.PlayerHasGun[x]) || \ 52 (!BATTLEMODE) \ 53 ) 54 55 56 typedef struct 57 { 58 statetype *state; 59 int speed; 60 classtype obclass; 61 int offset; 62 int flags; 63 64 }missile_stats; 65 66 extern missile_stats PlayerMissileData[13]; 67 68 extern int GetWeaponForItem(int itemnumber); 69 extern int GetItemForWeapon(int weapon); 70 71 72 typedef enum 73 {reset, 74 reset2, 75 done, 76 at_knife, 77 at_pulltrigger, 78 at_automatic, 79 at_dryheaving, 80 at_missileweapon 81 } attack_action; 82 83 84 typedef struct atkinf 85 { 86 attack_action attack; 87 char mtics,frame; // attack is 1 for gun, 2 for knife, 3 for machine guns, 88 // 4 for chaingun (orig. game) 89 } attack_t; 90 91 typedef struct weaptype 92 {const int screenheight; 93 int startammo; 94 int base_damage; 95 int impulse; 96 int numattacks; 97 attack_t attackinfo[14]; 98 }williamdidthis; 99 100 // 101 // Interactive input status of device, returned by SWIFT_Get3DStatus 102 // 103 typedef struct { 104 short x; 105 short y; 106 short z; 107 short pitch; 108 short roll; 109 short yaw; 110 short buttons; 111 } SWIFT_3DStatus; 112 113 114 // 115 // Static data about device, returned by SWIFT_GetStaticDeviceInfo 116 // 117 typedef struct 118 { 119 unsigned char deviceType; 120 unsigned char majorVersion; 121 unsigned char minorVersion; 122 unsigned char coordDescriptor[6]; 123 unsigned char reserved[1]; 124 } SWIFT_StaticData; 125 126 typedef struct 127 { 128 int lives; 129 int health; 130 int triads; 131 signed char ammo; 132 short poweruptime; 133 short protectiontime; 134 int new_weapon; 135 int keys; 136 int weapon; 137 int missileweapon; 138 int bulletweapon; 139 signed char HASBULLETWEAPON[3]; 140 int attackframe,attackcount,weaponframe; 141 byte player; 142 int topspeed; 143 int dmomx; 144 int dmomy; 145 int angle; 146 int anglefrac; 147 boolean buttonheld[NUMBUTTONS]; 148 boolean buttonstate[NUMBUTTONS]; 149 int horizon; 150 int lastmomz; 151 signed short playerheight; 152 signed short heightoffset; 153 signed short weaponheight; 154 byte weaponx,weapony; 155 word batblast; 156 signed char NETCAPTURED; 157 signed char HASKNIFE; 158 int oldweapon, oldmissileweapon; 159 signed short weapondowntics,weaponuptics; 160 int soundtime; 161 int healthtime; 162 objtype* guntarget; 163 int targettime; 164 // int steptime; 165 // int stepwhich; 166 boolean falling; 167 int oldshapeoffset; 168 int uniformcolor; 169 char codename[MAXCODENAMELENGTH]; 170 int oldheightoffset; 171 int team; 172 } playertype; 173 174 175 typedef struct 176 { int topspeed; 177 int toprunspeed; 178 int hitpoints; 179 int accuracy; 180 int height; 181 } ROTTCHARS; 182 183 184 #define M_LINKSTATE(x,y) \ 185 { y = &PLAYERSTATE[x->dirchoosetime];\ 186 } 187 188 189 extern williamdidthis DOGSCRATCH; 190 extern int GRAVITY; 191 extern int controlupdatetime; 192 extern int controlupdatestarted; 193 extern statobj_t *DEADPLAYER[MAXDEAD]; 194 extern int NUMDEAD; 195 extern objtype *PLAYER[MAXPLAYERS]; 196 extern objtype *player; 197 extern playertype PLAYERSTATE[MAXPLAYERS],*locplayerstate; 198 199 extern ROTTCHARS characters[5]; 200 201 extern williamdidthis FREE; 202 extern statetype s_player; 203 extern williamdidthis WEAPONS[MAXWEAPONS]; 204 extern boolean cybermanenabled; 205 extern boolean spaceballenabled; 206 extern boolean SpaceBallPresent; 207 extern boolean CybermanPresent; 208 extern boolean mouseenabled; 209 extern boolean joystickenabled; 210 extern boolean joypadenabled; 211 extern boolean joystickprogressive; 212 extern int joystickport; 213 extern int joyxmax, joyymax, joyxmin, joyymin; 214 extern int buttonscan[NUMBUTTONS]; 215 #ifdef DC 216 #define MAX_MOUSEBTN 5 217 #define MAX_JOYBTN 10 218 #else 219 #define MAX_MOUSEBTN 3 220 #define MAX_JOYBTN 4 221 #endif 222 extern int buttonmouse[MAX_MOUSEBTN*2]; 223 extern int buttonjoy[MAX_JOYBTN*2]; 224 extern boolean buttonpoll[NUMBUTTONS]; 225 extern boolean godmode; 226 extern boolean missilecam; 227 extern objtype * missobj; 228 extern int lastpolltime; 229 230 extern int controlbuf[3]; 231 extern int buttonbits; 232 233 extern int pausedstartedticcount; 234 extern boolean RefreshPause; 235 236 237 void PlayNoWaySound(void); 238 int GetBonusTimeForItem(int); 239 int GetRespawnTimeForItem(int); 240 int GetItemForWeapon(int); 241 void SetWhoHaveWeapons(void); 242 int MaxHitpointsForCharacter(playertype*); 243 void RespawnPlayerobj(objtype*); 244 void RevivePlayerobj(int,int,int,objtype*); 245 void OperateElevatorSwitch(objtype*,int,int,int); 246 void ResetPlayerstate(playertype*); 247 void InitializeWeapons(playertype*); 248 void DropWeapon(objtype*ob); 249 void PollKeyboardButtons (void); 250 void PollMouseButtons (void); 251 void PollJoystickButtons (void); 252 void PollKeyboardMove (void); 253 void PollCyberman (void); 254 void PollMouseMove (void); 255 void PollJoystickMove (void); 256 void PollControls (void); 257 void AddDemoCmd (void); 258 void AddRemoteCmd (void); 259 void PlayerSlideMove(objtype * ob); 260 void SpawnSmoke(objtype*); 261 void GetBonus(objtype*,statobj_t*); 262 void SpawnPlayerobj(int,int,int,int); 263 void ClipPlayer(void); 264 void PlayerMove ( objtype * ob ); 265 void Cmd_Use(objtype*); 266 void Cmd_Fire (objtype*ob); 267 void SpawnGunSmoke(int x, int y, int z, int angle, int bullethole); 268 void SpawnBlood(objtype * ob, int angle); 269 void SpawnMetalSparks(objtype * ob, int angle); 270 void CheckPlayerSpecials(objtype * ob); 271 void LoadPlayer ( void ); 272 void PlayerTiltHead (objtype * ob); 273 boolean InRange (objtype *p, objtype *victim, int distance); 274 void CheckUnPause ( void ); 275 void UpdatePlayers ( void ); 276 void UnTargetActor ( objtype * target ); 277 278 279 enum 280 { RENORMALIZE = 1, 281 PITFALL, 282 PITRISE, 283 COLUMNCRUSH, 284 GODMODERISE, 285 GODMODEFALL, 286 DOGMODEFALL, 287 DOGMODERISE, 288 STEPUP, 289 STEPDOWN 290 }; 291 292 extern void ResetWeapons(objtype *); 293 extern void SaveWeapons(objtype*); 294 295 extern int whichpath; 296 extern statobj_t *BulletHoles[MAXBULLETS]; 297 298 extern boolean vrenabled; 299 300 void SetupBulletHoleLink (int num, statobj_t * item); 301 302 #endif 303