Annotation of doom/p_spec.h, revision 1.1.1.4

1.1.1.4 ! root        1: // Emacs style mode select   -*- C++ -*- 
        !             2: //-----------------------------------------------------------------------------
        !             3: //
        !             4: // $Id:$
        !             5: //
        !             6: // Copyright (C) 1993-1996 by id Software, Inc.
        !             7: //
        !             8: // This source is available for distribution and/or modification
        !             9: // only under the terms of the DOOM Source Code License as
        !            10: // published by id Software. All rights reserved.
        !            11: //
        !            12: // The source is distributed in the hope that it will be useful,
        !            13: // but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            14: // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
        !            15: // for more details.
        !            16: //
        !            17: // DESCRIPTION:  none
        !            18: //     Implements special effects:
        !            19: //     Texture animation, height or lighting changes
        !            20: //      according to adjacent sectors, respective
        !            21: //      utility functions, etc.
        !            22: //
        !            23: //-----------------------------------------------------------------------------
        !            24: 
        !            25: 
        !            26: #ifndef __P_SPEC__
        !            27: #define __P_SPEC__
        !            28: 
        !            29: 
        !            30: //
        !            31: // End-level timer (-TIMER option)
        !            32: //
        !            33: extern boolean levelTimer;
        !            34: extern int     levelTimeCount;
1.1.1.2   root       35: 
1.1.1.3   root       36: 
                     37: //      Define values for map objects
1.1.1.4 ! root       38: #define MO_TELEPORTMAN          14
        !            39: 
1.1       root       40: 
1.1.1.2   root       41: // at game start
1.1.1.4 ! root       42: void    P_InitPicAnims (void);
1.1.1.2   root       43: 
                     44: // at map load
1.1.1.4 ! root       45: void    P_SpawnSpecials (void);
1.1.1.2   root       46: 
                     47: // every tic
1.1.1.4 ! root       48: void    P_UpdateSpecials (void);
1.1       root       49: 
1.1.1.2   root       50: // when needed
1.1.1.4 ! root       51: boolean
        !            52: P_UseSpecialLine
        !            53: ( mobj_t*      thing,
        !            54:   line_t*      line,
        !            55:   int          side );
        !            56: 
        !            57: void
        !            58: P_ShootSpecialLine
        !            59: ( mobj_t*      thing,
        !            60:   line_t*      line );
        !            61: 
        !            62: void
        !            63: P_CrossSpecialLine
        !            64: ( int          linenum,
        !            65:   int          side,
        !            66:   mobj_t*      thing );
        !            67: 
        !            68: void    P_PlayerInSpecialSector (player_t* player);
        !            69: 
        !            70: int
        !            71: twoSided
        !            72: ( int          sector,
        !            73:   int          line );
        !            74: 
        !            75: sector_t*
        !            76: getSector
        !            77: ( int          currentSector,
        !            78:   int          line,
        !            79:   int          side );
        !            80: 
        !            81: side_t*
        !            82: getSide
        !            83: ( int          currentSector,
        !            84:   int          line,
        !            85:   int          side );
        !            86: 
        !            87: fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
        !            88: fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
        !            89: 
        !            90: fixed_t
        !            91: P_FindNextHighestFloor
        !            92: ( sector_t*    sec,
        !            93:   int          currentheight );
        !            94: 
        !            95: fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
        !            96: fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
        !            97: 
        !            98: int
        !            99: P_FindSectorFromLineTag
        !           100: ( line_t*      line,
        !           101:   int          start );
        !           102: 
        !           103: int
        !           104: P_FindMinSurroundingLight
        !           105: ( sector_t*    sector,
        !           106:   int          max );
        !           107: 
        !           108: sector_t*
        !           109: getNextSector
        !           110: ( line_t*      line,
        !           111:   sector_t*    sec );
1.1       root      112: 
                    113: 
1.1.1.4 ! root      114: //
        !           115: // SPECIAL
        !           116: //
        !           117: int EV_DoDonut(line_t* line);
1.1       root      118: 
1.1.1.3   root      119: 
1.1.1.4 ! root      120: 
        !           121: //
        !           122: // P_LIGHTS
        !           123: //
        !           124: typedef struct
1.1.1.3   root      125: {
1.1.1.4 ! root      126:     thinker_t  thinker;
        !           127:     sector_t*  sector;
        !           128:     int                count;
        !           129:     int                maxlight;
        !           130:     int                minlight;
        !           131:     
        !           132: } fireflicker_t;
        !           133: 
        !           134: 
