Annotation of doom/p_spec.h, revision 1.1.1.5

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

unix.superglobalmegacorp.com

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