Annotation of doom/p_spec.h, revision 1.1.1.3

1.1.1.2   root        1: 
1.1.1.3 ! root        2: //**************************************************************************
        !             3: //**
        !             4: //** p_spec.h : Heretic 2 : Raven Software, Corp.
        !             5: //**
        !             6: //** $RCSfile: p_spec.h,v $
        !             7: //** $Revision: 1.38 $
        !             8: //** $Date: 96/01/06 18:37:35 $
        !             9: //** $Author: bgokey $
        !            10: //**
        !            11: //**************************************************************************
1.1       root       12: 
1.1.1.2   root       13: extern int *TerrainTypes;
1.1       root       14: 
1.1.1.2   root       15: //
1.1.1.3 ! root       16: //      scrolling line specials
1.1.1.2   root       17: //
1.1       root       18: 
1.1.1.3 ! root       19: #define MAXLINEANIMS 64
        !            20: extern short numlinespecials;
        !            21: extern line_t *linespeciallist[MAXLINEANIMS];
        !            22: 
        !            23: //      Define values for map objects
        !            24: #define MO_TELEPORTMAN 14
1.1       root       25: 
1.1.1.2   root       26: // at game start
                     27: void P_InitTerrainTypes(void);
                     28: void P_InitLava(void);
                     29: 
                     30: // at map load
                     31: void P_SpawnSpecials(void);
                     32: 
                     33: // every tic
                     34: void P_UpdateSpecials(void);
1.1       root       35: 
1.1.1.2   root       36: // when needed
1.1.1.3 ! root       37: boolean P_ExecuteLineSpecial(int special, byte *args, line_t *line, int side,
        !            38:        mobj_t *mo);
        !            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);
        !            43: 
        !            44: void P_PlayerInSpecialSector(player_t *player);
        !            45: void P_PlayerOnSpecialFlat(player_t *player, int floorType);
        !            46: 
        !            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);
1.1       root       58: sector_t *getNextSector(line_t *line,sector_t *sec);
1.1.1.3 ! root       59: line_t *P_FindLine(int lineTag, int *searchPosition);
1.1       root       60: 
1.1.1.2   root       61: //
1.1.1.3 ! root       62: //      SPECIAL
1.1.1.2   root       63: //
1.1.1.3 ! root       64: //int EV_DoDonut(line_t *line);
        !            65: 
        !            66: //-------------------------------
        !            67: // P_anim.c
        !            68: //-------------------------------
        !            69: 
        !            70: void P_AnimateSurfaces(void);
        !            71: void P_InitFTAnims(void);
        !            72: void P_InitLightning(void);
        !            73: void P_ForceLightning(void);
1.1       root       74: 
                     75: /*
                     76: ===============================================================================
                     77: 
                     78:                                                        P_LIGHTS
                     79: 
                     80: ===============================================================================
                     81: */
1.1.1.3 ! root       82: 
        !            83: typedef enum
        !            84: {
        !            85:        LITE_RAISEBYVALUE,
        !            86:        LITE_LOWERBYVALUE,
        !            87:        LITE_CHANGETOVALUE,
        !            88:        LITE_FADE,
        !            89:        LITE_GLOW,
        !            90:        LITE_FLICKER,
        !            91:        LITE_STROBE
        !            92: } lighttype_t;
        !            93: 
1.1       root       94: typedef struct
                     95: {
1.1.1.3 ! root       96:        thinker_t       thinker;
1.1       root       97:        sector_t        *sector;
1.1.1.3 ! root       98:        lighttype_t     type;
        !            99:        int             value1;
        !           100:        int                     value2;
        !           101:        int                     tics1;
        !           102:        int                     tics2;
        !           103:        int             count;
        !           104: } light_t;
        !           105:        
        !           106: typedef struct
        !           107: {
        !           108:        thinker_t       thinker;
        !           109:        sector_t        *sector;
        !           110:        int index;
        !           111:        int base;
        !           112: } phase_t;
        !           113: 
        !           114: #define LIGHT_SEQUENCE_START    2
        !           115: #define LIGHT_SEQUENCE          3
        !           116: #define LIGHT_SEQUENCE_ALT      4
        !           117: 
        !           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);
        !           123: 
        !           124: #if 0
        !           125: typedef struct
        !           126: {
        !           127:        thinker_t thinker;
        !           128:        sector_t *sector;
        !           129:        int count;
        !           130:        int maxlight;
        !           131:        int minlight;
        !           132:        int maxtime;
        !           133:        int mintime;
1.1       root      134: } lightflash_t;
                    135: 
                    136: typedef struct
                    137: {
1.1.1.3 ! root      138:        thinker_t thinker;
        !           139:        sector_t *sector;
        !           140:        int count;
        !           141:        int minlight;
        !           142:        int maxlight;
        !           143:        int darktime;
        !           144:        int brighttime;
1.1       root      145: } strobe_t;
                    146: 
                    147: typedef struct
                    148: {
1.1.1.3 ! root      149:        thinker_t thinker;
        !           150:        sector_t *sector;
        !           151:        int minlight;
        !           152:        int maxlight;
        !           153:        int direction;
1.1       root      154: } glow_t;
                    155: 
