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 ===============================================================================
246 PLAT_DOWNBYVALUEWAITUPSTAY,
248 PLAT_UPBYVALUEWAITDOWNSTAY,
249 //PLAT_RAISEANDCHANGE,
250 //PLAT_RAISETONEARESTANDCHANGE
270 #define PLATSPEED FRACUNIT
273 extern plat_t *activeplats[MAXPLATS];
275 void T_PlatRaise(plat_t *plat);
276 int EV_DoPlat(line_t *line, byte *args, plattype_e type, int amount);
277 void P_AddActivePlat(plat_t *plat);
278 void P_RemoveActivePlat(plat_t *plat);
279 void EV_StopPlat(line_t *line, byte *args);
282 ===============================================================================
286 ===============================================================================
291 DREV_CLOSE30THENOPEN,
304 int direction; // 1 = up, 0 = waiting at top, -1 = down
305 int topwait; // tics to wait at the top (keep in case a door going down is reset)
306 int topcountdown; // when it reaches 0, start going down
309 #define VDOORSPEED FRACUNIT*2
310 #define VDOORWAIT 150
312 boolean EV_VerticalDoor(line_t *line, mobj_t *thing);
313 int EV_DoDoor(line_t *line, byte *args, vldoor_e type);
314 void T_VerticalDoor(vldoor_t *door);
315 //void P_SpawnDoorCloseIn30(sector_t *sec);
316 //void P_SpawnDoorRaiseIn5Mins(sector_t *sec, int secnum);
319 ===============================================================================
323 ===============================================================================
333 CLEV_CRUSHRAISEANDSTAY,
334 CLEV_MOVETOVALUETIMES8
342 fixed_t bottomheight, topheight;
345 int direction; // 1 = up, 0 = waiting, -1 = down
350 #define CEILSPEED FRACUNIT
352 #define MAXCEILINGS 30
354 extern ceiling_t *activeceilings[MAXCEILINGS];
356 int EV_DoCeiling(line_t *line, byte *args, ceiling_e type);
357 void T_MoveCeiling(ceiling_t *ceiling);
358 void P_AddActiveCeiling(ceiling_t *c);
359 void P_RemoveActiveCeiling(ceiling_t *c);
360 int EV_CeilingCrushStop(line_t *line, byte *args);
363 ===============================================================================
367 ===============================================================================
371 FLEV_LOWERFLOOR, // lower floor to highest surrounding floor
372 FLEV_LOWERFLOORTOLOWEST, // lower floor to lowest surrounding floor
373 FLEV_LOWERFLOORBYVALUE,
374 FLEV_RAISEFLOOR, // raise floor to lowest surrounding CEILING
375 FLEV_RAISEFLOORTONEAREST, // raise floor to next highest surrounding floor
376 FLEV_RAISEFLOORBYVALUE,
377 FLEV_RAISEFLOORCRUSH,
378 FLEV_RAISEBUILDSTEP, // One step of a staircase
379 FLEV_RAISEBYVALUETIMES8,
380 FLEV_LOWERBYVALUETIMES8,
381 FLEV_LOWERTIMES8INSTANT,
382 FLEV_RAISETIMES8INSTANT,
383 FLEV_MOVETOVALUETIMES8
395 fixed_t floordestheight;
399 fixed_t stairsDelayHeight;
400 fixed_t stairsDelayHeightDelta;
403 short resetDelayCount;
423 fixed_t originalHeight;
433 #define FLOORSPEED FRACUNIT
449 result_e T_MovePlane(sector_t *sector, fixed_t speed,
450 fixed_t dest, int crush, int floorOrCeiling, int direction);
452 int EV_BuildStairs(line_t *line, byte *args, int direction, stairs_e type);
453 int EV_DoFloor(line_t *line, byte *args, floor_e floortype);
454 void T_MoveFloor(floormove_t *floor);
455 void T_BuildPillar(pillar_t *pillar);
456 void T_FloorWaggle(floorWaggle_t *waggle);
457 int EV_BuildPillar(line_t *line, byte *args, boolean crush);
458 int EV_OpenPillar(line_t *line, byte *args);
459 int EV_DoFloorAndCeiling(line_t *line, byte *args, boolean raise);
460 int EV_FloorCrushStop(line_t *line, byte *args);
461 boolean EV_StartFloorWaggle(int tag, int height, int speed, int offset,
464 //--------------------------------------------------------------------------
468 //--------------------------------------------------------------------------
470 boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle,
472 boolean EV_Teleport(int tid, mobj_t *thing, boolean fog);
474 //--------------------------------------------------------------------------
478 //--------------------------------------------------------------------------
480 #define MAX_ACS_SCRIPT_VARS 10
481 #define MAX_ACS_MAP_VARS 32
482 #define MAX_ACS_WORLD_VARS 64
483 #define ACS_STACK_DEPTH 32
484 #define MAX_ACS_STORE 20
493 ASTE_WAITINGFORSCRIPT,
497 typedef struct acs_s acs_t;
498 typedef struct acsInfo_s acsInfo_t;
518 int stack[ACS_STACK_DEPTH];
520 int vars[MAX_ACS_SCRIPT_VARS];
526 int map; // Target map
527 int script; // Script number on target map
528 byte args[4]; // Padded to 4 for alignment
531 void P_LoadACScripts(int lump);
532 boolean P_StartACS(int number, int map, byte *args, mobj_t *activator,
533 line_t *line, int side);
534 boolean P_StartLockedACS(line_t *line, byte *args, mobj_t *mo, int side);
535 boolean P_TerminateACS(int number, int map);
536 boolean P_SuspendACS(int number, int map);
537 void T_InterpretACS(acs_t *script);
538 void P_TagFinished(int tag);
539 void P_PolyobjFinished(int po);
540 void P_ACSInitNewGame(void);
541 void P_CheckACSStore(void);
543 extern int ACScriptCount;
544 extern byte *ActionCodeBase;
545 extern acsInfo_t *ACSInfo;
546 extern int MapVars[MAX_ACS_MAP_VARS];
547 extern int WorldVars[MAX_ACS_WORLD_VARS];
548 extern acsstore_t ACSStore[MAX_ACS_STORE+1]; // +1 for termination marker
550 //--------------------------------------------------------------------------
554 //--------------------------------------------------------------------------
556 extern mobjtype_t TranslateThingType[];
558 boolean EV_ThingProjectile(byte *args, boolean gravity);
559 boolean EV_ThingSpawn(byte *args, boolean fog);
560 boolean EV_ThingActivate(int tid);
561 boolean EV_ThingDeactivate(int tid);
562 boolean EV_ThingRemove(int tid);
563 boolean EV_ThingDestroy(int tid);