First commit. Does not even compile, very much a WiP

This commit is contained in:
Jeroen Domburg
2016-08-30 19:41:05 +08:00
commit 2038455139
168 changed files with 83669 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
build/
sdkconfig.old

9
Makefile Normal file
View File

@@ -0,0 +1,9 @@
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := esp32-doom
include $(IDF_PATH)/make/project.mk

View File

@@ -0,0 +1,11 @@
#
# Component Makefile
#
# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default,
# this will take the sources in the src/ directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
include $(IDF_PATH)/make/component.mk

View File

@@ -0,0 +1,87 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Joystick handling for Linux
*
*-----------------------------------------------------------------------------
*/
#ifndef lint
#endif /* lint */
#include <stdlib.h>
#include "doomdef.h"
#include "doomtype.h"
#include "m_argv.h"
#include "d_event.h"
#include "d_main.h"
#include "i_joy.h"
#include "lprintf.h"
int joyleft;
int joyright;
int joyup;
int joydown;
int usejoystick;
static void I_EndJoystick(void)
{
lprintf(LO_DEBUG, "I_EndJoystick : closing joystick\n");
}
void I_PollJoystick(void)
{
#if 0
event_t ev;
Sint16 axis_value;
if (!usejoystick || (!joystick)) return;
ev.type = ev_joystick;
ev.data1 =
(SDL_JoystickGetButton(joystick, 0)<<0) |
(SDL_JoystickGetButton(joystick, 1)<<1) |
(SDL_JoystickGetButton(joystick, 2)<<2) |
(SDL_JoystickGetButton(joystick, 3)<<3);
axis_value = SDL_JoystickGetAxis(joystick, 0) / 3000;
if (abs(axis_value)<10) axis_value=0;
ev.data2 = axis_value;
axis_value = SDL_JoystickGetAxis(joystick, 1) / 3000;
if (abs(axis_value)<10) axis_value=0;
ev.data3 = axis_value;
D_PostEvent(&ev);
#endif
}
void I_InitJoystick(void)
{
}

View File

@@ -0,0 +1,248 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Startup and quit functions. Handles signals, inits the
* memory management, then calls D_DoomMain. Also contains
* I_Init which does other system-related startup stuff.
*
*-----------------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "doomdef.h"
#include "m_argv.h"
#include "d_main.h"
#include "m_fixed.h"
#include "i_system.h"
#include "i_video.h"
#include "z_zone.h"
#include "lprintf.h"
#include "m_random.h"
#include "doomstat.h"
#include "g_game.h"
#include "m_misc.h"
#include "i_sound.h"
#include "i_main.h"
#include "r_fps.h"
#include "lprintf.h"
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
/* Most of the following has been rewritten by Lee Killough
*
* I_GetTime
* killough 4/13/98: Make clock rate adjustable by scale factor
* cphipps - much made static
*/
int realtic_clock_rate = 100;
static int_64_t I_GetTime_Scale = 1<<24;
static int I_GetTime_Scaled(void)
{
return (int)( (int_64_t) I_GetTime_RealTime() * I_GetTime_Scale >> 24);
}
static int I_GetTime_FastDemo(void)
{
static int fasttic;
return fasttic++;
}
static int I_GetTime_Error(void)
{
I_Error("I_GetTime_Error: GetTime() used before initialization");
return 0;
}
int (*I_GetTime)(void) = I_GetTime_Error;
void I_Init(void)
{
/* killough 4/14/98: Adjustable speedup based on realtic_clock_rate */
if (fastdemo)
I_GetTime = I_GetTime_FastDemo;
else
if (realtic_clock_rate != 100)
{
I_GetTime_Scale = ((int_64_t) realtic_clock_rate << 24) / 100;
I_GetTime = I_GetTime_Scaled;
}
else
I_GetTime = I_GetTime_RealTime;
{
/* killough 2/21/98: avoid sound initialization if no sound & no music */
if (!(nomusicparm && nosfxparm))
I_InitSound();
}
R_InitInterpolation();
}
/* killough 2/22/98: Add support for ENDBOOM, which is PC-specific
*
* this converts BIOS color codes to ANSI codes.
* Its not pretty, but it does the job - rain
* CPhipps - made static
*/
inline static int convert(int color, int *bold)
{
if (color > 7) {
color -= 8;
*bold = 1;
}
switch (color) {
case 0:
return 0;
case 1:
return 4;
case 2:
return 2;
case 3:
return 6;
case 4:
return 1;
case 5:
return 5;
case 6:
return 3;
case 7:
return 7;
}
return 0;
}
/* CPhipps - flags controlling ENDOOM behaviour */
enum {
endoom_colours = 1,
endoom_nonasciichars = 2,
endoom_droplastline = 4
};
unsigned int endoom_mode;
static void PrintVer(void)
{
char vbuf[200];
lprintf(LO_INFO,"%s\n",I_GetVersionString(vbuf,200));
}
static int has_exited;
/* I_SafeExit
* This function is called instead of exit() by functions that might be called
* during the exit process (i.e. after exit() has already been called)
* Prevent infinitely recursive exits -- killough
*/
void I_SafeExit(int rc)
{
if (!has_exited) /* If it hasn't exited yet, exit now -- killough */
{
has_exited=rc ? 2 : 1;
exit(rc);
}
}
#ifdef SECURE_UID
uid_t stored_euid = -1;
#endif
//int main(int argc, const char * const * argv)
int doom_main(int argc, char const * const *argv)
{
#ifdef SECURE_UID
/* First thing, revoke setuid status (if any) */
stored_euid = geteuid();
if (getuid() != stored_euid)
if (seteuid(getuid()) < 0)
fprintf(stderr, "Failed to revoke setuid\n");
else
fprintf(stderr, "Revoked uid %d\n",stored_euid);
#endif
myargc = argc;
myargv = argv;
#ifdef _WIN32
if (!M_CheckParm("-nodraw")) {
/* initialize the console window */
Init_ConsoleWin();
atexit(Done_ConsoleWin);
}
#endif
/* Version info */
lprintf(LO_INFO,"\n");
PrintVer();
/* cph - Z_Close must be done after I_Quit, so we register it first. */
atexit(Z_Close);
/*
killough 1/98:
This fixes some problems with exit handling
during abnormal situations.
The old code called I_Quit() to end program,
while now I_Quit() is installed as an exit
handler and exit() is called to exit, either
normally or abnormally. Seg faults are caught
and the error handler is used, to prevent
being left in graphics mode or having very
loud SFX noise because the sound card is
left in an unstable state.
*/
Z_Init(); /* 1/18/98 killough: start up memory stuff first */
I_SetAffinityMask();
/* cphipps - call to video specific startup code */
I_PreInitGraphics();
D_DoomMain ();
return 0;
}

View File

@@ -0,0 +1,137 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Low level UDP network interface. This is shared between the server
* and client, with SERVER defined for the former to select some extra
* functions. Handles socket creation, and packet send and receive.
*
*-----------------------------------------------------------------------------*/
# include "config.h"
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#include <stdlib.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#ifdef HAVE_NET
#include "protocol.h"
#include "i_network.h"
#include "lprintf.h"
void I_ShutdownNetwork(void)
{
}
void I_InitNetwork(void)
{
}
UDP_PACKET *I_AllocPacket(int size)
{
}
void I_FreePacket(UDP_PACKET *packet)
{
}
void I_WaitForPacket(int ms)
{
}
int I_ConnectToServer(const char *serv)
{
return 0;
}
void I_Disconnect(void)
{
}
UDP_SOCKET I_Socket(Uint16 port)
{
}
void I_CloseSocket(UDP_SOCKET sock)
{
}
UDP_CHANNEL I_RegisterPlayer(IPaddress *ipaddr)
{
}
void I_UnRegisterPlayer(UDP_CHANNEL channel)
{
}
/*
* ChecksumPacket
*
* Returns the checksum of a given network packet
*/
static byte ChecksumPacket(const packet_header_t* buffer, size_t len)
{
const byte* p = (const void*)buffer;
byte sum = 0;
if (len==0)
return 0;
while (p++, --len)
sum += *p;
return sum;
}
size_t I_GetPacket(packet_header_t* buffer, size_t buflen)
{
return 0;
}
void I_SendPacket(packet_header_t* packet, size_t len)
{
}
void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to)
{
}
void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr)
{
}
#endif /* HAVE_NET */

View File

@@ -0,0 +1,157 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* System interface for sound.
*
*-----------------------------------------------------------------------------
*/
#include "config.h"
#include <math.h>
#include <unistd.h>
#include "z_zone.h"
#include "m_swap.h"
#include "i_sound.h"
#include "m_argv.h"
#include "m_misc.h"
#include "w_wad.h"
#include "lprintf.h"
#include "s_sound.h"
#include "doomdef.h"
#include "doomstat.h"
#include "doomtype.h"
#include "d_main.h"
int snd_card = 0;
int mus_card = 0;
int snd_samplerate = 0;
void I_UpdateSoundParams(int handle, int volume, int seperation, int pitch)
{
}
void I_SetChannels(void)
{
}
int I_GetSfxLumpNum(sfxinfo_t* sfx)
{
return 1;
}
int I_StartSound(int id, int channel, int vol, int sep, int pitch, int priority)
{
return channel;
}
void I_StopSound (int handle)
{
}
int I_SoundIsPlaying(int handle)
{
return 0;
}
int I_AnySoundStillPlaying(void)
{
return false;
}
void I_ShutdownSound(void)
{
}
//static SDL_AudioSpec audio;
void I_InitSound(void)
{
}
void I_ShutdownMusic(void)
{
}
void I_InitMusic(void)
{
}
void I_PlaySong(int handle, int looping)
{
}
extern int mus_pause_opt; // From m_misc.c
void I_PauseSong (int handle)
{
}
void I_ResumeSong (int handle)
{
}
void I_StopSong(int handle)
{
}
void I_UnRegisterSong(int handle)
{
}
int I_RegisterSong(const void *data, size_t len)
{
return (0);
}
int I_RegisterMusic( const char* filename, musicinfo_t *song )
{
return 1;
}
void I_SetMusicVolume(int volume)
{
}

View File

@@ -0,0 +1,150 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Misc system stuff needed by Doom, implemented for Linux.
* Mainly timer handling, and ENDOOM/ENDBOOM.
*
*-----------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include <signal.h>
#ifdef _MSC_VER
#define F_OK 0 /* Check for file existence */
#define W_OK 2 /* Check for write permission */
#define R_OK 4 /* Check for read permission */
#include <io.h>
#include <direct.h>
#else
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "config.h"
#include <unistd.h>
#include <sched.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include "m_argv.h"
#include "lprintf.h"
#include "doomtype.h"
#include "doomdef.h"
#include "lprintf.h"
#include "m_fixed.h"
#include "r_fps.h"
#include "i_system.h"
#ifdef __GNUG__
#pragma implementation "i_system.h"
#endif
#include "i_system.h"
int I_StartDisplay(void)
{
return true;
}
void I_EndDisplay(void)
{
}
void I_uSleep(unsigned long usecs)
{
}
int I_GetTime_RealTime (void)
{
return 1;
}
fixed_t I_GetTimeFrac (void)
{
return 1;
}
void I_GetTime_SaveMS(void)
{
}
unsigned long I_GetRandomTimeSeed(void)
{
return 4;
}
const char* I_GetVersionString(char* buf, size_t sz)
{
sprintf(buf,"%s v%s (http://prboom.sourceforge.net/)",PACKAGE,VERSION);
return buf;
}
const char* I_SigString(char* buf, size_t sz, int signum)
{
return buf;
}
void I_Read(int fd, void* vbuf, size_t sz)
{
}
int I_Filelength(int handle)
{
return 0;
}
const char *I_DoomExeDir(void)
{
return "";
}
char* I_FindFile(const char* wfname, const char* ext)
{
char *p;
p = malloc(strlen(wfname)+4);
sprintf(p, "%s.%s", wfname, ext);
return NULL;
}
void I_SetAffinityMask(void)
{
}

View File

@@ -0,0 +1,249 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2006 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* DOOM graphics stuff for SDL
*
*-----------------------------------------------------------------------------
*/
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include "m_argv.h"
#include "doomstat.h"
#include "doomdef.h"
#include "doomtype.h"
#include "v_video.h"
#include "r_draw.h"
#include "d_main.h"
#include "d_event.h"
#include "i_joy.h"
#include "i_video.h"
#include "z_zone.h"
#include "s_sound.h"
#include "sounds.h"
#include "w_wad.h"
#include "st_stuff.h"
#include "lprintf.h"
int use_fullscreen=0;
int use_doublebuffer=0;
void I_StartTic (void)
{
}
void I_StartFrame (void)
{
}
static void I_InitInputs(void)
{
}
static void I_UploadNewPalette(int pal)
{
#if 0
// This is used to replace the current 256 colour cmap with a new one
// Used by 256 colour PseudoColor modes
// Array of SDL_Color structs used for setting the 256-colour palette
static SDL_Color* colours;
static int cachedgamma;
static size_t num_pals;
if (V_GetMode() == VID_MODEGL)
return;
if ((colours == NULL) || (cachedgamma != usegamma)) {
int pplump = W_GetNumForName("PLAYPAL");
int gtlump = (W_CheckNumForName)("GAMMATBL",ns_prboom);
register const byte * palette = W_CacheLumpNum(pplump);
register const byte * const gtable = (const byte *)W_CacheLumpNum(gtlump) + 256*(cachedgamma = usegamma);
register int i;
num_pals = W_LumpLength(pplump) / (3*256);
num_pals *= 256;
if (!colours) {
// First call - allocate and prepare colour array
colours = malloc(sizeof(*colours)*num_pals);
}
// set the colormap entries
for (i=0 ; (size_t)i<num_pals ; i++) {
colours[i].r = gtable[palette[0]];
colours[i].g = gtable[palette[1]];
colours[i].b = gtable[palette[2]];
palette += 3;
}
W_UnlockLumpNum(pplump);
W_UnlockLumpNum(gtlump);
num_pals/=256;
}
#endif
}
//////////////////////////////////////////////////////////////////////////////
// Graphics API
void I_ShutdownGraphics(void)
{
}
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
}
//
// I_FinishUpdate
//
static int newpal = 0;
void I_FinishUpdate (void)
{
#if 0
if (SDL_MUSTLOCK(screen)) {
int h;
byte *src;
byte *dest;
if (SDL_LockSurface(screen) < 0) {
lprintf(LO_INFO,"I_FinishUpdate: %s\n", SDL_GetError());
return;
}
dest=screen->pixels;
src=screens[0].data;
h=screen->h;
for (; h>0; h--)
{
memcpy(dest,src,SCREENWIDTH*V_GetPixelDepth());
dest+=screen->pitch;
src+=screens[0].byte_pitch;
}
SDL_UnlockSurface(screen);
}
/* Update the display buffer (flipping video pages if supported)
* If we need to change palette, that implicitely does a flip */
if (newpal != NO_PALETTE_CHANGE) {
I_UploadNewPalette(newpal);
newpal = NO_PALETTE_CHANGE;
}
SDL_Flip(screen);
#endif
}
void I_SetPalette (int pal)
{
newpal = pal;
}
void I_PreInitGraphics(void)
{
}
// CPhipps -
// I_SetRes
// Sets the screen resolution
void I_SetRes(void)
{
int i;
I_CalculateRes(SCREENWIDTH, SCREENHEIGHT);
// set first three to standard values
for (i=0; i<3; i++) {
screens[i].width = SCREENWIDTH;
screens[i].height = SCREENHEIGHT;
screens[i].byte_pitch = SCREENPITCH;
screens[i].short_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE16);
screens[i].int_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE32);
}
// statusbar
screens[4].width = SCREENWIDTH;
screens[4].height = (ST_SCALED_HEIGHT+1);
screens[4].byte_pitch = SCREENPITCH;
screens[4].short_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE16);
screens[4].int_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE32);
lprintf(LO_INFO,"I_SetRes: Using resolution %dx%d\n", SCREENWIDTH, SCREENHEIGHT);
}
void I_InitGraphics(void)
{
char titlebuffer[2048];
static int firsttime=1;
if (firsttime)
{
firsttime = 0;
atexit(I_ShutdownGraphics);
lprintf(LO_INFO, "I_InitGraphics: %dx%d\n", SCREENWIDTH, SCREENHEIGHT);
/* Set the video mode */
I_UpdateVideoMode();
/* Initialize the input system */
I_InitInputs();
}
}
void I_UpdateVideoMode(void)
{
int init_flags;
int i;
video_mode_t mode;
lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen");
mode = VID_MODE16;
// mode = VID_MODE8;
V_InitMode(mode);
V_DestroyUnusedTrueColorPalettes();
V_FreeScreens();
I_SetRes();
V_AllocScreens();
R_InitBuffer(SCREENWIDTH, SCREENHEIGHT);
}

View File

@@ -0,0 +1,14 @@
#
# Component Makefile
#
# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default,
# this will take the sources in the src/ directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
include $(IDF_PATH)/make/component.mk
CFLAGS += -Wno-error=char-subscripts -Wno-error=unused-value -Wno-error=parentheses -Wno-error=int-to-pointer-cast -Wno-pointer-sign \
-Wno-unused-but-set-variable -Wno-maybe-uninitialized

1585
components/prboom/am_map.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,539 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Network client. Passes information to/from server, staying
* synchronised.
* Contains the main wait loop, waiting for network input or
* time before doing the next tic.
* Rewritten for LxDoom, but based around bits of the old code.
*
*-----------------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef USE_SDL_NET
#include "SDL.h"
#endif
#include "doomtype.h"
#include "doomstat.h"
#include "d_net.h"
#include "z_zone.h"
#include "d_main.h"
#include "g_game.h"
#include "m_menu.h"
#include "p_checksum.h"
#include "protocol.h"
#include "i_network.h"
#include "i_system.h"
#include "i_main.h"
#include "i_video.h"
#include "m_argv.h"
#include "r_fps.h"
#include "lprintf.h"
static boolean server;
static int remotetic; // Tic expected from the remote
static int remotesend; // Tic expected by the remote
ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
static ticcmd_t* localcmds;
static unsigned numqueuedpackets;
static packet_header_t** queuedpacket;
int maketic;
int ticdup = 1;
static int xtratics = 0;
int wanted_player_number;
static boolean isExtraDDisplay = false;
static void D_QuitNetGame (void);
#ifndef HAVE_NET
doomcom_t* doomcom;
#endif
#ifdef HAVE_NET
void D_InitNetGame (void)
{
int i;
int numplayers = 1;
i = M_CheckParm("-net");
if (i && i < myargc-1) i++;
if (!(netgame = server = !!i)) {
playeringame[consoleplayer = 0] = true;
// e6y
// for play, recording or playback using "single-player coop" mode.
// Equivalent to using prboom_server with -N 1
netgame = M_CheckParm("-solo-net");
} else {
// Get game info from server
packet_header_t *packet = Z_Malloc(1000, PU_STATIC, NULL);
struct setup_packet_s *sinfo = (void*)(packet+1);
struct { packet_header_t head; short pn; } PACKEDATTR initpacket;
I_InitNetwork();
udp_socket = I_Socket(0);
I_ConnectToServer(myargv[i]);
do
{
do {
// Send init packet
initpacket.pn = doom_htons(wanted_player_number);
packet_set(&initpacket.head, PKT_INIT, 0);
I_SendPacket(&initpacket.head, sizeof(initpacket));
I_WaitForPacket(5000);
} while (!I_GetPacket(packet, 1000));
if (packet->type == PKT_DOWN) I_Error("Server aborted the game");
} while (packet->type != PKT_SETUP);
// Once we have been accepted by the server, we should tell it when we leave
atexit(D_QuitNetGame);
// Get info from the setup packet
consoleplayer = sinfo->yourplayer;
compatibility_level = sinfo->complevel;
G_Compatibility();
startskill = sinfo->skill;
deathmatch = sinfo->deathmatch;
startmap = sinfo->level;
startepisode = sinfo->episode;
ticdup = sinfo->ticdup;
xtratics = sinfo->extratic;
G_ReadOptions(sinfo->game_options);
lprintf(LO_INFO, "\tjoined game as player %d/%d; %d WADs specified\n",
consoleplayer+1, numplayers = sinfo->players, sinfo->numwads);
{
char *p = sinfo->wadnames;
int i = sinfo->numwads;
while (i--) {
D_AddFile(p, source_net);
p += strlen(p) + 1;
}
}
Z_Free(packet);
}
localcmds = netcmds[displayplayer = consoleplayer];
for (i=0; i<numplayers; i++)
playeringame[i] = true;
for (; i<MAXPLAYERS; i++)
playeringame[i] = false;
if (!playeringame[consoleplayer]) I_Error("D_InitNetGame: consoleplayer not in game");
}
#else
void D_InitNetGame (void)
{
int i;
doomcom = Z_Malloc(sizeof *doomcom, PU_STATIC, NULL);
doomcom->consoleplayer = 0;
doomcom->numnodes = 0; doomcom->numplayers = 1;
localcmds = netcmds[consoleplayer];
netgame = (M_CheckParm("-solo-net") != 0);
for (i=0; i<doomcom->numplayers; i++)
playeringame[i] = true;
for (; i<MAXPLAYERS; i++)
playeringame[i] = false;
consoleplayer = displayplayer = doomcom->consoleplayer;
}
#endif // HAVE_NET
#ifdef HAVE_NET
void D_CheckNetGame(void)
{
packet_header_t *packet = Z_Malloc(sizeof(packet_header_t)+1, PU_STATIC, NULL);
if (server) {
lprintf(LO_INFO, "D_CheckNetGame: waiting for server to signal game start\n");
do {
while (!I_GetPacket(packet, sizeof(packet_header_t)+1)) {
packet_set(packet, PKT_GO, 0);
*(byte*)(packet+1) = consoleplayer;
I_SendPacket(packet, sizeof(packet_header_t)+1);
I_uSleep(100000);
}
} while (packet->type != PKT_GO);
}
Z_Free(packet);
}
boolean D_NetGetWad(const char* name)
{
#if defined(HAVE_WAIT_H)
size_t psize = sizeof(packet_header_t) + strlen(name) + 500;
packet_header_t *packet;
boolean done = false;
if (!server || strchr(name, '/')) return false; // If it contains path info, reject
do {
// Send WAD request to remote
packet = Z_Malloc(psize, PU_STATIC, NULL);
packet_set(packet, PKT_WAD, 0);
*(byte*)(packet+1) = consoleplayer;
strcpy(1+(byte*)(packet+1), name);
I_SendPacket(packet, sizeof(packet_header_t) + strlen(name) + 2);
I_uSleep(10000);
} while (!I_GetPacket(packet, psize) || (packet->type != PKT_WAD));
Z_Free(packet);
if (!strcasecmp((void*)(packet+1), name)) {
pid_t pid;
int rv;
byte *p = (byte*)(packet+1) + strlen(name) + 1;
/* Automatic wad file retrieval using wget (supports http and ftp, using URLs)
* Unix systems have all these commands handy, this kind of thing is easy
* Any windo$e port will have some awkward work replacing these.
*/
/* cph - caution here. This is data from an untrusted source.
* Don't pass it via a shell. */
if ((pid = fork()) == -1)
perror("fork");
else if (!pid) {
/* Child chains to wget, does the download */
execlp("wget", "wget", p, NULL);
}
/* This is the parent, i.e. main LxDoom process */
wait(&rv);
if (!(done = !access(name, R_OK))) {
if (!strcmp(p+strlen(p)-4, ".zip")) {
p = strrchr(p, '/')+1;
if ((pid = fork()) == -1)
perror("fork");
else if (!pid) {
/* Child executes decompressor */
execlp("unzip", "unzip", p, name, NULL);
}
/* Parent waits for the file */
wait(&rv);
done = !!access(name, R_OK);
}
/* Add more decompression protocols here as desired */
}
Z_Free(buffer);
}
return done;
#else /* HAVE_WAIT_H */
return false;
#endif
}
void NetUpdate(void)
{
static int lastmadetic;
if (isExtraDDisplay)
return;
if (server) { // Receive network packets
size_t recvlen;
packet_header_t *packet = Z_Malloc(10000, PU_STATIC, NULL);
while ((recvlen = I_GetPacket(packet, 10000))) {
switch(packet->type) {
case PKT_TICS:
{
byte *p = (void*)(packet+1);
int tics = *p++;
unsigned long ptic = doom_ntohl(packet->tic);
if (ptic > (unsigned)remotetic) { // Missed some
packet_set(packet, PKT_RETRANS, remotetic);
*(byte*)(packet+1) = consoleplayer;
I_SendPacket(packet, sizeof(*packet)+1);
} else {
if (ptic + tics <= (unsigned)remotetic) break; // Will not improve things
remotetic = ptic;
while (tics--) {
int players = *p++;
while (players--) {
int n = *p++;
RawToTic(&netcmds[n][remotetic%BACKUPTICS], p);
p += sizeof(ticcmd_t);
}
remotetic++;
}
}
}
break;
case PKT_RETRANS: // Resend request
remotesend = doom_ntohl(packet->tic);
break;
case PKT_DOWN: // Server downed
{
int j;
for (j=0; j<MAXPLAYERS; j++)
if (j != consoleplayer) playeringame[j] = false;
server = false;
doom_printf("Server is down\nAll other players are no longer in the game\n");
}
break;
case PKT_EXTRA: // Misc stuff
case PKT_QUIT: // Player quit
// Queue packet to be processed when its tic time is reached
queuedpacket = Z_Realloc(queuedpacket, ++numqueuedpackets * sizeof *queuedpacket,
PU_STATIC, NULL);
queuedpacket[numqueuedpackets-1] = Z_Malloc(recvlen, PU_STATIC, NULL);
memcpy(queuedpacket[numqueuedpackets-1], packet, recvlen);
break;
case PKT_BACKOFF:
/* cph 2003-09-18 -
* The server sends this when we have got ahead of the other clients. We should
* stall the input side on this client, to allow other clients to catch up.
*/
lastmadetic++;
break;
default: // Other packet, unrecognised or redundant
break;
}
}
Z_Free(packet);
}
{ // Build new ticcmds
int newtics = I_GetTime() - lastmadetic;
newtics = (newtics > 0 ? newtics : 0);
lastmadetic += newtics;
if (ffmap) newtics++;
while (newtics--) {
I_StartTic();
if (maketic - gametic > BACKUPTICS/2) break;
G_BuildTiccmd(&localcmds[maketic%BACKUPTICS]);
maketic++;
}
if (server && maketic > remotesend) { // Send the tics to the server
int sendtics;
remotesend -= xtratics;
if (remotesend < 0) remotesend = 0;
sendtics = maketic - remotesend;
{
size_t pkt_size = sizeof(packet_header_t) + 2 + sendtics * sizeof(ticcmd_t);
packet_header_t *packet = Z_Malloc(pkt_size, PU_STATIC, NULL);
packet_set(packet, PKT_TICC, maketic - sendtics);
*(byte*)(packet+1) = sendtics;
*(((byte*)(packet+1))+1) = consoleplayer;
{
void *tic = ((byte*)(packet+1)) +2;
while (sendtics--) {
TicToRaw(tic, &localcmds[remotesend++%BACKUPTICS]);
tic = (byte *)tic + sizeof(ticcmd_t);
}
}
I_SendPacket(packet, pkt_size);
Z_Free(packet);
}
}
}
}
#else
void D_BuildNewTiccmds(void)
{
static int lastmadetic;
int newtics = I_GetTime() - lastmadetic;
lastmadetic += newtics;
while (newtics--)
{
I_StartTic();
if (maketic - gametic > BACKUPTICS/2) break;
G_BuildTiccmd(&localcmds[maketic%BACKUPTICS]);
maketic++;
}
}
#endif
#ifdef HAVE_NET
/* cph - data passed to this must be in the Doom (little-) endian */
void D_NetSendMisc(netmisctype_t type, size_t len, void* data)
{
if (server) {
size_t size = sizeof(packet_header_t) + 3*sizeof(int) + len;
packet_header_t *packet = Z_Malloc(size, PU_STATIC, NULL);
int *p = (void*)(packet+1);
packet_set(packet, PKT_EXTRA, gametic);
*p++ = LONG(type); *p++ = LONG(consoleplayer); *p++ = LONG(len);
memcpy(p, data, len);
I_SendPacket(packet, size);
Z_Free(packet);
}
}
static void CheckQueuedPackets(void)
{
int i;
for (i=0; (unsigned)i<numqueuedpackets; i++)
if (doom_ntohl(queuedpacket[i]->tic) <= gametic)
switch (queuedpacket[i]->type) {
case PKT_QUIT: // Player quit the game
{
int pn = *(byte*)(queuedpacket[i]+1);
playeringame[pn] = false;
doom_printf("Player %d left the game\n", pn);
}
break;
case PKT_EXTRA:
{
int *p = (int*)(queuedpacket[i]+1);
size_t len = LONG(*(p+2));
switch (LONG(*p)) {
case nm_plcolour:
G_ChangedPlayerColour(LONG(*(p+1)), LONG(*(p+3)));
break;
case nm_savegamename:
if (len < SAVEDESCLEN) {
memcpy(savedescription, p+3, len);
// Force terminating 0 in case
savedescription[len] = 0;
}
break;
}
}
break;
default: // Should not be queued
break;
}
{ // Requeue remaining packets
int newnum = 0;
packet_header_t **newqueue = NULL;
for (i=0; (unsigned)i<numqueuedpackets; i++)
if (doom_ntohl(queuedpacket[i]->tic) > gametic) {
newqueue = Z_Realloc(newqueue, ++newnum * sizeof *newqueue,
PU_STATIC, NULL);
newqueue[newnum-1] = queuedpacket[i];
} else Z_Free(queuedpacket[i]);
Z_Free(queuedpacket);
numqueuedpackets = newnum; queuedpacket = newqueue;
}
}
#endif // HAVE_NET
void TryRunTics (void)
{
int runtics;
int entertime = I_GetTime();
// Wait for tics to run
while (1) {
#ifdef HAVE_NET
NetUpdate();
#else
D_BuildNewTiccmds();
#endif
runtics = (server ? remotetic : maketic) - gametic;
if (!runtics) {
if (!movement_smooth) {
#ifdef HAVE_NET
if (server)
I_WaitForPacket(ms_to_next_tick);
else
#endif
I_uSleep(ms_to_next_tick*1000);
}
if (I_GetTime() - entertime > 10) {
#ifdef HAVE_NET
if (server) {
char buf[sizeof(packet_header_t)+1];
remotesend--;
packet_set((packet_header_t *)buf, PKT_RETRANS, remotetic);
buf[sizeof(buf)-1] = consoleplayer;
I_SendPacket((packet_header_t *)buf, sizeof buf);
}
#endif
M_Ticker(); return;
}
//if ((displaytime) < (tic_vars.next-SDL_GetTicks()))
{
WasRenderedInTryRunTics = true;
if (V_GetMode() == VID_MODEGL ?
movement_smooth :
movement_smooth && gamestate==wipegamestate)
{
isExtraDDisplay = true;
D_Display();
isExtraDDisplay = false;
}
}
} else break;
}
while (runtics--) {
#ifdef HAVE_NET
if (server) CheckQueuedPackets();
#endif
if (advancedemo)
D_DoAdvanceDemo ();
M_Ticker ();
I_GetTime_SaveMS();
G_Ticker ();
P_Checksum(gametic);
gametic++;
#ifdef HAVE_NET
NetUpdate(); // Keep sending our tics to avoid stalling remote nodes
#endif
}
}
#ifdef HAVE_NET
static void D_QuitNetGame (void)
{
byte buf[1 + sizeof(packet_header_t)];
packet_header_t *packet = (void*)buf;
int i;
if (!server) return;
buf[sizeof(packet_header_t)] = consoleplayer;
packet_set(packet, PKT_QUIT, gametic);
for (i=0; i<4; i++) {
I_SendPacket(packet, 1 + sizeof(packet_header_t));
I_uSleep(10000);
}
}
#endif

3090
components/prboom/d_deh.c Normal file

File diff suppressed because it is too large Load Diff

140
components/prboom/d_items.c Normal file
View File

@@ -0,0 +1,140 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Something to do with weapon sprite frames. Don't ask me.
*
*-----------------------------------------------------------------------------
*/
// We are referring to sprite numbers.
#include "doomtype.h"
#include "info.h"
#ifdef __GNUG__
#pragma implementation "d_items.h"
#endif
#include "d_items.h"
//
// PSPRITE ACTIONS for waepons.
// This struct controls the weapon animations.
//
// Each entry is:
// ammo/amunition type
// upstate
// downstate
// readystate
// atkstate, i.e. attack/fire/hit frame
// flashstate, muzzle flash
//
weaponinfo_t weaponinfo[NUMWEAPONS] =
{
{
// fist
am_noammo,
S_PUNCHUP,
S_PUNCHDOWN,
S_PUNCH,
S_PUNCH1,
S_NULL
},
{
// pistol
am_clip,
S_PISTOLUP,
S_PISTOLDOWN,
S_PISTOL,
S_PISTOL1,
S_PISTOLFLASH
},
{
// shotgun
am_shell,
S_SGUNUP,
S_SGUNDOWN,
S_SGUN,
S_SGUN1,
S_SGUNFLASH1
},
{
// chaingun
am_clip,
S_CHAINUP,
S_CHAINDOWN,
S_CHAIN,
S_CHAIN1,
S_CHAINFLASH1
},
{
// missile launcher
am_misl,
S_MISSILEUP,
S_MISSILEDOWN,
S_MISSILE,
S_MISSILE1,
S_MISSILEFLASH1
},
{
// plasma rifle
am_cell,
S_PLASMAUP,
S_PLASMADOWN,
S_PLASMA,
S_PLASMA1,
S_PLASMAFLASH1
},
{
// bfg 9000
am_cell,
S_BFGUP,
S_BFGDOWN,
S_BFG,
S_BFG1,
S_BFGFLASH1
},
{
// chainsaw
am_noammo,
S_SAWUP,
S_SAWDOWN,
S_SAW,
S_SAW1,
S_NULL
},
{
// super shotgun
am_shell,
S_DSGUNUP,
S_DSGUNDOWN,
S_DSGUN,
S_DSGUN1,
S_DSGUNFLASH1
},
};

1725
components/prboom/d_main.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,754 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2004 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Network game server code
* New for LxDoom, but drawing ideas and code fragments from the
* earlier net code
*-----------------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdarg.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#ifdef USE_SDL_NET
#include "SDL.h"
#endif
#include "doomtype.h"
#include "protocol.h"
#include "i_network.h"
#ifndef PRBOOM_SERVER
#include "m_fixed.h"
#endif
#include "i_system.h"
#include "m_swap.h"
#ifndef HAVE_NET
int main(void)
{
fprintf(stderr,
PACKAGE "-server: You must compile with networking enabled!\n");
// exit(1);
return 1;
}
#else
#ifndef HAVE_GETOPT
/* The following code for getopt is from the libc-source of FreeBSD,
* it might be changed a little bit.
* Florian Schulze (florian.schulze@gmx.net)
*/
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#endif
static const char rcsid[] = "$FreeBSD$";
#endif /* LIBC_SCCS and not lint */
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
char *optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""
char *__progname="prboom_server";
/*
* getopt --
* Parse argc/argv argument vector.
*/
int
getopt(nargc, nargv, ostr)
int nargc;
char * const *nargv;
const char *ostr;
{
extern char *__progname;
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
int ret;
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return (-1);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return (-1);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
!(oli = strchr(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means -1.
*/
if (optopt == (int)'-')
return (-1);
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
"%s: illegal option -- %c\n", __progname, optopt);
return (BADCH);
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else { /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (*ostr == ':')
ret = BADARG;
else
ret = BADCH;
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
__progname, optopt);
return (ret);
}
else /* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return (optopt); /* dump back option letter */
}
#else
#include <unistd.h>
#endif
#define MAXPLAYERS 4
#define BACKUPTICS 12
// Dummies to forfill l_udp.c unused client stuff
int M_CheckParm(const char* p) { p = NULL; return 1; }
int myargc;
char** myargv;
void NORETURN I_Error(const char *error, ...) // killough 3/20/98: add const
{
va_list argptr;
va_start(argptr,error);
vfprintf(stderr,error,argptr);
va_end(argptr);
//exit(-1);
}
int playerjoingame[MAXPLAYERS], playerleftgame[MAXPLAYERS];
UDP_CHANNEL remoteaddr[MAXPLAYERS];
enum { pc_unused, pc_connected, pc_ready, pc_confirmedready, pc_playing, pc_quit } playerstate[MAXPLAYERS];
int displaycounter;
boolean n_players_in_state(int n, int ps) {
int i,j;
for (i=j=0;i<MAXPLAYERS;i++)
if (playerstate[i] == ps) j++;
return (j == n);
}
void BroadcastPacket(packet_header_t *packet, size_t len)
{
int i;
for (i=0; i<MAXPLAYERS; i++)
if (playerstate[i] != pc_unused && playerstate[i] != pc_quit)
I_SendPacketTo(packet, len, &remoteaddr[i]);
}
byte def_game_options[GAME_OPTIONS_SIZE] = \
{ // cf g_game.c:G_WriteOptions()
1, // monsters remember
1, // friction
0, // weapon recoil
1, // pushers
0, // reserved/unused
1, // player bobbing
0, 0, 0, // respawn, fast, nomonsters
1, // demo insurance
0, 0, 0, 0, // 4 bytes of random number seed
1, 0, 0, 0,
0, 128, /* distfriend */
0, 1, 1, 1, 1, 0,
/* Zeroes for all compatibility stuff */
};
#define nosuch "NOSUCHCONFIGITEM"
const char* gameopt_config_names[] = {
"monsters_remember",nosuch,"weapon_recoil",nosuch,nosuch,"player_bobbing",nosuch,nosuch,nosuch,"demo_insurance",
nosuch,nosuch,nosuch,nosuch, // RNG seed
"monster_infighting","player_helpers",nosuch,nosuch,
nosuch,nosuch, // distfriend
"monster_backing","monster_avoid_hazards","monster_friction","help_friends","dog_jumping","monkeys",
"comp_telefrag","comp_dropoff","comp_vile","comp_pain","comp_skull","comp_blazing","comp_doorlight","comp_model","comp_god","comp_falloff","comp_floors","comp_skymap","comp_pursuit","comp_doorstuck","comp_staylift","comp_zombie","comp_stairs","comp_infcheat","comp_zerotags","comp_moveblock","comp_respawn","comp_sound" };
const int num_gameopts = sizeof gameopt_config_names / sizeof gameopt_config_names[0];
int verbose;
void NORETURN sig_handler(int signum)
{
char buf[80];
I_SigString(buf,80,signum);
printf("Received signal: %s\n", buf);
// Any signal is fatal
//exit(1);
}
void doexit(void)
{
packet_header_t packet;
// Send "downed" packet
packet_set(&packet, PKT_DOWN, 0);
BroadcastPacket(&packet, sizeof packet);
}
#ifndef USE_SDL_NET
static void I_InitSockets(int v4port)
{
v4socket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
I_SetupSocket(v4socket, v4port, AF_INET);
}
#else
static void I_InitSockets(Uint16 port)
{
I_InitNetwork();
udp_socket = I_Socket(port);
if (!udp_socket) I_Error("I_InitSockets: failed to open UDP port %d\n",port);
}
#endif
long int ptic(packet_header_t* p)
{
return doom_ntohl(p->tic);
}
void read_config_file(FILE* fp, struct setup_packet_s* sp)
{
byte* gameopt = sp->game_options;
while (!feof(fp)) {
char def[80];
char strparm[100];
if (fscanf (fp, "%79s %99[^\n]\n", def, strparm) == 2) {
int v = atoi(strparm);
if (!strcmp(def,"default_skill")) {
if (verbose) printf("config file sets default_skill to %d\n",v);
sp->skill = v-1;
} else if (!strcmp(def,"default_compatibility_level")) {
if (verbose) printf("config file sets compatibility_level to %d\n",v);
if (v == -1) v = MAX_COMPATIBILITY_LEVEL-1; //e6y: -1 => maxcompat
sp->complevel = v;
} else {
int i;
for (i=0; i<num_gameopts; i++) {
if (!!strcmp(gameopt_config_names[i],def)) continue;
if (verbose) printf("config file sets %s to %d\n",def,v);
gameopt[i] = v;
}
}
}
}
}
static int badplayer(int n) { return (n < 0 || n >= MAXPLAYERS); }
int main(int argc, char** argv)
{
#ifndef USE_SDL_NET
int localport = 5030;
#else
Uint16 localport = 5030;
#endif
int numplayers = 2, xtratics = 0, ticdup = 1;
int exectics = 0; // gametics completed
struct setup_packet_s setupinfo = { 2, 0, 1, 1, 1, 0, best_compatibility, 0, 0};
char**wadname = NULL;
char**wadget = NULL;
int numwads = 0;
{
int opt;
byte *gameopt = setupinfo.game_options;
memcpy(gameopt, &def_game_options, sizeof (setupinfo.game_options));
while ((opt = getopt(argc, argv, "c:t:x:p:e:l:adrfns:N:vw:")) != EOF)
switch (opt) {
case 'c':
{
FILE *cf = fopen(optarg,"r");
if (!cf) { perror("fopen"); return -1; }
read_config_file(cf,&setupinfo);
fclose(cf);
}
break;
case 't':
if (optarg) ticdup = atoi(optarg);
break;
case 'x':
if (optarg) xtratics = atoi(optarg);
break;
case 'p':
if (optarg) localport = atoi(optarg);
break;
case 'e':
if (optarg) setupinfo.episode = atoi(optarg);
break;
case 'l':
if (optarg) setupinfo.level = atoi(optarg);
break;
case 'a':
setupinfo.deathmatch = 2;
break;
case 'd':
setupinfo.deathmatch = 1;
break;
case 'r':
setupinfo.game_options[6] = 1;
break;
case 'f':
setupinfo.game_options[7] = 1;
break;
case 'n':
setupinfo.game_options[8] = 1;
break;
case 's':
if (optarg) setupinfo.skill = atoi(optarg)-1;
break;
case 'N':
if (optarg) setupinfo.players = numplayers = atoi(optarg);
break;
case 'v':
verbose++;
break;
case 'w':
if (optarg) {
char *p;
wadname = realloc(wadname, ++numwads * sizeof *wadname);
wadget = realloc(wadget , numwads * sizeof *wadget );
wadname[numwads-1] = strdup(optarg);
if ((p = strchr(wadname[numwads-1], ','))) {
*p++ = 0; wadget[numwads-1] = p;
} else wadget[numwads-1] = NULL;
}
break;
}
}
setupinfo.ticdup = ticdup; setupinfo.extratic = xtratics;
{ /* Random number seed
* Mirrors the corresponding code in G_ReadOptions */
int rngseed = (int)time(NULL);
setupinfo.game_options[13] = rngseed & 0xff;
rngseed >>= 8;
setupinfo.game_options[12] = rngseed & 0xff;
rngseed >>= 8;
setupinfo.game_options[11] = rngseed & 0xff;
rngseed >>= 8;
setupinfo.game_options[10] = rngseed & 0xff;
}
I_InitSockets(localport);
printf("Listening on port %d, waiting for %d players\n", localport, numplayers);
{ // no players initially
int i;
for (i=0; i<MAXPLAYERS; i++) {
playerjoingame[i] = INT_MAX;
playerleftgame[i] = 0;
playerstate[i] = pc_unused;
}
// Print wads
for (i=0; i<numwads; i++)
printf("Wad %s (%s)\n", wadname[i], wadget[i] ? wadget[i] : "");
}
// Exit and signal handling
atexit(doexit); // heh
signal(SIGTERM, sig_handler);
signal(SIGINT , sig_handler);
#ifndef USE_SDL_NET
signal(SIGQUIT, sig_handler);
signal(SIGKILL, sig_handler);
signal(SIGHUP , sig_handler);
#endif
{
int remoteticfrom[MAXPLAYERS] = { 0, 0, 0, 0 };
int remoteticto[MAXPLAYERS] = { 0, 0, 0, 0 };
int backoffcounter[MAXPLAYERS] = { 0, 0, 0, 0 };
int curplayers = 0;
int confirming = 0;
boolean ingame = false;
ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
while (1) {
packet_header_t *packet = malloc(10000);
size_t len;
I_WaitForPacket(120*1000);
while ((len = I_GetPacket(packet, 10000))) {
if (verbose>2) printf("Received packet:");
switch (packet->type) {
case PKT_INIT:
if (!ingame) {
{
int n;
struct setup_packet_s *sinfo = (void*)(packet+1);
/* Find player number and add to the game */
n = *(short*)(packet+1);
if (badplayer(n) || playerstate[n] != pc_unused)
for (n=0; n<numplayers; n++)
if (playerstate[n] == pc_unused) break;
if (n == numplayers) break; // Full game
playerstate[n] = pc_connected;
#ifndef USE_SDL_NET
remoteaddr[n] = sentfrom;
#else
if (sentfrom==-1)
remoteaddr[n]=I_RegisterPlayer(&sentfrom_addr);
#endif
printf("Join by ");
I_PrintAddress(stdout, &remoteaddr[n]);
#ifdef USE_SDL_NET
printf(" (channel %d)",remoteaddr[n]);
#endif
printf(" as player %d\n",n);
{
int i;
size_t extrabytes = 0;
// Send setup packet
packet_set(packet, PKT_SETUP, 0);
memcpy(sinfo, &setupinfo, sizeof setupinfo);
sinfo->yourplayer = n;
sinfo->numwads = numwads;
for (i=0; i<numwads; i++) {
strcpy(sinfo->wadnames + extrabytes, wadname[i]);
extrabytes += strlen(wadname[i]) + 1;
}
I_SendPacketTo(packet, sizeof *packet + sizeof setupinfo + extrabytes,
remoteaddr+n);
I_uSleep(10000);
I_SendPacketTo(packet, sizeof *packet + sizeof setupinfo + extrabytes,
remoteaddr+n);
}
}
}
break;
case PKT_GO:
if (!ingame) {
int from = *(byte*)(packet+1);
if (badplayer(from) || playerstate[from] == pc_unused) break;
if (confirming) {
if (playerstate[from] != pc_confirmedready) curplayers++;
playerstate[from] = pc_confirmedready;
} else
playerstate[from] = pc_ready;
}
break;
case PKT_TICC:
{
byte tics = *(byte*)(packet+1);
int from = *(((byte*)(packet+1))+1);
if (badplayer(from)) break;
if (verbose>2)
printf("tics %ld - %ld from %d\n", ptic(packet), ptic(packet) + tics - 1, from);
if (ptic(packet) > remoteticfrom[from]) {
// Missed tics, so request a resend
packet_set(packet, PKT_RETRANS, remoteticfrom[from]);
I_SendPacketTo(packet, sizeof *packet, remoteaddr+from);
} else {
ticcmd_t *newtic = (void*)(((byte*)(packet+1))+2);
if (ptic(packet) + tics < remoteticfrom[from]) break; // Won't help
remoteticfrom[from] = ptic(packet);
while (tics--)
netcmds[from][remoteticfrom[from]++%BACKUPTICS] = *newtic++;
}
}
break;
case PKT_RETRANS:
{
int from = *(byte*)(packet+1);
if (badplayer(from)) break;
if (verbose>2) printf("%d requests resend from %d\n", from, ptic(packet));
remoteticto[from] = ptic(packet);
}
break;
case PKT_QUIT:
{
int from = *(byte*)(packet+1);
if (badplayer(from)) break;
if (!ingame && playerstate[from] != pc_unused) {
// If we already got a PKT_GO, we have to remove this player frmo the count of ready players. And we then flag this player slot as vacant.
printf("player %d pulls out\n", from);
if (playerstate[from] == pc_confirmedready) curplayers--;
playerstate[from] = pc_unused;
} else
if (playerleftgame[from] == INT_MAX) { // In the game
playerleftgame[from] = ptic(packet);
--curplayers;
if (verbose) printf("%d quits at %d (%d left)\n", from, ptic(packet),curplayers);
// if (ingame && !curplayers) exit(0); // All players have exited
}
}
// Fall through and broadcast it
case PKT_EXTRA:
BroadcastPacket(packet, len);
if (packet->type == PKT_EXTRA) {
if (verbose>2) printf("misc from %d\n", *(((byte*)(packet+1))+1));
}
break;
case PKT_WAD:
{
int i;
int from = *(byte*)(packet+1);
char *name = 1 + (char*)(packet+1);
size_t size = sizeof(packet_header_t);
packet_header_t *reply;
if (badplayer(from) || playerstate[from] != pc_unused) break;
if (verbose) printf("Request for %s ", name);
for (i=0; i<numwads; i++)
if (!strcasecmp(name, wadname[i]))
break;
if ((i==numwads) || !wadget[i]) {
if (verbose) printf("n/a\n");
*(char*)(packet+1) = 0;
I_SendPacketTo(packet, size+1, remoteaddr + from);
} else {
size += strlen(wadname[i]) + strlen(wadget[i]) + 2;
reply = malloc(size);
packet_set(reply, PKT_WAD, 0);
strcpy((char*)(reply+1), wadname[i]);
strcpy((char*)(reply+1) + strlen(wadname[i]) + 1, wadget[i]);
printf("sending %s\n", wadget[i]);
I_SendPacketTo(reply, size, remoteaddr + from);
free(reply);
}
}
break;
default:
printf("Unrecognised packet type %d\n", packet->type);
break;
}
}
free(packet);
if (!ingame && n_players_in_state(numplayers,pc_confirmedready)) {
int i;
packet_header_t gopacket;
packet = &gopacket;
ingame=true;
printf("All players joined, beginning game.\n");
for (i=0; i<MAXPLAYERS; i++) {
if (playerstate[i] == pc_confirmedready) {
playerjoingame[i] = 0;
playerleftgame[i] = INT_MAX;
playerstate[i] = pc_playing;
}
}
packet_set(packet, PKT_GO, 0);
BroadcastPacket(packet, sizeof *packet);
I_uSleep(10000);
BroadcastPacket(packet, sizeof *packet);
I_uSleep(10000);
}
if (confirming && !--confirming && !ingame) {
int i;
curplayers = 0;
for (i=0; i<MAXPLAYERS; i++) {
if (playerstate[i] == pc_ready) {
playerstate[i] = pc_unused;
printf("Player %d dropped, no PKT_GO received in confirmation\n", i);
}
if (playerstate[i] == pc_confirmedready) playerstate[i] = pc_ready;
}
}
if (!ingame && n_players_in_state(numplayers,pc_ready)) {
printf("All players ready, now confirming.\n");
confirming = 100;
}
if (ingame) { // Run some tics
int lowtic = INT_MAX;
int i;
for (i=0; i<MAXPLAYERS; i++)
if (playerstate[i] == pc_playing || playerstate[i] == pc_quit) {
if (remoteticfrom[i] < playerleftgame[i]-1 && remoteticfrom[i]<lowtic)
lowtic = remoteticfrom[i];
}
if (verbose>1) printf("%d new tics can be run\n", lowtic - exectics);
if (lowtic > exectics)
exectics = lowtic; // count exec'ed tics
// Now send all tics up to lowtic
for (i=0; i<MAXPLAYERS; i++)
if (playerstate[i] == pc_playing) {
int tics;
if (lowtic <= remoteticto[i]) continue;
if ((remoteticto[i] -= xtratics) < 0) remoteticto[i] = 0;
tics = lowtic - remoteticto[i];
{
byte *p;
packet = malloc(sizeof(packet_header_t) + 1 +
tics * (1 + numplayers * (1 + sizeof(ticcmd_t))));
p = (void*)(packet+1);
packet_set(packet, PKT_TICS, remoteticto[i]);
*p++ = tics;
if (verbose>1) printf("sending %d tics to %d\n", tics, i);
while (tics--) {
int j, playersthistic = 0;
byte *q = p++;
for (j=0; j<MAXPLAYERS; j++)
if ((playerjoingame[j] <= remoteticto[i]) &&
(playerleftgame[j] > remoteticto[i])) {
*p++ = j;
memcpy(p, &netcmds[j][remoteticto[i]%BACKUPTICS], sizeof(ticcmd_t));
p += sizeof(ticcmd_t);
playersthistic++;
}
*q = playersthistic;
remoteticto[i]++;
}
I_SendPacketTo(packet, p - ((byte*)packet), remoteaddr+i);
free(packet);
}
{
if (remoteticfrom[i] == remoteticto[i]) {
backoffcounter[i] = 0;
} else if (remoteticfrom[i] > remoteticto[i]+1) {
if ((backoffcounter[i] += remoteticfrom[i] - remoteticto[i] - 1) > 35) {
packet_header_t *packet = malloc(sizeof(packet_header_t));
packet_set(packet, PKT_BACKOFF, remoteticto[i]);
I_SendPacketTo(packet,sizeof *packet,remoteaddr+i);
backoffcounter[i] = 0;
if (verbose) printf("telling client %d to back off\n",i);
free(packet);
}
}
}
}
}
if (!((ingame ? 0xff : 0xf) & displaycounter++)) {
int i;
fprintf(stderr,"Player states: [");
for (i=0;i<MAXPLAYERS;i++) {
switch (playerstate[i]) {
case pc_unused: fputc(' ',stderr); break;
case pc_connected: fputc('c',stderr); break;
case pc_ready: fputc('r',stderr); break;
case pc_confirmedready: fputc('g',stderr); break;
case pc_playing: fputc('p',stderr); break;
case pc_quit: fputc('x',stderr); break;
}
}
fprintf(stderr,"]\n");
}
}
}
}
#endif // HAVE_NET

View File

@@ -0,0 +1,48 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* DoomDef - basic defines for DOOM, e.g. Version, game mode
* and skill level, and display parameters.
*
*-----------------------------------------------------------------------------
*/
#ifdef __GNUG__
#pragma implementation "doomdef.h"
#endif
#include "doomdef.h"
// Location for any defines turned variables.
// None.
// proff 08/17/98: Changed for high-res
int SCREENWIDTH=320;
int SCREENHEIGHT=200;
int SCREENPITCH=320;

View File

@@ -0,0 +1,108 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Put all global state variables here.
*
*-----------------------------------------------------------------------------
*/
#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;
// Language.
Language_t language = english;
// Set if homebrew PWAD stuff has been added.
boolean modifiedgame;
//-----------------------------------------------------------------------------
// CPhipps - compatibility vars
complevel_t compatibility_level, default_compatibility_level;
int comp[COMP_TOTAL], default_comp[COMP_TOTAL]; // killough 10/98
// v1.1-like pitched sounds
int pitched_sounds; // killough
int default_translucency; // config file says // phares
boolean general_translucency; // true if translucency is ok // phares
int demo_insurance, default_demo_insurance; // killough 1/16/98
int allow_pushers = 1; // MT_PUSH Things // phares 3/10/98
int default_allow_pushers; // killough 3/1/98: make local to each game
int variable_friction = 1; // ice & mud // phares 3/10/98
int default_variable_friction; // killough 3/1/98: make local to each game
int weapon_recoil; // weapon recoil // phares
int default_weapon_recoil; // killough 3/1/98: make local to each game
int player_bobbing; // whether player bobs or not // phares 2/25/98
int default_player_bobbing; // killough 3/1/98: make local to each game
int monsters_remember; // killough 3/1/98
int default_monsters_remember;
int monster_infighting=1; // killough 7/19/98: monster<=>monster attacks
int default_monster_infighting=1;
int monster_friction=1; // killough 10/98: monsters affected by friction
int default_monster_friction=1;
#ifdef DOGS
int dogs, default_dogs; // killough 7/19/98: Marine's best friend :)
int dog_jumping, default_dog_jumping; // killough 10/98
#endif
// killough 8/8/98: distance friends tend to move towards players
int distfriend = 128, default_distfriend = 128;
// killough 9/8/98: whether monsters are allowed to strafe or retreat
int monster_backing, default_monster_backing;
// killough 9/9/98: whether monsters are able to avoid hazards (e.g. crushers)
int monster_avoid_hazards, default_monster_avoid_hazards;
// killough 9/9/98: whether monsters help friends
int help_friends, default_help_friends;
int flashing_hom; // killough 10/98
int doom_weapon_toggles; // killough 10/98
int monkeys, default_monkeys;

View File

@@ -0,0 +1,85 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Globally defined strings.
*
*-----------------------------------------------------------------------------
*/
#ifdef __GNUG__
#pragma implementation "dstrings.h"
#endif
#include "dstrings.h"
// killough 1/18/98: remove hardcoded limit, add const:
const char *const endmsg[]=
{
// 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.", // 1/15/98 killough
// 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.", // 1/15/98 killough
// FinalDOOM?
// Note that these ending "bad taste" strings were commented out
// in the original id code as the #else case of an #if 1
// Obviously they were internal playthings before the release of
// DOOM2 and were not intended for public use.
//
// Following messages commented out for now. Bad taste. // phares
// "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.", // 1/15/98 killough
};
// killough 1/18/98: remove hardcoded limit and replace with var (silly hack):
const size_t NUM_QUITMESSAGES = sizeof(endmsg)/sizeof(*endmsg) - 1;

View File

@@ -0,0 +1,668 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Game completion, final screen animation.
*
*-----------------------------------------------------------------------------
*/
#include "doomstat.h"
#include "d_event.h"
#include "v_video.h"
#include "w_wad.h"
#include "s_sound.h"
#include "sounds.h"
#include "d_deh.h" // Ty 03/22/98 - externalizations
#include "f_finale.h" // CPhipps - hmm...
// Stage of animation:
// 0 = text, 1 = art screen, 2 = character cast
static int finalestage; // cph -
static int finalecount; // made static
static const char* finaletext; // cph -
static const char* finaleflat; // made static const
// defines for the end mission display text // phares
#define TEXTSPEED 3 // original value // phares
#define TEXTWAIT 250 // original value // phares
#define NEWTEXTSPEED 0.01f // new value // phares
#define NEWTEXTWAIT 1000 // new value // phares
// CPhipps - removed the old finale screen text message strings;
// they were commented out for ages already
// Ty 03/22/98 - ... the new s_WHATEVER extern variables are used
// in the code below instead.
void F_StartCast (void);
void F_CastTicker (void);
boolean F_CastResponder (event_t *ev);
void F_CastDrawer (void);
void WI_checkForAccelerate(void); // killough 3/28/98: used to
extern int acceleratestage; // accelerate intermission screens
static int midstage; // whether we're in "mid-stage"
//
// F_StartFinale
//
void F_StartFinale (void)
{
gameaction = ga_nothing;
gamestate = GS_FINALE;
automapmode &= ~am_active;
// killough 3/28/98: clear accelerative text flags
acceleratestage = midstage = 0;
// 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:
case retail:
{
S_ChangeMusic(mus_victor, true);
switch (gameepisode)
{
case 1:
finaleflat = bgflatE1; // Ty 03/30/98 - new externalized bg flats
finaletext = s_E1TEXT; // Ty 03/23/98 - Was e1text variable.
break;
case 2:
finaleflat = bgflatE2;
finaletext = s_E2TEXT; // Ty 03/23/98 - Same stuff for each
break;
case 3:
finaleflat = bgflatE3;
finaletext = s_E3TEXT;
break;
case 4:
finaleflat = bgflatE4;
finaletext = s_E4TEXT;
break;
default:
// Ouch.
break;
}
break;
}
// DOOM II and missions packs with E1, M34
case commercial:
{
S_ChangeMusic(mus_read_m, true);
// Ty 08/27/98 - added the gamemission logic
switch (gamemap)
{
case 6:
finaleflat = bgflat06;
finaletext = (gamemission==pack_tnt) ? s_T1TEXT :
(gamemission==pack_plut) ? s_P1TEXT : s_C1TEXT;
break;
case 11:
finaleflat = bgflat11;
finaletext = (gamemission==pack_tnt) ? s_T2TEXT :
(gamemission==pack_plut) ? s_P2TEXT : s_C2TEXT;
break;
case 20:
finaleflat = bgflat20;
finaletext = (gamemission==pack_tnt) ? s_T3TEXT :
(gamemission==pack_plut) ? s_P3TEXT : s_C3TEXT;
break;
case 30:
finaleflat = bgflat30;
finaletext = (gamemission==pack_tnt) ? s_T4TEXT :
(gamemission==pack_plut) ? s_P4TEXT : s_C4TEXT;
break;
case 15:
finaleflat = bgflat15;
finaletext = (gamemission==pack_tnt) ? s_T5TEXT :
(gamemission==pack_plut) ? s_P5TEXT : s_C5TEXT;
break;
case 31:
finaleflat = bgflat31;
finaletext = (gamemission==pack_tnt) ? s_T6TEXT :
(gamemission==pack_plut) ? s_P6TEXT : s_C6TEXT;
break;
default:
// Ouch.
break;
}
break;
// Ty 08/27/98 - end gamemission logic
}
// Indeterminate.
default: // Ty 03/30/98 - not externalized
S_ChangeMusic(mus_read_m, true);
finaleflat = "F_SKY1"; // Not used anywhere else.
finaletext = s_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;
}
// Get_TextSpeed() returns the value of the text display speed // phares
// Rewritten to allow user-directed acceleration -- killough 3/28/98
static float Get_TextSpeed(void)
{
return midstage ? NEWTEXTSPEED : (midstage=acceleratestage) ?
acceleratestage=0, NEWTEXTSPEED : TEXTSPEED;
}
//
// F_Ticker
//
// killough 3/28/98: almost totally rewritten, to use
// player-directed acceleration instead of constant delays.
// Now the player can accelerate the text display by using
// the fire/use keys while it is being printed. The delay
// automatically responds to the user, and gives enough
// time to read.
//
// killough 5/10/98: add back v1.9 demo compatibility
//
void F_Ticker(void)
{
int i;
if (!demo_compatibility)
WI_checkForAccelerate(); // killough 3/28/98: check for acceleration
else
if (gamemode == commercial && finalecount > 50) // check for skipping
for (i=0; i<MAXPLAYERS; i++)
if (players[i].cmd.buttons)
goto next_level; // go on to the next level
// advance animation
finalecount++;
if (finalestage == 2)
F_CastTicker();
if (!finalestage)
{
float speed = demo_compatibility ? TEXTSPEED : Get_TextSpeed();
/* killough 2/28/98: changed to allow acceleration */
if (finalecount > strlen(finaletext)*speed +
(midstage ? NEWTEXTWAIT : TEXTWAIT) ||
(midstage && acceleratestage)) {
if (gamemode != commercial) // Doom 1 / Ultimate Doom episode end
{ // with enough time, it's automatic
finalecount = 0;
finalestage = 1;
wipegamestate = -1; // force a wipe
if (gameepisode == 3)
S_StartMusic(mus_bunny);
}
else // you must press a button to continue in Doom 2
if (!demo_compatibility && midstage)
{
next_level:
if (gamemap == 30)
F_StartCast(); // cast of Doom 2 characters
else
gameaction = ga_worlddone; // next level, e.g. MAP07
}
}
}
}
//
// F_TextWrite
//
// This program displays the background and text at end-mission // phares
// text time. It draws both repeatedly so that other displays, // |
// like the main menu, can be drawn over it dynamically and // V
// erased dynamically. The TEXTSPEED constant is changed into
// the Get_TextSpeed function so that the speed of writing the // ^
// text can be increased, and there's still time to read what's // |
// written. // phares
// CPhipps - reformatted
#include "hu_stuff.h"
extern patchnum_t hu_font[HU_FONTSIZE];
static void F_TextWrite (void)
{
V_DrawBackground(finaleflat, 0);
{ // draw some of the text onto the screen
int cx = 10;
int cy = 10;
const char* ch = finaletext; // CPhipps - const
int count = (int)((float)(finalecount - 10)/Get_TextSpeed()); // phares
int w;
if (count < 0)
count = 0;
for ( ; count ; count-- ) {
int c = *ch++;
if (!c)
break;
if (c == '\n') {
cx = 10;
cy += 11;
continue;
}
c = toupper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE) {
cx += 4;
continue;
}
w = hu_font[c].width;
if (cx+w > SCREENWIDTH)
break;
// CPhipps - patch drawing updated
V_DrawNumPatch(cx, cy, 0, hu_font[c].lumpnum, CR_DEFAULT, VPT_STRETCH);
cx+=w;
}
}
}
//
// Final DOOM 2 animation
// Casting by id Software.
// in order of appearance
//
typedef struct
{
const char **name; // CPhipps - const**
mobjtype_t type;
} castinfo_t;
#define MAX_CASTORDER 18 /* Ty - hard coded for now */
static const castinfo_t castorder[] = { // CPhipps - static const, initialised here
{ &s_CC_ZOMBIE, MT_POSSESSED },
{ &s_CC_SHOTGUN, MT_SHOTGUY },
{ &s_CC_HEAVY, MT_CHAINGUY },
{ &s_CC_IMP, MT_TROOP },
{ &s_CC_DEMON, MT_SERGEANT },
{ &s_CC_LOST, MT_SKULL },
{ &s_CC_CACO, MT_HEAD },
{ &s_CC_HELL, MT_KNIGHT },
{ &s_CC_BARON, MT_BRUISER },
{ &s_CC_ARACH, MT_BABY },
{ &s_CC_PAIN, MT_PAIN },
{ &s_CC_REVEN, MT_UNDEAD },
{ &s_CC_MANCU, MT_FATSO },
{ &s_CC_ARCH, MT_VILE },
{ &s_CC_SPIDER, MT_SPIDER },
{ &s_CC_CYBER, MT_CYBORG },
{ &s_CC_HERO, MT_PLAYER },
{ NULL, 0}
};
int castnum;
int casttics;
state_t* caststate;
boolean castdeath;
int castframes;
int castonmelee;
boolean castattacking;
//
// F_StartCast
//
void F_StartCast (void)
{
wipegamestate = -1; // force a screen wipe
castnum = 0;
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
casttics = caststate->tics;
castdeath = false;
finalestage = 2;
castframes = 0;
castonmelee = 0;
castattacking = false;
S_ChangeMusic(mus_evil, true);
}
//
// F_CastTicker
//
void F_CastTicker (void)
{
int st;
int sfx;
if (--casttics > 0)
return; // not time to change state yet
if (caststate->tics == -1 || caststate->nextstate == S_NULL)
{
// switch from deathstate to next monster
castnum++;
castdeath = false;
if (castorder[castnum].name == NULL)
castnum = 0;
if (mobjinfo[castorder[castnum].type].seesound)
S_StartSound (NULL, mobjinfo[castorder[castnum].type].seesound);
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
castframes = 0;
}
else
{
// just advance to next state in animation
if (caststate == &states[S_PLAY_ATK1])
goto stopattack; // Oh, gross hack!
st = caststate->nextstate;
caststate = &states[st];
castframes++;
// sound hacks....
switch (st)
{
case S_PLAY_ATK1: sfx = sfx_dshtgn; break;
case S_POSS_ATK2: sfx = sfx_pistol; break;
case S_SPOS_ATK2: sfx = sfx_shotgn; break;
case S_VILE_ATK2: sfx = sfx_vilatk; break;
case S_SKEL_FIST2: sfx = sfx_skeswg; break;
case S_SKEL_FIST4: sfx = sfx_skepch; break;
case S_SKEL_MISS2: sfx = sfx_skeatk; break;
case S_FATT_ATK8:
case S_FATT_ATK5:
case S_FATT_ATK2: sfx = sfx_firsht; break;
case S_CPOS_ATK2:
case S_CPOS_ATK3:
case S_CPOS_ATK4: sfx = sfx_shotgn; break;
case S_TROO_ATK3: sfx = sfx_claw; break;
case S_SARG_ATK2: sfx = sfx_sgtatk; break;
case S_BOSS_ATK2:
case S_BOS2_ATK2:
case S_HEAD_ATK2: sfx = sfx_firsht; break;
case S_SKULL_ATK2: sfx = sfx_sklatk; break;
case S_SPID_ATK2:
case S_SPID_ATK3: sfx = sfx_shotgn; break;
case S_BSPI_ATK2: sfx = sfx_plasma; break;
case S_CYBER_ATK2:
case S_CYBER_ATK4:
case S_CYBER_ATK6: sfx = sfx_rlaunc; break;
case S_PAIN_ATK3: sfx = sfx_sklatk; break;
default: sfx = 0; break;
}
if (sfx)
S_StartSound (NULL, sfx);
}
if (castframes == 12)
{
// go into attack frame
castattacking = true;
if (castonmelee)
caststate=&states[mobjinfo[castorder[castnum].type].meleestate];
else
caststate=&states[mobjinfo[castorder[castnum].type].missilestate];
castonmelee ^= 1;
if (caststate == &states[S_NULL])
{
if (castonmelee)
caststate=
&states[mobjinfo[castorder[castnum].type].meleestate];
else
caststate=
&states[mobjinfo[castorder[castnum].type].missilestate];
}
}
if (castattacking)
{
if (castframes == 24
|| caststate == &states[mobjinfo[castorder[castnum].type].seestate] )
{
stopattack:
castattacking = false;
castframes = 0;
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
}
}
casttics = caststate->tics;
if (casttics == -1)
casttics = 15;
}
//
// F_CastResponder
//
boolean F_CastResponder (event_t* ev)
{
if (ev->type != ev_keydown)
return false;
if (castdeath)
return true; // already in dying frames
// go into death frame
castdeath = true;
caststate = &states[mobjinfo[castorder[castnum].type].deathstate];
casttics = caststate->tics;
castframes = 0;
castattacking = false;
if (mobjinfo[castorder[castnum].type].deathsound)
S_StartSound (NULL, mobjinfo[castorder[castnum].type].deathsound);
return true;
}
static void F_CastPrint (const char* text) // CPhipps - static, const char*
{
const char* ch; // CPhipps - const
int c;
int cx;
int w;
int width;
// find width
ch = text;
width = 0;
while (ch)
{
c = *ch++;
if (!c)
break;
c = toupper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE)
{
width += 4;
continue;
}
w = hu_font[c].width;
width += w;
}
// draw it
cx = 160-width/2;
ch = text;
while (ch)
{
c = *ch++;
if (!c)
break;
c = toupper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE)
{
cx += 4;
continue;
}
w = hu_font[c].width;
// CPhipps - patch drawing updated
V_DrawNumPatch(cx, 180, 0, hu_font[c].lumpnum, CR_DEFAULT, VPT_STRETCH);
cx+=w;
}
}
//
// F_CastDrawer
//
void F_CastDrawer (void)
{
spritedef_t* sprdef;
spriteframe_t* sprframe;
int lump;
boolean flip;
// erase the entire screen to a background
// CPhipps - patch drawing updated
V_DrawNamePatch(0,0,0, bgcastcall, CR_DEFAULT, VPT_STRETCH); // Ty 03/30/98 bg texture extern
F_CastPrint (*(castorder[castnum].name));
// draw the current frame in the middle of the screen
sprdef = &sprites[caststate->sprite];
sprframe = &sprdef->spriteframes[ caststate->frame & FF_FRAMEMASK];
lump = sprframe->lump[0];
flip = (boolean)sprframe->flip[0];
// CPhipps - patch drawing updated
V_DrawNumPatch(160, 170, 0, lump+firstspritelump, CR_DEFAULT,
VPT_STRETCH | (flip ? VPT_FLIP : 0));
}
//
// F_BunnyScroll
//
static const char pfub2[] = { "PFUB2" };
static const char pfub1[] = { "PFUB1" };
static void F_BunnyScroll (void)
{
char name[10];
int stage;
static int laststage;
{
int scrolled = 320 - (finalecount-230)/2;
if (scrolled <= 0) {
V_DrawNamePatch(0, 0, 0, pfub2, CR_DEFAULT, VPT_STRETCH);
} else if (scrolled >= 320) {
V_DrawNamePatch(0, 0, 0, pfub1, CR_DEFAULT, VPT_STRETCH);
} else {
V_DrawNamePatch(320-scrolled, 0, 0, pfub1, CR_DEFAULT, VPT_STRETCH);
V_DrawNamePatch(-scrolled, 0, 0, pfub2, CR_DEFAULT, VPT_STRETCH);
}
}
if (finalecount < 1130)
return;
if (finalecount < 1180)
{
// CPhipps - patch drawing updated
V_DrawNamePatch((320-13*8)/2, (200-8*8)/2,0, "END0", CR_DEFAULT, VPT_STRETCH);
laststage = 0;
return;
}
stage = (finalecount-1180) / 5;
if (stage > 6)
stage = 6;
if (stage > laststage)
{
S_StartSound (NULL, sfx_pistol);
laststage = stage;
}
sprintf (name,"END%i",stage);
// CPhipps - patch drawing updated
V_DrawNamePatch((320-13*8)/2, (200-8*8)/2, 0, name, CR_DEFAULT, VPT_STRETCH);
}
//
// F_Drawer
//
void F_Drawer (void)
{
if (finalestage == 2)
{
F_CastDrawer ();
return;
}
if (!finalestage)
F_TextWrite ();
else
{
switch (gameepisode)
{
// CPhipps - patch drawing updated
case 1:
if ( gamemode == retail )
V_DrawNamePatch(0, 0, 0, "CREDIT", CR_DEFAULT, VPT_STRETCH);
else
V_DrawNamePatch(0, 0, 0, "HELP2", CR_DEFAULT, VPT_STRETCH);
break;
case 2:
V_DrawNamePatch(0, 0, 0, "VICTORY2", CR_DEFAULT, VPT_STRETCH);
break;
case 3:
F_BunnyScroll ();
break;
case 4:
V_DrawNamePatch(0, 0, 0, "ENDPIC", CR_DEFAULT, VPT_STRETCH);
break;
}
}
}

202
components/prboom/f_wipe.c Normal file
View File

@@ -0,0 +1,202 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Mission begin melt/wipe screen special effect.
*
*-----------------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "z_zone.h"
#include "doomdef.h"
#include "i_video.h"
#include "v_video.h"
#include "m_random.h"
#include "f_wipe.h"
//
// SCREEN WIPE PACKAGE
//
// Parts re-written to support true-color video modes. Column-major
// formatting removed. - POPE
// CPhipps - macros for the source and destination screens
#define SRC_SCR 2
#define DEST_SCR 3
static screeninfo_t wipe_scr_start;
static screeninfo_t wipe_scr_end;
static screeninfo_t wipe_scr;
static int y_lookup[MAX_SCREENWIDTH];
static int wipe_initMelt(int ticks)
{
int i;
// copy start screen to main screen
for(i=0;i<SCREENHEIGHT;i++)
memcpy(wipe_scr.data+i*wipe_scr.byte_pitch,
wipe_scr_start.data+i*wipe_scr.byte_pitch,
SCREENWIDTH*V_GetPixelDepth());
// setup initial column positions (y<0 => not ready to scroll yet)
y_lookup[0] = -(M_Random()%16);
for (i=1;i<SCREENWIDTH;i++)
{
int r = (M_Random()%3) - 1;
y_lookup[i] = y_lookup[i-1] + r;
if (y_lookup[i] > 0)
y_lookup[i] = 0;
else
if (y_lookup[i] == -16)
y_lookup[i] = -15;
}
return 0;
}
static int wipe_doMelt(int ticks)
{
boolean done = true;
int i;
const int depth = V_GetPixelDepth();
while (ticks--) {
for (i=0;i<(SCREENWIDTH);i++) {
if (y_lookup[i]<0) {
y_lookup[i]++;
done = false;
continue;
}
if (y_lookup[i] < SCREENHEIGHT) {
byte *s, *d;
int j, k, dy;
/* cph 2001/07/29 -
* The original melt rate was 8 pixels/sec, i.e. 25 frames to melt
* the whole screen, so make the melt rate depend on SCREENHEIGHT
* so it takes no longer in high res
*/
dy = (y_lookup[i] < 16) ? y_lookup[i]+1 : SCREENHEIGHT/25;
if (y_lookup[i]+dy >= SCREENHEIGHT)
dy = SCREENHEIGHT - y_lookup[i];
s = wipe_scr_end.data + (y_lookup[i]*wipe_scr_end.byte_pitch+(i*depth));
d = wipe_scr.data + (y_lookup[i]*wipe_scr.byte_pitch+(i*depth));
for (j=dy;j;j--) {
for (k=0; k<depth; k++)
d[k] = s[k];
d += wipe_scr.byte_pitch;
s += wipe_scr_end.byte_pitch;
}
y_lookup[i] += dy;
s = wipe_scr_start.data + (i*depth);
d = wipe_scr.data + (y_lookup[i]*wipe_scr.byte_pitch+(i*depth));
for (j=SCREENHEIGHT-y_lookup[i];j;j--) {
for (k=0; k<depth; k++)
d[k] = s[k];
d += wipe_scr.byte_pitch;
s += wipe_scr_end.byte_pitch;
}
done = false;
}
}
}
return done;
}
// CPhipps - modified to allocate and deallocate screens[2 to 3] as needed, saving memory
static int wipe_exitMelt(int ticks)
{
V_FreeScreen(&wipe_scr_start);
wipe_scr_start.width = 0;
wipe_scr_start.height = 0;
V_FreeScreen(&wipe_scr_end);
wipe_scr_end.width = 0;
wipe_scr_end.height = 0;
// Paranoia
screens[SRC_SCR] = wipe_scr_start;
screens[DEST_SCR] = wipe_scr_end;
return 0;
}
int wipe_StartScreen(void)
{
wipe_scr_start.width = SCREENWIDTH;
wipe_scr_start.height = SCREENHEIGHT;
wipe_scr_start.byte_pitch = screens[0].byte_pitch;
wipe_scr_start.short_pitch = screens[0].short_pitch;
wipe_scr_start.int_pitch = screens[0].int_pitch;
wipe_scr_start.not_on_heap = false;
V_AllocScreen(&wipe_scr_start);
screens[SRC_SCR] = wipe_scr_start;
V_CopyRect(0, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0, SRC_SCR, VPT_NONE ); // Copy start screen to buffer
return 0;
}
int wipe_EndScreen(void)
{
wipe_scr_end.width = SCREENWIDTH;
wipe_scr_end.height = SCREENHEIGHT;
wipe_scr_end.byte_pitch = screens[0].byte_pitch;
wipe_scr_end.short_pitch = screens[0].short_pitch;
wipe_scr_end.int_pitch = screens[0].int_pitch;
wipe_scr_end.not_on_heap = false;
V_AllocScreen(&wipe_scr_end);
screens[DEST_SCR] = wipe_scr_end;
V_CopyRect(0, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0, DEST_SCR, VPT_NONE); // Copy end screen to buffer
V_CopyRect(0, 0, SRC_SCR, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0 , VPT_NONE); // restore start screen
return 0;
}
// killough 3/5/98: reformatted and cleaned up
int wipe_ScreenWipe(int ticks)
{
static boolean go; // when zero, stop the wipe
if (!go) // initial stuff
{
go = 1;
wipe_scr = screens[0];
wipe_initMelt(ticks);
}
// do a piece of wipe-in
if (wipe_doMelt(ticks)) // final stuff
{
wipe_exitMelt(ticks);
go = 0;
}
return !go;
}

2975
components/prboom/g_game.c Normal file

File diff suppressed because it is too large Load Diff

2721
components/prboom/gl_main.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,960 @@
#if 0
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
*
*---------------------------------------------------------------------
*/
#include "z_zone.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#ifndef CALLBACK
#define CALLBACK
#endif
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <SDL.h>
#include <SDL_opengl.h>
#include "doomtype.h"
#include "w_wad.h"
#include "m_argv.h"
#include "d_event.h"
#include "v_video.h"
#include "doomstat.h"
#include "r_bsp.h"
#include "r_main.h"
#include "r_draw.h"
#include "r_sky.h"
#include "r_plane.h"
#include "r_data.h"
#include "p_maputl.h"
#include "p_tick.h"
#include "m_bbox.h"
#include "lprintf.h"
#include "gl_intern.h"
#include "gl_struct.h"
/* TEXTURES */
static GLTexture **gld_GLTextures=NULL;
/* PATCHES FLATS SPRITES */
static GLTexture **gld_GLPatchTextures=NULL;
boolean use_mipmapping=false;
int gld_max_texturesize=0;
char *gl_tex_format_string;
//int gl_tex_format=GL_RGBA8;
int gl_tex_format=GL_RGB5_A1;
//int gl_tex_format=GL_RGBA4;
//int gl_tex_format=GL_RGBA2;
GLTexture *last_gltexture=NULL;
int last_cm=-1;
int transparent_pal_index;
unsigned char gld_palmap[256];
void gld_InitPalettedTextures(void)
{
const unsigned char *playpal;
int pal[256];
int i,j;
playpal=W_CacheLumpName("PLAYPAL");
for (i=0; i<256; i++) {
pal[i] = (playpal[i*3+0] << 16) | (playpal[i*3+1] << 8) | playpal[i*3+2];
gld_palmap[i] = i;
}
transparent_pal_index = -1;
for (i=0; i<256; i++) {
for (j=i+1; j<256; j++) {
if (pal[i] == pal[j]) {
transparent_pal_index = j;
gld_palmap[j] = i;
break;
}
}
if (transparent_pal_index >= 0)
break;
}
W_UnlockLumpName("PLAYPAL");
}
int gld_GetTexDimension(int value)
{
int i;
i=1;
while (i<value)
i*=2;
if (i>gld_max_texturesize)
i=gld_max_texturesize;
return i;
}
static GLTexture *gld_AddNewGLTexture(int texture_num)
{
if (texture_num<0)
return NULL;
if (texture_num>=numtextures)
return NULL;
if (!gld_GLTextures)
{
gld_GLTextures=Z_Malloc(numtextures*sizeof(GLTexture *),PU_STATIC,0);
memset(gld_GLTextures,0,numtextures*sizeof(GLTexture *));
}
if (!gld_GLTextures[texture_num])
{
gld_GLTextures[texture_num]=Z_Malloc(sizeof(GLTexture),PU_STATIC,0);
memset(gld_GLTextures[texture_num], 0, sizeof(GLTexture));
gld_GLTextures[texture_num]->textype=GLDT_UNREGISTERED;
}
return gld_GLTextures[texture_num];
}
static GLTexture *gld_AddNewGLPatchTexture(int lump)
{
if (lump<0)
return NULL;
if (lump>=numlumps)
return NULL;
if (!gld_GLPatchTextures)
{
gld_GLPatchTextures=Z_Malloc(numlumps*sizeof(GLTexture *),PU_STATIC,0);
memset(gld_GLPatchTextures,0,numlumps*sizeof(GLTexture *));
}
if (!gld_GLPatchTextures[lump])
{
gld_GLPatchTextures[lump]=Z_Malloc(sizeof(GLTexture),PU_STATIC,0);
memset(gld_GLPatchTextures[lump], 0, sizeof(GLTexture));
gld_GLPatchTextures[lump]->textype=GLDT_UNREGISTERED;
}
return gld_GLPatchTextures[lump];
}
void gld_SetTexturePalette(GLenum target)
{
const unsigned char *playpal;
unsigned char pal[1024];
int i;
playpal=W_CacheLumpName("PLAYPAL");
for (i=0; i<256; i++) {
pal[i*4+0] = playpal[i*3+0];
pal[i*4+1] = playpal[i*3+1];
pal[i*4+2] = playpal[i*3+2];
pal[i*4+3] = 255;
}
pal[transparent_pal_index*4+0]=0;
pal[transparent_pal_index*4+1]=0;
pal[transparent_pal_index*4+2]=0;
pal[transparent_pal_index*4+3]=0;
gld_ColorTableEXT(target, GL_RGBA, 256, GL_RGBA, GL_UNSIGNED_BYTE, pal);
W_UnlockLumpName("PLAYPAL");
}
static void gld_AddPatchToTexture_UnTranslated(GLTexture *gltexture, unsigned char *buffer, const rpatch_t *patch, int originx, int originy, int paletted)
{
int x,y,j;
int xs,xe;
int js,je;
const rcolumn_t *column;
const byte *source;
int i, pos;
const unsigned char *playpal;
if (!gltexture)
return;
if (!patch)
return;
playpal=W_CacheLumpName("PLAYPAL");
xs=0;
xe=patch->width;
if ((xs+originx)>=gltexture->realtexwidth)
return;
if ((xe+originx)<=0)
return;
if ((xs+originx)<0)
xs=-originx;
if ((xe+originx)>gltexture->realtexwidth)
xe+=(gltexture->realtexwidth-(xe+originx));
for (x=xs;x<xe;x++)
{
#ifdef RANGECHECK
if (x>=patch->width)
{
lprintf(LO_ERROR,"gld_AddPatchToTexture_UnTranslated x>=patch->width (%i >= %i)\n",x,patch->width);
return;
}
#endif
column = &patch->columns[x];
for (i=0; i<column->numPosts; i++) {
const rpost_t *post = &column->posts[i];
y=(post->topdelta+originy);
js=0;
je=post->length;
if ((js+y)>=gltexture->realtexheight)
continue;
if ((je+y)<=0)
continue;
if ((js+y)<0)
js=-y;
if ((je+y)>gltexture->realtexheight)
je+=(gltexture->realtexheight-(je+y));
source = column->pixels + post->topdelta;
if (paletted) {
pos=(((js+y)*gltexture->buffer_width)+x+originx);
for (j=js;j<je;j++,pos+=(gltexture->buffer_width))
{
#ifdef RANGECHECK
if (pos>=gltexture->buffer_size)
{
lprintf(LO_ERROR,"gld_AddPatchToTexture_UnTranslated pos>=size (%i >= %i)\n",pos+3,gltexture->buffer_size);
return;
}
#endif
buffer[pos]=gld_palmap[source[j]];
}
} else {
pos=4*(((js+y)*gltexture->buffer_width)+x+originx);
for (j=js;j<je;j++,pos+=(4*gltexture->buffer_width))
{
#ifdef RANGECHECK
if ((pos+3)>=gltexture->buffer_size)
{
lprintf(LO_ERROR,"gld_AddPatchToTexture_UnTranslated pos+3>=size (%i >= %i)\n",pos+3,gltexture->buffer_size);
return;
}
#endif
buffer[pos]=playpal[source[j]*3];
buffer[pos+1]=playpal[source[j]*3+1];
buffer[pos+2]=playpal[source[j]*3+2];
buffer[pos+3]=255;
}
}
}
}
W_UnlockLumpName("PLAYPAL");
}
void gld_AddPatchToTexture(GLTexture *gltexture, unsigned char *buffer, const rpatch_t *patch, int originx, int originy, int cm, int paletted)
{
int x,y,j;
int xs,xe;
int js,je;
const rcolumn_t *column;
const byte *source;
int i, pos;
const unsigned char *playpal;
const unsigned char *outr;
if (!gltexture)
return;
if (!patch)
return;
if ((cm==CR_DEFAULT) || (cm==CR_LIMIT))
{
gld_AddPatchToTexture_UnTranslated(gltexture,buffer,patch,originx,originy, paletted);
return;
}
if (cm<CR_LIMIT)
outr=colrngs[cm];
else
outr=translationtables + 256*((cm-CR_LIMIT)-1);
playpal=W_CacheLumpName("PLAYPAL");
xs=0;
xe=patch->width;
if ((xs+originx)>=gltexture->realtexwidth)
return;
if ((xe+originx)<=0)
return;
if ((xs+originx)<0)
xs=-originx;
if ((xe+originx)>gltexture->realtexwidth)
xe+=(gltexture->realtexwidth-(xe+originx));
for (x=xs;x<xe;x++)
{
#ifdef RANGECHECK
if (x>=patch->width)
{
lprintf(LO_ERROR,"gld_AddPatchToTexture x>=patch->width (%i >= %i)\n",x,patch->width);
return;
}
#endif
column = &patch->columns[x];
for (i=0; i<column->numPosts; i++) {
const rpost_t *post = &column->posts[i];
y=(post->topdelta+originy);
js=0;
je=post->length;
if ((js+y)>=gltexture->realtexheight)
continue;
if ((je+y)<=0)
continue;
if ((js+y)<0)
js=-y;
if ((je+y)>gltexture->realtexheight)
je+=(gltexture->realtexheight-(je+y));
source = column->pixels + post->topdelta;
if (paletted) {
pos=(((js+y)*gltexture->buffer_width)+x+originx);
for (j=js;j<je;j++,pos+=(gltexture->buffer_width))
{
#ifdef RANGECHECK
if (pos>=gltexture->buffer_size)
{
lprintf(LO_ERROR,"gld_AddPatchToTexture_UnTranslated pos>=size (%i >= %i)\n",pos+3,gltexture->buffer_size);
return;
}
#endif
buffer[pos]=gld_palmap[outr[source[j]]];
}
} else {
pos=4*(((js+y)*gltexture->buffer_width)+x+originx);
for (j=js;j<je;j++,pos+=(4*gltexture->buffer_width))
{
#ifdef RANGECHECK
if ((pos+3)>=gltexture->buffer_size)
{
lprintf(LO_ERROR,"gld_AddPatchToTexture pos+3>=size (%i >= %i)\n",pos+3,gltexture->buffer_size);
return;
}
#endif
buffer[pos]=playpal[outr[source[j]]*3];
buffer[pos+1]=playpal[outr[source[j]]*3+1];
buffer[pos+2]=playpal[outr[source[j]]*3+2];
buffer[pos+3]=255;
}
}
}
}
W_UnlockLumpName("PLAYPAL");
}
static void gld_AddFlatToTexture(GLTexture *gltexture, unsigned char *buffer, const unsigned char *flat, int paletted)
{
int x,y,pos;
const unsigned char *playpal;
if (!gltexture)
return;
if (!flat)
return;
if (paletted) {
for (y=0;y<gltexture->realtexheight;y++)
{
pos=(y*gltexture->buffer_width);
for (x=0;x<gltexture->realtexwidth;x++,pos++)
{
#ifdef RANGECHECK
if (pos>=gltexture->buffer_size)
{
lprintf(LO_ERROR,"gld_AddFlatToTexture pos>=size (%i >= %i)\n",pos,gltexture->buffer_size);
return;
}
#endif
buffer[pos]=gld_palmap[flat[y*64+x]];
}
}
} else {
playpal=W_CacheLumpName("PLAYPAL");
for (y=0;y<gltexture->realtexheight;y++)
{
pos=4*(y*gltexture->buffer_width);
for (x=0;x<gltexture->realtexwidth;x++,pos+=4)
{
#ifdef RANGECHECK
if ((pos+3)>=gltexture->buffer_size)
{
lprintf(LO_ERROR,"gld_AddFlatToTexture pos+3>=size (%i >= %i)\n",pos+3,gltexture->buffer_size);
return;
}
#endif
buffer[pos]=playpal[flat[y*64+x]*3];
buffer[pos+1]=playpal[flat[y*64+x]*3+1];
buffer[pos+2]=playpal[flat[y*64+x]*3+2];
buffer[pos+3]=255;
}
}
W_UnlockLumpName("PLAYPAL");
}
}
//e6y: "force" flag for loading texture with zero index
GLTexture *gld_RegisterTexture(int texture_num, boolean mipmap, boolean force)
{
GLTexture *gltexture;
//e6y: textures with zero index should be loaded sometimes
if (texture_num==NO_TEXTURE && !force)
return NULL;
gltexture=gld_AddNewGLTexture(texture_num);
if (!gltexture)
return NULL;
if (gltexture->textype==GLDT_UNREGISTERED)
{
texture_t *texture=NULL;
if ((texture_num>=0) || (texture_num<numtextures))
texture=textures[texture_num];
if (!texture)
return NULL;
gltexture->textype=GLDT_BROKEN;
gltexture->index=texture_num;
gltexture->mipmap=mipmap;
gltexture->realtexwidth=texture->width;
gltexture->realtexheight=texture->height;
gltexture->leftoffset=0;
gltexture->topoffset=0;
gltexture->tex_width=gld_GetTexDimension(gltexture->realtexwidth);
gltexture->tex_height=gld_GetTexDimension(gltexture->realtexheight);
gltexture->width=MIN(gltexture->realtexwidth, gltexture->tex_width);
gltexture->height=MIN(gltexture->realtexheight, gltexture->tex_height);
gltexture->buffer_width=gltexture->tex_width;
gltexture->buffer_height=gltexture->tex_height;
#ifdef USE_GLU_IMAGESCALE
gltexture->width=gltexture->tex_width;
gltexture->height=gltexture->tex_height;
gltexture->buffer_width=gltexture->realtexwidth;
gltexture->buffer_height=gltexture->realtexheight;
#endif
if (gltexture->mipmap & use_mipmapping)
{
gltexture->width=gltexture->tex_width;
gltexture->height=gltexture->tex_height;
gltexture->buffer_width=gltexture->realtexwidth;
gltexture->buffer_height=gltexture->realtexheight;
}
gltexture->buffer_size=gltexture->buffer_width*gltexture->buffer_height*4;
if (gltexture->realtexwidth>gltexture->buffer_width)
return gltexture;
if (gltexture->realtexheight>gltexture->buffer_height)
return gltexture;
gltexture->textype=GLDT_TEXTURE;
}
return gltexture;
}
void gld_BindTexture(GLTexture *gltexture)
{
const rpatch_t *patch;
int i;
unsigned char *buffer;
if (gltexture==last_gltexture)
return;
last_gltexture=gltexture;
if (!gltexture) {
glBindTexture(GL_TEXTURE_2D, 0);
last_gltexture = NULL;
last_cm = -1;
return;
}
if (gltexture->textype!=GLDT_TEXTURE)
{
glBindTexture(GL_TEXTURE_2D, 0);
last_gltexture = NULL;
last_cm = -1;
return;
}
if (gltexture->glTexID[CR_DEFAULT]!=0)
{
glBindTexture(GL_TEXTURE_2D, gltexture->glTexID[CR_DEFAULT]);
glGetTexParameteriv(GL_TEXTURE_2D,GL_TEXTURE_RESIDENT,&i);
#ifdef _DEBUG
if (i!=GL_TRUE)
lprintf(LO_INFO, "glGetTexParam: %i\n", i);
#endif
if (i==GL_TRUE)
return;
}
buffer=(unsigned char*)Z_Malloc(gltexture->buffer_size,PU_STATIC,0);
if (!(gltexture->mipmap & use_mipmapping) & gl_paletted_texture)
memset(buffer,transparent_pal_index,gltexture->buffer_size);
else
memset(buffer,0,gltexture->buffer_size);
patch=R_CacheTextureCompositePatchNum(gltexture->index);
gld_AddPatchToTexture(gltexture, buffer, patch,
0, 0,
CR_DEFAULT, !(gltexture->mipmap & use_mipmapping) & gl_paletted_texture);
R_UnlockTextureCompositePatchNum(gltexture->index);
if (gltexture->glTexID[CR_DEFAULT]==0)
glGenTextures(1,&gltexture->glTexID[CR_DEFAULT]);
glBindTexture(GL_TEXTURE_2D, gltexture->glTexID[CR_DEFAULT]);
#ifdef USE_GLU_MIPMAP
if (gltexture->mipmap & use_mipmapping)
{
gluBuild2DMipmaps(GL_TEXTURE_2D, gl_tex_format,
gltexture->buffer_width, gltexture->buffer_height,
GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_mipmap_filter);
if (gl_texture_filter_anisotropic)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0);
}
else
#endif /* USE_GLU_MIPMAP */
{
#ifdef USE_GLU_IMAGESCALE
if ((gltexture->buffer_width!=gltexture->tex_width) ||
(gltexture->buffer_height!=gltexture->tex_height)
)
{
unsigned char *scaledbuffer;
scaledbuffer=(unsigned char*)Z_Malloc(gltexture->tex_width*gltexture->tex_height*4,PU_STATIC,0);
if (scaledbuffer)
{
gluScaleImage(GL_RGBA,
gltexture->buffer_width, gltexture->buffer_height,
GL_UNSIGNED_BYTE,buffer,
gltexture->tex_width, gltexture->tex_height,
GL_UNSIGNED_BYTE,scaledbuffer);
Z_Free(buffer);
buffer=scaledbuffer;
glTexImage2D( GL_TEXTURE_2D, 0, gl_tex_format,
gltexture->tex_width, gltexture->tex_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
}
else
#endif /* USE_GLU_IMAGESCALE */
{
if (gl_paletted_texture) {
gld_SetTexturePalette(GL_TEXTURE_2D);
glTexImage2D( GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
gltexture->buffer_width, gltexture->buffer_height,
0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, buffer);
} else {
glTexImage2D( GL_TEXTURE_2D, 0, gl_tex_format,
gltexture->buffer_width, gltexture->buffer_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_tex_filter);
}
Z_Free(buffer);
}
GLTexture *gld_RegisterPatch(int lump, int cm)
{
const rpatch_t *patch;
GLTexture *gltexture;
gltexture=gld_AddNewGLPatchTexture(lump);
if (!gltexture)
return NULL;
if (gltexture->textype==GLDT_UNREGISTERED)
{
patch=R_CachePatchNum(lump);
if (!patch)
return NULL;
gltexture->textype=GLDT_BROKEN;
gltexture->index=lump;
gltexture->mipmap=false;
gltexture->realtexwidth=patch->width;
gltexture->realtexheight=patch->height;
gltexture->leftoffset=patch->leftoffset;
gltexture->topoffset=patch->topoffset;
gltexture->tex_width=gld_GetTexDimension(gltexture->realtexwidth);
gltexture->tex_height=gld_GetTexDimension(gltexture->realtexheight);
gltexture->width=MIN(gltexture->realtexwidth, gltexture->tex_width);
gltexture->height=MIN(gltexture->realtexheight, gltexture->tex_height);
gltexture->buffer_width=gltexture->tex_width;
gltexture->buffer_height=gltexture->tex_height;
#ifdef USE_GLU_IMAGESCALE
gltexture->width=MIN(gltexture->realtexwidth, gltexture->tex_width);
gltexture->height=MIN(gltexture->realtexheight, gltexture->tex_height);
gltexture->buffer_width=MAX(gltexture->realtexwidth, gltexture->tex_width);
gltexture->buffer_height=MAX(gltexture->realtexheight, gltexture->tex_height);
#endif
gltexture->buffer_size=gltexture->buffer_width*gltexture->buffer_height*4;
R_UnlockPatchNum(lump);
if (gltexture->realtexwidth>gltexture->buffer_width)
return gltexture;
if (gltexture->realtexheight>gltexture->buffer_height)
return gltexture;
gltexture->textype=GLDT_PATCH;
}
return gltexture;
}
void gld_BindPatch(GLTexture *gltexture, int cm)
{
const rpatch_t *patch;
int i;
unsigned char *buffer;
if ((gltexture==last_gltexture) && (cm==last_cm))
return;
last_gltexture=gltexture;
last_cm=cm;
if (!gltexture)
return;
if (gltexture->textype!=GLDT_PATCH)
{
glBindTexture(GL_TEXTURE_2D, 0);
last_gltexture = NULL;
last_cm = -1;
return;
}
if (gltexture->glTexID[cm]!=0)
{
glBindTexture(GL_TEXTURE_2D, gltexture->glTexID[cm]);
glGetTexParameteriv(GL_TEXTURE_2D,GL_TEXTURE_RESIDENT,&i);
#ifdef _DEBUG
if (i!=GL_TRUE)
lprintf(LO_INFO, "glGetTexParam: %i\n", i);
#endif
if (i==GL_TRUE)
return;
}
patch=R_CachePatchNum(gltexture->index);
buffer=(unsigned char*)Z_Malloc(gltexture->buffer_size,PU_STATIC,0);
if (gl_paletted_texture)
memset(buffer,transparent_pal_index,gltexture->buffer_size);
else
memset(buffer,0,gltexture->buffer_size);
gld_AddPatchToTexture(gltexture, buffer, patch, 0, 0, cm, gl_paletted_texture);
if (gltexture->glTexID[cm]==0)
glGenTextures(1,&gltexture->glTexID[cm]);
glBindTexture(GL_TEXTURE_2D, gltexture->glTexID[cm]);
#ifdef USE_GLU_IMAGESCALE
if ((gltexture->buffer_width>gltexture->tex_width) ||
(gltexture->buffer_height>gltexture->tex_height)
)
{
unsigned char *scaledbuffer;
scaledbuffer=(unsigned char*)Z_Malloc(gltexture->tex_width*gltexture->tex_height*4,PU_STATIC,0);
if (scaledbuffer)
{
gluScaleImage(GL_RGBA,
gltexture->buffer_width, gltexture->buffer_height,
GL_UNSIGNED_BYTE,buffer,
gltexture->tex_width, gltexture->tex_height,
GL_UNSIGNED_BYTE,scaledbuffer);
Z_Free(buffer);
buffer=scaledbuffer;
glTexImage2D( GL_TEXTURE_2D, 0, gl_tex_format,
gltexture->tex_width, gltexture->tex_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
}
else
#endif /* USE_GLU_IMAGESCALE */
{
if (gl_paletted_texture) {
gld_SetTexturePalette(GL_TEXTURE_2D);
glTexImage2D( GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
gltexture->buffer_width, gltexture->buffer_height,
0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, buffer);
} else {
glTexImage2D( GL_TEXTURE_2D, 0, gl_tex_format,
gltexture->buffer_width, gltexture->buffer_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_tex_filter);
Z_Free(buffer);
R_UnlockPatchNum(gltexture->index);
}
GLTexture *gld_RegisterFlat(int lump, boolean mipmap)
{
GLTexture *gltexture;
gltexture=gld_AddNewGLPatchTexture(firstflat+lump);
if (!gltexture)
return NULL;
if (gltexture->textype==GLDT_UNREGISTERED)
{
gltexture->textype=GLDT_BROKEN;
gltexture->index=firstflat+lump;
gltexture->mipmap=mipmap;
gltexture->realtexwidth=64;
gltexture->realtexheight=64;
gltexture->leftoffset=0;
gltexture->topoffset=0;
gltexture->tex_width=gld_GetTexDimension(gltexture->realtexwidth);
gltexture->tex_height=gld_GetTexDimension(gltexture->realtexheight);
gltexture->width=MIN(gltexture->realtexwidth, gltexture->tex_width);
gltexture->height=MIN(gltexture->realtexheight, gltexture->tex_height);
gltexture->buffer_width=gltexture->tex_width;
gltexture->buffer_height=gltexture->tex_height;
#ifdef USE_GLU_IMAGESCALE
gltexture->width=gltexture->tex_width;
gltexture->height=gltexture->tex_height;
gltexture->buffer_width=gltexture->realtexwidth;
gltexture->buffer_height=gltexture->realtexheight;
#endif
if (gltexture->mipmap & use_mipmapping)
{
gltexture->width=gltexture->tex_width;
gltexture->height=gltexture->tex_height;
gltexture->buffer_width=gltexture->realtexwidth;
gltexture->buffer_height=gltexture->realtexheight;
}
gltexture->buffer_size=gltexture->buffer_width*gltexture->buffer_height*4;
if (gltexture->realtexwidth>gltexture->buffer_width)
return gltexture;
if (gltexture->realtexheight>gltexture->buffer_height)
return gltexture;
gltexture->textype=GLDT_FLAT;
}
return gltexture;
}
void gld_BindFlat(GLTexture *gltexture)
{
const unsigned char *flat;
int i;
unsigned char *buffer;
if (gltexture==last_gltexture)
return;
last_gltexture=gltexture;
if (!gltexture)
return;
if (gltexture->textype!=GLDT_FLAT)
{
glBindTexture(GL_TEXTURE_2D, 0);
last_gltexture = NULL;
last_cm = -1;
return;
}
if (gltexture->glTexID[CR_DEFAULT]!=0)
{
glBindTexture(GL_TEXTURE_2D, gltexture->glTexID[CR_DEFAULT]);
glGetTexParameteriv(GL_TEXTURE_2D,GL_TEXTURE_RESIDENT,&i);
#ifdef _DEBUG
if (i!=GL_TRUE)
lprintf(LO_INFO, "glGetTexParam: %i\n", i);
#endif
if (i==GL_TRUE)
return;
}
flat=W_CacheLumpNum(gltexture->index);
buffer=(unsigned char*)Z_Malloc(gltexture->buffer_size,PU_STATIC,0);
if (!(gltexture->mipmap & use_mipmapping) & gl_paletted_texture)
memset(buffer,transparent_pal_index,gltexture->buffer_size);
else
memset(buffer,0,gltexture->buffer_size);
gld_AddFlatToTexture(gltexture, buffer, flat, !(gltexture->mipmap & use_mipmapping) & gl_paletted_texture);
if (gltexture->glTexID[CR_DEFAULT]==0)
glGenTextures(1,&gltexture->glTexID[CR_DEFAULT]);
glBindTexture(GL_TEXTURE_2D, gltexture->glTexID[CR_DEFAULT]);
#ifdef USE_GLU_MIPMAP
if (gltexture->mipmap & use_mipmapping)
{
gluBuild2DMipmaps(GL_TEXTURE_2D, gl_tex_format,
gltexture->buffer_width, gltexture->buffer_height,
GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_mipmap_filter);
if (gl_texture_filter_anisotropic)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0);
}
else
#endif /* USE_GLU_MIPMAP */
{
#ifdef USE_GLU_IMAGESCALE
if ((gltexture->buffer_width!=gltexture->tex_width) ||
(gltexture->buffer_height!=gltexture->tex_height)
)
{
unsigned char *scaledbuffer;
scaledbuffer=(unsigned char*)Z_Malloc(gltexture->tex_width*gltexture->tex_height*4,PU_STATIC,0);
if (scaledbuffer)
{
gluScaleImage(GL_RGBA,
gltexture->buffer_width, gltexture->buffer_height,
GL_UNSIGNED_BYTE,buffer,
gltexture->tex_width, gltexture->tex_height,
GL_UNSIGNED_BYTE,scaledbuffer);
Z_Free(buffer);
buffer=scaledbuffer;
glTexImage2D( GL_TEXTURE_2D, 0, gl_tex_format,
gltexture->tex_width, gltexture->tex_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
}
else
#endif /* USE_GLU_IMAGESCALE */
{
if (gl_paletted_texture) {
gld_SetTexturePalette(GL_TEXTURE_2D);
glTexImage2D( GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
gltexture->buffer_width, gltexture->buffer_height,
0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, buffer);
} else {
glTexImage2D( GL_TEXTURE_2D, 0, gl_tex_format,
gltexture->buffer_width, gltexture->buffer_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_tex_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_tex_filter);
}
Z_Free(buffer);
W_UnlockLumpNum(gltexture->index);
}
static void gld_CleanTextures(void)
{
int i,j;
if (!gld_GLTextures)
return;
for (i=0; i<numtextures; i++)
{
if (gld_GLTextures[i])
{
for (j=0; j<(CR_LIMIT+MAXPLAYERS); j++)
glDeleteTextures(1,&(gld_GLTextures[i]->glTexID[j]));
Z_Free(gld_GLTextures[i]);
}
}
memset(gld_GLTextures,0,numtextures*sizeof(GLTexture *));
}
static void gld_CleanPatchTextures(void)
{
int i,j;
if (!gld_GLPatchTextures)
return;
for (i=0; i<numlumps; i++)
{
if (gld_GLPatchTextures[i])
{
for (j=0; j<(CR_LIMIT+MAXPLAYERS); j++)
glDeleteTextures(1,&(gld_GLPatchTextures[i]->glTexID[j]));
Z_Free(gld_GLPatchTextures[i]);
}
}
memset(gld_GLPatchTextures,0,numlumps*sizeof(GLTexture *));
}
void gld_Precache(void)
{
register int i;
register byte *hitlist;
if (demoplayback)
return;
{
size_t size = numflats > numsprites ? numflats : numsprites;
hitlist = Z_Malloc((size_t)numtextures > size ? numtextures : size,PU_LEVEL,0);
}
// Precache flats.
memset(hitlist, 0, numflats);
for (i = numsectors; --i >= 0; )
hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1;
for (i = numflats; --i >= 0; )
if (hitlist[i])
gld_BindFlat(gld_RegisterFlat(i,true));
// Precache textures.
memset(hitlist, 0, numtextures);
for (i = numsides; --i >= 0;)
hitlist[sides[i].bottomtexture] =
hitlist[sides[i].toptexture] =
hitlist[sides[i].midtexture] = 1;
// Sky texture is always present.
// Note that F_SKY1 is the name used to
// indicate a sky floor/ceiling as a flat,
// while the sky texture is stored like
// a wall texture, with an episode dependend
// name.
hitlist[skytexture] = 0;
for (i = numtextures; --i >= 0; )
if (hitlist[i])
gld_BindTexture(gld_RegisterTexture(i,true,false));
// Precache sprites.
memset(hitlist, 0, numsprites);
{
thinker_t *th;
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
if (th->function == P_MobjThinker)
hitlist[((mobj_t *)th)->sprite] = 1;
}
for (i=numsprites; --i >= 0;)
if (hitlist[i])
{
int j = sprites[i].numframes;
while (--j >= 0)
{
short *sflump = sprites[i].spriteframes[j].lump;
int k = 7;
do
gld_BindPatch(gld_RegisterPatch(firstspritelump + sflump[k],CR_DEFAULT),CR_DEFAULT);
while (--k >= 0);
}
}
Z_Free(hitlist);
}
void gld_CleanMemory(void)
{
gld_CleanTextures();
gld_CleanPatchTextures();
}
#endif

767
components/prboom/hu_lib.c Normal file
View File

@@ -0,0 +1,767 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION: heads-up text and input code
*
*-----------------------------------------------------------------------------
*/
#include "doomdef.h"
#include "doomstat.h"
#include "v_video.h"
#include "m_swap.h"
#include "hu_lib.h"
#include "hu_stuff.h"
#include "r_main.h"
#include "r_draw.h"
// boolean : whether the screen is always erased
#define noterased viewwindowx
extern int key_backspace; // phares
extern int key_enter; // phares
//
// not used currently
// code to initialize HUlib would go here if needed
//
static void HUlib_init(void)
{
}
////////////////////////////////////////////////////////
//
// Basic text line widget
//
////////////////////////////////////////////////////////
//
// HUlib_clearTextLine()
//
// Blank the internal text line in a hu_textline_t widget
//
// Passed a hu_textline_t, returns nothing
//
void HUlib_clearTextLine(hu_textline_t* t)
{
t->linelen = // killough 1/23 98: support multiple lines
t->len = 0;
t->l[0] = 0;
t->needsupdate = true;
}
//
// HUlib_initTextLine()
//
// Initialize a hu_textline_t widget. Set the position, font, start char
// of the font, and color range to be used.
//
// Passed a hu_textline_t, and the values used to initialize
// Returns nothing
//
void HUlib_initTextLine(hu_textline_t* t, int x, int y,
const patchnum_t* f, int sc, int cm )
//jff 2/16/98 add color range parameter
{
t->x = x;
t->y = y;
t->f = f;
t->sc = sc;
t->cm = cm;
HUlib_clearTextLine(t);
}
//
// HUlib_addCharToTextLine()
//
// Adds a character at the end of the text line in a hu_textline_t widget
//
// Passed the hu_textline_t and the char to add
// Returns false if already at length limit, true if the character added
//
boolean HUlib_addCharToTextLine
( hu_textline_t* t,
char ch )
{
// killough 1/23/98 -- support multiple lines
if (t->linelen == HU_MAXLINELENGTH)
return false;
else
{
t->linelen++;
if (ch == '\n')
t->linelen=0;
t->l[t->len++] = ch;
t->l[t->len] = 0;
t->needsupdate = 4;
return true;
}
}
//
// HUlib_delCharFromTextLine()
//
// Deletes a character at the end of the text line in a hu_textline_t widget
//
// Passed the hu_textline_t
// Returns false if already empty, true if the character deleted
//
static boolean HUlib_delCharFromTextLine(hu_textline_t* t)
{
if (!t->len) return false;
else
{
t->l[--t->len] = 0;
t->needsupdate = 4;
return true;
}
}
//
// HUlib_drawTextLine()
//
// Draws a hu_textline_t widget
//
// Passed the hu_textline_t and flag whether to draw a cursor
// Returns nothing
//
void HUlib_drawTextLine
( hu_textline_t* l,
boolean drawcursor )
{
int i;
int w;
int x;
unsigned char c;
int oc = l->cm; //jff 2/17/98 remember default color
int y = l->y; // killough 1/18/98 -- support multiple lines
// draw the new stuff
x = l->x;
for (i=0;i<l->len;i++)
{
c = toupper(l->l[i]); //jff insure were not getting a cheap toupper conv.
if (c=='\n') // killough 1/18/98 -- support multiple lines
x=0,y+=8;
else if (c=='\t') // killough 1/23/98 -- support tab stops
x=x-x%80+80;
else if (c=='\x1b') //jff 2/17/98 escape code for color change
{ //jff 3/26/98 changed to actual escape char
if (++i<l->len)
if (l->l[i]>='0' && l->l[i]<='9')
l->cm = l->l[i]-'0';
}
else if (c != ' ' && c >= l->sc && c <= 127)
{
w = l->f[c - l->sc].width;
if (x+w > BASE_WIDTH)
break;
// killough 1/18/98 -- support multiple lines:
// CPhipps - patch drawing updated
V_DrawNumPatch(x, y, FG, l->f[c - l->sc].lumpnum, l->cm, VPT_TRANS | VPT_STRETCH);
x += w;
}
else
{
x += 4;
if (x >= BASE_WIDTH)
break;
}
}
l->cm = oc; //jff 2/17/98 restore original color
// draw the cursor if requested
if (drawcursor && x + l->f['_' - l->sc].width <= BASE_WIDTH)
{
// killough 1/18/98 -- support multiple lines
// CPhipps - patch drawing updated
V_DrawNumPatch(x, y, FG, l->f['_' - l->sc].lumpnum, CR_DEFAULT, VPT_NONE | VPT_STRETCH);
}
}
//
// HUlib_eraseTextLine()
//
// Erases a hu_textline_t widget when screen border is behind text
// Sorta called by HU_Erase and just better darn get things straight
//
// Passed the hu_textline_t
// Returns nothing
//
void HUlib_eraseTextLine(hu_textline_t* l)
{
int lh;
int y;
// Only erases when NOT in automap and the screen is reduced,
// and the text must either need updating or refreshing
// (because of a recent change back from the automap)
if (!(automapmode & am_active) && viewwindowx && l->needsupdate)
{
lh = l->f[0].height + 1;
for (y=l->y; y<l->y+lh ; y++)
{
if (y < viewwindowy || y >= viewwindowy + viewheight)
R_VideoErase(0, y, SCREENWIDTH); // erase entire line
else
{
// erase left border
R_VideoErase(0, y, viewwindowx);
// erase right border
R_VideoErase(viewwindowx + viewwidth, y, viewwindowx);
}
}
}
if (l->needsupdate) l->needsupdate--;
}
////////////////////////////////////////////////////////
//
// Player message widget (up to 4 lines of text)
//
////////////////////////////////////////////////////////
//
// HUlib_initSText()
//
// Initialize a hu_stext_t widget. Set the position, number of lines, font,
// start char of the font, and color range to be used, and whether enabled.
//
// Passed a hu_stext_t, and the values used to initialize
// Returns nothing
//
void HUlib_initSText
( hu_stext_t* s,
int x,
int y,
int h,
const patchnum_t* font,
int startchar,
int cm, //jff 2/16/98 add color range parameter
boolean* on )
{
int i;
s->h = h;
s->on = on;
s->laston = true;
s->cl = 0;
for (i=0;i<h;i++)
HUlib_initTextLine
(
&s->l[i],
x,
y - i*(font[0].height+1),
font,
startchar,
cm
);
}
//
// HUlib_addLineToSText()
//
// Adds a blank line to a hu_stext_t widget
//
// Passed a hu_stext_t
// Returns nothing
//
static void HUlib_addLineToSText(hu_stext_t* s)
{
int i;
// add a clear line
if (++s->cl == s->h)
s->cl = 0;
HUlib_clearTextLine(&s->l[s->cl]);
// everything needs updating
for (i=0 ; i<s->h ; i++)
s->l[i].needsupdate = 4;
}
//
// HUlib_addMessageToSText()
//
// Adds a message line with prefix to a hu_stext_t widget
//
// Passed a hu_stext_t, the prefix string, and a message string
// Returns nothing
//
void HUlib_addMessageToSText(hu_stext_t* s, const char* prefix, const char* msg)
{
HUlib_addLineToSText(s);
if (prefix)
while (*prefix)
HUlib_addCharToTextLine(&s->l[s->cl], *(prefix++));
while (*msg)
HUlib_addCharToTextLine(&s->l[s->cl], *(msg++));
}
//
// HUlib_drawSText()
//
// Displays a hu_stext_t widget
//
// Passed a hu_stext_t
// Returns nothing
//
void HUlib_drawSText(hu_stext_t* s)
{
int i, idx;
hu_textline_t *l;
if (!*s->on)
return; // if not on, don't draw
// draw everything
for (i=0 ; i<s->h ; i++)
{
idx = s->cl - i;
if (idx < 0)
idx += s->h; // handle queue of lines
l = &s->l[idx];
// need a decision made here on whether to skip the draw
HUlib_drawTextLine(l, false); // no cursor, please
}
}
//
// HUlib_eraseSText()
//
// Erases a hu_stext_t widget, when the screen is not fullsize
//
// Passed a hu_stext_t
// Returns nothing
//
void HUlib_eraseSText(hu_stext_t* s)
{
int i;
for (i=0 ; i<s->h ; i++)
{
if (s->laston && !*s->on)
s->l[i].needsupdate = 4;
HUlib_eraseTextLine(&s->l[i]);
}
s->laston = *s->on;
}
////////////////////////////////////////////////////////
//
// Scrolling message review widget
//
// jff added 2/26/98
//
////////////////////////////////////////////////////////
//
// HUlib_initMText()
//
// Initialize a hu_mtext_t widget. Set the position, width, number of lines,
// font, start char of the font, color range, background font, and whether
// enabled.
//
// Passed a hu_mtext_t, and the values used to initialize
// Returns nothing
//
void HUlib_initMText(hu_mtext_t *m, int x, int y, int w, int h,
const patchnum_t* font, int startchar, int cm,
const patchnum_t* bgfont, boolean *on)
{
int i;
m->nl = 0;
m->nr = 0;
m->cl = -1; //jff 4/28/98 prepare for pre-increment
m->x = x;
m->y = y;
m->w = w;
m->h = h;
m->bg = bgfont;
m->on = on;
for (i=0;i<HU_MAXMESSAGES;i++)
{
HUlib_initTextLine
(
&m->l[i],
x,
y + (hud_list_bgon? i+1 : i)*HU_REFRESHSPACING,
font,
startchar,
cm
);
}
}
//
// HUlib_addLineToMText()
//
// Adds a blank line to a hu_mtext_t widget
//
// Passed a hu_mtext_t
// Returns nothing
//
static void HUlib_addLineToMText(hu_mtext_t* m)
{
// add a clear line
if (++m->cl == hud_msg_lines)
m->cl = 0;
HUlib_clearTextLine(&m->l[m->cl]);
if (m->nl<hud_msg_lines)
m->nl++;
// needs updating
m->l[m->cl].needsupdate = 4;
}
//
// HUlib_addMessageToMText()
//
// Adds a message line with prefix to a hu_mtext_t widget
//
// Passed a hu_mtext_t, the prefix string, and a message string
// Returns nothing
//
void HUlib_addMessageToMText(hu_mtext_t* m, const char* prefix, const char* msg)
{
HUlib_addLineToMText(m);
if (prefix)
while (*prefix)
HUlib_addCharToTextLine(&m->l[m->cl], *(prefix++));
while (*msg)
HUlib_addCharToTextLine(&m->l[m->cl], *(msg++));
}
//
// HUlib_drawMBg()
//
// Draws a background box which the message display review widget can
// display over
//
// Passed position, width, height, and the background patches
// Returns nothing
//
void HUlib_drawMBg
( int x,
int y,
int w,
int h,
const patchnum_t* bgp
)
{
int xs = bgp[0].width;
int ys = bgp[0].height;
int i,j;
// CPhipps - patch drawing updated
// top rows
V_DrawNumPatch(x, y, FG, bgp[0].lumpnum, CR_DEFAULT, VPT_STRETCH); // ul
for (j=x+xs;j<x+w-xs;j+=xs) // uc
V_DrawNumPatch(j, y, FG, bgp[1].lumpnum, CR_DEFAULT, VPT_STRETCH);
V_DrawNumPatch(j, y, FG, bgp[2].lumpnum, CR_DEFAULT, VPT_STRETCH); // ur
// middle rows
for (i=y+ys;i<y+h-ys;i+=ys)
{
V_DrawNumPatch(x, i, FG, bgp[3].lumpnum, CR_DEFAULT, VPT_STRETCH); // cl
for (j=x+xs;j<x+w-xs;j+=xs) // cc
V_DrawNumPatch(j, i, FG, bgp[4].lumpnum, CR_DEFAULT, VPT_STRETCH);
V_DrawNumPatch(j, i, FG, bgp[5].lumpnum, CR_DEFAULT, VPT_STRETCH); // cr
}
// bottom row
V_DrawNumPatch(x, i, FG, bgp[6].lumpnum, CR_DEFAULT, VPT_STRETCH); // ll
for (j=x+xs;j<x+w-xs;j+=xs) // lc
V_DrawNumPatch(j, i, FG, bgp[7].lumpnum, CR_DEFAULT, VPT_STRETCH);
V_DrawNumPatch(j, i, FG, bgp[8].lumpnum, CR_DEFAULT, VPT_STRETCH); // lr
}
//
// HUlib_drawMText()
//
// Displays a hu_mtext_t widget
//
// Passed a hu_mtext_t
// Returns nothing
//
void HUlib_drawMText(hu_mtext_t* m)
{
int i, idx, y;
hu_textline_t *l;
if (!*m->on)
return; // if not on, don't draw
// draw everything
if (hud_list_bgon)
HUlib_drawMBg(m->x,m->y,m->w,m->h,m->bg);
y = m->y + HU_REFRESHSPACING;
for (i=0 ; i<m->nl ; i++)
{
idx = m->cl - i;
if (idx < 0)
idx += m->nl; // handle queue of lines
l = &m->l[idx];
if (hud_list_bgon)
{
l->x = m->x + 4;
l->y = m->y + (i+1)*HU_REFRESHSPACING;
}
else
{
l->x = m->x;
l->y = m->y + i*HU_REFRESHSPACING;
}
// need a decision made here on whether to skip the draw
HUlib_drawTextLine(l, false); // no cursor, please
}
}
//
// HUlib_eraseMBg()
//
// Erases background behind hu_mtext_t widget, when the screen is not fullsize
//
// Passed a hu_mtext_t
// Returns nothing
//
static void HUlib_eraseMBg(hu_mtext_t* m)
{
int lh;
int y;
// Only erases when NOT in automap and the screen is reduced,
// and the text must either need updating or refreshing
// (because of a recent change back from the automap)
if (!(automapmode & am_active) && viewwindowx)
{
lh = m->l[0].f[0].height + 1;
for (y=m->y; y<m->y+lh*(hud_msg_lines+2) ; y++)
{
if (y < viewwindowy || y >= viewwindowy + viewheight)
R_VideoErase(0, y, SCREENWIDTH); // erase entire line
else
{
// erase left border
R_VideoErase(0, y, viewwindowx);
// erase right border
R_VideoErase(viewwindowx + viewwidth, y, viewwindowx);
}
}
}
}
//
// HUlib_eraseMText()
//
// Erases a hu_mtext_t widget, when the screen is not fullsize
//
// Passed a hu_mtext_t
// Returns nothing
//
void HUlib_eraseMText(hu_mtext_t* m)
{
int i;
if (hud_list_bgon)
HUlib_eraseMBg(m);
for (i=0 ; i< m->nl ; i++)
{
m->l[i].needsupdate = 4;
HUlib_eraseTextLine(&m->l[i]);
}
}
////////////////////////////////////////////////////////
//
// Interactive text entry widget
//
////////////////////////////////////////////////////////
//
// HUlib_initIText()
//
// Initialize a hu_itext_t widget. Set the position, font,
// start char of the font, color range, and whether enabled.
//
// Passed a hu_itext_t, and the values used to initialize
// Returns nothing
//
void HUlib_initIText
( hu_itext_t* it,
int x,
int y,
const patchnum_t* font,
int startchar,
int cm, //jff 2/16/98 add color range parameter
boolean* on )
{
it->lm = 0; // default left margin is start of text
it->on = on;
it->laston = true;
HUlib_initTextLine(&it->l, x, y, font, startchar, cm);
}
// The following deletion routines adhere to the left margin restriction
//
// HUlib_delCharFromIText()
//
// Deletes a character at the end of the text line in a hu_itext_t widget
//
// Passed the hu_itext_t
// Returns nothing
//
static void HUlib_delCharFromIText(hu_itext_t* it)
{
if (it->l.len != it->lm)
HUlib_delCharFromTextLine(&it->l);
}
//
// HUlib_eraseLineFromIText()
//
// Deletes all characters from a hu_itext_t widget
//
// Passed the hu_itext_t
// Returns nothing
//
static void HUlib_eraseLineFromIText(hu_itext_t* it)
{
while (it->lm != it->l.len)
HUlib_delCharFromTextLine(&it->l);
}
//
// HUlib_resetIText()
//
// Deletes all characters from a hu_itext_t widget
// Resets left margin as well
//
// Passed the hu_itext_t
// Returns nothing
//
void HUlib_resetIText(hu_itext_t* it)
{
it->lm = 0;
HUlib_clearTextLine(&it->l);
}
//
// HUlib_addPrefixToIText()
//
// Adds a prefix string passed to a hu_itext_t widget
// Sets left margin to length of string added
//
// Passed the hu_itext_t and the prefix string
// Returns nothing
//
void HUlib_addPrefixToIText
( hu_itext_t* it,
char* str )
{
while (*str)
HUlib_addCharToTextLine(&it->l, *(str++));
it->lm = it->l.len;
}
//
// HUlib_keyInIText()
//
// Wrapper function for handling general keyed input.
//
// Passed the hu_itext_t and the char input
// Returns true if it ate the key
//
boolean HUlib_keyInIText
( hu_itext_t* it,
unsigned char ch )
{
if (ch >= ' ' && ch <= '_')
HUlib_addCharToTextLine(&it->l, (char) ch);
else if (ch == key_backspace) // phares
HUlib_delCharFromIText(it);
else if (ch != key_enter) // phares
return false; // did not eat key
return true; // ate the key
}
//
// HUlib_drawIText()
//
// Displays a hu_itext_t widget
//
// Passed the hu_itext_t
// Returns nothing
//
void HUlib_drawIText(hu_itext_t* it)
{
hu_textline_t *l = &it->l;
if (!*it->on)
return;
HUlib_drawTextLine(l, true); // draw the line w/ cursor
}
//
// HUlib_eraseIText()
//
// Erases a hu_itext_t widget when the screen is not fullsize
//
// Passed the hu_itext_t
// Returns nothing
//
void HUlib_eraseIText(hu_itext_t* it)
{
if (it->laston && !*it->on)
it->l.needsupdate = 4;
HUlib_eraseTextLine(&it->l);
it->laston = *it->on;
}

1593
components/prboom/hu_stuff.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* AutoMap module.
*
*-----------------------------------------------------------------------------*/
#ifndef __AMMAP_H__
#define __AMMAP_H__
#include "d_event.h"
#define MAPBITS 12
#define FRACTOMAPBITS (FRACBITS-MAPBITS)
// Used by ST StatusBar stuff.
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
// Called by main loop.
boolean AM_Responder (event_t* ev);
// Called by main loop.
void AM_Ticker (void);
// Called by main loop,
// called instead of view drawer if automap active.
void AM_Drawer (void);
// Called to force the automap to quit
// if the level is completed while it is up.
void AM_Stop (void);
// killough 2/22/98: for saving automap information in savegame:
extern void AM_Start(void);
//jff 4/16/98 make externally available
extern void AM_clearMarks(void);
typedef struct
{
fixed_t x,y;
} mpoint_t;
extern mpoint_t *markpoints;
extern int markpointnum, markpointnum_max;
// end changes -- killough 2/22/98
// killough 5/2/98: moved from m_misc.c
//jff 1/7/98 automap colors added
extern int mapcolor_back; // map background
extern int mapcolor_grid; // grid lines color
extern int mapcolor_wall; // normal 1s wall color
extern int mapcolor_fchg; // line at floor height change color
extern int mapcolor_cchg; // line at ceiling height change color
extern int mapcolor_clsd; // line at sector with floor=ceiling color
extern int mapcolor_rkey; // red key color
extern int mapcolor_bkey; // blue key color
extern int mapcolor_ykey; // yellow key color
extern int mapcolor_rdor; // red door color (diff from keys to allow option)
extern int mapcolor_bdor; // blue door color (of enabling one not other)
extern int mapcolor_ydor; // yellow door color
extern int mapcolor_tele; // teleporter line color
extern int mapcolor_secr; // secret sector boundary color
//jff 4/23/98
extern int mapcolor_exit; // exit line
extern int mapcolor_unsn; // computer map unseen line color
extern int mapcolor_flat; // line with no floor/ceiling changes
extern int mapcolor_sprt; // general sprite color
extern int mapcolor_item; // item sprite color
extern int mapcolor_enemy; // enemy sprite color
extern int mapcolor_frnd; // friendly sprite color
extern int mapcolor_hair; // crosshair color
extern int mapcolor_sngl; // single player arrow color
extern int mapcolor_plyr[4]; // colors for players in multiplayer
extern int mapcolor_me; // consoleplayer's chosen colour
//jff 3/9/98
extern int map_secret_after; // secrets do not appear til after bagged
#endif

View File

@@ -0,0 +1,231 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Uncomment this to exhaustively run memory checks while the game is running
(this is EXTREMELY slow). */
/* #undef CHECKHEAP */
/* Define for support for MBF helper dogs */
//#define DOGS 0
#define HAVE_STRLWR 1
/* Define to be the path where Doom WADs are stored */
#define DOOMWADDIR ""
/* Define if you are building with OpenGL support */
//#define GL_DOOM 1
/* Define to 1 if you have the <asm/byteorder.h> header file. */
//#define HAVE_ASM_BYTEORDER_H 0
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
don't. */
#define HAVE_DECL_SYS_SIGLIST 0
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
#define HAVE_GETOPT 1
/* Define to 1 if you have the `inet_aton' function. */
#define HAVE_INET_ATON 1
/* Define to 1 if you have the `inet_ntop' function. */
#define HAVE_INET_NTOP 1
/* Define to 1 if you have the `inet_pton' function. */
#define HAVE_INET_PTON 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have struct sockaddr_in6 */
#define HAVE_IPv6 0
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `png' library (-lpng). */
#define HAVE_LIBPNG 0
/* Define to 1 if you have the `SDL_mixer' library (-lSDL_mixer). */
/* #undef HAVE_LIBSDL_MIXER */
/* Define if you have the SDL net library -lSDL_net */
/* #undef HAVE_LIBSDL_NET */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 0
/* Define if you want network game support */
/* #undef HAVE_NET */
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 0
/* Define to 1 if you have the `sched_setaffinity' function. */
#define HAVE_SCHED_SETAFFINITY 0
/* Define to 1 if you have the `SDL_JoystickGetAxis' function. */
#define HAVE_SDL_JOYSTICKGETAXIS 0
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 0
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 0
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 0
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 0
/* Define to 1 if you have the `usleep' function. */
#define HAVE_USLEEP 0
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Uncomment this to cause heap dumps to be generated. Only useful if
INSTRUMENTED is also defined. */
/* #undef HEAPDUMP */
/* Define for high resolution support */
#define HIGHRES 0
/* Define on targets supporting 386 assembly */
/* #undef I386_ASM */
/* Define this to see real-time memory allocation statistics, and enable extra
debugging features */
/* #undef INSTRUMENTED */
/* If your platform has a fast version of max, define MAX to it */
/* #undef MAX */
/* If your platform has a fast version of min, define MIN to it */
/* #undef MIN */
/* Name of package */
#define PACKAGE "prboom"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "prboom"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "prboom 2.5.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "prboom"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.5.0"
/* Set to the attribute to apply to struct definitions to make them packed */
#define PACKEDATTR __attribute__((packed))
/* Define to enable internal range checking */
/* #undef RANGECHECK */
/* Define if you have an old SDL_net, such that the UDPpacket structure has a
src member instead of an address member */
/* #undef SDL_NET_UDP_PACKET_SRC */
/* When defined this causes quick checks which only impose significant
overhead if a posible error is detected. */
#define SIMPLECHECKS 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Defining this causes time stamps to be created each time a lump is locked,
and lumps locked for long periods of time are reported */
/* #undef TIMEDIAG */
/* Define if you want to use gluImageScale */
#define USE_GLU_IMAGESCALE 0
/* Define if you want to use gluBuild2DMipmaps */
#define USE_GLU_MIPMAP 0
/* Define if you want to use the SDL net lib */
/* #undef USE_SDL_NET */
/* Version number of package */
#define VERSION "2.5.0"
/* Define if using the dmalloc debugging malloc package */
/* #undef WITH_DMALLOC */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define this to perform id checks on zone blocks, to detect corrupted and
illegally freed blocks */
#define ZONEIDCHECK 1
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to strcasecmp, if we have it */
#define stricmp strcasecmp
/* Define to strncasecmp, if we have it */
#define strnicmp strncasecmp
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
#define atexit(a)
#define exit(a) assert(0)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,707 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Printed strings for translation.
* English language support (default).
* See dstrings.h for suggestions about foreign language BEX support
*
*-----------------------------------------------------------------------------*/
#ifndef __D_ENGLSH__
#define __D_ENGLSH__
/* d_main.c */
#define D_DEVSTR "Development mode ON.\n"
#define D_CDROM "CD-ROM Version: default.cfg from c:\\doomdata\n"
/* m_menu.c */
#define PRESSKEY "press a key."
#define PRESSYN "press y or n."
#define QUITMSG "are you sure you want to\nquit this great game?"
#define LOADNET "you can't do load while in a net game!\n\n"PRESSKEY
#define QLOADNET "you can't quickload during a netgame!\n\n"PRESSKEY
#define QSAVESPOT "you haven't picked a quicksave slot yet!\n\n"PRESSKEY
#define SAVEDEAD "you can't save if you aren't playing!\n\n"PRESSKEY
#define QSPROMPT "quicksave over your game named\n\n'%s'?\n\n"PRESSYN
#define QLPROMPT "do you want to quickload the game named\n\n'%s'?\n\n"PRESSYN
#define NEWGAME \
"you can't start a new game\n"\
"while in a network game.\n\n"PRESSKEY
#define NIGHTMARE \
"are you sure? this skill level\n"\
"isn't even remotely fair.\n\n"PRESSYN
#define SWSTRING \
"this is the shareware version of doom.\n\n"\
"you need to order the entire trilogy.\n\n"PRESSKEY
#define MSGOFF "Messages OFF"
#define MSGON "Messages ON"
#define NETEND "you can't end a netgame!\n\n"PRESSKEY
#define ENDGAME "are you sure you want to end the game?\n\n"PRESSYN
#define RESTARTLEVEL "restart the level?\n\n"PRESSYN
#define DOSY "(press y to quit)"
#define DETAILHI "High detail"
#define DETAILLO "Low detail"
#define GAMMALVL0 "Gamma correction OFF"
#define GAMMALVL1 "Gamma correction level 1"
#define GAMMALVL2 "Gamma correction level 2"
#define GAMMALVL3 "Gamma correction level 3"
#define GAMMALVL4 "Gamma correction level 4"
#define EMPTYSTRING "empty slot"
/* p_inter.c */
#define GOTARMOR "Picked up the armor."
#define GOTMEGA "Picked up the MegaArmor!"
#define GOTHTHBONUS "Picked up a health bonus."
#define GOTARMBONUS "Picked up an armor bonus."
#define GOTSTIM "Picked up a stimpack."
#define GOTMEDINEED "Picked up a medikit that you REALLY need!"
#define GOTMEDIKIT "Picked up a medikit."
#define GOTSUPER "Supercharge!"
#define GOTBLUECARD "Picked up a blue keycard."
#define GOTYELWCARD "Picked up a yellow keycard."
#define GOTREDCARD "Picked up a red keycard."
#define GOTBLUESKUL "Picked up a blue skull key."
#define GOTYELWSKUL "Picked up a yellow skull key."
#define GOTREDSKULL "Picked up a red skull key."
#define GOTINVUL "Invulnerability!"
#define GOTBERSERK "Berserk!"
#define GOTINVIS "Partial Invisibility"
#define GOTSUIT "Radiation Shielding Suit"
#define GOTMAP "Computer Area Map"
#define GOTVISOR "Light Amplification Visor"
#define GOTMSPHERE "MegaSphere!"
#define GOTCLIP "Picked up a clip."
#define GOTCLIPBOX "Picked up a box of bullets."
#define GOTROCKET "Picked up a rocket."
#define GOTROCKBOX "Picked up a box of rockets."
#define GOTCELL "Picked up an energy cell."
#define GOTCELLBOX "Picked up an energy cell pack."
#define GOTSHELLS "Picked up 4 shotgun shells."
#define GOTSHELLBOX "Picked up a box of shotgun shells."
#define GOTBACKPACK "Picked up a backpack full of ammo!"
#define GOTBFG9000 "You got the BFG9000! Oh, yes."
#define GOTCHAINGUN "You got the chaingun!"
#define GOTCHAINSAW "A chainsaw! Find some meat!"
#define GOTLAUNCHER "You got the rocket launcher!"
#define GOTPLASMA "You got the plasma gun!"
#define GOTSHOTGUN "You got the shotgun!"
#define GOTSHOTGUN2 "You got the super shotgun!"
/* p_doors.c */
#define PD_BLUEO "You need a blue key to activate this object"
#define PD_REDO "You need a red key to activate this object"
#define PD_YELLOWO "You need a yellow key to activate this object"
#define PD_BLUEK "You need a blue key to open this door"
#define PD_REDK "You need a red key to open this door"
#define PD_YELLOWK "You need a yellow key to open this door"
/* jff 02/05/98 Create messages specific to card and skull keys */
#define PD_BLUEC "You need a blue card to open this door"
#define PD_REDC "You need a red card to open this door"
#define PD_YELLOWC "You need a yellow card to open this door"
#define PD_BLUES "You need a blue skull to open this door"
#define PD_REDS "You need a red skull to open this door"
#define PD_YELLOWS "You need a yellow skull to open this door"
#define PD_ANY "Any key will open this door"
#define PD_ALL3 "You need all three keys to open this door"
#define PD_ALL6 "You need all six keys to open this door"
/* g_game.c */
#define GGSAVED "game saved."
/* hu_stuff.c */
#define HUSTR_MSGU "[Message unsent]"
#define HUSTR_E1M1 "E1M1: Hangar"
#define HUSTR_E1M2 "E1M2: Nuclear Plant"
#define HUSTR_E1M3 "E1M3: Toxin Refinery"
#define HUSTR_E1M4 "E1M4: Command Control"
#define HUSTR_E1M5 "E1M5: Phobos Lab"
#define HUSTR_E1M6 "E1M6: Central Processing"
#define HUSTR_E1M7 "E1M7: Computer Station"
#define HUSTR_E1M8 "E1M8: Phobos Anomaly"
#define HUSTR_E1M9 "E1M9: Military Base"
#define HUSTR_E2M1 "E2M1: Deimos Anomaly"
#define HUSTR_E2M2 "E2M2: Containment Area"
#define HUSTR_E2M3 "E2M3: Refinery"
#define HUSTR_E2M4 "E2M4: Deimos Lab"
#define HUSTR_E2M5 "E2M5: Command Center"
#define HUSTR_E2M6 "E2M6: Halls of the Damned"
#define HUSTR_E2M7 "E2M7: Spawning Vats"
#define HUSTR_E2M8 "E2M8: Tower of Babel"
#define HUSTR_E2M9 "E2M9: Fortress of Mystery"
#define HUSTR_E3M1 "E3M1: Hell Keep"
#define HUSTR_E3M2 "E3M2: Slough of Despair"
#define HUSTR_E3M3 "E3M3: Pandemonium"
#define HUSTR_E3M4 "E3M4: House of Pain"
#define HUSTR_E3M5 "E3M5: Unholy Cathedral"
#define HUSTR_E3M6 "E3M6: Mt. Erebus"
#define HUSTR_E3M7 "E3M7: Limbo"
#define HUSTR_E3M8 "E3M8: Dis"
#define HUSTR_E3M9 "E3M9: Warrens"
#define HUSTR_E4M1 "E4M1: Hell Beneath"
#define HUSTR_E4M2 "E4M2: Perfect Hatred"
#define HUSTR_E4M3 "E4M3: Sever The Wicked"
#define HUSTR_E4M4 "E4M4: Unruly Evil"
#define HUSTR_E4M5 "E4M5: They Will Repent"
#define HUSTR_E4M6 "E4M6: Against Thee Wickedly"
#define HUSTR_E4M7 "E4M7: And Hell Followed"
#define HUSTR_E4M8 "E4M8: Unto The Cruel"
#define HUSTR_E4M9 "E4M9: Fear"
#define HUSTR_1 "level 1: entryway"
#define HUSTR_2 "level 2: underhalls"
#define HUSTR_3 "level 3: the gantlet"
#define HUSTR_4 "level 4: the focus"
#define HUSTR_5 "level 5: the waste tunnels"
#define HUSTR_6 "level 6: the crusher"
#define HUSTR_7 "level 7: dead simple"
#define HUSTR_8 "level 8: tricks and traps"
#define HUSTR_9 "level 9: the pit"
#define HUSTR_10 "level 10: refueling base"
#define HUSTR_11 "level 11: 'o' of destruction!"
#define HUSTR_12 "level 12: the factory"
#define HUSTR_13 "level 13: downtown"
#define HUSTR_14 "level 14: the inmost dens"
#define HUSTR_15 "level 15: industrial zone"
#define HUSTR_16 "level 16: suburbs"
#define HUSTR_17 "level 17: tenements"
#define HUSTR_18 "level 18: the courtyard"
#define HUSTR_19 "level 19: the citadel"
#define HUSTR_20 "level 20: gotcha!"
#define HUSTR_21 "level 21: nirvana"
#define HUSTR_22 "level 22: the catacombs"
#define HUSTR_23 "level 23: barrels o' fun"
#define HUSTR_24 "level 24: the chasm"
#define HUSTR_25 "level 25: bloodfalls"
#define HUSTR_26 "level 26: the abandoned mines"
#define HUSTR_27 "level 27: monster condo"
#define HUSTR_28 "level 28: the spirit world"
#define HUSTR_29 "level 29: the living end"
#define HUSTR_30 "level 30: icon of sin"
#define HUSTR_31 "level 31: wolfenstein"
#define HUSTR_32 "level 32: grosse"
#define PHUSTR_1 "level 1: congo"
#define PHUSTR_2 "level 2: well of souls"
#define PHUSTR_3 "level 3: aztec"
#define PHUSTR_4 "level 4: caged"
#define PHUSTR_5 "level 5: ghost town"
#define PHUSTR_6 "level 6: baron's lair"
#define PHUSTR_7 "level 7: caughtyard"
#define PHUSTR_8 "level 8: realm"
#define PHUSTR_9 "level 9: abattoire"
#define PHUSTR_10 "level 10: onslaught"
#define PHUSTR_11 "level 11: hunted"
#define PHUSTR_12 "level 12: speed"
#define PHUSTR_13 "level 13: the crypt"
#define PHUSTR_14 "level 14: genesis"
#define PHUSTR_15 "level 15: the twilight"
#define PHUSTR_16 "level 16: the omen"
#define PHUSTR_17 "level 17: compound"
#define PHUSTR_18 "level 18: neurosphere"
#define PHUSTR_19 "level 19: nme"
#define PHUSTR_20 "level 20: the death domain"
#define PHUSTR_21 "level 21: slayer"
#define PHUSTR_22 "level 22: impossible mission"
#define PHUSTR_23 "level 23: tombstone"
#define PHUSTR_24 "level 24: the final frontier"
#define PHUSTR_25 "level 25: the temple of darkness"
#define PHUSTR_26 "level 26: bunker"
#define PHUSTR_27 "level 27: anti-christ"
#define PHUSTR_28 "level 28: the sewers"
#define PHUSTR_29 "level 29: odyssey of noises"
#define PHUSTR_30 "level 30: the gateway of hell"
#define PHUSTR_31 "level 31: cyberden"
#define PHUSTR_32 "level 32: go 2 it"
#define THUSTR_1 "level 1: system control"
#define THUSTR_2 "level 2: human bbq"
#define THUSTR_3 "level 3: power control"
#define THUSTR_4 "level 4: wormhole"
#define THUSTR_5 "level 5: hanger"
#define THUSTR_6 "level 6: open season"
#define THUSTR_7 "level 7: prison"
#define THUSTR_8 "level 8: metal"
#define THUSTR_9 "level 9: stronghold"
#define THUSTR_10 "level 10: redemption"
#define THUSTR_11 "level 11: storage facility"
#define THUSTR_12 "level 12: crater"
#define THUSTR_13 "level 13: nukage processing"
#define THUSTR_14 "level 14: steel works"
#define THUSTR_15 "level 15: dead zone"
#define THUSTR_16 "level 16: deepest reaches"
#define THUSTR_17 "level 17: processing area"
#define THUSTR_18 "level 18: mill"
#define THUSTR_19 "level 19: shipping/respawning"
#define THUSTR_20 "level 20: central processing"
#define THUSTR_21 "level 21: administration center"
#define THUSTR_22 "level 22: habitat"
#define THUSTR_23 "level 23: lunar mining project"
#define THUSTR_24 "level 24: quarry"
#define THUSTR_25 "level 25: baron's den"
#define THUSTR_26 "level 26: ballistyx"
#define THUSTR_27 "level 27: mount pain"
#define THUSTR_28 "level 28: heck"
#define THUSTR_29 "level 29: river styx"
#define THUSTR_30 "level 30: last call"
#define THUSTR_31 "level 31: pharaoh"
#define THUSTR_32 "level 32: caribbean"
#define HUSTR_CHATMACRO1 "I'm ready to kick butt!"
#define HUSTR_CHATMACRO2 "I'm OK."
#define HUSTR_CHATMACRO3 "I'm not looking too good!"
#define HUSTR_CHATMACRO4 "Help!"
#define HUSTR_CHATMACRO5 "You suck!"
#define HUSTR_CHATMACRO6 "Next time, scumbag..."
#define HUSTR_CHATMACRO7 "Come here!"
#define HUSTR_CHATMACRO8 "I'll take care of it."
#define HUSTR_CHATMACRO9 "Yes"
#define HUSTR_CHATMACRO0 "No"
#define HUSTR_TALKTOSELF1 "You mumble to yourself"
#define HUSTR_TALKTOSELF2 "Who's there?"
#define HUSTR_TALKTOSELF3 "You scare yourself"
#define HUSTR_TALKTOSELF4 "You start to rave"
#define HUSTR_TALKTOSELF5 "You've lost it..."
#define HUSTR_MESSAGESENT "[Message Sent]"
/* The following should NOT be changed unless it seems
* just AWFULLY necessary */
#define HUSTR_PLRGREEN "Player 1: "
#define HUSTR_PLRINDIGO "Player 2: "
#define HUSTR_PLRBROWN "Player 3: "
#define HUSTR_PLRRED "Player 4: "
#define HUSTR_KEYGREEN 'g'
#define HUSTR_KEYINDIGO 'i'
#define HUSTR_KEYBROWN 'b'
#define HUSTR_KEYRED 'r'
/* am_map.c */
#define AMSTR_FOLLOWON "Follow Mode ON"
#define AMSTR_FOLLOWOFF "Follow Mode OFF"
#define AMSTR_GRIDON "Grid ON"
#define AMSTR_GRIDOFF "Grid OFF"
#define AMSTR_MARKEDSPOT "Marked Spot"
#define AMSTR_MARKSCLEARED "All Marks Cleared"
#define AMSTR_ROTATEON "Rotate Mode ON"
#define AMSTR_ROTATEOFF "Rotate Mode OFF"
#define AMSTR_OVERLAYON "Overlay Mode ON"
#define AMSTR_OVERLAYOFF "Overlay Mode OFF"
/* st_stuff.c */
#define STSTR_MUS "Music Change"
#define STSTR_NOMUS "IMPOSSIBLE SELECTION"
#define STSTR_DQDON "Degreelessness Mode On"
#define STSTR_DQDOFF "Degreelessness Mode Off"
#define STSTR_KFAADDED "Very Happy Ammo Added"
#define STSTR_FAADDED "Ammo (no keys) Added"
#define STSTR_NCON "No Clipping Mode ON"
#define STSTR_NCOFF "No Clipping Mode OFF"
#define STSTR_BEHOLD "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp"
#define STSTR_BEHOLDX "Power-up Toggled"
#define STSTR_CHOPPERS "... doesn't suck - GM"
#define STSTR_CLEV "Changing Level..."
#define STSTR_COMPON "Compatibility Mode On" /* phares */
#define STSTR_COMPOFF "Compatibility Mode Off" /* phares */
/* f_finale.c */
#define E1TEXT \
"Once you beat the big badasses and\n"\
"clean out the moon base you're supposed\n"\
"to win, aren't you? Aren't you? Where's\n"\
"your fat reward and ticket home? What\n"\
"the hell is this? It's not supposed to\n"\
"end this way!\n"\
"\n" \
"It stinks like rotten meat, but looks\n"\
"like the lost Deimos base. Looks like\n"\
"you're stuck on The Shores of Hell.\n"\
"The only way out is through.\n"\
"\n"\
"To continue the DOOM experience, play\n"\
"The Shores of Hell and its amazing\n"\
"sequel, Inferno!\n"
#define E2TEXT \
"You've done it! The hideous cyber-\n"\
"demon lord that ruled the lost Deimos\n"\
"moon base has been slain and you\n"\
"are triumphant! But ... where are\n"\
"you? You clamber to the edge of the\n"\
"moon and look down to see the awful\n"\
"truth.\n" \
"\n"\
"Deimos floats above Hell itself!\n"\
"You've never heard of anyone escaping\n"\
"from Hell, but you'll make the bastards\n"\
"sorry they ever heard of you! Quickly,\n"\
"you rappel down to the surface of\n"\
"Hell.\n"\
"\n" \
"Now, it's on to the final chapter of\n"\
"DOOM! -- Inferno."
#define E3TEXT \
"The loathsome spiderdemon that\n"\
"masterminded the invasion of the moon\n"\
"bases and caused so much death has had\n"\
"its ass kicked for all time.\n"\
"\n"\
"A hidden doorway opens and you enter.\n"\
"You've proven too tough for Hell to\n"\
"contain, and now Hell at last plays\n"\
"fair -- for you emerge from the door\n"\
"to see the green fields of Earth!\n"\
"Home at last.\n" \
"\n"\
"You wonder what's been happening on\n"\
"Earth while you were battling evil\n"\
"unleashed. It's good that no Hell-\n"\
"spawn could have come through that\n"\
"door with you ..."
#define E4TEXT \
"the spider mastermind must have sent forth\n"\
"its legions of hellspawn before your\n"\
"final confrontation with that terrible\n"\
"beast from hell. but you stepped forward\n"\
"and brought forth eternal damnation and\n"\
"suffering upon the horde as a true hero\n"\
"would in the face of something so evil.\n"\
"\n"\
"besides, someone was gonna pay for what\n"\
"happened to daisy, your pet rabbit.\n"\
"\n"\
"but now, you see spread before you more\n"\
"potential pain and gibbitude as a nation\n"\
"of demons run amok among our cities.\n"\
"\n"\
"next stop, hell on earth!"
/* after level 6, put this: */
#define C1TEXT \
"YOU HAVE ENTERED DEEPLY INTO THE INFESTED\n" \
"STARPORT. BUT SOMETHING IS WRONG. THE\n" \
"MONSTERS HAVE BROUGHT THEIR OWN REALITY\n" \
"WITH THEM, AND THE STARPORT'S TECHNOLOGY\n" \
"IS BEING SUBVERTED BY THEIR PRESENCE.\n" \
"\n"\
"AHEAD, YOU SEE AN OUTPOST OF HELL, A\n" \
"FORTIFIED ZONE. IF YOU CAN GET PAST IT,\n" \
"YOU CAN PENETRATE INTO THE HAUNTED HEART\n" \
"OF THE STARBASE AND FIND THE CONTROLLING\n" \
"SWITCH WHICH HOLDS EARTH'S POPULATION\n" \
"HOSTAGE."
/* After level 11, put this: */
#define C2TEXT \
"YOU HAVE WON! YOUR VICTORY HAS ENABLED\n" \
"HUMANKIND TO EVACUATE EARTH AND ESCAPE\n"\
"THE NIGHTMARE. NOW YOU ARE THE ONLY\n"\
"HUMAN LEFT ON THE FACE OF THE PLANET.\n"\
"CANNIBAL MUTATIONS, CARNIVOROUS ALIENS,\n"\
"AND EVIL SPIRITS ARE YOUR ONLY NEIGHBORS.\n"\
"YOU SIT BACK AND WAIT FOR DEATH, CONTENT\n"\
"THAT YOU HAVE SAVED YOUR SPECIES.\n"\
"\n"\
"BUT THEN, EARTH CONTROL BEAMS DOWN A\n"\
"MESSAGE FROM SPACE: \"SENSORS HAVE LOCATED\n"\
"THE SOURCE OF THE ALIEN INVASION. IF YOU\n"\
"GO THERE, YOU MAY BE ABLE TO BLOCK THEIR\n"\
"ENTRY. THE ALIEN BASE IS IN THE HEART OF\n"\
"YOUR OWN HOME CITY, NOT FAR FROM THE\n"\
"STARPORT.\" SLOWLY AND PAINFULLY YOU GET\n"\
"UP AND RETURN TO THE FRAY."
/* After level 20, put this: */
#define C3TEXT \
"YOU ARE AT THE CORRUPT HEART OF THE CITY,\n"\
"SURROUNDED BY THE CORPSES OF YOUR ENEMIES.\n"\
"YOU SEE NO WAY TO DESTROY THE CREATURES'\n"\
"ENTRYWAY ON THIS SIDE, SO YOU CLENCH YOUR\n"\
"TEETH AND PLUNGE THROUGH IT.\n"\
"\n"\
"THERE MUST BE A WAY TO CLOSE IT ON THE\n"\
"OTHER SIDE. WHAT DO YOU CARE IF YOU'VE\n"\
"GOT TO GO THROUGH HELL TO GET TO IT?"
/* After level 29, put this: */
#define C4TEXT \
"THE HORRENDOUS VISAGE OF THE BIGGEST\n"\
"DEMON YOU'VE EVER SEEN CRUMBLES BEFORE\n"\
"YOU, AFTER YOU PUMP YOUR ROCKETS INTO\n"\
"HIS EXPOSED BRAIN. THE MONSTER SHRIVELS\n"\
"UP AND DIES, ITS THRASHING LIMBS\n"\
"DEVASTATING UNTOLD MILES OF HELL'S\n"\
"SURFACE.\n"\
"\n"\
"YOU'VE DONE IT. THE INVASION IS OVER.\n"\
"EARTH IS SAVED. HELL IS A WRECK. YOU\n"\
"WONDER WHERE BAD FOLKS WILL GO WHEN THEY\n"\
"DIE, NOW. WIPING THE SWEAT FROM YOUR\n"\
"FOREHEAD YOU BEGIN THE LONG TREK BACK\n"\
"HOME. REBUILDING EARTH OUGHT TO BE A\n"\
"LOT MORE FUN THAN RUINING IT WAS.\n"
/* Before level 31, put this: */
#define C5TEXT \
"CONGRATULATIONS, YOU'VE FOUND THE SECRET\n"\
"LEVEL! LOOKS LIKE IT'S BEEN BUILT BY\n"\
"HUMANS, RATHER THAN DEMONS. YOU WONDER\n"\
"WHO THE INMATES OF THIS CORNER OF HELL\n"\
"WILL BE."
/* Before level 32, put this: */
#define C6TEXT \
"CONGRATULATIONS, YOU'VE FOUND THE\n"\
"SUPER SECRET LEVEL! YOU'D BETTER\n"\
"BLAZE THROUGH THIS ONE!\n"
/*** Plutonia ***/
/* after map 06 */
#define P1TEXT \
"You gloat over the steaming carcass of the\n"\
"Guardian. With its death, you've wrested\n"\
"the Accelerator from the stinking claws\n"\
"of Hell. You relax and glance around the\n"\
"room. Damn! There was supposed to be at\n"\
"least one working prototype, but you can't\n"\
"see it. The demons must have taken it.\n"\
"\n"\
"You must find the prototype, or all your\n"\
"struggles will have been wasted. Keep\n"\
"moving, keep fighting, keep killing.\n"\
"Oh yes, keep living, too."
/* after map 11 */
#define P2TEXT \
"Even the deadly Arch-Vile labyrinth could\n"\
"not stop you, and you've gotten to the\n"\
"prototype Accelerator which is soon\n"\
"efficiently and permanently deactivated.\n"\
"\n"\
"You're good at that kind of thing."
/* after map 20 */
#define P3TEXT \
"You've bashed and battered your way into\n"\
"the heart of the devil-hive. Time for a\n"\
"Search-and-Destroy mission, aimed at the\n"\
"Gatekeeper, whose foul offspring is\n"\
"cascading to Earth. Yeah, he's bad. But\n"\
"you know who's worse!\n"\
"\n"\
"Grinning evilly, you check your gear, and\n"\
"get ready to give the bastard a little Hell\n"\
"of your own making!"
/* after map 30 */
#define P4TEXT \
"The Gatekeeper's evil face is splattered\n"\
"all over the place. As its tattered corpse\n"\
"collapses, an inverted Gate forms and\n"\
"sucks down the shards of the last\n"\
"prototype Accelerator, not to mention the\n"\
"few remaining demons. You're done. Hell\n"\
"has gone back to pounding bad dead folks \n"\
"instead of good live ones. Remember to\n"\
"tell your grandkids to put a rocket\n"\
"launcher in your coffin. If you go to Hell\n"\
"when you die, you'll need it for some\n"\
"final cleaning-up ..."
/* before map 31 */
#define P5TEXT \
"You've found the second-hardest level we\n"\
"got. Hope you have a saved game a level or\n"\
"two previous. If not, be prepared to die\n"\
"aplenty. For master marines only."
/* before map 32 */
#define P6TEXT \
"Betcha wondered just what WAS the hardest\n"\
"level we had ready for ya? Now you know.\n"\
"No one gets out alive."
/*** TNT: Evilution ***/
#define T1TEXT \
"You've fought your way out of the infested\n"\
"experimental labs. It seems that UAC has\n"\
"once again gulped it down. With their\n"\
"high turnover, it must be hard for poor\n"\
"old UAC to buy corporate health insurance\n"\
"nowadays..\n"\
"\n"\
"Ahead lies the military complex, now\n"\
"swarming with diseased horrors hot to get\n"\
"their teeth into you. With luck, the\n"\
"complex still has some warlike ordnance\n"\
"laying around."
#define T2TEXT \
"You hear the grinding of heavy machinery\n"\
"ahead. You sure hope they're not stamping\n"\
"out new hellspawn, but you're ready to\n"\
"ream out a whole herd if you have to.\n"\
"They might be planning a blood feast, but\n"\
"you feel about as mean as two thousand\n"\
"maniacs packed into one mad killer.\n"\
"\n"\
"You don't plan to go down easy."
#define T3TEXT \
"The vista opening ahead looks real damn\n"\
"familiar. Smells familiar, too -- like\n"\
"fried excrement. You didn't like this\n"\
"place before, and you sure as hell ain't\n"\
"planning to like it now. The more you\n"\
"brood on it, the madder you get.\n"\
"Hefting your gun, an evil grin trickles\n"\
"onto your face. Time to take some names."
#define T4TEXT \
"Suddenly, all is silent, from one horizon\n"\
"to the other. The agonizing echo of Hell\n"\
"fades away, the nightmare sky turns to\n"\
"blue, the heaps of monster corpses start \n"\
"to evaporate along with the evil stench \n"\
"that filled the air. Jeeze, maybe you've\n"\
"done it. Have you really won?\n"\
"\n"\
"Something rumbles in the distance.\n"\
"A blue light begins to glow inside the\n"\
"ruined skull of the demon-spitter."
#define T5TEXT \
"What now? Looks totally different. Kind\n"\
"of like King Tut's condo. Well,\n"\
"whatever's here can't be any worse\n"\
"than usual. Can it? Or maybe it's best\n"\
"to let sleeping gods lie.."
#define T6TEXT \
"Time for a vacation. You've burst the\n"\
"bowels of hell and by golly you're ready\n"\
"for a break. You mutter to yourself,\n"\
"Maybe someone else can kick Hell's ass\n"\
"next time around. Ahead lies a quiet town,\n"\
"with peaceful flowing water, quaint\n"\
"buildings, and presumably no Hellspawn.\n"\
"\n"\
"As you step off the transport, you hear\n"\
"the stomp of a cyberdemon's iron shoe."
/*
* Character cast strings F_FINALE.C
*/
#define CC_ZOMBIE "ZOMBIEMAN"
#define CC_SHOTGUN "SHOTGUN GUY"
#define CC_HEAVY "HEAVY WEAPON DUDE"
#define CC_IMP "IMP"
#define CC_DEMON "DEMON"
#define CC_LOST "LOST SOUL"
#define CC_CACO "CACODEMON"
#define CC_HELL "HELL KNIGHT"
#define CC_BARON "BARON OF HELL"
#define CC_ARACH "ARACHNOTRON"
#define CC_PAIN "PAIN ELEMENTAL"
#define CC_REVEN "REVENANT"
#define CC_MANCU "MANCUBUS"
#define CC_ARCH "ARCH-VILE"
#define CC_SPIDER "THE SPIDER MASTERMIND"
#define CC_CYBER "THE CYBERDEMON"
#define CC_HERO "OUR HERO"
#endif

View File

@@ -0,0 +1,125 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Event information structures.
*
*-----------------------------------------------------------------------------*/
#ifndef __D_EVENT__
#define __D_EVENT__
#include "doomtype.h"
//
// Event handling.
//
// Input event types.
typedef enum
{
ev_keydown,
ev_keyup,
ev_mouse,
ev_joystick
} evtype_t;
// Event structure.
typedef struct
{
evtype_t type;
int data1; // keys / mouse/joystick buttons
int data2; // mouse/joystick x move
int data3; // mouse/joystick y move
} event_t;
typedef enum
{
ga_nothing,
ga_loadlevel,
ga_newgame,
ga_loadgame,
ga_savegame,
ga_playdemo,
ga_completed,
ga_victory,
ga_worlddone,
} gameaction_t;
//
// Button/action code definitions.
//
typedef enum
{
// Press "Fire".
BT_ATTACK = 1,
// Use button, to open doors, activate switches.
BT_USE = 2,
// Flag: game events, not really buttons.
BT_SPECIAL = 128,
BT_SPECIALMASK = 3,
// Flag, weapon change pending.
// If true, the next 4 bits hold weapon num.
BT_CHANGE = 4,
// The 4bit weapon mask and shift, convenience.
//BT_WEAPONMASK = (8+16+32),
BT_WEAPONMASK = (8+16+32+64), // extended to pick up SSG // phares
BT_WEAPONSHIFT = 3,
// Special events
BTS_LOADGAME = 0, // Loads a game
// Pause the game.
BTS_PAUSE = 1,
// Save the game at each console.
BTS_SAVEGAME = 2,
BTS_RESTARTLEVEL= 3, // Restarts the current level
// Savegame slot numbers occupy the second byte of buttons.
BTS_SAVEMASK = (4+8+16),
BTS_SAVESHIFT = 2,
} buttoncode_t;
//
// GLOBAL VARIABLES
//
extern gameaction_t gameaction;
#endif

View File

@@ -0,0 +1,59 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Items: key cards, artifacts, weapon, ammunition.
*
*-----------------------------------------------------------------------------*/
#ifndef __D_ITEMS__
#define __D_ITEMS__
#include "doomdef.h"
#ifdef __GNUG__
#pragma interface
#endif
/* Weapon info: sprite frames, ammunition use. */
typedef struct
{
ammotype_t ammo;
int upstate;
int downstate;
int readystate;
int atkstate;
int flashstate;
} weaponinfo_t;
extern weaponinfo_t weaponinfo[NUMWEAPONS];
#endif

View File

@@ -0,0 +1,82 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Main startup and splash screenstuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __D_MAIN__
#define __D_MAIN__
#include "d_event.h"
#include "w_wad.h"
#ifdef __GNUG__
#pragma interface
#endif
/* CPhipps - removed wadfiles[] stuff to w_wad.h */
extern char basesavegame[]; // killough 2/16/98: savegame path
//jff 1/24/98 make command line copies of play modes available
extern boolean clnomonsters; // checkparm of -nomonsters
extern boolean clrespawnparm; // checkparm of -respawn
extern boolean clfastparm; // checkparm of -fast
//jff end of external declaration of command line playmode
extern boolean nosfxparm;
extern boolean nomusicparm;
extern int ffmap;
// Called by IO functions when input is detected.
void D_PostEvent(event_t* ev);
// Demo stuff
extern boolean advancedemo;
void D_AdvanceDemo(void);
void D_DoAdvanceDemo (void);
//
// BASE LEVEL
//
void D_Display(void);
void D_PageTicker(void);
void D_StartTitle(void);
void D_DoomMain(void);
void D_AddFile (const char *file, wad_source_t source);
/* cph - MBF-like wad/deh/bex autoload code */
/* proff 2001/7/1 - added prboom.wad as last entry so it's always loaded and
doesn't overlap with the cfg settings */
#define MAXLOADFILES 3
extern const char *wad_files[MAXLOADFILES], *deh_files[MAXLOADFILES];
#endif

View File

@@ -0,0 +1,214 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Networking stuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __D_NET__
#define __D_NET__
#include "d_player.h"
#ifdef __GNUG__
#pragma interface
#endif
//
// Network play related stuff.
// There is a data struct that stores network
// communication related stuff, and another
// one that defines the actual packets to
// be transmitted.
//
#define DOOMCOM_ID 0x12345678l
// Max computers/players in a game.
#define MAXNETNODES 8
typedef enum
{
CMD_SEND = 1,
CMD_GET = 2
} command_t;
//
// Network packet data.
//
typedef struct
{
// High bit is retransmit request.
unsigned checksum;
// Only valid if NCMD_RETRANSMIT.
byte retransmitfrom;
byte starttic;
byte player;
byte numtics;
ticcmd_t cmds[BACKUPTICS];
} doomdata_t;
//
// Startup packet difference
// SG: 4/12/98
// Added so we can send more startup data to synch things like
// bobbing, recoil, etc.
// this is just mapped over the ticcmd_t array when setup packet is sent
//
// Note: the original code takes care of startskill, deathmatch, nomonsters
// respawn, startepisode, startmap
// Note: for phase 1 we need to add monsters_remember, variable_friction,
// weapon_recoil, allow_pushers, over_under, player_bobbing,
// fastparm, demo_insurance, and the rngseed
//Stick all options into bytes so we don't need to mess with bitfields
//WARNING: make sure this doesn't exceed the size of the ticcmds area!
//sizeof(ticcmd_t)*BACKUPTICS
//This is the current length of our extra stuff
//
//killough 5/2/98: this should all be replaced by calls to G_WriteOptions()
//and G_ReadOptions(), which were specifically designed to set up packets.
//By creating a separate struct and functions to read/write the options,
//you now have two functions and data to maintain instead of just one.
//If the array in g_game.c which G_WriteOptions()/G_ReadOptions() operates
//on, is too large (more than sizeof(ticcmd_t)*BACKUPTICS), it can
//either be shortened, or the net code needs to divide it up
//automatically into packets. The STARTUPLEN below is non-portable.
//There's a portable way to do it without having to know the sizes.
#define STARTUPLEN 12
typedef struct
{
byte monsters_remember;
byte variable_friction;
byte weapon_recoil;
byte allow_pushers;
byte over_under;
byte player_bobbing;
byte fastparm;
byte demo_insurance;
unsigned long rngseed;
char filler[sizeof(ticcmd_t)*BACKUPTICS-STARTUPLEN];
} startup_t;
typedef enum {
// Leave space, so low values corresponding to normal netgame setup packets can be ignored
nm_plcolour = 3,
nm_savegamename = 4,
} netmisctype_t;
typedef struct
{
netmisctype_t type;
size_t len;
byte value[sizeof(ticcmd_t)*BACKUPTICS - sizeof(netmisctype_t) - sizeof(size_t)];
} netmisc_t;
typedef struct
{
// Supposed to be DOOMCOM_ID?
long id;
// DOOM executes an int to execute commands.
short intnum;
// Communication between DOOM and the driver.
// Is CMD_SEND or CMD_GET.
short command;
// Is dest for send, set by get (-1 = no packet).
short remotenode;
// Number of bytes in doomdata to be sent
short datalength;
// Info common to all nodes.
// Console is allways node 0.
short numnodes;
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
short ticdup;
// Flag: 1 = send a backup tic in every packet.
short extratics;
// Flag: 1 = deathmatch.
short deathmatch;
// Flag: -1 = new game, 0-5 = load savegame
short savegame;
short episode; // 1-3
short map; // 1-9
short skill; // 1-5
// Info specific to this node.
short consoleplayer;
short numplayers;
// These are related to the 3-display mode,
// in which two drones looking left and right
// were used to render two additional views
// on two additional computers.
// Probably not operational anymore.
// 1 = left, 0 = center, -1 = right
short angleoffset;
// 1 = drone
short drone;
// The packet data to be sent.
doomdata_t data;
} doomcom_t;
// Create any new ticcmds and broadcast to other players.
#ifdef HAVE_NET
void NetUpdate (void);
#else
void D_BuildNewTiccmds(void);
#endif
//? how many ticks to run?
void TryRunTics (void);
// CPhipps - move to header file
void D_InitNetGame (void); // This does the setup
void D_CheckNetGame(void); // This waits for game start
// CPhipps - misc info broadcast
void D_NetSendMisc(netmisctype_t type, size_t len, void* data);
// CPhipps - ask server for a wad file we need
boolean D_NetGetWad(const char* name);
// Netgame stuff (buffers and pointers, i.e. indices).
extern doomcom_t *doomcom;
extern doomdata_t *netbuffer; // This points inside doomcom.
#endif

View File

@@ -0,0 +1,234 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Player state structure.
*
*-----------------------------------------------------------------------------*/
#ifndef __D_PLAYER__
#define __D_PLAYER__
// The player data structure depends on a number
// of other structs: items (internal inventory),
// animation states (closely tied to the sprites
// used to represent them, unfortunately).
#include "d_items.h"
#include "p_pspr.h"
// In addition, the player is just a special
// case of the generic moving object/actor.
#include "p_mobj.h"
// Finally, for odd reasons, the player input
// is buffered within the player data struct,
// as commands per game tick.
#include "d_ticcmd.h"
#ifdef __GNUG__
#pragma interface
#endif
//
// Player states.
//
typedef enum
{
// Playing or camping.
PST_LIVE,
// Dead on the ground, view follows killer.
PST_DEAD,
// Ready to restart/respawn???
PST_REBORN
} playerstate_t;
//
// Player internal flags, for cheats and debug.
//
typedef enum
{
// No clipping, walk through barriers.
CF_NOCLIP = 1,
// No damage, no health loss.
CF_GODMODE = 2,
// Not really a cheat, just a debug aid.
CF_NOMOMENTUM = 4
} 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;
/* killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
* mo->momx and mo->momy represent true momenta experienced by player.
* This only represents the thrust that the player applies himself.
* This avoids anomolies with such things as Boom ice and conveyors.
*/
fixed_t momx, momy; // killough 10/98
// 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. // CPhipps - const
const char* message;
// 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
int pnum;
wbplayerstruct_t plyr[MAXPLAYERS];
// CPhipps - total game time for completed levels so far
int totaltimes;
} wbstartstruct_t;
#endif

View File

@@ -0,0 +1,94 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* 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.
*/
// killough 11/98: convert back to C instead of C++
typedef void (*actionf_t)();
//typedef void (*actionf_v)();
//typedef void (*actionf_p1)( void* );
//typedef void (*actionf_p2)( void*, void* );
/* Note: In d_deh.c you will find references to these
* wherever code pointers and function handlers exist
*/
/*
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
* 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;
/* killough 8/29/98: we maintain thinkers in several equivalence classes,
* according to various criteria, so as to allow quicker searches.
*/
struct thinker_s *cnext, *cprev; /* Next, previous thinkers in same class */
/* killough 11/98: count of how many other objects reference
* this one using pointers. Used for garbage collection.
*/
unsigned references;
} thinker_t;
#endif

View File

@@ -0,0 +1,59 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* 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.
* CPhipps - explicitely signed the elements, since they have to be signed to work right
*/
typedef struct
{
signed char forwardmove; /* *2048 for move */
signed char sidemove; /* *2048 for move */
signed short angleturn; /* <<16 for angle delta */
short consistancy; /* checks for net game */
byte chatchar;
byte buttons;
} ticcmd_t;
#endif

View File

@@ -0,0 +1,204 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* all external data is defined here
* most of the data is loaded into different structures at run time
* some internal structures shared by many modules are here
*
*-----------------------------------------------------------------------------*/
#ifndef __DOOMDATA__
#define __DOOMDATA__
// The most basic types we use, portability.
#include "config.h"
#include "doomtype.h"
//
// Map level types.
// The following data structures define the persistent format
// used in the lumps of the WAD files.
//
// Lump order in a map WAD: each map needs a couple of lumps
// to provide a complete scene geometry description.
enum {
ML_LABEL, // A separator, name, ExMx or MAPxx
ML_THINGS, // Monsters, items..
ML_LINEDEFS, // LineDefs, from editing
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // SubSectors, list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
};
#ifdef _MSC_VER // proff: This is the same as __attribute__ ((packed)) in GNUC
#pragma pack(push)
#pragma pack(1)
#endif //_MSC_VER
// A single Vertex.
typedef struct {
short x,y;
} PACKEDATTR mapvertex_t;
// A SideDef, defining the visual appearance of a wall,
// by setting textures and offsets.
typedef struct {
short textureoffset;
short rowoffset;
char toptexture[8];
char bottomtexture[8];
char midtexture[8];
short sector; // Front sector, towards viewer.
} PACKEDATTR mapsidedef_t;
// A LineDef, as used for editing, and as input to the BSP builder.
typedef struct {
unsigned short v1;
unsigned short v2;
unsigned short flags;
short special;
short tag;
// proff 07/23/2006 - support more than 32768 sidedefs
// use the unsigned value and special case the -1
// sidenum[1] will be -1 (NO_INDEX) if one sided
unsigned short sidenum[2];
} PACKEDATTR maplinedef_t;
#define NO_INDEX ((unsigned short)-1)
//
// LineDef attributes.
//
// Solid, is an obstacle.
#define ML_BLOCKING 1
// Blocks monsters only.
#define ML_BLOCKMONSTERS 2
// Backside will not be drawn if not two sided.
#define ML_TWOSIDED 4
// If a texture is pegged, the texture will have
// the end exposed to air held constant at the
// top or bottom of the texture (stairs or pulled
// down things) and will move with a height change
// of one of the neighbor sectors.
// Unpegged textures always have the first row of
// the texture at the top pixel of the line for both
// top and bottom textures (use next to windows).
// upper texture unpegged
#define ML_DONTPEGTOP 8
// lower texture unpegged
#define ML_DONTPEGBOTTOM 16
// In AutoMap: don't map as two sided: IT'S A SECRET!
#define ML_SECRET 32
// Sound rendering: don't let sound cross two of these.
#define ML_SOUNDBLOCK 64
// Don't draw on the automap at all.
#define ML_DONTDRAW 128
// Set if already seen, thus drawn in automap.
#define ML_MAPPED 256
//jff 3/21/98 Set if line absorbs use by player
//allow multiple push/switch triggers to be used on one push
#define ML_PASSUSE 512
// Sector definition, from editing.
typedef struct {
short floorheight;
short ceilingheight;
char floorpic[8];
char ceilingpic[8];
short lightlevel;
short special;
short tag;
} PACKEDATTR mapsector_t;
// SubSector, as generated by BSP.
typedef struct {
unsigned short numsegs;
unsigned short firstseg; // Index of first one; segs are stored sequentially.
} PACKEDATTR mapsubsector_t;
// LineSeg, generated by splitting LineDefs
// using partition lines selected by BSP builder.
typedef struct {
unsigned short v1;
unsigned short v2;
short angle;
unsigned short linedef;
short side;
short offset;
} PACKEDATTR mapseg_t;
// BSP node structure.
// Indicate a leaf.
#define NF_SUBSECTOR 0x8000
typedef struct {
short x; // Partition line from (x,y) to x+dx,y+dy)
short y;
short dx;
short dy;
// Bounding box for each child, clip against view frustum.
short bbox[2][4];
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree.
unsigned short children[2];
} PACKEDATTR mapnode_t;
// Thing definition, position, orientation and type,
// plus skill/visibility flags and attributes.
typedef struct {
short x;
short y;
short angle;
short type;
short options;
} PACKEDATTR mapthing_t;
#ifdef _MSC_VER
#pragma pack(pop)
#endif //_MSC_VER
#endif // __DOOMDATA__

View File

@@ -0,0 +1,331 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Internally used data structures for virtually everything,
* key definitions, lots of other stuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __DOOMDEF__
#define __DOOMDEF__
/* use config.h if autoconf made one -- josh */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
// killough 4/25/98: Make gcc extensions mean nothing on other compilers
#ifndef __GNUC__
#define __attribute__(x)
#endif
// This must come first, since it redefines malloc(), free(), etc. -- killough:
#include "z_zone.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
// this should go here, not in makefile/configure.ac -- josh
#ifndef O_BINARY
#define O_BINARY 0
#endif
#include "m_swap.h"
#include "version.h"
// Game mode handling - identify IWAD version
// to handle IWAD dependend animations etc.
typedef enum {
shareware, // DOOM 1 shareware, E1, M9
registered, // DOOM 1 registered, E3, M27
commercial, // DOOM 2 retail, E1 M34 (DOOM 2 german edition not handled)
retail, // DOOM 1 retail, E4, M36
indetermined // Well, no IWAD found.
} GameMode_t;
// Mission packs - might be useful for TC stuff?
typedef enum {
doom, // DOOM 1
doom2, // DOOM 2
pack_tnt, // TNT mission pack
pack_plut, // Plutonia pack
none
} GameMission_t;
// Identify language to use, software localization.
typedef enum {
english,
french,
german,
unknown
} Language_t;
//
// For resize of screen, at start of game.
//
#define BASE_WIDTH 320
// It is educational but futile to change this
// scaling e.g. to 2. Drawing of status bar,
// menues etc. is tied to the scale implied
// by the graphics.
#define INV_ASPECT_RATIO 0.625 /* 0.75, ideally */
// killough 2/8/98: MAX versions for maximum screen sizes
// allows us to avoid the overhead of dynamic allocation
// when multiple screen sizes are supported
// proff 08/17/98: Changed for high-res
#define MAX_SCREENWIDTH 2048
#define MAX_SCREENHEIGHT 1536
// SCREENWIDTH and SCREENHEIGHT define the visible size
extern int SCREENWIDTH;
extern int SCREENHEIGHT;
// SCREENPITCH is the size of one line in the buffer and
// can be bigger than the SCREENWIDTH depending on the size
// of one pixel (8, 16 or 32 bit) and the padding at the
// end of the line caused by hardware considerations
extern int SCREENPITCH;
// The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4
// phares 5/14/98:
// DOOM Editor Numbers (aka doomednum in mobj_t)
#define DEN_PLAYER5 4001
#define DEN_PLAYER6 4002
#define DEN_PLAYER7 4003
#define DEN_PLAYER8 4004
// State updates, number of tics / second.
#define TICRATE 35
// The current state of the game: whether we are playing, gazing
// at the intermission screen, the game final animation, or a demo.
typedef enum {
GS_LEVEL=0,
GS_INTERMISSION,
GS_FINALE,
GS_DEMOSCREEN,
GS_UNK = -1
} gamestate_t;
//
// Difficulty/skill settings/filters.
//
// These are Thing flags
// Skill flags.
#define MTF_EASY 1
#define MTF_NORMAL 2
#define MTF_HARD 4
// Deaf monsters/do not react to sound.
#define MTF_AMBUSH 8
/* killough 11/98 */
#define MTF_NOTSINGLE 16
#define MTF_NOTDM 32
#define MTF_NOTCOOP 64
#define MTF_FRIEND 128
#define MTF_RESERVED 256
typedef enum {
sk_none=-1, //jff 3/24/98 create unpicked skill setting
sk_baby=0,
sk_easy,
sk_medium,
sk_hard,
sk_nightmare
} skill_t;
//
// Key cards.
//
typedef enum {
it_bluecard,
it_yellowcard,
it_redcard,
it_blueskull,
it_yellowskull,
it_redskull,
NUMCARDS
} card_t;
// The defined weapons, including a marker
// indicating user has not changed weapon.
typedef enum {
wp_fist,
wp_pistol,
wp_shotgun,
wp_chaingun,
wp_missile,
wp_plasma,
wp_bfg,
wp_chainsaw,
wp_supershotgun,
NUMWEAPONS,
wp_nochange // No pending weapon change.
} 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).
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).
#define KEYD_RIGHTARROW 0xae
#define KEYD_LEFTARROW 0xac
#define KEYD_UPARROW 0xad
#define KEYD_DOWNARROW 0xaf
#define KEYD_ESCAPE 27
#define KEYD_ENTER 13
#define KEYD_TAB 9
#define KEYD_F1 (0x80+0x3b)
#define KEYD_F2 (0x80+0x3c)
#define KEYD_F3 (0x80+0x3d)
#define KEYD_F4 (0x80+0x3e)
#define KEYD_F5 (0x80+0x3f)
#define KEYD_F6 (0x80+0x40)
#define KEYD_F7 (0x80+0x41)
#define KEYD_F8 (0x80+0x42)
#define KEYD_F9 (0x80+0x43)
#define KEYD_F10 (0x80+0x44)
#define KEYD_F11 (0x80+0x57)
#define KEYD_F12 (0x80+0x58)
#define KEYD_BACKSPACE 127
#define KEYD_PAUSE 0xff
#define KEYD_EQUALS 0x3d
#define KEYD_MINUS 0x2d
#define KEYD_RSHIFT (0x80+0x36)
#define KEYD_RCTRL (0x80+0x1d)
#define KEYD_RALT (0x80+0x38)
#define KEYD_LALT KEYD_RALT
#define KEYD_CAPSLOCK 0xba // phares
// phares 3/2/98:
#define KEYD_INSERT 0xd2
#define KEYD_HOME 0xc7
#define KEYD_PAGEUP 0xc9
#define KEYD_PAGEDOWN 0xd1
#define KEYD_DEL 0xc8
#define KEYD_END 0xcf
#define KEYD_SCROLLLOCK 0xc6
#define KEYD_SPACEBAR 0x20
// phares 3/2/98
#define KEYD_NUMLOCK 0xC5 // killough 3/6/98
// cph - Add the numeric keypad keys, as suggested by krose 4/22/99:
// The way numbers are assigned to keys is a mess, but it's too late to
// change that easily. At least these additions are don neatly.
// Codes 0x100-0x200 are reserved for number pad
#define KEYD_KEYPAD0 (0x100 + '0')
#define KEYD_KEYPAD1 (0x100 + '1')
#define KEYD_KEYPAD2 (0x100 + '2')
#define KEYD_KEYPAD3 (0x100 + '3')
#define KEYD_KEYPAD4 (0x100 + '4')
#define KEYD_KEYPAD5 (0x100 + '5')
#define KEYD_KEYPAD6 (0x100 + '6')
#define KEYD_KEYPAD7 (0x100 + '7')
#define KEYD_KEYPAD8 (0x100 + '8')
#define KEYD_KEYPAD9 (0x100 + '9')
#define KEYD_KEYPADENTER (0x100 + KEYD_ENTER)
#define KEYD_KEYPADDIVIDE (0x100 + '/')
#define KEYD_KEYPADMULTIPLY (0x100 + '*')
#define KEYD_KEYPADMINUS (0x100 + '-')
#define KEYD_KEYPADPLUS (0x100 + '+')
#define KEYD_KEYPADPERIOD (0x100 + '.')
// phares 4/19/98:
// Defines Setup Screen groups that config variables appear in.
// Used when resetting the defaults for every item in a Setup group.
typedef enum {
ss_none,
ss_keys,
ss_weap,
ss_stat,
ss_auto,
ss_enem,
ss_mess,
ss_chat,
ss_gen, /* killough 10/98 */
ss_comp, /* killough 10/98 */
ss_max
} ss_types;
// phares 3/20/98:
//
// Player friction is variable, based on controlling
// linedefs. More friction can create mud, sludge,
// magnetized floors, etc. Less friction can create ice.
#define MORE_FRICTION_MOMENTUM 15000 // mud factor based on momentum
#define ORIG_FRICTION 0xE800 // original value
#define ORIG_FRICTION_FACTOR 2048 // original value
#endif // __DOOMDEF__

View File

@@ -0,0 +1,332 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2006 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* 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 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
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;
// CPhipps - new compatibility handling
extern complevel_t compatibility_level, default_compatibility_level;
// CPhipps - old compatibility testing flags aliased to new handling
#define compatibility (compatibility_level<=boom_compatibility_compatibility)
#define demo_compatibility (compatibility_level < boom_compatibility_compatibility)
#define mbf_features (compatibility_level>=mbf_compatibility)
// v1.1-like pitched sounds
extern int pitched_sounds; // killough
extern int default_translucency; // config file says // phares
extern boolean general_translucency; // true if translucency is ok // phares
extern int demo_insurance, default_demo_insurance; // killough 4/5/98
// -------------------------------------------
// killough 10/98: compatibility vector
enum {
comp_telefrag,
comp_dropoff,
comp_vile,
comp_pain,
comp_skull,
comp_blazing,
comp_doorlight,
comp_model,
comp_god,
comp_falloff,
comp_floors,
comp_skymap,
comp_pursuit,
comp_doorstuck,
comp_staylift,
comp_zombie,
comp_stairs,
comp_infcheat,
comp_zerotags,
comp_moveblock,
comp_respawn, /* cph - this is the inverse of comp_respawnfix from eternity */
comp_sound,
comp_666,
comp_soul,
comp_maskedanim,
COMP_NUM, /* cph - should be last in sequence */
COMP_TOTAL=32 // Some extra room for additional variables
};
extern int comp[COMP_TOTAL], default_comp[COMP_TOTAL];
// -------------------------------------------
// Language.
extern Language_t language;
// -------------------------------------------
// Selected skill type, map etc.
//
// Defaults for menu, methinks.
extern skill_t startskill;
extern int startepisode;
extern int startmap;
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
// CPhipps - screen parameters
extern unsigned int desired_screenwidth, desired_screenheight;
// -------------------------
// Status flags for refresh.
//
enum automapmode_e {
am_active = 1, // currently shown
am_overlay= 2, // covers the screen, i.e. not overlay mode
am_rotate = 4, // rotates to the player facing direction
am_follow = 8, // keep the player centred
am_grid =16, // show grid
};
extern enum automapmode_e automapmode; // Mode that the automap is in
extern boolean menuactive; // Menu overlayed?
extern boolean paused; // Game Pause?
extern boolean nodrawers;
extern boolean noblit;
// 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, totallive;
extern int totalitems;
extern int totalsecret;
// Timer, for scores.
extern int basetic; /* killough 9/29/98: levelstarttic, adjusted */
extern int leveltime; // tics in game play for par
// --------------------------------------
// DEMO playback/recording related stuff.
extern boolean usergame;
extern boolean demoplayback;
extern boolean demorecording;
extern int demover;
// Quit after playing a demo from cmdline.
extern boolean singledemo;
// Print timing information after quitting. killough
extern boolean timingdemo;
// Run tick clock at fastest speed possible while playing demo. killough
extern boolean fastdemo;
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];
extern boolean realplayeringame[MAXPLAYERS];
extern mapthing_t *deathmatchstarts; // killough
extern size_t num_deathmatchstarts; // killough
extern mapthing_t *deathmatch_p;
// Player spawn spots.
extern mapthing_t playerstarts[];
// Intermission stats.
// Parameters for world map / intermission.
extern wbstartstruct_t wminfo;
//-----------------------------------------
// Internal parameters, used for engine.
//
// File handling stuff.
extern FILE *debugfile;
// 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_horiz; // killough
extern int mouseSensitivity_vert;
// 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;
extern int maketic;
// Networking and tick handling related.
#define BACKUPTICS 12
extern ticcmd_t netcmds[][BACKUPTICS];
extern int ticdup;
//-----------------------------------------------------------------------------
extern int allow_pushers; // MT_PUSH Things // phares 3/10/98
extern int default_allow_pushers;
extern int variable_friction; // ice & mud // phares 3/10/98
extern int default_variable_friction;
extern int monsters_remember; // killough 3/1/98
extern int default_monsters_remember;
extern int weapon_recoil; // weapon recoil // phares
extern int default_weapon_recoil;
extern int player_bobbing; // whether player bobs or not // phares 2/25/98
extern int default_player_bobbing; // killough 3/1/98: make local to each game
#ifdef DOGS
extern int dogs, default_dogs; // killough 7/19/98: Marine's best friend :)
extern int dog_jumping, default_dog_jumping; // killough 10/98
#endif
/* killough 8/8/98: distance friendly monsters tend to stay from player */
extern int distfriend, default_distfriend;
/* killough 9/8/98: whether monsters are allowed to strafe or retreat */
extern int monster_backing, default_monster_backing;
/* killough 9/9/98: whether monsters intelligently avoid hazards */
extern int monster_avoid_hazards, default_monster_avoid_hazards;
/* killough 10/98: whether monsters are affected by friction */
extern int monster_friction, default_monster_friction;
/* killough 9/9/98: whether monsters help friends */
extern int help_friends, default_help_friends;
extern int flashing_hom; // killough 10/98
extern int doom_weapon_toggles; // killough 10/98
/* killough 7/19/98: whether monsters should fight against each other */
extern int monster_infighting, default_monster_infighting;
extern int monkeys, default_monkeys;
extern int HelperThing; // type of thing to use for helper
#endif

View File

@@ -0,0 +1,128 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2006 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Simple basic typedefs, isolated here to make it easier
* separating modules.
*
*-----------------------------------------------------------------------------*/
#ifndef __DOOMTYPE__
#define __DOOMTYPE__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#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
//e6y
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
/* cph - Wrapper for the long long type, as Win32 used a different name.
* Except I don't know what to test as it's compiler specific
* Proff - I fixed it */
#ifndef _MSC_VER
typedef signed long long int_64_t;
typedef unsigned long long uint_64_t;
// define compiled-specific long-long contstant notation here
#define LONGLONG(num) (uint_64_t)num ## ll
#else
typedef __int64 int_64_t;
typedef unsigned __int64 uint_64_t;
// define compiled-specific long-long contstant notation here
#define LONGLONG(num) (uint_64_t)num
#undef PATH_MAX
#define PATH_MAX 1024
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define S_ISDIR(x) (((sbuf.st_mode & S_IFDIR)==S_IFDIR)?1:0)
#endif
#ifdef __GNUC__
#define CONSTFUNC __attribute__((const))
#define PUREFUNC __attribute__((pure))
#define NORETURN __attribute__ ((noreturn))
#else
#define CONSTFUNC
#define PUREFUNC
#define NORETURN
#endif
/* CPhipps - use limits.h instead of depreciated values.h */
#include <limits.h>
/* cph - move compatibility levels here so we can use them in d_server.c */
typedef enum {
doom_12_compatibility, /* Doom v1.2 */
doom_1666_compatibility, /* Doom v1.666 */
doom2_19_compatibility, /* Doom & Doom 2 v1.9 */
ultdoom_compatibility, /* Doom 2 v1.9 */
finaldoom_compatibility, /* Final & Ultimate Doom v1.9, and Doom95 */
dosdoom_compatibility, /* Early dosdoom & tasdoom */
tasdoom_compatibility, /* Early dosdoom & tasdoom */
boom_compatibility_compatibility, /* Boom's compatibility mode */
boom_201_compatibility, /* Compatible with Boom v2.01 */
boom_202_compatibility, /* Compatible with Boom v2.01 */
lxdoom_1_compatibility, /* LxDoom v1.3.2+ */
mbf_compatibility, /* MBF */
prboom_1_compatibility, /* PrBoom 2.03beta? */
prboom_2_compatibility, /* PrBoom 2.1.0-2.1.1 */
prboom_3_compatibility, /* PrBoom 2.2.x */
prboom_4_compatibility, /* PrBoom 2.3.x */
prboom_5_compatibility, /* PrBoom 2.4.0 */
prboom_6_compatibility, /* Latest PrBoom */
MAX_COMPATIBILITY_LEVEL, /* Must be last entry */
/* Aliases follow */
boom_compatibility = boom_201_compatibility, /* Alias used by G_Compatibility */
best_compatibility = prboom_6_compatibility,
} complevel_t;
/* cph - from v_video.h, needed by gl_struct.h */
enum patch_translation_e {
VPT_NONE = 0, // Normal
VPT_FLIP = 1, // Flip image horizontally
VPT_TRANS = 2, // Translate image via a translation table
VPT_STRETCH = 4, // Stretch to compensate for high-res
};
#endif

View File

@@ -0,0 +1,80 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* DOOM strings, by language.
* Note: In BOOM, some new strings hav ebeen defined that are
* not found in the French version. A better approach is
* to create a BEX text-replacement file for other
* languages since any language can be supported that way
* without recompiling the program.
*
*-----------------------------------------------------------------------------*/
#ifndef __DSTRINGS__
#define __DSTRINGS__
/* All important printed strings.
* Language selection (message strings).
* Use -DFRENCH etc.
*/
#ifdef FRENCH
#include "d_french.h"
#else
#include "d_englsh.h"
#endif
/* Note this is not externally modifiable through DEH/BEX
* Misc. other strings.
* #define SAVEGAMENAME "boomsav" * killough 3/22/98 *
* Ty 05/04/98 - replaced with a modifiable string, see d_deh.c
*/
/*
* File locations,
* relative to current position.
* Path names are OS-sensitive.
*/
#define DEVMAPS "devmaps"
#define DEVDATA "devdata"
/* Not done in french?
* QuitDOOM messages *
* killough 1/18/98:
* replace hardcoded limit with extern var (silly hack, I know)
*/
#include <stddef.h>
extern const size_t NUM_QUITMESSAGES; /* Calculated in dstrings.c */
extern const char* const endmsg[]; /* killough 1/18/98 const added */
#endif

View File

@@ -0,0 +1,56 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Related to f_finale.c, which is called at the end of a level
*
*-----------------------------------------------------------------------------*/
#ifndef __F_FINALE__
#define __F_FINALE__
#include "doomtype.h"
#include "d_event.h"
/*
* FINALE
*/
/* Called by main loop. */
boolean F_Responder (event_t* ev);
/* Called by main loop. */
void F_Ticker (void);
/* Called by main loop. */
void F_Drawer (void);
void F_StartFinale (void);
#endif

View File

@@ -0,0 +1,45 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Mission start screen wipe/melt, special effects.
*
*-----------------------------------------------------------------------------*/
#ifndef __F_WIPE_H__
#define __F_WIPE_H__
/*
* SCREEN WIPE PACKAGE
*/
int wipe_ScreenWipe (int ticks);
int wipe_StartScreen(void);
int wipe_EndScreen (void);
#endif

View File

@@ -0,0 +1,178 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION: Main game control interface.
*-----------------------------------------------------------------------------*/
#ifndef __G_GAME__
#define __G_GAME__
#include "doomdef.h"
#include "d_event.h"
#include "d_ticcmd.h"
//
// GAME
//
// killough 5/2/98: number of bytes reserved for saving options
#define GAME_OPTION_SIZE 64
boolean G_Responder(event_t *ev);
boolean G_CheckDemoStatus(void);
void G_DeathMatchSpawnPlayer(int playernum);
void G_InitNew(skill_t skill, int episode, int map);
void G_DeferedInitNew(skill_t skill, int episode, int map);
void G_DeferedPlayDemo(const char *demo); // CPhipps - const
void G_LoadGame(int slot, boolean is_command); // killough 5/15/98
void G_ForcedLoadGame(void); // killough 5/15/98: forced loadgames
void G_DoLoadGame(void);
void G_SaveGame(int slot, char *description); // Called by M_Responder.
void G_BeginRecording(void);
// CPhipps - const on these string params
void G_RecordDemo(const char *name); // Only called by startup code.
void G_ExitLevel(void);
void G_SecretExitLevel(void);
void G_WorldDone(void);
void G_EndGame(void); /* cph - make m_menu.c call a G_* function for this */
void G_Ticker(void);
void G_ReloadDefaults(void); // killough 3/1/98: loads game defaults
void G_SaveGameName(char *, size_t, int, boolean); /* killough 3/22/98: sets savegame filename */
void G_SetFastParms(int); // killough 4/10/98: sets -fast parameters
void G_DoNewGame(void);
void G_DoReborn(int playernum);
void G_DoPlayDemo(void);
void G_DoCompleted(void);
void G_ReadDemoTiccmd(ticcmd_t *cmd);
void G_WriteDemoTiccmd(ticcmd_t *cmd);
void G_DoWorldDone(void);
void G_Compatibility(void);
const byte *G_ReadOptions(const byte *demo_p); /* killough 3/1/98 - cph: const byte* */
byte *G_WriteOptions(byte *demo_p); // killough 3/1/98
void G_PlayerReborn(int player);
void G_RestartLevel(void); // CPhipps - menu involked level restart
void G_DoVictory(void);
void G_BuildTiccmd (ticcmd_t* cmd); // CPhipps - move decl to header
void G_ChangedPlayerColour(int pn, int cl); // CPhipps - On-the-fly player colour changing
void G_MakeSpecialEvent(buttoncode_t bc, ...); /* cph - new event stuff */
// killough 1/18/98: Doom-style printf; killough 4/25/98: add gcc attributes
// CPhipps - renames to doom_printf to avoid name collision with glibc
void doom_printf(const char *, ...) __attribute__((format(printf,1,2)));
// killough 5/2/98: moved from m_misc.c:
extern int key_right;
extern int key_left;
extern int key_up;
extern int key_down;
extern int key_menu_right; // phares 3/7/98
extern int key_menu_left; // |
extern int key_menu_up; // V
extern int key_menu_down;
extern int key_menu_backspace; // ^
extern int key_menu_escape; // |
extern int key_menu_enter; // phares 3/7/98
extern int key_strafeleft;
extern int key_straferight;
extern int key_fire;
extern int key_use;
extern int key_strafe;
extern int key_speed;
extern int key_escape; // phares
extern int key_savegame; // |
extern int key_loadgame; // V
extern int key_autorun;
extern int key_reverse;
extern int key_zoomin;
extern int key_zoomout;
extern int key_chat;
extern int key_backspace;
extern int key_enter;
extern int key_help;
extern int key_soundvolume;
extern int key_hud;
extern int key_quicksave;
extern int key_endgame;
extern int key_messages;
extern int key_quickload;
extern int key_quit;
extern int key_gamma;
extern int key_spy;
extern int key_pause;
extern int key_setup;
extern int key_forward;
extern int key_leftturn;
extern int key_rightturn;
extern int key_backward;
extern int key_weapontoggle;
extern int key_weapon1;
extern int key_weapon2;
extern int key_weapon3;
extern int key_weapon4;
extern int key_weapon5;
extern int key_weapon6;
extern int key_weapon7;
extern int key_weapon8;
extern int key_weapon9;
extern int destination_keys[MAXPLAYERS];
extern int key_map_right;
extern int key_map_left;
extern int key_map_up;
extern int key_map_down;
extern int key_map_zoomin;
extern int key_map_zoomout;
extern int key_map;
extern int key_map_gobig;
extern int key_map_follow;
extern int key_map_mark; // ^
extern int key_map_clear; // |
extern int key_map_grid; // phares
extern int key_map_rotate; // cph - map rotation
extern int key_map_overlay;// cph - map overlay
extern int key_screenshot; // killough 2/22/98 -- add key for screenshot
extern int autorun; // always running? // phares
extern int defaultskill; //jff 3/24/98 default skill
extern boolean haswolflevels; //jff 4/18/98 wolf levels present
extern int bodyquesize; // killough 2/8/98: adustable corpse limit
// killough 5/2/98: moved from d_deh.c:
// Par times (new item with BOOM) - from g_game.c
extern int pars[4][10]; // hardcoded array size
extern int cpars[32]; // hardcoded array size
// CPhipps - Make savedesciption visible in wider scope
#define SAVEDESCLEN 32
extern char savedescription[SAVEDESCLEN]; // Description to save in savegame
/* cph - compatibility level strings */
extern const char * comp_lev_str[];
#endif

View File

@@ -0,0 +1,88 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
*
*---------------------------------------------------------------------
*/
#ifndef _GL_INTERN_H
#define _GL_INTERN_H
typedef enum
{
GLDT_UNREGISTERED,
GLDT_BROKEN,
GLDT_PATCH,
GLDT_TEXTURE,
GLDT_FLAT
} GLTexType;
typedef struct
{
int index;
int width,height;
int leftoffset,topoffset;
int tex_width,tex_height;
int realtexwidth, realtexheight;
int buffer_width,buffer_height;
int buffer_size;
int glTexID[CR_LIMIT+MAXPLAYERS];
GLTexType textype;
boolean mipmap;
} GLTexture;
extern int gld_max_texturesize;
extern char *gl_tex_format_string;
extern int gl_tex_format;
extern int gl_tex_filter;
extern int gl_mipmap_filter;
extern int gl_texture_filter_anisotropic;
extern int gl_paletted_texture;
extern int gl_shared_texture_palette;
extern boolean use_mipmapping;
extern int transparent_pal_index;
extern unsigned char gld_palmap[256];
extern GLTexture *last_gltexture;
extern int last_cm;
//e6y: in some cases textures with a zero index (NO_TEXTURE) should be registered
GLTexture *gld_RegisterTexture(int texture_num, boolean mipmap, boolean force);
void gld_BindTexture(GLTexture *gltexture);
GLTexture *gld_RegisterPatch(int lump, int cm);
void gld_BindPatch(GLTexture *gltexture, int cm);
GLTexture *gld_RegisterFlat(int lump, boolean mipmap);
void gld_BindFlat(GLTexture *gltexture);
void gld_InitPalettedTextures(void);
int gld_GetTexDimension(int value);
void gld_SetTexturePalette(GLenum target);
void gld_Precache(void);
PFNGLCOLORTABLEEXTPROC gld_ColorTableEXT;
#endif // _GL_INTERN_H

View File

@@ -0,0 +1,64 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
*
*---------------------------------------------------------------------
*/
#ifndef _GL_STRUCT_H
#define _GL_STRUCT_H
extern int nodesVersion;
void gld_Init(int width, int height);
void gld_InitCommandLine();
void gld_DrawNumPatch(int x, int y, int lump, int cm, enum patch_translation_e flags);
void gld_DrawBackground(const char* name);
void gld_DrawLine(int x0, int y0, int x1, int y1, int BaseColor);
void gld_DrawWeapon(int weaponlump, vissprite_t *vis, int lightlevel);
void gld_FillBlock(int x, int y, int width, int height, int col);
void gld_SetPalette(int palette);
unsigned char *gld_ReadScreen (void);
void gld_CleanMemory(void);
void gld_PreprocessLevel(void);
void gld_Set2DMode();
void gld_InitDrawScene(void);
void gld_StartDrawScene(void);
void gld_AddPlane(int subsectornum, visplane_t *floor, visplane_t *ceiling);
void gld_AddWall(seg_t *seg);
void gld_AddSprite(vissprite_t *vspr);
void gld_DrawScene(player_t *player);
void gld_EndDrawScene(void);
void gld_Finish();
#endif // _GL_STRUCT_H

View File

@@ -0,0 +1,247 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION: none
*
*-----------------------------------------------------------------------------*/
#ifndef __HULIB__
#define __HULIB__
// We are referring to patches.
#include "r_defs.h"
#include "v_video.h" //jff 2/16/52 include color range defs
/* background and foreground screen numbers
* different from other modules. */
#define BG 1
#define FG 0
/* font stuff
* #define HU_CHARERASE KEYD_BACKSPACE / not used / phares
*/
#define HU_MAXLINES 4
#define HU_MAXLINELENGTH 80
#define HU_REFRESHSPACING 8 /*jff 2/26/98 space lines in text refresh widget*/
/*jff 2/26/98 maximum number of messages allowed in refresh list */
#define HU_MAXMESSAGES 16
/*
* Typedefs of widgets
*/
/* Text Line widget
* (parent of Scrolling Text and Input Text widgets) */
typedef struct
{
// left-justified position of scrolling text window
int x;
int y;
const patchnum_t* f; // font
int sc; // start character
//const char *cr; //jff 2/16/52 output color range
// Proff - Made this an int again. Needed for OpenGL
int cm; //jff 2/16/52 output color range
// killough 1/23/98: Support multiple lines:
#define MAXLINES 25
int linelen;
char l[HU_MAXLINELENGTH*MAXLINES+1]; // line of text
int len; // current line length
// whether this line needs to be udpated
int needsupdate;
} hu_textline_t;
// Scrolling Text window widget
// (child of Text Line widget)
typedef struct
{
hu_textline_t l[HU_MAXLINES]; // text lines to draw
int h; // height in lines
int cl; // current line number
// pointer to boolean stating whether to update window
boolean* on;
boolean laston; // last value of *->on.
} hu_stext_t;
//jff 2/26/98 new widget to display last hud_msg_lines of messages
// Message refresh window widget
typedef struct
{
hu_textline_t l[HU_MAXMESSAGES]; // text lines to draw
int nl; // height in lines
int nr; // total height in rows
int cl; // current line number
int x,y,w,h; // window position and size
const patchnum_t *bg; // patches for background
// pointer to boolean stating whether to update window
boolean* on;
boolean laston; // last value of *->on.
} hu_mtext_t;
// Input Text Line widget
// (child of Text Line widget)
typedef struct
{
hu_textline_t l; // text line to input on
// left margin past which I am not to delete characters
int lm;
// pointer to boolean stating whether to update window
boolean* on;
boolean laston; // last value of *->on;
} hu_itext_t;
//
// Widget creation, access, and update routines
//
//
// textline code
//
// clear a line of text
void HUlib_clearTextLine(hu_textline_t *t);
void HUlib_initTextLine
(
hu_textline_t *t,
int x,
int y,
const patchnum_t *f,
int sc,
int cm //jff 2/16/98 add color range parameter
);
// returns success
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
// draws tline
void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor);
// erases text line
void HUlib_eraseTextLine(hu_textline_t *l);
//
// Scrolling Text window widget routines
//
// initialize an stext widget
void HUlib_initSText
( hu_stext_t* s,
int x,
int y,
int h,
const patchnum_t* font,
int startchar,
int cm, //jff 2/16/98 add color range parameter
boolean* on );
// add a text message to an stext widget
void HUlib_addMessageToSText(hu_stext_t* s, const char* prefix, const char* msg);
// draws stext
void HUlib_drawSText(hu_stext_t* s);
// erases all stext lines
void HUlib_eraseSText(hu_stext_t* s);
//jff 2/26/98 message refresh widget
// initialize refresh text widget
void HUlib_initMText(hu_mtext_t *m, int x, int y, int w, int h, const patchnum_t* font,
int startchar, int cm, const patchnum_t* bgfont, boolean *on);
//jff 2/26/98 message refresh widget
// add a text message to refresh text widget
void HUlib_addMessageToMText(hu_mtext_t* m, const char* prefix, const char* msg);
//jff 2/26/98 new routine to display a background on which
// the list of last hud_msg_lines are displayed
void HUlib_drawMBg
( int x,
int y,
int w,
int h,
const patchnum_t* bgp
);
//jff 2/26/98 message refresh widget
// draws mtext
void HUlib_drawMText(hu_mtext_t* m);
//jff 4/28/98 erases behind message list
void HUlib_eraseMText(hu_mtext_t* m);
// Input Text Line widget routines
void HUlib_initIText
( hu_itext_t* it,
int x,
int y,
const patchnum_t* font,
int startchar,
int cm, //jff 2/16/98 add color range parameter
boolean* on );
// resets line and left margin
void HUlib_resetIText(hu_itext_t* it);
// left of left-margin
void HUlib_addPrefixToIText
( hu_itext_t* it,
char* str );
// whether eaten
boolean HUlib_keyInIText
( hu_itext_t* it,
unsigned char ch );
void HUlib_drawIText(hu_itext_t* it);
// erases all itext lines
void HUlib_eraseIText(hu_itext_t* it);
#endif

View File

@@ -0,0 +1,90 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION: Head up display
*
*-----------------------------------------------------------------------------*/
#ifndef __HU_STUFF_H__
#define __HU_STUFF_H__
#include "d_event.h"
/*
* Globally visible constants.
*/
#define HU_FONTSTART '!' /* the first font characters */
#define HU_FONTEND (0x7f) /*jff 2/16/98 '_' the last font characters */
/* Calculate # of glyphs in font. */
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
#define HU_BROADCAST 5
/*#define HU_MSGREFRESH KEYD_ENTER phares */
#define HU_MSGX 0
#define HU_MSGY 0
#define HU_MSGWIDTH 64 /* in characters */
#define HU_MSGHEIGHT 1 /* in lines */
#define HU_MSGTIMEOUT (4*TICRATE)
/*
* Heads up text
*/
void HU_Init(void);
void HU_Start(void);
boolean HU_Responder(event_t* ev);
void HU_Ticker(void);
void HU_Drawer(void);
char HU_dequeueChatChar(void);
void HU_Erase(void);
void HU_MoveHud(void); // jff 3/9/98 avoid glitch in HUD display
/* killough 5/2/98: moved from m_misc.c: */
/* jff 2/16/98 hud supported automap colors added */
extern int hudcolor_titl; /* color range of automap level title */
extern int hudcolor_xyco; /* color range of new coords on automap */
/* jff 2/16/98 hud text colors, controls added */
extern int hudcolor_mesg; /* color range of scrolling messages */
extern int hudcolor_chat; /* color range of chat lines */
/* jff 2/26/98 hud message list color and background enable */
extern int hudcolor_list; /* color of list of past messages */
extern int hud_list_bgon; /* solid window background for list of messages */
extern int hud_msg_lines; /* number of message lines in window up to 16 */
extern int hud_distributed; /* whether hud is all in lower left or distributed */
/* jff 2/23/98 hud is currently displayed */
extern int hud_displayed; /* hud is displayed */
/* jff 2/18/98 hud/status control */
extern int hud_active; /* hud mode 0=off, 1=small, 2=full */
extern int hud_nosecrets; /* status does not list secrets/items/kills */
#endif

View File

@@ -0,0 +1,47 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Joystick interface.
*
*-----------------------------------------------------------------------------*/
extern int joybfire;
extern int joybstrafe;
extern int joybuse;
extern int joybspeed;
extern int joyleft;
extern int joyright;
extern int joyup;
extern int joydown;
extern int usejoystick;
void I_InitJoystick(void);
void I_PollJoystick(void);

View File

@@ -0,0 +1,44 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* General system functions. Signal related stuff, exit function
* prototypes, and programmable Doom clock.
*
*-----------------------------------------------------------------------------
*/
#ifndef __I_MAIN__
#define __I_MAIN__
void I_Init(void);
void I_SafeExit(int rc);
extern int (*I_GetTime)(void);
#endif

View File

@@ -0,0 +1,74 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Low level network interface.
*-----------------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef USE_SDL_NET
#include "SDL_net.h"
#define UDP_SOCKET UDPsocket
#define UDP_PACKET UDPpacket
#define AF_INET
#define UDP_CHANNEL int
extern UDP_SOCKET udp_socket;
#else
#define UDP_CHANNEL struct sockaddr
#endif
#ifndef IPPORT_RESERVED
#define IPPORT_RESERVED 1024
#endif
void I_InitNetwork(void);
size_t I_GetPacket(packet_header_t* buffer, size_t buflen);
void I_SendPacket(packet_header_t* packet, size_t len);
void I_WaitForPacket(int ms);
#ifdef USE_SDL_NET
UDP_SOCKET I_Socket(Uint16 port);
int I_ConnectToServer(const char *serv);
UDP_CHANNEL I_RegisterPlayer(IPaddress *ipaddr);
void I_UnRegisterPlayer(UDP_CHANNEL channel);
extern IPaddress sentfrom_addr;
#endif
#ifdef AF_INET
void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to);
void I_SetupSocket(int sock, int port, int family);
void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr);
extern UDP_CHANNEL sentfrom;
extern int v4socket, v6socket;
#endif
extern size_t sentbytes, recvdbytes;

View File

@@ -0,0 +1,120 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* System interface, sound.
*
*-----------------------------------------------------------------------------*/
#ifndef __I_SOUND__
#define __I_SOUND__
#include "sounds.h"
#include "doomtype.h"
#define SNDSERV
#undef SNDINTR
#ifndef SNDSERV
#include "l_soundgen.h"
#endif
// Init at program start...
void I_InitSound(void);
// ... shut down and relase at program termination.
void I_ShutdownSound(void);
//
// SFX I/O
//
// Initialize channels?
void I_SetChannels(void);
// Get raw data lump index for sound descriptor.
int I_GetSfxLumpNum (sfxinfo_t *sfxinfo);
// Starts a sound in a particular sound channel.
int I_StartSound(int id, int channel, int vol, int sep, int pitch, int priority);
// Stops a sound channel.
void I_StopSound(int handle);
// Called by S_*() functions
// to see if a channel is still playing.
// Returns 0 if no longer playing, 1 if playing.
int I_SoundIsPlaying(int handle);
// Called by m_menu.c to let the quit sound play and quit right after it stops
int I_AnySoundStillPlaying(void);
// Updates the volume, separation,
// and pitch of a sound channel.
void I_UpdateSoundParams(int handle, int vol, int sep, int pitch);
//
// MUSIC I/O
//
void I_InitMusic(void);
void I_ShutdownMusic(void);
void I_UpdateMusic(void);
// Volume.
void I_SetMusicVolume(int volume);
// PAUSE game handling.
void I_PauseSong(int handle);
void I_ResumeSong(int handle);
// Registers a song handle to song data.
int I_RegisterSong(const void *data, size_t len);
// cournia - tries to load a music file
int I_RegisterMusic( const char* filename, musicinfo_t *music );
// Called by anything that wishes to start music.
// plays a song, and when the song is done,
// starts playing it again in an endless loop.
// Horrible thing to do, considering.
void I_PlaySong(int handle, int looping);
// Stops a song over 3 seconds.
void I_StopSong(int handle);
// See above (register), then think backwards
void I_UnRegisterSong(int handle);
// Allegro card support jff 1/18/98
extern int snd_card;
extern int mus_card;
// CPhipps - put these in config file
extern int snd_samplerate;
#endif

View File

@@ -0,0 +1,93 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* System specific interface stuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __I_SYSTEM__
#define __I_SYSTEM__
#ifdef __GNUG__
#pragma interface
#endif
#include "m_fixed.h"
extern int ms_to_next_tick;
int I_StartDisplay(void);
void I_EndDisplay(void);
int I_GetTime_RealTime(void); /* killough */
#ifndef PRBOOM_SERVER
fixed_t I_GetTimeFrac (void);
#endif
void I_GetTime_SaveMS(void);
unsigned long I_GetRandomTimeSeed(void); /* cphipps */
void I_uSleep(unsigned long usecs);
/* cphipps - I_GetVersionString
* Returns a version string in the given buffer
*/
const char* I_GetVersionString(char* buf, size_t sz);
/* cphipps - I_SigString
* Returns a string describing a signal number
*/
const char* I_SigString(char* buf, size_t sz, int signum);
const char *I_DoomExeDir(void); // killough 2/16/98: path to executable's dir
char* I_FindFile(const char* wfname, const char* ext);
/* cph 2001/11/18 - wrapper for read(2) which deals with partial reads */
void I_Read(int fd, void* buf, size_t sz);
/* cph 2001/11/18 - Move W_Filelength to i_system.c */
int I_Filelength(int handle);
void I_SetAffinityMask(void);
int doom_main(int argc, char const * const * argv);
off_t lseek(int fd, off_t offset, int whence);
//HACK mmap support, w_mmap.c
#define PROT_READ 1
#define MAP_SHARED 2
#define MAP_FAILED (void*)-1
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
int munmap(void *addr, size_t length);
#endif

View File

@@ -0,0 +1,82 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* System specific interface stuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __I_VIDEO__
#define __I_VIDEO__
#include "doomtype.h"
#include "v_video.h"
#ifdef __GNUG__
#pragma interface
#endif
void I_PreInitGraphics(void); /* CPhipps - do stuff immediately on start */
void I_CalculateRes(unsigned int width, unsigned int height); /* calculate resolution */
void I_SetRes(void); /* set resolution */
void I_InitGraphics (void);
void I_UpdateVideoMode(void);
void I_ShutdownGraphics(void);
/* Takes full 8 bit values. */
void I_SetPalette(int pal); /* CPhipps - pass down palette number */
void I_UpdateNoBlit (void);
void I_FinishUpdate (void);
int I_ScreenShot (const char *fname);
/* I_StartTic
* Called by D_DoomLoop,
* called before processing each tic in a frame.
* Quick syncronous operations are performed here.
* Can call D_PostEvent.
*/
void I_StartTic (void);
/* I_StartFrame
* Called by D_DoomLoop,
* called before processing any tics in a frame
* (just after displaying a frame).
* Time consuming syncronous operations
* are performed here (joystick reading).
* Can call D_PostEvent.
*/
void I_StartFrame (void);
extern int use_doublebuffer; /* proff 2001-7-4 - controls wether to use doublebuffering*/
extern int use_fullscreen; /* proff 21/05/2000 */
extern int desired_fullscreen; //e6y
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Declarations etc. for logical console output
*
*-----------------------------------------------------------------------------*/
#ifndef __LPRINTF__
#define __LPRINTF__
typedef enum /* Logical output levels */
{
LO_INFO=1, /* One of these is used in each physical output */
LO_CONFIRM=2, /* call. Which are output, or echoed to console */
LO_WARN=4, /* if output redirected is determined by the */
LO_ERROR=8, /* global masks: cons_output_mask,cons_error_mask. */
LO_FATAL=16,
LO_DEBUG=32,
LO_ALWAYS=64,
} OutputLevels;
#ifndef __GNUC__
#define __attribute__(x)
#endif
extern int lprintf(OutputLevels pri, const char *fmt, ...) __attribute__((format(printf,2,3)));
extern int cons_output_mask;
extern int cons_error_mask;
/* killough 3/20/98: add const
* killough 4/25/98: add gcc attributes
* cphipps 01/11- moved from i_system.h */
void I_Error(const char *error, ...) __attribute__((format(printf,1,2)));
#ifdef _WIN32
void I_ConTextAttr(unsigned char a);
void I_UpdateConsole(void);
int Init_ConsoleWin(void);
void Done_ConsoleWin(void);
#endif
#endif

View File

@@ -0,0 +1,47 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Argument handling.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_ARGV__
#define __M_ARGV__
/*
* MISC
*/
extern int myargc;
extern char const * const * myargv; /* CPhipps - const * const * */
/* Returns the position of the given parameter in the arg list (0 if not found). */
int M_CheckParm(const char *check);
#endif

View File

@@ -0,0 +1,56 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Simple bounding box datatype and functions.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_BBOX__
#define __M_BBOX__
#include <limits.h>
#include "m_fixed.h"
/* Bounding box coordinate storage. */
enum
{
BOXTOP,
BOXBOTTOM,
BOXLEFT,
BOXRIGHT
}; /* bbox coordinates */
/* Bounding box functions. */
void M_ClearBox(fixed_t* box);
void M_AddToBox(fixed_t* box,fixed_t x,fixed_t y);
#endif

View File

@@ -0,0 +1,58 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Cheat code checking.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_CHEAT__
#define __M_CHEAT__
/* killough 4/16/98: Cheat table structure */
extern struct cheat_s {
const char * cheat;
const char *const deh_cheat;
enum {
always = 0,
not_dm = 1,
not_coop = 2,
not_demo = 4,
not_menu = 8,
not_deh = 16,
not_net = not_dm | not_coop
} const when;
void (*const func)();
const int arg;
uint_64_t code, mask;
} cheat[];
boolean M_FindCheats(int key);
#endif

View File

@@ -0,0 +1,223 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Fixed point arithemtics, implementation.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_FIXED__
#define __M_FIXED__
#include "config.h"
#include "doomtype.h"
/*
* Fixed point, 32bit as 16.16.
*/
#define FRACBITS 16
#define FRACUNIT (1<<FRACBITS)
typedef int fixed_t;
/*
* Absolute Value
*
* killough 5/10/98: In djgpp, use inlined assembly for performance
* killough 9/05/98: better code seems to be gotten from using inlined C
*/
#ifdef _MSC_VER
# ifdef I386_ASM
#pragma warning( disable : 4035 )
__inline static int D_abs(int x)
{
__asm
{
mov eax,x
cdq
xor eax,edx
sub eax,edx
}
}
# else /* I386_ASM */
inline static const int D_abs(x)
{
fixed_t _t = (x),_s;
_s = _t >> (8*sizeof _t-1);
return (_t^_s)-_s;
}
# endif /* I386_ASM */
#else /* _MSC_VER */
#define D_abs(x) ({fixed_t _t = (x), _s = _t >> (8*sizeof _t-1); (_t^_s)-_s;})
#endif /* _MSC_VER */
/*
* Fixed Point Multiplication
*/
#ifdef I386_ASM
# ifdef _MSC_VER
#pragma warning( disable : 4035 )
__inline static fixed_t FixedMul(fixed_t a, fixed_t b)
{
// return (fixed_t)((longlong) a*b >> FRACBITS);
__asm
{
mov eax,a
imul b
shrd eax,edx,16
}
}
#pragma warning( default : 4035 )
# else /* _MSC_VER */
/* killough 5/10/98: In djgpp, use inlined assembly for performance
* CPhipps - made __inline__ to inline, as specified in the gcc docs
* Also made const. Also __asm__ to asm, as in docs.
* Replaced inline asm with Julian's version for Eternity dated 6/7/2001
*/
inline
static CONSTFUNC fixed_t FixedMul(fixed_t a, fixed_t b)
{
fixed_t result;
asm (
" imull %2 ;"
" shrdl $16,%%edx,%0 ;"
: "=a" (result) /* eax is always the result */
: "0" (a), /* eax is also first operand */
"rm" (b) /* second operand can be reg or mem */
: "%edx", "%cc" /* edx and condition codes clobbered */
);
return result;
}
# endif /* _MSC_VER */
#else /* I386_ASM */
/* CPhipps - made __inline__ to inline, as specified in the gcc docs
* Also made const */
inline static CONSTFUNC fixed_t FixedMul(fixed_t a, fixed_t b)
{
return (fixed_t)((int_64_t) a*b >> FRACBITS);
}
#endif /* I386_ASM */
/*
* Fixed Point Division
*/
#ifdef I386_ASM
# ifdef _MSC_VER
#pragma warning( disable : 4035 )
__inline static fixed_t FixedDiv(fixed_t a, fixed_t b)
{
// e6y
// zg is a master of engineer science.
//
// Fixed crash with FixedDiv(-2147483648,x)
// Exception Number : EXCEPTION_INT_OVERFLOW(C0000095)
//
// Some other ports (Eternity, Chocolate) return wrong value instead of MAXINT.
// For example FixedDiv(-2147483648,-30576) should return INT_MAX instead of 307907126
// 307907126 is truncated correct int64 value: 4602874423 - 2^32 = 307907126
if ((unsigned)D_abs(a) >> 14 >= (unsigned)D_abs(b))
return (a^b)<0 ? INT_MIN : INT_MAX;
__asm
{
mov eax,a
mov ebx,b
mov edx,eax
shl eax,16 // proff 11/06/98: Changed from sal to shl, I think
// this is better
sar edx,16
idiv ebx // This is needed, because when I used 'idiv b' the
// compiler produced wrong code in a different place
}
}
#pragma warning( default : 4035 )
# else /* _MSC_VER */
/* killough 5/10/98: In djgpp, use inlined assembly for performance
* killough 9/5/98: optimized to reduce the number of branches
* CPhipps - made __inline__ to inline, as specified in the gcc docs
* Also made const, also __asm__ to asm as in docs.
* Replaced inline asm with Julian's version for Eternity dated 6/7/2001
*/
inline
static CONSTFUNC fixed_t FixedDiv(fixed_t a, fixed_t b)
{
//e6y: zg is a master of engineer science
if ((unsigned)D_abs(a) >> 14 < (unsigned)D_abs(b))
{
fixed_t result;
asm (
" idivl %3 ;"
: "=a" (result)
: "0" (a<<16),
"d" (a>>16),
"rm" (b)
: "%cc"
);
return result;
}
return ((a^b)>>31) ^ INT_MAX;
}
# endif /* _MSC_VER */
#else /* I386_ASM */
/* CPhipps - made __inline__ to inline, as specified in the gcc docs
* Also made const */
inline static CONSTFUNC fixed_t FixedDiv(fixed_t a, fixed_t b)
{
return ((unsigned)D_abs(a)>>14) >= (unsigned)D_abs(b) ? ((a^b)>>31) ^ INT_MAX :
(fixed_t)(((int_64_t) a << FRACBITS) / b);
}
#endif /* I386_ASM */
/* CPhipps -
* FixedMod - returns a % b, guaranteeing 0<=a<b
* (notice that the C standard for % does not guarantee this)
*/
inline static CONSTFUNC fixed_t FixedMod(fixed_t a, fixed_t b)
{
if (b & (b-1)) {
fixed_t r = a % b;
return ((r<0) ? r+b : r);
} else
return (a & (b-1));
}
#endif

View File

@@ -0,0 +1,182 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Menu widget stuff, episode selection and such.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_MENU__
#define __M_MENU__
#include "d_event.h"
//
// MENUS
//
// Called by main loop,
// saves config file and calls I_Quit when user exits.
// Even when the menu is not displayed,
// this can resize the view and change game parameters.
// Does all the real work of the menu interaction.
boolean M_Responder (event_t *ev);
// Called by main loop,
// only used for menu (skull cursor) animation.
void M_Ticker (void);
// Called by main loop,
// draws the menus directly into the screen buffer.
void M_Drawer (void);
// Called by D_DoomMain,
// loads the config file.
void M_Init (void);
// Called by intro code to force menu up upon a keypress,
// does nothing if menu is already up.
void M_StartControlPanel (void);
void M_ForcedLoadGame(const char *msg); // killough 5/15/98: forced loadgames
void M_Trans(void); // killough 11/98: reset translucency
void M_ResetMenu(void); // killough 11/98: reset main menu ordering
void M_DrawCredits(void); // killough 11/98
/* killough 8/15/98: warn about changes not being committed until next game */
#define warn_about_changes(x) (warning_about_changes=(x), \
print_warning_about_changes = 2)
extern int warning_about_changes, print_warning_about_changes;
/****************************
*
* The following #defines are for the m_flags field of each item on every
* Setup Screen. They can be OR'ed together where appropriate
*/
#define S_HILITE 0x1 // Cursor is sitting on this item
#define S_SELECT 0x2 // We're changing this item
#define S_TITLE 0x4 // Title item
#define S_YESNO 0x8 // Yes or No item
#define S_CRITEM 0x10 // Message color
#define S_COLOR 0x20 // Automap color
#define S_CHAT 0x40 // Chat String
#define S_RESET 0x80 // Reset to Defaults Button
#define S_PREV 0x100 // Previous menu exists
#define S_NEXT 0x200 // Next menu exists
#define S_KEY 0x400 // Key Binding
#define S_WEAP 0x800 // Weapon #
#define S_NUM 0x1000 // Numerical item
#define S_SKIP 0x2000 // Cursor can't land here
#define S_KEEP 0x4000 // Don't swap key out
#define S_END 0x8000 // Last item in list (dummy)
#define S_LEVWARN 0x10000// killough 8/30/98: Always warn about pending change
#define S_PRGWARN 0x20000// killough 10/98: Warn about change until next run
#define S_BADVAL 0x40000// killough 10/98: Warn about bad value
#define S_FILE 0x80000// killough 10/98: Filenames
#define S_LEFTJUST 0x100000 // killough 10/98: items which are left-justified
#define S_CREDIT 0x200000 // killough 10/98: credit
#define S_BADVID 0x400000 // killough 12/98: video mode change error
#define S_CHOICE 0x800000 // this item has several values
/* S_SHOWDESC = the set of items whose description should be displayed
* S_SHOWSET = the set of items whose setting should be displayed
* S_STRING = the set of items whose settings are strings -- killough 10/98:
* S_HASDEFPTR = the set of items whose var field points to default array
*/
#define S_SHOWDESC (S_TITLE|S_YESNO|S_CRITEM|S_COLOR|S_CHAT|S_RESET|S_PREV|S_NEXT|S_KEY|S_WEAP|S_NUM|S_FILE|S_CREDIT|S_CHOICE)
#define S_SHOWSET (S_YESNO|S_CRITEM|S_COLOR|S_CHAT|S_KEY|S_WEAP|S_NUM|S_FILE|S_CHOICE)
#define S_STRING (S_CHAT|S_FILE)
#define S_HASDEFPTR (S_STRING|S_YESNO|S_NUM|S_WEAP|S_COLOR|S_CRITEM|S_CHOICE)
/****************************
*
* The setup_group enum is used to show which 'groups' keys fall into so
* that you can bind a key differently in each 'group'.
*/
typedef enum {
m_null, // Has no meaning; not applicable
m_scrn, // A key can not be assigned to more than one action
m_map, // in the same group. A key can be assigned to one
m_menu, // action in one group, and another action in another.
} setup_group;
/****************************
*
* phares 4/17/98:
* State definition for each item.
* This is the definition of the structure for each setup item. Not all
* fields are used by all items.
*
* A setup screen is defined by an array of these items specific to
* that screen.
*
* killough 11/98:
*
* Restructured to allow simpler table entries,
* and to Xref with defaults[] array in m_misc.c.
* Moved from m_menu.c to m_menu.h so that m_misc.c can use it.
*/
typedef struct setup_menu_s
{
const char *m_text; /* text to display */
int m_flags; /* phares 4/17/98: flag bits S_* (defined above) */
setup_group m_group; /* Group */
short m_x; /* screen x position (left is 0) */
short m_y; /* screen y position (top is 0) */
union /* killough 11/98: The first field is a union of several types */
{
const void *var; /* generic variable */
int *m_key; /* key value, or 0 if not shown */
const char *name; /* name */
struct default_s *def; /* default[] table entry */
struct setup_menu_s *menu; /* next or prev menu */
} var;
int *m_mouse; /* mouse button value, or 0 if not shown */
int *m_joy; /* joystick button value, or 0 if not shown */
void (*action)(void); /* killough 10/98: function to call after changing */
const char **selectstrings; /* list of strings for choice value */
} setup_menu_t;
#endif

View File

@@ -0,0 +1,111 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* External non-system-specific stuff, like storing config settings,
* simple file handling, and saving screnshots.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_MISC__
#define __M_MISC__
#include "doomtype.h"
//
// MISC
//
boolean M_WriteFile (char const* name,void* source,int length);
int M_ReadFile (char const* name,byte** buffer);
void M_ScreenShot (void);
void M_DoScreenShot (const char*); // cph
void M_LoadDefaults (void);
void M_SaveDefaults (void);
struct default_s *M_LookupDefault(const char *name); /* killough 11/98 */
// phares 4/21/98:
// Moved from m_misc.c so m_menu.c could see it.
// CPhipps - struct to hold a value in a config file
// Cannot be a union, as it must be initialised
typedef struct default_s
{
const char* name;
/* cph -
* The location struct holds the pointer to the variable holding the
* setting. For int's we do nothing special.
* For strings, the string is actually stored on our heap with Z_Strdup()
* BUT we don't want the rest of the program to be able to modify them,
* so we declare it const. It's not really const though, and m_misc.c and
* m_menu.c cast it back when they need to change it. Possibly this is
* more trouble than it's worth.
*/
struct {
int* pi;
const char** ppsz;
} location;
struct {
int i;
const char* psz;
} defaultvalue; // CPhipps - default value
// Limits (for an int)
int minvalue; // jff 3/3/98 minimum allowed value
int maxvalue; // jff 3/3/98 maximum allowed value
enum {
def_none, // Dummy entry
def_str, // A string
def_int, // Integer
def_hex, // Integer (write in hex)
def_bool = def_int, // Boolean
def_key = def_hex, // Key code (byte)
def_mouseb = def_int,// Mouse button
def_colour = def_hex // Colour (256 colour palette entry)
} type; // CPhipps - type of entry
int setupscreen; // phares 4/19/98: setup screen where this appears
int *current; /* cph - MBF-like pointer to current value */
// cph - removed the help strings from the config file
// const char* help; // jff 3/3/98 description of parameter
// CPhipps - remove unused "lousy hack" code
struct setup_menu_s *setup_menu; /* Xref to setup menu item, if any */
} default_t;
#define IS_STRING(dv) ((dv).type == def_str)
// CPhipps - What is the max. key code that X will send us?
#define MAX_KEY 65536
#define MAX_MOUSEB 2
#define UL (-123456789) /* magic number for no min or max for parameter */
#endif

View File

@@ -0,0 +1,154 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Functions to return random numbers.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_RANDOM__
#define __M_RANDOM__
#include "doomtype.h"
// killough 1/19/98: rewritten to use to use a better random number generator
// in the new engine, although the old one is available for compatibility.
// killough 2/16/98:
//
// Make every random number generator local to each control-equivalent block.
// Critical for demo sync. Changing the order of this list breaks all previous
// versions' demos. The random number generators are made local to reduce the
// chances of sync problems. In Doom, if a single random number generator call
// was off, it would mess up all random number generators. This reduces the
// chances of it happening by making each RNG local to a control flow block.
//
// Notes to developers: if you want to reduce your demo sync hassles, follow
// this rule: for each call to P_Random you add, add a new class to the enum
// type below for each block of code which calls P_Random. If two calls to
// P_Random are not in "control-equivalent blocks", i.e. there are any cases
// where one is executed, and the other is not, put them in separate classes.
//
// Keep all current entries in this list the same, and in the order
// indicated by the #'s, because they're critical for preserving demo
// sync. Do not remove entries simply because they become unused later.
typedef enum {
pr_skullfly, // #1
pr_damage, // #2
pr_crush, // #3
pr_genlift, // #4
pr_killtics, // #5
pr_damagemobj, // #6
pr_painchance, // #7
pr_lights, // #8
pr_explode, // #9
pr_respawn, // #10
pr_lastlook, // #11
pr_spawnthing, // #12
pr_spawnpuff, // #13
pr_spawnblood, // #14
pr_missile, // #15
pr_shadow, // #16
pr_plats, // #17
pr_punch, // #18
pr_punchangle, // #19
pr_saw, // #20
pr_plasma, // #21
pr_gunshot, // #22
pr_misfire, // #23
pr_shotgun, // #24
pr_bfg, // #25
pr_slimehurt, // #26
pr_dmspawn, // #27
pr_missrange, // #28
pr_trywalk, // #29
pr_newchase, // #30
pr_newchasedir, // #31
pr_see, // #32
pr_facetarget, // #33
pr_posattack, // #34
pr_sposattack, // #35
pr_cposattack, // #36
pr_spidrefire, // #37
pr_troopattack, // #38
pr_sargattack, // #39
pr_headattack, // #40
pr_bruisattack, // #41
pr_tracer, // #42
pr_skelfist, // #43
pr_scream, // #44
pr_brainscream, // #45
pr_cposrefire, // #46
pr_brainexp, // #47
pr_spawnfly, // #48
pr_misc, // #49
pr_all_in_one, // #50
/* CPhipps - new entries from MBF, mostly unused for now */
pr_opendoor, // #51
pr_targetsearch, // #52
pr_friends, // #53
pr_threshold, // #54
pr_skiptarget, // #55
pr_enemystrafe, // #56
pr_avoidcrush, // #57
pr_stayonlift, // #58
pr_helpfriend, // #59
pr_dropoff, // #60
pr_randomjump, // #61
pr_defect, // #62 // Start new entries -- add new entries below
// End of new entries
NUMPRCLASS // MUST be last item in list
} pr_class_t;
// The random number generator's state.
typedef struct {
unsigned long seed[NUMPRCLASS]; // Each block's random seed
int rndindex, prndindex; // For compatibility support
} rng_t;
extern rng_t rng; // The rng's state
extern unsigned long rngseed; // The starting seed (not part of state)
// As M_Random, but used by the play simulation.
int P_Random(pr_class_t DA(const char *, int));
#ifdef INSTRUMENTED
#define P_Random(a) (P_Random) (a, __FILE__,__LINE__)
#endif
// Returns a number from 0 to 255,
#define M_Random() P_Random(pr_misc)
// Fix randoms for demos.
void M_ClearRandom(void);
#endif

View File

@@ -0,0 +1,134 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Endianess handling, swapping 16bit and 32bit.
*
*-----------------------------------------------------------------------------*/
#ifndef __M_SWAP__
#define __M_SWAP__
#ifdef __GNUG__
#pragma interface
#endif
/* CPhipps - now the endianness handling, converting input or output to/from
* the machine's endianness to that wanted for this type of I/O
*
* To find our own endianness, use config.h
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Endianess handling. */
/* cph - First the macros to do the actual byte swapping */
/* leban
* rather than continue the confusing tradition of redefining the
* stardard macro, we now present the doom_ntoh and doom_hton macros....
* might as well use the xdoom macros.
*/
/* Try to use superfast macros on systems that support them */
#ifdef HAVE_ASM_BYTEORDER_H
#include <asm/byteorder.h>
#ifdef __arch__swab16
#define doom_swap_s (signed short)__arch__swab16
#endif
#ifdef __arch__swab32
#define doom_swap_l (signed long)__arch__swab32
#endif
#endif /* HAVE_ASM_BYTEORDER_H */
#ifdef HAVE_LIBKERN_OSBYTEORDER_H
#include <libkern/OSByteOrder.h>
#define doom_swap_s (short)OSSwapInt16
#define doom_swap_l (long)OSSwapInt32
#endif
#ifndef doom_swap_l
#define doom_swap_l(x) \
((long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
(((unsigned long int)(x) & 0xff000000U) >> 24)))
#endif
#ifndef doom_swap_s
#define doom_swap_s(x) \
((short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
(((unsigned short int)(x) & 0xff00) >> 8)))
#endif
/* Macros are named doom_XtoYT, where
* X is thing to convert from, Y is thing to convert to, chosen from
* n for network, h for host (i.e our machine's), w for WAD (Doom data files)
* and T is the type, l or s for long or short
*
* CPhipps - all WADs and network packets will be little endian for now
* Use separate macros so network could be converted to big-endian later.
*/
#ifdef WORDS_BIGENDIAN
#define doom_wtohl(x) doom_swap_l(x)
#define doom_htowl(x) doom_swap_l(x)
#define doom_wtohs(x) doom_swap_s(x)
#define doom_htows(x) doom_swap_s(x)
#define doom_ntohl(x) doom_swap_l(x)
#define doom_htonl(x) doom_swap_l(x)
#define doom_ntohs(x) doom_swap_s(x)
#define doom_htons(x) doom_swap_s(x)
#else
#define doom_wtohl(x) (long int)(x)
#define doom_htowl(x) (long int)(x)
#define doom_wtohs(x) (short int)(x)
#define doom_htows(x) (short int)(x)
#define doom_ntohl(x) (long int)(x)
#define doom_htonl(x) (long int)(x)
#define doom_ntohs(x) (short int)(x)
#define doom_htons(x) (short int)(x)
#endif
/* CPhipps - Boom's old LONG and SHORT endianness macros are for WAD stuff */
#define LONG(x) doom_wtohl(x)
#define SHORT(x) doom_htows(x)
#endif

View File

@@ -0,0 +1,47 @@
/*
* This is the header file for the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*
* Changed so as no longer to depend on Colin Plumb's `usual.h'
* header definitions; now uses stuff from dpkg's config.h
* - Ian Jackson <ian@chiark.greenend.org.uk>.
* Still in the public domain.
*/
#ifndef MD5_H
#define MD5_H
#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define UWORD32 DWORD
#else
#include <inttypes.h>
#define UWORD32 uint32_t
#endif
#define md5byte unsigned char
struct MD5Context {
UWORD32 buf[4];
UWORD32 bytes[2];
UWORD32 in[16];
};
void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *context);
void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
#endif /* !MD5_H */

View File

@@ -0,0 +1,76 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* mmus2mid.c supports conversion of MUS format music in memory
* to MIDI format 1 music in memory.
*/
#if !defined( MMUS2MID_H )
#define MMUS2MID_H
// error codes
typedef enum
{
MUSDATACOR, // MUS data corrupt
TOOMCHAN, // Too many channels
MEMALLOC, // Memory allocation error
MUSDATAMT, // MUS file empty
BADMUSCTL, // MUS event 5 or 7 found
BADSYSEVT, // MUS system event not in 10-14 range
BADCTLCHG, // MUS control change larger than 9
TRACKOVF, // MIDI track exceeds allocation
BADMIDHDR, // bad midi header detected
} error_code_t;
// some names for integers of various sizes, all unsigned
typedef unsigned char UBYTE; // a one-byte int
typedef unsigned short UWORD; // a two-byte int
// proff: changed from unsigned int to unsigned long to avoid warning
typedef unsigned long ULONG; // a four-byte int (assumes int 4 bytes)
#ifndef MSDOS /* proff: This is from allegro.h */
#define MIDI_TRACKS 32
typedef struct MIDI /* a midi file */
{
int divisions; /* number of ticks per quarter note */
struct {
unsigned char *data; /* MIDI message stream */
int len; /* length of the track data */
} track[MIDI_TRACKS];
} MIDI;
#endif /* !MSDOS */
extern int mmus2mid(const UBYTE *mus,MIDI *mid, UWORD division, int nocomp);
extern void free_mididata(MIDI *mid);
extern int MIDIToMidi(MIDI *mididata,UBYTE **mid,int *midlen);
extern int MidiToMIDI(UBYTE *mid,MIDI *mididata);
#endif

View File

@@ -0,0 +1,4 @@
extern void (*P_Checksum)(int);
extern void P_ChecksumFinal(void);
void P_RecordChecksum(const char *file);
//void P_VerifyChecksum(const char *file);

View File

@@ -0,0 +1,118 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Enemy thinking, AI.
* Action Pointer Functions
* that are associated with states/frames.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_ENEMY__
#define __P_ENEMY__
#include "p_mobj.h"
void P_NoiseAlert (mobj_t *target, mobj_t *emmiter);
void P_SpawnBrainTargets(void); /* killough 3/26/98: spawn icon landings */
extern struct brain_s { /* killough 3/26/98: global state of boss brain */
int easy, targeton;
} brain;
// ********************************************************************
// Function addresses or Code Pointers
// ********************************************************************
// These function addresses are the Code Pointers that have been
// modified for years by Dehacked enthusiasts. The new BEX format
// allows more extensive changes (see d_deh.c)
// Doesn't work with g++, needs actionf_p1
void A_Explode();
void A_Pain();
void A_PlayerScream();
void A_Fall();
void A_XScream();
void A_Look();
void A_Chase();
void A_FaceTarget();
void A_PosAttack();
void A_Scream();
void A_SPosAttack();
void A_VileChase();
void A_VileStart();
void A_VileTarget();
void A_VileAttack();
void A_StartFire();
void A_Fire();
void A_FireCrackle();
void A_Tracer();
void A_SkelWhoosh();
void A_SkelFist();
void A_SkelMissile();
void A_FatRaise();
void A_FatAttack1();
void A_FatAttack2();
void A_FatAttack3();
void A_BossDeath();
void A_CPosAttack();
void A_CPosRefire();
void A_TroopAttack();
void A_SargAttack();
void A_HeadAttack();
void A_BruisAttack();
void A_SkullAttack();
void A_Metal();
void A_SpidRefire();
void A_BabyMetal();
void A_BspiAttack();
void A_Hoof();
void A_CyberAttack();
void A_PainAttack();
void A_PainDie();
void A_KeenDie();
void A_BrainPain();
void A_BrainScream();
void A_BrainDie();
void A_BrainAwake();
void A_BrainSpit();
void A_SpawnSound();
void A_SpawnFly();
void A_BrainExplode();
void A_Die();
void A_Detonate(); /* killough 8/9/98: detonate a bomb or other device */
void A_Mushroom(); /* killough 10/98: mushroom effect */
void A_Spawn(); // killough 11/98
void A_Turn(); // killough 11/98
void A_Face(); // killough 11/98
void A_Scratch(); // killough 11/98
void A_PlaySound(); // killough 11/98
void A_RandomJump(); // killough 11/98
void A_LineEffect(); // killough 11/98
#endif // __P_ENEMY__

View File

@@ -0,0 +1,75 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Thing events, and dehacked specified numbers controlling them.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_INTER__
#define __P_INTER__
#include "d_player.h"
#include "p_mobj.h"
#ifdef __GNUG__
#pragma interface
#endif
/* Ty 03/09/98 Moved to an int in p_inter.c for deh and externalization */
#define MAXHEALTH maxhealth
/* follow a player exlusively for 3 seconds */
#define BASETHRESHOLD (100)
boolean P_GivePower(player_t *, int);
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
void P_DamageMobj(mobj_t *target,mobj_t *inflictor,mobj_t *source,int damage);
/* killough 5/2/98: moved from d_deh.c, g_game.c, m_misc.c, others: */
extern int god_health; /* Ty 03/09/98 - deh support, see also p_inter.c */
extern int idfa_armor;
extern int idfa_armor_class;
extern int idkfa_armor;
extern int idkfa_armor_class; /* Ty - end */
/* Ty 03/13/98 - externalized initial settings for respawned player */
extern int initial_health;
extern int initial_bullets;
extern int maxhealth;
extern int max_armor;
extern int green_armor_class;
extern int blue_armor_class;
extern int max_soul;
extern int soul_health;
extern int mega_health;
extern int bfgcells;
extern int monsters_infight; // e6y: Dehacked support - monsters infight
extern int maxammo[], clipammo[];
#endif

View File

@@ -0,0 +1,92 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Map functions
*
*-----------------------------------------------------------------------------*/
#ifndef __P_MAP__
#define __P_MAP__
#include "r_defs.h"
#include "d_player.h"
#define USERANGE (64*FRACUNIT)
#define MELEERANGE (64*FRACUNIT)
#define MISSILERANGE (32*64*FRACUNIT)
// MAXRADIUS is for precalculated sector block boxes the spider demon
// is larger, but we do not have any moving sectors nearby
#define MAXRADIUS (32*FRACUNIT)
// killough 3/15/98: add fourth argument to P_TryMove
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff);
// killough 8/9/98: extra argument for telefragging
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y,boolean boss);
void P_SlideMove(mobj_t *mo);
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
void P_UseLines(player_t *player);
// killough 8/2/98: add 'mask' argument to prevent friends autoaiming at others
fixed_t P_AimLineAttack(mobj_t *t1,angle_t angle,fixed_t distance, uint_64_t mask);
void P_LineAttack(mobj_t *t1, angle_t angle, fixed_t distance,
fixed_t slope, int damage );
void P_RadiusAttack(mobj_t *spot, mobj_t *source, int damage);
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
//jff 3/19/98 P_CheckSector(): new routine to replace P_ChangeSector()
boolean P_ChangeSector(sector_t* sector,boolean crunch);
boolean P_CheckSector(sector_t *sector, boolean crunch);
void P_DelSeclist(msecnode_t*); // phares 3/16/98
void P_CreateSecNodeList(mobj_t*,fixed_t,fixed_t); // phares 3/14/98
boolean Check_Sides(mobj_t *, int, int); // phares
int P_GetMoveFactor(const mobj_t *mo, int *friction); // killough 8/28/98
int P_GetFriction(const mobj_t *mo, int *factor); // killough 8/28/98
void P_ApplyTorque(mobj_t *mo); // killough 9/12/98
/* cphipps 2004/08/30 */
void P_MapStart(void);
void P_MapEnd(void);
// If "floatok" true, move would be ok if within "tmfloorz - tmceilingz".
extern boolean floatok;
extern boolean felldown; // killough 11/98: indicates object pushed off ledge
extern fixed_t tmfloorz;
extern fixed_t tmceilingz;
extern line_t *ceilingline;
extern line_t *floorline; // killough 8/23/98
extern mobj_t *linetarget; // who got hit (or NULL)
extern msecnode_t *sector_list; // phares 3/16/98
extern fixed_t tmbbox[4]; // phares 3/20/98
extern line_t *blockline; // killough 8/11/98
#endif // __P_MAP__

View File

@@ -0,0 +1,89 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Map utility functions
*
*-----------------------------------------------------------------------------*/
#ifndef __P_MAPUTL__
#define __P_MAPUTL__
#include "r_defs.h"
/* mapblocks are used to check movement against lines and things */
#define MAPBLOCKUNITS 128
#define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
#define MAPBLOCKSHIFT (FRACBITS+7)
#define MAPBMASK (MAPBLOCKSIZE-1)
#define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
#define PT_ADDLINES 1
#define PT_ADDTHINGS 2
#define PT_EARLYOUT 4
typedef struct {
fixed_t x;
fixed_t y;
fixed_t dx;
fixed_t dy;
} divline_t;
typedef struct {
fixed_t frac; /* along trace line */
boolean isaline;
union {
mobj_t* thing;
line_t* line;
} d;
} intercept_t;
typedef boolean (*traverser_t)(intercept_t *in);
fixed_t CONSTFUNC P_AproxDistance (fixed_t dx, fixed_t dy);
int PUREFUNC P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line);
int PUREFUNC P_BoxOnLineSide (const fixed_t *tmbox, const line_t *ld);
fixed_t PUREFUNC P_InterceptVector (const divline_t *v2, const divline_t *v1);
/* cph - old compatibility version below */
fixed_t PUREFUNC P_InterceptVector2(const divline_t *v2, const divline_t *v1);
void P_LineOpening (const line_t *linedef);
void P_UnsetThingPosition(mobj_t *thing);
void P_SetThingPosition(mobj_t *thing);
boolean P_BlockLinesIterator (int x, int y, boolean func(line_t *));
boolean P_BlockThingsIterator(int x, int y, boolean func(mobj_t *));
boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
int flags, boolean trav(intercept_t *));
extern fixed_t opentop;
extern fixed_t openbottom;
extern fixed_t openrange;
extern fixed_t lowfloor;
extern divline_t trace;
#endif /* __P_MAPUTL__ */

View File

@@ -0,0 +1,403 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Map Objects, MObj, definition and handling.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_MOBJ__
#define __P_MOBJ__
// Basics.
#include "tables.h"
#include "m_fixed.h"
// We need the thinker_t stuff.
#include "d_think.h"
// We need the WAD data structure for Map things,
// from the THINGS lump.
#include "doomdata.h"
// States are tied to finite states are
// tied to animation frames.
// Needs precompiled tables/data structures.
#include "info.h"
//
// NOTES: mobj_t
//
// mobj_ts are used to tell the refresh where to draw an image,
// tell the world simulation when objects are contacted,
// and tell the sound driver how to position a sound.
//
// The refresh uses the next and prev links to follow
// lists of things in sectors as they are being drawn.
// The sprite, frame, and angle elements determine which patch_t
// is used to draw the sprite if it is visible.
// The sprite and frame values are allmost allways set
// from state_t structures.
// The statescr.exe utility generates the states.h and states.c
// files that contain the sprite/frame numbers from the
// statescr.txt source file.
// The xyz origin point represents a point at the bottom middle
// of the sprite (between the feet of a biped).
// This is the default origin position for patch_ts grabbed
// with lumpy.exe.
// A walking creature will have its z equal to the floor
// it is standing on.
//
// The sound code uses the x,y, and subsector fields
// to do stereo positioning of any sound effited by the mobj_t.
//
// The play simulation uses the blocklinks, x,y,z, radius, height
// to determine when mobj_ts are touching each other,
// touching lines in the map, or hit by trace lines (gunshots,
// lines of sight, etc).
// The mobj_t->flags element has various bit flags
// used by the simulation.
//
// Every mobj_t is linked into a single sector
// based on its origin coordinates.
// The subsector_t is found with R_PointInSubsector(x,y),
// and the sector_t can be found with subsector->sector.
// The sector links are only used by the rendering code,
// the play simulation does not care about them at all.
//
// Any mobj_t that needs to be acted upon by something else
// in the play world (block movement, be shot, etc) will also
// need to be linked into the blockmap.
// If the thing has the MF_NOBLOCK flag set, it will not use
// the block links. It can still interact with other things,
// but only as the instigator (missiles will run into other
// things, but nothing can run into a missile).
// Each block in the grid is 128*128 units, and knows about
// every line_t that it contains a piece of, and every
// interactable mobj_t that has its origin contained.
//
// A valid mobj_t is a mobj_t that has the proper subsector_t
// filled in for its xy coordinates and is linked into the
// sector from which the subsector was made, or has the
// MF_NOSECTOR flag set (the subsector_t needs to be valid
// even if MF_NOSECTOR is set), and is linked into a blockmap
// block or has the MF_NOBLOCKMAP flag set.
// Links should only be modified by the P_[Un]SetThingPosition()
// functions.
// Do not change the MF_NO? flags while a thing is valid.
//
// Any questions?
//
//
// Misc. mobj flags
//
// Call P_SpecialThing when touched.
#define MF_SPECIAL (uint_64_t)(0x0000000000000001)
// Blocks.
#define MF_SOLID (uint_64_t)(0x0000000000000002)
// Can be hit.
#define MF_SHOOTABLE (uint_64_t)(0x0000000000000004)
// Don't use the sector links (invisible but touchable).
#define MF_NOSECTOR (uint_64_t)(0x0000000000000008)
// Don't use the blocklinks (inert but displayable)
#define MF_NOBLOCKMAP (uint_64_t)(0x0000000000000010)
// Not to be activated by sound, deaf monster.
#define MF_AMBUSH (uint_64_t)(0x0000000000000020)
// Will try to attack right back.
#define MF_JUSTHIT (uint_64_t)(0x0000000000000040)
// Will take at least one step before attacking.
#define MF_JUSTATTACKED (uint_64_t)(0x0000000000000080)
// On level spawning (initial position),
// hang from ceiling instead of stand on floor.
#define MF_SPAWNCEILING (uint_64_t)(0x0000000000000100)
// Don't apply gravity (every tic),
// that is, object will float, keeping current height
// or changing it actively.
#define MF_NOGRAVITY (uint_64_t)(0x0000000000000200)
// Movement flags.
// This allows jumps from high places.
#define MF_DROPOFF (uint_64_t)(0x0000000000000400)
// For players, will pick up items.
#define MF_PICKUP (uint_64_t)(0x0000000000000800)
// Player cheat. ???
#define MF_NOCLIP (uint_64_t)(0x0000000000001000)
// Player: keep info about sliding along walls.
#define MF_SLIDE (uint_64_t)(0x0000000000002000)
// Allow moves to any height, no gravity.
// For active floaters, e.g. cacodemons, pain elementals.
#define MF_FLOAT (uint_64_t)(0x0000000000004000)
// Don't cross lines
// ??? or look at heights on teleport.
#define MF_TELEPORT (uint_64_t)(0x0000000000008000)
// Don't hit same species, explode on block.
// Player missiles as well as fireballs of various kinds.
#define MF_MISSILE (uint_64_t)(0x0000000000010000)
// Dropped by a demon, not level spawned.
// E.g. ammo clips dropped by dying former humans.
#define MF_DROPPED (uint_64_t)(0x0000000000020000)
// Use fuzzy draw (shadow demons or spectres),
// temporary player invisibility powerup.
#define MF_SHADOW (uint_64_t)(0x0000000000040000)
// Flag: don't bleed when shot (use puff),
// barrels and shootable furniture shall not bleed.
#define MF_NOBLOOD (uint_64_t)(0x0000000000080000)
// Don't stop moving halfway off a step,
// that is, have dead bodies slide down all the way.
#define MF_CORPSE (uint_64_t)(0x0000000000100000)
// Floating to a height for a move, ???
// don't auto float to target's height.
#define MF_INFLOAT (uint_64_t)(0x0000000000200000)
// On kill, count this enemy object
// towards intermission kill total.
// Happy gathering.
#define MF_COUNTKILL (uint_64_t)(0x0000000000400000)
// On picking up, count this item object
// towards intermission item total.
#define MF_COUNTITEM (uint_64_t)(0x0000000000800000)
// Special handling: skull in flight.
// Neither a cacodemon nor a missile.
#define MF_SKULLFLY (uint_64_t)(0x0000000001000000)
// Don't spawn this object
// in death match mode (e.g. key cards).
#define MF_NOTDMATCH (uint_64_t)(0x0000000002000000)
// Player sprites in multiplayer modes are modified
// using an internal color lookup table for re-indexing.
// If 0x4 0x8 or 0xc,
// use a translation table for player colormaps
#define MF_TRANSLATION (uint_64_t)(0x000000000c000000)
#define MF_TRANSLATION1 (uint_64_t)(0x0000000004000000)
#define MF_TRANSLATION2 (uint_64_t)(0x0000000008000000)
// Hmm ???.
#define MF_TRANSSHIFT 26
#define MF_UNUSED2 (uint_64_t)(0x0000000010000000)
#define MF_UNUSED3 (uint_64_t)(0x0000000020000000)
// Translucent sprite? // phares
#define MF_TRANSLUCENT (uint_64_t)(0x0000000040000000)
// this is free LONGLONG(0x0000000100000000)
// these are greater than an int. That's why the flags below are now uint_64_t
#define MF_TOUCHY LONGLONG(0x0000000100000000)
#define MF_BOUNCES LONGLONG(0x0000000200000000)
#define MF_FRIEND LONGLONG(0x0000000400000000)
// killough 9/15/98: Same, but internal flags, not intended for .deh
// (some degree of opaqueness is good, to avoid compatibility woes)
enum {
MIF_FALLING = 1, // Object is falling
MIF_ARMED = 2, // Object is armed (for MF_TOUCHY objects)
};
// Map Object definition.
//
//
// killough 2/20/98:
//
// WARNING: Special steps must be taken in p_saveg.c if C pointers are added to
// this mobj_s struct, or else savegames will crash when loaded. See p_saveg.c.
// Do not add "struct mobj_s *fooptr" without adding code to p_saveg.c to
// convert the pointers to ordinals and back for savegames. This was the whole
// reason behind monsters going to sleep when loading savegames (the "target"
// pointer was simply nullified after loading, to prevent Doom from crashing),
// and the whole reason behind loadgames crashing on savegames of AV attacks.
//
// killough 9/8/98: changed some fields to shorts,
// for better memory usage (if only for cache).
/* cph 2006/08/28 - move Prev[XYZ] fields to the end of the struct. Add any
* other new fields to the end, and make sure you don't break savegames! */
typedef struct mobj_s
{
// List: thinker links.
thinker_t thinker;
// Info for drawing: position.
fixed_t x;
fixed_t y;
fixed_t z;
// More list: links in sector (if needed)
struct mobj_s* snext;
struct mobj_s** sprev; // killough 8/10/98: change to ptr-to-ptr
//More drawing info: to determine current sprite.
angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value
int frame; // might be ORed with FF_FULLBRIGHT
// Interaction info, by BLOCKMAP.
// Links in blocks (if needed).
struct mobj_s* bnext;
struct mobj_s** bprev; // killough 8/11/98: change to ptr-to-ptr
struct subsector_s* subsector;
// The closest interval over all contacted Sectors.
fixed_t floorz;
fixed_t ceilingz;
// killough 11/98: the lowest floor over all contacted Sectors.
fixed_t dropoffz;
// For movement checking.
fixed_t radius;
fixed_t height;
// Momentums, used to update position.
fixed_t momx;
fixed_t momy;
fixed_t momz;
// If == validcount, already checked.
int validcount;
mobjtype_t type;
mobjinfo_t* info; // &mobjinfo[mobj->type]
int tics; // state tic counter
state_t* state;
uint_64_t flags;
int intflags; // killough 9/15/98: internal flags
int health;
// Movement direction, movement generation (zig-zagging).
short movedir; // 0-7
short movecount; // when 0, select a new dir
short strafecount; // killough 9/8/98: monster strafing
// Thing being chased/attacked (or NULL),
// also the originator for missiles.
struct mobj_s* target;
// Reaction time: if non 0, don't attack yet.
// Used by player to freeze a bit after teleporting.
short reactiontime;
// If >0, the current target will be chased no
// matter what (even if shot by another object)
short threshold;
// killough 9/9/98: How long a monster pursues a target.
short pursuecount;
short gear; // killough 11/98: used in torque simulation
// Additional info record for player avatars only.
// Only valid if type == MT_PLAYER
struct player_s* player;
// Player number last looked for.
short lastlook;
// For nightmare respawn.
mapthing_t spawnpoint;
// Thing being chased/attacked for tracers.
struct mobj_s* tracer;
// new field: last known enemy -- killough 2/15/98
struct mobj_s* lastenemy;
// killough 8/2/98: friction properties part of sectors,
// not objects -- removed friction properties from here
// e6y: restored friction properties here
// Friction values for the sector the object is in
int friction; // phares 3/17/98
int movefactor;
// a linked list of sectors where this object appears
struct msecnode_s* touching_sectorlist; // phares 3/14/98
fixed_t PrevX;
fixed_t PrevY;
fixed_t PrevZ;
fixed_t pad; // cph - needed so I can get the size unambiguously on amd64
// SEE WARNING ABOVE ABOUT POINTER FIELDS!!!
} mobj_t;
// External declarations (fomerly in p_local.h) -- killough 5/2/98
#define VIEWHEIGHT (41*FRACUNIT)
#define GRAVITY FRACUNIT
#define MAXMOVE (30*FRACUNIT)
#define ONFLOORZ INT_MIN
#define ONCEILINGZ INT_MAX
// Time interval for item respawning.
#define ITEMQUESIZE 128
#define FLOATSPEED (FRACUNIT*4)
#define STOPSPEED (FRACUNIT/16)
// killough 11/98:
// For torque simulation:
#define OVERDRIVE 6
#define MAXGEAR (OVERDRIVE+16)
// killough 11/98:
// Whether an object is "sentient" or not. Used for environmental influences.
#define sentient(mobj) ((mobj)->health > 0 && (mobj)->info->seestate)
extern int iquehead;
extern int iquetail;
void P_RespawnSpecials(void);
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
void P_RemoveMobj(mobj_t *th);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_MobjThinker(mobj_t *mobj);
void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
void P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type);
boolean P_IsDoomnumAllowed(int doomnum);
void P_SpawnMapThing (const mapthing_t* mthing);
void P_SpawnPlayer(int n, const mapthing_t *mthing);
void P_CheckMissileSpawn(mobj_t*); // killough 8/2/98
void P_ExplodeMissile(mobj_t*); // killough
#endif

View File

@@ -0,0 +1,119 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Sprite animation.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_PSPR__
#define __P_PSPR__
/* Basic data types.
* Needs fixed point, and BAM angles. */
#include "m_fixed.h"
#include "tables.h"
/* Needs to include the precompiled sprite animation tables.
*
* Header generated by multigen utility.
* This includes all the data for thing animation,
* i.e. the Thing Atrributes table and the Frame Sequence table.
*/
#include "info.h"
#ifdef __GNUG__
#pragma interface
#endif
/*
* Frame flags:
* handles maximum brightness (torches, muzzle flare, light sources)
*/
#define FF_FULLBRIGHT 0x8000 /* flag in thing->frame */
#define FF_FRAMEMASK 0x7fff
/*
* Overlay psprites are scaled shapes
* drawn directly on the view screen,
* coordinates are given for a 320*200 view screen.
*/
typedef enum
{
ps_weapon,
ps_flash,
NUMPSPRITES
} psprnum_t;
typedef struct
{
state_t *state; /* a NULL state means not active */
int tics;
fixed_t sx;
fixed_t sy;
} pspdef_t;
extern int weapon_preferences[2][NUMWEAPONS+1]; /* killough 5/2/98 */
int P_WeaponPreferred(int w1, int w2);
struct player_s;
int P_SwitchWeapon(struct player_s *player);
boolean P_CheckAmmo(struct player_s *player);
void P_SetupPsprites(struct player_s *curplayer);
void P_MovePsprites(struct player_s *curplayer);
void P_DropWeapon(struct player_s *player);
void A_Light0();
void A_WeaponReady();
void A_Lower();
void A_Raise();
void A_Punch();
void A_ReFire();
void A_FirePistol();
void A_Light1();
void A_FireShotgun();
void A_Light2();
void A_FireShotgun2();
void A_CheckReload();
void A_OpenShotgun2();
void A_LoadShotgun2();
void A_CloseShotgun2();
void A_FireCGun();
void A_GunFlash();
void A_FireMissile();
void A_Saw();
void A_FirePlasma();
void A_BFGsound();
void A_FireBFG();
void A_BFGSpray();
#endif

View File

@@ -0,0 +1,66 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Savegame I/O, archiving, persistence.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_SAVEG__
#define __P_SAVEG__
#ifdef __GNUG__
#pragma interface
#endif
/* Persistent storage/archiving.
* These are the load / save game routines. */
void P_ArchivePlayers(void);
void P_UnArchivePlayers(void);
void P_ArchiveWorld(void);
void P_UnArchiveWorld(void);
void P_ArchiveThinkers(void);
void P_UnArchiveThinkers(void);
void P_ArchiveSpecials(void);
void P_UnArchiveSpecials(void);
void P_ThinkerToIndex(void); /* phares 9/13/98: save soundtarget in savegame */
void P_IndexToThinker(void); /* phares 9/13/98: save soundtarget in savegame */
/* 1/18/98 killough: add RNG info to savegame */
void P_ArchiveRNG(void);
void P_UnArchiveRNG(void);
/* 2/21/98 killough: add automap info to savegame */
void P_ArchiveMap(void);
void P_UnArchiveMap(void);
extern byte *save_p;
void CheckSaveGame(size_t,const char*, int); /* killough */
#define CheckSaveGame(a) (CheckSaveGame)(a, __FILE__, __LINE__)
#endif

View File

@@ -0,0 +1,57 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Setup a game, startup stuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_SETUP__
#define __P_SETUP__
#include "p_mobj.h"
#ifdef __GNUG__
#pragma interface
#endif
void P_SetupLevel(int episode, int map, int playermask, skill_t skill);
void P_Init(void); /* Called by startup code. */
extern const byte *rejectmatrix; /* for fast sight rejection - cph - const* */
/* killough 3/1/98: change blockmap from "short" to "long" offsets: */
extern long *blockmaplump; /* offsets in blockmap are from here */
extern long *blockmap;
extern int bmapwidth;
extern int bmapheight; /* in mapblocks */
extern fixed_t bmaporgx;
extern fixed_t bmaporgy; /* origin of block map */
extern mobj_t **blocklinks; /* for thing chains */
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,75 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000,2002 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Core thinker processing prototypes.
*-----------------------------------------------------------------------------*/
#ifndef __P_TICK__
#define __P_TICK__
#include "d_think.h"
#ifdef __GNUG__
#pragma interface
#endif
/* Called by C_Ticker, can call G_PlayerExited.
* Carries out all thinking of monsters and players. */
void P_Ticker(void);
void P_InitThinkers(void);
void P_AddThinker(thinker_t *thinker);
void P_RemoveThinker(thinker_t *thinker);
void P_RemoveThinkerDelayed(thinker_t *thinker); // killough 4/25/98
void P_UpdateThinker(thinker_t *thinker); // killough 8/29/98
void P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
/* killough 8/29/98: threads of thinkers, for more efficient searches
* cph 2002/01/13: for consistency with the main thinker list, keep objects
* pending deletion on a class list too
*/
typedef enum {
th_delete,
th_misc,
th_friends,
th_enemies,
NUMTHCLASS,
th_all = NUMTHCLASS, /* For P_NextThinker, indicates "any class" */
} th_class;
extern thinker_t thinkerclasscap[];
#define thinkercap thinkerclasscap[th_all]
/* cph 2002/01/13 - iterator for thinker lists */
thinker_t* P_NextThinker(thinker_t*,th_class);
#endif

View File

@@ -0,0 +1,47 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Player related stuff.
* Bobbing POV/weapon, movement.
* Pending weapon.
*
*-----------------------------------------------------------------------------*/
#ifndef __P_USER__
#define __P_USER__
#include "d_player.h"
void P_PlayerThink(player_t *player);
void P_CalcHeight(player_t *player);
void P_DeathThink(player_t *player);
void P_MovePlayer(player_t *player);
void P_Thrust(player_t *player, angle_t angle, fixed_t move);
#endif /* __P_USER__ */

View File

@@ -0,0 +1,97 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Doom Network protocol packet definitions.
*-----------------------------------------------------------------------------*/
#include "doomtype.h"
#include "d_ticcmd.h"
#include "m_swap.h"
#include "config.h"
enum packet_type_e {
PKT_INIT, // initial packet to server
PKT_SETUP, // game information packet
PKT_GO, // game has started
PKT_TICC, // tics from client
PKT_TICS, // tics from server
PKT_RETRANS, // Request for retransmission
PKT_EXTRA, // Extra info packet
PKT_QUIT, // Player quit game
PKT_DOWN, // Server downed
PKT_WAD, // Wad file request
PKT_BACKOFF, // Request for client back-off
};
typedef struct {
byte checksum; // Simple checksum of the entire packet
byte type; /* Type of packet */
byte reserved[2]; /* Was random in prboom <=2.2.4, now 0 */
unsigned tic; // Timestamp
} PACKEDATTR packet_header_t;
static inline void packet_set(packet_header_t* p, enum packet_type_e t, unsigned long tic)
{ p->tic = doom_htonl(tic); p->type = t; p->reserved[0] = 0; p->reserved[1] = 0; }
#ifndef GAME_OPTIONS_SIZE
// From g_game.h
#define GAME_OPTIONS_SIZE 64
#endif
struct setup_packet_s {
byte players, yourplayer, skill, episode, level, deathmatch, complevel, ticdup, extratic;
byte game_options[GAME_OPTIONS_SIZE];
byte numwads;
byte wadnames[1]; // Actually longer
};
/* cph - convert network byte stream to usable ticcmd_t and visa-versa
* - the functions are functionally identical apart from parameters
* - the void* param can be unaligned. By using void* as the parameter
* it means gcc won't assume alignment so won't make false assumptions
* when optimising. So I'm told.
*/
inline static void RawToTic(ticcmd_t* dst, const void* src)
{
memcpy(dst,src,sizeof *dst);
dst->angleturn = doom_ntohs(dst->angleturn);
dst->consistancy = doom_ntohs(dst->consistancy);
}
inline static void TicToRaw(void* dst, const ticcmd_t* src)
{
/* We have to make a copy of the source struct, then do byte swaps,
* and fnially copy to the destination (can't do the swaps in the
* destination, because it might not be aligned).
*/
ticcmd_t tmp = *src;
tmp.angleturn = doom_ntohs(tmp.angleturn);
tmp.consistancy = doom_ntohs(tmp.consistancy);
memcpy(dst,&tmp,sizeof tmp);
}

View File

@@ -0,0 +1,64 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh module, BSP traversal and handling.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_BSP__
#define __R_BSP__
#ifdef __GNUG__
#pragma interface
#endif
extern seg_t *curline;
extern side_t *sidedef;
extern line_t *linedef;
extern sector_t *frontsector;
extern sector_t *backsector;
/* old code -- killough:
* extern drawseg_t drawsegs[MAXDRAWSEGS];
* new code -- killough: */
extern drawseg_t *drawsegs;
extern unsigned maxdrawsegs;
extern byte solidcol[MAX_SCREENWIDTH];
extern drawseg_t *ds_p;
void R_ClearClipSegs(void);
void R_ClearDrawSegs(void);
void R_RenderBSPNode(int bspnum);
/* killough 4/13/98: fake floors/ceilings for deep water / fake ceilings: */
sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, boolean);
#endif

View File

@@ -0,0 +1,109 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh module, data I/O, caching, retrieval of graphics
* by name.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_DATA__
#define __R_DATA__
#include "r_defs.h"
#include "r_state.h"
#include "r_patch.h"
#ifdef __GNUG__
#pragma interface
#endif
// A single patch from a texture definition, basically
// a rectangular area within the texture rectangle.
typedef struct
{
int originx, originy; // Block origin, which has already accounted
int patch; // for the internal origin of the patch.
} texpatch_t;
//
// Texture definition.
// A DOOM wall texture is a list of patches
// which are to be combined in a predefined order.
//
typedef struct
{
char name[8]; // Keep name for switch changing, etc.
int next, index; // killough 1/31/98: used in hashing algorithm
// CPhipps - moved arrays with per-texture entries to elements here
unsigned widthmask;
// CPhipps - end of additions
short width, height;
short patchcount; // All the patches[patchcount] are drawn
texpatch_t patches[1]; // back-to-front into the cached texture.
} texture_t;
extern int numtextures;
extern texture_t **textures;
const byte *R_GetTextureColumn(const rpatch_t *texpatch, int col);
// I/O, setting up the stuff.
void R_InitData (void);
void R_PrecacheLevel (void);
// Retrieval.
// Floor/ceiling opaque texture tiles,
// lookup by name. For animation?
int R_FlatNumForName (const char* name); // killough -- const added
// R_*TextureNumForName returns the texture number for the texture name, or NO_TEXTURE if
// there is no texture (i.e. "-") specified.
/* cph 2006/07/23 - defined value for no-texture marker (texture "-" in the WAD file) */
#define NO_TEXTURE 0
int PUREFUNC R_TextureNumForName (const char *name); // killough -- const added; cph - now PUREFUNC
int PUREFUNC R_SafeTextureNumForName (const char *name, int snum);
int PUREFUNC R_CheckTextureNumForName (const char *name);
void R_InitTranMap(int); // killough 3/6/98: translucency initialization
int R_ColormapNumForName(const char *name); // killough 4/4/98
/* cph 2001/11/17 - new func to do lighting calcs and get suitable colour map */
const lighttable_t* R_ColourMap(int lightlevel, fixed_t spryscale);
extern const byte *main_tranmap, *tranmap;
/* Proff - Added for OpenGL - cph - const char* param */
void R_SetPatchNum(patchnum_t *patchnum, const char *name);
#endif

View File

@@ -0,0 +1,428 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh/rendering module, shared data struct definitions.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_DEFS__
#define __R_DEFS__
// Screenwidth.
#include "doomdef.h"
// Some more or less basic data types
// we depend on.
#include "m_fixed.h"
// We rely on the thinker data struct
// to handle sound origins in sectors.
#include "d_think.h"
// SECTORS do store MObjs anyway.
#include "p_mobj.h"
#ifdef __GNUG__
#pragma interface
#endif
// Silhouette, needed for clipping Segs (mainly)
// and sprites representing things.
#define SIL_NONE 0
#define SIL_BOTTOM 1
#define SIL_TOP 2
#define SIL_BOTH 3
#define MAXDRAWSEGS 256
//
// INTERNAL MAP TYPES
// used by play and refresh
//
//
// Your plain vanilla vertex.
// Note: transformed values not buffered locally,
// like some DOOM-alikes ("wt", "WebView") do.
//
typedef struct
{
fixed_t x, y;
} vertex_t;
// Each sector has a degenmobj_t in its center for sound origin purposes.
typedef struct
{
thinker_t thinker; // not used for anything
fixed_t x, y, z;
} degenmobj_t;
//
// The SECTORS record, at runtime.
// Stores things/mobjs.
//
typedef struct
{
int iSectorID; // proff 04/05/2000: needed for OpenGL and used in debugmode by the HUD to draw sectornum
boolean no_toptextures;
boolean no_bottomtextures;
fixed_t floorheight;
fixed_t ceilingheight;
int nexttag,firsttag; // killough 1/30/98: improves searches for tags.
int soundtraversed; // 0 = untraversed, 1,2 = sndlines-1
mobj_t *soundtarget; // thing that made a sound (or null)
int blockbox[4]; // mapblock bounding box for height changes
degenmobj_t soundorg; // origin for any sounds played by the sector
int validcount; // if == validcount, already checked
mobj_t *thinglist; // list of mobjs in sector
/* killough 8/28/98: friction is a sector property, not an mobj property.
* these fields used to be in mobj_t, but presented performance problems
* when processed as mobj properties. Fix is to make them sector properties.
*/
int friction,movefactor;
// thinker_t for reversable actions
void *floordata; // jff 2/22/98 make thinkers on
void *ceilingdata; // floors, ceilings, lighting,
void *lightingdata; // independent of one another
// jff 2/26/98 lockout machinery for stairbuilding
int stairlock; // -2 on first locked -1 after thinker done 0 normally
int prevsec; // -1 or number of sector for previous step
int nextsec; // -1 or number of next step sector
// killough 3/7/98: support flat heights drawn at another sector's heights
int heightsec; // other sector, or -1 if no other sector
int bottommap, midmap, topmap; // killough 4/4/98: dynamic colormaps
// list of mobjs that are at least partially in the sector
// thinglist is a subset of touching_thinglist
struct msecnode_s *touching_thinglist; // phares 3/14/98
int linecount;
struct line_s **lines;
// killough 10/98: support skies coming from sidedefs. Allows scrolling
// skies and other effects. No "level info" kind of lump is needed,
// because you can use an arbitrary number of skies per level with this
// method. This field only applies when skyflatnum is used for floorpic
// or ceilingpic, because the rest of Doom needs to know which is sky
// and which isn't, etc.
int sky;
// killough 3/7/98: floor and ceiling texture offsets
fixed_t floor_xoffs, floor_yoffs;
fixed_t ceiling_xoffs, ceiling_yoffs;
// killough 4/11/98: support for lightlevels coming from another sector
int floorlightsec, ceilinglightsec;
short floorpic;
short ceilingpic;
short lightlevel;
short special;
short oldspecial; //jff 2/16/98 remembers if sector WAS secret (automap)
short tag;
} sector_t;
//
// The SideDef.
//
typedef struct
{
fixed_t textureoffset; // add this to the calculated texture column
fixed_t rowoffset; // add this to the calculated texture top
short toptexture; // Texture indices. We do not maintain names here.
short bottomtexture;
short midtexture;
sector_t* sector; // Sector the SideDef is facing.
// killough 4/4/98, 4/11/98: highest referencing special linedef's type,
// or lump number of special effect. Allows texture names to be overloaded
// for other functions.
int special;
} side_t;
//
// Move clipping aid for LineDefs.
//
typedef enum
{
ST_HORIZONTAL,
ST_VERTICAL,
ST_POSITIVE,
ST_NEGATIVE
} slopetype_t;
typedef struct line_s
{
int iLineID; // proff 04/05/2000: needed for OpenGL
vertex_t *v1, *v2; // Vertices, from v1 to v2.
fixed_t dx, dy; // Precalculated v2 - v1 for side checking.
unsigned short flags; // Animation related.
short special;
short tag;
unsigned short sidenum[2]; // Visual appearance: SideDefs.
fixed_t bbox[4]; // A bounding box, for the linedef's extent
slopetype_t slopetype; // To aid move clipping.
sector_t *frontsector; // Front and back sector.
sector_t *backsector;
int validcount; // if == validcount, already checked
void *specialdata; // thinker_t for reversable actions
int tranlump; // killough 4/11/98: translucency filter, -1 == none
int firsttag,nexttag; // killough 4/17/98: improves searches for tags.
int r_validcount; // cph: if == gametic, r_flags already done
enum { // cph:
RF_TOP_TILE = 1, // Upper texture needs tiling
RF_MID_TILE = 2, // Mid texture needs tiling
RF_BOT_TILE = 4, // Lower texture needs tiling
RF_IGNORE = 8, // Renderer can skip this line
RF_CLOSED =16, // Line blocks view
} r_flags;
degenmobj_t soundorg; // sound origin for switches/buttons
} line_t;
// phares 3/14/98
//
// Sector list node showing all sectors an object appears in.
//
// There are two threads that flow through these nodes. The first thread
// starts at touching_thinglist in a sector_t and flows through the m_snext
// links to find all mobjs that are entirely or partially in the sector.
// The second thread starts at touching_sectorlist in an mobj_t and flows
// through the m_tnext links to find all sectors a thing touches. This is
// useful when applying friction or push effects to sectors. These effects
// can be done as thinkers that act upon all objects touching their sectors.
// As an mobj moves through the world, these nodes are created and
// destroyed, with the links changed appropriately.
//
// For the links, NULL means top or end of list.
typedef struct msecnode_s
{
sector_t *m_sector; // a sector containing this object
struct mobj_s *m_thing; // this object
struct msecnode_s *m_tprev; // prev msecnode_t for this thing
struct msecnode_s *m_tnext; // next msecnode_t for this thing
struct msecnode_s *m_sprev; // prev msecnode_t for this sector
struct msecnode_s *m_snext; // next msecnode_t for this sector
boolean visited; // killough 4/4/98, 4/7/98: used in search algorithms
} msecnode_t;
//
// The LineSeg.
//
typedef struct
{
vertex_t *v1, *v2;
fixed_t offset;
angle_t angle;
side_t* sidedef;
line_t* linedef;
int iSegID; // proff 11/05/2000: needed for OpenGL
// figgi -- needed for glnodes
float length;
boolean miniseg;
// Sector references.
// Could be retrieved from linedef, too
// (but that would be slower -- killough)
// backsector is NULL for one sided lines
sector_t *frontsector, *backsector;
} seg_t;
//
// A SubSector.
// References a Sector.
// Basically, this is a list of LineSegs,
// indicating the visible walls that define
// (all or some) sides of a convex BSP leaf.
//
typedef struct subsector_s
{
sector_t *sector;
unsigned short numlines, firstline;
} subsector_t;
//
// BSP node.
//
typedef struct
{
fixed_t x, y, dx, dy; // Partition line.
fixed_t bbox[2][4]; // Bounding box for each child.
unsigned short children[2]; // If NF_SUBSECTOR its a subsector.
} node_t;
//
// OTHER TYPES
//
// This could be wider for >8 bit display.
// Indeed, true color support is posibble
// precalculating 24bpp lightmap/colormap LUT.
// from darkening PLAYPAL to all black.
// Could use even more than 32 levels.
typedef byte lighttable_t;
//
// Masked 2s linedefs
//
typedef struct drawseg_s
{
seg_t *curline;
int x1, x2;
fixed_t scale1, scale2, scalestep;
int silhouette; // 0=none, 1=bottom, 2=top, 3=both
fixed_t bsilheight; // do not clip sprites above this
fixed_t tsilheight; // do not clip sprites below this
// Added for filtering (fractional texture u coord) support - POPE
fixed_t rw_offset, rw_distance, rw_centerangle;
// Pointers to lists for sprite clipping,
// all three adjusted so [x1] is first value.
int *sprtopclip, *sprbottomclip, *maskedtexturecol; // dropoff overflow
} drawseg_t;
// proff: Added for OpenGL
typedef struct
{
int width,height;
int leftoffset,topoffset;
int lumpnum;
} patchnum_t;
//
// A vissprite_t is a thing that will be drawn during a refresh.
// i.e. a sprite object that is partly visible.
//
typedef struct vissprite_s
{
mobj_t *thing;
boolean flip;
int x1, x2;
fixed_t gx, gy; // for line side calculation
fixed_t gz, gzt; // global bottom / top for silhouette clipping
fixed_t startfrac; // horizontal position of x1
fixed_t scale;
fixed_t xiscale; // negative if flipped
fixed_t texturemid;
int patch;
uint_64_t mobjflags;
// for color translation and shadow draw, maxbright frames as well
const lighttable_t *colormap;
// killough 3/27/98: height sector for underwater/fake ceiling support
int heightsec;
boolean isplayersprite;
} vissprite_t;
//
// Sprites are patches with a special naming convention
// so they can be recognized by R_InitSprites.
// The base name is NNNNFx or NNNNFxFx, with
// x indicating the rotation, x = 0, 1-7.
// The sprite and frame specified by a thing_t
// is range checked at run time.
// A sprite is a patch_t that is assumed to represent
// a three dimensional object and may have multiple
// rotations pre drawn.
// Horizontal flipping is used to save space,
// thus NNNNF2F5 defines a mirrored patch.
// Some sprites will only have one picture used
// for all views: NNNNF0
//
typedef struct
{
// If false use 0 for any position.
// Note: as eight entries are available,
// we might as well insert the same name eight times.
boolean rotate;
// Lump to use for view angles 0-7.
short lump[8];
// Flip bit (1 = flip) to use for view angles 0-7.
byte flip[8];
} spriteframe_t;
//
// A sprite definition:
// a number of animation frames.
//
typedef struct
{
int numframes;
spriteframe_t *spriteframes;
} spritedef_t;
//
// Now what is a visplane, anyway?
//
// Go to http://classicgaming.com/doom/editing/ to find out -- killough
//
typedef struct visplane
{
struct visplane *next; // Next visplane in hash chain -- killough
int picnum, lightlevel, minx, maxx;
fixed_t height;
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
unsigned int pad1; // leave pads for [minx-1]/[maxx+1]
unsigned int top[MAX_SCREENWIDTH];
unsigned int pad2, pad3; // killough 2/8/98, 4/25/98
unsigned int bottom[MAX_SCREENWIDTH];
unsigned int pad4; // dropoff overflow
} visplane_t;
#endif

View File

@@ -0,0 +1,45 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Demo stuff
*
*---------------------------------------------------------------------
*/
#include "doomstat.h"
#define SMOOTH_PLAYING_MAXFACTOR 16
extern int demo_smoothturns;
extern int demo_smoothturnsfactor;
void R_SmoothPlaying_Reset(player_t *player);
void R_SmoothPlaying_Add(int delta);
angle_t R_SmoothPlaying_Get(angle_t defangle);
void R_ResetAfterTeleport(player_t *player);

View File

@@ -0,0 +1,163 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* System specific interface stuff.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_DRAW__
#define __R_DRAW__
#include "r_defs.h"
#ifdef __GNUG__
#pragma interface
#endif
enum column_pipeline_e {
RDC_PIPELINE_STANDARD,
RDC_PIPELINE_TRANSLUCENT,
RDC_PIPELINE_TRANSLATED,
RDC_PIPELINE_FUZZ,
RDC_PIPELINE_MAXPIPELINES,
};
// Used to specify what kind of filering you want
enum draw_filter_type_e {
RDRAW_FILTER_NONE,
RDRAW_FILTER_POINT,
RDRAW_FILTER_LINEAR,
RDRAW_FILTER_ROUNDED,
RDRAW_FILTER_MAXFILTERS
};
// Used to specify what kind of column edge rendering to use on masked
// columns. SQUARE = standard, SLOPED = slope the column edge up or down
// based on neighboring columns
enum sloped_edge_type_e {
RDRAW_MASKEDCOLUMNEDGE_SQUARE,
RDRAW_MASKEDCOLUMNEDGE_SLOPED
};
// Packaged into a struct - POPE
typedef struct {
int x;
int yl;
int yh;
fixed_t z; // the current column z coord
fixed_t iscale;
fixed_t texturemid;
int texheight; // killough
fixed_t texu; // the current column u coord
const byte *source; // first pixel in a column
const byte *prevsource; // first pixel in previous column
const byte *nextsource; // first pixel in next column
const lighttable_t *colormap;
const lighttable_t *nextcolormap;
const byte *translation;
int edgeslope; // OR'ed RDRAW_EDGESLOPE_*
// 1 if R_DrawColumn* is currently drawing a masked column, otherwise 0
int drawingmasked;
enum sloped_edge_type_e edgetype;
} draw_column_vars_t;
void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars);
void R_VideoErase(int x, int y, int count);
typedef struct {
int y;
int x1;
int x2;
fixed_t z; // the current span z coord
fixed_t xfrac;
fixed_t yfrac;
fixed_t xstep;
fixed_t ystep;
const byte *source; // start of a 64*64 tile image
const lighttable_t *colormap;
const lighttable_t *nextcolormap;
} draw_span_vars_t;
typedef struct {
byte *byte_topleft;
unsigned short *short_topleft;
unsigned int *int_topleft;
int byte_pitch;
int short_pitch;
int int_pitch;
enum draw_filter_type_e filterwall;
enum draw_filter_type_e filterfloor;
enum draw_filter_type_e filtersprite;
enum draw_filter_type_e filterz;
enum draw_filter_type_e filterpatch;
enum sloped_edge_type_e sprite_edges;
enum sloped_edge_type_e patch_edges;
// Used to specify an early-out magnification threshold for filtering.
// If a texture is being minified (dcvars.iscale > rdraw_magThresh), then it
// drops back to point filtering.
fixed_t mag_threshold;
} draw_vars_t;
extern draw_vars_t drawvars;
extern byte playernumtotrans[MAXPLAYERS]; // CPhipps - what translation table for what player
extern byte *translationtables;
typedef void (*R_DrawColumn_f)(draw_column_vars_t *dcvars);
R_DrawColumn_f R_GetDrawColumnFunc(enum column_pipeline_e type,
enum draw_filter_type_e filter,
enum draw_filter_type_e filterz);
// Span blitting for rows, floor/ceiling. No Spectre effect needed.
typedef void (*R_DrawSpan_f)(draw_span_vars_t *dsvars);
R_DrawSpan_f R_GetDrawSpanFunc(enum draw_filter_type_e filter,
enum draw_filter_type_e filterz);
void R_DrawSpan(draw_span_vars_t *dsvars);
void R_InitBuffer(int width, int height);
// Initialize color translation tables, for player rendering etc.
void R_InitTranslationTables(void);
// Rendering function.
void R_FillBackScreen(void);
// If the view size is not full screen, draws a border around it.
void R_DrawViewBorder(void);
// haleyjd 09/13/04: new function to call from main rendering loop
// which gets rid of the unnecessary reset of various variables during
// column drawing.
void R_ResetColumnBuffer(void);
#endif

View File

@@ -0,0 +1,174 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
*-----------------------------------------------------------------------------*/
#ifndef R_FILTER_H
#define R_FILTER_H
#define DITHER_DIM 4
extern byte filter_ditherMatrix[DITHER_DIM][DITHER_DIM];
#define FILTER_UVBITS 6
#define FILTER_UVDIM (1<<FILTER_UVBITS)
extern byte filter_roundedUVMap[FILTER_UVDIM*FILTER_UVDIM];
extern byte filter_roundedRowMap[4*16];
void R_FilterInit(void);
// Use the dither matrix to determine whether a pixel is on or off based
// on the overall intensity we're trying to simulate
#define filter_getDitheredPixelLevel(x, y, intensity) \
((filter_ditherMatrix[(y)&(DITHER_DIM-1)][(x)&(DITHER_DIM-1)] < (intensity)) ? 1 : 0)
// Choose current pixel or next pixel down based on dither of the fractional
// texture V coord. texV is not a true fractional texture coord, so it
// has to be converted using ((texV) - dcvars.yl) >> 8), which was empirically
// derived. the "-dcvars.yl" is apparently required to offset some minor
// shaking in coordinate y-axis and prevents dithering seams
#define FILTER_GETV(x,y,texV,nextRowTexV) \
(filter_getDitheredPixelLevel(x, y, (((texV) - yl) >> 8)&0xff) ? ((nextRowTexV)>>FRACBITS) : ((texV)>>FRACBITS))
// Choose current column or next column to the right based on dither of the
// fractional texture U coord
#define filter_getDitheredForColumn(x, y, texV, nextRowTexV) \
dither_sources[(filter_getDitheredPixelLevel(x, y, filter_fracu))][FILTER_GETV(x,y,texV,nextRowTexV)]
#define filter_getRoundedForColumn(texV, nextRowTexV) \
filter_getScale2xQuadColors( \
source[ ((texV)>>FRACBITS) ], \
source[ (MAX(0, ((texV)>>FRACBITS)-1)) ], \
nextsource[ ((texV)>>FRACBITS) ], \
source[ ((nextRowTexV)>>FRACBITS) ], \
prevsource[ ((texV)>>FRACBITS) ] \
) \
[ filter_roundedUVMap[ \
((filter_fracu>>(8-FILTER_UVBITS))<<FILTER_UVBITS) + \
((((texV)>>8) & 0xff)>>(8-FILTER_UVBITS)) \
] ]
#define filter_getRoundedForSpan(texU, texV) \
filter_getScale2xQuadColors( \
source[ (((texU)>>16)&0x3f) | (((texV)>>10)&0xfc0) ], \
source[ (((texU)>>16)&0x3f) | ((((texV)-FRACUNIT)>>10)&0xfc0) ], \
source[ ((((texU)+FRACUNIT)>>16)&0x3f) | (((texV)>>10)&0xfc0) ], \
source[ (((texU)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0) ], \
source[ ((((texU)-FRACUNIT)>>16)&0x3f) | (((texV)>>10)&0xfc0) ] \
) \
[ filter_roundedUVMap[ \
(((((texU)>>8) & 0xff)>>(8-FILTER_UVBITS))<<FILTER_UVBITS) + \
((((texV)>>8) & 0xff)>>(8-FILTER_UVBITS)) \
] ]
byte *filter_getScale2xQuadColors(byte e, byte b, byte f, byte h, byte d);
// This is the horrendous macro version of the function commented out of
// r_filter.c. It does a bilinear blend on the four source texels for a
// given u and v
#define filter_getFilteredForColumn32(depthmap, texV, nextRowTexV) ( \
VID_PAL32( depthmap(nextsource[(nextRowTexV)>>FRACBITS]), (filter_fracu*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL32( depthmap(source[(nextRowTexV)>>FRACBITS]), ((0xffff-filter_fracu)*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL32( depthmap(source[(texV)>>FRACBITS]), ((0xffff-filter_fracu)*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL32( depthmap(nextsource[(texV)>>FRACBITS]), (filter_fracu*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS) ))
// The 16 bit method of the filtering doesn't really maintain enough
// accuracy for discerning viewers, but the alternative requires converting
// from 32 bit, which is slow and requires both the intPalette and the
// shortPalette to be in memory at the same time.
#define filter_getFilteredForColumn16(depthmap, texV, nextRowTexV) ( \
VID_PAL16( depthmap(nextsource[(nextRowTexV)>>FRACBITS]), (filter_fracu*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL16( depthmap(source[(nextRowTexV)>>FRACBITS]), ((0xffff-filter_fracu)*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL16( depthmap(source[(texV)>>FRACBITS]), ((0xffff-filter_fracu)*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL16( depthmap(nextsource[(texV)>>FRACBITS]), (filter_fracu*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS) ))
#define filter_getFilteredForColumn15(depthmap, texV, nextRowTexV) ( \
VID_PAL15( depthmap(nextsource[(nextRowTexV)>>FRACBITS]), (filter_fracu*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL15( depthmap(source[(nextRowTexV)>>FRACBITS]), ((0xffff-filter_fracu)*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL15( depthmap(source[(texV)>>FRACBITS]), ((0xffff-filter_fracu)*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS) ) + \
VID_PAL15( depthmap(nextsource[(texV)>>FRACBITS]), (filter_fracu*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS) ))
// Same as for column but wrapping at 64
#define filter_getFilteredForSpan32(depthmap, texU, texV) ( \
VID_PAL32( depthmap(source[ ((((texU)+FRACUNIT)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0)]), (unsigned int)(((texU)&0xffff)*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL32( depthmap(source[ (((texU)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0)]), (unsigned int)((0xffff-((texU)&0xffff))*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL32( depthmap(source[ (((texU)>>16)&0x3f) | (((texV)>>10)&0xfc0)]), (unsigned int)((0xffff-((texU)&0xffff))*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL32( depthmap(source[ ((((texU)+FRACUNIT)>>16)&0x3f) | (((texV)>>10)&0xfc0)]), (unsigned int)(((texU)&0xffff)*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS)))
// Use 16 bit addition here since it's a little faster and the defects from
// such low-accuracy blending are less visible on spans
#define filter_getFilteredForSpan16(depthmap, texU, texV) ( \
VID_PAL16( depthmap(source[ ((((texU)+FRACUNIT)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0)]), (unsigned int)(((texU)&0xffff)*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL16( depthmap(source[ (((texU)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0)]), (unsigned int)((0xffff-((texU)&0xffff))*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL16( depthmap(source[ (((texU)>>16)&0x3f) | (((texV)>>10)&0xfc0)]), (unsigned int)((0xffff-((texU)&0xffff))*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL16( depthmap(source[ ((((texU)+FRACUNIT)>>16)&0x3f) | (((texV)>>10)&0xfc0)]), (unsigned int)(((texU)&0xffff)*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS)))
#define filter_getFilteredForSpan15(depthmap, texU, texV) ( \
VID_PAL15( depthmap(source[ ((((texU)+FRACUNIT)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0)]), (unsigned int)(((texU)&0xffff)*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL15( depthmap(source[ (((texU)>>16)&0x3f) | ((((texV)+FRACUNIT)>>10)&0xfc0)]), (unsigned int)((0xffff-((texU)&0xffff))*((texV)&0xffff))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL15( depthmap(source[ (((texU)>>16)&0x3f) | (((texV)>>10)&0xfc0)]), (unsigned int)((0xffff-((texU)&0xffff))*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS)) + \
VID_PAL15( depthmap(source[ ((((texU)+FRACUNIT)>>16)&0x3f) | (((texV)>>10)&0xfc0)]), (unsigned int)(((texU)&0xffff)*(0xffff-((texV)&0xffff)))>>(32-VID_COLORWEIGHTBITS)))
// do red and blue at once for slight speedup
#define GETBLENDED15_5050(col1, col2) \
((((col1&0x7c1f)+(col2&0x7c1f))>>1)&0x7c1f) | \
((((col1&0x03e0)+(col2&0x03e0))>>1)&0x03e0)
#define GETBLENDED16_5050(col1, col2) \
((((col1&0xf81f)+(col2&0xf81f))>>1)&0xf81f) | \
((((col1&0x07e0)+(col2&0x07e0))>>1)&0x07e0)
#define GETBLENDED32_5050(col1, col2) \
((((col1&0xff00ff)+(col2&0xff00ff))>>1)&0xff00ff) | \
((((col1&0x00ff00)+(col2&0x00ff00))>>1)&0x00ff00)
#define GETBLENDED15_3268(col1, col2) \
((((col1&0x7c1f)*5+(col2&0x7c1f)*11)>>4)&0x7c1f) | \
((((col1&0x03e0)*5+(col2&0x03e0)*11)>>4)&0x03e0)
#define GETBLENDED16_3268(col1, col2) \
((((col1&0xf81f)*5+(col2&0xf81f)*11)>>4)&0xf81f) | \
((((col1&0x07e0)*5+(col2&0x07e0)*11)>>4)&0x07e0)
#define GETBLENDED32_3268(col1, col2) \
((((col1&0xff00ff)*5+(col2&0xff00ff)*11)>>4)&0xff00ff) | \
((((col1&0x00ff00)*5+(col2&0x00ff00)*11)>>4)&0x00ff00)
#define GETBLENDED15_9406(col1, col2) \
((((col1&0x7c1f)*15+(col2&0x7c1f))>>4)&0x7c1f) | \
((((col1&0x03e0)*15+(col2&0x03e0))>>4)&0x03e0)
#define GETBLENDED16_9406(col1, col2) \
((((col1&0xf81f)*15+(col2&0xf81f))>>4)&0xf81f) | \
((((col1&0x07e0)*15+(col2&0x07e0))>>4)&0x07e0)
#define GETBLENDED32_9406(col1, col2) \
((((col1&0xff00ff)*15+(col2&0xff00ff))>>4)&0xff00ff) | \
((((col1&0x00ff00)*15+(col2&0x00ff00))>>4)&0x00ff00)
#endif

View File

@@ -0,0 +1,76 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Uncapped framerate stuff
*
*---------------------------------------------------------------------
*/
#ifndef __R_FPS__
#define __R_FPS__
#include "doomstat.h"
extern int movement_smooth;
typedef struct {
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
angle_t viewpitch;
} view_vars_t;
extern view_vars_t original_view_vars;
typedef struct {
unsigned int start;
unsigned int next;
unsigned int step;
fixed_t frac;
float msec;
} tic_vars_t;
extern tic_vars_t tic_vars;
void R_InitInterpolation(void);
void R_InterpolateView (player_t *player, fixed_t frac);
extern boolean WasRenderedInTryRunTics;
void R_ResetViewInterpolation ();
void R_UpdateInterpolations();
void R_StopAllInterpolations(void);
void R_DoInterpolations(fixed_t smoothratio);
void R_RestoreInterpolations();
void R_ActivateSectorInterpolations();
void R_ActivateThinkerInterpolations(thinker_t *th);
void R_StopInterpolationIfNeeded(thinker_t *th);
#endif

View File

@@ -0,0 +1,120 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Renderer main interface.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_MAIN__
#define __R_MAIN__
#include "d_player.h"
#include "r_data.h"
#ifdef __GNUG__
#pragma interface
#endif
//
// POV related.
//
extern fixed_t viewcos;
extern fixed_t viewsin;
extern int viewwidth;
extern int viewheight;
extern int viewwindowx;
extern int viewwindowy;
extern int centerx;
extern int centery;
extern fixed_t centerxfrac;
extern fixed_t centeryfrac;
extern fixed_t viewheightfrac; //e6y: for correct clipping of things
extern fixed_t projection;
// proff 11/06/98: Added for high-res
extern fixed_t projectiony;
extern int validcount;
//
// Rendering stats
//
extern int rendered_visplanes, rendered_segs, rendered_vissprites;
extern boolean rendering_stats;
//
// Lighting LUT.
// Used for z-depth cuing per column/row,
// and other lighting effects (sector ambient, flash).
//
// Lighting constants.
#define LIGHTLEVELS 16
#define LIGHTSEGSHIFT 4
#define MAXLIGHTSCALE 48
#define LIGHTSCALESHIFT 12
#define MAXLIGHTZ 128
#define LIGHTZSHIFT 20
// killough 3/20/98: Allow colormaps to be dynamic (e.g. underwater)
extern const lighttable_t *(*zlight)[MAXLIGHTZ];
extern const lighttable_t *fullcolormap;
extern int numcolormaps; // killough 4/4/98: dynamic number of maps
extern const lighttable_t **colormaps;
// killough 3/20/98, 4/4/98: end dynamic colormaps
extern int extralight;
extern const lighttable_t *fixedcolormap;
// Number of diminishing brightness levels.
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
#define NUMCOLORMAPS 32
//
// Utility functions.
//
PUREFUNC int R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
PUREFUNC int R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
angle_t R_PointToAngle(fixed_t x, fixed_t y);
angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
//
// REFRESH - the actual rendering functions.
//
void R_RenderPlayerView(player_t *player); // Called by G_Drawer.
void R_Init(void); // Called by startup code.
void R_SetViewSize(int blocks); // Called by M_Responder.
void R_ExecuteSetViewSize(void); // cph - called by D_Display to complete a view resize
#endif

View File

@@ -0,0 +1,111 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
*-----------------------------------------------------------------------------*/
#ifndef R_PATCH_H
#define R_PATCH_H
// Used to specify the sloping of the top and bottom of a column post
typedef enum {
RDRAW_EDGESLOPE_TOP_UP = (1<<0),
RDRAW_EDGESLOPE_TOP_DOWN = (1<<1),
RDRAW_EDGESLOPE_BOT_UP = (1<<2),
RDRAW_EDGESLOPE_BOT_DOWN = (1<<3),
RDRAW_EDGESLOPE_TOP_MASK = 0x3,
RDRAW_EDGESLOPE_BOT_MASK = 0xc,
} edgeslope_t;
typedef struct {
int topdelta;
int length;
edgeslope_t slope;
} rpost_t;
typedef struct {
int numPosts;
rpost_t *posts;
unsigned char *pixels;
} rcolumn_t;
typedef struct {
int width;
int height;
unsigned widthmask;
unsigned char isNotTileable;
int leftoffset;
int topoffset;
// this is the single malloc'ed/free'd array
// for this patch
unsigned char *data;
// these are pointers into the data array
unsigned char *pixels;
rcolumn_t *columns;
rpost_t *posts;
#ifdef TIMEDIAG
int locktic;
#endif
unsigned int locks;
} rpatch_t;
const rpatch_t *R_CachePatchNum(int id);
void R_UnlockPatchNum(int id);
#define R_CachePatchName(name) R_CachePatchNum(W_GetNumForName(name))
#define R_UnlockPatchName(name) R_UnlockPatchNum(W_GetNumForName(name))
const rpatch_t *R_CacheTextureCompositePatchNum(int id);
void R_UnlockTextureCompositePatchNum(int id);
// Size query funcs
int R_NumPatchWidth(int lump) ;
int R_NumPatchHeight(int lump);
#define R_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name))
#define R_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name))
const rcolumn_t *R_GetPatchColumnWrapped(const rpatch_t *patch, int columnIndex);
const rcolumn_t *R_GetPatchColumnClamped(const rpatch_t *patch, int columnIndex);
// returns R_GetPatchColumnWrapped for square, non-holed textures
// and R_GetPatchColumnClamped otherwise
const rcolumn_t *R_GetPatchColumn(const rpatch_t *patch, int columnIndex);
void R_InitPatches();
void R_FlushAllPatches();
#endif

View File

@@ -0,0 +1,67 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh, visplane stuff (floor, ceilings).
*
*-----------------------------------------------------------------------------*/
#ifndef __R_PLANE__
#define __R_PLANE__
#include "r_data.h"
#ifdef __GNUG__
#pragma interface
#endif
/* killough 10/98: special mask indicates sky flat comes from sidedef */
#define PL_SKYFLAT (0x80000000)
/* Visplane related. */
extern int *lastopening; // dropoff overflow
extern int floorclip[], ceilingclip[]; // dropoff overflow
extern fixed_t yslope[], distscale[];
void R_InitPlanes(void);
void R_ClearPlanes(void);
void R_DrawPlanes (void);
visplane_t *R_FindPlane(
fixed_t height,
int picnum,
int lightlevel,
fixed_t xoffs, /* killough 2/28/98: add x-y offsets */
fixed_t yoffs
);
visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop);
visplane_t *R_DupPlane(const visplane_t *pl, int start, int stop);
#endif

View File

@@ -0,0 +1,44 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh module, drawing LineSegs from BSP.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_SEGS__
#define __R_SEGS__
#ifdef __GNUG__
#pragma interface
#endif
void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2);
void R_StoreWallRange(const int start, const int stop);
#endif

View File

@@ -0,0 +1,55 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Sky rendering.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_SKY__
#define __R_SKY__
#include "m_fixed.h"
#ifdef __GNUG__
#pragma interface
#endif
/* SKY, store the number for name. */
#define SKYFLATNAME "F_SKY1"
/* The sky map is 256*128*4 maps. */
#define ANGLETOSKYSHIFT 22
extern int skytexture;
extern int skytexturemid;
/* Called whenever the view size changes. */
void R_InitSkyMap(void);
#endif

View File

@@ -0,0 +1,116 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Refresh/render internal state variables (global).
*
*-----------------------------------------------------------------------------*/
#ifndef __R_STATE__
#define __R_STATE__
// Need data structure definitions.
#include "d_player.h"
#include "r_data.h"
#ifdef __GNUG__
#pragma interface
#endif
//
// Refresh internal data structures,
// for rendering.
//
// needed for texture pegging
extern fixed_t *textureheight;
extern int scaledviewwidth;
extern int firstflat, numflats;
// for global animation
extern int *flattranslation;
extern int *texturetranslation;
// Sprite....
extern int firstspritelump;
extern int lastspritelump;
extern int numspritelumps;
//
// Lookup tables for map data.
//
extern int numsprites;
extern spritedef_t *sprites;
extern int numvertexes;
extern vertex_t *vertexes;
extern int numsegs;
extern seg_t *segs;
extern int numsectors;
extern sector_t *sectors;
extern int numsubsectors;
extern subsector_t *subsectors;
extern int numnodes;
extern node_t *nodes;
extern int numlines;
extern line_t *lines;
extern int numsides;
extern side_t *sides;
//
// POV data.
//
extern fixed_t viewx;
extern fixed_t viewy;
extern fixed_t viewz;
extern angle_t viewangle;
extern player_t *viewplayer;
extern angle_t clipangle;
extern int viewangletox[FINEANGLES/2];
extern angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
extern fixed_t rw_distance;
extern angle_t rw_normalangle;
// angle to line origin
extern int rw_angle1;
extern visplane_t *floorplane;
extern visplane_t *ceilingplane;
#endif

View File

@@ -0,0 +1,72 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Rendering of moving objects, sprites.
*
*-----------------------------------------------------------------------------*/
#ifndef __R_THINGS__
#define __R_THINGS__
#ifdef __GNUG__
#pragma interface
#endif
#include "r_draw.h"
/* Constant arrays used for psprite clipping and initializing clipping. */
extern int negonearray[MAX_SCREENWIDTH]; /* killough 2/8/98: */ // dropoff overflow
extern int screenheightarray[MAX_SCREENWIDTH]; /* change to MAX_* */ // dropoff overflow
/* Vars for R_DrawMaskedColumn */
extern int *mfloorclip; // dropoff overflow
extern int *mceilingclip; // dropoff overflow
extern fixed_t spryscale;
extern fixed_t sprtopscreen;
extern fixed_t pspritescale;
extern fixed_t pspriteiscale;
/* proff 11/06/98: Added for high-res */
extern fixed_t pspriteyscale;
void R_DrawMaskedColumn(const rpatch_t *patch,
R_DrawColumn_f colfunc,
draw_column_vars_t *dcvars,
const rcolumn_t *column,
const rcolumn_t *prevcolumn,
const rcolumn_t *nextcolumn);
void R_SortVisSprites(void);
void R_AddSprites(subsector_t* subsec, int lightlevel);
void R_DrawPlayerSprites(void);
void R_InitSprites(const char * const * namelist);
void R_ClearSprites(void);
void R_DrawMasked(void);
#endif

View File

@@ -0,0 +1,100 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* The not so system specific sound interface.
*
*-----------------------------------------------------------------------------*/
#ifndef __S_SOUND__
#define __S_SOUND__
#ifdef __GNUG__
#pragma interface
#endif
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(int sfxVolume, int musicVolume);
// Kills all sounds
void S_Stop(void);
//
// Per level startup code.
// Kills playing sounds at start of level,
// determines music if any, changes music.
//
void S_Start(void);
//
// Start sound for thing at <origin>
// using <sound_id> from sounds.h
//
void S_StartSound(void *origin, int sound_id);
// Will start a sound at a given volume.
void S_StartSoundAtVolume(void *origin, int sound_id, int volume);
// killough 4/25/98: mask used to indicate sound origin is player item pickup
#define PICKUP_SOUND (0x8000)
// Stop sound for thing at <origin>
void S_StopSound(void* origin);
// Start music using <music_id> from sounds.h
void S_StartMusic(int music_id);
// Start music using <music_id> from sounds.h, and set whether looping
void S_ChangeMusic(int music_id, int looping);
// Stops the music fer sure.
void S_StopMusic(void);
// Stop and resume music, during game PAUSE.
void S_PauseSound(void);
void S_ResumeSound(void);
//
// Updates music & sounds
//
void S_UpdateSounds(void* listener);
void S_SetMusicVolume(int volume);
void S_SetSfxVolume(int volume);
// machine-independent sound params
extern int default_numChannels;
extern int numChannels;
//jff 3/17/98 holds last IDMUS number, or -1
extern int idmusnum;
#endif

View File

@@ -0,0 +1,305 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Created by the sound utility written by Dave Taylor.
* Kept as a sample, DOOM2 sounds. Frozen.
*
*-----------------------------------------------------------------------------*/
#ifndef __SOUNDS__
#define __SOUNDS__
//
// SoundFX struct.
//
struct sfxinfo_struct;
typedef struct sfxinfo_struct sfxinfo_t;
struct sfxinfo_struct {
// up to 6-character name
const char *name; // CPhipps - const
// Sfx singularity (only one at a time)
int singularity;
// Sfx priority
int priority;
// referenced sound if a link
sfxinfo_t *link;
// pitch if a link
int pitch;
// volume if a link
int volume;
// sound data
void *data;
// this is checked every second to see if sound
// can be thrown out (if 0, then decrement, if -1,
// then throw out, if > 0, then it is in use)
int usefulness;
// lump number of sfx
int lumpnum;
};
//
// MusicInfo struct.
//
typedef struct {
// up to 6-character name
const char *name; // CPhipps - const
// lump number of music
int lumpnum;
/* music data - cphipps 4/11 made const void* */
const void *data;
// music handle once registered
int handle;
} musicinfo_t;
// the complete set of sound effects
extern sfxinfo_t S_sfx[];
// the complete set of music
extern musicinfo_t S_music[];
//
// Identifiers for all music in game.
//
typedef enum {
mus_None,
mus_e1m1,
mus_e1m2,
mus_e1m3,
mus_e1m4,
mus_e1m5,
mus_e1m6,
mus_e1m7,
mus_e1m8,
mus_e1m9,
mus_e2m1,
mus_e2m2,
mus_e2m3,
mus_e2m4,
mus_e2m5,
mus_e2m6,
mus_e2m7,
mus_e2m8,
mus_e2m9,
mus_e3m1,
mus_e3m2,
mus_e3m3,
mus_e3m4,
mus_e3m5,
mus_e3m6,
mus_e3m7,
mus_e3m8,
mus_e3m9,
mus_inter,
mus_intro,
mus_bunny,
mus_victor,
mus_introa,
mus_runnin,
mus_stalks,
mus_countd,
mus_betwee,
mus_doom,
mus_the_da,
mus_shawn,
mus_ddtblu,
mus_in_cit,
mus_dead,
mus_stlks2,
mus_theda2,
mus_doom2,
mus_ddtbl2,
mus_runni2,
mus_dead2,
mus_stlks3,
mus_romero,
mus_shawn2,
mus_messag,
mus_count2,
mus_ddtbl3,
mus_ampie,
mus_theda3,
mus_adrian,
mus_messg2,
mus_romer2,
mus_tense,
mus_shawn3,
mus_openin,
mus_evil,
mus_ultima,
mus_read_m,
mus_dm2ttl,
mus_dm2int,
NUMMUSIC
} musicenum_t;
//
// Identifiers for all sfx in game.
//
typedef enum {
sfx_None,
sfx_pistol,
sfx_shotgn,
sfx_sgcock,
sfx_dshtgn,
sfx_dbopn,
sfx_dbcls,
sfx_dbload,
sfx_plasma,
sfx_bfg,
sfx_sawup,
sfx_sawidl,
sfx_sawful,
sfx_sawhit,
sfx_rlaunc,
sfx_rxplod,
sfx_firsht,
sfx_firxpl,
sfx_pstart,
sfx_pstop,
sfx_doropn,
sfx_dorcls,
sfx_stnmov,
sfx_swtchn,
sfx_swtchx,
sfx_plpain,
sfx_dmpain,
sfx_popain,
sfx_vipain,
sfx_mnpain,
sfx_pepain,
sfx_slop,
sfx_itemup,
sfx_wpnup,
sfx_oof,
sfx_telept,
sfx_posit1,
sfx_posit2,
sfx_posit3,
sfx_bgsit1,
sfx_bgsit2,
sfx_sgtsit,
sfx_cacsit,
sfx_brssit,
sfx_cybsit,
sfx_spisit,
sfx_bspsit,
sfx_kntsit,
sfx_vilsit,
sfx_mansit,
sfx_pesit,
sfx_sklatk,
sfx_sgtatk,
sfx_skepch,
sfx_vilatk,
sfx_claw,
sfx_skeswg,
sfx_pldeth,
sfx_pdiehi,
sfx_podth1,
sfx_podth2,
sfx_podth3,
sfx_bgdth1,
sfx_bgdth2,
sfx_sgtdth,
sfx_cacdth,
sfx_skldth,
sfx_brsdth,
sfx_cybdth,
sfx_spidth,
sfx_bspdth,
sfx_vildth,
sfx_kntdth,
sfx_pedth,
sfx_skedth,
sfx_posact,
sfx_bgact,
sfx_dmact,
sfx_bspact,
sfx_bspwlk,
sfx_vilact,
sfx_noway,
sfx_barexp,
sfx_punch,
sfx_hoof,
sfx_metal,
sfx_chgun,
sfx_tink,
sfx_bdopn,
sfx_bdcls,
sfx_itmbk,
sfx_flame,
sfx_flamst,
sfx_getpow,
sfx_bospit,
sfx_boscub,
sfx_bossit,
sfx_bospn,
sfx_bosdth,
sfx_manatk,
sfx_mandth,
sfx_sssit,
sfx_ssdth,
sfx_keenpn,
sfx_keendt,
sfx_skeact,
sfx_skesit,
sfx_skeatk,
sfx_radio,
#ifdef DOGS
/* killough 11/98: dog sounds */
sfx_dgsit,
sfx_dgatk,
sfx_dgact,
sfx_dgdth,
sfx_dgpain,
#endif
NUMSFX
} sfxenum_t;
#endif

View File

@@ -0,0 +1,209 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* The status bar widget definitions and prototypes
*
*-----------------------------------------------------------------------------*/
#ifndef __STLIB__
#define __STLIB__
// We are referring to patches.
#include "r_defs.h"
#include "v_video.h" // color ranges
//
// Background and foreground screen numbers
//
#define BG 4
#define FG 0
//
// Typedefs of widgets
//
// Number widget
typedef struct
{
// upper right-hand corner
// of the number (right-justified)
int x;
int y;
// max # of digits in number
int width;
// last number value
int oldnum;
// pointer to current value
int* num;
// pointer to boolean stating
// whether to update number
boolean* on;
// list of patches for 0-9
const patchnum_t* p;
// user data
int data;
} st_number_t;
// Percent widget ("child" of number widget,
// or, more precisely, contains a number widget.)
typedef struct
{
// number information
st_number_t n;
// percent sign graphic
const patchnum_t* p;
} st_percent_t;
// Multiple Icon widget
typedef struct
{
// center-justified location of icons
int x;
int y;
// last icon number
int oldinum;
// pointer to current icon
int* inum;
// pointer to boolean stating
// whether to update icon
boolean* on;
// list of icons
const patchnum_t* p;
// user data
int data;
} st_multicon_t;
// Binary Icon widget
typedef struct
{
// center-justified location of icon
int x;
int y;
// last icon value
boolean oldval;
// pointer to current icon status
boolean* val;
// pointer to boolean
// stating whether to update icon
boolean* on;
const patchnum_t* p; // icon
int data; // user data
} st_binicon_t;
//
// Widget creation, access, and update routines
//
// Initializes widget library.
// More precisely, initialize STMINUS,
// everything else is done somewhere else.
//
void STlib_init(void);
// Number widget routines
void STlib_initNum
( st_number_t* n,
int x,
int y,
const patchnum_t* pl,
int* num,
boolean* on,
int width );
void STlib_updateNum
( st_number_t* n,
int cm,
boolean refresh );
// Percent widget routines
void STlib_initPercent
( st_percent_t* p,
int x,
int y,
const patchnum_t* pl,
int* num,
boolean* on,
const patchnum_t* percent );
void STlib_updatePercent
( st_percent_t* per,
int cm,
int refresh );
// Multiple Icon widget routines
void STlib_initMultIcon
( st_multicon_t* mi,
int x,
int y,
const patchnum_t* il,
int* inum,
boolean* on );
void STlib_updateMultIcon
( st_multicon_t* mi,
boolean refresh );
// Binary Icon widget routines
void STlib_initBinIcon
( st_binicon_t* b,
int x,
int y,
const patchnum_t* i,
boolean* val,
boolean* on );
void STlib_updateBinIcon
( st_binicon_t* bi,
boolean refresh );
#endif

View File

@@ -0,0 +1,102 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Status bar code.
* Does the face/direction indicator animatin.
* Does palette indicators as well (red pain/berserk, bright pickup)
*
*-----------------------------------------------------------------------------*/
#ifndef __STSTUFF_H__
#define __STSTUFF_H__
#include "doomtype.h"
#include "d_event.h"
// Size of statusbar.
// Now sensitive for scaling.
// proff 08/18/98: Changed for high-res
#define ST_HEIGHT 32
#define ST_WIDTH 320
#define ST_Y (200 - ST_HEIGHT)
#define ST_SCALED_HEIGHT (ST_HEIGHT*SCREENHEIGHT/200)
#define ST_SCALED_WIDTH SCREENWIDTH
#define ST_SCALED_Y (SCREENHEIGHT - ST_SCALED_HEIGHT)
//
// STATUS BAR
//
// Called by main loop.
boolean ST_Responder(event_t* ev);
// Called by main loop.
void ST_Ticker(void);
// Called by main loop.
void ST_Drawer(boolean st_statusbaron, boolean refresh);
// Called when the console player is spawned on each level.
void ST_Start(void);
// Called by startup code.
void ST_Init(void);
// States for status bar code.
typedef enum
{
AutomapState,
FirstPersonState
} st_stateenum_t;
// States for the chat code.
typedef enum
{
StartChatState,
WaitDestState,
GetChatState
} st_chatstateenum_t;
// killough 5/2/98: moved from m_misc.c:
extern int health_red; // health amount less than which status is red
extern int health_yellow; // health amount less than which status is yellow
extern int health_green; // health amount above is blue, below is green
extern int armor_red; // armor amount less than which status is red
extern int armor_yellow; // armor amount less than which status is yellow
extern int armor_green; // armor amount above is blue, below is green
extern int ammo_red; // ammo percent less than which status is red
extern int ammo_yellow; // ammo percent less is yellow more green
extern int sts_always_red;// status numbers do not change colors
extern int sts_pct_always_gray;// status percents do not change colors
extern int sts_traditional_keys; // display keys the traditional way
extern int st_palette; // cph 2006/04/06 - make palette visible
#endif

View File

@@ -0,0 +1,93 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Lookup tables.
* Do not try to look them up :-).
* In the order of appearance:
*
* int finetangent[4096] - Tangens LUT.
* Should work with BAM fairly well (12 of 16bit,
* effectively, by shifting).
*
* int finesine[10240] - Sine lookup.
* Guess what, serves as cosine, too.
* Remarkable thing is, how to use BAMs with this?
*
* int tantoangle[2049] - ArcTan LUT,
* maps tan(angle) to angle fast. Gotta search.
*
*-----------------------------------------------------------------------------*/
#ifndef __TABLES__
#define __TABLES__
#include "m_fixed.h"
#define FINEANGLES 8192
#define FINEMASK (FINEANGLES-1)
// 0x100000000 to 0x2000
#define ANGLETOFINESHIFT 19
// Binary Angle Measument, BAM.
#define ANG45 0x20000000
#define ANG90 0x40000000
#define ANG180 0x80000000
#define ANG270 0xc0000000
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define SLOPERANGE 2048
#define SLOPEBITS 11
#define DBITS (FRACBITS-SLOPEBITS)
typedef unsigned angle_t;
// Load trig tables if needed
void R_LoadTrigTables(void);
// Effective size is 10240.
extern fixed_t finesine[5*FINEANGLES/4];
// Re-use data, is just PI/2 phase shift.
static fixed_t *const finecosine = finesine + (FINEANGLES/4);
// Effective size is 4096.
extern fixed_t finetangent[FINEANGLES/2];
// Effective size is 2049;
// The +1 size is to handle the case when x==y without additional checking.
extern angle_t tantoangle[SLOPERANGE+1];
// Utility function, called by R_PointToAngle.
int SlopeDiv(unsigned num, unsigned den);
#endif

View File

@@ -0,0 +1,207 @@
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION:
* Gamma correction LUT.
* Color range translation support
* Functions to draw patches (by post) directly to screen.
* Functions to blit a block to the screen.
*
*-----------------------------------------------------------------------------*/
#ifndef __V_VIDEO__
#define __V_VIDEO__
#include "doomtype.h"
#include "doomdef.h"
// Needed because we are refering to patches.
#include "r_data.h"
//
// VIDEO
//
#define CENTERY (SCREENHEIGHT/2)
// Screen 0 is the screen updated by I_Update screen.
// Screen 1 is an extra buffer.
// array of pointers to color translation tables
extern const byte *colrngs[];
// symbolic indices into color translation table pointer array
typedef enum
{
CR_BRICK, //0
CR_TAN, //1
CR_GRAY, //2
CR_GREEN, //3
CR_BROWN, //4
CR_GOLD, //5
CR_RED, //6
CR_BLUE, //7
CR_ORANGE, //8
CR_YELLOW, //9
CR_BLUE2, //10 // proff
CR_LIMIT //11 //jff 2/27/98 added for range check
} crange_idx_e;
//jff 1/16/98 end palette color range additions
#define CR_DEFAULT CR_RED /* default value for out of range colors */
typedef struct {
byte *data; // pointer to the screen content
boolean not_on_heap; // if set, no malloc or free is preformed and
// data never set to NULL. Used i.e. with SDL doublebuffer.
int width; // the width of the surface
int height; // the height of the surface, used when mallocing
int byte_pitch; // tha actual width of one line, used when mallocing
int short_pitch; // tha actual width of one line, used when mallocing
int int_pitch; // tha actual width of one line, used when mallocing
} screeninfo_t;
#define NUM_SCREENS 6
extern screeninfo_t screens[NUM_SCREENS];
extern int usegamma;
// Varying bit-depth support -POPE
//
// For bilinear filtering, each palette color is pre-weighted and put in a
// table for fast blending operations. These macros decide how many weights
// to create for each color. The lower the number, the lower the blend
// accuracy, which can produce very bad artifacts in texture filtering.
#define VID_NUMCOLORWEIGHTS 64
#define VID_COLORWEIGHTMASK (VID_NUMCOLORWEIGHTS-1)
#define VID_COLORWEIGHTBITS 6
// Palettes for converting from 8 bit color to 16 and 32 bit. Also
// contains the weighted versions of each palette color for filtering
// operations
extern unsigned short *V_Palette15;
extern unsigned short *V_Palette16;
extern unsigned int *V_Palette32;
#define VID_PAL15(color, weight) V_Palette15[ (color)*VID_NUMCOLORWEIGHTS + (weight) ]
#define VID_PAL16(color, weight) V_Palette16[ (color)*VID_NUMCOLORWEIGHTS + (weight) ]
#define VID_PAL32(color, weight) V_Palette32[ (color)*VID_NUMCOLORWEIGHTS + (weight) ]
// The available bit-depth modes
typedef enum {
VID_MODE8,
VID_MODE15,
VID_MODE16,
VID_MODE32,
VID_MODEGL,
VID_MODEMAX
} video_mode_t;
extern const char *default_videomode;
void V_InitMode(video_mode_t mode);
// video mode query interface
video_mode_t V_GetMode(void);
int V_GetModePixelDepth(video_mode_t mode);
int V_GetNumPixelBits(void);
int V_GetPixelDepth(void);
//jff 4/24/98 loads color translation lumps
void V_InitColorTranslation(void);
// Allocates buffer screens, call before R_Init.
void V_Init (void);
// V_CopyRect
typedef void (*V_CopyRect_f)(int srcx, int srcy, int srcscrn,
int width, int height,
int destx, int desty, int destscrn,
enum patch_translation_e flags);
extern V_CopyRect_f V_CopyRect;
// V_FillRect
typedef void (*V_FillRect_f)(int scrn, int x, int y,
int width, int height, byte colour);
extern V_FillRect_f V_FillRect;
// CPhipps - patch drawing
// Consolidated into the 3 really useful functions:
// V_DrawNumPatch - Draws the patch from lump num
typedef void (*V_DrawNumPatch_f)(int x, int y, int scrn,
int lump, int cm,
enum patch_translation_e flags);
extern V_DrawNumPatch_f V_DrawNumPatch;
// V_DrawNamePatch - Draws the patch from lump "name"
#define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f)
/* cph -
* Functions to return width & height of a patch.
* Doesn't really belong here, but is often used in conjunction with
* this code.
*/
#define V_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name))
#define V_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name))
/* cphipps 10/99: function to tile a flat over the screen */
typedef void (*V_DrawBackground_f)(const char* flatname, int scrn);
extern V_DrawBackground_f V_DrawBackground;
void V_DestroyUnusedTrueColorPalettes(void);
// CPhipps - function to set the palette to palette number pal.
void V_SetPalette(int pal);
// CPhipps - function to plot a pixel
// V_PlotPixel
typedef void (*V_PlotPixel_f)(int,int,int,byte);
extern V_PlotPixel_f V_PlotPixel;
typedef struct
{
int x, y;
} fpoint_t;
typedef struct
{
fpoint_t a, b;
} fline_t;
// V_DrawLine
typedef void (*V_DrawLine_f)(fline_t* fl, int color);
extern V_DrawLine_f V_DrawLine;
void V_AllocScreen(screeninfo_t *scrn);
void V_AllocScreens();
void V_FreeScreen(screeninfo_t *scrn);
void V_FreeScreens();
#ifdef GL_DOOM
#include "gl_struct.h"
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More