1.1.1.3   root      135: 
1.1       root      136: typedef struct
                    137: {
1.1.1.4 ! root      138:     thinker_t  thinker;
        !           139:     sector_t*  sector;
        !           140:     int                count;
        !           141:     int                maxlight;
        !           142:     int                minlight;
        !           143:     int                maxtime;
        !           144:     int                mintime;
        !           145:     
1.1       root      146: } lightflash_t;
                    147: 
1.1.1.4 ! root      148: 
        !           149: 
1.1       root      150: typedef struct
                    151: {
1.1.1.4 ! root      152:     thinker_t  thinker;
        !           153:     sector_t*  sector;
        !           154:     int                count;
        !           155:     int                minlight;
        !           156:     int                maxlight;
        !           157:     int                darktime;
        !           158:     int                brighttime;
        !           159:     
1.1       root      160: } strobe_t;
                    161: 
1.1.1.4 ! root      162: 
        !           163: 
        !           164: 
1.1       root      165: typedef struct
                    166: {
1.1.1.4 ! root      167:     thinker_t  thinker;
        !           168:     sector_t*  sector;
        !           169:     int                minlight;
        !           170:     int                maxlight;
        !           171:     int                direction;
        !           172: 
1.1       root      173: } glow_t;
                    174: 
                    175: 
1.1.1.4 ! root      176: #define GLOWSPEED                      8
        !           177: #define STROBEBRIGHT           5
        !           178: #define FASTDARK                       15
        !           179: #define SLOWDARK                       35
        !           180: 
        !           181: void    P_SpawnFireFlicker (sector_t* sector);
        !           182: void    T_LightFlash (lightflash_t* flash);
        !           183: void    P_SpawnLightFlash (sector_t* sector);
        !           184: void    T_StrobeFlash (strobe_t* flash);
        !           185: 
        !           186: void
        !           187: P_SpawnStrobeFlash
        !           188: ( sector_t*    sector,
        !           189:   int          fastOrSlow,
        !           190:   int          inSync );
        !           191: 
        !           192: void    EV_StartLightStrobing(line_t* line);
        !           193: void    EV_TurnTagLightsOff(line_t* line);
        !           194: 
        !           195: void
        !           196: EV_LightTurnOn
        !           197: ( line_t*      line,
        !           198:   int          bright );
        !           199: 
        !           200: void    T_Glow(glow_t* g);
        !           201: void    P_SpawnGlowingLight(sector_t* sector);
1.1       root      202: 
                    203: 
1.1.1.4 ! root      204: 
        !           205: 
        !           206: //
        !           207: // P_SWITCH
        !           208: //
1.1       root      209: typedef struct
                    210: {
1.1.1.4 ! root      211:     char       name1[9];
        !           212:     char       name2[9];
        !           213:     short      episode;
        !           214:     
1.1       root      215: } switchlist_t;
                    216: 
1.1.1.4 ! root      217: 
1.1       root      218: typedef enum
                    219: {
1.1.1.4 ! root      220:     top,
        !           221:     middle,
        !           222:     bottom
        !           223: 
1.1       root      224: } bwhere_e;
                    225: 
1.1.1.4 ! root      226: 
1.1       root      227: typedef struct
                    228: {
1.1.1.4 ! root      229:     line_t*    line;
        !           230:     bwhere_e   where;
        !           231:     int                btexture;
        !           232:     int                btimer;
        !           233:     mobj_t*    soundorg;
        !           234: 
1.1       root      235: } button_t;
                    236: 
                    237: 
                    238: 
                    239: 
1.1.1.4 ! root      240:  // max # of wall switches in a level
        !           241: #define MAXSWITCHES            50
        !           242: 
        !           243:  // 4 players, 4 buttons each at once, max.
        !           244: #define MAXBUTTONS             16
        !           245: 
        !           246:  // 1 second, in ticks. 
        !           247: #define BUTTONTIME      35             
        !           248: 
        !           249: extern button_t        buttonlist[MAXBUTTONS]; 
        !           250: 
        !           251: void
        !           252: P_ChangeSwitchTexture
        !           253: ( line_t*      line,
        !           254:   int          useAgain );
1.1       root      255: 
1.1.1.4 ! root      256: void P_InitSwitchList(void);
1.1       root      257: 
1.1.1.3   root      258: 
1.1.1.4 ! root      259: //
        !           260: // P_PLATS
        !           261: //