1.1.1.3 ! root      156: typedef struct
        !           157: {
        !           158:        thinker_t       thinker;
        !           159:        sector_t        *sector;
        !           160:        int index;
        !           161:        int base;
        !           162: } phase_t;
        !           163: 
        !           164: #define GLOWSPEED 8
        !           165: #define STROBEBRIGHT 5
        !           166: #define FASTDARK 15
        !           167: #define SLOWDARK 35
        !           168: 
        !           169: #define LIGHT_SEQUENCE_START    2
        !           170: #define LIGHT_SEQUENCE                  3
        !           171: #define LIGHT_SEQUENCE_ALT      4
        !           172: 
        !           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);
        !           185: #endif
1.1       root      186: 
                    187: /*
                    188: ===============================================================================
                    189: 
                    190:                                                        P_SWITCH
                    191: 
                    192: ===============================================================================
                    193: */
                    194: typedef struct
                    195: {
1.1.1.3 ! root      196:        char name1[9];
        !           197:        char name2[9];
        !           198:        int soundID;
1.1       root      199: } switchlist_t;
                    200: 
                    201: typedef enum
                    202: {
1.1.1.3 ! root      203:        SWTCH_TOP,
        !           204:        SWTCH_MIDDLE,
        !           205:        SWTCH_BOTTOM
1.1       root      206: } bwhere_e;
                    207: 
                    208: typedef struct
                    209: {
1.1.1.3 ! root      210:        line_t *line;
        !           211:        bwhere_e where;
        !           212:        int btexture;
        !           213:        int btimer;
        !           214:        mobj_t *soundorg;
1.1       root      215: } button_t;
                    216: 
1.1.1.3 ! root      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
1.1       root      220: 
1.1.1.3 ! root      221: extern button_t buttonlist[MAXBUTTONS];
1.1       root      222: 
1.1.1.3 ! root      223: void P_ChangeSwitchTexture(line_t *line, int useAgain);
        !           224: void P_InitSwitchList(void);
1.1       root      225: 
                    226: /*
                    227: ===============================================================================
                    228: 
                    229:                                                        P_PLATS
                    230: 
                    231: ===============================================================================
                    232: */
1.1.1.3 ! root      233: 
1.1       root      234: typedef enum
                    235: {
1.1.1.3 ! root      236:        PLAT_UP,
        !           237:        PLAT_DOWN,
        !           238:        PLAT_WAITING,
        !           239: //     PLAT_IN_STASIS
1.1       root      240: } plat_e;
                    241: 
                    242: typedef enum
                    243: {
1.1.1.3 ! root      244:        PLAT_PERPETUALRAISE,
        !           245:        PLAT_DOWNWAITUPSTAY,
        !           246:        PLAT_DOWNBYVALUEWAITUPSTAY,
        !           247:        PLAT_UPWAITDOWNSTAY,
        !           248:        PLAT_UPBYVALUEWAITDOWNSTAY,
        !           249:        //PLAT_RAISEANDCHANGE,
        !           250:        //PLAT_RAISETONEARESTANDCHANGE
1.1       root      251: } plattype_e;
                    252: 
                    253: typedef struct
                    254: {
1.1.1.3 ! root      255:        thinker_t thinker;
        !           256:        sector_t *sector;
        !           257:        fixed_t speed;
        !           258:        fixed_t low;
        !           259:        fixed_t high;
        !           260:        int wait;
        !           261:        int count;
        !           262:        plat_e status;
        !           263:        plat_e oldstatus;
        !           264:        int crush;
        !           265:        int tag;
        !           266:        plattype_e type;
1.1       root      267: } plat_t;
                    268: 
