Annotation of doom/p_spec.h, revision 1.1.1.6

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: //
1.1.1.6 ! root        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.
1.1.1.4   root       11: //
1.1.1.6 ! root       12: // The source is distributed in the hope that it will be useful,
1.1.1.4   root       13: // but WITHOUT ANY WARRANTY; without even the implied warranty of
1.1.1.6 ! root       14: // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
        !            15: // for more details.
1.1.1.4   root       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
1.1       root      338: } vldoor_e;
                    339: 
1.1.1.4   root      340: 
                    341: 
1.1       root      342: typedef struct
                    343: {
1.1.1.4   root      344:     thinker_t  thinker;
                    345:     vldoor_e   type;
                    346:     sector_t*  sector;
                    347:     fixed_t    topheight;
                    348:     fixed_t    speed;
                    349: 
                    350:     // 1 = up, 0 = waiting at top, -1 = down
                    351:     int             direction;
                    352:     
                    353:     // tics to wait at the top
                    354:     int             topwait;
                    355:     // (keep in case a door going down is reset)
                    356:     // when it reaches 0, start going down
                    357:     int             topcountdown;
                    358:     
1.1       root      359: } vldoor_t;
                    360: 
1.1.1.3   root      361: 
1.1       root      362: 
1.1.1.4   root      363: #define VDOORSPEED             FRACUNIT*2
                    364: #define VDOORWAIT              150
1.1       root      365: 
1.1.1.4   root      366: void
                    367: EV_VerticalDoor
                    368: ( line_t*      line,
                    369:   mobj_t*      thing );
1.1       root      370: 
1.1.1.4   root      371: int
                    372: EV_DoDoor
                    373: ( line_t*      line,
                    374:   vldoor_e     type );
                    375: 
                    376: int
                    377: EV_DoLockedDoor
                    378: ( line_t*      line,
                    379:   vldoor_e     type,
                    380:   mobj_t*      thing );
                    381: 
                    382: void    T_VerticalDoor (vldoor_t* door);
                    383: void    P_SpawnDoorCloseIn30 (sector_t* sec);
                    384: 
                    385: void
                    386: P_SpawnDoorRaiseIn5Mins
                    387: ( sector_t*    sec,
                    388:   int          secnum );
                    389: 
                    390: 
                    391: 
                    392: #if 0 // UNUSED
                    393: //
                    394: //      Sliding doors...
                    395: //
1.1       root      396: typedef enum
                    397: {
1.1.1.4   root      398:     sd_opening,
                    399:     sd_waiting,
                    400:     sd_closing
1.1       root      401: 
1.1.1.4   root      402: } sd_e;
1.1       root      403: 
1.1.1.3   root      404: 
                    405: 
1.1.1.4   root      406: typedef enum
                    407: {
                    408:     sdt_openOnly,
                    409:     sdt_closeOnly,
                    410:     sdt_openAndClose
1.1       root      411: 
1.1.1.4   root      412: } sdt_e;
1.1       root      413: 
                    414: 
1.1.1.4   root      415: 
                    416: 
                    417: typedef struct
1.1       root      418: {
1.1.1.4   root      419:     thinker_t  thinker;
                    420:     sdt_e      type;
                    421:     line_t*    line;
                    422:     int                frame;
                    423:     int                whichDoorIndex;
                    424:     int                timer;
                    425:     sector_t*  frontsector;
                    426:     sector_t*  backsector;
                    427:     sd_e        status;
                    428: 
                    429: } slidedoor_t;
                    430: 
                    431: 
1.1       root      432: 
                    433: typedef struct
                    434: {
1.1.1.4   root      435:     char       frontFrame1[9];
                    436:     char       frontFrame2[9];
                    437:     char       frontFrame3[9];
                    438:     char       frontFrame4[9];
                    439:     char       backFrame1[9];
                    440:     char       backFrame2[9];
                    441:     char       backFrame3[9];
                    442:     char       backFrame4[9];
                    443:     
                    444: } slidename_t;
                    445: 
                    446: 
1.1       root      447: 
1.1.1.3   root      448: typedef struct
                    449: {
1.1.1.4   root      450:     int             frontFrames[4];
                    451:     int             backFrames[4];
                    452: 
                    453: } slideframe_t;
                    454: 
                    455: 
                    456: 
                    457: // how many frames of animation
                    458: #define SNUMFRAMES             4
                    459: 
                    460: #define SDOORWAIT              35*3
                    461: #define SWAITTICS              4
                    462: 
                    463: // how many diff. types of anims
                    464: #define MAXSLIDEDOORS  5                            
                    465: 
                    466: void P_InitSlidingDoorFrames(void);
                    467: 
                    468: void
                    469: EV_SlidingDoor
                    470: ( line_t*      line,
                    471:   mobj_t*      thing );
                    472: #endif
                    473: 
                    474: 
                    475: 
                    476: //
                    477: // P_CEILNG
                    478: //
                    479: typedef enum
                    480: {
                    481:     lowerToFloor,
                    482:     raiseToHighest,
                    483:     lowerAndCrush,
                    484:     crushAndRaise,
                    485:     fastCrushAndRaise,
                    486:     silentCrushAndRaise
                    487: 
                    488: } ceiling_e;
                    489: 
                    490: 
