Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Iskhodnyy_kod_Doom

.pdf
Скачиваний:
7
Добавлен:
13.02.2015
Размер:
1.01 Mб
Скачать

if (useAgain)

P_StartButton(line, bottom,switchlist[i],BUTTONTIME);

return;

}

}

}

}

}

//

// P_UseSpecialLine

// Called when a thing uses a special line. // Only the front sides of lines are usable.

//

 

boolean

 

P_UseSpecialLine

 

( mobj_t*

thing,

line_t*

line,

int

side )

{

 

//Err...

//Use the back sides of VERY SPECIAL lines...

if (side)

{

switch(line->special)

{

case 124:

//Sliding door open&close

//UNUSED?

break;

default:

return false; break;

}

}

// Switches that other things can activate. if (!thing->player)

{

// never open secret doors

if (line->flags &

ML_SECRET)

return false;

 

switch(line->special)

{

 

case 1:

// MANUAL DOOR RAISE

case 32:

// MANUAL BLUE

case 33:

// MANUAL RED

case 34:

// MANUAL YELLOW

break;

 

default:

return false; break;

}

581

}

 

 

// do something

 

switch

(line->special)

 

{

 

 

//

MANUALS

 

case

1:

// Vertical Door

case

26:

// Blue Door/Locked

case

27:

// Yellow Door /Locked

case

28:

// Red Door /Locked

case

31:

// Manual door open

case

32:

// Blue locked door open

case

33:

// Red locked door open

case

34:

// Yellow locked door open

case

117:

// Blazing door raise

case

118:

// Blazing door open

EV_VerticalDoor (line, thing); break;

//UNUSED - Door Slide Open&Close

//case 124:

//EV_SlidingDoor (line, thing);

//break;

//SWITCHES

case 7:

// Build Stairs

if (EV_BuildStairs(line,build8)) P_ChangeSwitchTexture(line,0);

break;

case 9:

// Change Donut

if (EV_DoDonut(line)) P_ChangeSwitchTexture(line,0);

break;

case 11:

// Exit level P_ChangeSwitchTexture(line,0); G_ExitLevel ();

break;

case 14:

// Raise Floor 32 and change texture if (EV_DoPlat(line,raiseAndChange,32))

P_ChangeSwitchTexture(line,0); break;

case 15:

// Raise Floor 24 and change texture if (EV_DoPlat(line,raiseAndChange,24))

P_ChangeSwitchTexture(line,0); break;

case 18:

// Raise Floor to next highest floor

if (EV_DoFloor(line, raiseFloorToNearest)) P_ChangeSwitchTexture(line,0);

break;

case 20:

582

// Raise Plat next highest floor and change texture if (EV_DoPlat(line,raiseToNearestAndChange,0))

P_ChangeSwitchTexture(line,0); break;

case 21:

// PlatDownWaitUpStay

if (EV_DoPlat(line,downWaitUpStay,0)) P_ChangeSwitchTexture(line,0);

break;

case 23:

// Lower Floor to Lowest

if (EV_DoFloor(line,lowerFloorToLowest)) P_ChangeSwitchTexture(line,0);

break;

case 29:

// Raise Door

if (EV_DoDoor(line,normal)) P_ChangeSwitchTexture(line,0);

break;

case 41:

// Lower Ceiling to Floor

if (EV_DoCeiling(line,lowerToFloor)) P_ChangeSwitchTexture(line,0);

break;

case 71:

// Turbo Lower Floor

if (EV_DoFloor(line,turboLower)) P_ChangeSwitchTexture(line,0);

break;

case 49:

// Ceiling Crush And Raise

if (EV_DoCeiling(line,crushAndRaise)) P_ChangeSwitchTexture(line,0);

break;

case 50:

// Close Door

if (EV_DoDoor(line,close)) P_ChangeSwitchTexture(line,0);

break;

case 51:

// Secret EXIT P_ChangeSwitchTexture(line,0); G_SecretExitLevel ();

break;

case 55:

// Raise Floor Crush

if (EV_DoFloor(line,raiseFloorCrush)) P_ChangeSwitchTexture(line,0);

break;

case 101:

// Raise Floor

if (EV_DoFloor(line,raiseFloor)) P_ChangeSwitchTexture(line,0);

break;

583

case 102:

// Lower Floor to Surrounding floor height if (EV_DoFloor(line,lowerFloor))

P_ChangeSwitchTexture(line,0); break;

case 103:

// Open Door

if (EV_DoDoor(line,open)) P_ChangeSwitchTexture(line,0);

break;

case 111:

// Blazing Door Raise (faster than TURBO!) if (EV_DoDoor (line,blazeRaise))

P_ChangeSwitchTexture(line,0); break;

case 112:

// Blazing Door Open (faster than TURBO!) if (EV_DoDoor (line,blazeOpen))

P_ChangeSwitchTexture(line,0); break;

case 113:

// Blazing Door Close (faster than TURBO!) if (EV_DoDoor (line,blazeClose))

P_ChangeSwitchTexture(line,0); break;

case 122:

// Blazing PlatDownWaitUpStay

if (EV_DoPlat(line,blazeDWUS,0)) P_ChangeSwitchTexture(line,0);

break;

case 127:

// Build Stairs Turbo 16

if (EV_BuildStairs(line,turbo16)) P_ChangeSwitchTexture(line,0);

break;

case 131:

// Raise Floor Turbo

if (EV_DoFloor(line,raiseFloorTurbo)) P_ChangeSwitchTexture(line,0);

break;

case 133:

//BlzOpenDoor BLUE case 135:

//BlzOpenDoor RED case 137:

//BlzOpenDoor YELLOW

if (EV_DoLockedDoor (line,blazeOpen,thing)) P_ChangeSwitchTexture(line,0);

break;

case

140:

//

Raise Floor 512

if

(EV_DoFloor(line,raiseFloor512))

 

P_ChangeSwitchTexture(line,0);

break;

//

BUTTONS

584

case 42:

// Close Door

if (EV_DoDoor(line,close)) P_ChangeSwitchTexture(line,1);

break;

case 43:

// Lower Ceiling to Floor

if (EV_DoCeiling(line,lowerToFloor)) P_ChangeSwitchTexture(line,1);

break;

case 45:

// Lower Floor to Surrounding floor height if (EV_DoFloor(line,lowerFloor))

P_ChangeSwitchTexture(line,1); break;

case 60:

// Lower Floor to Lowest

if (EV_DoFloor(line,lowerFloorToLowest)) P_ChangeSwitchTexture(line,1);

break;

case 61:

// Open Door

if (EV_DoDoor(line,open)) P_ChangeSwitchTexture(line,1);

break;

case 62:

// PlatDownWaitUpStay

if (EV_DoPlat(line,downWaitUpStay,1)) P_ChangeSwitchTexture(line,1);

break;

case 63:

// Raise Door

if (EV_DoDoor(line,normal)) P_ChangeSwitchTexture(line,1);

break;

case 64:

// Raise Floor to ceiling

if (EV_DoFloor(line,raiseFloor)) P_ChangeSwitchTexture(line,1);

break;

case 66:

// Raise Floor 24 and change texture if (EV_DoPlat(line,raiseAndChange,24))

P_ChangeSwitchTexture(line,1); break;

case 67:

// Raise Floor 32 and change texture if (EV_DoPlat(line,raiseAndChange,32))

P_ChangeSwitchTexture(line,1); break;

case 65:

// Raise Floor Crush

if (EV_DoFloor(line,raiseFloorCrush)) P_ChangeSwitchTexture(line,1);

break;

585

case 68:

// Raise Plat to next highest floor and change texture if (EV_DoPlat(line,raiseToNearestAndChange,0))

P_ChangeSwitchTexture(line,1); break;

case 69:

// Raise Floor to next highest floor

if (EV_DoFloor(line, raiseFloorToNearest)) P_ChangeSwitchTexture(line,1);

break;

case 70:

// Turbo Lower Floor

if (EV_DoFloor(line,turboLower)) P_ChangeSwitchTexture(line,1);

break;

case 114:

// Blazing Door Raise (faster than TURBO!) if (EV_DoDoor (line,blazeRaise))

P_ChangeSwitchTexture(line,1); break;

case 115:

// Blazing Door Open (faster than TURBO!) if (EV_DoDoor (line,blazeOpen))

P_ChangeSwitchTexture(line,1); break;

case 116:

// Blazing Door Close (faster than TURBO!) if (EV_DoDoor (line,blazeClose))

P_ChangeSwitchTexture(line,1); break;

case 123:

// Blazing PlatDownWaitUpStay

if (EV_DoPlat(line,blazeDWUS,0)) P_ChangeSwitchTexture(line,1);

break;

case 132:

// Raise Floor Turbo

if (EV_DoFloor(line,raiseFloorTurbo)) P_ChangeSwitchTexture(line,1);

break;

case 99:

//BlzOpenDoor BLUE case 134:

//BlzOpenDoor RED case 136:

//BlzOpenDoor YELLOW

if (EV_DoLockedDoor (line,blazeOpen,thing)) P_ChangeSwitchTexture(line,1);

break;

case 138:

// Light Turn On EV_LightTurnOn(line,255); P_ChangeSwitchTexture(line,1); break;

586

case 139:

// Light Turn Off EV_LightTurnOn(line,35); P_ChangeSwitchTexture(line,1); break;

}

return true;

}