1.1.1.3 ! root      269: #define PLATWAIT 3
        !           270: #define PLATSPEED FRACUNIT
        !           271: #define MAXPLATS 30
        !           272: 
        !           273: extern plat_t *activeplats[MAXPLATS];
        !           274: 
        !           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);
1.1       root      280: 
                    281: /*
                    282: ===============================================================================
                    283: 
                    284:                                                        P_DOORS
                    285: 
                    286: ===============================================================================
                    287: */
                    288: typedef enum
                    289: {
1.1.1.3 ! root      290:        DREV_NORMAL,
        !           291:        DREV_CLOSE30THENOPEN,
        !           292:        DREV_CLOSE,
        !           293:        DREV_OPEN,
        !           294:        DREV_RAISEIN5MINS,
1.1       root      295: } vldoor_e;
                    296: 
                    297: typedef struct
                    298: {
1.1.1.3 ! root      299:        thinker_t thinker;
        !           300:        sector_t *sector;
        !           301:        vldoor_e type;
        !           302:        fixed_t topheight;
        !           303:        fixed_t speed;
        !           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
1.1       root      307: } vldoor_t;
                    308: 
1.1.1.3 ! root      309: #define VDOORSPEED FRACUNIT*2
        !           310: #define VDOORWAIT 150
        !           311: 
        !           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);
1.1       root      317: 
                    318: /*
                    319: ===============================================================================
                    320: 
                    321:                                                        P_CEILNG
                    322: 
                    323: ===============================================================================
                    324: */
                    325: typedef enum
                    326: {
1.1.1.3 ! root      327:        CLEV_LOWERTOFLOOR,
        !           328:        CLEV_RAISETOHIGHEST,
        !           329:        CLEV_LOWERANDCRUSH,
        !           330:        CLEV_CRUSHANDRAISE,
        !           331:        CLEV_LOWERBYVALUE,
        !           332:        CLEV_RAISEBYVALUE,
        !           333:        CLEV_CRUSHRAISEANDSTAY,
        !           334:        CLEV_MOVETOVALUETIMES8
1.1       root      335: } ceiling_e;
                    336: 
                    337: typedef struct
                    338: {
1.1.1.3 ! root      339:        thinker_t thinker;
        !           340:        sector_t *sector;
        !           341:        ceiling_e type;
        !           342:        fixed_t bottomheight, topheight;
        !           343:        fixed_t speed;
        !           344:        int crush;
        !           345:        int direction; // 1 = up, 0 = waiting, -1 = down
        !           346:        int tag; // ID
        !           347:        int olddirection;
1.1       root      348: } ceiling_t;
                    349: 
1.1.1.3 ! root      350: #define CEILSPEED FRACUNIT
        !           351: #define CEILWAIT 150
        !           352: #define MAXCEILINGS 30
        !           353: 
        !           354: extern ceiling_t *activeceilings[MAXCEILINGS];
        !           355: 
        !           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);
1.1       root      361: 
                    362: /*
                    363: ===============================================================================
                    364: 
                    365:                                                        P_FLOOR
                    366: 
                    367: ===============================================================================
                    368: */
                    369: typedef enum
                    370: {
1.1.1.3 ! root      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
1.1       root      384: } floor_e;
                    385: 
                    386: typedef struct
                    387: {
1.1.1.3 ! root      388:        thinker_t thinker;
        !           389:        sector_t *sector;
        !           390:        floor_e type;
        !           391:        int crush;
        !           392:        int direction;
        !           393:        int newspecial;
        !           394:        short texture;
        !           395:        fixed_t floordestheight;
        !           396:        fixed_t speed;
        !           397:        int     delayCount;
        !           398:        int delayTotal;
        !           399:        fixed_t stairsDelayHeight;
        !           400:        fixed_t stairsDelayHeightDelta;
        !           401:        fixed_t resetHeight;
        !           402:        short resetDelay;
        !           403:        short resetDelayCount;
        !           404:        byte textureChange;
1.1       root      405: } floormove_t;
                    406: 
