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

Iskhodnyy_kod_Doom

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

switch(line->special)

{

case 46:

// OPEN DOOR IMPACT ok = 1;

break;

}

if (!ok) return;

}

switch(line->special)

{

case 24:

// RAISE FLOOR EV_DoFloor(line,raiseFloor); P_ChangeSwitchTexture(line,0); break;

case 46:

// OPEN DOOR EV_DoDoor(line,open); P_ChangeSwitchTexture(line,1); break;

case 47:

// RAISE FLOOR NEAR AND CHANGE

EV_DoPlat(line,raiseToNearestAndChange,0);

P_ChangeSwitchTexture(line,0);

break;

}

}

//

//P_PlayerInSpecialSector

//Called every tic frame

//that the player origin is in a special sector

void P_PlayerInSpecialSector (player_t* player)

{

sector_t* sector;

sector = player->mo->subsector->sector;

// Falling, not all the way down yet?

if (player->mo->z != sector->floorheight)

return;

// Has

hitten ground.

switch

(sector->special)

{

 

case

5:

//

HELLSLIME DAMAGE

if

(!player->powers[pw_ironfeet])

 

if (!(leveltime&0x1f))

 

P_DamageMobj (player->mo, NULL, NULL, 10);

break;

case

7:

//

NUKAGE DAMAGE

if

(!player->powers[pw_ironfeet])

 

if (!(leveltime&0x1f))

 

P_DamageMobj (player->mo, NULL, NULL, 5);

561

break;

case 16:

//SUPER HELLSLIME DAMAGE case 4:

//STROBE HURT

if (!player->powers[pw_ironfeet] || (P_Random()<5) )

{

if (!(leveltime&0x1f))

P_DamageMobj (player->mo, NULL, NULL, 20);

}

break;

case 9:

// SECRET SECTOR player->secretcount++; sector->special = 0; break;

case 11:

// EXIT SUPER DAMAGE! (for E1M8 finale) player->cheats &= ~CF_GODMODE;

if (!(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;

};

}

//

//P_UpdateSpecials

//Animate planes, scroll walls, etc.

boolean

levelTimer;

int

levelTimeCount;

void P_UpdateSpecials (void)

{

 

anim_t*

anim;

int

pic;

int

i;

line_t*

line;

//

LEVEL TIMER

if (levelTimer == true)

{

levelTimeCount--;

if (!levelTimeCount) G_ExitLevel();

}

562

// ANIMATE FLATS AND TEXTURES GLOBALLY for (anim = anims ; anim < lastanim ; anim++)

{

for (i=anim->basepic ; i<anim->basepic+anim->numpics ; i++)

{

pic = anim->basepic + ( (leveltime/anim->speed + i)%anim->numpics ); if (anim->istexture)

texturetranslation[i] = pic;

else

flattranslation[i] = pic;

}

}

//ANIMATE LINE SPECIALS

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

{

line = linespeciallist[i]; switch(line->special)

{

case 48:

// EFFECT FIRSTCOL SCROLL + sides[line->sidenum[0]].textureoffset += FRACUNIT; break;

}

}

//DO BUTTONS

for (i = 0; i < MAXBUTTONS; i++) if (buttonlist[i].btimer)

{

buttonlist[i].btimer--;

if (!buttonlist[i].btimer)

{

switch(buttonlist[i].where)

{

case top: sides[buttonlist[i].line->sidenum[0]].toptexture =

buttonlist[i].btexture;

break;

case middle: sides[buttonlist[i].line->sidenum[0]].midtexture =

buttonlist[i].btexture;

break;

case bottom: sides[buttonlist[i].line->sidenum[0]].bottomtexture =

buttonlist[i].btexture;

break;

}

S_StartSound((mobj_t *)&buttonlist[i].soundorg,sfx_swtchn); memset(&buttonlist[i],0,sizeof(button_t));

}

}

}

//

// Special Stuff that can not be categorized

//

 

int EV_DoDonut(line_t*

line)

563

{

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 = &sectors[secnum];

// ALREADY MOVING? IF SO, KEEP GOING...

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;

//Spawn rising slime

floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 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;

//Spawn lowering donut-hole

floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 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;

}

//

// SPECIAL SPAWNING

//

564

//

//P_SpawnSpecials

//After the map has been loaded, scan for specials

//that spawn thinkers

//

 

short

numlinespecials;

line_t*

linespeciallist[MAXLINEANIMS];

// Parses command line parameters. void P_SpawnSpecials (void)

{

sector_t*

sector;

int

i;

int

episode;

episode = 1;

if (W_CheckNumForName("texture2") >= 0) episode = 2;

// See if -TIMER needs to be used. levelTimer = false;

i = M_CheckParm("-avg"); if (i && deathmatch)

{

levelTimer = true; levelTimeCount = 20 * 60 * 35;

}

i = M_CheckParm("-timer"); if (i && deathmatch)

{

 

 

 

int

time;

 

time = atoi(myargv[i+1]) * 60 * 35;

 

levelTimer

= true;

 

levelTimeCount = time;

}

 

 

//

Init

special SECTORs.

sector = sectors;

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

{

if (!sector->special) continue;

switch (sector->special)

{

case 1:

// FLICKERING LIGHTS

P_SpawnLightFlash (sector); break;

case 2:

// STROBE FAST P_SpawnStrobeFlash(sector,FASTDARK,0); break;

case 3:

// STROBE SLOW P_SpawnStrobeFlash(sector,SLOWDARK,0); break;

case 4:

565

// STROBE FAST/DEATH SLIME P_SpawnStrobeFlash(sector,FASTDARK,0); sector->special = 4;

break;

case 8:

// GLOWING LIGHT P_SpawnGlowingLight(sector); break;

case 9:

// SECRET SECTOR totalsecret++; break;

case 10:

// DOOR CLOSE IN 30 SECONDS P_SpawnDoorCloseIn30 (sector); break;

case 12:

// SYNC STROBE SLOW

P_SpawnStrobeFlash (sector, SLOWDARK, 1); break;

case 13:

// SYNC STROBE FAST

P_SpawnStrobeFlash (sector, FASTDARK, 1); break;

case 14:

// DOOR RAISE IN 5 MINUTES P_SpawnDoorRaiseIn5Mins (sector, i); break;

case 17: P_SpawnFireFlicker(sector); break;

}

}

// Init line EFFECTs numlinespecials = 0;

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

{

switch(lines[i].special)

{

case 48:

// EFFECT FIRSTCOL SCROLL+ linespeciallist[numlinespecials] = &lines[i]; numlinespecials++;

break;

}

}

// Init other misc stuff for (i = 0;i < MAXCEILINGS;i++) activeceilings[i] = NULL;

for (i = 0;i < MAXPLATS;i++) activeplats[i] = NULL;

for (i = 0;i < MAXBUTTONS;i++) memset(&buttonlist[i],0,sizeof(button_t));

566

boolean levelTimer;
int levelTimeCount;

//UNUSED: no horizonal sliders.

//P_InitSlidingDoorFrames();

}

9.24 p spec.h

// 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.

//

//DESCRIPTION: none

//Implements special effects:

//Texture animation, height or lighting changes

//according to adjacent sectors, respective

//utility functions, etc.

//

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

#ifndef __P_SPEC__ #define __P_SPEC__

//

// End-level timer (-TIMER option)

//

extern extern

//Define values for map objects

#define

MO_TELEPORTMAN

14

// at game start

 

 

void

P_InitPicAnims (void);

 

// at map load

 

 

void

P_SpawnSpecials (void);

 

// every tic

 

 

void

P_UpdateSpecials (void);

 

// when

needed

 

 

boolean

 

 

 

P_UseSpecialLine

 

 

( mobj_t*

thing,

 

line_t*

line,

 

int

 

side );

 

void

567

P_ShootSpecialLine

( mobj_t*

thing,

line_t*

line );

void P_CrossSpecialLine

( int

 

linenum,

int

 

side,

mobj_t*

thing );

void

P_PlayerInSpecialSector (player_t* player);

int

 

 

twoSided

 

 

( int

 

sector,

int

 

line );

sector_t*

 

getSector

 

( int

 

currentSector,

int

 

line,

int

 

side );

side_t*

 

 

getSide

 

 

( int

 

currentSector,

int

 

line,

int

 

side );

fixed_t P_FindLowestFloorSurrounding(sector_t* sec); fixed_t P_FindHighestFloorSurrounding(sector_t* sec);

fixed_t P_FindNextHighestFloor

( sector_t*

sec,

int

currentheight );

fixed_t P_FindLowestCeilingSurrounding(sector_t* sec); fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);

int P_FindSectorFromLineTag

( line_t*

line,

int

start );

int P_FindMinSurroundingLight

( sector_t*

sector,

int

max );

sector_t*

 

getNextSector

 

( line_t*

line,

sector_t*

sec );

//

// SPECIAL

//

int EV_DoDonut(line_t* line);

//

// P_LIGHTS

568

//

 

 

typedef

struct

 

{

 

 

thinker_t

thinker;

sector_t*

sector;

int

 

count;

int

 

maxlight;

int

 

minlight;

} fireflicker_t;

 

typedef

struct

 

{

 

 

thinker_t

thinker;

sector_t*

sector;

int

 

count;

int

 

maxlight;

int

 

minlight;

int

 

maxtime;

int

 

mintime;

} lightflash_t;

 

typedef

struct

 

{

 

 

thinker_t

thinker;

sector_t*

sector;

int

 

count;

int

 

minlight;

int

 

maxlight;

int

 

darktime;

int

 

brighttime;

} strobe_t;

 

typedef

struct

 

{

 

 

thinker_t

thinker;

sector_t*

sector;

int

 

minlight;

int

 

maxlight;

int

 

direction;

} glow_t;

 

#define

GLOWSPEED

8

#define

STROBEBRIGHT

5

#define

FASTDARK

15

#define

SLOWDARK

35

void

P_SpawnFireFlicker (sector_t* sector);

void

T_LightFlash (lightflash_t* flash);

void

P_SpawnLightFlash (sector_t* sector);

void

T_StrobeFlash (strobe_t* flash);

void

 

 

P_SpawnStrobeFlash

569

( sector_t*

sector,

int

 

fastOrSlow,

int

 

inSync );

void

EV_StartLightStrobing(line_t* line);

void

EV_TurnTagLightsOff(line_t* line);

void

 

 

EV_LightTurnOn

 

( line_t*

line,

int

 

bright );

void

T_Glow(glow_t* g);

void

P_SpawnGlowingLight(sector_t* sector);

//

 

// P_SWITCH

 

//

 

typedef struct

 

{

 

char

name1[9];

char

name2[9];

short

episode;

} switchlist_t;

 

typedef enum

 

{

 

top,

 

middle,

 

bottom

 

} bwhere_e;

 

typedef struct

 

{

 

line_t*

line;

bwhere_e

where;

int

btexture;

int

btimer;

mobj_t*

soundorg;

} button_t;

 

// max

# of wall switches in a level

#define

MAXSWITCHES

50

// 4 players, 4 buttons each at once, max.

#define

MAXBUTTONS

16

// 1 second, in ticks.

 

#define

BUTTONTIME

35

extern button_t

buttonlist[MAXBUTTONS];

void

 

 

P_ChangeSwitchTexture

 

570

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