1.1.1.3   root      491: 
                    492: typedef struct
                    493: {
1.1.1.4   root      494:     thinker_t  thinker;
                    495:     ceiling_e  type;
                    496:     sector_t*  sector;
                    497:     fixed_t    bottomheight;
                    498:     fixed_t    topheight;
                    499:     fixed_t    speed;
                    500:     boolean    crush;
                    501: 
                    502:     // 1 = up, 0 = waiting, -1 = down
                    503:     int                direction;
                    504: 
                    505:     // ID
                    506:     int                tag;                   
                    507:     int                olddirection;
                    508:     
                    509: } ceiling_t;
                    510: 
                    511: 
1.1.1.3   root      512: 
1.1       root      513: 
1.1.1.4   root      514: 
                    515: #define CEILSPEED              FRACUNIT
                    516: #define CEILWAIT               150
                    517: #define MAXCEILINGS            30
                    518: 
                    519: extern ceiling_t*      activeceilings[MAXCEILINGS];
                    520: 
                    521: int
                    522: EV_DoCeiling
                    523: ( line_t*      line,
                    524:   ceiling_e    type );
                    525: 
                    526: void    T_MoveCeiling (ceiling_t* ceiling);
                    527: void    P_AddActiveCeiling(ceiling_t* c);
                    528: void    P_RemoveActiveCeiling(ceiling_t* c);
                    529: int    EV_CeilingCrushStop(line_t* line);
                    530: void    P_ActivateInStasisCeiling(line_t* line);
                    531: 
                    532: 
                    533: //
                    534: // P_FLOOR
                    535: //
1.1       root      536: typedef enum
                    537: {
1.1.1.4   root      538:     // lower floor to highest surrounding floor
                    539:     lowerFloor,
                    540:     
                    541:     // lower floor to lowest surrounding floor
                    542:     lowerFloorToLowest,
                    543:     
                    544:     // lower floor to highest surrounding floor VERY FAST
                    545:     turboLower,
                    546:     
                    547:     // raise floor to lowest surrounding CEILING
                    548:     raiseFloor,
                    549:     
                    550:     // raise floor to next highest surrounding floor
                    551:     raiseFloorToNearest,
                    552: 
                    553:     // raise floor to shortest height texture around it
                    554:     raiseToTexture,
                    555:     
                    556:     // lower floor to lowest surrounding floor
                    557:     //  and change floorpic
                    558:     lowerAndChange,
                    559:   
                    560:     raiseFloor24,
                    561:     raiseFloor24AndChange,
                    562:     raiseFloorCrush,
                    563: 
                    564:      // raise to next highest floor, turbo-speed
                    565:     raiseFloorTurbo,       
                    566:     donutRaise,
                    567:     raiseFloor512
                    568:     
                    569: } floor_e;
                    570: 
                    571: 
                    572: 
1.1       root      573: 
1.1.1.3   root      574: typedef enum
                    575: {
1.1.1.4   root      576:     build8,    // slowly build by 8
                    577:     turbo16    // quickly build by 16
                    578:     
                    579: } stair_e;
                    580: 
                    581: 
                    582: 
                    583: typedef struct
                    584: {
                    585:     thinker_t  thinker;
                    586:     floor_e    type;
                    587:     boolean    crush;
                    588:     sector_t*  sector;
                    589:     int                direction;
                    590:     int                newspecial;
                    591:     short      texture;
                    592:     fixed_t    floordestheight;
                    593:     fixed_t    speed;
                    594: 
                    595: } floormove_t;
                    596: 
                    597: 
                    598: 
                    599: #define FLOORSPEED             FRACUNIT
1.1       root      600: 
1.1.1.3   root      601: typedef enum
                    602: {
1.1.1.4   root      603:     ok,
                    604:     crushed,
                    605:     pastdest
                    606:     
                    607: } result_e;
                    608: 
                    609: result_e
                    610: T_MovePlane
                    611: ( sector_t*    sector,
                    612:   fixed_t      speed,
                    613:   fixed_t      dest,
                    614:   boolean      crush,
                    615:   int          floorOrCeiling,
                    616:   int          direction );
                    617: 
                    618: int
                    619: EV_BuildStairs
                    620: ( line_t*      line,
                    621:   stair_e      type );
                    622: 
                    623: int
                    624: EV_DoFloor
                    625: ( line_t*      line,
                    626:   floor_e      floortype );
                    627: 
                    628: void T_MoveFloor( floormove_t* floor);
                    629: 
                    630: //
                    631: // P_TELEPT
                    632: //
                    633: int
                    634: EV_Teleport
                    635: ( line_t*      line,
                    636:   int          side,
                    637:   mobj_t*      thing );
                    638: 
                    639: #endif
                    640: //-----------------------------------------------------------------------------
                    641: //
                    642: // $Log:$
                    643: //
                    644: //-----------------------------------------------------------------------------

unix.superglobalmegacorp.com

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