1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
|
/*
Copyright (C) 1994-1995 Apogee Software, Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _rt_actor_public
#define _rt_actor_public
//***************************************************************************
//
// RT_ACTOR.C (actor functions)
//
//***************************************************************************
#include "states.h"
#define FL_SYNCED 0x400
#define FL_MASTER 0x800
#define FL_SKELETON 0x02
#define GASTICS 1050
#define M_ISACTOR(x) ((x!=NULL) && (x->which == ACTOR))
#define SF_GUTS 0x20
#define NUMENEMIES 16
#define NUMCLASSES 51
#define MAXTOUCH 10
#define MAXPOP 32
#define MAXDELETE 512
#define InMapBounds(x,y) (((x) >= 0) && ((x) < MAPSIZE) && ((y) >= 0) && ((y) < MAPSIZE))
#define ACTIVE(ob) ((ob == firstactive) || (ob->prevactive) || (ob->nextactive))
enum {SHOOT,SIGHT,DIRCHECK,EXPLOSION,MISSILE};
typedef enum
{
gt_sparks,
gt_organ,
gt_rib,
gt_pinkorgan,
gt_head,
gt_arm,
gt_leg,
gt_humerus,
gt_pelvis,
gt_limb,
gt_bsoul,
gt_lsoul,
gt_spit,
NumGibTypes
}gib_t;
#define GUTS (NumGibTypes)
#define RANDOM (NumGibTypes + 1)
#define DISEMBOWEL (NumGibTypes + 2)
#define GASVALUE 192
#define PAINOFFSET 2
#define PMFOFFSET 50
#define REMOTEOFFSET 86
#define ACTORSIZE 0x5800
#define PWALLRAD 0xa000
#ifdef __WATCOMC__
int M_ABS(int value);
#pragma aux M_ABS = \
"test eax,eax", \
"jge done", \
"neg eax",\
"done: " \
parm [eax] \
value [eax] \
modify exact [eax]
#else
#define M_ABS abs
#endif
#define M_CheckPlayerKilled(ob) \
{ if ((ob->obclass == playerobj) && (ob->flags & FL_DYING)) \
BATTLE_CheckGameStatus(battle_player_killed,ob->dirchoosetime);\
}
#define SetTilePosition(ob, newtilex, newtiley) \
{ \
ob->tilex = newtilex; \
ob->tiley = newtiley; \
ob->x = (ob->tilex << TILESHIFT) + TILEGLOBAL/2; \
ob->y = (ob->tiley << TILESHIFT) + TILEGLOBAL/2; \
}
#define SetFinePosition(ob, newx, newy) \
{ \
ob->x = newx; \
ob->y = newy; \
ob->tilex = (ob->x >> TILESHIFT); \
ob->tiley = (ob->y >> TILESHIFT); \
}
#define SetVisiblePosition(ob, x, y) \
{ \
ob->drawx = x; \
ob->drawy = y; \
}
//***************************************************************************
//
// WeaponDamages
//
//***************************************************************************
#define DMG_PISTOL 13
#define DMG_MP40 10
#define DMG_AHGUN 10
#define DMG_ENEMYBULLETWEAPON 10
typedef struct bas
{
short operate,
see,
fire,
hit,
die;
} basic_actor_sounds;
extern basic_actor_sounds BAS[NUMCLASSES+3];
typedef struct
{int x,y;
}_2Dpoint;
typedef enum {
inertobj,
playerobj,
lowguardobj,
highguardobj,
overpatrolobj,
strikeguardobj,
blitzguardobj,
triadenforcerobj,
deathmonkobj,
dfiremonkobj,
roboguardobj,
b_darianobj,
b_heinrichobj,
b_robobossobj,
b_darkmonkobj,
b_darksnakeobj,
patrolgunobj,
wallopobj,
//specials
pillarobj,
firejetobj,
bladeobj,
crushcolobj,
boulderobj,
spearobj,
gasgrateobj,
springobj,
// Missile weapon types
shurikenobj,
wallfireobj,
netobj,
h_mineobj,
grenadeobj,
fireballobj,
dmfballobj,
bigshurikenobj,
missileobj,
NMEsaucerobj,
dm_weaponobj,
dm_heatseekobj,
dm_spitobj,
p_bazookaobj,
p_firebombobj,
p_heatseekobj,
p_drunkmissileobj,
p_firewallobj,
p_splitmissileobj,
p_kesobj,
p_godballobj,
collectorobj,
diskobj,
rainobj
}classtype;
typedef struct objstruct
{
thingtype which;
byte tilex,tiley;
fixed x,y,z;
int shapenum;
unsigned flags;
short ticcount;
signed short hitpoints;
word whichactor;
signed short dirchoosetime;
fixed drawx,drawy;
classtype obclass;
statetype * state;
signed char door_to_open;
byte areanumber;
signed short shapeoffset;
int targettilex,targettiley;
dirtype dir;
short int angle;
short int yzangle;
int soundhandle;
int speed;
int momentumx, momentumy, momentumz;
int temp1,temp2,temp3;
void *whatever,*target;
struct objstruct *next, *prev;
struct objstruct *nextactive, *prevactive;
struct objstruct *nextinarea, *previnarea;
} objtype;
typedef struct b_struct
{int NMErotate;
int NMEdirstried;
int NMEqueuesize;
int ESAU_HIDING,ESAU_SHOOTING;
int HRAMMING, HMINING;
int SOUNDTIME;
int redindex,REDTIME;
int monkz;
int monkup;
int firespawned;
int notouch,noholes;
int nexttouch,nextpop;
int popsleft;
int DSTATE;
int doorcount;
int KEYACTORSLEFT;
int GASON;
int gasindex;
boolean NET_IN_FLIGHT;
boolean madenoise;
_2Dpoint ETOUCH[MAXTOUCH],EPOP[MAXPOP],TOMLOC;
int NUMWEAPONS;
int BulletHoleNum;
int NUMBEGGINGKEVINS;
boolean fulllightgibs;
boolean directgibs;
int gibgravity;
int gibspeed;
boolean supergibflag;
boolean randgibspeed;
int numgibs;
boolean elevatormusicon;
}misc_stuff;
extern boolean ludicrousgibs;
extern objtype* PLAYER0MISSILE;
extern byte deathshapeoffset[8];
extern byte RANDOMACTORTYPE[10];
extern objtype* FIRSTACTOR,*LASTACTOR;
extern objtype *FIRSTRAIN,*LASTRAIN;
extern objtype* SCREENEYE;
extern objtype *firstareaactor[NUMAREAS+1],*lastareaactor[NUMAREAS+1];
extern misc_stuff mstruct,*MISCVARS;
extern int actorstart,actorstop;
extern exit_t playstate;
extern objtype *lastactive,*firstactive;
extern objtype *new,**objlist,
*killerobj;
extern void *actorat[MAPSIZE][MAPSIZE];
extern int angletodir[ANGLES];
extern _2Dpoint SNAKEPATH[512];
extern int STOPSPEED;
extern int FRICTION;
extern int objcount;
void SpawnInertActor(int,int,int);
objtype* DiskAt(int tilex,int tiley);
void GetRainActors(void);
void DoRain(void);
void SpawnDisk(int,int,int,boolean);
void T_ElevDisk(objtype*);
void Add_To_Delete_Array(void*);
void Remove_Delete_Array_Entries(void);
void MakeInactive(objtype*ob);
void RespawnEluder(void);
void SpawnCollector(int,int);
void MakeLastInArea(objtype*);
void RemoveFromArea(objtype*);
void GetMomenta(objtype*,objtype*,int*,int*,int*,int);
int AngleBetween(objtype*,objtype*);
void TurnActorIntoSprite(objtype*);
void ResolveDoorSpace(int,int);
void RemoveObj(objtype*);
void SpawnParticles(objtype*,int,int);
void MakeActive(objtype*);
void SpawnSpear(int,int,int);
void SpawnBoulder(int,int,int);
void SpawnCrushingColumn(int,int,int);
void SpawnFirejet(int,int,int,int);
void T_Firethink(objtype*);
void SpawnBlade(int,int,int,int,int);
void T_OrobotChase(objtype*);
void SpawnMultiSpriteActor(classtype,int,int,int);
boolean ActorTryMove(objtype*,int,int,int);
void A_Repeat(objtype*);
void T_Heinrich_Defend(objtype*);
void T_Heinrich_Out_of_Control(objtype*);
void A_HeinrichShoot(objtype*);
void T_EsauWait(objtype*);
void T_EsauRise(objtype*);
void A_Drain(objtype*ob);
void T_Explosion(objtype*ob);
void T_MoveColumn(objtype*);
void EnableObject(int object);
void DisableObject(int);
void T_Collide(objtype*);
void Collision(objtype*ob,objtype *attacker,int hitmomentumx,int hitmomentumy);
void ActorMovement (objtype *);
void MoveActor(objtype*);
void InitActorList(void);
void NewState(objtype*,statetype*);
void DoActor(objtype*);
void SpawnPushColumn(int tilex,int tiley,int which,int dir, int linked);
void SpawnGunThingy(classtype which, int tilex, int tiley, int dir);
void SpawnStand (classtype which, int tilex, int tiley, int dir, int ambush);
void SpawnPatrol (classtype which, int tilex, int tiley, int dir);
void SpawnDeadGuard (int tilex, int tiley);
void SpawnWallfire(int tilex, int tiley, int dir);
void SpawnMissile(objtype*,classtype,int,int,statetype*,int);
void InitHitRect (objtype *ob, unsigned radius);
void NewState (objtype *ob, statetype *state);
void SelectPathDir(objtype*);
void SelectChaseDir (objtype *ob);
boolean SightPlayer (objtype *ob);
boolean CheckLine (void*,void *,int);
boolean CheckSight (objtype *ob,void*);
void KillActor (objtype *ob);
void DamageThing (void *, int);
void MissileHit (objtype *,void*);
void GetNewActor(void);
void T_WallPath(objtype*);
void T_Path (objtype *ob); //done
void T_RoboChase(objtype*ob);
void T_RoboPath(objtype*ob);
void T_Chase (objtype *ob); //done
void T_EsauChase(objtype*ob); //done
void T_Spears(objtype*);
void T_Projectile (objtype *ob); //done
void T_Stand (objtype *ob); //done
void T_GunStand(objtype *ob); //done
void T_Use(objtype *ob); // done
void A_Shoot (objtype *ob); // done
void A_MissileWeapon(objtype*); // done
void A_Wallfire(objtype*);
void A_Steal(objtype*);
void T_Roll(objtype*);
void T_BossDied (objtype *ob);
boolean QuickSpaceCheck(objtype*,int,int);
void PushWallMove(int num);
void SpawnNewObj(unsigned,unsigned,statetype*,classtype);
void SpawnSpring(int,int);
void SpawnFourWayGun(int,int);
void SpawnSnake(int tilex,int tiley);
void SpawnSneaky(int,int);
boolean MissileTryMove(objtype*ob,int,int,int);
void SaveActors(byte ** buf, int * size);
void LoadActors(byte * buf, int size);
boolean TurnOffLight0 (int tilex, int tiley);
boolean TurnOffLight1 (int tilex, int tiley, int i, int j);
boolean TurnOffLight2 (int tilex, int tiley, int j);
boolean TurnOffLight3 (int tilex, int tiley, int i);
void ParseMomentum(objtype *ob,int angle);
void SpawnGroundExplosion(int x, int y, int z);
void RayShoot (objtype * shooter, int damage, int accuracy);
void FindEmptyTile(int *stilex, int *stiley);
void T_Wind( objtype *ob );
void StopWind( void );
#endif
|