9.26 p telept.c

// Emacs style mode select -*- C++ -*- //-----------------------------------------------------------------------------

//

//$Id:$

//Copyright (C) 1993-1996 by id Software, Inc.

//This program is free software; you can redistribute it and/or

//modify it under the terms of the GNU General Public License

//as published by the Free Software Foundation; either version 2

//of the License, or (at your option) any later version.

//

//This program is distributed in the hope that it will be useful,

//but WITHOUT ANY WARRANTY; without even the implied warranty of

//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

//GNU General Public License for more details.

//

//$Log:$

//DESCRIPTION:

//Teleportation.

//-----------------------------------------------------------------------------

static const char

rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $";

#include "doomdef.h"

#include "s_sound.h"

#include "p_local.h"

// Data.

#include "sounds.h"

// State.

#include "r_state.h"

//

 

// TELEPORTATION

 

//

 

int

 

EV_Teleport

 

( line_t*

line,

int

side,

587

mobj_t*

thing )

{

 

int

i;

int

tag;

mobj_t*

m;

mobj_t*

fog;

unsigned

an;

thinker_t*

thinker;

sector_t*

sector;

fixed_t

oldx;

fixed_t

oldy;

fixed_t

oldz;

// don’t teleport missiles

if (thing->flags & MF_MISSILE) return 0;

//Don’t teleport if hit back of line,

//so you can get out of teleporter. if (side == 1)

return 0;

tag = line->tag;

for (i = 0; i < numsectors; i++)

{

if (sectors[ i ].tag == tag )

{

thinker = thinkercap.next;

for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)

{

// not a mobj

if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) continue;

m = (mobj_t *)thinker;

// not a teleportman

if (m->type != MT_TELEPORTMAN ) continue;

sector = m->subsector->sector; // wrong sector

if (sector-sectors != i ) continue;

oldx = thing->x; oldy = thing->y; oldz = thing->z;

if (!P_TeleportMove (thing, m->x, m->y)) return 0;

thing->z = thing->floorz; //fixme: not needed? if (thing->player)

thing->player->viewz = thing->z+thing->player->viewheight;

// spawn teleport fog at source and destination fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); S_StartSound (fog, sfx_telept);

an = m->angle >> ANGLETOFINESHIFT;

fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an] , thing->z, MT_TFOG);

