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

Iskhodnyy_kod_Doom

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

wp_shotgun, wp_chaingun, wp_missile, wp_plasma, wp_bfg, wp_chainsaw, wp_supershotgun,

NUMWEAPONS,

// No pending weapon change. wp_nochange

} weapontype_t;

// Ammunition types defined.

typedef enum

 

{

 

am_clip,

// Pistol / chaingun ammo.

am_shell,

// Shotgun / double barreled shotgun.

am_cell,

// Plasma rifle, BFG.

am_misl,

// Missile launcher.

NUMAMMO,

 

am_noammo

// Unlimited for chainsaw / fist.

} ammotype_t;

 

// Power up artifacts. typedef enum

{

pw_invulnerability, pw_strength, pw_invisibility, pw_ironfeet, pw_allmap, pw_infrared, NUMPOWERS

} powertype_t;

//

//Power up durations,

//how many seconds till expiration,

//assuming TICRATE is 35 ticks/second.

typedef enum

{

INVULNTICS

= (30*TICRATE),

INVISTICS

=

(60*TICRATE),

INFRATICS

=

(120*TICRATE),

IRONTICS

= (60*TICRATE)

} powerduration_t;

//

//DOOM keyboard definition.

//This is the stuff configured by Setup.Exe.

//Most key data are simple ascii (uppercased).

11

//

 

#define KEY_RIGHTARROW

0xae

#define KEY_LEFTARROW

0xac

#define KEY_UPARROW

0xad

#define KEY_DOWNARROW

0xaf

#define KEY_ESCAPE

27

#define KEY_ENTER

13

#define KEY_TAB

9

#define KEY_F1

(0x80+0x3b)

#define KEY_F2

(0x80+0x3c)

#define KEY_F3

(0x80+0x3d)

#define KEY_F4

(0x80+0x3e)

#define KEY_F5

(0x80+0x3f)

#define KEY_F6

(0x80+0x40)

#define KEY_F7

(0x80+0x41)

#define KEY_F8

(0x80+0x42)

#define KEY_F9

(0x80+0x43)

#define KEY_F10

(0x80+0x44)

#define KEY_F11

(0x80+0x57)

#define KEY_F12

(0x80+0x58)

#define KEY_BACKSPACE

127

#define KEY_PAUSE

0xff

#define KEY_EQUALS

0x3d

#define KEY_MINUS

0x2d

#define KEY_RSHIFT

(0x80+0x36)

#define KEY_RCTRL

(0x80+0x1d)

#define KEY_RALT

(0x80+0x38)

#define KEY_LALT

KEY_RALT

//DOOM basic types (boolean),

//and max/min values. //#include "doomtype.h"

//Fixed point.

//#include "m_fixed.h"

//Endianess handling. //#include "m_swap.h"

//Binary Angles, sine/cosine/atan lookups. //#include "tables.h"

//Event type.

//#include "d_event.h"

//Game function, skills. //#include "g_game.h"

//All external data is defined here. //#include "doomdata.h"

//All important printed strings.

//Language selection (message strings). //#include "dstrings.h"

//Player is a special actor.

//struct player_s;

12

//#include "d_items.h" //#include "d_player.h" //#include "p_mobj.h" //#include "d_net.h"

// PLAY

//#include "p_tick.h"

//Header, generated by sound utility.

//The utility was written by Dave Taylor. //#include "sounds.h"

#endif

// __DOOMDEF__

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

 

//

 

// $Log:$

 

//

 

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

 

1.4 doomstat.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:

//Put all global tate variables here.

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

static const char

rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";

#ifdef __GNUG__

#pragma implementation "doomstat.h" #endif

#include "doomstat.h"

// Game Mode - identify IWAD as shareware, retail etc. GameMode_t gamemode = indetermined;

GameMission_t gamemission = doom;

13

// Language.

Language_t language = english;

// Set if homebrew PWAD stuff has been added. boolean modifiedgame;

1.5 doomstat.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:

//All the global variables that store the internal state.

//Theoretically speaking, the internal state of the engine

//should be found by looking at the variables collected

//here, and every relevant module will have to include

//this header file.

//In practice, things are a bit messy.

//

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

#ifndef __D_STATE__ #define __D_STATE__

//We need globally shared data structures,

//for defining the global state variables. #include "doomdata.h"

#include "d_net.h"

