DOOM64-RE

DOOM 64 Reverse Engineering
Log | Files | Refs | README | LICENSE

p_spec.h (14634B)


      1 /* P_spec.h */
      2 
      3 #include "r_local.h"
      4 
      5 /*
      6 ===============================================================================
      7 
      8 							P_SPEC
      9 
     10 ===============================================================================
     11 */
     12 
     13 /* */
     14 /*	Aim Camera */
     15 /* */
     16 typedef struct
     17 {
     18 	thinker_t	thinker;
     19 	mobj_t      *viewmobj;
     20 } aimcamera_t;
     21 
     22 /* */
     23 /*	move Camera */
     24 /* */
     25 typedef struct
     26 {
     27 	thinker_t	thinker;
     28 	fixed_t     x;
     29 	fixed_t     y;
     30 	fixed_t     z;
     31 	fixed_t     slopex;
     32 	fixed_t     slopey;
     33 	fixed_t     slopez;
     34 	int         tic;
     35 	int         current;
     36 } movecamera_t;
     37 
     38 /* */
     39 /*	Fade Mobj in/out */
     40 /* */
     41 typedef struct
     42 {
     43 	thinker_t	thinker;
     44 	mobj_t      *mobj;
     45 	int         amount;
     46 	int         destAlpha;
     47 	int         flagReserve;
     48 } fade_t;
     49 
     50 /* */
     51 /*	Fade Bright */
     52 /* */
     53 typedef struct
     54 {
     55 	thinker_t	thinker;
     56 	int         factor;
     57 } fadebright_t;
     58 
     59 /* */
     60 /*	Mobj Exp */
     61 /* */
     62 typedef struct
     63 {
     64 	thinker_t	thinker;
     65 	int         delay;
     66 	int         lifetime;
     67 	int         delaydefault;
     68 	mobj_t      *mobj;
     69 } mobjexp_t;
     70 
     71 
     72 /* */
     73 /*	Quake */
     74 /* */
     75 typedef struct
     76 {
     77 	thinker_t	thinker;
     78 	int         tics;
     79 } quake_t;
     80 
     81 
     82 /* */
     83 /*	Animating textures and planes */
     84 /* */
     85 typedef struct
     86 {
     87 	int		basepic;
     88 	int		picstart;
     89 	int		picend;
     90 	int		current;
     91 	int     frame;
     92 	int		tics;
     93 	int     delay;
     94 	int     delaycnt;
     95 	boolean isreverse;
     96 } anim_t;
     97 
     98 /* */
     99 /*	psx doom / doom64 exit delay */
    100 /* */
    101 typedef struct
    102 {
    103 	thinker_t  thinker;
    104 	int tics;
    105 	void(*finishfunc)(void);
    106 }delay_t;
    107 
    108 /* */
    109 /*	source animation definition */
    110 /* */
    111 typedef struct
    112 {
    113     int     delay;
    114 	char	startname[9];
    115 	int     frames;
    116 	int		speed;
    117 	boolean	isreverse;
    118 	boolean	ispalcycle;
    119 } animdef_t;
    120 
    121 #define	MAXANIMS		15  //[d64] is 15
    122 extern	anim_t	anims[MAXANIMS], *lastanim;
    123 
    124 extern card_t   MapBlueKeyType;
    125 extern card_t   MapRedKeyType;
    126 extern card_t   MapYellowKeyType;
    127 
    128 /* */
    129 /*	Animating line specials */
    130 /* */
    131 extern	line_t	**linespeciallist;
    132 extern	int		numlinespecials;
    133 
    134 /* */
    135 /*	Animating sector specials */
    136 /* */
    137 extern	sector_t    **sectorspeciallist;
    138 extern	int         numsectorspecials;
    139 
    140 /*	Define values for map objects */
    141 #define	MO_TELEPORTMAN		14
    142 
    143 
    144 /* at game start */
    145 //void	P_InitPicAnims (void);
    146 
    147 /* at map load */
    148 void	P_SpawnSpecials (void);
    149 
    150 /* every tic */
    151 void 	P_UpdateSpecials (void);
    152 
    153 /* when needed */
    154 boolean	P_UseSpecialLine (line_t *line, mobj_t *thing);
    155 //void	P_ShootSpecialLine ( mobj_t *thing, line_t *line);
    156 //void P_CrossSpecialLine (line_t *line,mobj_t *thing);
    157 
    158 void 	P_PlayerInSpecialSector (player_t *player, sector_t *sec);
    159 
    160 int		twoSided(int sector,int line);
    161 sector_t *getSector(int currentSector,int line,int side);
    162 side_t	*getSide(int currentSector,int line, int side);
    163 fixed_t	P_FindLowestFloorSurrounding(sector_t *sec);
    164 fixed_t	P_FindHighestFloorSurrounding(sector_t *sec);
    165 fixed_t	P_FindNextHighestFloor(sector_t *sec,int currentheight);
    166 fixed_t	P_FindLowestCeilingSurrounding(sector_t *sec);
    167 fixed_t	P_FindHighestCeilingSurrounding(sector_t *sec);
    168 int		P_FindSectorFromLineTag(int tag,int start);
    169 int		P_FindMinSurroundingLight(sector_t *sector,int max);
    170 sector_t *getNextSector(line_t *line,sector_t *sec);
    171 
    172 int P_FindLightFromLightTag(int tag,int start);
    173 boolean P_ActivateLineByTag(int tag,mobj_t *thing);
    174 
    175 /* */
    176 /*	SPECIAL */
    177 /* */
    178 int EV_DoDonut(line_t *line);
    179 
    180 /*
    181 ===============================================================================
    182 
    183 							P_LIGHTS
    184 
    185 ===============================================================================
    186 */
    187 
    188 typedef struct
    189 {
    190 	thinker_t	thinker;
    191 	sector_t    *sector;
    192 	int		    count;
    193 	int		    special;
    194 } fireflicker_t;
    195 
    196 typedef struct
    197 {
    198 	thinker_t	thinker;
    199 	sector_t	*sector;
    200 	int			count;
    201 	int		    special;
    202 } lightflash_t;
    203 
    204 typedef struct
    205 {
    206 	thinker_t	thinker;
    207 	sector_t	*sector;
    208 	int			count;
    209 	int			maxlight;
    210 	int			darktime;
    211 	int			brighttime;
    212 	int		    special;
    213 } strobe_t;
    214 
    215 typedef enum
    216 {
    217 	PULSENORMAL,
    218 	PULSESLOW,
    219 	PULSERANDOM
    220 } glowtype_e;
    221 
    222 /*#define GLOWSPEED           2
    223 #define STROBEBRIGHT        1
    224 #define SUPERFAST           10
    225 #define FASTDARK            15
    226 #define SLOWDARK            30*/
    227 
    228 typedef struct
    229 {
    230 	thinker_t	thinker;
    231 	sector_t	*sector;
    232 	glowtype_e	type;
    233 	int			count;
    234 	int			direction;
    235 	int			minlight;
    236 	int			maxlight;
    237 	int			special;
    238 } glow_t;
    239 
    240 typedef struct
    241 {
    242 	thinker_t	thinker;
    243 	sector_t	*sector;
    244 	sector_t	*headsector;
    245 	int			count;
    246 	int			start;
    247 	int			index;
    248 	int		    special;
    249 } sequenceglow_t;
    250 
    251 #define GLOWSPEED       2
    252 #define	STROBEBRIGHT    3
    253 #define	STROBEBRIGHT2   1
    254 #define	TURBODARK       4
    255 #define	FASTDARK        15
    256 #define	SLOWDARK        30
    257 
    258 void	T_FireFlicker(fireflicker_t *flick);
    259 void	P_SpawnFireFlicker(sector_t *sector);
    260 void	T_LightFlash (lightflash_t *flash);
    261 void	P_SpawnLightFlash (sector_t *sector);
    262 void	T_StrobeFlash (strobe_t *flash);
    263 void 	P_SpawnStrobeFlash (sector_t *sector, int fastOrSlow);
    264 void	P_SpawnStrobeAltFlash(sector_t *sector, int fastOrSlow);
    265 int     EV_StartLightStrobing(line_t *line);
    266 void	T_Glow(glow_t *g);
    267 void	P_SpawnGlowingLight(sector_t *sector, glowtype_e type);
    268 
    269 
    270 typedef enum
    271 {
    272     mods_flags,
    273     mods_special,
    274     mods_flats,
    275     mods_lights,
    276 } modifysector_t;
    277 
    278 #define LIGHT_FLOOR     0
    279 #define LIGHT_CEILING   1
    280 #define LIGHT_THING     2
    281 #define LIGHT_UPRWALL   3
    282 #define LIGHT_LWRWALL   4
    283 
    284 int P_ModifySectorColor(line_t* line, int index, int type);
    285 
    286 #define SEQUENCELIGHTMAX 48
    287 
    288 void T_SequenceGlow(sequenceglow_t *seq_g);
    289 void P_SpawnSequenceLight(sector_t* sector, boolean first);
    290 
    291 typedef struct
    292 {
    293 	thinker_t	thinker;
    294 	sector_t	*sector;
    295 	int         dest;
    296 	int         src;
    297 	int			r;
    298 	int			g;
    299 	int			b;
    300 	int		    inc;
    301 } lightmorph_t;
    302 
    303 void P_UpdateLightThinker(int destlight, int srclight);
    304 void T_LightMorph(lightmorph_t *lt);
    305 int P_ChangeLightByTag(int tag1, int tag2);
    306 int P_DoSectorLightChange(int tag1,int tag2);
    307 
    308 typedef struct
    309 {
    310 	thinker_t	thinker;
    311 	sector_t	*sector;
    312 	sector_t    *combiner;
    313 	int		    special;
    314 } combine_t;
    315 void P_CombineLightSpecials(sector_t *sector);
    316 
    317 /*
    318 ===============================================================================
    319 
    320 							P_SWITCH
    321 
    322 ===============================================================================
    323 */
    324 typedef struct
    325 {
    326 	char	name1[9];
    327 	char	name2[9];
    328 } switchlist_t;
    329 
    330 typedef enum
    331 {
    332 	top,
    333 	middle,
    334 	bottom
    335 } bwhere_e;
    336 
    337 typedef struct
    338 {
    339 	side_t      *side;  //old line_t		*line;
    340 	bwhere_e	where;
    341 	int			btexture;
    342 	int			btimer;
    343 	mobj_t		*soundorg;
    344 } button_t;
    345 
    346 #define	MAXSWITCHES	50		/* max # of wall switches in a level */
    347 #define	MAXBUTTONS	16		/* 4 players, 4 buttons each at once, max. */
    348 #define BUTTONTIME	30		/* 1 second */
    349 
    350 extern	button_t	buttonlist[MAXBUTTONS];
    351 
    352 void	P_ChangeSwitchTexture(line_t *line,int useAgain);
    353 void 	P_InitSwitchList(void);
    354 
    355 /*
    356 ===============================================================================
    357 
    358 							P_PLATS
    359 
    360 ===============================================================================
    361 */
    362 typedef enum
    363 {
    364 	down = -1,
    365 	waiting = 0,
    366 	up = 1,
    367 	in_stasis = 2
    368 } plat_e;
    369 
    370 typedef enum
    371 {
    372 	perpetualRaise,
    373 	raiseAndChange,
    374 	raiseToNearestAndChange,
    375 	downWaitUpStay,
    376 	blazeDWUS,
    377 	upWaitDownStay,
    378     blazeUWDS,
    379     customDownUp,
    380     customDownUpFast,
    381     customUpDown,
    382     customUpDownFast
    383 } plattype_e;
    384 
    385 typedef struct
    386 {
    387 	thinker_t	thinker;
    388 	sector_t	*sector;
    389 	fixed_t		speed;
    390 	fixed_t		low;
    391 	fixed_t		high;
    392 	int			wait;
    393 	int			count;
    394 	plat_e		status;
    395 	plat_e		oldstatus;
    396 	boolean		crush;
    397 	int			tag;
    398 	plattype_e	type;
    399 } plat_t;
    400 
    401 #define	PLATWAIT	3			/* seconds */
    402 #define	PLATSPEED	(FRACUNIT*2)
    403 #define	MAXPLATS	30
    404 
    405 extern	plat_t	*activeplats[MAXPLATS];
    406 
    407 void	T_PlatRaise(plat_t	*plat);
    408 int		EV_DoPlat(line_t *line,plattype_e type,int amount);
    409 void	P_AddActivePlat(plat_t *plat);
    410 void	P_RemoveActivePlat(plat_t *plat);
    411 int     EV_StopPlat(line_t *line);
    412 void	P_ActivateInStasis(int tag);
    413 
    414 /*
    415 ===============================================================================
    416 
    417 							P_DOORS
    418 
    419 ===============================================================================
    420 */
    421 typedef enum
    422 {
    423 	Normal,
    424 	Close30ThenOpen,
    425 	DoorClose,
    426 	DoorOpen,
    427 	RaiseIn5Mins,
    428 	BlazeRaise,
    429 	BlazeOpen,
    430 	BlazeClose
    431 } vldoor_e;
    432 
    433 typedef struct
    434 {
    435 	thinker_t	thinker;
    436 	vldoor_e	type;
    437 	sector_t	*sector;
    438 	fixed_t		topheight;
    439 	fixed_t		bottomheight;   // D64 new
    440 	boolean     initceiling;    // D64 new
    441 	fixed_t		speed;
    442 	int			direction;		/* 1 = up, 0 = waiting at top, -1 = down */
    443 	int			topwait;		/* tics to wait at the top */
    444 								/* (keep in case a door going down is reset) */
    445 	int			topcountdown;	/* when it reaches 0, start going down */
    446 } vldoor_t;
    447 
    448 #define	VDOORSPEED	FRACUNIT*2
    449 #define	VDOORWAIT	120
    450 
    451 void	EV_VerticalDoor (line_t *line, mobj_t *thing);
    452 boolean P_CheckKeyLock(line_t *line, mobj_t *thing);  // Psx Doom New
    453 int		EV_DoDoor (line_t *line, vldoor_e  type);
    454 void	T_VerticalDoor (vldoor_t *door);
    455 void	P_SpawnDoorCloseIn30 (sector_t *sec);
    456 void	P_SpawnDoorRaiseIn5Mins (sector_t *sec, int secnum);
    457 
    458 /*
    459 ===============================================================================
    460 
    461 							P_CEILNG
    462 
    463 ===============================================================================
    464 */
    465 typedef enum
    466 {
    467 	lowerToFloor,
    468 	raiseToHighest,
    469 	lowerAndCrush,
    470 	crushAndRaise,
    471 	fastCrushAndRaise,
    472 	silentCrushAndRaise,
    473 	customCeiling,
    474 	crushAndRaiseOnce,
    475 	customCeilingToHeight,
    476 } ceiling_e;
    477 
    478 typedef struct
    479 {
    480 	thinker_t	thinker;
    481 	ceiling_e	type;
    482 	sector_t	*sector;
    483 	fixed_t		bottomheight, topheight;
    484 	fixed_t		speed;
    485 	boolean		crush;
    486 	int			direction;		/* 1 = up, 0 = waiting, -1 = down */
    487 	int			tag;			/* ID */
    488 	int			olddirection;
    489 	boolean     instant;
    490 } ceiling_t;
    491 
    492 #define	CEILSPEED		FRACUNIT*2
    493 #define MAXCEILINGS		30
    494 
    495 extern	ceiling_t	*activeceilings[MAXCEILINGS];
    496 
    497 int		EV_DoCeiling (line_t *line, ceiling_e  type, fixed_t speed);
    498 void	T_MoveCeiling (ceiling_t *ceiling);
    499 void	P_AddActiveCeiling(ceiling_t *c);
    500 void	P_RemoveActiveCeiling(ceiling_t *c);
    501 int		EV_CeilingCrushStop(line_t	*line);
    502 void	P_ActivateInStasisCeiling(line_t *line);
    503 
    504 /*
    505 ===============================================================================
    506 
    507 							P_FLOOR
    508 
    509 ===============================================================================
    510 */
    511 typedef enum
    512 {
    513 	lowerFloor,			/* lower floor to highest surrounding floor */
    514 	lowerFloorToLowest,	/* lower floor to lowest surrounding floor */
    515 	turboLower,			/* lower floor to highest surrounding floor VERY FAST */
    516 	raiseFloor,			/* raise floor to lowest surrounding CEILING */
    517 	raiseFloorToNearest,	/* raise floor to next highest surrounding floor */
    518 	raiseToTexture,		/* raise floor to shortest height texture around it */
    519 	lowerAndChange,		/* lower floor to lowest surrounding floor and change */
    520 						/* floorpic */
    521 	raiseFloor24,
    522 	raiseFloor24AndChange,
    523 	raiseFloorCrush,
    524 	raiseFloorTurbo,        // [d64]: unused
    525     customFloor,
    526     customFloorToHeight
    527 } floor_e;
    528 
    529 typedef enum
    530 {
    531 	build8,	// slowly build by 8
    532 	turbo16	// quickly build by 16
    533 } stair_e;
    534 
    535 typedef struct
    536 {
    537 	thinker_t	thinker;
    538 	floor_e		type;
    539 	boolean		crush;
    540 	sector_t	*sector;
    541 	int			direction;
    542 	int			newspecial;
    543 	short		texture;
    544 	fixed_t		floordestheight;
    545 	fixed_t		speed;
    546 	boolean     instant;
    547 } floormove_t;
    548 
    549 typedef struct
    550 {
    551 	thinker_t	thinker;
    552 	sector_t	*sector;
    553 	fixed_t		ceildest;
    554 	fixed_t		flrdest;
    555 	int         ceildir;
    556 	int         flrdir;
    557 } splitmove_t;
    558 
    559 #define	FLOORSPEED	FRACUNIT*3
    560 
    561 typedef enum
    562 {
    563 	ok,
    564 	crushed,
    565 	pastdest,
    566 	stop
    567 } result_e;
    568 
    569 result_e	T_MovePlane(sector_t *sector,fixed_t speed,
    570 			fixed_t dest,boolean crush,int floorOrCeiling,int direction);
    571 
    572 int		EV_BuildStairs(line_t *line, stair_e type);
    573 int		EV_DoFloor(line_t *line,floor_e floortype,fixed_t speed);
    574 int     EV_SplitSector(line_t *line, boolean sync);// New D64
    575 void	T_MoveFloor(floormove_t *floor);
    576 void    T_MoveSplitPlane(splitmove_t *split);// New D64
    577 
    578 /*
    579 ===============================================================================
    580 
    581 							P_TELEPT
    582 
    583 ===============================================================================
    584 */
    585 int		EV_Teleport( line_t *line,mobj_t *thing );
    586 int		EV_SilentTeleport( line_t *line,mobj_t *thing );
    587 
    588 /*
    589 ===============================================================================
    590 
    591                             P_MISC
    592 
    593 ===============================================================================
    594 */
    595 
    596 void T_AimCamera(aimcamera_t *camera); // 8000DE60
    597 int P_SetAimCamera(line_t *line, boolean aim); // 8000DF20
    598 int EV_SpawnTrapMissile(line_t *line, mobj_t *target, mobjtype_t type); // 8000E02C
    599 void P_SpawnDelayTimer(int tics, void(*action)()); // 8000E1CC
    600 void T_CountdownTimer(delay_t *timer); // 8000E1CC
    601 void P_ExitLevel(void); // 8000E220
    602 void P_SecretExitLevel(int map); // 8000E25C
    603 int P_ModifyLineFlags(line_t *line, int tag); // 8000E6BC
    604 int P_ModifyLineData(line_t *line, int tag); // 8000E780
    605 int P_ModifyLineTexture(line_t *line, int tag); // 8000E82C
    606 int P_ModifySector(line_t *line, int tag, int type); // 8000E928
    607 void T_FadeThinker(fade_t *fade); // 8000EACC
    608 int EV_SpawnMobjTemplate(int tag); // 8000EB8C
    609 int EV_FadeOutMobj(int tag); // 8000ED08
    610 void T_Quake(quake_t *quake); // 8000EDE8
    611 void P_SpawnQuake(int tics); // 8000EE7C
    612 int P_RandomLineTrigger(line_t *line,mobj_t *thing); // 8000EEE0
    613 void T_MoveCamera(movecamera_t *camera); // 8000F014
    614 void P_SetMovingCamera(line_t *line); // 8000f2f8
    615 void P_RefreshBrightness(void); // 8000f410
    616 void P_SetLightFactor(int lightfactor); // 8000F458
    617 void T_FadeInBrightness(fadebright_t *fb); // 8000f610
    618 int P_ModifyMobjFlags(int tid, int flags); // 8000F674
    619 int P_AlertTaggedMobj(int tid, mobj_t *activator); // 8000F6C4
    620 void T_MobjExplode(mobjexp_t *exp); // 8000F76C
    621 
    622 /*
    623 ===============================================================================
    624 
    625                             P_MACROS
    626 
    627 ===============================================================================
    628 */
    629 
    630 typedef struct
    631 {
    632     int tag;
    633     mobj_t *activator;
    634 } macroactivator_t;
    635 
    636 /* MACRO Variables */
    637 extern macro_t     *activemacro;       // 800A6094
    638 extern mobj_t      *macroactivator;    // 800A6098
    639 extern line_t      macrotempline;      // 800A60A0
    640 extern line_t      *macroline;         // 800A60EC
    641 extern thinker_t   *macrothinker;      // 800A60F0
    642 extern int         macrointeger;       // 800A60F4
    643 extern macro_t     *restartmacro;      // 800A60F8
    644 extern int         macrocounter;       // 800A60FC
    645 extern macroactivator_t macroqueue[4]; // 800A6100
    646 extern int         macroidx1;          // 800A6120
    647 extern int         macroidx2;          // 800A6124
    648 
    649 int P_StartMacro(int macroindex, line_t *line, mobj_t *thing); // 80021088
    650 int P_SuspendMacro(void); // 80021148
    651 void P_ToggleMacros(int tag, boolean toggleon); // 80021214
    652 void P_RunMacros(void); // 8002126C
    653 void P_RestartMacro(line_t *line, int id); // 80021384