Iskhodnyy_kod_Doom
.pdfMT_KNIGHT,
MT_SKULL,
MT_SPIDER,
MT_BABY,
MT_CYBORG,
MT_PAIN,
MT_WOLFSS,
MT_KEEN, MT_BOSSBRAIN, MT_BOSSSPIT, MT_BOSSTARGET, MT_SPAWNSHOT, MT_SPAWNFIRE, MT_BARREL, MT_TROOPSHOT, MT_HEADSHOT, MT_ROCKET, MT_PLASMA, MT_BFG, MT_ARACHPLAZ, MT_PUFF, MT_BLOOD, MT_TFOG, MT_IFOG, MT_TELEPORTMAN, MT_EXTRABFG, MT_MISC0, MT_MISC1, MT_MISC2, MT_MISC3, MT_MISC4, MT_MISC5, MT_MISC6, MT_MISC7, MT_MISC8, MT_MISC9, MT_MISC10, MT_MISC11, MT_MISC12, MT_INV, MT_MISC13, MT_INS, MT_MISC14, MT_MISC15, MT_MISC16, MT_MEGA, MT_CLIP, MT_MISC17, MT_MISC18, MT_MISC19, MT_MISC20, MT_MISC21, MT_MISC22, MT_MISC23, MT_MISC24, MT_MISC25, MT_CHAINGUN, MT_MISC26, MT_MISC27, MT_MISC28, MT_SHOTGUN, MT_SUPERSHOTGUN, MT_MISC29, MT_MISC30, MT_MISC31,
361
MT_MISC32,
MT_MISC33,
MT_MISC34,
MT_MISC35,
MT_MISC36,
MT_MISC37,
MT_MISC38,
MT_MISC39,
MT_MISC40,
MT_MISC41,
MT_MISC42,
MT_MISC43,
MT_MISC44,
MT_MISC45,
MT_MISC46,
MT_MISC47,
MT_MISC48,
MT_MISC49,
MT_MISC50,
MT_MISC51,
MT_MISC52,
MT_MISC53,
MT_MISC54,
MT_MISC55,
MT_MISC56,
MT_MISC57,
MT_MISC58,
MT_MISC59,
MT_MISC60,
MT_MISC61,
MT_MISC62,
MT_MISC63,
MT_MISC64,
MT_MISC65,
MT_MISC66,
MT_MISC67,
MT_MISC68,
MT_MISC69,
MT_MISC70,
MT_MISC71,
MT_MISC72,
MT_MISC73,
MT_MISC74,
MT_MISC75,
MT_MISC76,
MT_MISC77,
MT_MISC78,
MT_MISC79,
MT_MISC80,
MT_MISC81,
MT_MISC82,
MT_MISC83,
MT_MISC84,
MT_MISC85,
MT_MISC86,
NUMMOBJTYPES
} mobjtype_t;
typedef struct
{
int doomednum;
int spawnstate;
int spawnhealth;
int seestate;
362
int |
seesound; |
int |
reactiontime; |
int |
attacksound; |
int |
painstate; |
int |
painchance; |
int |
painsound; |
int |
meleestate; |
int |
missilestate; |
int |
deathstate; |
int |
xdeathstate; |
int |
deathsound; |
int |
speed; |
int |
radius; |
int |
height; |
int |
mass; |
int |
damage; |
int |
activesound; |
int |
flags; |
int |
raisestate; |
} mobjinfo_t; |
|
extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
#endif //-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------
9.3 p ceilng.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: Ceiling aninmation (lowering, crushing, raising)
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_ceilng.c,v 1.4 1997/02/03 16:47:53 b1 Exp $";
#include "z_zone.h" #include "doomdef.h" #include "p_local.h"
#include "s_sound.h"
363
// State.
#include "doomstat.h" #include "r_state.h"
// Data.
#include "sounds.h"
//
// CEILINGS
//
ceiling_t* activeceilings[MAXCEILINGS];
//
// T_MoveCeiling
//
void T_MoveCeiling (ceiling_t* ceiling)
{
result_e res;
switch(ceiling->direction)
{
case 0:
// IN STASIS break;
case 1: // UP
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false,1,ceiling->direction);
if (!(leveltime&7))
{
switch(ceiling->type)
{
case silentCrushAndRaise: break;
default:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,
sfx_stnmov);
// ? break;
}
}
if (res == pastdest)
{
switch(ceiling->type)
{
case raiseToHighest: P_RemoveActiveCeiling(ceiling); break;
case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop);
case fastCrushAndRaise: case crushAndRaise:
ceiling->direction = -1; break;
364
default:
break;
}
}
break;
case -1: // DOWN
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight,
ceiling->crush,1,ceiling->direction);
if (!(leveltime&7))
{
switch(ceiling->type)
{
case silentCrushAndRaise: break; default:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,
sfx_stnmov);
}
}
if (res == pastdest)
{
switch(ceiling->type)
{
case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop);
case crushAndRaise: ceiling->speed = CEILSPEED;
case fastCrushAndRaise: ceiling->direction = 1; break;
case lowerAndCrush: case lowerToFloor:
P_RemoveActiveCeiling(ceiling); break;
default:
break;
}
}
else // ( res != pastdest )
{
if (res == crushed)
{
switch(ceiling->type)
{
case silentCrushAndRaise: case crushAndRaise:
case lowerAndCrush: ceiling->speed = CEILSPEED / 8; break;
default:
break;
}
}
}
365
break;
}
}
//
//EV_DoCeiling
//Move a ceiling up/down and all around!
int EV_DoCeiling
( line_t* line,
ceiling_e |
type ) |
{ |
|
int |
secnum; |
int |
rtn; |
sector_t* |
sec; |
ceiling_t* |
ceiling; |
secnum = -1; |
|
rtn = 0; |
|
// Reactivate in-stasis ceilings...for certain types. switch(type)
{
case fastCrushAndRaise: case silentCrushAndRaise: case crushAndRaise:
P_ActivateInStasisCeiling(line); default:
break;
}
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum]; if (sec->specialdata)
continue;
// new door thinker rtn = 1;
ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVSPEC, 0); P_AddThinker (&ceiling->thinker);
sec->specialdata = ceiling;
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling; ceiling->sector = sec;
ceiling->crush = false;
switch(type)
{
case fastCrushAndRaise: ceiling->crush = true;
ceiling->topheight = sec->ceilingheight; ceiling->bottomheight = sec->floorheight + (8*FRACUNIT); ceiling->direction = -1;
ceiling->speed = CEILSPEED * 2; break;
case silentCrushAndRaise: case crushAndRaise:
ceiling->crush = true; ceiling->topheight = sec->ceilingheight;
case lowerAndCrush: case lowerToFloor:
ceiling->bottomheight = sec->floorheight;
366
if (type != lowerToFloor) ceiling->bottomheight += 8*FRACUNIT;
ceiling->direction = -1; ceiling->speed = CEILSPEED; break;
case raiseToHighest:
ceiling->topheight = P_FindHighestCeilingSurrounding(sec); ceiling->direction = 1;
ceiling->speed = CEILSPEED; break;
}
ceiling->tag = sec->tag; ceiling->type = type; P_AddActiveCeiling(ceiling);
}
return rtn;
}
//
// Add an active ceiling
//
void P_AddActiveCeiling(ceiling_t* c)
{
int |
i; |
for (i = 0; i < MAXCEILINGS;i++)
{
if (activeceilings[i] == NULL)
{
activeceilings[i] = c; return;
}
}
}
//
// Remove a ceiling’s thinker
//
void P_RemoveActiveCeiling(ceiling_t* c)
{
int |
i; |
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i] == c)
{
activeceilings[i]->sector->specialdata = NULL; P_RemoveThinker (&activeceilings[i]->thinker); activeceilings[i] = NULL;
break;
}
}
}
//
// Restart a ceiling that’s in-stasis
//
void P_ActivateInStasisCeiling(line_t* line)
367
{
int |
i; |
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i]
&&(activeceilings[i]->tag == line->tag)
&&(activeceilings[i]->direction == 0))
{
activeceilings[i]->direction = activeceilings[i]->olddirection; activeceilings[i]->thinker.function.acp1
= (actionf_p1)T_MoveCeiling;
}
}
}
//
//EV_CeilingCrushStop
//Stop a ceiling from crushing!
int |
EV_CeilingCrushStop(line_t |
*line) |
{ |
|
|
int |
i; |
|
int |
rtn; |
|
rtn = 0;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i]
&&(activeceilings[i]->tag == line->tag)
&&(activeceilings[i]->direction != 0))
{
activeceilings[i]->olddirection = activeceilings[i]->direction; activeceilings[i]->thinker.function.acv = (actionf_v)NULL; activeceilings[i]->direction = 0; // in-stasis rtn = 1;
}
}
return rtn;
}
9.4p doors.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:$
368
//
// DESCRIPTION: Door animation code (opening/closing)
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_doors.c,v 1.4 1997/02/03 16:47:53 b1 Exp $";
#include "z_zone.h" #include "doomdef.h" #include "p_local.h"
#include "s_sound.h"
// State. |
|
#include |
"doomstat.h" |
#include |
"r_state.h" |
// Data. |
|
#include |
"dstrings.h" |
#include |
"sounds.h" |
#if 0 |
|
|
// |
|
|
// Sliding door frame information |
|
|
// |
|
|
slidename_t |
slideFrameNames[MAXSLIDEDOORS] = |
|
{ |
|
|
{"GDOORF1","GDOORF2","GDOORF3","GDOORF4", |
// front |
|
"GDOORB1","GDOORB2","GDOORB3","GDOORB4"}, |
// back |
|
{"\0","\0","\0","\0"} |
|
|
}; |
|
|
#endif |
|
|
// |
|
|
// VERTICAL DOORS |
|
|
// |
|
|
// |
|
|
// T_VerticalDoor |
|
|
// |
|
|
void T_VerticalDoor (vldoor_t* door) |
|
|
{ |
|
|
result_e |
res; |
|
switch(door->direction)
{
case 0:
// WAITING
if (!--door->topcountdown)
{
switch(door->type)
{
case blazeRaise:
door->direction = -1; // time to go back down S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_bdcls);
break;
case normal:
door->direction = -1; // time to go back down
369
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_dorcls);
break;
case close30ThenOpen: door->direction = 1;
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn);
break;
default:
break;
}
}
break;
case 2:
//INITIAL WAIT
if (!--door->topcountdown)
{
switch(door->type)
{
case raiseIn5Mins: door->direction = 1; door->type = normal;
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn);
break;
default:
break;
}
}
break;
case -1: // DOWN
res = T_MovePlane(door->sector, door->speed, door->sector->floorheight, false,1,door->direction);
if (res == pastdest)
{
switch(door->type)
{
case blazeRaise: case blazeClose:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); // unlink and free S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_bdcls);
break;
case normal: case close:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); // unlink and free break;
case close30ThenOpen: door->direction = 0; door->topcountdown = 35*30; break;
default:
370