588

// emit sound, where? S_StartSound (fog, sfx_telept);

// don’t move for a bit if (thing->player)

thing->reactiontime = 18;

thing->angle = m->angle;

thing->momx = thing->momy = thing->momz = 0; return 1;

}

}

}

return 0;

}

9.27p tick.c

// Emacs style mode select -*- C++ -*- //-----------------------------------------------------------------------------

//

//$Id:$

//Copyright (C) 1993-1996 by id Software, Inc.

//This program is free software; you can redistribute it and/or

//modify it under the terms of the GNU General Public License

//as published by the Free Software Foundation; either version 2

//of the License, or (at your option) any later version.

//

//This program is distributed in the hope that it will be useful,

//but WITHOUT ANY WARRANTY; without even the implied warranty of

//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

//GNU General Public License for more details.

//

//$Log:$

//DESCRIPTION:

//Archiving: SaveGame I/O.

//Thinker, Ticker.

//

//-----------------------------------------------------------------------------

static const char

rcsid[] = "$Id: p_tick.c,v 1.4 1997/02/03 16:47:55 b1 Exp $";

#include "z_zone.h" #include "p_local.h"

#include "doomstat.h"

int leveltime;

//

//THINKERS

//All thinkers should be allocated by Z_Malloc

//so they can be operated on uniformly.

//The actual structures will vary in size,

//but the first element must be thinker_t.

//

589

// Both the head and tail of the thinker list. thinker_t thinkercap;

//

// P_InitThinkers

//

void P_InitThinkers (void)

{

thinkercap.prev = thinkercap.next = &thinkercap;

}

//

//P_AddThinker

//Adds a new thinker at the end of the list.

void P_AddThinker (thinker_t* thinker)

{

thinkercap.prev->next = thinker; thinker->next = &thinkercap; thinker->prev = thinkercap.prev; thinkercap.prev = thinker;

}

//

//P_RemoveThinker

//Deallocation is lazy -- it will not actually be freed

//until its thinking turn comes up.

//

void P_RemoveThinker (thinker_t* thinker)

{

// FIXME: NOP.

thinker->function.acv = (actionf_v)(-1);

}

//

//P_AllocateThinker

//Allocates memory and adds a new thinker at the end of the list.

void P_AllocateThinker (thinker_t*

thinker)

{

 

}

 

//

// P_RunThinkers

//

void P_RunThinkers (void)

{

thinker_t* currentthinker;

currentthinker = thinkercap.next; while (currentthinker != &thinkercap)

{

if ( currentthinker->function.acv == (actionf_v)(-1) )

{

590

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]