//We need the playr data structure as well. #include "d_player.h"

#ifdef __GNUG__ #pragma interface #endif

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

 

 

 

// Command line parameters.

 

//

 

 

 

extern

boolean

nomonsters;

// checkparm of -nomonsters

extern

boolean

respawnparm;

// checkparm of -respawn

extern

boolean

fastparm;

// checkparm of -fast

14

startskill;
startepisode;
startmap;

extern

boolean

devparm;

// DEBUG: launched with -devparm

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

 

 

 

// Game

Mode - identify IWAD as shareware, retail etc.

//

 

 

 

extern

GameMode_t

gamemode;

 

extern

GameMission_t

gamemission;

// Set

if homebrew PWAD stuff has been added.

extern

boolean

modifiedgame;

 

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

 

 

 

// Language.

 

 

extern

Language_t

language;

 

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

//Selected skill type, map etc.

//Defaults for menu, methinks.

extern skill_t extern int extern int

extern

boolean

autostart;

// Selected

by user.

 

extern

skill_t

gameskill;

extern

int

 

gameepisode;

extern

int

 

gamemap;

// Nightmare mode flag, single player.

extern

boolean

respawnmonsters;

// Netgame?

Only true if >1 player.

extern

boolean

netgame;

//Flag: true only if started as net deathmatch.

//An enum might handle altdeath/cooperative better.

extern boolean

deathmatch;

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

 

//Internal parameters for sound rendering.

//These have been taken from the DOS version,

//but are not (yet) supported with Linux

//(e.g. no sound volume adjustment with menu.

//These are not used, but should be (menu).

//From m_menu.c:

//Sound FX volume has default, 0 - 15

//Music volume has default, 0 - 15

//These are multiplied by 8.

extern

int

snd_SfxVolume;

//

maximum

volume

for

sound

extern

int

snd_MusicVolume;

//

maximum

volume

for

music

//Current music/sfx card - index useless

//w/o a reference LUT in a sound module.

//Ideally, this would use indices found

//in: /usr/include/linux/soundcard.h extern int snd_MusicDevice;

15

extern int snd_SfxDevice;

//Config file? Same disclaimer as above. extern int snd_DesiredMusicDevice;

extern int snd_DesiredSfxDevice;

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

//Status flags for refresh.

//

//Depending on view size - no status bar?

//Note that there is no way to disable the

//status bar explicitely.

extern boolean statusbaractive;

extern

boolean automapactive;

// In AutoMap mode?

extern

boolean

menuactive;

// Menu overlayed?

extern

boolean

paused;

 

// Game Pause?

extern

boolean

 

viewactive;

 

extern

boolean

 

nodrawers;

 

extern

boolean

 

noblit;

 

extern

int

viewwindowx;

extern

int

viewwindowy;

extern

int

viewheight;

extern

int

viewwidth;

extern

int

scaledviewwidth;

//This one is related to the 3-screen display mode.

//ANG90 = left side, ANG270 = right

extern int viewangleoffset;

// Player taking events, and displaying.

extern

int

consoleplayer;

extern

int

displayplayer;

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

//Scores, rating.

//Statistics on a given map, for intermission.

extern

int

 

totalkills;

 

extern

 

int

totalitems;

 

extern

 

int

totalsecret;

 

// Timer, for scores.

 

extern

int

 

levelstarttic;

// gametic at level start

extern

int

 

leveltime;

// tics in game play for par

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

//DEMO playback/recording related stuff.

//No demo, there is a human player in charge?

//Disable save/end game?

extern boolean

usergame;

16

//?

 

 

extern

boolean

demoplayback;

extern

boolean

demorecording;

// Quit

after playing a demo from cmdline.

extern

boolean

singledemo;

//?

 

extern gamestate_t

gamestate;

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

//Internal parameters, fixed.

//These are set by the engine, and not changed

//according to user inputs. Partly load from

//WAD, partly set at startup time.

extern

int

gametic;

// Bookkeeping on players - state.

extern

player_t

players[MAXPLAYERS];

// Alive? Disconnected?

 

extern

boolean

playeringame[MAXPLAYERS];

// Player spawn spots for deathmatch.

#define

MAX_DM_STARTS

10

extern

mapthing_t

deathmatchstarts[MAX_DM_STARTS];

extern

mapthing_t*

deathmatch_p;

// Player spawn spots.

 

extern

