123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425 |
- #include "Precompiled.h"
- #include "globaldata.h"
- #include "Main.h"
- #include <stdlib.h>
- #include "doomdef.h"
- #include "doomstat.h"
- #include "i_system.h"
- #include "z_zone.h"
- #include "m_argv.h"
- #include "m_random.h"
- #include "w_wad.h"
- #include "r_local.h"
- #include "p_local.h"
- #include "g_game.h"
- #include "s_sound.h"
- #include "r_state.h"
- #include "sounds.h"
- #include "../../neo/d3xp/Game_Local.h"
- const animdef_t animdefs[] =
- {
- {false, "NUKAGE3", "NUKAGE1", 8},
- {false, "FWATER4", "FWATER1", 8},
- {false, "SWATER4", "SWATER1", 8},
- {false, "LAVA4", "LAVA1", 8},
- {false, "BLOOD3", "BLOOD1", 8},
-
- {false, "RROCK08", "RROCK05", 8},
- {false, "SLIME04", "SLIME01", 8},
- {false, "SLIME08", "SLIME05", 8},
- {false, "SLIME12", "SLIME09", 8},
- {true, "BLODGR4", "BLODGR1", 8},
- {true, "SLADRIP3", "SLADRIP1", 8},
- {true, "BLODRIP4", "BLODRIP1", 8},
- {true, "FIREWALL", "FIREWALA", 8},
- {true, "GSTFONT3", "GSTFONT1", 8},
- {true, "FIRELAVA", "FIRELAV3", 8},
- {true, "FIREMAG3", "FIREMAG1", 8},
- {true, "FIREBLU2", "FIREBLU1", 8},
- {true, "ROCKRED3", "ROCKRED1", 8},
- {true, "BFALL4", "BFALL1", 8},
- {true, "SFALL4", "SFALL1", 8},
- {true, "WFALL4", "WFALL1", 8},
- {true, "DBRAIN4", "DBRAIN1", 8},
- {-1}
- };
- void P_InitPicAnims (void)
- {
- int i;
-
- ::g->lastanim = ::g->anims;
- for (i=0 ; animdefs[i].istexture != (qboolean)-1 ; i++)
- {
- if (animdefs[i].istexture)
- {
-
- if (R_CheckTextureNumForName(animdefs[i].startname) == -1)
- continue;
- ::g->lastanim->picnum = R_TextureNumForName (animdefs[i].endname);
- ::g->lastanim->basepic = R_TextureNumForName (animdefs[i].startname);
- }
- else
- {
- if (W_CheckNumForName(animdefs[i].startname) == -1)
- continue;
- ::g->lastanim->picnum = R_FlatNumForName (animdefs[i].endname);
- ::g->lastanim->basepic = R_FlatNumForName (animdefs[i].startname);
- }
- ::g->lastanim->istexture = animdefs[i].istexture;
- ::g->lastanim->numpics = ::g->lastanim->picnum - ::g->lastanim->basepic + 1;
- if (::g->lastanim->numpics < 2)
- I_Error ("P_InitPicAnims: bad cycle from %s to %s",
- animdefs[i].startname,
- animdefs[i].endname);
- ::g->lastanim->speed = animdefs[i].speed;
- ::g->lastanim++;
- }
- }
- side_t*
- getSide
- ( int currentSector,
- int line,
- int side )
- {
- return &::g->sides[ (::g->sectors[currentSector].lines[line])->sidenum[side] ];
- }
- sector_t*
- getSector
- ( int currentSector,
- int line,
- int side )
- {
- return ::g->sides[ (::g->sectors[currentSector].lines[line])->sidenum[side] ].sector;
- }
- int
- twoSided
- ( int sector,
- int line )
- {
- return (::g->sectors[sector].lines[line])->flags & ML_TWOSIDED;
- }
- sector_t*
- getNextSector
- ( line_t* line,
- sector_t* sec )
- {
- if (!(line->flags & ML_TWOSIDED))
- return NULL;
- if (line->frontsector == sec)
- return line->backsector;
- return line->frontsector;
- }
- fixed_t P_FindLowestFloorSurrounding(sector_t* sec)
- {
- int i;
- line_t* check;
- sector_t* other;
- fixed_t floor = sec->floorheight;
- for (i=0 ;i < sec->linecount ; i++)
- {
- check = sec->lines[i];
- other = getNextSector(check,sec);
- if (!other)
- continue;
- if (other->floorheight < floor)
- floor = other->floorheight;
- }
- return floor;
- }
- fixed_t P_FindHighestFloorSurrounding(sector_t *sec)
- {
- int i;
- line_t* check;
- sector_t* other;
- fixed_t floor = -500*FRACUNIT;
- for (i=0 ;i < sec->linecount ; i++)
- {
- check = sec->lines[i];
- other = getNextSector(check,sec);
- if (!other)
- continue;
- if (other->floorheight > floor)
- floor = other->floorheight;
- }
- return floor;
- }
- fixed_t
- P_FindNextHighestFloor
- ( sector_t* sec,
- int currentheight )
- {
- int i;
- int h;
- int min;
- line_t* check;
- sector_t* other;
- fixed_t height = currentheight;
- fixed_t heightlist[MAX_ADJOINING_SECTORS];
- for (i=0, h=0 ;i < sec->linecount ; i++)
- {
- check = sec->lines[i];
- other = getNextSector(check,sec);
- if (!other)
- continue;
- if (other->floorheight > height)
- heightlist[h++] = other->floorheight;
-
- if ( h >= MAX_ADJOINING_SECTORS )
- {
- I_PrintfE("Sector with more than 20 adjoining sectors\n" );
- break;
- }
- }
-
- if (!h)
- return currentheight;
- min = heightlist[0];
-
- for (i = 1;i < h;i++)
- if (heightlist[i] < min)
- min = heightlist[i];
- return min;
- }
- fixed_t
- P_FindLowestCeilingSurrounding(sector_t* sec)
- {
- int i;
- line_t* check;
- sector_t* other;
- fixed_t height = MAXINT;
- for (i=0 ;i < sec->linecount ; i++)
- {
- check = sec->lines[i];
- other = getNextSector(check,sec);
- if (!other)
- continue;
- if (other->ceilingheight < height)
- height = other->ceilingheight;
- }
- return height;
- }
- fixed_t P_FindHighestCeilingSurrounding(sector_t* sec)
- {
- int i;
- line_t* check;
- sector_t* other;
- fixed_t height = 0;
- for (i=0 ;i < sec->linecount ; i++)
- {
- check = sec->lines[i];
- other = getNextSector(check,sec);
- if (!other)
- continue;
- if (other->ceilingheight > height)
- height = other->ceilingheight;
- }
- return height;
- }
- int
- P_FindSectorFromLineTag
- ( line_t* line,
- int start )
- {
- int i;
- for (i = start+1; i < ::g->numsectors; i++)
- if (::g->sectors[i].tag == line->tag)
- return i;
- return -1;
- }
- int
- P_FindMinSurroundingLight
- ( sector_t* sector,
- int max )
- {
- int i;
- int min;
- line_t* line;
- sector_t* check;
- min = max;
- for (i=0 ; i < sector->linecount ; i++)
- {
- line = sector->lines[i];
- check = getNextSector(line,sector);
- if (!check)
- continue;
- if (check->lightlevel < min)
- min = check->lightlevel;
- }
- return min;
- }
- void
- P_CrossSpecialLine
- ( int linenum,
- int side,
- mobj_t* thing )
- {
- line_t* line;
- int ok;
- line = &::g->lines[linenum];
-
- if (!thing->player)
- {
-
- switch(thing->type)
- {
- case MT_ROCKET:
- case MT_PLASMA:
- case MT_BFG:
- case MT_TROOPSHOT:
- case MT_HEADSHOT:
- case MT_BRUISERSHOT:
- return;
- break;
- default: break;
- }
- ok = 0;
- switch(line->special)
- {
- case 39:
- case 97:
- case 125:
- case 126:
- case 4:
- case 10:
- case 88:
- ok = 1;
- break;
- }
- if (!ok)
- return;
- }
-
- switch (line->special)
- {
-
-
- case 2:
-
- EV_DoDoor(line,opened);
- line->special = 0;
- break;
- case 3:
-
- EV_DoDoor(line,closed);
- line->special = 0;
- break;
- case 4:
-
- EV_DoDoor(line,normal);
- line->special = 0;
- break;
- case 5:
-
- EV_DoFloor(line,raiseFloor);
- line->special = 0;
- break;
- case 6:
-
- EV_DoCeiling(line,fastCrushAndRaise);
- line->special = 0;
- break;
- case 8:
-
- EV_BuildStairs(line,build8);
- line->special = 0;
- break;
- case 10:
-
- EV_DoPlat(line,downWaitUpStay,0);
- line->special = 0;
- break;
- case 12:
-
- EV_LightTurnOn(line,0);
- line->special = 0;
- break;
- case 13:
-
- EV_LightTurnOn(line,255);
- line->special = 0;
- break;
- case 16:
-
- EV_DoDoor(line,close30ThenOpen);
- line->special = 0;
- break;
- case 17:
-
- EV_StartLightStrobing(line);
- line->special = 0;
- break;
- case 19:
-
- EV_DoFloor(line,lowerFloor);
- line->special = 0;
- break;
- case 22:
-
- EV_DoPlat(line,raiseToNearestAndChange,0);
- line->special = 0;
- break;
- case 25:
-
- EV_DoCeiling(line,crushAndRaise);
- line->special = 0;
- break;
- case 30:
-
-
- EV_DoFloor(line,raiseToTexture);
- line->special = 0;
- break;
- case 35:
-
- EV_LightTurnOn(line,35);
- line->special = 0;
- break;
- case 36:
-
- EV_DoFloor(line,turboLower);
- line->special = 0;
- break;
- case 37:
-
- EV_DoFloor(line,lowerAndChange);
- line->special = 0;
- break;
- case 38:
-
- EV_DoFloor( line, lowerFloorToLowest );
- line->special = 0;
- break;
- case 39:
-
- EV_Teleport( line, side, thing );
- line->special = 0;
- break;
- case 40:
-
- EV_DoCeiling( line, raiseToHighest );
- EV_DoFloor( line, lowerFloorToLowest );
- line->special = 0;
- break;
- case 44:
-
- EV_DoCeiling( line, lowerAndCrush );
- line->special = 0;
- break;
- case 52:
-
-
- if ( !::g->deathmatch && ::g->gameaction != ga_completed ) {
- G_ExitLevel();
- }
- break;
- case 53:
-
- EV_DoPlat(line,perpetualRaise,0);
- line->special = 0;
- break;
- case 54:
-
- EV_StopPlat(line);
- line->special = 0;
- break;
- case 56:
-
- EV_DoFloor(line,raiseFloorCrush);
- line->special = 0;
- break;
- case 57:
-
- EV_CeilingCrushStop(line);
- line->special = 0;
- break;
- case 58:
-
- EV_DoFloor(line,raiseFloor24);
- line->special = 0;
- break;
- case 59:
-
- EV_DoFloor(line,raiseFloor24AndChange);
- line->special = 0;
- break;
- case 104:
-
- EV_TurnTagLightsOff(line);
- line->special = 0;
- break;
- case 108:
-
- EV_DoDoor (line,blazeRaise);
- line->special = 0;
- break;
- case 109:
-
- EV_DoDoor (line,blazeOpen);
- line->special = 0;
- break;
- case 100:
-
- EV_BuildStairs(line,turbo16);
- line->special = 0;
- break;
- case 110:
-
- EV_DoDoor (line,blazeClose);
- line->special = 0;
- break;
- case 119:
-
- EV_DoFloor(line,raiseFloorToNearest);
- line->special = 0;
- break;
- case 121:
-
- EV_DoPlat(line,blazeDWUS,0);
- line->special = 0;
- break;
- case 124:
-
- if ( !::g->deathmatch && ::g->gameaction != ga_completed ) {
- G_SecretExitLevel ();
- }
- break;
- case 125:
-
- if (!thing->player)
- {
- EV_Teleport( line, side, thing );
- line->special = 0;
- }
- break;
- case 130:
-
- EV_DoFloor(line,raiseFloorTurbo);
- line->special = 0;
- break;
- case 141:
-
- EV_DoCeiling(line,silentCrushAndRaise);
- line->special = 0;
- break;
-
- case 72:
-
- EV_DoCeiling( line, lowerAndCrush );
- break;
- case 73:
-
- EV_DoCeiling(line,crushAndRaise);
- break;
- case 74:
-
- EV_CeilingCrushStop(line);
- break;
- case 75:
-
- EV_DoDoor(line,closed);
- break;
- case 76:
-
- EV_DoDoor(line,close30ThenOpen);
- break;
- case 77:
-
- EV_DoCeiling(line,fastCrushAndRaise);
- break;
- case 79:
-
- EV_LightTurnOn(line,35);
- break;
- case 80:
-
- EV_LightTurnOn(line,0);
- break;
- case 81:
-
- EV_LightTurnOn(line,255);
- break;
- case 82:
-
- EV_DoFloor( line, lowerFloorToLowest );
- break;
- case 83:
-
- EV_DoFloor(line,lowerFloor);
- break;
- case 84:
-
- EV_DoFloor(line,lowerAndChange);
- break;
- case 86:
-
- EV_DoDoor(line,opened);
- break;
- case 87:
-
- EV_DoPlat(line,perpetualRaise,0);
- break;
- case 88:
-
- EV_DoPlat(line,downWaitUpStay,0);
- break;
- case 89:
-
- EV_StopPlat(line);
- break;
- case 90:
-
- EV_DoDoor(line,normal);
- break;
- case 91:
-
- EV_DoFloor(line,raiseFloor);
- break;
- case 92:
-
- EV_DoFloor(line,raiseFloor24);
- break;
- case 93:
-
- EV_DoFloor(line,raiseFloor24AndChange);
- break;
- case 94:
-
- EV_DoFloor(line,raiseFloorCrush);
- break;
- case 95:
-
-
- EV_DoPlat(line,raiseToNearestAndChange,0);
- break;
- case 96:
-
-
- EV_DoFloor(line,raiseToTexture);
- break;
- case 97:
-
- EV_Teleport( line, side, thing );
- break;
- case 98:
-
- EV_DoFloor(line,turboLower);
- break;
- case 105:
-
- EV_DoDoor (line,blazeRaise);
- break;
- case 106:
-
- EV_DoDoor (line,blazeOpen);
- break;
- case 107:
-
- EV_DoDoor (line,blazeClose);
- break;
- case 120:
-
- EV_DoPlat(line,blazeDWUS,0);
- break;
- case 126:
-
- if (!thing->player)
- EV_Teleport( line, side, thing );
- break;
- case 128:
-
- EV_DoFloor(line,raiseFloorToNearest);
- break;
- case 129:
-
- EV_DoFloor(line,raiseFloorTurbo);
- break;
- }
- }
- void
- P_ShootSpecialLine
- ( mobj_t* thing,
- line_t* line )
- {
- int ok;
-
- if (!thing->player)
- {
- ok = 0;
- switch(line->special)
- {
- case 46:
-
- ok = 1;
- break;
- }
- if (!ok)
- return;
- }
- switch(line->special)
- {
- case 24:
-
- EV_DoFloor(line,raiseFloor);
- P_ChangeSwitchTexture(line,0);
- break;
- case 46:
-
- EV_DoDoor(line,opened);
- P_ChangeSwitchTexture(line,1);
- break;
- case 47:
-
- EV_DoPlat(line,raiseToNearestAndChange,0);
- P_ChangeSwitchTexture(line,0);
- break;
- }
- }
- void P_PlayerInSpecialSector (player_t* player)
- {
- sector_t* sector;
- sector = player->mo->subsector->sector;
-
- if (player->mo->z != sector->floorheight)
- return;
-
- switch (sector->special)
- {
- case 5:
-
- if (!player->powers[pw_ironfeet])
- if (!(::g->leveltime&0x1f))
- P_DamageMobj (player->mo, NULL, NULL, 10);
- break;
- case 7:
-
- if (!player->powers[pw_ironfeet])
- if (!(::g->leveltime&0x1f))
- P_DamageMobj (player->mo, NULL, NULL, 5);
- break;
- case 16:
-
- case 4:
-
- if (!player->powers[pw_ironfeet]
- || (P_Random()<5) )
- {
- if (!(::g->leveltime&0x1f))
- P_DamageMobj (player->mo, NULL, NULL, 20);
- }
- break;
- case 9:
-
- player->secretcount++;
- sector->special = 0;
- if ( !::g->demoplayback && ( ::g->usergame && !::g->netgame ) ) {
-
- if ( !common->IsMultiplayer() ) {
- switch( DoomLib::GetGameSKU() ) {
- case GAME_SKU_DOOM1_BFG: {
-
-
- break;
- }
- case GAME_SKU_DOOM2_BFG: {
-
- idAchievementManager::LocalUser_CompleteAchievement(ACHIEVEMENT_DOOM2_IMPORTANT_LOOKING_DOOR_FIND_ANY_SECRET );
- break;
- }
- case GAME_SKU_DCC: {
-
-
- break;
- }
- default: {
-
- break;
- }
- }
- }
- }
- break;
- case 11:
-
- player->cheats &= ~CF_GODMODE;
- if (!(::g->leveltime&0x1f))
- P_DamageMobj (player->mo, NULL, NULL, 20);
- if (player->health <= 10)
- G_ExitLevel();
- break;
- default:
- I_Error ("P_PlayerInSpecialSector: "
- "unknown special %i",
- sector->special);
- break;
- };
- }
- int PlayerFrags( int playernum ) {
- int frags = 0;
- for( int i=0 ; i<MAXPLAYERS ; i++) {
- if ( i != playernum ) {
- frags += ::g->players[playernum].frags[i];
- }
- }
- frags -= ::g->players[playernum].frags[playernum];
- return frags;
- }
- void P_UpdateSpecials (void)
- {
- anim_t2* anim;
- int pic;
- int i;
- line_t* line;
-
- if (::g->levelTimer == true)
- {
- ::g->levelTimeCount--;
- if (!::g->levelTimeCount)
- G_ExitLevel();
- }
-
- if ( ::g->deathmatch && ::g->levelFragCount > 0 ) {
- bool fragCountHit = false;
- for ( int i=0; i<MAXPLAYERS; i++ ) {
- if ( ::g->playeringame[i] ) {
- if ( PlayerFrags(i) >= ::g->levelFragCount ) {
- fragCountHit = true;
- }
- }
- }
- if ( fragCountHit ) {
- G_ExitLevel();
- }
- }
-
- for (anim = ::g->anims ; anim < ::g->lastanim ; anim++)
- {
- for (i=anim->basepic ; i<anim->basepic+anim->numpics ; i++)
- {
- pic = anim->basepic + ( (::g->leveltime/anim->speed + i)%anim->numpics );
- if (anim->istexture)
- ::g->texturetranslation[i] = pic;
- else
- ::g->flattranslation[i] = pic;
- }
- }
-
- for (i = 0; i < ::g->numlinespecials; i++)
- {
- line = ::g->linespeciallist[i];
- switch(line->special)
- {
- case 48:
-
- ::g->sides[line->sidenum[0]].textureoffset += FRACUNIT;
- break;
- }
- }
-
- for (i = 0; i < MAXBUTTONS; i++)
- if (::g->buttonlist[i].btimer)
- {
- ::g->buttonlist[i].btimer--;
- if (!::g->buttonlist[i].btimer)
- {
- switch(::g->buttonlist[i].where)
- {
- case top:
- ::g->sides[::g->buttonlist[i].line->sidenum[0]].toptexture =
- ::g->buttonlist[i].btexture;
- break;
- case middle:
- ::g->sides[::g->buttonlist[i].line->sidenum[0]].midtexture =
- ::g->buttonlist[i].btexture;
- break;
- case bottom:
- ::g->sides[::g->buttonlist[i].line->sidenum[0]].bottomtexture =
- ::g->buttonlist[i].btexture;
- break;
- }
- S_StartSound((mobj_t *)&::g->buttonlist[i].soundorg,sfx_swtchn);
- memset(&::g->buttonlist[i],0,sizeof(button_t));
- }
- }
- }
- int EV_DoDonut(line_t* line)
- {
- sector_t* s1;
- sector_t* s2;
- sector_t* s3;
- int secnum;
- int rtn;
- int i;
- floormove_t* floor;
- secnum = -1;
- rtn = 0;
- while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
- {
- s1 = &::g->sectors[secnum];
-
- if (s1->specialdata)
- continue;
- rtn = 1;
- s2 = getNextSector(s1->lines[0],s1);
- for (i = 0;i < s2->linecount;i++)
- {
- if ((!(s2->lines[i]->flags & ML_TWOSIDED)) ||
- (s2->lines[i]->backsector == s1))
- continue;
- s3 = s2->lines[i]->backsector;
-
- floor = (floormove_t*)DoomLib::Z_Malloc (sizeof(*floor), PU_LEVEL, 0);
- P_AddThinker (&floor->thinker);
- s2->specialdata = floor;
- floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
- floor->type = donutRaise;
- floor->crush = false;
- floor->direction = 1;
- floor->sector = s2;
- floor->speed = FLOORSPEED / 2;
- floor->texture = s3->floorpic;
- floor->newspecial = 0;
- floor->floordestheight = s3->floorheight;
-
- floor = (floormove_t*)DoomLib::Z_Malloc (sizeof(*floor), PU_LEVEL, 0);
- P_AddThinker (&floor->thinker);
- s1->specialdata = floor;
- floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
- floor->type = lowerFloor;
- floor->crush = false;
- floor->direction = -1;
- floor->sector = s1;
- floor->speed = FLOORSPEED / 2;
- floor->floordestheight = s3->floorheight;
- break;
- }
- }
- return rtn;
- }
- void P_SpawnSpecials (void)
- {
- sector_t* sector;
- int i;
- int episode;
- episode = 1;
- if (W_CheckNumForName("texture2") >= 0)
- episode = 2;
-
- ::g->levelTimer = false;
- i = M_CheckParm("-avg");
- if (i && ::g->deathmatch)
- {
- ::g->levelTimer = true;
- ::g->levelTimeCount = 20 * 60 * TICRATE;
- }
-
-
- #ifdef ID_ENABLE_DOOM_CLASSIC_NETWORKING
- const int timeLimit = session->GetActingGameStateLobbyBase().GetMatchParms().gameTimeLimit;
- #else
- const int timeLimit = 0;
- #endif
- if (timeLimit != 0 && g->deathmatch)
- {
- int time;
-
- time = timeLimit * 60 * TICRATE;
- ::g->levelTimer = true;
- ::g->levelTimeCount = time;
- }
-
-
- #ifdef ID_ENABLE_DOOM_CLASSIC_NETWORKING
- const int fragLimit = gameLocal->GetMatchParms().GetScoreLimit();
- #else
- const int fragLimit = 0;
- #endif
- if (fragLimit != 0 && ::g->deathmatch)
- {
-
- ::g->levelFragCount = fragLimit;
- } else {
- ::g->levelFragCount = 0;
- }
-
- sector = ::g->sectors;
- for (i=0 ; i < ::g->numsectors ; i++, sector++)
- {
- if (!sector->special)
- continue;
- switch (sector->special)
- {
- case 1:
-
- P_SpawnLightFlash (sector);
- break;
- case 2:
-
- P_SpawnStrobeFlash(sector,FASTDARK,0);
- break;
- case 3:
-
- P_SpawnStrobeFlash(sector,SLOWDARK,0);
- break;
- case 4:
-
- P_SpawnStrobeFlash(sector,FASTDARK,0);
- sector->special = 4;
- break;
- case 8:
-
- P_SpawnGlowingLight(sector);
- break;
- case 9:
-
- ::g->totalsecret++;
- break;
- case 10:
-
- P_SpawnDoorCloseIn30 (sector);
- break;
- case 12:
-
- P_SpawnStrobeFlash (sector, SLOWDARK, 1);
- break;
- case 13:
-
- P_SpawnStrobeFlash (sector, FASTDARK, 1);
- break;
- case 14:
-
- P_SpawnDoorRaiseIn5Mins (sector, i);
- break;
- case 17:
- P_SpawnFireFlicker(sector);
- break;
- }
- }
-
- ::g->numlinespecials = 0;
- for (i = 0;i < ::g->numlines; i++)
- {
- switch(::g->lines[i].special)
- {
- case 48:
-
- ::g->linespeciallist[::g->numlinespecials] = &::g->lines[i];
- ::g->numlinespecials++;
- break;
- }
- }
-
- for (i = 0;i < MAXCEILINGS;i++)
- ::g->activeceilings[i] = NULL;
- for (i = 0;i < MAXPLATS;i++)
- ::g->activeplats[i] = NULL;
- for (i = 0;i < MAXBUTTONS;i++)
- memset(&::g->buttonlist[i],0,sizeof(button_t));
-
-
- }
|