1.1       root      262: typedef enum
                    263: {
1.1.1.4 ! root      264:     up,
        !           265:     down,
        !           266:     waiting,
        !           267:     in_stasis
        !           268: 
1.1       root      269: } plat_e;
                    270: 
1.1.1.4 ! root      271: 
        !           272: 
1.1       root      273: typedef enum
                    274: {
1.1.1.4 ! root      275:     perpetualRaise,
        !           276:     downWaitUpStay,
        !           277:     raiseAndChange,
        !           278:     raiseToNearestAndChange,
        !           279:     blazeDWUS
        !           280: 
1.1       root      281: } plattype_e;
                    282: 
1.1.1.4 ! root      283: 
        !           284: 
1.1       root      285: typedef struct
                    286: {
1.1.1.4 ! root      287:     thinker_t  thinker;
        !           288:     sector_t*  sector;
        !           289:     fixed_t    speed;
        !           290:     fixed_t    low;
        !           291:     fixed_t    high;
        !           292:     int                wait;
        !           293:     int                count;
        !           294:     plat_e     status;
        !           295:     plat_e     oldstatus;
        !           296:     boolean    crush;
        !           297:     int                tag;
        !           298:     plattype_e type;
        !           299:     
1.1       root      300: } plat_t;
                    301: 
1.1.1.3   root      302: 
                    303: 
1.1.1.4 ! root      304: #define PLATWAIT               3
        !           305: #define PLATSPEED              FRACUNIT
        !           306: #define MAXPLATS               30
1.1       root      307: 
                    308: 
1.1.1.4 ! root      309: extern plat_t* activeplats[MAXPLATS];
1.1       root      310: 
1.1.1.4 ! root      311: void    T_PlatRaise(plat_t*    plat);
        !           312: 
        !           313: int
        !           314: EV_DoPlat
        !           315: ( line_t*      line,
        !           316:   plattype_e   type,
        !           317:   int          amount );
        !           318: 
        !           319: void    P_AddActivePlat(plat_t* plat);
        !           320: void    P_RemoveActivePlat(plat_t* plat);
        !           321: void    EV_StopPlat(line_t* line);
        !           322: void    P_ActivateInStasis(int tag);
        !           323: 
        !           324: 
        !           325: //
        !           326: // P_DOORS
        !           327: //
1.1       root      328: typedef enum
                    329: {
1.1.1.4 ! root      330:     normal,
        !           331:     close30ThenOpen,
        !           332:     close,
        !           333:     open,
        !           334:     raiseIn5Mins,
        !           335:     blazeRaise,
        !           336:     blazeOpen,
        !           337:     blazeClose
        !           338: 
1.1       root      339: } vldoor_e;
                    340: 
1.1.1.4 ! root      341: 
        !           342: 
1.1       root      343: typedef struct
                    344: {
1.1.1.4 ! root      345:     thinker_t  thinker;
        !           346:     vldoor_e   type;
        !           347:     sector_t*  sector;
        !           348:     fixed_t    topheight;
        !           349:     fixed_t    speed;
        !           350: 
        !           351:     // 1 = up, 0 = waiting at top, -1 = down
        !           352:     int             direction;
        !           353:     
        !           354:     // tics to wait at the top
        !           355:     int             topwait;
        !           356:     // (keep in case a door going down is reset)
        !           357:     // when it reaches 0, start going down
        !           358:     int             topcountdown;
        !           359:     
1.1       root      360: } vldoor_t;
                    361: 
1.1.1.3   root      362: 
1.1       root      363: 
1.1.1.4 ! root      364: #define VDOORSPEED             FRACUNIT*2
        !           365: #define VDOORWAIT              150
1.1       root      366: 
1.1.1.4 ! root      367: void
        !           368: EV_VerticalDoor
        !           369: ( line_t*      line,
        !           370:   mobj_t*      thing );
1.1       root      371: 
1.1.1.4 ! root      372: int
        !           373: EV_DoDoor
        !           374: ( line_t*      line,
        !           375:   vldoor_e     type );
        !           376: 
        !           377: int
        !           378: EV_DoLockedDoor
        !           379: ( line_t*      line,
        !           380:   vldoor_e     type,
        !           381:   mobj_t*      thing );
        !           382: 
        !           383: void    T_VerticalDoor (vldoor_t* door);
        !           384: void    P_SpawnDoorCloseIn30 (sector_t* sec);
        !           385: 
        !           386: void
        !           387: P_SpawnDoorRaiseIn5Mins
        !           388: ( sector_t*    sec,
        !           389:   int          secnum );
        !           390: 
        !           391: 
        !           392: 
        !           393: #if 0 // UNUSED
        !           394: //
        !           395: //      Sliding doors...
        !           396: //