1.1.1.3 ! root      407: typedef struct
        !           408: {
        !           409:        thinker_t thinker;
        !           410:        sector_t *sector;
        !           411:        int ceilingSpeed;
        !           412:        int floorSpeed;
        !           413:        int floordest;
        !           414:        int ceilingdest;
        !           415:        int direction;
        !           416:        int crush;
        !           417: } pillar_t;
        !           418: 
        !           419: typedef struct
        !           420: {
        !           421:        thinker_t thinker;
        !           422:        sector_t *sector;
        !           423:        fixed_t originalHeight;
        !           424:        fixed_t accumulator;
        !           425:        fixed_t accDelta;
        !           426:        fixed_t targetScale;
        !           427:        fixed_t scale;
        !           428:        fixed_t scaleDelta;
        !           429:        int ticker;
        !           430:        int state;
        !           431: } floorWaggle_t;
        !           432: 
        !           433: #define FLOORSPEED FRACUNIT
1.1       root      434: 
                    435: typedef enum
                    436: {
1.1.1.3 ! root      437:        RES_OK,
        !           438:        RES_CRUSHED,
        !           439:        RES_PASTDEST
1.1       root      440: } result_e;
                    441: 
1.1.1.3 ! root      442: typedef enum
        !           443: {
        !           444:        STAIRS_NORMAL,
        !           445:        STAIRS_SYNC,
        !           446:        STAIRS_PHASED
        !           447: } stairs_e;
        !           448: 
        !           449: result_e T_MovePlane(sector_t *sector, fixed_t speed,
        !           450:                        fixed_t dest, int crush, int floorOrCeiling, int direction);
        !           451: 
        !           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,
        !           462:        int timer);
        !           463: 
        !           464: //--------------------------------------------------------------------------
        !           465: //
        !           466: // p_telept
        !           467: //
        !           468: //--------------------------------------------------------------------------
        !           469: 
        !           470: boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle,
        !           471:        boolean useFog);
        !           472: boolean EV_Teleport(int tid, mobj_t *thing, boolean fog);
        !           473: 
        !           474: //--------------------------------------------------------------------------
        !           475: //
        !           476: // p_acs
        !           477: //
        !           478: //--------------------------------------------------------------------------
1.1       root      479: 
1.1.1.3 ! root      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
1.1       root      485: 
1.1.1.3 ! root      486: typedef enum
        !           487: {
        !           488:        ASTE_INACTIVE,
        !           489:        ASTE_RUNNING,
        !           490:        ASTE_SUSPENDED,
        !           491:        ASTE_WAITINGFORTAG,
        !           492:        ASTE_WAITINGFORPOLY,
        !           493:        ASTE_WAITINGFORSCRIPT,
        !           494:        ASTE_TERMINATING
        !           495: } aste_t;
        !           496: 
        !           497: typedef struct acs_s acs_t;
        !           498: typedef struct acsInfo_s acsInfo_t;
        !           499: 
        !           500: struct acsInfo_s
        !           501: {
        !           502:        int number;
        !           503:        int *address;
        !           504:        int argCount;
        !           505:        aste_t state;
        !           506:        int waitValue;
        !           507: };
        !           508: 
        !           509: struct acs_s
        !           510: {
        !           511:        thinker_t thinker;
        !           512:        mobj_t *activator;
        !           513:        line_t *line;
        !           514:        int side;
        !           515:        int number;
        !           516:        int infoIndex;
        !           517:        int delayCount;
        !           518:        int stack[ACS_STACK_DEPTH];
        !           519:        int     stackPtr;
        !           520:        int vars[MAX_ACS_SCRIPT_VARS];
        !           521:        int *ip;
        !           522: };
1.1       root      523: 
1.1.1.3 ! root      524: typedef struct
        !           525: {
        !           526:        int map;                // Target map
        !           527:        int script;             // Script number on target map
        !           528:        byte args[4];   // Padded to 4 for alignment
        !           529: } acsstore_t;
        !           530: 
        !           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);
        !           542: 
        !           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
1.1       root      549: 
1.1.1.3 ! root      550: //--------------------------------------------------------------------------
        !           551: //
        !           552: // p_things
        !           553: //
        !           554: //--------------------------------------------------------------------------
        !           555: 
        !           556: extern mobjtype_t TranslateThingType[];
1.1       root      557: 
1.1.1.3 ! root      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);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.