mapthing_t

playerstarts[MAXPLAYERS];

//Intermission stats.

//Parameters for world map / intermission.

extern wbstartstruct_t

wminfo;

//LUT of ammunition limits for each kind.

//This doubles with BackPack powerup item.

extern int

maxammo[NUMAMMO];

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

//Internal parameters, used for engine.

//File handling stuff.

extern

char

basedefault[1024];

extern

FILE*

debugfile;

17

// if true, load all graphics at level load

extern boolean precache;

//wipegamestate can be set to -1

//to force a wipe on the next draw

extern

gamestate_t

wipegamestate;

extern

int

mouseSensitivity;

//?

 

 

// debug flag to cancel

adaptiveness

extern

boolean

singletics;

extern

int

bodyqueslot;

//Needed to store the number of the dummy sky flat.

//Used for rendering,

//as well as tracking projectiles etc.

extern int

skyflatnum;

//Netgame stuff (buffers and pointers, i.e. indices).

//This is ???

extern

doomcom_t*

doomcom;

// This

points inside doomcom.

extern

doomdata_t*

netbuffer;

extern

ticcmd_t

localcmds[BACKUPTICS];

extern

int

rndindex;

extern

int

maketic;

extern

int

nettics[MAXNETNODES];

extern

ticcmd_t

netcmds[MAXPLAYERS][BACKUPTICS];

extern

int

ticdup;

#endif

 

 

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

 

 

//

 

 

// $Log:$

//

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

1.6 doomtype.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.

//

18

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

//Simple basic typedefs, isolated here to make it easier

//separating modules.

//

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

#ifndef __DOOMTYPE__ #define __DOOMTYPE__

#ifndef __BYTEBOOL__ #define __BYTEBOOL__

//Fixed to use builtin bool type with C++. #ifdef __cplusplus

typedef bool boolean; #else

typedef enum {false, true} boolean; #endif

typedef unsigned char byte; #endif

//Predefined with some OS.

#ifdef LINUX

 

#include <values.h>

 

#else

 

#define MAXCHAR

((char)0x7f)

#define MAXSHORT

((short)0x7fff)

// Max pos 32-bit int.

 

#define MAXINT

((int)0x7fffffff)

#define MAXLONG

((long)0x7fffffff)

#define MINCHAR

((char)0x80)

#define MINSHORT

((short)0x8000)

// Max negative 32-bit integer.

#define MININT

((int)0x80000000)

#define MINLONG

((long)0x80000000)

#endif

 

#endif //-----------------------------------------------------------------------------

//

// $Log:$

//

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

1.7dstrings.c

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

//

//$Id:$

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

19

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

//Globally defined strings.

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

static const char

rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";

#ifdef __GNUG__

#pragma implementation "dstrings.h" #endif

#include "dstrings.h"

char* endmsg[NUM_QUITMESSAGES+1]=

{

//DOOM1

QUITMSG,

"please don’t leave, there’s more\ndemons to toast!", "let’s beat it -- this is turning\ninto a bloodbath!", "i wouldn’t leave if i were you.\ndos is much worse.",

"you’re trying to say you like dos\nbetter than me, right?", "don’t leave yet -- there’s a\ndemon around that corner!", "ya know, next time you come in here\ni’m gonna toast ya.", "go ahead and leave. see if i care."

//QuitDOOM II messages

"you want to quit?\nthen, thou hast lost an eighth!",

"don’t go now, there’s a \ndimensional shambler waiting\nat the dos prompt!", "get outta here and go back\nto your boring programs.",

"if i were your boss, i’d \n deathmatch ya in a minute!", "look, bud. you leave now\nand you forfeit your body count!", "just leave. when you come\nback, i’ll be waiting with a bat.", "you’re lucky i don’t smack\nyou for thinking about leaving."

// FinalDOOM?

"fuck you, pussy!\nget the fuck out!",

"you quit and i’ll jizz\nin your cystholes!",

"if you leave, i’ll make\nthe lord drink my jizz.", "hey, ron! can we say\n’fuck’ in the game?",

"i’d leave: this is just\nmore monsters and levels.\nwhat a load.", "suck it down, asshole!\nyou’re a fucking wimp!",

"don’t quit now! we’re \nstill spending your money!",

// Internal debug. Different style, too.

"THIS IS NO MESSAGE!\nPage intentionally left blank."

};

20

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