1.1       root      397: typedef enum
                    398: {
1.1.1.4 ! root      399:     sd_opening,
        !           400:     sd_waiting,
        !           401:     sd_closing
1.1       root      402: 
1.1.1.4 ! root      403: } sd_e;
1.1       root      404: 
1.1.1.3   root      405: 
                    406: 
1.1.1.4 ! root      407: typedef enum
        !           408: {
        !           409:     sdt_openOnly,
        !           410:     sdt_closeOnly,
        !           411:     sdt_openAndClose
1.1       root      412: 
1.1.1.4 ! root      413: } sdt_e;
1.1       root      414: 
                    415: 
1.1.1.4 ! root      416: 
        !           417: 
        !           418: typedef struct
1.1       root      419: {
1.1.1.4 ! root      420:     thinker_t  thinker;
        !           421:     sdt_e      type;
        !           422:     line_t*    line;
        !           423:     int                frame;
        !           424:     int                whichDoorIndex;
        !           425:     int                timer;
        !           426:     sector_t*  frontsector;
        !           427:     sector_t*  backsector;
        !           428:     sd_e        status;
        !           429: 
        !           430: } slidedoor_t;
        !           431: 
        !           432: 
1.1       root      433: 
                    434: typedef struct
                    435: {
1.1.1.4 ! root      436:     char       frontFrame1[9];
        !           437:     char       frontFrame2[9];
        !           438:     char       frontFrame3[9];
        !           439:     char       frontFrame4[9];
        !           440:     char       backFrame1[9];
        !           441:     char       backFrame2[9];
        !           442:     char       backFrame3[9];
        !           443:     char       backFrame4[9];
        !           444:     
        !           445: } slidename_t;
        !           446: 
        !           447: 
1.1       root      448: 
1.1.1.3   root      449: typedef struct
                    450: {
1.1.1.4 ! root      451:     int             frontFrames[4];
        !           452:     int             backFrames[4];
        !           453: 
        !           454: } slideframe_t;
        !           455: 
        !           456: 
        !           457: 
        !           458: // how many frames of animation
        !           459: #define SNUMFRAMES             4
        !           460: 
        !           461: #define SDOORWAIT              35*3
        !           462: #define SWAITTICS              4
        !           463: 
        !           464: // how many diff. types of anims
        !           465: #define MAXSLIDEDOORS  5                            
        !           466: 
        !           467: void P_InitSlidingDoorFrames(void);
        !           468: 
        !           469: void
        !           470: EV_SlidingDoor
        !           471: ( line_t*      line,
        !           472:   mobj_t*      thing );
        !           473: #endif
        !           474: 
        !           475: 
        !           476: 
        !           477: //
        !           478: // P_CEILNG
        !           479: //
        !           480: typedef enum
        !           481: {
        !           482:     lowerToFloor,
        !           483:     raiseToHighest,
        !           484:     lowerAndCrush,
        !           485:     crushAndRaise,
        !           486:     fastCrushAndRaise,
        !           487:     silentCrushAndRaise
        !           488: 
        !           489: } ceiling_e;
        !           490: 
        !           491: 
1.1.1.3   root      492: 
                    493: typedef struct
                    494: {
1.1.1.4 ! root      495:     thinker_t  thinker;
        !           496:     ceiling_e  type;
        !           497:     sector_t*  sector;
        !           498:     fixed_t    bottomheight;
        !           499:     fixed_t    topheight;
        !           500:     fixed_t    speed;
        !           501:     boolean    crush;
        !           502: 
        !           503:     // 1 = up, 0 = waiting, -1 = down
        !           504:     int                direction;
        !           505: 
        !           506:     // ID
        !           507:     int                tag;                   
        !           508:     int                olddirection;
        !           509:     
        !           510: } ceiling_t;
        !           511: 
        !           512: 
