2 //**************************************************************************
4 //** p_spec.h : Heretic 2 : Raven Software, Corp.
11 //**************************************************************************
13 extern int *TerrainTypes;
16 // scrolling line specials
19 #define MAXLINEANIMS 64
20 extern short numlinespecials;
21 extern line_t *linespeciallist[MAXLINEANIMS];
23 // Define values for map objects
24 #define MO_TELEPORTMAN 14
27 void P_InitTerrainTypes(void);
28 void P_InitLava(void);
31 void P_SpawnSpecials(void);
34 void P_UpdateSpecials(void);
37 boolean P_ExecuteLineSpecial(int special, byte *args, line_t *line, int side,
39 boolean P_ActivateLine(line_t *ld, mobj_t *mo, int side, int activationType);
40 //boolean P_UseSpecialLine ( mobj_t *thing, line_t *line);
41 //void P_ShootSpecialLine ( mobj_t *thing, line_t *line);
42 //void P_CrossSpecialLine (int linenum, int side, mobj_t *thing);
44 void P_PlayerInSpecialSector(player_t *player);
45 void P_PlayerOnSpecialFlat(player_t *player, int floorType);
47 //int twoSided(int sector,int line);
48 //sector_t *getSector(int currentSector,int line,int side);
49 //side_t *getSide(int currentSector,int line, int side);
50 fixed_t P_FindLowestFloorSurrounding(sector_t *sec);
51 fixed_t P_FindHighestFloorSurrounding(sector_t *sec);
52 fixed_t P_FindNextHighestFloor(sector_t *sec,int currentheight);
53 fixed_t P_FindLowestCeilingSurrounding(sector_t *sec);
54 fixed_t P_FindHighestCeilingSurrounding(sector_t *sec);
55 //int P_FindSectorFromLineTag(line_t *line,int start);
56 int P_FindSectorFromTag(int tag, int start);
57 //int P_FindMinSurroundingLight(sector_t *sector,int max);
58 sector_t *getNextSector(line_t *line,sector_t *sec);
59 line_t *P_FindLine(int lineTag, int *searchPosition);
64 //int EV_DoDonut(line_t *line);
66 //-------------------------------
68 //-------------------------------
70 void P_AnimateSurfaces(void);
71 void P_InitFTAnims(void);
72 void P_InitLightning(void);
73 void P_ForceLightning(void);
76 ===============================================================================
80 ===============================================================================
114 #define LIGHT_SEQUENCE_START 2
115 #define LIGHT_SEQUENCE 3
116 #define LIGHT_SEQUENCE_ALT 4
118 void T_Phase(phase_t *phase);
119 void T_Light(light_t *light);
120 void P_SpawnPhasedLight(sector_t *sector, int base, int index);
121 void P_SpawnLightSequence(sector_t *sector, int indexStep);
122 boolean EV_SpawnLight(line_t *line, byte *arg, lighttype_t type);
165 #define STROBEBRIGHT 5
169 #define LIGHT_SEQUENCE_START 2
170 #define LIGHT_SEQUENCE 3
171 #define LIGHT_SEQUENCE_ALT 4
173 void T_LightFlash (lightflash_t *flash);
174 void P_SpawnLightFlash (sector_t *sector);
175 void T_StrobeFlash (strobe_t *flash);
176 void P_SpawnStrobeFlash (sector_t *sector, int fastOrSlow, int inSync);
177 void EV_StartLightStrobing(line_t *line);
178 void EV_TurnTagLightsOff(line_t *line);
179 void EV_LightTurnOn(line_t *line, int bright);
180 void T_Glow(glow_t *g);
181 void P_SpawnGlowingLight(sector_t *sector);
182 void T_Phase(phase_t *phase);
183 void P_SpawnPhasedLight(sector_t *sector, int base, int index);
184 void P_SpawnLightSequence(sector_t *sector, int indexStep);
188 ===============================================================================
192 ===============================================================================
217 #define MAXSWITCHES 50 // max # of wall switches in a level
218 #define MAXBUTTONS 16 // 4 players, 4 buttons each at once, max.
219 #define BUTTONTIME 35 // 1 second
221 extern button_t buttonlist[MAXBUTTONS];
223 void P_ChangeSwitchTexture(line_t *line, int useAgain);
224 void P_InitSwitchList(void);
227 ===============================================================================
231 ===============================================================================
245 PLAT_DOWNBYVALUEWAITUPSTAY,
247 PLAT_UPBYVALUEWAITDOWNSTAY
267 #define PLATSPEED FRACUNIT
270 extern plat_t *activeplats[MAXPLATS];
272 void T_PlatRaise(plat_t *plat);
273 int EV_DoPlat(line_t *line, byte *args, plattype_e type, int amount);
274 void P_AddActivePlat(plat_t *plat);
275 void P_RemoveActivePlat(plat_t *plat);
276 void EV_StopPlat(line_t *line, byte *args);
279 ===============================================================================
283 ===============================================================================
288 DREV_CLOSE30THENOPEN,
301 int direction; // 1 = up, 0 = waiting at top, -1 = down
302 int topwait; // tics to wait at the top (keep in case a door going down is reset)
303 int topcountdown; // when it reaches 0, start going down
306 #define VDOORSPEED FRACUNIT*2
307 #define VDOORWAIT 150
309 boolean EV_VerticalDoor(line_t *line, mobj_t *thing);
310 int EV_DoDoor(line_t *line, byte *args, vldoor_e type);
311 void T_VerticalDoor(vldoor_t *door);
312 //void P_SpawnDoorCloseIn30(sector_t *sec);
313 //void P_SpawnDoorRaiseIn5Mins(sector_t *sec, int secnum);
316 ===============================================================================
320 ===============================================================================
330 CLEV_CRUSHRAISEANDSTAY,
331 CLEV_MOVETOVALUETIMES8
339 fixed_t bottomheight, topheight;
342 int direction; // 1 = up, 0 = waiting, -1 = down
347 #define CEILSPEED FRACUNIT
349 #define MAXCEILINGS 30
351 extern ceiling_t *activeceilings[MAXCEILINGS];
353 int EV_DoCeiling(line_t *line, byte *args, ceiling_e type);
354 void T_MoveCeiling(ceiling_t *ceiling);
355 void P_AddActiveCeiling(ceiling_t *c);
356 void P_RemoveActiveCeiling(ceiling_t *c);
357 int EV_CeilingCrushStop(line_t *line, byte *args);
360 ===============================================================================
364 ===============================================================================
368 FLEV_LOWERFLOOR, // lower floor to highest surrounding floor
369 FLEV_LOWERFLOORTOLOWEST, // lower floor to lowest surrounding floor
370 FLEV_LOWERFLOORBYVALUE,
371 FLEV_RAISEFLOOR, // raise floor to lowest surrounding CEILING
372 FLEV_RAISEFLOORTONEAREST, // raise floor to next highest surrounding floor
373 FLEV_RAISEFLOORBYVALUE,
374 FLEV_RAISEFLOORCRUSH,
375 FLEV_RAISEBUILDSTEP, // One step of a staircase
376 FLEV_RAISEBYVALUETIMES8,
377 FLEV_LOWERBYVALUETIMES8,
378 FLEV_LOWERTIMES8INSTANT,
379 FLEV_RAISETIMES8INSTANT,
380 FLEV_MOVETOVALUETIMES8
392 fixed_t floordestheight;
396 fixed_t stairsDelayHeight;
397 fixed_t stairsDelayHeightDelta;
400 short resetDelayCount;
420 fixed_t originalHeight;
430 #define FLOORSPEED FRACUNIT
446 result_e T_MovePlane(sector_t *sector, fixed_t speed,
447 fixed_t dest, int crush, int floorOrCeiling, int direction);
449 int EV_BuildStairs(line_t *line, byte *args, int direction, stairs_e type);
450 int EV_DoFloor(line_t *line, byte *args, floor_e floortype);
451 void T_MoveFloor(floormove_t *floor);
452 void T_BuildPillar(pillar_t *pillar);
453 void T_FloorWaggle(floorWaggle_t *waggle);
454 int EV_BuildPillar(line_t *line, byte *args, boolean crush);
455 int EV_OpenPillar(line_t *line, byte *args);
456 int EV_DoFloorAndCeiling(line_t *line, byte *args, boolean raise);
457 int EV_FloorCrushStop(line_t *line, byte *args);
458 boolean EV_StartFloorWaggle(int tag, int height, int speed, int offset,
461 //--------------------------------------------------------------------------
465 //--------------------------------------------------------------------------
467 boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle,
469 boolean EV_Teleport(int tid, mobj_t *thing, boolean fog);
471 //--------------------------------------------------------------------------
475 //--------------------------------------------------------------------------
477 #define MAX_ACS_SCRIPT_VARS 10
478 #define MAX_ACS_MAP_VARS 32
479 #define MAX_ACS_WORLD_VARS 64
480 #define ACS_STACK_DEPTH 32
481 #define MAX_ACS_STORE 20
490 ASTE_WAITINGFORSCRIPT,
494 typedef struct acs_s acs_t;
495 typedef struct acsInfo_s acsInfo_t;
515 int stack[ACS_STACK_DEPTH];
517 int vars[MAX_ACS_SCRIPT_VARS];
523 int map; // Target map
524 int script; // Script number on target map
525 byte args[4]; // Padded to 4 for alignment
528 void P_LoadACScripts(int lump);
529 boolean P_StartACS(int number, int map, byte *args, mobj_t *activator,
530 line_t *line, int side);
531 boolean P_StartLockedACS(line_t *line, byte *args, mobj_t *mo, int side);
532 boolean P_TerminateACS(int number, int map);
533 boolean P_SuspendACS(int number, int map);
534 void T_InterpretACS(acs_t *script);
535 void P_TagFinished(int tag);
536 void P_PolyobjFinished(int po);
537 void P_ACSInitNewGame(void);
538 void P_CheckACSStore(void);
540 extern int ACScriptCount;
541 extern byte *ActionCodeBase;
542 extern acsInfo_t *ACSInfo;
543 extern int MapVars[MAX_ACS_MAP_VARS];
544 extern int WorldVars[MAX_ACS_WORLD_VARS];
545 extern acsstore_t ACSStore[MAX_ACS_STORE+1]; // +1 for termination marker
547 //--------------------------------------------------------------------------
551 //--------------------------------------------------------------------------
553 extern mobjtype_t TranslateThingType[];
555 boolean EV_ThingProjectile(byte *args, boolean gravity);
556 boolean EV_ThingSpawn(byte *args, boolean fog);
557 boolean EV_ThingActivate(int tid);
558 boolean EV_ThingDeactivate(int tid);
559 boolean EV_ThingRemove(int tid);
560 boolean EV_ThingDestroy(int tid);