Iskhodnyy_kod_Doom
.pdf} cheat_t;
//
// Extended player object info: player_t
//
typedef struct player_s
{
mobj_t* |
mo; |
playerstate_t |
playerstate; |
ticcmd_t |
cmd; |
//Determine POV,
//including viewpoint bobbing during movement.
//Focal origin above r.z
fixed_t |
viewz; |
// Base height above floor for viewz. |
|
fixed_t |
viewheight; |
// Bob/squat speed. |
|
fixed_t |
deltaviewheight; |
// bounded/scaled total momentum. |
|
fixed_t |
bob; |
//This is only used between levels,
//mo->health is used during levels.
int |
health; |
int |
armorpoints; |
// Armor type is 0-2. |
|
int |
armortype; |
// Power ups. invinc and invis are tic counters.
int |
powers[NUMPOWERS]; |
boolean |
cards[NUMCARDS]; |
boolean |
backpack; |
// Frags, kills of other players. |
|
int |
frags[MAXPLAYERS]; |
weapontype_t |
readyweapon; |
// Is wp_nochange if not changing. |
|
weapontype_t |
pendingweapon; |
boolean |
weaponowned[NUMWEAPONS]; |
int |
ammo[NUMAMMO]; |
int |
maxammo[NUMAMMO]; |
// True if button down last tic. |
|
int |
attackdown; |
int |
usedown; |
//Bit flags, for cheats and debug.
//See cheat_t, above.
int |
cheats; |
// Refired shots are less accurate. |
|
int |
refire; |
// For intermission stats. |
|
int |
killcount; |
int |
itemcount; |
int |
secretcount; |
// Hint messages. |
|
char* |
message; |
101
// For screen flashing (red or bright).
int |
damagecount; |
int |
bonuscount; |
// |
Who did damage (NULL for floors/ceilings). |
|
mobj_t* |
attacker; |
|
// |
So gun flashes light up areas. |
|
int |
extralight; |
//Current PLAYPAL, ???
//can be set to REDCOLORMAP for pain, etc.
int |
fixedcolormap; |
//Player skin colorshift,
//0-3 for which color to draw player.
int |
colormap; |
// Overlay view sprites |
(gun, etc). |
pspdef_t |
psprites[NUMPSPRITES]; |
// True if secret level |
has been done. |
boolean |
didsecret; |
} player_t; |
|
//
//INTERMISSION
//Structure passed e.g. to WI_Start(wb)
typedef struct
{
boolean |
in; |
// whether the player is in game |
|
// Player stats, kills, collected items etc. |
|||
int |
|
skills; |
|
int |
|
sitems; |
|
int |
|
ssecret; |
|
int |
|
stime; |
|
int |
|
frags[4]; |
|
int |
|
score; |
// current score on entry, modified on return |
} wbplayerstruct_t; |
|
|
|
typedef struct |
|
|
|
{ |
|
|
|
int |
|
epsd; |
// episode # (0-2) |
// if true, splash |
the secret level |
||
boolean |
didsecret; |
|
|
// previous and next levels, origin 0 |
|||
int |
|
last; |
|
int |
|
next; |
|
int |
|
maxkills; |
|
int |
|
maxitems; |
|
int |
|
maxsecret; |
|
int |
|
maxfrags; |
|
// the par time |
|
|
|
int |
|
partime; |
|
// index of this player in game
102
int |
pnum; |
wbplayerstruct_t |
plyr[MAXPLAYERS]; |
||
} wbstartstruct_t; |
|
||
#endif |
|
||
//----------------------------------------------------------------------------- |
|
|
|
// |
|
|
|
// $Log:$ |
|
||
// |
|
|
|
//----------------------------------------------------------------------------- |
|
|
|
3.11 d |
|
textur.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:
//Typedefs related to to textures etc.,
//isolated here to make it easier separating modules.
//-----------------------------------------------------------------------------
#ifndef __D_TEXTUR__ #define __D_TEXTUR__
#include "doomtype.h"
//
//Flats?
//a pic is an unmasked block of pixels typedef struct
{
byte |
width; |
byte |
height; |
byte |
data; |
} pic_t; |
|
#endif //-----------------------------------------------------------------------------
//
103
// $Log:$
//
//-----------------------------------------------------------------------------
3.12 d think.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:
//MapObj data. Map Objects or mobjs are actors, entities,
// thinker, take-your-pick... anything that moves, acts, or
// suffers state changes of more or less violent nature.
//
//-----------------------------------------------------------------------------
#ifndef __D_THINK__ #define __D_THINK__
#ifdef __GNUG__ #pragma interface #endif
//
//Experimental stuff.
//To compile this as "ANSI C with classes"
//we will need to handle the various
//action functions cleanly.
//
typedef typedef typedef
typedef union
{
actionf_p1 acp1; actionf_v acv; actionf_p2 acp2;
} actionf_t;
//Historically, "think_t" is yet another
//function pointer to a routine to handle
104
//an actor.
typedef actionf_t think_t;
// Doubly linked list of actors. typedef struct thinker_s
{ |
|
|
|
struct thinker_s* |
prev; |
||
struct thinker_s* |
next; |
||
think_t |
function; |
||
} thinker_t; |
|
||
#endif |
|
||
//----------------------------------------------------------------------------- |
|
|
|
// |
|
|
|
// $Log:$ |
|
||
// |
|
|
|
//----------------------------------------------------------------------------- |
|
|
|
3.13 d |
|
ticcmd.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:
//System specific interface stuff.
//-----------------------------------------------------------------------------
#ifndef __D_TICCMD__ #define __D_TICCMD__
#include "doomtype.h"
#ifdef __GNUG__ #pragma interface #endif
//The data sampled per tick (single player)
//and transmitted to other peers (multiplayer).
//Mainly movements/button commands per game tick,
//plus a checksum for internal state consistency. typedef struct
{
char |
forwardmove; |
// *2048 for move |
char |
sidemove; |
// *2048 for move |
short |
angleturn; |
// <<16 for angle delta |
105
|
short |
consistancy; |
// checks for net game |
||
|
byte |
chatchar; |
|
||
|
byte |
buttons; |
|
||
} ticcmd_t; |
|
|
|||
#endif |
|
|
|||
//----------------------------------------------------------------------------- |
|
|
|
|
|
// |
|
|
|
|
|
// $Log:$ |
|
|
|||
// |
|
|
|
|
|
//----------------------------------------------------------------------------- |
|
|
|
|
|
4 |
Finale code |
|
|||
4.1 |
f |
|
finale.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:
//Game completion, final screen animation.
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: f_finale.c,v 1.5 1997/02/03 21:26:34 b1 Exp $";
#include <ctype.h>
//Functions. #include "i_system.h" #include "m_swap.h" #include "z_zone.h" #include "v_video.h" #include "w_wad.h" #include "s_sound.h"
//Data.
#include "dstrings.h" #include "sounds.h"
#include "doomstat.h" #include "r_state.h"
// ?
//#include "doomstat.h"
106
//#include "r_local.h"
//#include "f_finale.h"
//Stage of animation:
//0 = text, 1 = art screen, 2 = character cast
int |
finalestage; |
|
int |
finalecount; |
|
#define |
TEXTSPEED |
3 |
#define |
TEXTWAIT |
250 |
char* |
e1text = E1TEXT; |
|
char* |
e2text = E2TEXT; |
|
char* |
e3text = E3TEXT; |
|
char* |
e4text = E4TEXT; |
|
char* |
c1text = C1TEXT; |
|
char* |
c2text = C2TEXT; |
|
char* |
c3text = C3TEXT; |
|
char* |
c4text = C4TEXT; |
|
char* |
c5text = C5TEXT; |
|
char* |
c6text = C6TEXT; |
|
char* |
p1text = P1TEXT; |
|
char* |
p2text = P2TEXT; |
|
char* |
p3text = P3TEXT; |
|
char* |
p4text = P4TEXT; |
|
char* |
p5text = P5TEXT; |
|
char* |
p6text = P6TEXT; |
|
char* |
t1text = T1TEXT; |
|
char* |
t2text = T2TEXT; |
|
char* |
t3text = T3TEXT; |
|
char* |
t4text = T4TEXT; |
|
char* |
t5text = T5TEXT; |
|
char* |
t6text = T6TEXT; |
|
char* |
finaletext; |
|
char* |
finaleflat; |
|
void |
F_StartCast (void); |
|
void |
F_CastTicker (void); |
boolean F_CastResponder (event_t *ev);
void F_CastDrawer (void);
//
// F_StartFinale
//
void F_StartFinale (void)
{
gameaction = ga_nothing; gamestate = GS_FINALE; viewactive = false; automapactive = false;
//Okay - IWAD dependend stuff.
//This has been changed severly, and
//some stuff might have changed in the process. switch ( gamemode )
{
//DOOM 1 - E1, E3 or E4, but each nine missions case shareware:
case registered:
107
case retail:
{
S_ChangeMusic(mus_victor, true);
switch (gameepisode)
{
case 1:
finaleflat = "FLOOR4_8"; finaletext = e1text; break;
case 2:
finaleflat = "SFLR6_1"; finaletext = e2text; break;
case 3:
finaleflat = "MFLR8_4"; finaletext = e3text; break;
case 4:
finaleflat = "MFLR8_3"; finaletext = e4text; break;
default: // Ouch. break;
}
break;
}
// DOOM II and missions packs with E1, M34 case commercial:
{
S_ChangeMusic(mus_read_m, true);
switch (gamemap)
{
case 6:
finaleflat = "SLIME16"; finaletext = c1text; break;
case 11:
finaleflat = "RROCK14"; finaletext = c2text; break;
case 20:
finaleflat = "RROCK07"; finaletext = c3text; break;
case 30:
finaleflat = "RROCK17"; finaletext = c4text; break;
case 15:
finaleflat = "RROCK13"; finaletext = c5text; break;
case 31:
finaleflat = "RROCK19"; finaletext = c6text; break;
default: // Ouch. break;
}
break;
108
}
// Indeterminate. default:
S_ChangeMusic(mus_read_m, true);
finaleflat = "F_SKY1"; // Not used anywhere else. finaletext = c1text; // FIXME - other text, music? break;
}
finalestage = 0; finalecount = 0;
}
boolean F_Responder (event_t *event)
{
if (finalestage == 2)
return F_CastResponder (event);
return false;
} |
|
// |
|
// F_Ticker |
|
// |
|
void F_Ticker (void) |
|
{ |
|
int |
i; |
// check for skipping
if ( (gamemode == commercial) && ( finalecount > 50) )
{
// go on to the next level for (i=0 ; i<MAXPLAYERS ; i++)
if (players[i].cmd.buttons) break;
if (i < MAXPLAYERS)
{
if (gamemap == 30) F_StartCast ();
else
gameaction = ga_worlddone;
}
}
// advance animation finalecount++;
if (finalestage == 2)
{
F_CastTicker (); return;
}
if ( gamemode == commercial) return;
if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT)
109
{
finalecount |
= 0; |
|
|
|
finalestage |
= |
1; |
|
|
wipegamestate |
= |
-1; |
// force a wipe |
|
if (gameepisode |
== 3) |
|
||
S_StartMusic (mus_bunny); |
|
}
}
//
// F_TextWrite
//
#include "hu_stuff.h"
extern |
patch_t *hu_font[HU_FONTSIZE]; |
void F_TextWrite (void) |
|
{ |
|
byte* |
src; |
byte* |
dest; |
int |
x,y,w; |
int |
count; |
char* |
ch; |
int |
c; |
int |
cx; |
int |
cy; |
// erase the entire screen to a tiled background src = W_CacheLumpName ( finaleflat , PU_CACHE); dest = screens[0];
for (y=0 ; y<SCREENHEIGHT ; y++)
{
for (x=0 ; x<SCREENWIDTH/64 ; x++)
{
memcpy (dest, src+((y&63)<<6), 64); dest += 64;
}
if (SCREENWIDTH&63)
{
memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63); dest += (SCREENWIDTH&63);
}
}
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
// draw some of the text onto the screen cx = 10;
cy = 10;
ch = finaletext;
count = (finalecount - 10)/TEXTSPEED; if (count < 0)
count = 0;
for ( ; count ; count-- )
{
c = *ch++; if (!c)
break;
if (c == ’\n’)
110