1.1.1.3   root      513: 
1.1       root      514: 
1.1.1.4 ! root      515: 
        !           516: #define CEILSPEED              FRACUNIT
        !           517: #define CEILWAIT               150
        !           518: #define MAXCEILINGS            30
        !           519: 
        !           520: extern ceiling_t*      activeceilings[MAXCEILINGS];
        !           521: 
        !           522: int
        !           523: EV_DoCeiling
        !           524: ( line_t*      line,
        !           525:   ceiling_e    type );
        !           526: 
        !           527: void    T_MoveCeiling (ceiling_t* ceiling);
        !           528: void    P_AddActiveCeiling(ceiling_t* c);
        !           529: void    P_RemoveActiveCeiling(ceiling_t* c);
        !           530: int    EV_CeilingCrushStop(line_t* line);
        !           531: void    P_ActivateInStasisCeiling(line_t* line);
        !           532: 
        !           533: 
        !           534: //
        !           535: // P_FLOOR
        !           536: //
1.1       root      537: typedef enum
                    538: {
1.1.1.4 ! root      539:     // lower floor to highest surrounding floor
        !           540:     lowerFloor,
        !           541:     
        !           542:     // lower floor to lowest surrounding floor
        !           543:     lowerFloorToLowest,
        !           544:     
        !           545:     // lower floor to highest surrounding floor VERY FAST
        !           546:     turboLower,
        !           547:     
        !           548:     // raise floor to lowest surrounding CEILING
        !           549:     raiseFloor,
        !           550:     
        !           551:     // raise floor to next highest surrounding floor
        !           552:     raiseFloorToNearest,
        !           553: 
        !           554:     // raise floor to shortest height texture around it
        !           555:     raiseToTexture,
        !           556:     
        !           557:     // lower floor to lowest surrounding floor
        !           558:     //  and change floorpic
        !           559:     lowerAndChange,
        !           560:   
        !           561:     raiseFloor24,
        !           562:     raiseFloor24AndChange,
        !           563:     raiseFloorCrush,
        !           564: 
        !           565:      // raise to next highest floor, turbo-speed
        !           566:     raiseFloorTurbo,       
        !           567:     donutRaise,
        !           568:     raiseFloor512
        !           569:     
        !           570: } floor_e;
        !           571: 
        !           572: 
        !           573: 
1.1       root      574: 
1.1.1.3   root      575: typedef enum
                    576: {
1.1.1.4 ! root      577:     build8,    // slowly build by 8
        !           578:     turbo16    // quickly build by 16
        !           579:     
        !           580: } stair_e;
        !           581: 
        !           582: 
        !           583: 
        !           584: typedef struct
        !           585: {
        !           586:     thinker_t  thinker;
        !           587:     floor_e    type;
        !           588:     boolean    crush;
        !           589:     sector_t*  sector;
        !           590:     int                direction;
        !           591:     int                newspecial;
        !           592:     short      texture;
        !           593:     fixed_t    floordestheight;
        !           594:     fixed_t    speed;
        !           595: 
        !           596: } floormove_t;
        !           597: 
        !           598: 
        !           599: 
        !           600: #define FLOORSPEED             FRACUNIT
1.1       root      601: 
1.1.1.3   root      602: typedef enum
                    603: {
1.1.1.4 ! root      604:     ok,
        !           605:     crushed,
        !           606:     pastdest
        !           607:     
        !           608: } result_e;
        !           609: 
        !           610: result_e
        !           611: T_MovePlane
        !           612: ( sector_t*    sector,
        !           613:   fixed_t      speed,
        !           614:   fixed_t      dest,
        !           615:   boolean      crush,
        !           616:   int          floorOrCeiling,
        !           617:   int          direction );
        !           618: 
        !           619: int
        !           620: EV_BuildStairs
        !           621: ( line_t*      line,
        !           622:   stair_e      type );
        !           623: 
        !           624: int
        !           625: EV_DoFloor
        !           626: ( line_t*      line,
        !           627:   floor_e      floortype );
        !           628: 
        !           629: void T_MoveFloor( floormove_t* floor);
        !           630: 
        !           631: //
        !           632: // P_TELEPT
        !           633: //
        !           634: int
        !           635: EV_Teleport
        !           636: ( line_t*      line,
        !           637:   int          side,
        !           638:   mobj_t*      thing );
        !           639: 
        !           640: #endif
        !           641: //-----------------------------------------------------------------------------
        !           642: //
        !           643: // $Log:$
        !           644: //
        !           645: //-----------------------------------------------------------------------------

unix.superglobalmegacorp.com

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