dslinux/user/pixil/packages/nxdoom/nxdoom AUTHORS COPYING ChangeLog DOOMLIC.TXT FILES FILES2 INSTALL Makefile.am Makefile.in NEWS README README.NANOX README.SDL README.asm README.b README.book README.gl TODO aclocal.m4 am_map.c am_map.h configure configure.in d_englsh.h d_event.h d_french.h d_items.c d_items.h d_main.c d_main.h d_net.c d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h depcomp doomdata.h doomdef.c doomdef.h doomstat.c doomstat.h doomtype.h dstrings.c dstrings.h f_finale.c f_finale.h f_wipe.c f_wipe.h g_game.c g_game.h hu_lib.c hu_lib.h hu_stuff.c hu_stuff.h i_main.c i_net.c i_net.h i_sound.c i_sound.h i_system.c i_system.h i_video.c i_video.h info.c info.h install-sh m_argv.c m_argv.h m_bbox.c m_bbox.h m_cheat.c m_cheat.h m_fixed.c m_fixed.h m_menu.c m_menu.h m_misc.c m_misc.h m_random.c m_random.h m_swap.c m_swap.h missing mkinstalldirs p_ceilng.c p_doors.c p_enemy.c p_floor.c p_inter.c p_inter.h p_lights.c p_local.h p_map.c p_maputl.c p_mobj.c p_m! obj.h p_plats.c p_pspr.c p_pspr.h p_saveg.c p_saveg.h p_setup.c p_setup.h p_sight.c p_spec.c p_spec.h p_switch.c p_telept.c p_tick.c p_tick.h p_user.c r_bsp.c r_bsp.h r_data.c r_data.h r_defs.h r_draw.c r_draw.h r_local.h r_main.c r_main.h r_plane.c r_plane.h r_segs.c r_segs.h r_sky.c r_sky.h r_state.h r_things.c r_things.h s_sound.c s_sound.h sounds.c sounds.h st_lib.c st_lib.h st_stuff.c st_stuff.h tables.c tables.h v_video.c v_video.h w_wad.c w_wad.h wi_stuff.c wi_stuff.h z_zone.c z_zone.h
amadeus
dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:26:25 CEST 2006
Update of /cvsroot/dslinux/dslinux/user/pixil/packages/nxdoom/nxdoom
In directory antilope:/tmp/cvs-serv11916/packages/nxdoom/nxdoom
Added Files:
AUTHORS COPYING ChangeLog DOOMLIC.TXT FILES FILES2 INSTALL
Makefile.am Makefile.in NEWS README README.NANOX README.SDL
README.asm README.b README.book README.gl TODO aclocal.m4
am_map.c am_map.h configure configure.in d_englsh.h d_event.h
d_french.h d_items.c d_items.h d_main.c d_main.h d_net.c
d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h depcomp
doomdata.h doomdef.c doomdef.h doomstat.c doomstat.h
doomtype.h dstrings.c dstrings.h f_finale.c f_finale.h
f_wipe.c f_wipe.h g_game.c g_game.h hu_lib.c hu_lib.h
hu_stuff.c hu_stuff.h i_main.c i_net.c i_net.h i_sound.c
i_sound.h i_system.c i_system.h i_video.c i_video.h info.c
info.h install-sh m_argv.c m_argv.h m_bbox.c m_bbox.h
m_cheat.c m_cheat.h m_fixed.c m_fixed.h m_menu.c m_menu.h
m_misc.c m_misc.h m_random.c m_random.h m_swap.c m_swap.h
missing mkinstalldirs p_ceilng.c p_doors.c p_enemy.c p_floor.c
p_inter.c p_inter.h p_lights.c p_local.h p_map.c p_maputl.c
p_mobj.c p_mobj.h p_plats.c p_pspr.c p_pspr.h p_saveg.c
p_saveg.h p_setup.c p_setup.h p_sight.c p_spec.c p_spec.h
p_switch.c p_telept.c p_tick.c p_tick.h p_user.c r_bsp.c
r_bsp.h r_data.c r_data.h r_defs.h r_draw.c r_draw.h r_local.h
r_main.c r_main.h r_plane.c r_plane.h r_segs.c r_segs.h
r_sky.c r_sky.h r_state.h r_things.c r_things.h s_sound.c
s_sound.h sounds.c sounds.h st_lib.c st_lib.h st_stuff.c
st_stuff.h tables.c tables.h v_video.c v_video.h w_wad.c
w_wad.h wi_stuff.c wi_stuff.h z_zone.c z_zone.h
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it
--- NEW FILE: mkinstalldirs ---
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman at prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here
--- NEW FILE: p_spec.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_spec.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_spec.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1335 lines suppressed...]
linespeciallist[numlinespecials] = &lines[i];
numlinespecials++;
break;
}
}
// Init other misc stuff
for (i = 0;i < MAXCEILINGS;i++)
activeceilings[i] = NULL;
for (i = 0;i < MAXPLATS;i++)
activeplats[i] = NULL;
for (i = 0;i < MAXBUTTONS;i++)
memset(&buttonlist[i],0,sizeof(button_t));
// UNUSED: no horizonal sliders.
// P_InitSlidingDoorFrames();
}
--- NEW FILE: s_sound.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: s_sound.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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 );
//
// 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 );
// 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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: s_sound.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: v_video.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: v_video.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: v_video.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Gamma correction LUT stuff.
// Functions to draw patches (by post) directly to screen.
// Functions to blit a block to the screen.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: v_video.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
#include "m_swap.h"
#include "i_system.h"
#include "r_local.h"
#include "doomdef.h"
#include "doomdata.h"
#include "m_bbox.h"
#include "v_video.h"
// Each screen is [SCREENWIDTH*SCREENHEIGHT];
byte* screens[5];
int dirtybox[4];
// Now where did these came from?
byte gammatable[5][256] =
{
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,
49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,
65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,
81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255},
{2,4,5,7,8,10,11,12,14,15,16,18,19,20,21,23,24,25,26,27,29,30,31,
32,33,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,54,55,
56,57,58,59,60,61,62,63,64,65,66,67,69,70,71,72,73,74,75,76,77,
78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,
99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,
115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,129,
130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,
146,147,148,148,149,150,151,152,153,154,155,156,157,158,159,160,
161,162,163,163,164,165,166,167,168,169,170,171,172,173,174,175,
175,176,177,178,179,180,181,182,183,184,185,186,186,187,188,189,
190,191,192,193,194,195,196,196,197,198,199,200,201,202,203,204,
205,205,206,207,208,209,210,211,212,213,214,214,215,216,217,218,
219,220,221,222,222,223,224,225,226,227,228,229,230,230,231,232,
233,234,235,236,237,237,238,239,240,241,242,243,244,245,245,246,
247,248,249,250,251,252,252,253,254,255},
{4,7,9,11,13,15,17,19,21,22,24,26,27,29,30,32,33,35,36,38,39,40,42,
43,45,46,47,48,50,51,52,54,55,56,57,59,60,61,62,63,65,66,67,68,69,
70,72,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,
94,95,96,97,98,100,101,102,103,104,105,106,107,108,109,110,111,112,
113,114,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,
129,130,131,132,133,133,134,135,136,137,138,139,140,141,142,143,144,
144,145,146,147,148,149,150,151,152,153,153,154,155,156,157,158,159,
160,160,161,162,163,164,165,166,166,167,168,169,170,171,172,172,173,
174,175,176,177,178,178,179,180,181,182,183,183,184,185,186,187,188,
188,189,190,191,192,193,193,194,195,196,197,197,198,199,200,201,201,
202,203,204,205,206,206,207,208,209,210,210,211,212,213,213,214,215,
216,217,217,218,219,220,221,221,222,223,224,224,225,226,227,228,228,
229,230,231,231,232,233,234,235,235,236,237,238,238,239,240,241,241,
242,243,244,244,245,246,247,247,248,249,250,251,251,252,253,254,254,
255},
{8,12,16,19,22,24,27,29,31,34,36,38,40,41,43,45,47,49,50,52,53,55,
57,58,60,61,63,64,65,67,68,70,71,72,74,75,76,77,79,80,81,82,84,85,
86,87,88,90,91,92,93,94,95,96,98,99,100,101,102,103,104,105,106,107,
108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,
125,126,127,128,129,130,131,132,133,134,135,135,136,137,138,139,140,
141,142,143,143,144,145,146,147,148,149,150,150,151,152,153,154,155,
155,156,157,158,159,160,160,161,162,163,164,165,165,166,167,168,169,
169,170,171,172,173,173,174,175,176,176,177,178,179,180,180,181,182,
183,183,184,185,186,186,187,188,189,189,190,191,192,192,193,194,195,
195,196,197,197,198,199,200,200,201,202,202,203,204,205,205,206,207,
207,208,209,210,210,211,212,212,213,214,214,215,216,216,217,218,219,
219,220,221,221,222,223,223,224,225,225,226,227,227,228,229,229,230,
231,231,232,233,233,234,235,235,236,237,237,238,238,239,240,240,241,
242,242,243,244,244,245,246,246,247,247,248,249,249,250,251,251,252,
253,253,254,254,255},
{16,23,28,32,36,39,42,45,48,50,53,55,57,60,62,64,66,68,69,71,73,75,76,
78,80,81,83,84,86,87,89,90,92,93,94,96,97,98,100,101,102,103,105,106,
107,108,109,110,112,113,114,115,116,117,118,119,120,121,122,123,124,
125,126,128,128,129,130,131,132,133,134,135,136,137,138,139,140,141,
142,143,143,144,145,146,147,148,149,150,150,151,152,153,154,155,155,
156,157,158,159,159,160,161,162,163,163,164,165,166,166,167,168,169,
169,170,171,172,172,173,174,175,175,176,177,177,178,179,180,180,181,
182,182,183,184,184,185,186,187,187,188,189,189,190,191,191,192,193,
193,194,195,195,196,196,197,198,198,199,200,200,201,202,202,203,203,
204,205,205,206,207,207,208,208,209,210,210,211,211,212,213,213,214,
214,215,216,216,217,217,218,219,219,220,220,221,221,222,223,223,224,
224,225,225,226,227,227,228,228,229,229,230,230,231,232,232,233,233,
234,234,235,235,236,236,237,237,238,239,239,240,240,241,241,242,242,
243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,
251,252,252,253,254,254,255,255}
};
int usegamma;
//
// V_MarkRect
//
void
V_MarkRect
( int x,
int y,
int width,
int height )
{
M_AddToBox (dirtybox, x, y);
M_AddToBox (dirtybox, x+width-1, y+height-1);
}
//
// V_CopyRect
//
void
V_CopyRect
( int srcx,
int srcy,
int srcscrn,
int width,
int height,
int destx,
int desty,
int destscrn )
{
byte* src;
byte* dest;
#ifdef RANGECHECK
if (srcx<0
||srcx+width >SCREENWIDTH
|| srcy<0
|| srcy+height>SCREENHEIGHT
||destx<0||destx+width >SCREENWIDTH
|| desty<0
|| desty+height>SCREENHEIGHT
|| (unsigned)srcscrn>4
|| (unsigned)destscrn>4)
{
I_Error ("Bad V_CopyRect");
}
#endif
V_MarkRect (destx, desty, width, height);
src = screens[srcscrn]+SCREENWIDTH*srcy+srcx;
dest = screens[destscrn]+SCREENWIDTH*desty+destx;
for ( ; height>0 ; height--)
{
memcpy (dest, src, width);
src += SCREENWIDTH;
dest += SCREENWIDTH;
}
}
//
// V_DrawPatch
// Masks a column based masked pic to the screen.
//
void
V_DrawPatch
( int x,
int y,
int scrn,
patch_t* patch )
{
int count;
int col;
column_t* column;
byte* desttop;
byte* dest;
byte* source;
int w;
y -= SHORT(patch->topoffset);
x -= SHORT(patch->leftoffset);
#ifdef RANGECHECK
if (x<0
||x+SHORT(patch->width) >SCREENWIDTH
|| y<0
|| y+SHORT(patch->height)>SCREENHEIGHT
|| (unsigned)scrn>4)
{
fprintf( stderr, "Patch at %d,%d exceeds LFB\n", x,y );
// No I_Error abort - what is up with TNT.WAD?
fprintf( stderr, "V_DrawPatch: bad patch (ignored)\n");
return;
}
#endif
if (!scrn)
V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height));
col = 0;
desttop = screens[scrn]+y*SCREENWIDTH+x;
w = SHORT(patch->width);
for ( ; col<w ; x++, col++, desttop++)
{
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
// step through the posts in a column
while (column->topdelta != 0xff )
{
source = (byte *)column + 3;
dest = desttop + column->topdelta*SCREENWIDTH;
count = column->length;
while (count--)
{
*dest = *source++;
dest += SCREENWIDTH;
}
column = (column_t *)( (byte *)column + column->length
+ 4 );
}
}
}
//
// V_DrawPatchFlipped
// Masks a column based masked pic to the screen.
// Flips horizontally, e.g. to mirror face.
//
void
V_DrawPatchFlipped
( int x,
int y,
int scrn,
patch_t* patch )
{
int count;
int col;
column_t* column;
byte* desttop;
byte* dest;
byte* source;
int w;
y -= SHORT(patch->topoffset);
x -= SHORT(patch->leftoffset);
#ifdef RANGECHECK
if (x<0
||x+SHORT(patch->width) >SCREENWIDTH
|| y<0
|| y+SHORT(patch->height)>SCREENHEIGHT
|| (unsigned)scrn>4)
{
fprintf( stderr, "Patch origin %d,%d exceeds LFB\n", x,y );
I_Error ("Bad V_DrawPatch in V_DrawPatchFlipped");
}
#endif
if (!scrn)
V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height));
col = 0;
desttop = screens[scrn]+y*SCREENWIDTH+x;
w = SHORT(patch->width);
for ( ; col<w ; x++, col++, desttop++)
{
column = (column_t *)((byte *)patch + LONG(patch->columnofs[w-1-col]));
// step through the posts in a column
while (column->topdelta != 0xff )
{
source = (byte *)column + 3;
dest = desttop + column->topdelta*SCREENWIDTH;
count = column->length;
while (count--)
{
*dest = *source++;
dest += SCREENWIDTH;
}
column = (column_t *)( (byte *)column + column->length
+ 4 );
}
}
}
//
// V_DrawPatchDirect
// Draws directly to the screen on the pc.
//
void
V_DrawPatchDirect
( int x,
int y,
int scrn,
patch_t* patch )
{
V_DrawPatch (x,y,scrn, patch);
/*
int count;
int col;
column_t* column;
byte* desttop;
byte* dest;
byte* source;
int w;
y -= SHORT(patch->topoffset);
x -= SHORT(patch->leftoffset);
#ifdef RANGECHECK
if (x<0
||x+SHORT(patch->width) >SCREENWIDTH
|| y<0
|| y+SHORT(patch->height)>SCREENHEIGHT
|| (unsigned)scrn>4)
{
I_Error ("Bad V_DrawPatchDirect");
}
#endif
// V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height));
desttop = destscreen + y*SCREENWIDTH/4 + (x>>2);
w = SHORT(patch->width);
for ( col = 0 ; col<w ; col++)
{
outp (SC_INDEX+1,1<<(x&3));
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
// step through the posts in a column
while (column->topdelta != 0xff )
{
source = (byte *)column + 3;
dest = desttop + column->topdelta*SCREENWIDTH/4;
count = column->length;
while (count--)
{
*dest = *source++;
dest += SCREENWIDTH/4;
}
column = (column_t *)( (byte *)column + column->length
+ 4 );
}
if ( ((++x)&3) == 0 )
desttop++; // go to next byte, not next plane
}*/
}
//
// V_DrawBlock
// Draw a linear block of pixels into the view buffer.
//
void
V_DrawBlock
( int x,
int y,
int scrn,
int width,
int height,
byte* src )
{
byte* dest;
#ifdef RANGECHECK
if (x<0
||x+width >SCREENWIDTH
|| y<0
|| y+height>SCREENHEIGHT
|| (unsigned)scrn>4 )
{
I_Error ("Bad V_DrawBlock");
}
#endif
V_MarkRect (x, y, width, height);
dest = screens[scrn] + y*SCREENWIDTH+x;
while (height--)
{
memcpy (dest, src, width);
src += width;
dest += SCREENWIDTH;
}
}
//
// V_GetBlock
// Gets a linear block of pixels from the view buffer.
//
void
V_GetBlock
( int x,
int y,
int scrn,
int width,
int height,
byte* dest )
{
byte* src;
#ifdef RANGECHECK
if (x<0
||x+width >SCREENWIDTH
|| y<0
|| y+height>SCREENHEIGHT
|| (unsigned)scrn>4 )
{
I_Error ("Bad V_DrawBlock");
}
#endif
src = screens[scrn] + y*SCREENWIDTH+x;
while (height--)
{
memcpy (dest, src, width);
src += SCREENWIDTH;
dest += width;
}
}
//
// V_Init
//
void V_Init (void)
{
int i;
byte* base;
// stick these in low dos memory on PCs
base = I_AllocLow (SCREENWIDTH*SCREENHEIGHT*4);
for (i=0 ; i<4 ; i++)
screens[i] = base + i*SCREENWIDTH*SCREENHEIGHT;
}
--- NEW FILE: p_maputl.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_maputl.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_maputl.c,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Movement/collision utility functions,
// as used by function in p_map.c.
// BLOCKMAP Iterator functions,
// and some PIT_* functions to use for iteration.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_maputl.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $";
#include <stdlib.h>
#include "m_bbox.h"
#include "doomdef.h"
#include "p_local.h"
// State.
#include "r_state.h"
//
// P_AproxDistance
// Gives an estimation of distance (not exact)
//
fixed_t
P_AproxDistance
( fixed_t dx,
fixed_t dy )
{
dx = abs(dx);
dy = abs(dy);
if (dx < dy)
return dx+dy-(dx>>1);
return dx+dy-(dy>>1);
}
//
// P_PointOnLineSide
// Returns 0 or 1
//
int
P_PointOnLineSide
( fixed_t x,
fixed_t y,
line_t* line )
{
fixed_t dx;
fixed_t dy;
fixed_t left;
fixed_t right;
if (!line->dx)
{
if (x <= line->v1->x)
return line->dy > 0;
return line->dy < 0;
}
if (!line->dy)
{
if (y <= line->v1->y)
return line->dx < 0;
return line->dx > 0;
}
dx = (x - line->v1->x);
dy = (y - line->v1->y);
left = FixedMul ( line->dy>>FRACBITS , dx );
right = FixedMul ( dy , line->dx>>FRACBITS );
if (right < left)
return 0; // front side
return 1; // back side
}
//
// P_BoxOnLineSide
// Considers the line to be infinite
// Returns side 0 or 1, -1 if box crosses the line.
//
int
P_BoxOnLineSide
( fixed_t* tmbox,
line_t* ld )
{
int p1;
int p2;
switch (ld->slopetype)
{
case ST_HORIZONTAL:
p1 = tmbox[BOXTOP] > ld->v1->y;
p2 = tmbox[BOXBOTTOM] > ld->v1->y;
if (ld->dx < 0)
{
p1 ^= 1;
p2 ^= 1;
}
break;
case ST_VERTICAL:
p1 = tmbox[BOXRIGHT] < ld->v1->x;
p2 = tmbox[BOXLEFT] < ld->v1->x;
if (ld->dy < 0)
{
p1 ^= 1;
p2 ^= 1;
}
break;
case ST_POSITIVE:
p1 = P_PointOnLineSide (tmbox[BOXLEFT], tmbox[BOXTOP], ld);
p2 = P_PointOnLineSide (tmbox[BOXRIGHT], tmbox[BOXBOTTOM], ld);
break;
case ST_NEGATIVE:
p1 = P_PointOnLineSide (tmbox[BOXRIGHT], tmbox[BOXTOP], ld);
p2 = P_PointOnLineSide (tmbox[BOXLEFT], tmbox[BOXBOTTOM], ld);
break;
}
if (p1 == p2)
return p1;
return -1;
}
//
// P_PointOnDivlineSide
// Returns 0 or 1.
//
int
P_PointOnDivlineSide
( fixed_t x,
fixed_t y,
divline_t* line )
{
fixed_t dx;
fixed_t dy;
fixed_t left;
fixed_t right;
if (!line->dx)
{
if (x <= line->x)
return line->dy > 0;
return line->dy < 0;
}
if (!line->dy)
{
if (y <= line->y)
return line->dx < 0;
return line->dx > 0;
}
dx = (x - line->x);
dy = (y - line->y);
// try to quickly decide by looking at sign bits
if ( (line->dy ^ line->dx ^ dx ^ dy)&0x80000000 )
{
if ( (line->dy ^ dx) & 0x80000000 )
return 1; // (left is negative)
return 0;
}
left = FixedMul ( line->dy>>8, dx>>8 );
right = FixedMul ( dy>>8 , line->dx>>8 );
if (right < left)
return 0; // front side
return 1; // back side
}
//
// P_MakeDivline
//
void
P_MakeDivline
( line_t* li,
divline_t* dl )
{
dl->x = li->v1->x;
dl->y = li->v1->y;
dl->dx = li->dx;
dl->dy = li->dy;
}
//
// P_InterceptVector
// Returns the fractional intercept point
// along the first divline.
// This is only called by the addthings
// and addlines traversers.
//
fixed_t
P_InterceptVector
( divline_t* v2,
divline_t* v1 )
{
#if 1
fixed_t frac;
fixed_t num;
fixed_t den;
den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy);
if (den == 0)
return 0;
// I_Error ("P_InterceptVector: parallel");
num =
FixedMul ( (v1->x - v2->x)>>8 ,v1->dy )
+FixedMul ( (v2->y - v1->y)>>8, v1->dx );
frac = FixedDiv (num , den);
return frac;
#else // UNUSED, float debug.
float frac;
float num;
float den;
float v1x;
float v1y;
float v1dx;
float v1dy;
float v2x;
float v2y;
float v2dx;
float v2dy;
v1x = (float)v1->x/FRACUNIT;
v1y = (float)v1->y/FRACUNIT;
v1dx = (float)v1->dx/FRACUNIT;
v1dy = (float)v1->dy/FRACUNIT;
v2x = (float)v2->x/FRACUNIT;
v2y = (float)v2->y/FRACUNIT;
v2dx = (float)v2->dx/FRACUNIT;
v2dy = (float)v2->dy/FRACUNIT;
den = v1dy*v2dx - v1dx*v2dy;
if (den == 0)
return 0; // parallel
num = (v1x - v2x)*v1dy + (v2y - v1y)*v1dx;
frac = num / den;
return frac*FRACUNIT;
#endif
}
//
// P_LineOpening
// Sets opentop and openbottom to the window
// through a two sided line.
// OPTIMIZE: keep this precalculated
//
fixed_t opentop;
fixed_t openbottom;
fixed_t openrange;
fixed_t lowfloor;
void P_LineOpening (line_t* linedef)
{
sector_t* front;
sector_t* back;
if (linedef->sidenum[1] == -1)
{
// single sided line
openrange = 0;
return;
}
front = linedef->frontsector;
back = linedef->backsector;
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
if (front->floorheight > back->floorheight)
{
openbottom = front->floorheight;
lowfloor = back->floorheight;
}
else
{
openbottom = back->floorheight;
lowfloor = front->floorheight;
}
openrange = opentop - openbottom;
}
//
// THING POSITION SETTING
//
//
// P_UnsetThingPosition
// Unlinks a thing from block map and sectors.
// On each position change, BLOCKMAP and other
// lookups maintaining lists ot things inside
// these structures need to be updated.
//
void P_UnsetThingPosition (mobj_t* thing)
{
int blockx;
int blocky;
if ( ! (thing->flags & MF_NOSECTOR) )
{
// inert things don't need to be in blockmap?
// unlink from subsector
if (thing->snext)
thing->snext->sprev = thing->sprev;
if (thing->sprev)
thing->sprev->snext = thing->snext;
else
thing->subsector->sector->thinglist = thing->snext;
}
if ( ! (thing->flags & MF_NOBLOCKMAP) )
{
// inert things don't need to be in blockmap
// unlink from block map
if (thing->bnext)
thing->bnext->bprev = thing->bprev;
if (thing->bprev)
thing->bprev->bnext = thing->bnext;
else
{
blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT;
if (blockx>=0 && blockx < bmapwidth
&& blocky>=0 && blocky <bmapheight)
{
blocklinks[blocky*bmapwidth+blockx] = thing->bnext;
}
}
}
}
//
// P_SetThingPosition
// Links a thing into both a block and a subsector
// based on it's x y.
// Sets thing->subsector properly
//
void
P_SetThingPosition (mobj_t* thing)
{
subsector_t* ss;
sector_t* sec;
int blockx;
int blocky;
mobj_t** link;
// link into subsector
ss = R_PointInSubsector (thing->x,thing->y);
thing->subsector = ss;
if ( ! (thing->flags & MF_NOSECTOR) )
{
// invisible things don't go into the sector links
sec = ss->sector;
thing->sprev = NULL;
thing->snext = sec->thinglist;
if (sec->thinglist)
sec->thinglist->sprev = thing;
sec->thinglist = thing;
}
// link into blockmap
if ( ! (thing->flags & MF_NOBLOCKMAP) )
{
// inert things don't need to be in blockmap
blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT;
if (blockx>=0
&& blockx < bmapwidth
&& blocky>=0
&& blocky < bmapheight)
{
link = &blocklinks[blocky*bmapwidth+blockx];
thing->bprev = NULL;
thing->bnext = *link;
if (*link)
(*link)->bprev = thing;
*link = thing;
}
else
{
// thing is off the map
thing->bnext = thing->bprev = NULL;
}
}
}
//
// BLOCK MAP ITERATORS
// For each line/thing in the given mapblock,
// call the passed PIT_* function.
// If the function returns false,
// exit with false without checking anything else.
//
//
// P_BlockLinesIterator
// The validcount flags are used to avoid checking lines
// that are marked in multiple mapblocks,
// so increment validcount before the first call
// to P_BlockLinesIterator, then make one or more calls
// to it.
//
boolean
P_BlockLinesIterator
( int x,
int y,
boolean(*func)(line_t*) )
{
int offset;
short* list;
line_t* ld;
if (x<0
|| y<0
|| x>=bmapwidth
|| y>=bmapheight)
{
return true;
}
offset = y*bmapwidth+x;
offset = *(blockmap+offset);
for ( list = blockmaplump+offset ; *list != -1 ; list++)
{
ld = &lines[*list];
if (ld->validcount == validcount)
continue; // line has already been checked
ld->validcount = validcount;
if ( !func(ld) )
return false;
}
return true; // everything was checked
}
//
// P_BlockThingsIterator
//
boolean
P_BlockThingsIterator
( int x,
int y,
boolean(*func)(mobj_t*) )
{
mobj_t* mobj;
if ( x<0
|| y<0
|| x>=bmapwidth
|| y>=bmapheight)
{
return true;
}
for (mobj = blocklinks[y*bmapwidth+x] ;
mobj ;
mobj = mobj->bnext)
{
if (!func( mobj ) )
return false;
}
return true;
}
//
// INTERCEPT ROUTINES
//
intercept_t intercepts[MAXINTERCEPTS];
intercept_t* intercept_p;
divline_t trace;
boolean earlyout;
int ptflags;
//
// PIT_AddLineIntercepts.
// Looks for lines in the given block
// that intercept the given trace
// to add to the intercepts list.
//
// A line is crossed if its endpoints
// are on opposite sides of the trace.
// Returns true if earlyout and a solid line hit.
//
boolean
PIT_AddLineIntercepts (line_t* ld)
{
int s1;
int s2;
fixed_t frac;
divline_t dl;
// avoid precision problems with two routines
if ( trace.dx > FRACUNIT*16
|| trace.dy > FRACUNIT*16
|| trace.dx < -FRACUNIT*16
|| trace.dy < -FRACUNIT*16)
{
s1 = P_PointOnDivlineSide (ld->v1->x, ld->v1->y, &trace);
s2 = P_PointOnDivlineSide (ld->v2->x, ld->v2->y, &trace);
}
else
{
s1 = P_PointOnLineSide (trace.x, trace.y, ld);
s2 = P_PointOnLineSide (trace.x+trace.dx, trace.y+trace.dy, ld);
}
if (s1 == s2)
return true; // line isn't crossed
// hit the line
P_MakeDivline (ld, &dl);
frac = P_InterceptVector (&trace, &dl);
if (frac < 0)
return true; // behind source
// try to early out the check
if (earlyout
&& frac < FRACUNIT
&& !ld->backsector)
{
return false; // stop checking
}
intercept_p->frac = frac;
intercept_p->isaline = true;
intercept_p->d.line = ld;
intercept_p++;
return true; // continue
}
//
// PIT_AddThingIntercepts
//
boolean PIT_AddThingIntercepts (mobj_t* thing)
{
fixed_t x1;
fixed_t y1;
fixed_t x2;
fixed_t y2;
int s1;
int s2;
boolean tracepositive;
divline_t dl;
fixed_t frac;
tracepositive = (trace.dx ^ trace.dy)>0;
// check a corner to corner crossection for hit
if (tracepositive)
{
x1 = thing->x - thing->radius;
y1 = thing->y + thing->radius;
x2 = thing->x + thing->radius;
y2 = thing->y - thing->radius;
}
else
{
x1 = thing->x - thing->radius;
y1 = thing->y - thing->radius;
x2 = thing->x + thing->radius;
y2 = thing->y + thing->radius;
}
s1 = P_PointOnDivlineSide (x1, y1, &trace);
s2 = P_PointOnDivlineSide (x2, y2, &trace);
if (s1 == s2)
return true; // line isn't crossed
dl.x = x1;
dl.y = y1;
dl.dx = x2-x1;
dl.dy = y2-y1;
frac = P_InterceptVector (&trace, &dl);
if (frac < 0)
return true; // behind source
intercept_p->frac = frac;
intercept_p->isaline = false;
intercept_p->d.thing = thing;
intercept_p++;
return true; // keep going
}
//
// P_TraverseIntercepts
// Returns true if the traverser function returns true
// for all lines.
//
boolean
P_TraverseIntercepts
( traverser_t func,
fixed_t maxfrac )
{
int count;
fixed_t dist;
intercept_t* scan;
intercept_t* in;
count = intercept_p - intercepts;
in = 0; // shut up compiler warning
while (count--)
{
dist = MAXINT;
for (scan = intercepts ; scan<intercept_p ; scan++)
{
if (scan->frac < dist)
{
dist = scan->frac;
in = scan;
}
}
if (dist > maxfrac)
return true; // checked everything in range
#if 0 // UNUSED
{
// don't check these yet, there may be others inserted
in = scan = intercepts;
for ( scan = intercepts ; scan<intercept_p ; scan++)
if (scan->frac > maxfrac)
*in++ = *scan;
intercept_p = in;
return false;
}
#endif
if ( !func (in) )
return false; // don't bother going farther
in->frac = MAXINT;
}
return true; // everything was traversed
}
//
// P_PathTraverse
// Traces a line from x1,y1 to x2,y2,
// calling the traverser function for each.
// Returns true if the traverser function returns true
// for all lines.
//
boolean
P_PathTraverse
( fixed_t x1,
fixed_t y1,
fixed_t x2,
fixed_t y2,
int flags,
boolean (*trav) (intercept_t *))
{
fixed_t xt1;
fixed_t yt1;
fixed_t xt2;
fixed_t yt2;
fixed_t xstep;
fixed_t ystep;
fixed_t partial;
fixed_t xintercept;
fixed_t yintercept;
int mapx;
int mapy;
int mapxstep;
int mapystep;
int count;
earlyout = flags & PT_EARLYOUT;
validcount++;
intercept_p = intercepts;
if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0)
x1 += FRACUNIT; // don't side exactly on a line
if ( ((y1-bmaporgy)&(MAPBLOCKSIZE-1)) == 0)
y1 += FRACUNIT; // don't side exactly on a line
trace.x = x1;
trace.y = y1;
trace.dx = x2 - x1;
trace.dy = y2 - y1;
x1 -= bmaporgx;
y1 -= bmaporgy;
xt1 = x1>>MAPBLOCKSHIFT;
yt1 = y1>>MAPBLOCKSHIFT;
x2 -= bmaporgx;
y2 -= bmaporgy;
xt2 = x2>>MAPBLOCKSHIFT;
yt2 = y2>>MAPBLOCKSHIFT;
if (xt2 > xt1)
{
mapxstep = 1;
partial = FRACUNIT - ((x1>>MAPBTOFRAC)&(FRACUNIT-1));
ystep = FixedDiv (y2-y1,abs(x2-x1));
}
else if (xt2 < xt1)
{
mapxstep = -1;
partial = (x1>>MAPBTOFRAC)&(FRACUNIT-1);
ystep = FixedDiv (y2-y1,abs(x2-x1));
}
else
{
mapxstep = 0;
partial = FRACUNIT;
ystep = 256*FRACUNIT;
}
yintercept = (y1>>MAPBTOFRAC) + FixedMul (partial, ystep);
if (yt2 > yt1)
{
mapystep = 1;
partial = FRACUNIT - ((y1>>MAPBTOFRAC)&(FRACUNIT-1));
xstep = FixedDiv (x2-x1,abs(y2-y1));
}
else if (yt2 < yt1)
{
mapystep = -1;
partial = (y1>>MAPBTOFRAC)&(FRACUNIT-1);
xstep = FixedDiv (x2-x1,abs(y2-y1));
}
else
{
mapystep = 0;
partial = FRACUNIT;
xstep = 256*FRACUNIT;
}
xintercept = (x1>>MAPBTOFRAC) + FixedMul (partial, xstep);
// Step through map blocks.
// Count is present to prevent a round off error
// from skipping the break.
mapx = xt1;
mapy = yt1;
for (count = 0 ; count < 64 ; count++)
{
if (flags & PT_ADDLINES)
{
if (!P_BlockLinesIterator (mapx, mapy,PIT_AddLineIntercepts))
return false; // early out
}
if (flags & PT_ADDTHINGS)
{
if (!P_BlockThingsIterator (mapx, mapy,PIT_AddThingIntercepts))
return false; // early out
}
if (mapx == xt2
&& mapy == yt2)
{
break;
}
if ( (yintercept >> FRACBITS) == mapy)
{
yintercept += ystep;
mapx += mapxstep;
}
else if ( (xintercept >> FRACBITS) == mapx)
{
xintercept += xstep;
mapy += mapystep;
}
}
// go through the sorted list
return P_TraverseIntercepts ( trav, FRACUNIT );
}
--- NEW FILE: p_spec.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_spec.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION: none
// Implements special effects:
// Texture animation, height or lighting changes
// according to adjacent sectors, respective
// utility functions, etc.
//
//-----------------------------------------------------------------------------
#ifndef __P_SPEC__
#define __P_SPEC__
//
// End-level timer (-TIMER option)
//
extern boolean levelTimer;
extern int levelTimeCount;
// Define values for map objects
#define MO_TELEPORTMAN 14
// at game start
void P_InitPicAnims (void);
// at map load
void P_SpawnSpecials (void);
// every tic
void P_UpdateSpecials (void);
// when needed
boolean
P_UseSpecialLine
( mobj_t* thing,
line_t* line,
int side );
void
P_ShootSpecialLine
( mobj_t* thing,
line_t* line );
void
P_CrossSpecialLine
( int linenum,
int side,
mobj_t* thing );
void P_PlayerInSpecialSector (player_t* player);
int
twoSided
( int sector,
int line );
sector_t*
getSector
( int currentSector,
int line,
int side );
side_t*
getSide
( int currentSector,
int line,
int side );
fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
fixed_t
P_FindNextHighestFloor
( sector_t* sec,
int currentheight );
fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
int
P_FindSectorFromLineTag
( line_t* line,
int start );
int
P_FindMinSurroundingLight
( sector_t* sector,
int max );
sector_t*
getNextSector
( line_t* line,
sector_t* sec );
//
// SPECIAL
//
int EV_DoDonut(line_t* line);
//
// P_LIGHTS
//
typedef struct
{
thinker_t thinker;
sector_t* sector;
int count;
int maxlight;
int minlight;
} fireflicker_t;
typedef struct
{
thinker_t thinker;
sector_t* sector;
int count;
int maxlight;
int minlight;
int maxtime;
int mintime;
} lightflash_t;
typedef struct
{
thinker_t thinker;
sector_t* sector;
int count;
int minlight;
int maxlight;
int darktime;
int brighttime;
} strobe_t;
typedef struct
{
thinker_t thinker;
sector_t* sector;
int minlight;
int maxlight;
int direction;
} glow_t;
#define GLOWSPEED 8
#define STROBEBRIGHT 5
#define FASTDARK 15
#define SLOWDARK 35
void P_SpawnFireFlicker (sector_t* sector);
void T_LightFlash (lightflash_t* flash);
void P_SpawnLightFlash (sector_t* sector);
void T_StrobeFlash (strobe_t* flash);
void
P_SpawnStrobeFlash
( sector_t* sector,
int fastOrSlow,
int inSync );
void EV_StartLightStrobing(line_t* line);
void EV_TurnTagLightsOff(line_t* line);
void
EV_LightTurnOn
( line_t* line,
int bright );
void T_Glow(glow_t* g);
void P_SpawnGlowingLight(sector_t* sector);
//
// P_SWITCH
//
typedef struct
{
char name1[9];
char name2[9];
short episode;
} switchlist_t;
typedef enum
{
top,
middle,
bottom
} bwhere_e;
typedef struct
{
line_t* line;
bwhere_e where;
int btexture;
int btimer;
mobj_t* soundorg;
} button_t;
// max # of wall switches in a level
#define MAXSWITCHES 50
// 4 players, 4 buttons each at once, max.
#define MAXBUTTONS 16
// 1 second, in ticks.
#define BUTTONTIME 35
extern button_t buttonlist[MAXBUTTONS];
void
P_ChangeSwitchTexture
( line_t* line,
int useAgain );
void P_InitSwitchList(void);
//
// P_PLATS
//
typedef enum
{
up,
down,
waiting,
in_stasis
} plat_e;
typedef enum
{
perpetualRaise,
downWaitUpStay,
raiseAndChange,
raiseToNearestAndChange,
blazeDWUS
} plattype_e;
typedef struct
{
thinker_t thinker;
sector_t* sector;
fixed_t speed;
fixed_t low;
fixed_t high;
int wait;
int count;
plat_e status;
plat_e oldstatus;
boolean crush;
int tag;
plattype_e type;
} plat_t;
#define PLATWAIT 3
#define PLATSPEED FRACUNIT
#define MAXPLATS 30
extern plat_t* activeplats[MAXPLATS];
void T_PlatRaise(plat_t* plat);
int
EV_DoPlat
( line_t* line,
plattype_e type,
int amount );
void P_AddActivePlat(plat_t* plat);
void P_RemoveActivePlat(plat_t* plat);
void EV_StopPlat(line_t* line);
void P_ActivateInStasis(int tag);
//
// P_DOORS
//
typedef enum
{
normal,
close30ThenOpen,
close,
open,
raiseIn5Mins,
blazeRaise,
blazeOpen,
blazeClose
} vldoor_e;
typedef struct
{
thinker_t thinker;
vldoor_e type;
sector_t* sector;
fixed_t topheight;
fixed_t speed;
// 1 = up, 0 = waiting at top, -1 = down
int direction;
// tics to wait at the top
int topwait;
// (keep in case a door going down is reset)
// when it reaches 0, start going down
int topcountdown;
} vldoor_t;
#define VDOORSPEED FRACUNIT*2
#define VDOORWAIT 150
void
EV_VerticalDoor
( line_t* line,
mobj_t* thing );
int
EV_DoDoor
( line_t* line,
vldoor_e type );
int
EV_DoLockedDoor
( line_t* line,
vldoor_e type,
mobj_t* thing );
void T_VerticalDoor (vldoor_t* door);
void P_SpawnDoorCloseIn30 (sector_t* sec);
void
P_SpawnDoorRaiseIn5Mins
( sector_t* sec,
int secnum );
#if 0 // UNUSED
//
// Sliding doors...
//
typedef enum
{
sd_opening,
sd_waiting,
sd_closing
} sd_e;
typedef enum
{
sdt_openOnly,
sdt_closeOnly,
sdt_openAndClose
} sdt_e;
typedef struct
{
thinker_t thinker;
sdt_e type;
line_t* line;
int frame;
int whichDoorIndex;
int timer;
sector_t* frontsector;
sector_t* backsector;
sd_e status;
} slidedoor_t;
typedef struct
{
char frontFrame1[9];
char frontFrame2[9];
char frontFrame3[9];
char frontFrame4[9];
char backFrame1[9];
char backFrame2[9];
char backFrame3[9];
char backFrame4[9];
} slidename_t;
typedef struct
{
int frontFrames[4];
int backFrames[4];
} slideframe_t;
// how many frames of animation
#define SNUMFRAMES 4
#define SDOORWAIT 35*3
#define SWAITTICS 4
// how many diff. types of anims
#define MAXSLIDEDOORS 5
void P_InitSlidingDoorFrames(void);
void
EV_SlidingDoor
( line_t* line,
mobj_t* thing );
#endif
//
// P_CEILNG
//
typedef enum
{
lowerToFloor,
raiseToHighest,
lowerAndCrush,
crushAndRaise,
fastCrushAndRaise,
silentCrushAndRaise
} ceiling_e;
typedef struct
{
thinker_t thinker;
ceiling_e type;
sector_t* sector;
fixed_t bottomheight;
fixed_t topheight;
fixed_t speed;
boolean crush;
// 1 = up, 0 = waiting, -1 = down
int direction;
// ID
int tag;
int olddirection;
} ceiling_t;
#define CEILSPEED FRACUNIT
#define CEILWAIT 150
#define MAXCEILINGS 30
extern ceiling_t* activeceilings[MAXCEILINGS];
int
EV_DoCeiling
( line_t* line,
ceiling_e type );
void T_MoveCeiling (ceiling_t* ceiling);
void P_AddActiveCeiling(ceiling_t* c);
void P_RemoveActiveCeiling(ceiling_t* c);
int EV_CeilingCrushStop(line_t* line);
void P_ActivateInStasisCeiling(line_t* line);
//
// P_FLOOR
//
typedef enum
{
// lower floor to highest surrounding floor
lowerFloor,
// lower floor to lowest surrounding floor
lowerFloorToLowest,
// lower floor to highest surrounding floor VERY FAST
turboLower,
// raise floor to lowest surrounding CEILING
raiseFloor,
// raise floor to next highest surrounding floor
raiseFloorToNearest,
// raise floor to shortest height texture around it
raiseToTexture,
// lower floor to lowest surrounding floor
// and change floorpic
lowerAndChange,
raiseFloor24,
raiseFloor24AndChange,
raiseFloorCrush,
// raise to next highest floor, turbo-speed
raiseFloorTurbo,
donutRaise,
raiseFloor512
} floor_e;
typedef enum
{
build8, // slowly build by 8
turbo16 // quickly build by 16
} stair_e;
typedef struct
{
thinker_t thinker;
floor_e type;
boolean crush;
sector_t* sector;
int direction;
int newspecial;
short texture;
fixed_t floordestheight;
fixed_t speed;
} floormove_t;
#define FLOORSPEED FRACUNIT
typedef enum
{
ok,
crushed,
pastdest
} result_e;
result_e
T_MovePlane
( sector_t* sector,
fixed_t speed,
fixed_t dest,
boolean crush,
int floorOrCeiling,
int direction );
int
EV_BuildStairs
( line_t* line,
stair_e type );
int
EV_DoFloor
( line_t* line,
floor_e floortype );
void T_MoveFloor( floormove_t* floor);
//
// P_TELEPT
//
int
EV_Teleport
( line_t* line,
int side,
mobj_t* thing );
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_spec.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: doomdef.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: doomdef.h,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Internally used data structures for virtually everything,
// key definitions, lots of other stuff.
//
//-----------------------------------------------------------------------------
#ifndef __DOOMDEF__
#define __DOOMDEF__
#include <stdio.h>
#include <string.h>
//
// Global parameters/defines.
//
// DOOM version
enum { VERSION_NUM = 110 };
// 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;
// If rangecheck is undefined,
// most parameter validation debugging code will not be compiled
#define RANGECHECK
// Do or do not use external soundserver.
// The sndserver binary to be run separately
// has been introduced by Dave Taylor.
// The integrated sound support is experimental,
// and unfinished. Default is synchronous.
// Experimental asynchronous timer based is
// handled by SNDINTR.
#define SNDSERV 1
//#define SNDINTR 1
// This one switches between MIT SHM (no proper mouse)
// and XFree86 DGA (mickey sampling). The original
// linuxdoom used SHM, which is default.
//#define X11_DGA 1
//
// For resize of screen, at start of game.
// It will not work dynamically, see visplanes.
//
#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 SCREEN_MUL 1
#define INV_ASPECT_RATIO 0.625 // 0.75, ideally
// Defines suck. C sucks.
// C++ might sucks for OOP, but it sure is a better C.
// So there.
#define SCREENWIDTH 320
//SCREEN_MUL*BASE_WIDTH //320
#define SCREENHEIGHT 200
//(int)(SCREEN_MUL*BASE_WIDTH*INV_ASPECT_RATIO) //200
// The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4
// 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,
GS_INTERMISSION,
GS_FINALE,
GS_DEMOSCREEN
} gamestate_t;
//
// Difficulty/skill settings/filters.
//
// 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
typedef enum
{
sk_baby,
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,
// No pending weapon change.
wp_nochange
} weapontype_t;
// Ammunition types defined.
typedef enum
{
am_clip, // Pistol / chaingun ammo.
am_shell, // Shotgun / double barreled shotgun.
am_cell, // Plasma rifle, BFG.
am_misl, // Missile launcher.
NUMAMMO,
am_noammo // Unlimited for chainsaw / fist.
} ammotype_t;
// Power up artifacts.
typedef enum
{
pw_invulnerability,
pw_strength,
pw_invisibility,
pw_ironfeet,
pw_allmap,
pw_infrared,
NUMPOWERS
} powertype_t;
//
// Power up durations,
// how many seconds till expiration,
// assuming TICRATE is 35 ticks/second.
//
typedef enum
{
INVULNTICS = (30*TICRATE),
INVISTICS = (60*TICRATE),
INFRATICS = (120*TICRATE),
IRONTICS = (60*TICRATE)
} powerduration_t;
//
// DOOM keyboard definition.
// This is the stuff configured by Setup.Exe.
// Most key data are simple ascii (uppercased).
//
#define KEY_RIGHTARROW 0xae
#define KEY_LEFTARROW 0xac
#define KEY_UPARROW 0xad
#define KEY_DOWNARROW 0xaf
#define KEY_ESCAPE 27
#define KEY_ENTER 13
#define KEY_TAB 9
#define KEY_F1 (0x80+0x3b)
#define KEY_F2 (0x80+0x3c)
#define KEY_F3 (0x80+0x3d)
#define KEY_F4 (0x80+0x3e)
#define KEY_F5 (0x80+0x3f)
#define KEY_F6 (0x80+0x40)
#define KEY_F7 (0x80+0x41)
#define KEY_F8 (0x80+0x42)
#define KEY_F9 (0x80+0x43)
#define KEY_F10 (0x80+0x44)
#define KEY_F11 (0x80+0x57)
#define KEY_F12 (0x80+0x58)
#define KEY_BACKSPACE 127
#define KEY_PAUSE 0xff
#define KEY_EQUALS 0x3d
#define KEY_MINUS 0x2d
#define KEY_RSHIFT (0x80+0x36)
#define KEY_RCTRL (0x80+0x1d)
#define KEY_RALT (0x80+0x38)
#define KEY_LALT KEY_RALT
// DOOM basic types (boolean),
// and max/min values.
//#include "doomtype.h"
// Fixed point.
//#include "m_fixed.h"
// Endianess handling.
//#include "m_swap.h"
// Binary Angles, sine/cosine/atan lookups.
//#include "tables.h"
// Event type.
//#include "d_event.h"
// Game function, skills.
//#include "g_game.h"
// All external data is defined here.
//#include "doomdata.h"
// All important printed strings.
// Language selection (message strings).
//#include "dstrings.h"
// Player is a special actor.
//struct player_s;
//#include "d_items.h"
//#include "d_player.h"
//#include "p_mobj.h"
//#include "d_net.h"
// PLAY
//#include "p_tick.h"
// Header, generated by sound utility.
// The utility was written by Dave Taylor.
//#include "sounds.h"
#endif // __DOOMDEF__
//-----------------------------------------------------------------------------
//
// $Log: doomdef.h,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: hu_lib.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: hu_lib.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION: none
//
//-----------------------------------------------------------------------------
#ifndef __HULIB__
#define __HULIB__
// We are referring to patches.
#include "r_defs.h"
// background and foreground screen numbers
// different from other modules.
#define BG 1
#define FG 0
// font stuff
#define HU_CHARERASE KEY_BACKSPACE
#define HU_MAXLINES 4
#define HU_MAXLINELENGTH 80
//
// 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;
patch_t** f; // font
int sc; // start character
char l[HU_MAXLINELENGTH+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;
// 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
//
// initializes heads-up widget library
void HUlib_init(void);
//
// 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, patch_t **f, int sc);
// returns success
boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
// returns success
boolean HUlib_delCharFromTextLine(hu_textline_t *t);
// 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
//
// ?
void
HUlib_initSText
( hu_stext_t* s,
int x,
int y,
int h,
patch_t** font,
int startchar,
boolean* on );
// add a new line
void HUlib_addLineToSText(hu_stext_t* s);
// ?
void
HUlib_addMessageToSText
( hu_stext_t* s,
char* prefix,
char* msg );
// draws stext
void HUlib_drawSText(hu_stext_t* s);
// erases all stext lines
void HUlib_eraseSText(hu_stext_t* s);
// Input Text Line widget routines
void
HUlib_initIText
( hu_itext_t* it,
int x,
int y,
patch_t** font,
int startchar,
boolean* on );
// enforces left margin
void HUlib_delCharFromIText(hu_itext_t* it);
// enforces left margin
void HUlib_eraseLineFromIText(hu_itext_t* it);
// 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
//-----------------------------------------------------------------------------
//
// $Log: hu_lib.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: README.asm ---
README - DOOM assembly code
Okay, I add the DOS assembly module for the historically
inclined here (may rec.games.programmer suffer). If anyone
feels the urge to port these to GNU GCC; either inline or
as separate modules including Makefile support, be my guest.
Module tmap.S includes the inner loops for texture mapping,
the interesting one being the floor/ceiling span rendering.
There was another module in the source dump, fpfunc.S, that
had both texture mapping and fixed point functions. It
contained implementations both for i386 and M68k. For
brevity, I include only the i386 fixed point stuff below.
//====================================================
// tmap.S as of January 10th, 1997
//================
//
// R_DrawColumn
//
//================
.data
loopcount .long 0
pixelcount .long 0
.text
.align 16
.globl _R_DrawColumn
_R_DrawColumn:
pushad
movl ebp,[_dc_yl]
movl ebx,ebp
movl edi,[_ylookup+ebx*4]
movl ebx,[_dc_x]
addl edi,[_columnofs + ebx*4]
movl eax,[_dc_yh]
incl eax
subl eax,ebp // pixel count
movl [pixelcount],eax // save for final pixel
js done // nothing to scale
shrl eax,1 // double pixel count
movl [loopcount],eax
movl ecx,[_dc_iscale]
movl eax,[_centery]
subl eax,ebp
imull ecx
movl ebp,[_dc_texturemid]
subl ebp,eax
shll ebp,9 // 7 significant bits, 25 frac
movl esi,[_dc_source]
movl ebx,[_dc_iscale]
shll ebx,9
movl eax,OFFSET patch1+2 // convice tasm to modify code...
movl [eax],ebx
movl eax,OFFSET patch2+2 // convice tasm to modify code...
movl [eax],ebx
// eax aligned colormap
// ebx aligned colormap
// ecx,edx scratch
// esi virtual source
// edi moving destination pointer
// ebp frac
movl ecx,ebp // begin calculating first pixel
addl ebp,ebx // advance frac pointer
shrl ecx,25 // finish calculation for first pixel
movl edx,ebp // begin calculating second pixel
addl ebp,ebx // advance frac pointer
shrl edx,25 // finish calculation for second pixel
movl eax,[_dc_colormap]
movl ebx,eax
movb al,[esi+ecx] // get first pixel
movb bl,[esi+edx] // get second pixel
movb al,[eax] // color translate first pixel
movb bl,[ebx] // color translate second pixel
testl [pixelcount],0fffffffeh
jnz doubleloop // at least two pixels to map
jmp checklast
.align 16
doubleloop:
movl ecx,ebp // begin calculating third pixel
patch1:
addl ebp,12345678h // advance frac pointer
movb [edi],al // write first pixel
shrl ecx,25 // finish calculation for third pixel
movl edx,ebp // begin calculating fourth pixel
patch2:
addl ebp,12345678h // advance frac pointer
movl [edi+SCREENWIDTH],bl // write second pixel
shrl edx,25 // finish calculation for fourth pixel
movb al,[esi+ecx] // get third pixel
addl edi,SCREENWIDTH*2 // advance to third pixel destination
movb bl,[esi+edx] // get fourth pixel
decl [loopcount] // done with loop?
movb al,[eax] // color translate third pixel
movb bl,[ebx] // color translate fourth pixel
jnz doubleloop
// check for final pixel
checklast:
testl [pixelcount],1
jz done
movb [edi],al // write final pixel
done:
popad
ret
//================
//
// R_DrawSpan
//
// Horizontal texture mapping
//
//================
.align 16
.globl _R_DrawSpan
_R_DrawSpan:
pushad
//
// find loop count
//
movl eax,[_ds_x2]
incl eax
subl eax,[_ds_x1] // pixel count
movl [pixelcount],eax // save for final pixel
js hdone // nothing to scale
shrl eax,1 // double pixel count
movl [loopcount],eax
//
// build composite position
//
movl ebp,[_ds_xfrac]
shll ebp,10
andl ebp,0ffff0000h
movl eax,[_ds_yfrac]
shrl eax,6
andl eax,0ffffh
orl ebp,eax
movl esi,[_ds_source]
//
// calculate screen dest
//
movl edi,[_ds_y]
movl edi,[_ylookup+edi*4]
movl eax,[_ds_x1]
addl edi,[_columnofs+eax*4]
//
// build composite step
//
movl ebx,[_ds_xstep]
shll ebx,10
andl ebx,0ffff0000h
movl eax,[_ds_ystep]
shrl eax,6
andl eax,0ffffh
orl ebx,eax
movl eax,OFFSET hpatch1+2 // convice tasm to modify code...
movl [eax],ebx
movl eax,OFFSET hpatch2+2 // convice tasm to modify code...
movl [eax],ebx
// eax aligned colormap
// ebx aligned colormap
// ecx,edx scratch
// esi virtual source
// edi moving destination pointer
// ebp frac
shldl ecx,ebp,22 // begin calculating third pixel (y units)
shldl ecx,ebp,6 // begin calculating third pixel (x units)
addl ebp,ebx // advance frac pointer
andl ecx,4095 // finish calculation for third pixel
shldl edx,ebp,22 // begin calculating fourth pixel (y units)
shldl edx,ebp,6 // begin calculating fourth pixel (x units)
addl ebp,ebx // advance frac pointer
andl edx,4095 // finish calculation for fourth pixel
movl eax,[_ds_colormap]
movl ebx,eax
movb al,[esi+ecx] // get first pixel
movb bl,[esi+edx] // get second pixel
movb al,[eax] // color translate first pixel
movb bl,[ebx] // color translate second pixel
testl [pixelcount],0fffffffeh
jnz hdoubleloop // at least two pixels to map
jmp hchecklast
.align 16
hdoubleloop:
shldl ecx,ebp,22 // begin calculating third pixel (y units)
shldl ecx,ebp,6 // begin calculating third pixel (x units)
hpatch1:
addl ebp,12345678h // advance frac pointer
movb [edi],al // write first pixel
andl ecx,4095 // finish calculation for third pixel
shldl edx,ebp,22 // begin calculating fourth pixel (y units)
shldl edx,ebp,6 // begin calculating fourth pixel (x units)
hpatch2:
addl ebp,12345678h // advance frac pointer
movb [edi+1],bl // write second pixel
andl edx,4095 // finish calculation for fourth pixel
movb al,[esi+ecx] // get third pixel
addl edi,2 // advance to third pixel destination
movb bl,[esi+edx] // get fourth pixel
decl [loopcount] // done with loop?
movb al,[eax] // color translate third pixel
movb bl,[ebx] // color translate fourth pixel
jnz hdoubleloop
// check for final pixel
hchecklast:
testl [pixelcount],1
jz hdone
movb [edi],al // write final pixel
hdone:
popad
ret
//====================================================
// fpfunc.S as of January 10th, 1997 (parts)
#ifdef i386
.text
.align 4
.globl _FixedMul
_FixedMul:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
imull 12(%ebp)
shrdl $16,%edx,%eax
popl %ebp
ret
.align 4
.globl _FixedDiv2
_FixedDiv2:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
cdq
shldl $16,%eax,%edx
sall $16,%eax
idivl 12(%ebp)
popl %ebp
ret
#endif
--- NEW FILE: v_video.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: v_video.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Gamma correction LUT.
// 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.
extern byte* screens[5];
extern int dirtybox[4];
extern byte gammatable[5][256];
extern int usegamma;
// Allocates buffer screens, call before R_Init.
void V_Init (void);
void
V_CopyRect
( int srcx,
int srcy,
int srcscrn,
int width,
int height,
int destx,
int desty,
int destscrn );
void
V_DrawPatch
( int x,
int y,
int scrn,
patch_t* patch);
void
V_DrawPatchDirect
( int x,
int y,
int scrn,
patch_t* patch );
// Draw a linear block of pixels into the view buffer.
void
V_DrawBlock
( int x,
int y,
int scrn,
int width,
int height,
byte* src );
// Reads a linear block of pixels into the view buffer.
void
V_GetBlock
( int x,
int y,
int scrn,
int width,
int height,
byte* dest );
void
V_MarkRect
( int x,
int y,
int width,
int height );
#endif
//-----------------------------------------------------------------------------
//
// $Log: v_video.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: s_sound.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: s_sound.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: s_sound.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION: none
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: s_sound.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
#include <stdio.h>
#include <stdlib.h>
#include "i_system.h"
#include "i_sound.h"
#include "sounds.h"
#include "s_sound.h"
#include "z_zone.h"
#include "m_random.h"
#include "w_wad.h"
#include "doomdef.h"
#include "p_local.h"
#include "doomstat.h"
// Purpose?
const char snd_prefixen[]
= { 'P', 'P', 'A', 'S', 'S', 'S', 'M', 'M', 'M', 'S', 'S', 'S' };
#define S_MAX_VOLUME 127
// when to clip out sounds
// Does not fit the large outdoor areas.
#define S_CLIPPING_DIST (1200*0x10000)
// Distance tp origin when sounds should be maxed out.
// This should relate to movement clipping resolution
// (see BLOCKMAP handling).
// Originally: (200*0x10000).
#define S_CLOSE_DIST (160*0x10000)
#define S_ATTENUATOR ((S_CLIPPING_DIST-S_CLOSE_DIST)>>FRACBITS)
// Adjustable by menu.
#define NORM_VOLUME snd_MaxVolume
#define NORM_PITCH 128
#define NORM_PRIORITY 64
#define NORM_SEP 128
#define S_PITCH_PERTURB 1
#define S_STEREO_SWING (96*0x10000)
// percent attenuation from front to back
#define S_IFRACVOL 30
#define NA 0
#define S_NUMCHANNELS 2
// Current music/sfx card - index useless
// w/o a reference LUT in a sound module.
extern int snd_MusicDevice;
extern int snd_SfxDevice;
// Config file? Same disclaimer as above.
extern int snd_DesiredMusicDevice;
extern int snd_DesiredSfxDevice;
typedef struct
{
// sound information (if null, channel avail.)
sfxinfo_t* sfxinfo;
// origin of sound
void* origin;
// handle of the sound being played
int handle;
} channel_t;
// the set of channels available
static channel_t* channels;
// These are not used, but should be (menu).
// Maximum volume of a sound effect.
// Internal default is max out of 0-15.
int snd_SfxVolume = 15;
// Maximum volume of music. Useless so far.
int snd_MusicVolume = 15;
// whether songs are mus_paused
static boolean mus_paused;
// music currently being played
static musicinfo_t* mus_playing=0;
// following is set
// by the defaults code in M_misc:
// number of channels available
int numChannels;
static int nextcleanup;
//
// Internals.
//
int
S_getChannel
( void* origin,
sfxinfo_t* sfxinfo );
int
S_AdjustSoundParams
( mobj_t* listener,
mobj_t* source,
int* vol,
int* sep,
int* pitch );
void S_StopChannel(int cnum);
//
// 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 )
{
int i;
fprintf( stderr, "S_Init: default sfx volume %d\n", sfxVolume);
// Whatever these did with DMX, these are rather dummies now.
I_SetChannels();
S_SetSfxVolume(sfxVolume);
// No music with Linux - another dummy.
S_SetMusicVolume(musicVolume);
// Allocating the internal channels for mixing
// (the maximum numer of sounds rendered
// simultaneously) within zone memory.
channels =
(channel_t *) Z_Malloc(numChannels*sizeof(channel_t), PU_STATIC, 0);
// Free all channels for use
for (i=0 ; i<numChannels ; i++)
channels[i].sfxinfo = 0;
// no sounds are playing, and they are not mus_paused
mus_paused = 0;
// Note that sounds have not been cached (yet).
for (i=1 ; i<NUMSFX ; i++)
S_sfx[i].lumpnum = S_sfx[i].usefulness = -1;
}
//
// Per level startup code.
// Kills playing sounds at start of level,
// determines music if any, changes music.
//
void S_Start(void)
{
int cnum;
int mnum;
// kill all playing sounds at start of level
// (trust me - a good idea)
for (cnum=0 ; cnum<numChannels ; cnum++)
if (channels[cnum].sfxinfo)
S_StopChannel(cnum);
// start new music for the level
mus_paused = 0;
if (gamemode == commercial)
mnum = mus_runnin + gamemap - 1;
else
{
int spmus[]=
{
// Song - Who? - Where?
mus_e3m4, // American e4m1
mus_e3m2, // Romero e4m2
mus_e3m3, // Shawn e4m3
mus_e1m5, // American e4m4
mus_e2m7, // Tim e4m5
mus_e2m4, // Romero e4m6
mus_e2m6, // J.Anderson e4m7 CHIRON.WAD
mus_e2m5, // Shawn e4m8
mus_e1m9 // Tim e4m9
};
if (gameepisode < 4)
mnum = mus_e1m1 + (gameepisode-1)*9 + gamemap-1;
else
mnum = spmus[gamemap-1];
}
// HACK FOR COMMERCIAL
// if (commercial && mnum > mus_e3m9)
// mnum -= mus_e3m9;
S_ChangeMusic(mnum, true);
nextcleanup = 15;
}
void
S_StartSoundAtVolume
( void* origin_p,
int sfx_id,
int volume )
{
int rc;
int sep;
int pitch;
int priority;
sfxinfo_t* sfx;
int cnum;
mobj_t* origin = (mobj_t *) origin_p;
/* If no sould has been set, then go ahead and bail */
#if !defined(USE_DSP) && !defined(USE_ESOUND)
return;
#endif
// Debug.
/*fprintf( stderr,
"S_StartSoundAtVolume: playing sound %d (%s)\n",
sfx_id, S_sfx[sfx_id].name );*/
// check for bogus sound #
if (sfx_id < 1 || sfx_id > NUMSFX)
I_Error("Bad sfx #: %d", sfx_id);
sfx = &S_sfx[sfx_id];
// Initialize sound parameters
if (sfx->link)
{
pitch = sfx->pitch;
priority = sfx->priority;
volume += sfx->volume;
if (volume < 1)
return;
if (volume > snd_SfxVolume)
volume = snd_SfxVolume;
}
else
{
pitch = NORM_PITCH;
priority = NORM_PRIORITY;
}
// Check to see if it is audible,
// and if not, modify the params
if (origin && origin != players[consoleplayer].mo)
{
rc = S_AdjustSoundParams(players[consoleplayer].mo,
origin,
&volume,
&sep,
&pitch);
if ( origin->x == players[consoleplayer].mo->x
&& origin->y == players[consoleplayer].mo->y)
{
sep = NORM_SEP;
}
if (!rc)
return;
}
else
{
sep = NORM_SEP;
}
// hacks to vary the sfx pitches
if (sfx_id >= sfx_sawup
&& sfx_id <= sfx_sawhit)
{
pitch += 8 - (M_Random()&15);
if (pitch<0)
pitch = 0;
else if (pitch>255)
pitch = 255;
}
else if (sfx_id != sfx_itemup
&& sfx_id != sfx_tink)
{
pitch += 16 - (M_Random()&31);
if (pitch<0)
pitch = 0;
else if (pitch>255)
pitch = 255;
}
// kill old sound
S_StopSound(origin);
// try to find a channel
cnum = S_getChannel(origin, sfx);
if (cnum<0)
return;
//
// This is supposed to handle the loading/caching.
// For some odd reason, the caching is done nearly
// each time the sound is needed?
//
// get lumpnum if necessary
if (sfx->lumpnum < 0)
sfx->lumpnum = I_GetSfxLumpNum(sfx);
#ifndef SNDSRV
// cache data if necessary
if (!sfx->data)
{
fprintf( stderr,
"S_StartSoundAtVolume: 16bit and not pre-cached - wtf?\n");
// DOS remains, 8bit handling
//sfx->data = (void *) W_CacheLumpNum(sfx->lumpnum, PU_MUSIC);
// fprintf( stderr,
// "S_StartSoundAtVolume: loading %d (lump %d) : 0x%x\n",
// sfx_id, sfx->lumpnum, (int)sfx->data );
}
#endif
// increase the usefulness
if (sfx->usefulness++ < 0)
sfx->usefulness = 1;
// Assigns the handle to one of the channels in the
// mix/output buffer.
channels[cnum].handle = I_StartSound(sfx_id,
/*sfx->data,*/
volume,
sep,
pitch,
priority);
}
void
S_StartSound
( void* origin,
int sfx_id )
{
#ifdef SAWDEBUG
// if (sfx_id == sfx_sawful)
// sfx_id = sfx_itemup;
#endif
S_StartSoundAtVolume(origin, sfx_id, snd_SfxVolume);
// UNUSED. We had problems, had we not?
#ifdef SAWDEBUG
{
int i;
int n;
static mobj_t* last_saw_origins[10] = {1,1,1,1,1,1,1,1,1,1};
static int first_saw=0;
static int next_saw=0;
if (sfx_id == sfx_sawidl
|| sfx_id == sfx_sawful
|| sfx_id == sfx_sawhit)
{
for (i=first_saw;i!=next_saw;i=(i+1)%10)
if (last_saw_origins[i] != origin)
fprintf(stderr, "old origin 0x%lx != "
"origin 0x%lx for sfx %d\n",
last_saw_origins[i],
origin,
sfx_id);
last_saw_origins[next_saw] = origin;
next_saw = (next_saw + 1) % 10;
if (next_saw == first_saw)
first_saw = (first_saw + 1) % 10;
for (n=i=0; i<numChannels ; i++)
{
if (channels[i].sfxinfo == &S_sfx[sfx_sawidl]
|| channels[i].sfxinfo == &S_sfx[sfx_sawful]
|| channels[i].sfxinfo == &S_sfx[sfx_sawhit]) n++;
}
if (n>1)
{
for (i=0; i<numChannels ; i++)
{
if (channels[i].sfxinfo == &S_sfx[sfx_sawidl]
|| channels[i].sfxinfo == &S_sfx[sfx_sawful]
|| channels[i].sfxinfo == &S_sfx[sfx_sawhit])
{
fprintf(stderr,
"chn: sfxinfo=0x%lx, origin=0x%lx, "
"handle=%d\n",
channels[i].sfxinfo,
channels[i].origin,
channels[i].handle);
}
}
fprintf(stderr, "\n");
}
}
}
#endif
}
void S_StopSound(void *origin)
{
int cnum;
for (cnum=0 ; cnum<numChannels ; cnum++)
{
if (channels[cnum].sfxinfo && channels[cnum].origin == origin)
{
S_StopChannel(cnum);
break;
}
}
}
//
// Stop and resume music, during game PAUSE.
//
void S_PauseSound(void)
{
if (mus_playing && !mus_paused)
{
I_PauseSong(mus_playing->handle);
mus_paused = true;
}
}
void S_ResumeSound(void)
{
if (mus_playing && mus_paused)
{
I_ResumeSong(mus_playing->handle);
mus_paused = false;
}
}
//
// Updates music & sounds
//
void S_UpdateSounds(void* listener_p)
{
int audible;
int cnum;
int volume;
int sep;
int pitch;
sfxinfo_t* sfx;
channel_t* c;
mobj_t* listener = (mobj_t*)listener_p;
// Clean up unused data.
// This is currently not done for 16bit (sounds cached static).
// DOS 8bit remains.
/*if (gametic > nextcleanup)
{
for (i=1 ; i<NUMSFX ; i++)
{
if (S_sfx[i].usefulness < 1
&& S_sfx[i].usefulness > -1)
{
if (--S_sfx[i].usefulness == -1)
{
Z_ChangeTag(S_sfx[i].data, PU_CACHE);
S_sfx[i].data = 0;
}
}
}
nextcleanup = gametic + 15;
}*/
for (cnum=0 ; cnum<numChannels ; cnum++)
{
c = &channels[cnum];
sfx = c->sfxinfo;
if (c->sfxinfo)
{
if (I_SoundIsPlaying(c->handle))
{
// initialize parameters
volume = snd_SfxVolume;
pitch = NORM_PITCH;
sep = NORM_SEP;
if (sfx->link)
{
pitch = sfx->pitch;
volume += sfx->volume;
if (volume < 1)
{
S_StopChannel(cnum);
continue;
}
else if (volume > snd_SfxVolume)
{
volume = snd_SfxVolume;
}
}
// check non-local sounds for distance clipping
// or modify their params
if (c->origin && listener_p != c->origin)
{
audible = S_AdjustSoundParams(listener,
c->origin,
&volume,
&sep,
&pitch);
if (!audible)
{
S_StopChannel(cnum);
}
else
I_UpdateSoundParams(c->handle, volume, sep, pitch);
}
}
else
{
// if channel is allocated but sound has stopped,
// free it
S_StopChannel(cnum);
}
}
}
I_UpdateSound();
// kill music if it is a single-play && finished
// if ( mus_playing
// && !I_QrySongPlaying(mus_playing->handle)
// && !mus_paused )
// S_StopMusic();
}
void S_SetMusicVolume(int volume)
{
if (volume < 0 || volume > 127)
{
I_Error("Attempt to set music volume at %d",
volume);
}
I_SetMusicVolume(127);
I_SetMusicVolume(volume);
snd_MusicVolume = volume;
}
void S_SetSfxVolume(int volume)
{
if (volume < 0 || volume > 127)
I_Error("Attempt to set sfx volume at %d", volume);
snd_SfxVolume = volume;
}
//
// Starts some music with the music id found in sounds.h.
//
void S_StartMusic(int m_id)
{
S_ChangeMusic(m_id, false);
}
void
S_ChangeMusic
( int musicnum,
int looping )
{
musicinfo_t* music;
char namebuf[9];
if ( (musicnum <= mus_None)
|| (musicnum >= NUMMUSIC) )
{
I_Error("Bad music number %d", musicnum);
}
else
music = &S_music[musicnum];
if (mus_playing == music)
return;
// shutdown old music
S_StopMusic();
// get lumpnum if neccessary
if (!music->lumpnum)
{
sprintf(namebuf, "d_%s", music->name);
music->lumpnum = W_GetNumForName(namebuf);
}
// load & register it
music->data = (void *) W_CacheLumpNum(music->lumpnum, PU_MUSIC);
music->handle = I_RegisterSong(music->data);
// play it
I_PlaySong(music->handle, looping);
mus_playing = music;
}
void S_StopMusic(void)
{
if (mus_playing)
{
if (mus_paused)
I_ResumeSong(mus_playing->handle);
I_StopSong(mus_playing->handle);
I_UnRegisterSong(mus_playing->handle);
Z_ChangeTag(mus_playing->data, PU_CACHE);
mus_playing->data = 0;
mus_playing = 0;
}
}
void S_StopChannel(int cnum)
{
int i;
channel_t* c = &channels[cnum];
if (c->sfxinfo)
{
// stop the sound playing
if (I_SoundIsPlaying(c->handle))
{
#ifdef SAWDEBUG
if (c->sfxinfo == &S_sfx[sfx_sawful])
fprintf(stderr, "stopped\n");
#endif
I_StopSound(c->handle);
}
// check to see
// if other channels are playing the sound
for (i=0 ; i<numChannels ; i++)
{
if (cnum != i
&& c->sfxinfo == channels[i].sfxinfo)
{
break;
}
}
// degrade usefulness of sound data
c->sfxinfo->usefulness--;
c->sfxinfo = 0;
}
}
//
// Changes volume, stereo-separation, and pitch variables
// from the norm of a sound effect to be played.
// If the sound is not audible, returns a 0.
// Otherwise, modifies parameters and returns 1.
//
int
S_AdjustSoundParams
( mobj_t* listener,
mobj_t* source,
int* vol,
int* sep,
int* pitch )
{
fixed_t approx_dist;
fixed_t adx;
fixed_t ady;
angle_t angle;
// calculate the distance to sound origin
// and clip it if necessary
adx = abs(listener->x - source->x);
ady = abs(listener->y - source->y);
// From _GG1_ p.428. Appox. eucledian distance fast.
approx_dist = adx + ady - ((adx < ady ? adx : ady)>>1);
if (gamemap != 8
&& approx_dist > S_CLIPPING_DIST)
{
return 0;
}
// angle of source to listener
angle = R_PointToAngle2(listener->x,
listener->y,
source->x,
source->y);
if (angle > listener->angle)
angle = angle - listener->angle;
else
angle = angle + (0xffffffff - listener->angle);
angle >>= ANGLETOFINESHIFT;
// stereo separation
*sep = 128 - (FixedMul(S_STEREO_SWING,finesine[angle])>>FRACBITS);
// volume calculation
if (approx_dist < S_CLOSE_DIST)
{
*vol = snd_SfxVolume;
}
else if (gamemap == 8)
{
if (approx_dist > S_CLIPPING_DIST)
approx_dist = S_CLIPPING_DIST;
*vol = 15+ ((snd_SfxVolume-15)
*((S_CLIPPING_DIST - approx_dist)>>FRACBITS))
/ S_ATTENUATOR;
}
else
{
// distance effect
*vol = (snd_SfxVolume
* ((S_CLIPPING_DIST - approx_dist)>>FRACBITS))
/ S_ATTENUATOR;
}
return (*vol > 0);
}
//
// S_getChannel :
// If none available, return -1. Otherwise channel #.
//
int
S_getChannel
( void* origin,
sfxinfo_t* sfxinfo )
{
// channel number to use
int cnum;
channel_t* c;
// Find an open channel
for (cnum=0 ; cnum<numChannels ; cnum++)
{
if (!channels[cnum].sfxinfo)
break;
else if (origin && channels[cnum].origin == origin)
{
S_StopChannel(cnum);
break;
}
}
// None available
if (cnum == numChannels)
{
// Look for lower priority
for (cnum=0 ; cnum<numChannels ; cnum++)
if (channels[cnum].sfxinfo->priority >= sfxinfo->priority) break;
if (cnum == numChannels)
{
// FUCK! No lower priority. Sorry, Charlie.
return -1;
}
else
{
// Otherwise, kick out lower priority.
S_StopChannel(cnum);
}
}
c = &channels[cnum];
// channel is decided to be cnum.
c->sfxinfo = sfxinfo;
c->origin = origin;
return cnum;
}
--- NEW FILE: p_plats.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_plats.c,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_plats.c,v $
// Revision 1.1 2006-10-03 11:26:20 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Plats (i.e. elevator platforms) code, raising/lowering.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_plats.c,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $";
#include "i_system.h"
#include "z_zone.h"
#include "m_random.h"
#include "doomdef.h"
#include "p_local.h"
#include "s_sound.h"
// State.
#include "doomstat.h"
#include "r_state.h"
// Data.
#include "sounds.h"
plat_t* activeplats[MAXPLATS];
//
// Move a plat up and down
//
void T_PlatRaise(plat_t* plat)
{
result_e res;
switch(plat->status)
{
case up:
res = T_MovePlane(plat->sector,
plat->speed,
plat->high,
plat->crush,0,1);
if (plat->type == raiseAndChange
|| plat->type == raiseToNearestAndChange)
{
if (!(leveltime&7))
S_StartSound((mobj_t *)&plat->sector->soundorg,
sfx_stnmov);
}
if (res == crushed && (!plat->crush))
{
plat->count = plat->wait;
plat->status = down;
S_StartSound((mobj_t *)&plat->sector->soundorg,
sfx_pstart);
}
else
{
if (res == pastdest)
{
plat->count = plat->wait;
plat->status = waiting;
S_StartSound((mobj_t *)&plat->sector->soundorg,
sfx_pstop);
switch(plat->type)
{
case blazeDWUS:
case downWaitUpStay:
P_RemoveActivePlat(plat);
break;
case raiseAndChange:
case raiseToNearestAndChange:
P_RemoveActivePlat(plat);
break;
default:
break;
}
}
}
break;
case down:
res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1);
if (res == pastdest)
{
plat->count = plat->wait;
plat->status = waiting;
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstop);
}
break;
case waiting:
if (!--plat->count)
{
if (plat->sector->floorheight == plat->low)
plat->status = up;
else
plat->status = down;
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstart);
}
case in_stasis:
break;
}
}
//
// Do Platforms
// "amount" is only used for SOME platforms.
//
int
EV_DoPlat
( line_t* line,
plattype_e type,
int amount )
{
plat_t* plat;
int secnum;
int rtn;
sector_t* sec;
secnum = -1;
rtn = 0;
// Activate all <type> plats that are in_stasis
switch(type)
{
case perpetualRaise:
P_ActivateInStasis(line->tag);
break;
default:
break;
}
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
// Find lowest & highest floors around sector
rtn = 1;
plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC, 0);
P_AddThinker(&plat->thinker);
plat->type = type;
plat->sector = sec;
plat->sector->specialdata = plat;
plat->thinker.function.acp1 = (actionf_p1) T_PlatRaise;
plat->crush = false;
plat->tag = line->tag;
switch(type)
{
case raiseToNearestAndChange:
plat->speed = PLATSPEED/2;
sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
plat->wait = 0;
plat->status = up;
// NO MORE DAMAGE, IF APPLICABLE
sec->special = 0;
S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov);
break;
case raiseAndChange:
plat->speed = PLATSPEED/2;
sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
plat->high = sec->floorheight + amount*FRACUNIT;
plat->wait = 0;
plat->status = up;
S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov);
break;
case downWaitUpStay:
plat->speed = PLATSPEED * 4;
plat->low = P_FindLowestFloorSurrounding(sec);
if (plat->low > sec->floorheight)
plat->low = sec->floorheight;
plat->high = sec->floorheight;
plat->wait = 35*PLATWAIT;
plat->status = down;
S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart);
break;
case blazeDWUS:
plat->speed = PLATSPEED * 8;
plat->low = P_FindLowestFloorSurrounding(sec);
if (plat->low > sec->floorheight)
plat->low = sec->floorheight;
plat->high = sec->floorheight;
plat->wait = 35*PLATWAIT;
plat->status = down;
S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart);
break;
case perpetualRaise:
plat->speed = PLATSPEED;
plat->low = P_FindLowestFloorSurrounding(sec);
if (plat->low > sec->floorheight)
plat->low = sec->floorheight;
plat->high = P_FindHighestFloorSurrounding(sec);
if (plat->high < sec->floorheight)
plat->high = sec->floorheight;
plat->wait = 35*PLATWAIT;
plat->status = P_Random()&1;
S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart);
break;
}
P_AddActivePlat(plat);
}
return rtn;
}
void P_ActivateInStasis(int tag)
{
int i;
for (i = 0;i < MAXPLATS;i++)
if (activeplats[i]
&& (activeplats[i])->tag == tag
&& (activeplats[i])->status == in_stasis)
{
(activeplats[i])->status = (activeplats[i])->oldstatus;
(activeplats[i])->thinker.function.acp1
= (actionf_p1) T_PlatRaise;
}
}
void EV_StopPlat(line_t* line)
{
int j;
for (j = 0;j < MAXPLATS;j++)
if (activeplats[j]
&& ((activeplats[j])->status != in_stasis)
&& ((activeplats[j])->tag == line->tag))
{
(activeplats[j])->oldstatus = (activeplats[j])->status;
(activeplats[j])->status = in_stasis;
(activeplats[j])->thinker.function.acv = (actionf_v)NULL;
}
}
void P_AddActivePlat(plat_t* plat)
{
int i;
for (i = 0;i < MAXPLATS;i++)
if (activeplats[i] == NULL)
{
activeplats[i] = plat;
return;
}
I_Error ("P_AddActivePlat: no more plats!");
}
void P_RemoveActivePlat(plat_t* plat)
{
int i;
for (i = 0;i < MAXPLATS;i++)
if (plat == activeplats[i])
{
(activeplats[i])->sector->specialdata = NULL;
P_RemoveThinker(&(activeplats[i])->thinker);
activeplats[i] = NULL;
return;
}
I_Error ("P_RemoveActivePlat: can't find plat!");
}
--- NEW FILE: depcomp ---
--- NEW FILE: r_state.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_state.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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;
// needed for pre rendering (fracs)
extern fixed_t* spritewidth;
extern fixed_t* spriteoffset;
extern fixed_t* spritetopoffset;
extern lighttable_t* colormaps;
extern int viewwidth;
extern int scaledviewwidth;
extern int viewheight;
extern int firstflat;
// 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[SCREENWIDTH+1];
//extern fixed_t finetangent[FINEANGLES/2];
extern fixed_t rw_distance;
extern angle_t rw_normalangle;
// angle to line origin
extern int rw_angle1;
// Segs count?
extern int sscount;
extern visplane_t* floorplane;
extern visplane_t* ceilingplane;
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_state.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: w_wad.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: w_wad.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: w_wad.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Handles WAD file header, directory, lump I/O.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: w_wad.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "m_swap.h"
#include "doomtype.h"
#include "i_system.h"
#include "z_zone.h"
#ifdef __GNUG__
#pragma implementation "w_wad.h"
#endif
#include "w_wad.h"
//
// GLOBALS
//
// Location of each lump on disk.
lumpinfo_t* lumpinfo;
int numlumps;
void** lumpcache;
#if defined(linux) || defined(__BEOS__) || defined(__SVR4)
void strupr (char* s)
{
while (*s) { *s = toupper(*s); s++; }
}
#endif
int filelength (FILE *handle)
{
unsigned long pos, size;
pos = ftell(handle);
printf("Position was %lu\n", pos);
fseek(handle, 0, SEEK_END);
size = ftell(handle);
fseek(handle, pos, SEEK_SET);
printf("Size is %lu\n", size);
return (int)size;
}
void
ExtractFileBase
( char* path,
char* dest )
{
char* src;
int length;
src = path + strlen(path) - 1;
// back up until a \ or the start
while (src != path
&& *(src-1) != '\\'
&& *(src-1) != '/')
{
src--;
}
// copy up to eight characters
memset (dest,0,8);
length = 0;
while (*src && *src != '.')
{
if (++length == 9)
I_Error ("Filename base of %s >8 chars",path);
*dest++ = toupper((int)*src++);
}
}
//
// LUMP BASED ROUTINES.
//
//
// W_AddFile
// All files are optional, but at least one file must be
// found (PWAD, if all required lumps are present).
// Files with a .wad extension are wadlink files
// with multiple lumps.
// Other files are single lumps with the base filename
// for the lump name.
//
// If filename starts with a tilde, the file is handled
// specially to allow map reloads.
// But: the reload feature is a fragile hack...
#ifdef __BEOS__
#ifdef __GNUC__
extern void *alloca(int);
#else
#include <alloca.h>
#endif
#endif /* __BEOS__ */
int reloadlump;
char* reloadname;
void W_AddFile (char *filename)
{
wadinfo_t header;
lumpinfo_t* lump_p;
unsigned i;
FILE *handle;
int length;
int startlump;
filelump_t* fileinfo;
filelump_t singleinfo;
int storehandle;
// open the file and add to directory
// handle reload indicator.
if (filename[0] == '~')
{
filename++;
reloadname = filename;
reloadlump = numlumps;
}
if ( (handle = fopen (filename,"rb")) == NULL)
{
printf (" couldn't open %s\n",filename);
return;
}
printf (" adding %s\n",filename);
startlump = numlumps;
if (I_strncasecmp (filename+strlen(filename)-3 , "wad", 3 ) )
{
// single lump file
fileinfo = &singleinfo;
singleinfo.filepos = 0;
singleinfo.size = LONG(filelength(handle));
ExtractFileBase (filename, singleinfo.name);
numlumps++;
}
else
{
// WAD file
fread (&header, 1, sizeof(header), handle);
if (strncmp(header.identification,"IWAD",4))
{
// Homebrew levels?
if (strncmp(header.identification,"PWAD",4))
{
I_Error ("Wad file %s doesn't have IWAD "
"or PWAD id\n", filename);
}
// ???modifiedgame = true;
}
header.numlumps = LONG(header.numlumps);
header.infotableofs = LONG(header.infotableofs);
length = header.numlumps*sizeof(filelump_t);
fileinfo = alloca (length);
fseek (handle, header.infotableofs, SEEK_SET);
fread (fileinfo, 1, length, handle);
numlumps += header.numlumps;
}
// Fill in lumpinfo
lumpinfo = realloc (lumpinfo, numlumps*sizeof(lumpinfo_t));
if (!lumpinfo)
I_Error ("Couldn't realloc lumpinfo");
lump_p = &lumpinfo[startlump];
storehandle = reloadname ? -1 : (int)handle;
for (i=startlump ; i<numlumps ; i++,lump_p++, fileinfo++)
{
lump_p->handle = storehandle;
lump_p->position = LONG(fileinfo->filepos);
lump_p->size = LONG(fileinfo->size);
strncpy (lump_p->name, fileinfo->name, 8);
}
if (reloadname)
fclose (handle);
}
//
// W_Reload
// Flushes any of the reloadable lumps in memory
// and reloads the directory.
//
void W_Reload (void)
{
wadinfo_t header;
int lumpcount;
lumpinfo_t* lump_p;
unsigned i;
FILE *handle;
int length;
filelump_t* fileinfo;
if (!reloadname)
return;
if ( (handle = fopen (reloadname,"rb")) == NULL)
I_Error ("W_Reload: couldn't open %s",reloadname);
fread (&header, 1, sizeof(header), handle);
lumpcount = LONG(header.numlumps);
header.infotableofs = LONG(header.infotableofs);
length = lumpcount*sizeof(filelump_t);
fileinfo = alloca (length);
fseek (handle, header.infotableofs, SEEK_SET);
fread (fileinfo, 1, length, handle);
// Fill in lumpinfo
lump_p = &lumpinfo[reloadlump];
for (i=reloadlump ;
i<reloadlump+lumpcount ;
i++,lump_p++, fileinfo++)
{
if (lumpcache[i])
Z_Free (lumpcache[i]);
lump_p->position = LONG(fileinfo->filepos);
lump_p->size = LONG(fileinfo->size);
}
fclose (handle);
}
//
// W_InitMultipleFiles
// Pass a null terminated list of files to use.
// All files are optional, but at least one file
// must be found.
// Files with a .wad extension are idlink files
// with multiple lumps.
// Other files are single lumps with the base filename
// for the lump name.
// Lump names can appear multiple times.
// The name searcher looks backwards, so a later file
// does override all earlier ones.
//
void W_InitMultipleFiles (char** filenames)
{
int size;
// open all the files, load headers, and count lumps
numlumps = 0;
// will be realloced as lumps are added
lumpinfo = malloc(1);
for ( ; *filenames ; filenames++)
W_AddFile (*filenames);
if (!numlumps)
I_Error ("W_InitFiles: no files found");
// set up caching
size = numlumps * sizeof(*lumpcache);
lumpcache = malloc (size);
if (!lumpcache)
I_Error ("Couldn't allocate lumpcache");
memset (lumpcache,0, size);
}
//
// W_InitFile
// Just initialize from a single file.
//
void W_InitFile (char* filename)
{
char* names[2];
names[0] = filename;
names[1] = NULL;
W_InitMultipleFiles (names);
}
//
// W_NumLumps
//
int W_NumLumps (void)
{
return numlumps;
}
//
// W_CheckNumForName
// Returns -1 if name not found.
//
int W_CheckNumForName (char* name)
{
union {
char s[9];
int x[2];
} name8;
int v1;
int v2;
lumpinfo_t* lump_p;
// make the name into two integers for easy compares
strncpy (name8.s,name,8);
// in case the name was a fill 8 chars
name8.s[8] = 0;
// case insensitive
strupr (name8.s);
v1 = name8.x[0];
v2 = name8.x[1];
// scan backwards so patch lump files take precedence
lump_p = lumpinfo + numlumps;
while (lump_p-- != lumpinfo)
{
if ( *(int *)lump_p->name == v1
&& *(int *)&lump_p->name[4] == v2)
{
return lump_p - lumpinfo;
}
}
// TFB. Not found.
return -1;
}
//
// W_GetNumForName
// Calls W_CheckNumForName, but bombs out if not found.
//
int W_GetNumForName (char* name)
{
int i;
i = W_CheckNumForName (name);
if (i == -1)
I_Error ("W_GetNumForName: %s not found!", name);
return i;
}
//
// W_LumpLength
// Returns the buffer size needed to load the given lump.
//
int W_LumpLength (int lump)
{
if (lump >= numlumps)
I_Error ("W_LumpLength: %i >= numlumps",lump);
return lumpinfo[lump].size;
}
//
// W_ReadLump
// Loads the lump into the given buffer,
// which must be >= W_LumpLength().
//
void
W_ReadLump
( int lump,
void* dest )
{
int c;
lumpinfo_t* l;
FILE *handle;
if (lump >= numlumps)
I_Error ("W_ReadLump: %i >= numlumps",lump);
l = lumpinfo+lump;
// ??? I_BeginRead ();
if (l->handle == -1)
{
// reloadable file, so use open / read / close
if ( (handle = fopen (reloadname,"rb")) == NULL)
I_Error ("W_ReadLump: couldn't open %s",reloadname);
}
else
handle = (FILE *)l->handle;
fseek (handle, l->position, SEEK_SET);
c = fread (dest, 1, l->size, handle);
if (c < l->size)
I_Error ("W_ReadLump: only read %i of %i on lump %i",
c,l->size,lump);
if (l->handle == -1)
fclose (handle);
// ??? I_EndRead ();
}
//
// W_CacheLumpNum
//
void*
W_CacheLumpNum
( int lump,
int tag )
{
byte* ptr;
if ((unsigned)lump >= numlumps)
I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
if (!lumpcache[lump])
{
// read the lump in
//printf ("cache miss on lump %i\n",lump);
ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]);
W_ReadLump (lump, lumpcache[lump]);
}
else
{
//printf ("cache hit on lump %i\n",lump);
Z_ChangeTag (lumpcache[lump],tag);
}
return lumpcache[lump];
}
//
// W_CacheLumpName
//
void*
W_CacheLumpName
( char* name,
int tag )
{
return W_CacheLumpNum (W_GetNumForName(name), tag);
}
//
// W_Profile
//
int info[2500][10];
int profilecount;
void W_Profile (void)
{
int i;
memblock_t* block;
void* ptr;
char ch;
FILE* f;
int j;
char name[9];
for (i=0 ; i<numlumps ; i++)
{
ptr = lumpcache[i];
if (!ptr)
{
ch = ' ';
continue;
}
else
{
block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
if (block->tag < PU_PURGELEVEL)
ch = 'S';
else
ch = 'P';
}
info[i][profilecount] = ch;
}
profilecount++;
f = fopen ("waddump.txt","w");
name[8] = 0;
for (i=0 ; i<numlumps ; i++)
{
memcpy (name,lumpinfo[i].name,8);
for (j=0 ; j<8 ; j++)
if (!name[j])
break;
for ( ; j<8 ; j++)
name[j] = ' ';
fprintf (f,"%s ",name);
for (j=0 ; j<profilecount ; j++)
fprintf (f," %c",info[i][j]);
fprintf (f,"\n");
}
fclose (f);
}
--- NEW FILE: i_net.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_net.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific network interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_NET__
#define __I_NET__
#ifdef __GNUG__
#pragma interface
#endif
// Called by D_DoomMain.
void I_InitNetwork (void);
void I_NetCmd (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log: i_net.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: d_french.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_french.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Printed strings, french translation.
//
//-----------------------------------------------------------------------------
#ifndef __D_FRENCH__
#define __D_FRENCH__
//
// D_Main.C
//
#define D_DEVSTR "MODE DEVELOPPEMENT ON.\n"
#define D_CDROM "VERSION CD-ROM: DEFAULT.CFG DANS C:\\DOOMDATA\n"
//
// M_Menu.C
//
#define PRESSKEY "APPUYEZ SUR UNE TOUCHE."
#define PRESSYN "APPUYEZ SUR Y OU N"
#define QUITMSG "VOUS VOULEZ VRAIMENT\nQUITTER CE SUPER JEU?"
#define LOADNET "VOUS NE POUVEZ PAS CHARGER\nUN JEU EN RESEAU!\n\n"PRESSKEY
#define QLOADNET "CHARGEMENT RAPIDE INTERDIT EN RESEAU!\n\n"PRESSKEY
#define QSAVESPOT "VOUS N'AVEZ PAS CHOISI UN EMPLACEMENT!\n\n"PRESSKEY
#define SAVEDEAD "VOUS NE POUVEZ PAS SAUVER SI VOUS NE JOUEZ "\
"PAS!\n\n"PRESSKEY
#define QSPROMPT "SAUVEGARDE RAPIDE DANS LE FICHIER \n\n'%s'?\n\n"PRESSYN
#define QLPROMPT "VOULEZ-VOUS CHARGER LA SAUVEGARDE"\
"\n\n'%s'?\n\n"PRESSYN
#define NEWGAME "VOUS NE POUVEZ PAS LANCER\n"\
"UN NOUVEAU JEU SUR RESEAU.\n\n"PRESSKEY
#define NIGHTMARE "VOUS CONFIRMEZ? CE NIVEAU EST\n"\
"VRAIMENT IMPITOYABLE!n"PRESSYN
#define SWSTRING "CECI EST UNE VERSION SHAREWARE DE DOOM.\n\n"\
"VOUS DEVRIEZ COMMANDER LA TRILOGIE COMPLETE.\n\n"PRESSKEY
#define MSGOFF "MESSAGES OFF"
#define MSGON "MESSAGES ON"
#define NETEND "VOUS NE POUVEZ PAS METTRE FIN A UN JEU SUR "\
"RESEAU!\n\n"PRESSKEY
#define ENDGAME "VOUS VOULEZ VRAIMENT METTRE FIN AU JEU?\n\n"PRESSYN
#define DOSY "(APPUYEZ SUR Y POUR REVENIR AU OS.)"
#define DETAILHI "GRAPHISMES MAXIMUM "
#define DETAILLO "GRAPHISMES MINIMUM "
#define GAMMALVL0 "CORRECTION GAMMA OFF"
#define GAMMALVL1 "CORRECTION GAMMA NIVEAU 1"
#define GAMMALVL2 "CORRECTION GAMMA NIVEAU 2"
#define GAMMALVL3 "CORRECTION GAMMA NIVEAU 3"
#define GAMMALVL4 "CORRECTION GAMMA NIVEAU 4"
#define EMPTYSTRING "EMPLACEMENT VIDE"
//
// P_inter.C
//
#define GOTARMOR "ARMURE RECUPEREE."
#define GOTMEGA "MEGA-ARMURE RECUPEREE!"
#define GOTHTHBONUS "BONUS DE SANTE RECUPERE."
#define GOTARMBONUS "BONUS D'ARMURE RECUPERE."
#define GOTSTIM "STIMPACK RECUPERE."
#define GOTMEDINEED "MEDIKIT RECUPERE. VOUS EN AVEZ VRAIMENT BESOIN!"
#define GOTMEDIKIT "MEDIKIT RECUPERE."
#define GOTSUPER "SUPERCHARGE!"
#define GOTBLUECARD "CARTE MAGNETIQUE BLEUE RECUPEREE."
#define GOTYELWCARD "CARTE MAGNETIQUE JAUNE RECUPEREE."
#define GOTREDCARD "CARTE MAGNETIQUE ROUGE RECUPEREE."
#define GOTBLUESKUL "CLEF CRANE BLEUE RECUPEREE."
#define GOTYELWSKUL "CLEF CRANE JAUNE RECUPEREE."
#define GOTREDSKULL "CLEF CRANE ROUGE RECUPEREE."
#define GOTINVUL "INVULNERABILITE!"
#define GOTBERSERK "BERSERK!"
#define GOTINVIS "INVISIBILITE PARTIELLE "
#define GOTSUIT "COMBINAISON ANTI-RADIATIONS "
#define GOTMAP "CARTE INFORMATIQUE "
#define GOTVISOR "VISEUR A AMPLIFICATION DE LUMIERE "
#define GOTMSPHERE "MEGASPHERE!"
#define GOTCLIP "CHARGEUR RECUPERE."
#define GOTCLIPBOX "BOITE DE BALLES RECUPEREE."
#define GOTROCKET "ROQUETTE RECUPEREE."
#define GOTROCKBOX "CAISSE DE ROQUETTES RECUPEREE."
#define GOTCELL "CELLULE D'ENERGIE RECUPEREE."
#define GOTCELLBOX "PACK DE CELLULES D'ENERGIE RECUPERE."
#define GOTSHELLS "4 CARTOUCHES RECUPEREES."
#define GOTSHELLBOX "BOITE DE CARTOUCHES RECUPEREE."
#define GOTBACKPACK "SAC PLEIN DE MUNITIONS RECUPERE!"
#define GOTBFG9000 "VOUS AVEZ UN BFG9000! OH, OUI!"
#define GOTCHAINGUN "VOUS AVEZ LA MITRAILLEUSE!"
#define GOTCHAINSAW "UNE TRONCONNEUSE!"
#define GOTLAUNCHER "VOUS AVEZ UN LANCE-ROQUETTES!"
#define GOTPLASMA "VOUS AVEZ UN FUSIL A PLASMA!"
#define GOTSHOTGUN "VOUS AVEZ UN FUSIL!"
#define GOTSHOTGUN2 "VOUS AVEZ UN SUPER FUSIL!"
//
// P_Doors.C
//
#define PD_BLUEO "IL VOUS FAUT UNE CLEF BLEUE"
#define PD_REDO "IL VOUS FAUT UNE CLEF ROUGE"
#define PD_YELLOWO "IL VOUS FAUT UNE CLEF JAUNE"
#define PD_BLUEK PD_BLUEO
#define PD_REDK PD_REDO
#define PD_YELLOWK PD_YELLOWO
//
// G_game.C
//
#define GGSAVED "JEU SAUVEGARDE."
//
// HU_stuff.C
//
#define HUSTR_MSGU "[MESSAGE NON ENVOYE]"
#define HUSTR_E1M1 "E1M1: HANGAR"
#define HUSTR_E1M2 "E1M2: USINE NUCLEAIRE "
#define HUSTR_E1M3 "E1M3: RAFFINERIE DE TOXINES "
#define HUSTR_E1M4 "E1M4: CENTRE DE CONTROLE "
#define HUSTR_E1M5 "E1M5: LABORATOIRE PHOBOS "
#define HUSTR_E1M6 "E1M6: TRAITEMENT CENTRAL "
#define HUSTR_E1M7 "E1M7: CENTRE INFORMATIQUE "
#define HUSTR_E1M8 "E1M8: ANOMALIE PHOBOS "
#define HUSTR_E1M9 "E1M9: BASE MILITAIRE "
#define HUSTR_E2M1 "E2M1: ANOMALIE DEIMOS "
#define HUSTR_E2M2 "E2M2: ZONE DE CONFINEMENT "
#define HUSTR_E2M3 "E2M3: RAFFINERIE"
#define HUSTR_E2M4 "E2M4: LABORATOIRE DEIMOS "
#define HUSTR_E2M5 "E2M5: CENTRE DE CONTROLE "
#define HUSTR_E2M6 "E2M6: HALLS DES DAMNES "
#define HUSTR_E2M7 "E2M7: CUVES DE REPRODUCTION "
#define HUSTR_E2M8 "E2M8: TOUR DE BABEL "
#define HUSTR_E2M9 "E2M9: FORTERESSE DU MYSTERE "
#define HUSTR_E3M1 "E3M1: DONJON DE L'ENFER "
#define HUSTR_E3M2 "E3M2: BOURBIER DU DESESPOIR "
#define HUSTR_E3M3 "E3M3: PANDEMONIUM"
#define HUSTR_E3M4 "E3M4: MAISON DE LA DOULEUR "
#define HUSTR_E3M5 "E3M5: CATHEDRALE PROFANE "
#define HUSTR_E3M6 "E3M6: MONT EREBUS"
#define HUSTR_E3M7 "E3M7: LIMBES"
#define HUSTR_E3M8 "E3M8: DIS"
#define HUSTR_E3M9 "E3M9: CLAPIERS"
#define HUSTR_1 "NIVEAU 1: ENTREE "
#define HUSTR_2 "NIVEAU 2: HALLS SOUTERRAINS "
#define HUSTR_3 "NIVEAU 3: LE FEU NOURRI "
#define HUSTR_4 "NIVEAU 4: LE FOYER "
#define HUSTR_5 "NIVEAU 5: LES EGOUTS "
#define HUSTR_6 "NIVEAU 6: LE BROYEUR "
#define HUSTR_7 "NIVEAU 7: L'HERBE DE LA MORT"
#define HUSTR_8 "NIVEAU 8: RUSES ET PIEGES "
#define HUSTR_9 "NIVEAU 9: LE PUITS "
#define HUSTR_10 "NIVEAU 10: BASE DE RAVITAILLEMENT "
#define HUSTR_11 "NIVEAU 11: LE CERCLE DE LA MORT!"
#define HUSTR_12 "NIVEAU 12: L'USINE "
#define HUSTR_13 "NIVEAU 13: LE CENTRE VILLE"
#define HUSTR_14 "NIVEAU 14: LES ANTRES PROFONDES "
#define HUSTR_15 "NIVEAU 15: LA ZONE INDUSTRIELLE "
#define HUSTR_16 "NIVEAU 16: LA BANLIEUE"
#define HUSTR_17 "NIVEAU 17: LES IMMEUBLES"
#define HUSTR_18 "NIVEAU 18: LA COUR "
#define HUSTR_19 "NIVEAU 19: LA CITADELLE "
#define HUSTR_20 "NIVEAU 20: JE T'AI EU!"
#define HUSTR_21 "NIVEAU 21: LE NIRVANA"
#define HUSTR_22 "NIVEAU 22: LES CATACOMBES "
#define HUSTR_23 "NIVEAU 23: LA GRANDE FETE "
#define HUSTR_24 "NIVEAU 24: LE GOUFFRE "
#define HUSTR_25 "NIVEAU 25: LES CHUTES DE SANG"
#define HUSTR_26 "NIVEAU 26: LES MINES ABANDONNEES "
#define HUSTR_27 "NIVEAU 27: CHEZ LES MONSTRES "
#define HUSTR_28 "NIVEAU 28: LE MONDE DE L'ESPRIT "
#define HUSTR_29 "NIVEAU 29: LA LIMITE "
#define HUSTR_30 "NIVEAU 30: L'ICONE DU PECHE "
#define HUSTR_31 "NIVEAU 31: WOLFENSTEIN"
#define HUSTR_32 "NIVEAU 32: LE MASSACRE"
#define HUSTR_CHATMACRO1 "JE SUIS PRET A LEUR EN FAIRE BAVER!"
#define HUSTR_CHATMACRO2 "JE VAIS BIEN."
#define HUSTR_CHATMACRO3 "JE N'AI PAS L'AIR EN FORME!"
#define HUSTR_CHATMACRO4 "AU SECOURS!"
#define HUSTR_CHATMACRO5 "TU CRAINS!"
#define HUSTR_CHATMACRO6 "LA PROCHAINE FOIS, MINABLE..."
#define HUSTR_CHATMACRO7 "VIENS ICI!"
#define HUSTR_CHATMACRO8 "JE VAIS M'EN OCCUPER."
#define HUSTR_CHATMACRO9 "OUI"
#define HUSTR_CHATMACRO0 "NON"
#define HUSTR_TALKTOSELF1 "VOUS PARLEZ TOUT SEUL "
#define HUSTR_TALKTOSELF2 "QUI EST LA?"
#define HUSTR_TALKTOSELF3 "VOUS VOUS FAITES PEUR "
#define HUSTR_TALKTOSELF4 "VOUS COMMENCEZ A DELIRER "
#define HUSTR_TALKTOSELF5 "VOUS ETES LARGUE..."
#define HUSTR_MESSAGESENT "[MESSAGE ENVOYE]"
// The following should NOT be changed unless it seems
// just AWFULLY necessary
#define HUSTR_PLRGREEN "VERT: "
#define HUSTR_PLRINDIGO "INDIGO: "
#define HUSTR_PLRBROWN "BRUN: "
#define HUSTR_PLRRED "ROUGE: "
#define HUSTR_KEYGREEN 'g' // french key should be "V"
#define HUSTR_KEYINDIGO 'i'
#define HUSTR_KEYBROWN 'b'
#define HUSTR_KEYRED 'r'
//
// AM_map.C
//
#define AMSTR_FOLLOWON "MODE POURSUITE ON"
#define AMSTR_FOLLOWOFF "MODE POURSUITE OFF"
#define AMSTR_GRIDON "GRILLE ON"
#define AMSTR_GRIDOFF "GRILLE OFF"
#define AMSTR_MARKEDSPOT "REPERE MARQUE "
#define AMSTR_MARKSCLEARED "REPERES EFFACES "
//
// ST_stuff.C
//
#define STSTR_MUS "CHANGEMENT DE MUSIQUE "
#define STSTR_NOMUS "IMPOSSIBLE SELECTION"
#define STSTR_DQDON "INVULNERABILITE ON "
#define STSTR_DQDOFF "INVULNERABILITE OFF"
#define STSTR_KFAADDED "ARMEMENT MAXIMUM! "
#define STSTR_FAADDED "ARMES (SAUF CLEFS) AJOUTEES"
#define STSTR_NCON "BARRIERES ON"
#define STSTR_NCOFF "BARRIERES OFF"
#define STSTR_BEHOLD " inVuln, Str, Inviso, Rad, Allmap, or Lite-amp"
#define STSTR_BEHOLDX "AMELIORATION ACTIVEE"
#define STSTR_CHOPPERS "... DOESN'T SUCK - GM"
#define STSTR_CLEV "CHANGEMENT DE NIVEAU..."
//
// F_Finale.C
//
#define E1TEXT "APRES AVOIR VAINCU LES GROS MECHANTS\n"\
"ET NETTOYE LA BASE LUNAIRE, VOUS AVEZ\n"\
"GAGNE, NON? PAS VRAI? OU EST DONC VOTRE\n"\
" RECOMPENSE ET VOTRE BILLET DE\n"\
"RETOUR? QU'EST-QUE CA VEUT DIRE?CE"\
"N'EST PAS LA FIN ESPEREE!\n"\
"\n" \
"CA SENT LA VIANDE PUTREFIEE, MAIS\n"\
"ON DIRAIT LA BASE DEIMOS. VOUS ETES\n"\
"APPAREMMENT BLOQUE AUX PORTES DE L'ENFER.\n"\
"LA SEULE ISSUE EST DE L'AUTRE COTE.\n"\
"\n"\
"POUR VIVRE LA SUITE DE DOOM, JOUEZ\n"\
"A 'AUX PORTES DE L'ENFER' ET A\n"\
"L'EPISODE SUIVANT, 'L'ENFER'!\n"
#define E2TEXT "VOUS AVEZ REUSSI. L'INFAME DEMON\n"\
"QUI CONTROLAIT LA BASE LUNAIRE DE\n"\
"DEIMOS EST MORT, ET VOUS AVEZ\n"\
"TRIOMPHE! MAIS... OU ETES-VOUS?\n"\
"VOUS GRIMPEZ JUSQU'AU BORD DE LA\n"\
"LUNE ET VOUS DECOUVREZ L'ATROCE\n"\
"VERITE.\n" \
"\n"\
"DEIMOS EST AU-DESSUS DE L'ENFER!\n"\
"VOUS SAVEZ QUE PERSONNE NE S'EN\n"\
"EST JAMAIS ECHAPPE, MAIS CES FUMIERS\n"\
"VONT REGRETTER DE VOUS AVOIR CONNU!\n"\
"VOUS REDESCENDEZ RAPIDEMENT VERS\n"\
"LA SURFACE DE L'ENFER.\n"\
"\n" \
"VOICI MAINTENANT LE CHAPITRE FINAL DE\n"\
"DOOM! -- L'ENFER."
#define E3TEXT "LE DEMON ARACHNEEN ET REPUGNANT\n"\
"QUI A DIRIGE L'INVASION DES BASES\n"\
"LUNAIRES ET SEME LA MORT VIENT DE SE\n"\
"FAIRE PULVERISER UNE FOIS POUR TOUTES.\n"\
"\n"\
"UNE PORTE SECRETE S'OUVRE. VOUS ENTREZ.\n"\
"VOUS AVEZ PROUVE QUE VOUS POUVIEZ\n"\
"RESISTER AUX HORREURS DE L'ENFER.\n"\
"IL SAIT ETRE BEAU JOUEUR, ET LORSQUE\n"\
"VOUS SORTEZ, VOUS REVOYEZ LES VERTES\n"\
"PRAIRIES DE LA TERRE, VOTRE PLANETE.\n"\
"\n"\
"VOUS VOUS DEMANDEZ CE QUI S'EST PASSE\n"\
"SUR TERRE PENDANT QUE VOUS AVEZ\n"\
"COMBATTU LE DEMON. HEUREUSEMENT,\n"\
"AUCUN GERME DU MAL N'A FRANCHI\n"\
"CETTE PORTE AVEC VOUS..."
// after level 6, put this:
#define C1TEXT "VOUS ETES AU PLUS PROFOND DE L'ASTROPORT\n" \
"INFESTE DE MONSTRES, MAIS QUELQUE CHOSE\n" \
"NE VA PAS. ILS ONT APPORTE LEUR PROPRE\n" \
"REALITE, ET LA TECHNOLOGIE DE L'ASTROPORT\n" \
"EST AFFECTEE PAR LEUR PRESENCE.\n" \
"\n"\
"DEVANT VOUS, VOUS VOYEZ UN POSTE AVANCE\n" \
"DE L'ENFER, UNE ZONE FORTIFIEE. SI VOUS\n" \
"POUVEZ PASSER, VOUS POURREZ PENETRER AU\n" \
"COEUR DE LA BASE HANTEE ET TROUVER \n" \
"L'INTERRUPTEUR DE CONTROLE QUI GARDE LA \n" \
"POPULATION DE LA TERRE EN OTAGE."
// After level 11, put this:
#define C2TEXT "VOUS AVEZ GAGNE! VOTRE VICTOIRE A PERMIS\n" \
"A L'HUMANITE D'EVACUER LA TERRE ET \n"\
"D'ECHAPPER AU CAUCHEMAR. VOUS ETES \n"\
"MAINTENANT LE DERNIER HUMAIN A LA SURFACE \n"\
"DE LA PLANETE. VOUS ETES ENTOURE DE \n"\
"MUTANTS CANNIBALES, D'EXTRATERRESTRES \n"\
"CARNIVORES ET D'ESPRITS DU MAL. VOUS \n"\
"ATTENDEZ CALMEMENT LA MORT, HEUREUX \n"\
"D'AVOIR PU SAUVER VOTRE RACE.\n"\
"MAIS UN MESSAGE VOUS PARVIENT SOUDAIN\n"\
"DE L'ESPACE: \"NOS CAPTEURS ONT LOCALISE\n"\
"LA SOURCE DE L'INVASION EXTRATERRESTRE.\n"\
"SI VOUS Y ALLEZ, VOUS POURREZ PEUT-ETRE\n"\
"LES ARRETER. LEUR BASE EST SITUEE AU COEUR\n"\
"DE VOTRE VILLE NATALE, PRES DE L'ASTROPORT.\n"\
"VOUS VOUS RELEVEZ LENTEMENT ET PENIBLEMENT\n"\
"ET VOUS REPARTEZ POUR LE FRONT."
// After level 20, put this:
#define C3TEXT "VOUS ETES AU COEUR DE LA CITE CORROMPUE,\n"\
"ENTOURE PAR LES CADAVRES DE VOS ENNEMIS.\n"\
"VOUS NE VOYEZ PAS COMMENT DETRUIRE LA PORTE\n"\
"DES CREATURES DE CE COTE. VOUS SERREZ\n"\
"LES DENTS ET PLONGEZ DANS L'OUVERTURE.\n"\
"\n"\
"IL DOIT Y AVOIR UN MOYEN DE LA FERMER\n"\
"DE L'AUTRE COTE. VOUS ACCEPTEZ DE\n"\
"TRAVERSER L'ENFER POUR LE FAIRE?"
// After level 29, put this:
#define C4TEXT "LE VISAGE HORRIBLE D'UN DEMON D'UNE\n"\
"TAILLE INCROYABLE S'EFFONDRE DEVANT\n"\
"VOUS LORSQUE VOUS TIREZ UNE SALVE DE\n"\
"ROQUETTES DANS SON CERVEAU. LE MONSTRE\n"\
"SE RATATINE, SES MEMBRES DECHIQUETES\n"\
"SE REPANDANT SUR DES CENTAINES DE\n"\
"KILOMETRES A LA SURFACE DE L'ENFER.\n"\
"\n"\
"VOUS AVEZ REUSSI. L'INVASION N'AURA.\n"\
"PAS LIEU. LA TERRE EST SAUVEE. L'ENFER\n"\
"EST ANEANTI. EN VOUS DEMANDANT OU IRONT\n"\
"MAINTENANT LES DAMNES, VOUS ESSUYEZ\n"\
"VOTRE FRONT COUVERT DE SUEUR ET REPARTEZ\n"\
"VERS LA TERRE. SA RECONSTRUCTION SERA\n"\
"BEAUCOUP PLUS DROLE QUE SA DESTRUCTION.\n"
// Before level 31, put this:
#define C5TEXT "FELICITATIONS! VOUS AVEZ TROUVE LE\n"\
"NIVEAU SECRET! IL SEMBLE AVOIR ETE\n"\
"CONSTRUIT PAR LES HUMAINS. VOUS VOUS\n"\
"DEMANDEZ QUELS PEUVENT ETRE LES\n"\
"HABITANTS DE CE COIN PERDU DE L'ENFER."
// Before level 32, put this:
#define C6TEXT "FELICITATIONS! VOUS AVEZ DECOUVERT\n"\
"LE NIVEAU SUPER SECRET! VOUS FERIEZ\n"\
"MIEUX DE FONCER DANS CELUI-LA!\n"
//
// Character cast strings F_FINALE.C
//
#define CC_ZOMBIE "ZOMBIE"
#define CC_SHOTGUN "TYPE AU FUSIL"
#define CC_HEAVY "MEC SUPER-ARME"
#define CC_IMP "DIABLOTIN"
#define CC_DEMON "DEMON"
#define CC_LOST "AME PERDUE"
#define CC_CACO "CACODEMON"
#define CC_HELL "CHEVALIER DE L'ENFER"
#define CC_BARON "BARON DE L'ENFER"
#define CC_ARACH "ARACHNOTRON"
#define CC_PAIN "ELEMENTAIRE DE LA DOULEUR"
#define CC_REVEN "REVENANT"
#define CC_MANCU "MANCUBUS"
#define CC_ARCH "ARCHI-INFAME"
#define CC_SPIDER "L'ARAIGNEE CERVEAU"
#define CC_CYBER "LE CYBERDEMON"
#define CC_HERO "NOTRE HEROS"
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_french.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_setup.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_setup.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Setup a game, startup stuff.
//
//-----------------------------------------------------------------------------
#ifndef __P_SETUP__
#define __P_SETUP__
#ifdef __GNUG__
#pragma interface
#endif
// NOT called by W_Ticker. Fixme.
void
P_SetupLevel
( int episode,
int map,
int playermask,
skill_t skill);
// Called by startup code.
void P_Init (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_setup.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: st_lib.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: st_lib.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// The status bar widget code.
//
//-----------------------------------------------------------------------------
#ifndef __STLIB__
#define __STLIB__
// We are referring to patches.
#include "r_defs.h"
//
// 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
patch_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
patch_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
patch_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
int oldval;
// pointer to current icon status
boolean* val;
// pointer to boolean
// stating whether to update icon
boolean* on;
patch_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,
patch_t** pl,
int* num,
boolean* on,
int width );
void
STlib_updateNum
( st_number_t* n,
boolean refresh );
// Percent widget routines
void
STlib_initPercent
( st_percent_t* p,
int x,
int y,
patch_t** pl,
int* num,
boolean* on,
patch_t* percent );
void
STlib_updatePercent
( st_percent_t* per,
int refresh );
// Multiple Icon widget routines
void
STlib_initMultIcon
( st_multicon_t* mi,
int x,
int y,
patch_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,
patch_t* i,
boolean* val,
boolean* on );
void
STlib_updateBinIcon
( st_binicon_t* bi,
boolean refresh );
#endif
//-----------------------------------------------------------------------------
//
// $Log: st_lib.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: d_event.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_event.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#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,
ga_screenshot
} 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 3 bits hold weapon num.
BT_CHANGE = 4,
// The 3bit weapon mask and shift, convenience.
BT_WEAPONMASK = (8+16+32),
BT_WEAPONSHIFT = 3,
// Pause the game.
BTS_PAUSE = 1,
// Save the game at each console.
BTS_SAVEGAME = 2,
// Savegame slot numbers
// occupy the second byte of buttons.
BTS_SAVEMASK = (4+8+16),
BTS_SAVESHIFT = 2,
} buttoncode_t;
//
// GLOBAL VARIABLES
//
#define MAXEVENTS 64
extern event_t events[MAXEVENTS];
extern int eventhead;
extern int eventtail;
extern gameaction_t gameaction;
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_event.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_user.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_user.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_user.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Player related stuff.
// Bobbing POV/weapon, movement.
// Pending weapon.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_user.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "doomdef.h"
#include "d_event.h"
#include "p_local.h"
#include "doomstat.h"
// Index of the special effects (INVUL inverse) map.
#define INVERSECOLORMAP 32
//
// Movement.
//
// 16 pixels of bob
#define MAXBOB 0x100000
boolean onground;
//
// P_Thrust
// Moves the given origin along a given angle.
//
void
P_Thrust
( player_t* player,
angle_t angle,
fixed_t move )
{
angle >>= ANGLETOFINESHIFT;
player->mo->momx += FixedMul(move,finecosine[angle]);
player->mo->momy += FixedMul(move,finesine[angle]);
}
//
// P_CalcHeight
// Calculate the walking / running height adjustment
//
void P_CalcHeight (player_t* player)
{
int angle;
fixed_t bob;
// Regular movement bobbing
// (needs to be calculated for gun swing
// even if not on ground)
// OPTIMIZE: tablify angle
// Note: a LUT allows for effects
// like a ramp with low health.
player->bob =
FixedMul (player->mo->momx, player->mo->momx)
+ FixedMul (player->mo->momy,player->mo->momy);
player->bob >>= 2;
if (player->bob>MAXBOB)
player->bob = MAXBOB;
if ((player->cheats & CF_NOMOMENTUM) || !onground)
{
player->viewz = player->mo->z + VIEWHEIGHT;
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
player->viewz = player->mo->ceilingz-4*FRACUNIT;
player->viewz = player->mo->z + player->viewheight;
return;
}
angle = (FINEANGLES/20*leveltime)&FINEMASK;
bob = FixedMul ( player->bob/2, finesine[angle]);
// move viewheight
if (player->playerstate == PST_LIVE)
{
player->viewheight += player->deltaviewheight;
if (player->viewheight > VIEWHEIGHT)
{
player->viewheight = VIEWHEIGHT;
player->deltaviewheight = 0;
}
if (player->viewheight < VIEWHEIGHT/2)
{
player->viewheight = VIEWHEIGHT/2;
if (player->deltaviewheight <= 0)
player->deltaviewheight = 1;
}
if (player->deltaviewheight)
{
player->deltaviewheight += FRACUNIT/4;
if (!player->deltaviewheight)
player->deltaviewheight = 1;
}
}
player->viewz = player->mo->z + player->viewheight + bob;
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
player->viewz = player->mo->ceilingz-4*FRACUNIT;
}
//
// P_MovePlayer
//
void P_MovePlayer (player_t* player)
{
ticcmd_t* cmd;
cmd = &player->cmd;
player->mo->angle += (cmd->angleturn<<16);
// Do not let the player control movement
// if not onground.
onground = (player->mo->z <= player->mo->floorz);
if (cmd->forwardmove && onground)
P_Thrust (player, player->mo->angle, cmd->forwardmove*2048);
if (cmd->sidemove && onground)
P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048);
if ( (cmd->forwardmove || cmd->sidemove)
&& player->mo->state == &states[S_PLAY] )
{
P_SetMobjState (player->mo, S_PLAY_RUN1);
}
}
//
// P_DeathThink
// Fall on your face when dying.
// Decrease POV height to floor height.
//
#define ANG5 (ANG90/18)
void P_DeathThink (player_t* player)
{
angle_t angle;
angle_t delta;
P_MovePsprites (player);
// fall to the ground
if (player->viewheight > 6*FRACUNIT)
player->viewheight -= FRACUNIT;
if (player->viewheight < 6*FRACUNIT)
player->viewheight = 6*FRACUNIT;
player->deltaviewheight = 0;
onground = (player->mo->z <= player->mo->floorz);
P_CalcHeight (player);
if (player->attacker && player->attacker != player->mo)
{
angle = R_PointToAngle2 (player->mo->x,
player->mo->y,
player->attacker->x,
player->attacker->y);
delta = angle - player->mo->angle;
if (delta < ANG5 || delta > (unsigned)-ANG5)
{
// Looking at killer,
// so fade damage flash down.
player->mo->angle = angle;
if (player->damagecount)
player->damagecount--;
}
else if (delta < ANG180)
player->mo->angle += ANG5;
else
player->mo->angle -= ANG5;
}
else if (player->damagecount)
player->damagecount--;
if (player->cmd.buttons & BT_USE)
player->playerstate = PST_REBORN;
}
//
// P_PlayerThink
//
void P_PlayerThink (player_t* player)
{
ticcmd_t* cmd;
weapontype_t newweapon;
// fixme: do this in the cheat code
if (player->cheats & CF_NOCLIP)
player->mo->flags |= MF_NOCLIP;
else
player->mo->flags &= ~MF_NOCLIP;
// chain saw run forward
cmd = &player->cmd;
if (player->mo->flags & MF_JUSTATTACKED)
{
cmd->angleturn = 0;
cmd->forwardmove = 0xc800/512;
cmd->sidemove = 0;
player->mo->flags &= ~MF_JUSTATTACKED;
}
if (player->playerstate == PST_DEAD)
{
P_DeathThink (player);
return;
}
// Move around.
// Reactiontime is used to prevent movement
// for a bit after a teleport.
if (player->mo->reactiontime)
player->mo->reactiontime--;
else
P_MovePlayer (player);
P_CalcHeight (player);
if (player->mo->subsector->sector->special)
P_PlayerInSpecialSector (player);
// Check for weapon change.
// A special event has no other buttons.
if (cmd->buttons & BT_SPECIAL)
cmd->buttons = 0;
if (cmd->buttons & BT_CHANGE)
{
// The actual changing of the weapon is done
// when the weapon psprite can do it
// (read: not in the middle of an attack).
newweapon = (cmd->buttons&BT_WEAPONMASK)>>BT_WEAPONSHIFT;
if (newweapon == wp_fist
&& player->weaponowned[wp_chainsaw]
&& !(player->readyweapon == wp_chainsaw
&& player->powers[pw_strength]))
{
newweapon = wp_chainsaw;
}
if ( (gamemode == commercial)
&& newweapon == wp_shotgun
&& player->weaponowned[wp_supershotgun]
&& player->readyweapon != wp_supershotgun)
{
newweapon = wp_supershotgun;
}
if (player->weaponowned[newweapon]
&& newweapon != player->readyweapon)
{
// Do not go to plasma or BFG in shareware,
// even if cheated.
if ((newweapon != wp_plasma
&& newweapon != wp_bfg)
|| (gamemode != shareware) )
{
player->pendingweapon = newweapon;
}
}
}
// check for use
if (cmd->buttons & BT_USE)
{
if (!player->usedown)
{
P_UseLines (player);
player->usedown = true;
}
}
else
player->usedown = false;
// cycle psprites
P_MovePsprites (player);
// Counters, time dependend power ups.
// Strength counts up to diminish fade.
if (player->powers[pw_strength])
player->powers[pw_strength]++;
if (player->powers[pw_invulnerability])
player->powers[pw_invulnerability]--;
if (player->powers[pw_invisibility])
if (! --player->powers[pw_invisibility] )
player->mo->flags &= ~MF_SHADOW;
if (player->powers[pw_infrared])
player->powers[pw_infrared]--;
if (player->powers[pw_ironfeet])
player->powers[pw_ironfeet]--;
if (player->damagecount)
player->damagecount--;
if (player->bonuscount)
player->bonuscount--;
// Handling colormaps.
if (player->powers[pw_invulnerability])
{
if (player->powers[pw_invulnerability] > 4*32
|| (player->powers[pw_invulnerability]&8) )
player->fixedcolormap = INVERSECOLORMAP;
else
player->fixedcolormap = 0;
}
else if (player->powers[pw_infrared])
{
if (player->powers[pw_infrared] > 4*32
|| (player->powers[pw_infrared]&8) )
{
// almost full bright
player->fixedcolormap = 1;
}
else
player->fixedcolormap = 0;
}
else
player->fixedcolormap = 0;
}
--- NEW FILE: m_menu.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_menu.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_menu.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1858 lines suppressed...]
ReadDef1.routine = M_DrawReadThis1;
ReadDef1.x = 330;
ReadDef1.y = 165;
ReadMenu1[0].routine = M_FinishReadThis;
break;
case shareware:
// Episode 2 and 3 are handled,
// branching to an ad screen.
case registered:
// We need to remove the fourth episode.
EpiDef.numitems--;
break;
case retail:
// We are fine.
default:
break;
}
}
--- NEW FILE: p_setup.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_setup.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_setup.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Do all the WAD I/O, get map description,
// set up initial state and misc. LUTs.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_setup.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include <math.h>
#include "z_zone.h"
#include "m_swap.h"
#include "m_bbox.h"
#include "g_game.h"
#include "i_system.h"
#include "w_wad.h"
#include "doomdef.h"
#include "p_local.h"
#include "s_sound.h"
#include "doomstat.h"
void P_SpawnMapThing (mapthing_t* mthing);
//
// MAP related Lookup tables.
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
//
int numvertexes;
vertex_t* vertexes;
int numsegs;
seg_t* segs;
int numsectors;
sector_t* sectors;
int numsubsectors;
subsector_t* subsectors;
int numnodes;
node_t* nodes;
int numlines;
line_t* lines;
int numsides;
side_t* sides;
// BLOCKMAP
// Created from axis aligned bounding box
// of the map, a rectangular array of
// blocks of size ...
// Used to speed up collision detection
// by spatial subdivision in 2D.
//
// Blockmap size.
int bmapwidth;
int bmapheight; // size in mapblocks
short* blockmap; // int for larger maps
// offsets in blockmap are from here
short* blockmaplump;
// origin of block map
fixed_t bmaporgx;
fixed_t bmaporgy;
// for thing chains
mobj_t** blocklinks;
// REJECT
// For fast sight rejection.
// Speeds up enemy AI by skipping detailed
// LineOf Sight calculation.
// Without special effect, this could be
// used as a PVS lookup as well.
//
byte* rejectmatrix;
// Maintain single and multi player starting spots.
#define MAX_DEATHMATCH_STARTS 10
mapthing_t deathmatchstarts[MAX_DEATHMATCH_STARTS];
mapthing_t* deathmatch_p;
mapthing_t playerstarts[MAXPLAYERS];
//
// P_LoadVertexes
//
void P_LoadVertexes (int lump)
{
byte* data;
int i;
mapvertex_t* ml;
vertex_t* li;
// Determine number of lumps:
// total lump length / vertex record length.
numvertexes = W_LumpLength (lump) / sizeof(mapvertex_t);
// Allocate zone memory for buffer.
vertexes = Z_Malloc (numvertexes*sizeof(vertex_t),PU_LEVEL,0);
// Load data into cache.
data = W_CacheLumpNum (lump,PU_STATIC);
ml = (mapvertex_t *)data;
li = vertexes;
// Copy and convert vertex coordinates,
// internal representation as fixed.
for (i=0 ; i<numvertexes ; i++, li++, ml++)
{
li->x = SHORT(ml->x)<<FRACBITS;
li->y = SHORT(ml->y)<<FRACBITS;
}
// Free buffer memory.
Z_Free (data);
}
//
// P_LoadSegs
//
void P_LoadSegs (int lump)
{
byte* data;
int i;
mapseg_t* ml;
seg_t* li;
line_t* ldef;
int linedef;
int side;
numsegs = W_LumpLength (lump) / sizeof(mapseg_t);
segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0);
memset (segs, 0, numsegs*sizeof(seg_t));
data = W_CacheLumpNum (lump,PU_STATIC);
ml = (mapseg_t *)data;
li = segs;
for (i=0 ; i<numsegs ; i++, li++, ml++)
{
li->v1 = &vertexes[SHORT(ml->v1)];
li->v2 = &vertexes[SHORT(ml->v2)];
li->angle = (SHORT(ml->angle))<<16;
li->offset = (SHORT(ml->offset))<<16;
linedef = SHORT(ml->linedef);
ldef = &lines[linedef];
li->linedef = ldef;
side = SHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[side]];
li->frontsector = sides[ldef->sidenum[side]].sector;
if (ldef-> flags & ML_TWOSIDED)
li->backsector = sides[ldef->sidenum[side^1]].sector;
else
li->backsector = 0;
}
Z_Free (data);
}
//
// P_LoadSubsectors
//
void P_LoadSubsectors (int lump)
{
byte* data;
int i;
mapsubsector_t* ms;
subsector_t* ss;
numsubsectors = W_LumpLength (lump) / sizeof(mapsubsector_t);
subsectors = Z_Malloc (numsubsectors*sizeof(subsector_t),PU_LEVEL,0);
data = W_CacheLumpNum (lump,PU_STATIC);
ms = (mapsubsector_t *)data;
memset (subsectors,0, numsubsectors*sizeof(subsector_t));
ss = subsectors;
for (i=0 ; i<numsubsectors ; i++, ss++, ms++)
{
ss->numlines = SHORT(ms->numsegs);
ss->firstline = SHORT(ms->firstseg);
}
Z_Free (data);
}
//
// P_LoadSectors
//
void P_LoadSectors (int lump)
{
byte* data;
int i;
mapsector_t* ms;
sector_t* ss;
numsectors = W_LumpLength (lump) / sizeof(mapsector_t);
sectors = Z_Malloc (numsectors*sizeof(sector_t),PU_LEVEL,0);
memset (sectors, 0, numsectors*sizeof(sector_t));
data = W_CacheLumpNum (lump,PU_STATIC);
ms = (mapsector_t *)data;
ss = sectors;
for (i=0 ; i<numsectors ; i++, ss++, ms++)
{
ss->floorheight = SHORT(ms->floorheight)<<FRACBITS;
ss->ceilingheight = SHORT(ms->ceilingheight)<<FRACBITS;
ss->floorpic = R_FlatNumForName(ms->floorpic);
ss->ceilingpic = R_FlatNumForName(ms->ceilingpic);
ss->lightlevel = SHORT(ms->lightlevel);
ss->special = SHORT(ms->special);
ss->tag = SHORT(ms->tag);
ss->thinglist = NULL;
}
Z_Free (data);
}
//
// P_LoadNodes
//
void P_LoadNodes (int lump)
{
byte* data;
int i;
int j;
int k;
mapnode_t* mn;
node_t* no;
numnodes = W_LumpLength (lump) / sizeof(mapnode_t);
nodes = Z_Malloc (numnodes*sizeof(node_t),PU_LEVEL,0);
data = W_CacheLumpNum (lump,PU_STATIC);
mn = (mapnode_t *)data;
no = nodes;
for (i=0 ; i<numnodes ; i++, no++, mn++)
{
no->x = SHORT(mn->x)<<FRACBITS;
no->y = SHORT(mn->y)<<FRACBITS;
no->dx = SHORT(mn->dx)<<FRACBITS;
no->dy = SHORT(mn->dy)<<FRACBITS;
for (j=0 ; j<2 ; j++)
{
no->children[j] = SHORT(mn->children[j]);
for (k=0 ; k<4 ; k++)
no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
}
}
Z_Free (data);
}
//
// P_LoadThings
//
void P_LoadThings (int lump)
{
byte* data;
int i;
mapthing_t* mt;
int numthings;
boolean spawn;
data = W_CacheLumpNum (lump,PU_STATIC);
numthings = W_LumpLength (lump) / sizeof(mapthing_t);
mt = (mapthing_t *)data;
for (i=0 ; i<numthings ; i++, mt++)
{
spawn = true;
// Do not spawn cool, new monsters if !commercial
if ( gamemode != commercial)
{
switch(mt->type)
{
case 68: // Arachnotron
case 64: // Archvile
case 88: // Boss Brain
case 89: // Boss Shooter
case 69: // Hell Knight
case 67: // Mancubus
case 71: // Pain Elemental
case 65: // Former Human Commando
case 66: // Revenant
case 84: // Wolf SS
spawn = false;
break;
}
}
if (spawn == false)
break;
// Do spawn all other stuff.
mt->x = SHORT(mt->x);
mt->y = SHORT(mt->y);
mt->angle = SHORT(mt->angle);
mt->type = SHORT(mt->type);
mt->options = SHORT(mt->options);
P_SpawnMapThing (mt);
}
Z_Free (data);
}
//
// P_LoadLineDefs
// Also counts secret lines for intermissions.
//
void P_LoadLineDefs (int lump)
{
byte* data;
int i;
maplinedef_t* mld;
line_t* ld;
vertex_t* v1;
vertex_t* v2;
numlines = W_LumpLength (lump) / sizeof(maplinedef_t);
lines = Z_Malloc (numlines*sizeof(line_t),PU_LEVEL,0);
memset (lines, 0, numlines*sizeof(line_t));
data = W_CacheLumpNum (lump,PU_STATIC);
mld = (maplinedef_t *)data;
ld = lines;
for (i=0 ; i<numlines ; i++, mld++, ld++)
{
ld->flags = SHORT(mld->flags);
ld->special = SHORT(mld->special);
ld->tag = SHORT(mld->tag);
v1 = ld->v1 = &vertexes[SHORT(mld->v1)];
v2 = ld->v2 = &vertexes[SHORT(mld->v2)];
ld->dx = v2->x - v1->x;
ld->dy = v2->y - v1->y;
if (!ld->dx)
ld->slopetype = ST_VERTICAL;
else if (!ld->dy)
ld->slopetype = ST_HORIZONTAL;
else
{
if (FixedDiv (ld->dy , ld->dx) > 0)
ld->slopetype = ST_POSITIVE;
else
ld->slopetype = ST_NEGATIVE;
}
if (v1->x < v2->x)
{
ld->bbox[BOXLEFT] = v1->x;
ld->bbox[BOXRIGHT] = v2->x;
}
else
{
ld->bbox[BOXLEFT] = v2->x;
ld->bbox[BOXRIGHT] = v1->x;
}
if (v1->y < v2->y)
{
ld->bbox[BOXBOTTOM] = v1->y;
ld->bbox[BOXTOP] = v2->y;
}
else
{
ld->bbox[BOXBOTTOM] = v2->y;
ld->bbox[BOXTOP] = v1->y;
}
ld->sidenum[0] = SHORT(mld->sidenum[0]);
ld->sidenum[1] = SHORT(mld->sidenum[1]);
if (ld->sidenum[0] != -1)
ld->frontsector = sides[ld->sidenum[0]].sector;
else
ld->frontsector = 0;
if (ld->sidenum[1] != -1)
ld->backsector = sides[ld->sidenum[1]].sector;
else
ld->backsector = 0;
}
Z_Free (data);
}
//
// P_LoadSideDefs
//
void P_LoadSideDefs (int lump)
{
byte* data;
int i;
mapsidedef_t* msd;
side_t* sd;
numsides = W_LumpLength (lump) / sizeof(mapsidedef_t);
sides = Z_Malloc (numsides*sizeof(side_t),PU_LEVEL,0);
memset (sides, 0, numsides*sizeof(side_t));
data = W_CacheLumpNum (lump,PU_STATIC);
msd = (mapsidedef_t *)data;
sd = sides;
for (i=0 ; i<numsides ; i++, msd++, sd++)
{
sd->textureoffset = SHORT(msd->textureoffset)<<FRACBITS;
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
sd->toptexture = R_TextureNumForName(msd->toptexture);
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
sd->midtexture = R_TextureNumForName(msd->midtexture);
sd->sector = §ors[SHORT(msd->sector)];
}
Z_Free (data);
}
//
// P_LoadBlockMap
//
void P_LoadBlockMap (int lump)
{
int i;
int count;
blockmaplump = W_CacheLumpNum (lump,PU_LEVEL);
blockmap = blockmaplump+4;
count = W_LumpLength (lump)/2;
for (i=0 ; i<count ; i++)
blockmaplump[i] = SHORT(blockmaplump[i]);
bmaporgx = blockmaplump[0]<<FRACBITS;
bmaporgy = blockmaplump[1]<<FRACBITS;
bmapwidth = blockmaplump[2];
bmapheight = blockmaplump[3];
// clear out mobj chains
count = sizeof(*blocklinks)* bmapwidth*bmapheight;
blocklinks = Z_Malloc (count,PU_LEVEL, 0);
memset (blocklinks, 0, count);
}
//
// P_GroupLines
// Builds sector line lists and subsector sector numbers.
// Finds block bounding boxes for sectors.
//
void P_GroupLines (void)
{
line_t** linebuffer;
int i;
int j;
int total;
line_t* li;
sector_t* sector;
subsector_t* ss;
seg_t* seg;
fixed_t bbox[4];
int block;
// look up sector number for each subsector
ss = subsectors;
for (i=0 ; i<numsubsectors ; i++, ss++)
{
seg = &segs[ss->firstline];
ss->sector = seg->sidedef->sector;
}
// count number of lines in each sector
li = lines;
total = 0;
for (i=0 ; i<numlines ; i++, li++)
{
total++;
li->frontsector->linecount++;
if (li->backsector && li->backsector != li->frontsector)
{
li->backsector->linecount++;
total++;
}
}
// build line tables for each sector
linebuffer = Z_Malloc (total*4, PU_LEVEL, 0);
sector = sectors;
for (i=0 ; i<numsectors ; i++, sector++)
{
M_ClearBox (bbox);
sector->lines = linebuffer;
li = lines;
for (j=0 ; j<numlines ; j++, li++)
{
if (li->frontsector == sector || li->backsector == sector)
{
*linebuffer++ = li;
M_AddToBox (bbox, li->v1->x, li->v1->y);
M_AddToBox (bbox, li->v2->x, li->v2->y);
}
}
if (linebuffer - sector->lines != sector->linecount)
I_Error ("P_GroupLines: miscounted");
// set the degenmobj_t to the middle of the bounding box
sector->soundorg.x = (bbox[BOXRIGHT]+bbox[BOXLEFT])/2;
sector->soundorg.y = (bbox[BOXTOP]+bbox[BOXBOTTOM])/2;
// adjust bounding box to map blocks
block = (bbox[BOXTOP]-bmaporgy+MAXRADIUS)>>MAPBLOCKSHIFT;
block = block >= bmapheight ? bmapheight-1 : block;
sector->blockbox[BOXTOP]=block;
block = (bbox[BOXBOTTOM]-bmaporgy-MAXRADIUS)>>MAPBLOCKSHIFT;
block = block < 0 ? 0 : block;
sector->blockbox[BOXBOTTOM]=block;
block = (bbox[BOXRIGHT]-bmaporgx+MAXRADIUS)>>MAPBLOCKSHIFT;
block = block >= bmapwidth ? bmapwidth-1 : block;
sector->blockbox[BOXRIGHT]=block;
block = (bbox[BOXLEFT]-bmaporgx-MAXRADIUS)>>MAPBLOCKSHIFT;
block = block < 0 ? 0 : block;
sector->blockbox[BOXLEFT]=block;
}
}
//
// P_SetupLevel
//
void
P_SetupLevel
( int episode,
int map,
int playermask,
skill_t skill)
{
int i;
char lumpname[9];
int lumpnum;
totalkills = totalitems = totalsecret = wminfo.maxfrags = 0;
wminfo.partime = 180;
for (i=0 ; i<MAXPLAYERS ; i++)
{
players[i].killcount = players[i].secretcount
= players[i].itemcount = 0;
}
// Initial height of PointOfView
// will be set by player think.
players[consoleplayer].viewz = 1;
// Make sure all sounds are stopped before Z_FreeTags.
S_Start ();
#if 0 // UNUSED
if (debugfile)
{
Z_FreeTags (PU_LEVEL, MAXINT);
Z_FileDumpHeap (debugfile);
}
else
#endif
Z_FreeTags (PU_LEVEL, PU_PURGELEVEL-1);
// UNUSED W_Profile ();
P_InitThinkers ();
// if working with a devlopment map, reload it
W_Reload ();
// find map name
if ( gamemode == commercial)
{
if (map<10)
sprintf (lumpname,"map0%i", map);
else
sprintf (lumpname,"map%i", map);
}
else
{
lumpname[0] = 'E';
lumpname[1] = '0' + episode;
lumpname[2] = 'M';
lumpname[3] = '0' + map;
lumpname[4] = 0;
}
lumpnum = W_GetNumForName (lumpname);
leveltime = 0;
// note: most of this ordering is important
P_LoadBlockMap (lumpnum+ML_BLOCKMAP);
P_LoadVertexes (lumpnum+ML_VERTEXES);
P_LoadSectors (lumpnum+ML_SECTORS);
P_LoadSideDefs (lumpnum+ML_SIDEDEFS);
P_LoadLineDefs (lumpnum+ML_LINEDEFS);
P_LoadSubsectors (lumpnum+ML_SSECTORS);
P_LoadNodes (lumpnum+ML_NODES);
P_LoadSegs (lumpnum+ML_SEGS);
rejectmatrix = W_CacheLumpNum (lumpnum+ML_REJECT,PU_LEVEL);
P_GroupLines ();
bodyqueslot = 0;
deathmatch_p = deathmatchstarts;
P_LoadThings (lumpnum+ML_THINGS);
// if deathmatch, randomly spawn the active players
if (deathmatch)
{
for (i=0 ; i<MAXPLAYERS ; i++)
if (playeringame[i])
{
players[i].mo = NULL;
G_DeathMatchSpawnPlayer (i);
}
}
// clear special respawning que
iquehead = iquetail = 0;
// set up world state
P_SpawnSpecials ();
// build subsector connect matrix
// UNUSED P_ConnectSubsectors ();
// preload graphics
if (precache)
R_PrecacheLevel ();
//printf ("free memory: 0x%x\n", Z_FreeMemory());
}
//
// P_Init
//
void P_Init (void)
{
P_InitSwitchList ();
P_InitPicAnims ();
R_InitSprites (sprnames);
}
--- NEW FILE: d_englsh.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_englsh.h,v 1.1 2006-10-03 11:26:14 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Printed strings for translation.
// English language support (default).
//
//-----------------------------------------------------------------------------
#ifndef __D_ENGLSH__
#define __D_ENGLSH__
//
// Printed strings for translation
//
//
// 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 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"
//
// 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 "Green: "
#define HUSTR_PLRINDIGO "Indigo: "
#define HUSTR_PLRBROWN "Brown: "
#define HUSTR_PLRRED "Red: "
#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"
//
// 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..."
//
// 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"
// 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."
#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
//-----------------------------------------------------------------------------
//
// $Log: d_englsh.h,v $
// Revision 1.1 2006-10-03 11:26:14 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:26 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_defs.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_defs.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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") did.
//
typedef struct
{
fixed_t x;
fixed_t y;
} vertex_t;
// Forward of LineDefs, for Sectors.
struct line_s;
// Each sector has a degenmobj_t in its center
// for sound origin purposes.
// I suppose this does not handle sound from
// moving objects (doppler), because
// position is prolly just buffered, not
// updated.
typedef struct
{
thinker_t thinker; // not used for anything
fixed_t x;
fixed_t y;
fixed_t z;
} degenmobj_t;
//
// The SECTORS record, at runtime.
// Stores things/mobjs.
//
typedef struct
{
fixed_t floorheight;
fixed_t ceilingheight;
short floorpic;
short ceilingpic;
short lightlevel;
short special;
short tag;
// 0 = untraversed, 1,2 = sndlines -1
int soundtraversed;
// thing that made a sound (or null)
mobj_t* soundtarget;
// mapblock bounding box for height changes
int blockbox[4];
// origin for any sounds played by the sector
degenmobj_t soundorg;
// if == validcount, already checked
int validcount;
// list of mobjs in sector
mobj_t* thinglist;
// thinker_t for reversable actions
void* specialdata;
int linecount;
struct line_s** lines; // [linecount] size
} sector_t;
//
// The SideDef.
//
typedef struct
{
// add this to the calculated texture column
fixed_t textureoffset;
// add this to the calculated texture top
fixed_t rowoffset;
// Texture indices.
// We do not maintain names here.
short toptexture;
short bottomtexture;
short midtexture;
// Sector the SideDef is facing.
sector_t* sector;
} side_t;
//
// Move clipping aid for LineDefs.
//
typedef enum
{
ST_HORIZONTAL,
ST_VERTICAL,
ST_POSITIVE,
ST_NEGATIVE
} slopetype_t;
typedef struct line_s
{
// Vertices, from v1 to v2.
vertex_t* v1;
vertex_t* v2;
// Precalculated v2 - v1 for side checking.
fixed_t dx;
fixed_t dy;
// Animation related.
short flags;
short special;
short tag;
// Visual appearance: SideDefs.
// sidenum[1] will be -1 if one sided
short sidenum[2];
// Neat. Another bounding box, for the extent
// of the LineDef.
fixed_t bbox[4];
// To aid move clipping.
slopetype_t slopetype;
// Front and back sector.
// Note: redundant? Can be retrieved from SideDefs.
sector_t* frontsector;
sector_t* backsector;
// if == validcount, already checked
int validcount;
// thinker_t for reversable actions
void* specialdata;
} line_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;
short numlines;
short firstline;
} subsector_t;
//
// The LineSeg.
//
typedef struct
{
vertex_t* v1;
vertex_t* v2;
fixed_t offset;
angle_t angle;
side_t* sidedef;
line_t* linedef;
// Sector references.
// Could be retrieved from linedef, too.
// backsector is NULL for one sided lines
sector_t* frontsector;
sector_t* backsector;
} seg_t;
//
// BSP node.
//
typedef struct
{
// Partition line.
fixed_t x;
fixed_t y;
fixed_t dx;
fixed_t dy;
// Bounding box for each child.
fixed_t bbox[2][4];
// If NF_SUBSECTOR its a subsector.
unsigned short children[2];
} node_t;
// posts are runs of non masked source pixels
typedef struct
{
byte topdelta; // -1 is the last post in a column
byte length; // length data bytes follows
} post_t;
// column_t is a list of 0 or more post_t, (byte)-1 terminated
typedef post_t column_t;
// PC direct to screen pointers
//B UNUSED - keep till detailshift in r_draw.c resolved
//extern byte* destview;
//extern byte* destscreen;
//
// 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 even us emore than 32 levels.
typedef byte lighttable_t;
//
// ?
//
typedef struct drawseg_s
{
seg_t* curline;
int x1;
int x2;
fixed_t scale1;
fixed_t scale2;
fixed_t scalestep;
// 0=none, 1=bottom, 2=top, 3=both
int silhouette;
// do not clip sprites above this
fixed_t bsilheight;
// do not clip sprites below this
fixed_t tsilheight;
// Pointers to lists for sprite clipping,
// all three adjusted so [x1] is first value.
short* sprtopclip;
short* sprbottomclip;
short* maskedtexturecol;
} drawseg_t;
// Patches.
// A patch holds one or more columns.
// Patches are used for sprites and all masked pictures,
// and we compose textures from the TEXTURE1/2 lists
// of patches.
typedef struct
{
short width; // bounding box size
short height;
short leftoffset; // pixels to the left of origin
short topoffset; // pixels below the origin
int columnofs[8]; // only [width] used
// the [0] is &columnofs[width]
} patch_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
{
// Doubly linked list.
struct vissprite_s* prev;
struct vissprite_s* next;
int x1;
int x2;
// for line side calculation
fixed_t gx;
fixed_t gy;
// global bottom / top for silhouette clipping
fixed_t gz;
fixed_t gzt;
// horizontal position of x1
fixed_t startfrac;
fixed_t scale;
// negative if flipped
fixed_t xiscale;
fixed_t texturemid;
int patch;
// for color translation and shadow draw,
// maxbright frames as well
lighttable_t* colormap;
int mobjflags;
} 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?
//
typedef struct
{
fixed_t height;
int picnum;
int lightlevel;
int minx;
int maxx;
// leave pads for [minx-1]/[maxx+1]
byte pad1;
// Here lies the rub for all
// dynamic resize/change of resolution.
byte top[SCREENWIDTH];
byte pad2;
byte pad3;
// See above.
byte bottom[SCREENWIDTH];
byte pad4;
} visplane_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_defs.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: README.book ---
The DOOM Book
Shortly after the Wolfenstein 3D source release,
I sent a mail to Jay Wilbur suggesting a book
about the DOOM engine. I anticipated a similar
release of the DOOM sources within a year or
two, and the obvious problems with the Wolfenstein
sources (lack of accompanying artwork, a code
base not maintained for quite some time) seemed
to demand a better approach. I talked to some
publishing company reps at the Book Fair in 1995,
and while they were cautiously interested, id was
not.
In the last weeks of 1996, following a visit at
id Software two months earlier, and after the
departure of Jay Wilbur, John Carmack asked me
whether I was still interested in doing the book.
I was, Bear sent me a code dump, and Todd
Hollenshead set out to address the legal concerns
(of which were many).
Unfortunately, what might have worked in 1995
turned out to be a doomed attempt in 1997. I won't
go into the details - let's just say that my
leaving university and going back to full time
writing for a living repeatedly forced me to
change priorities on what looked more and more
like a project unlikely to generate any revenue.
By mid of the year, when the legal issues had
finally been settled, it didn't look like I was
going to find a publisher at all. Following the
Book Fair in 1997 and some more discussions
(with about a dozen publishers, total), I gritted
my teeth and decided to abandon the project.
Note that the book project as such wasn't supposed
to hold up the source release to the public.
However, given the legal concerns relating to
the third party sound code in DOS DOOM, and the
lack of Win32 support as well as the advantages of
an OpenGL based release, the idea was to put
together a consistent, stable code base prior to
public release - most of which was supposed to be
an offspring of my reformatting and modifying the
code for the book.
None of this worked out as intended. However, I
hope that, at long last, this distribution
will finally provide a good point to start for
any cooperative effort to extend the already
impressive lifespan of DOOM into the age of
multiplayer servers and hardware-accelerated
clients.
--- NEW FILE: Makefile.in ---
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
LIBS = @LIBS@
MAKEINFO = @MAKEINFO@
NANOX_CFLAGS = @NANOX_CFLAGS@
NANOX_LIBS = @NANOX_LIBS@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
EXTRA_DIST = Changelog DOOMLIC.TXT FILES FILES2 README.SDL README.asm README.b README.book README.gl TODO
bin_PROGRAMS = doom
doom_SOURCES = am_map.c am_map.h d_englsh.h d_event.h d_french.h d_items.c d_items.h d_main.c d_main.h d_net.c d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h doomdata.h doomdef.c doomdef.h doomstat.c doomstat.h doomtype.h dstrings.c dstrings.h f_finale.c f_finale.h f_wipe.c f_wipe.h g_game.c g_game.h hu_lib.c hu_lib.h hu_stuff.c hu_stuff.h i_main.c i_net.c i_net.h i_sound.c i_sound.h i_system.c i_system.h i_video.c i_video.h info.c info.h m_argv.c m_argv.h m_bbox.c m_bbox.h m_cheat.c m_cheat.h m_fixed.c m_fixed.h m_menu.c m_menu.h m_misc.c m_misc.h m_random.c m_random.h m_swap.c m_swap.h p_ceilng.c p_doors.c p_enemy.c p_floor.c p_inter.c p_inter.h p_lights.c p_local.h p_map.c p_maputl.c p_mobj.c p_mobj.h p_plats.c p_pspr.c p_pspr.h p_saveg.c p_saveg.h p_setup.c p_setup.h p_sight.c p_spec.c p_spec.h p_!
switch.c p_telept.c p_tick.c p_tick.h p_user.c r_bsp.c r_bsp.h r_data.c r_data.h r_defs.h r_draw.c r_draw.h r_local.h r_main.c r_main.h r_plane.c r_plane.h r_segs.c r_segs.h r_sky.c r_sky.h r_state.h r_things.c r_things.h s_sound.c s_sound.h sounds.c sounds.h st_lib.c st_lib.h st_stuff.c st_stuff.h tables.c tables.h v_video.c v_video.h w_wad.c w_wad.h wi_stuff.c wi_stuff.h z_zone.c z_zone.h
doom_LDADD = -lm
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
doom_OBJECTS = am_map.o d_items.o d_main.o d_net.o doomdef.o doomstat.o \
dstrings.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o i_main.o \
i_net.o i_sound.o i_system.o i_video.o info.o m_argv.o m_bbox.o \
m_cheat.o m_fixed.o m_menu.o m_misc.o m_random.o m_swap.o p_ceilng.o \
p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o \
p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o \
p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o \
r_main.o r_plane.o r_segs.o r_sky.o r_things.o s_sound.o sounds.o \
st_lib.o st_stuff.o tables.o v_video.o w_wad.o wi_stuff.o z_zone.o
doom_DEPENDENCIES =
doom_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS TODO aclocal.m4 configure configure.in install-sh \
missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/am_map.P .deps/d_items.P .deps/d_main.P .deps/d_net.P \
.deps/doomdef.P .deps/doomstat.P .deps/dstrings.P .deps/f_finale.P \
.deps/f_wipe.P .deps/g_game.P .deps/hu_lib.P .deps/hu_stuff.P \
.deps/i_main.P .deps/i_net.P .deps/i_sound.P .deps/i_system.P \
.deps/i_video.P .deps/info.P .deps/m_argv.P .deps/m_bbox.P \
.deps/m_cheat.P .deps/m_fixed.P .deps/m_menu.P .deps/m_misc.P \
.deps/m_random.P .deps/m_swap.P .deps/p_ceilng.P .deps/p_doors.P \
.deps/p_enemy.P .deps/p_floor.P .deps/p_inter.P .deps/p_lights.P \
.deps/p_map.P .deps/p_maputl.P .deps/p_mobj.P .deps/p_plats.P \
.deps/p_pspr.P .deps/p_saveg.P .deps/p_setup.P .deps/p_sight.P \
.deps/p_spec.P .deps/p_switch.P .deps/p_telept.P .deps/p_tick.P \
.deps/p_user.P .deps/r_bsp.P .deps/r_data.P .deps/r_draw.P \
.deps/r_main.P .deps/r_plane.P .deps/r_segs.P .deps/r_sky.P \
.deps/r_things.P .deps/s_sound.P .deps/sounds.P .deps/st_lib.P \
.deps/st_stuff.P .deps/tables.P .deps/v_video.P .deps/w_wad.P \
.deps/wi_stuff.P .deps/z_zone.P
SOURCES = $(doom_SOURCES)
OBJECTS = $(doom_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
doom: $(doom_OBJECTS) $(doom_DEPENDENCIES)
@rm -f doom
$(LINK) $(doom_LDFLAGS) $(doom_OBJECTS) $(doom_LDADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
--- NEW FILE: r_things.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_things.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Rendering of moving objects, sprites.
//
//-----------------------------------------------------------------------------
#ifndef __R_THINGS__
#define __R_THINGS__
#ifdef __GNUG__
#pragma interface
#endif
#define MAXVISSPRITES 128
extern vissprite_t vissprites[MAXVISSPRITES];
extern vissprite_t* vissprite_p;
extern vissprite_t vsprsortedhead;
// Constant arrays used for psprite clipping
// and initializing clipping.
extern short negonearray[SCREENWIDTH];
extern short screenheightarray[SCREENWIDTH];
// vars for R_DrawMaskedColumn
extern short* mfloorclip;
extern short* mceilingclip;
extern fixed_t spryscale;
extern fixed_t sprtopscreen;
extern fixed_t pspritescale;
extern fixed_t pspriteiscale;
void R_DrawMaskedColumn (column_t* column);
void R_SortVisSprites (void);
void R_AddSprites (sector_t* sec);
void R_AddPSprites (void);
void R_DrawSprites (void);
void R_InitSprites (char** namelist);
void R_ClearSprites (void);
void R_DrawMasked (void);
void
R_ClipVisSprite
( vissprite_t* vis,
int xl,
int xh );
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_things.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_bbox.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_bbox.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_bbox.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Main loop menu stuff.
// Random number LUT.
// Default Config File.
// PCX Screenshots.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#ifdef __GNUG__
#pragma implementation "m_bbox.h"
#endif
#include "m_bbox.h"
void M_ClearBox (fixed_t *box)
{
box[BOXTOP] = box[BOXRIGHT] = MININT;
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
}
void
M_AddToBox
( fixed_t* box,
fixed_t x,
fixed_t y )
{
if (x<box[BOXLEFT])
box[BOXLEFT] = x;
else if (x>box[BOXRIGHT])
box[BOXRIGHT] = x;
if (y<box[BOXBOTTOM])
box[BOXBOTTOM] = y;
else if (y>box[BOXTOP])
box[BOXTOP] = y;
}
--- NEW FILE: hu_stuff.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: hu_stuff.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: hu_stuff.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION: Heads-up displays
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: hu_stuff.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include <ctype.h>
#include "doomdef.h"
#include "z_zone.h"
#include "m_swap.h"
#include "hu_stuff.h"
#include "hu_lib.h"
#include "w_wad.h"
#include "s_sound.h"
#include "doomstat.h"
// Data.
#include "dstrings.h"
#include "sounds.h"
//
// Locally used constants, shortcuts.
//
#define HU_TITLE (mapnames[(gameepisode-1)*9+gamemap-1])
#define HU_TITLE2 (mapnames2[gamemap-1])
#define HU_TITLEP (mapnamesp[gamemap-1])
#define HU_TITLET (mapnamest[gamemap-1])
#define HU_TITLEHEIGHT 1
#define HU_TITLEX 0
#define HU_TITLEY (167 - SHORT(hu_font[0]->height))
#define HU_INPUTTOGGLE 't'
#define HU_INPUTX HU_MSGX
#define HU_INPUTY (HU_MSGY + HU_MSGHEIGHT*(SHORT(hu_font[0]->height) +1))
#define HU_INPUTWIDTH 64
#define HU_INPUTHEIGHT 1
char* chat_macros[] =
{
HUSTR_CHATMACRO0,
HUSTR_CHATMACRO1,
HUSTR_CHATMACRO2,
HUSTR_CHATMACRO3,
HUSTR_CHATMACRO4,
HUSTR_CHATMACRO5,
HUSTR_CHATMACRO6,
HUSTR_CHATMACRO7,
HUSTR_CHATMACRO8,
HUSTR_CHATMACRO9
};
char* player_names[] =
{
HUSTR_PLRGREEN,
HUSTR_PLRINDIGO,
HUSTR_PLRBROWN,
HUSTR_PLRRED
};
char chat_char; // remove later.
static player_t* plr;
patch_t* hu_font[HU_FONTSIZE];
static hu_textline_t w_title;
boolean chat_on;
static hu_itext_t w_chat;
static boolean always_off = false;
static char chat_dest[MAXPLAYERS];
static hu_itext_t w_inputbuffer[MAXPLAYERS];
static boolean message_on;
boolean message_dontfuckwithme;
static boolean message_nottobefuckedwith;
static hu_stext_t w_message;
static int message_counter;
extern int showMessages;
extern boolean automapactive;
static boolean headsupactive = false;
//
// Builtin map names.
// The actual names can be found in DStrings.h.
//
char* mapnames[] = // DOOM shareware/registered/retail (Ultimate) names.
{
HUSTR_E1M1,
HUSTR_E1M2,
HUSTR_E1M3,
HUSTR_E1M4,
HUSTR_E1M5,
HUSTR_E1M6,
HUSTR_E1M7,
HUSTR_E1M8,
HUSTR_E1M9,
HUSTR_E2M1,
HUSTR_E2M2,
HUSTR_E2M3,
HUSTR_E2M4,
HUSTR_E2M5,
HUSTR_E2M6,
HUSTR_E2M7,
HUSTR_E2M8,
HUSTR_E2M9,
HUSTR_E3M1,
HUSTR_E3M2,
HUSTR_E3M3,
HUSTR_E3M4,
HUSTR_E3M5,
HUSTR_E3M6,
HUSTR_E3M7,
HUSTR_E3M8,
HUSTR_E3M9,
HUSTR_E4M1,
HUSTR_E4M2,
HUSTR_E4M3,
HUSTR_E4M4,
HUSTR_E4M5,
HUSTR_E4M6,
HUSTR_E4M7,
HUSTR_E4M8,
HUSTR_E4M9,
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL",
"NEWLEVEL"
};
char* mapnames2[] = // DOOM 2 map names.
{
HUSTR_1,
HUSTR_2,
HUSTR_3,
HUSTR_4,
HUSTR_5,
HUSTR_6,
HUSTR_7,
HUSTR_8,
HUSTR_9,
HUSTR_10,
HUSTR_11,
HUSTR_12,
HUSTR_13,
HUSTR_14,
HUSTR_15,
HUSTR_16,
HUSTR_17,
HUSTR_18,
HUSTR_19,
HUSTR_20,
HUSTR_21,
HUSTR_22,
HUSTR_23,
HUSTR_24,
HUSTR_25,
HUSTR_26,
HUSTR_27,
HUSTR_28,
HUSTR_29,
HUSTR_30,
HUSTR_31,
HUSTR_32
};
char* mapnamesp[] = // Plutonia WAD map names.
{
PHUSTR_1,
PHUSTR_2,
PHUSTR_3,
PHUSTR_4,
PHUSTR_5,
PHUSTR_6,
PHUSTR_7,
PHUSTR_8,
PHUSTR_9,
PHUSTR_10,
PHUSTR_11,
PHUSTR_12,
PHUSTR_13,
PHUSTR_14,
PHUSTR_15,
PHUSTR_16,
PHUSTR_17,
PHUSTR_18,
PHUSTR_19,
PHUSTR_20,
PHUSTR_21,
PHUSTR_22,
PHUSTR_23,
PHUSTR_24,
PHUSTR_25,
PHUSTR_26,
PHUSTR_27,
PHUSTR_28,
PHUSTR_29,
PHUSTR_30,
PHUSTR_31,
PHUSTR_32
};
char *mapnamest[] = // TNT WAD map names.
{
THUSTR_1,
THUSTR_2,
THUSTR_3,
THUSTR_4,
THUSTR_5,
THUSTR_6,
THUSTR_7,
THUSTR_8,
THUSTR_9,
THUSTR_10,
THUSTR_11,
THUSTR_12,
THUSTR_13,
THUSTR_14,
THUSTR_15,
THUSTR_16,
THUSTR_17,
THUSTR_18,
THUSTR_19,
THUSTR_20,
THUSTR_21,
THUSTR_22,
THUSTR_23,
THUSTR_24,
THUSTR_25,
THUSTR_26,
THUSTR_27,
THUSTR_28,
THUSTR_29,
THUSTR_30,
THUSTR_31,
THUSTR_32
};
const char* shiftxform;
const char french_shiftxform[] =
{
0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31,
' ', '!', '"', '#', '$', '%', '&',
'"', // shift-'
'(', ')', '*', '+',
'?', // shift-,
'_', // shift--
'>', // shift-.
'?', // shift-/
'0', // shift-0
'1', // shift-1
'2', // shift-2
'3', // shift-3
'4', // shift-4
'5', // shift-5
'6', // shift-6
'7', // shift-7
'8', // shift-8
'9', // shift-9
'/',
'.', // shift-;
'<',
'+', // shift-=
'>', '?', '@',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'[', // shift-[
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
']', // shift-]
'"', '_',
'\'', // shift-`
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'{', '|', '}', '~', 127
};
const char english_shiftxform[] =
{
0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31,
' ', '!', '"', '#', '$', '%', '&',
'"', // shift-'
'(', ')', '*', '+',
'<', // shift-,
'_', // shift--
'>', // shift-.
'?', // shift-/
')', // shift-0
'!', // shift-1
'@', // shift-2
'#', // shift-3
'$', // shift-4
'%', // shift-5
'^', // shift-6
'&', // shift-7
'*', // shift-8
'(', // shift-9
':',
':', // shift-;
'<',
'+', // shift-=
'>', '?', '@',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'[', // shift-[
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
']', // shift-]
'"', '_',
'\'', // shift-`
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'{', '|', '}', '~', 127
};
char frenchKeyMap[128]=
{
0,
1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31,
' ','!','"','#','$','%','&','%','(',')','*','+',';','-',':','!',
'0','1','2','3','4','5','6','7','8','9',':','M','<','=','>','?',
'@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^','_',
'@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127
};
char ForeignTranslation(unsigned char ch)
{
return ch < 128 ? frenchKeyMap[ch] : ch;
}
void HU_Init(void)
{
int i;
int j;
char buffer[9];
if (french)
shiftxform = french_shiftxform;
else
shiftxform = english_shiftxform;
// load the heads-up font
j = HU_FONTSTART;
for (i=0;i<HU_FONTSIZE;i++)
{
sprintf(buffer, "STCFN%.3d", j++);
hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC);
}
}
void HU_Stop(void)
{
headsupactive = false;
}
void HU_Start(void)
{
int i;
char* s;
if (headsupactive)
HU_Stop();
plr = &players[consoleplayer];
message_on = false;
message_dontfuckwithme = false;
message_nottobefuckedwith = false;
chat_on = false;
// create the message widget
HUlib_initSText(&w_message,
HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
hu_font,
HU_FONTSTART, &message_on);
// create the map title widget
HUlib_initTextLine(&w_title,
HU_TITLEX, HU_TITLEY,
hu_font,
HU_FONTSTART);
switch ( gamemode )
{
case shareware:
case registered:
case retail:
s = HU_TITLE;
break;
/* FIXME
case pack_plut:
s = HU_TITLEP;
break;
case pack_tnt:
s = HU_TITLET;
break;
*/
case commercial:
default:
s = HU_TITLE2;
break;
}
while (*s)
HUlib_addCharToTextLine(&w_title, *(s++));
// create the chat widget
HUlib_initIText(&w_chat,
HU_INPUTX, HU_INPUTY,
hu_font,
HU_FONTSTART, &chat_on);
// create the inputbuffer widgets
for (i=0 ; i<MAXPLAYERS ; i++)
HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off);
headsupactive = true;
}
void HU_Drawer(void)
{
HUlib_drawSText(&w_message);
HUlib_drawIText(&w_chat);
if (automapactive)
HUlib_drawTextLine(&w_title, false);
}
void HU_Erase(void)
{
HUlib_eraseSText(&w_message);
HUlib_eraseIText(&w_chat);
HUlib_eraseTextLine(&w_title);
}
void HU_Ticker(void)
{
int i, rc;
char c;
// tick down message counter if message is up
if (message_counter && !--message_counter)
{
message_on = false;
message_nottobefuckedwith = false;
}
if (showMessages || message_dontfuckwithme)
{
// display message if necessary
if ((plr->message && !message_nottobefuckedwith)
|| (plr->message && message_dontfuckwithme))
{
HUlib_addMessageToSText(&w_message, 0, plr->message);
plr->message = 0;
message_on = true;
message_counter = HU_MSGTIMEOUT;
message_nottobefuckedwith = message_dontfuckwithme;
message_dontfuckwithme = 0;
}
} // else message_on = false;
// check for incoming chat characters
if (netgame)
{
for (i=0 ; i<MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
if (i != consoleplayer
&& (c = players[i].cmd.chatchar))
{
if (c <= HU_BROADCAST)
chat_dest[i] = c;
else
{
if (c >= 'a' && c <= 'z')
c = (char) shiftxform[(unsigned char) c];
rc = HUlib_keyInIText(&w_inputbuffer[i], c);
if (rc && c == KEY_ENTER)
{
if (w_inputbuffer[i].l.len
&& (chat_dest[i] == consoleplayer+1
|| chat_dest[i] == HU_BROADCAST))
{
HUlib_addMessageToSText(&w_message,
player_names[i],
w_inputbuffer[i].l.l);
message_nottobefuckedwith = true;
message_on = true;
message_counter = HU_MSGTIMEOUT;
if ( gamemode == commercial )
S_StartSound(0, sfx_radio);
else
S_StartSound(0, sfx_tink);
}
HUlib_resetIText(&w_inputbuffer[i]);
}
}
players[i].cmd.chatchar = 0;
}
}
}
}
#define QUEUESIZE 128
static char chatchars[QUEUESIZE];
static int head = 0;
static int tail = 0;
void HU_queueChatChar(char c)
{
if (((head + 1) & (QUEUESIZE-1)) == tail)
{
plr->message = HUSTR_MSGU;
}
else
{
chatchars[head] = c;
head = (head + 1) & (QUEUESIZE-1);
}
}
char HU_dequeueChatChar(void)
{
char c;
if (head != tail)
{
c = chatchars[tail];
tail = (tail + 1) & (QUEUESIZE-1);
}
else
{
c = 0;
}
return c;
}
boolean HU_Responder(event_t *ev)
{
static char lastmessage[HU_MAXLINELENGTH+1];
char* macromessage;
boolean eatkey = false;
static boolean shiftdown = false;
static boolean altdown = false;
unsigned char c;
int i;
int numplayers;
static char destination_keys[MAXPLAYERS] =
{
HUSTR_KEYGREEN,
HUSTR_KEYINDIGO,
HUSTR_KEYBROWN,
HUSTR_KEYRED
};
static int num_nobrainers = 0;
numplayers = 0;
for (i=0 ; i<MAXPLAYERS ; i++)
numplayers += playeringame[i];
if (ev->data1 == KEY_RSHIFT)
{
shiftdown = ev->type == ev_keydown;
return false;
}
else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT)
{
altdown = ev->type == ev_keydown;
return false;
}
if (ev->type != ev_keydown)
return false;
if (!chat_on)
{
if (ev->data1 == HU_MSGREFRESH)
{
message_on = true;
message_counter = HU_MSGTIMEOUT;
eatkey = true;
}
else if (netgame && ev->data1 == HU_INPUTTOGGLE)
{
eatkey = chat_on = true;
HUlib_resetIText(&w_chat);
HU_queueChatChar(HU_BROADCAST);
}
else if (netgame && numplayers > 2)
{
for (i=0; i<MAXPLAYERS ; i++)
{
if (ev->data1 == destination_keys[i])
{
if (playeringame[i] && i!=consoleplayer)
{
eatkey = chat_on = true;
HUlib_resetIText(&w_chat);
HU_queueChatChar(i+1);
break;
}
else if (i == consoleplayer)
{
num_nobrainers++;
if (num_nobrainers < 3)
plr->message = HUSTR_TALKTOSELF1;
else if (num_nobrainers < 6)
plr->message = HUSTR_TALKTOSELF2;
else if (num_nobrainers < 9)
plr->message = HUSTR_TALKTOSELF3;
else if (num_nobrainers < 32)
plr->message = HUSTR_TALKTOSELF4;
else
plr->message = HUSTR_TALKTOSELF5;
}
}
}
}
}
else
{
c = ev->data1;
// send a macro
if (altdown)
{
c = c - '0';
if (c > 9)
return false;
// fprintf(stderr, "got here\n");
macromessage = chat_macros[c];
// kill last message with a '\n'
HU_queueChatChar(KEY_ENTER); // DEBUG!!!
// send the macro message
while (*macromessage)
HU_queueChatChar(*macromessage++);
HU_queueChatChar(KEY_ENTER);
// leave chat mode and notify that it was sent
chat_on = false;
strcpy(lastmessage, chat_macros[c]);
plr->message = lastmessage;
eatkey = true;
}
else
{
if (french)
c = ForeignTranslation(c);
if (shiftdown || (c >= 'a' && c <= 'z'))
c = shiftxform[c];
eatkey = HUlib_keyInIText(&w_chat, c);
if (eatkey)
{
// static unsigned char buf[20]; // DEBUG
HU_queueChatChar(c);
// sprintf(buf, "KEY: %d => %d", ev->data1, c);
// plr->message = buf;
}
if (c == KEY_ENTER)
{
chat_on = false;
if (w_chat.l.len)
{
strcpy(lastmessage, w_chat.l.l);
plr->message = lastmessage;
}
}
else if (c == KEY_ESCAPE)
chat_on = false;
}
}
return eatkey;
}
--- NEW FILE: f_wipe.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: f_wipe.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Mission start screen wipe/melt, special effects.
//
//-----------------------------------------------------------------------------
#ifndef __F_WIPE_H__
#define __F_WIPE_H__
//
// SCREEN WIPE PACKAGE
//
enum
{
// simple gradual pixel change for 8-bit only
wipe_ColorXForm,
// weird screen melt
wipe_Melt,
wipe_NUMWIPES
};
int
wipe_StartScreen
( int x,
int y,
int width,
int height );
int
wipe_EndScreen
( int x,
int y,
int width,
int height );
int
wipe_ScreenWipe
( int wipeno,
int x,
int y,
int width,
int height,
int ticks );
#endif
//-----------------------------------------------------------------------------
//
// $Log: f_wipe.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: README ---
For Nano-X information, see README.NANOX
To hear about the evolution of Doom, see README.book
For information on the ports of Doom that make this possible see README.SDL or README.b
--- NEW FILE: r_things.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_things.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_things.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...962 lines suppressed...]
spr=spr->next)
{
R_DrawSprite (spr);
}
}
// render any remaining masked mid textures
for (ds=ds_p-1 ; ds >= drawsegs ; ds--)
if (ds->maskedtexturecol)
R_RenderMaskedSegRange (ds, ds->x1, ds->x2);
// draw the psprites on top of everything
// but does not draw on side views
if (!viewangleoffset)
R_DrawPlayerSprites ();
}
--- NEW FILE: f_wipe.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: f_wipe.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: f_wipe.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Mission begin melt/wipe screen special effect.
//
//-----------------------------------------------------------------------------
static const char rcsid[] = "$Id: f_wipe.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "i_video.h"
#include "v_video.h"
#include "m_random.h"
#include "doomdef.h"
#include "f_wipe.h"
//
// SCREEN WIPE PACKAGE
//
// when zero, stop the wipe
static boolean go = 0;
static byte* wipe_scr_start;
static byte* wipe_scr_end;
static byte* wipe_scr;
void
wipe_shittyColMajorXform
( short* array,
int width,
int height )
{
int x;
int y;
short* dest;
dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0);
for(y=0;y<height;y++)
for(x=0;x<width;x++)
dest[x*height+y] = array[y*width+x];
memcpy(array, dest, width*height*2);
Z_Free(dest);
}
int
wipe_initColorXForm
( int width,
int height,
int ticks )
{
memcpy(wipe_scr, wipe_scr_start, width*height);
return 0;
}
int
wipe_doColorXForm
( int width,
int height,
int ticks )
{
boolean changed;
byte* w;
byte* e;
int newval;
changed = false;
w = wipe_scr;
e = wipe_scr_end;
while (w!=wipe_scr+width*height)
{
if (*w != *e)
{
if (*w > *e)
{
newval = *w - ticks;
if (newval < *e)
*w = *e;
else
*w = newval;
changed = true;
}
else if (*w < *e)
{
newval = *w + ticks;
if (newval > *e)
*w = *e;
else
*w = newval;
changed = true;
}
}
w++;
e++;
}
return !changed;
}
int
wipe_exitColorXForm
( int width,
int height,
int ticks )
{
return 0;
}
static int* y;
int
wipe_initMelt
( int width,
int height,
int ticks )
{
int i, r;
// copy start screen to main screen
memcpy(wipe_scr, wipe_scr_start, width*height);
// makes this wipe faster (in theory)
// to have stuff in column-major format
wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height);
wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height);
// setup initial column positions
// (y<0 => not ready to scroll yet)
y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0);
y[0] = -(M_Random()%16);
for (i=1;i<width;i++)
{
r = (M_Random()%3) - 1;
y[i] = y[i-1] + r;
if (y[i] > 0) y[i] = 0;
else if (y[i] == -16) y[i] = -15;
}
return 0;
}
int
wipe_doMelt
( int width,
int height,
int ticks )
{
int i;
int j;
int dy;
int idx;
short* s;
short* d;
boolean done = true;
width/=2;
while (ticks--)
{
for (i=0;i<width;i++)
{
if (y[i]<0)
{
y[i]++; done = false;
}
else if (y[i] < height)
{
dy = (y[i] < 16) ? y[i]+1 : 8;
if (y[i]+dy >= height) dy = height - y[i];
s = &((short *)wipe_scr_end)[i*height+y[i]];
d = &((short *)wipe_scr)[y[i]*width+i];
idx = 0;
for (j=dy;j;j--)
{
d[idx] = *(s++);
idx += width;
}
y[i] += dy;
s = &((short *)wipe_scr_start)[i*height];
d = &((short *)wipe_scr)[y[i]*width+i];
idx = 0;
for (j=height-y[i];j;j--)
{
d[idx] = *(s++);
idx += width;
}
done = false;
}
}
}
return done;
}
int
wipe_exitMelt
( int width,
int height,
int ticks )
{
Z_Free(y);
return 0;
}
int
wipe_StartScreen
( int x,
int y,
int width,
int height )
{
wipe_scr_start = screens[2];
I_ReadScreen(wipe_scr_start);
return 0;
}
int
wipe_EndScreen
( int x,
int y,
int width,
int height )
{
wipe_scr_end = screens[3];
I_ReadScreen(wipe_scr_end);
V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr.
return 0;
}
int
wipe_ScreenWipe
( int wipeno,
int x,
int y,
int width,
int height,
int ticks )
{
int rc;
static int (*wipes[])(int, int, int) =
{
wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm,
wipe_initMelt, wipe_doMelt, wipe_exitMelt
};
void V_MarkRect(int, int, int, int);
// initial stuff
if (!go)
{
go = 1;
// wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
wipe_scr = screens[0];
(*wipes[wipeno*3])(width, height, ticks);
}
// do a piece of wipe-in
V_MarkRect(0, 0, width, height);
rc = (*wipes[wipeno*3+1])(width, height, ticks);
// V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG
// final stuff
if (rc)
{
go = 0;
(*wipes[wipeno*3+2])(width, height, ticks);
}
return !go;
}
--- NEW FILE: hu_stuff.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: hu_stuff.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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 '_' // the last font characters
// Calculate # of glyphs in font.
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
#define HU_BROADCAST 5
#define HU_MSGREFRESH KEY_ENTER
#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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: hu_stuff.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_fixed.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_fixed.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Fixed point arithemtics, implementation.
//
//-----------------------------------------------------------------------------
#ifndef __M_FIXED__
#define __M_FIXED__
#ifdef __GNUG__
#pragma interface
#endif
//
// Fixed point, 32bit as 16.16.
//
#define FRACBITS 16
#define FRACUNIT (1<<FRACBITS)
typedef int fixed_t;
fixed_t FixedMul (fixed_t a, fixed_t b);
fixed_t FixedDiv (fixed_t a, fixed_t b);
fixed_t FixedDiv2 (fixed_t a, fixed_t b);
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_fixed.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: doomdef.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: doomdef.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: doomdef.c,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// DoomDef - basic defines for DOOM, e.g. Version, game mode
// and skill level, and display parameters.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: doomdef.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $";
#ifdef __GNUG__
#pragma implementation "doomdef.h"
#endif
#include "doomdef.h"
// Location for any defines turned variables.
// None.
--- NEW FILE: README.NANOX ---
Doom! for Microwindows version 1.0
Welcome, and thank you for downloading Doom! for Microwindows. We have
designed this code so it can be built on any system that can run
Microwindows and Nano-X.
Currently, we can run Doom! for Microwindows on the X86 desktop and
the Compaq Ipaq PDA. Coming soon: NEC VR4122, Yopy, Assabet, and others.
If you get it running on a new platform, make sure you let the Nano-X
mailing list know at nanogui at linuxhacker.org.
Also let me know, If you are interested in hosting a web page for this
project or being a maintainer, please send an email to jordanc at censoft.com.
This code was based on SDL doom 1.10, so check the README.SDL for more
details about that. The original SDL code can be found in the sdlfiles
directory.
We are releasing this code in the hopes that it will help you and
put a smile on your face. This code is distributed as-is with no
support or garentees that it will be bug free, or even compile.
Use this code at your own risk.
NON-WARRANTY:
This source is available for distribution and/or modification
only under the terms of the DOOM Source Code License as
published by id Software. All rights reserved.
The source is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
for more details.
Contributors:
Greg Haerr: The Nano-X drawing routines
Jason Kingan: Keyboard interaction and the actual work to get it running
on the SA1100
Jordan Crouse: Bug fixes, joystick support and sound support
See the AUTHORS file for more credits.
--- NEW FILE: g_game.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: g_game.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: g_game.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1686 lines suppressed...]
nomonsters = false;
consoleplayer = 0;
D_AdvanceDemo ();
return true;
}
if (demorecording)
{
*demo_p++ = DEMOMARKER;
M_WriteFile (demoname, demobuffer, demo_p - demobuffer);
Z_Free (demobuffer);
demorecording = false;
I_Error ("Demo %s recorded",demoname);
}
return false;
}
--- NEW FILE: ChangeLog ---
* TODO: see below, and in the "TODO" file. Enjoy!
Mon Dec 22 20:29:16 1997 <bk at gamers.org>
* CVS logs and other obsolete stuff removed. Anybody
who wants to keep some revision control now has a
clean slate to start with.
Mon Dec 22 19:53:34 1997 <bk at gamers.org>
* i_sound.c: enabled SNDSERV, as SNDINTR for
some reason just gives ghastly results e.g.
on E4M2. Frankly, I am at a loss. SNDSERV is
now default, until the internal sound driver
is a bit more reliable.
Note that the current redundancy means that
changes like the one below will have to
be propagated manually to the soundserver
sources.
* m_menu.c: the 4th episode is now removed with
the original doom.wad. You need to rename the
Ultimate DOOM/Special Edition retail IWAD to
doomu.wad now, or you won't see the 4th episode
in the menu. The compile time SPECIAL define
is thus gone.
Mon Dec 22 17:08:33 1997 <bk at gamers.org>
* v_video.c (V_DrawPatch): another last minute hack.
While shareware, retail, commercial, and plutonia
(being a full DOOM2 IWAD) seem to work okay now,
TNT gives an error on finishing the first mission:
"Patch at -35, -5 exceeds LFB".
I changed the error abort into a simple return,
thus the patch is ignored. The intermission screen
seems to come up okay.
* TODO: check which patch, and whether it is an IWAD
problem.
* i_sound.c: the sound table is hardwired in
sounds.h/sounds.c. As our current crude
sound handling simply loads *all* sounds at
startup, we are going to miss some with DOOM1
WAD files. I could skip them, but decided to
load a placeholder instead (dspistol). It might
be good to use a distinct default sound for
WAD debug purposes. A zero length sound lump
would work, but would not be noticeable.
Anyway, shareware and retail work now.
* TODO: implement proper handling for missing
lumps, sound and otherwise.
Perhaps move sound table into WAD?
* g_game.c (G_DoPlayDemo): finally removed the
annoying "Demo is from a different game version"
abort. It now simply declines to playback the
demo, and waits for user input on some
do_nothing screen.
* doomdef.h&Cie.: Lesson of the day - do not
replace a bunch of booleans with an enum and
use the same identifiers. Point in case:
"if ( commercial )" will not give an error,
and will always be true as long as the enum
value is greater than zero.
I found that the DOOM2 vs. DOOM differences
are everywhere (weapons, monsters, doors).
Number of episodes varies from shareware/commercial
to registered to retail, while commercial has
a unique set (two of them, counting the german
edition) of maps in one episode. Plus, TNT and
Plutonia add some TITLE strings to the mixture.
Well, Plutonia and TNT are treated as DOOM2 for
now, so you will miss the startup message.
* wi_stuff.h (NUMEPISODES): removed SPECIAL switch.
It is no 4 times 9 for wi_stuff.c internal
static arrays - doesn't matter.
* TODO: unified handling with DOOM 2 - dynamic
allocation of arrays.
* i_sound.c (I_UpdateSound): okay, I separated
the mixing, now done synchonously, along with
a flag signalling the timer that the mixing buffer
has been updated. The handler is now very short,
and I tried several intervals down to 50usecs,
w/o complaints. Now the man page says:
"system timer resolution currently 10ms". Odd.
Anyway, while the double shotgun/plasma rapid
fire problem seems to be a bit less disturbing
at higher refresh, it's still there. I set the
interval to 500usec, which is sufficient for
avoiding any buffer update misses.
Conclusion after just two days of experimentation:
yep, sound driver code isn't fun at all.
As for the bug - well, Dave Taylor suggested
close distance getting into a divide-by-near-zero
situation, screwing up the volume. I can't figure
why latency of an external sound driver or screen
size affect this, but I am running out of ideas.
* i_sound.c:
Some more experimentation with the timer driven
sound. It doesn't work well using an intervall
of less then 30 msecs - there will be artifacts
with say 50 msecs. This is pretty obvious with
a target frame rate of at least 30fps, methinks.
Using the REAL/SIGALRM timer with 30msec gets
rid of the artifacts, it seems - at the expense
of slowing down things on a P133 to a noticeable
jerkiness. Bah.
Mon Dec 22 00:36:54 1997 <bk at gamers.org>
* info.c: and i_video.c and i_sound.c - don't ask
me why some Linux header files are different with
gcc vs. g++, or what the complaint about the g++
complaint info.c state table is all about:
"initializer element for `states[..].action.acp1'
is not constant"
Undid some changes, compiled with gcc, playtested,
seems okay. Done for today... yesterday.
* i_net.c (ntohl): okay, htons/htonl, ntohs,ntohl
are back to haunt me. Copied the macros that
on my box aren't used for whatever reason directly
into the source. Got rid of all other multiple and
undefined references. CC=g++ now compiles (still
many warnings) and links, but the binary dumps a
core after Init PlayLoop. So be it.
Sun Dec 21 12:38:08 1997 <bk at gamers.org>
* p_enemy.c (P_NewChaseDir): changed tdir to int,
removed the LUTs - spurious locks were due to
endless loops created by boneheaded predecessor
map. Has to be a better way to do enum dirtype_t
anyway. Problem seems to be fixed.
* CC=gcc again, this time loads of #includes to
fix "implicit declarations, and one or two
unused variables. DOOM now compiles without
any -Wall warnings left, as C.
* Bug: compiled the reworked code with gcc. Within a
solid while of testing and blasting away, it
locked once. Got a core, which gdb doesn't grok.
Bah.
* TODO: okay, linkage of g++ build modules give loads
of errors, because we have many implicits, plus
missing #pragma implementation causing multiple
definitions. Yet, this is the very first time DOOM
was compiled as C++ without a parsing error. So there.
* sounds.c: included doomtype.h and removed yet another
enum { false, true } definition.
* p_saveg.c (misc): several.
* p_mobj.c (P_SpawnMobj): (actionf_p1)P_MobjThinker
* p_spec.c (EV_DoDonut): (action_p1) T_MoveFloor (twice).
* p_plats.c (EV_DoPlat): (actionf_p1) T_PlatRaise.
* p_plats.c (EV_StopPlat): (actionf_v)NULL.
* p_plats.c (P_ActivateInStasis): same
* p_lights.c (P_SpawnGlowingLight): (actionf_p1) T_Glow.
* p_lights.c (P_SpawnStrobeFlash): (actionf_p1) T_StrobeFlash.
* p_lights.c (P_SpawnLightFlash): (actionf_p1) T_LightFlash.
* p_lights.c (P_SpawnFireFlicker): (actionf_p1) T_FireFlicker.
* p_floor.c (EV_DoFloor): (actionf_p1) T_MoveFloor.
* p_floor.c (EV_BuildStairs): same (twice).
* p_doors.c (EV_VerticalDoor): (actionf_p1)T_VerticalDoor.
* p_doors.c (P_SpawnDoorCloseIn30): same
* p_doors.c (P_SpawnDoorRaiseIn5Mins): same
* p_doors.c (EV_DoDoor): same
* p_ceilng.c (EV_CeilingCrushStop): (actionf_v)NULL.
* p_ceilng.c (EV_DoCeiling): (actionf_p1)T_MoveCeiling.
* p_ceilng.c (P_ActivateInStasisCeiling): same.
These gave g++ errors, but have been ignored by gcc.
* r_data.c (R_PrecacheLevel): (actionf_p1)P_MobjThinker.
* p_saveg.c: conversions (actionf_p1)T_Whatever.
* p_tick.c: cast (actionf_v)(-1).
* p_telept.c: yet another (actionf_p1)P_MobjThinker.
* p_mobj.c (P_MobjThinker): cast (actionf_v)(-1).
* TODO: decent NOP/NULL/Nil function pointer.
I'd introduce a global A_NOP() function that
chokes up an error message.
Why -1 instead of NULL?
* p_enemy.c: conversions (actionf_p1)P_MobjThinker.
* d_think.h/info.h: think_t is essentially
the same action function pointer stuff.
I moved the definitions from info.h to
d_think.h, and aliased them with a typedef.
Now more changes needed.
* p_enemy.c (successor, predecessor): new LUT,
to provide increments/decrements for enum
dirtype_t, as g++ complaints:
"no post-increment/decrement operator for type"
* Makefile (CC): okay, tried "g++" once more.
A few errors (above). Plus shitloads of warnings
(obviously, better "unused" checking with C++,
lots of the usual int2enum suspects, implicit
declarations, the works).
* p_mobj.c: action.acp1 used accordingly.
* p_pspr.c: action.acp2 used accordingly.
* TODO: info.c:144 warning
"missing braces around initializer for `states[0].action'"
* info.h/info.c: some experimental stuff on
action function pointers.
* TODO: still some sound glitches at startup.
* i_sound.c: few more cleanups. Made mixing use
channel loop instead of unroll, set mixbuffer
to zero ot start.
Removed some more DOS leftovers (8bit),
kept some as comment.
* hu_stuff.c (HU_Start):
More gamemode changes. As in d_main.c, I
decided to use DOOM2 as default whenever
one needed - it was sold most, and had the
superset of items, enemies and monsters.
* TODO: the handling of WAD specific messages
like HU_TITLE, HU_TITLE2, HU_TITLEP etc.
should definitely be removed.
* d_main.c (CheckBetaTest):
Removed outdated, DOS specific BETATEST stuff.
d_main.c (IdentifyVersion):
Numerous changes to gamemode handling.
* TODO: currently, french language is enabled by
detecting an doom2f.wad - yet it needs FRENCH
define at compile time. I removed most language
stuff, and propose handling that at runtime,
using a switch in the config file. Well,
mission specific texts won't work outside the
WAD anyway.
* TODO: along the same lines: I suggest removing
the misc. devparm switches as well - lots of
redundancy not needed anymore.
* Makefile: finally added a doomstat.c for all
the global state variables listing internal
engine configuration. Right now, these are
scattered everywhere. Declaration to be found
in doomstat.h header.
* f_finale.c (F_StartFinale):
Reworked the entire finale handling based on
game mode enum.
* doomstat.h:
Global variables for game mode and language.
Removed old booleans.
* doomdef.h: GameMode_t and Language_t enum added.
Boolean for language was kinda limiting to 2
alternatives (french, english), and five boolean
plus #define SPECIAL for game version is just ugly.
* wi_stuff.h: SPECIAL switch compiles two
different EXE's, one for 3 episodes of 9 maps
each (DOOM 1 registered), one for 4 episodes
of 9 maps each (DOOM 1 retail/FinalDOOM).
Implicitely, the DOOM2 config (one episode,
34 missions) is handled. How is the german
edition (32 missions only) done?
Frankly, this is a mess. The problem is that
intermission (animated as in DOOM 1, simple
backdrop as in DOOM2) as well as certain
items (double shotgun) as well as certain
rendering stuff (sky texture) depend on this.
Plus, it ties into runtime flags as "commercial"
as well. Yuck.
Each change will change the game. Postponed.
* d_net.c,m_misc.c: removed last two NeXT remains.
* d_englsh.h,d_french.h,d_main.c,m_misc.c,r_draw.c,v_video.c:
more WATCOM remains removed. Kept some stuff that
handeld the blocky mode/detailshift in DOS, which
is n.a. in Linux - but probably not worth fixing.
Sat Dec 20 15:16:51 1997 <bk at gamers.org>
* Bug: core dump when using doom.wad or doom1.wad
without a "-file UNUSED/doom2.wad". Version
dependend handling of stuff (double shotgun)
comes to mind.
* doomdef.h:
SNDSERV enables external sound server
support. SNDINTR enables internal sound
output with timer (asynchronous). Default
is internal, synchronous.
* i_sound.c (I_HandleSoundTimer):
Okay, the plasma/double shotgun sound bug
(crapyy sund when firing nose-to-wall) is
obviously a problem with blocking at
refresh - smaller screen size makes it go
away.
I won't do threads w/o a proper gdb, and
I can't do whatever Dave Taylor did with
LinuxQuake w/o the sources, thus I broke
down and implemented a timer based solution.
Seems to work fine, given the fact that
this is the first time ever I implemented
sound handling.
Fri Dec 19 10:02:48 1997 <bk at gamers.org>
* m_menu.c/i_sound.c/s_sound.c:
Removed a few more inconsistencies due to
old internal sound handling (DOS),
external (Linux sndserver), and
new internal (the unfinished merge of
both the former).
The Options/Sound/Music volume menu is
accessible now. It was due to an internal
scaling of the menu (effective range 0-15),
up to 0..120, by multiply with 8 scattered
all over the place, that we got a
v_video.c: I_Error ("Bad V_DrawPatch")
Now I am using the menu resolution
everywhere, and scaling should only be done
in the actual mixing/output.
* OK, obviously this hasn't been updated in months.
This is because: a) most of the time nothing
happened, and b) when something got done, it was
too much to keep track of it by CVS and/or ChangeLog.
Basically, what happened in the meantime is that
I did not find a publisher who believed that the book
sales would be worth doing it. Within the limited
amount of time that I could dedicate to a project
that will not generate any revenue whatsoever,
I spent some time on cleaning up the Linux code
base which works, essentially. I might or might not
be able to participate in a Mesa+Voodoo+Glide based
GLDOOM port for Linux. I won't waste a minute on
Win32 without getting paid for it.
Because of the legal issues involved with the
DMX sound library id licensed for DOS DOOM, Linuxdoom
is the only code base that has sound support at all.
Other UNIX ports (SGI, Sun) could probably be revived
and integrated w/o too many problems. There is no
Win32 port - I never had access to WinDOOM or
Jim Dose's GLDOOM sources. There is no Linux
OpenGL (read: Mesa) support yet - that'd involve
internal changes which will best be done after a
public source release.
John Carmack opted for a release of the Linux code.
I have removed all DMX references I could get a
hold of, but preserved some of the original
sound handling within DOOM that interfaced
with DMX. Linuxdoom (like previous UNIX ports)
used a separate sound server binary. I did some
work on putting the sound server module back into
the engine. It works, but shutdown (pending sounds),
and sound output parallel to refresh (blocking)
is crappy, and there is a problem with double
shotgun and plasma at close distance (as well as
with lots of other noises going on). As the
mixing code is identical to the separate
soundserver, and as it doesn't seem to be a
blocking issue, I am currently at a loss - I
wonder whether the IPC communication with the
soundserver process introduced a delay that
changed behaviour, or whether I simply overlooked
a bug. I am currently lacking the time to track
this down, so I am keeping both internal and
soundserver source.
I did remove DOS and Watcom specifics. I did also
remove the texture mapping and fixed point assembly.
From my experience, it isn't worth the trouble
to ue GCC inline assembler, as performance of
the same loop written in C is perfectly sufficient.
On demand I will put both assembly modules into some
documentation, as they are probably of historic
interest.
There is no Sun DGA, Irix, or other non-Linux stuff
in this code base (at least, not intentionally).
They will be back when ports to other UNIX
environments will be merged back (I can't do
testing, and the modules were separate and not
consistent, so I refrained from wasting time on
this prior to a public release).
While I made only minor changes to the actual code
(some fixes, some cleaning up of SHM and audio),
I did a huge amount of shuffling around. I
introduced many more header files and modules,
some of them laughably small (doing these changes
is bound to screw up CVS, so no CVS record anymore
for the time being). I would introduce even more
separation if I had the time. Splitting the
animation/AI/behaviour code that defines
"DOOM - The Game" into a separate game.so (like
Quake2 does) should definitely be done. Separating
a ref_soft.so aka "DOOM - The Engine", and defining
a clean interface prior to introducing a ref_gl.so
is recommended as well.
I am going to purge some more leftovers, remove
the obsolete CVS history except for comments,
and try to clean up the last "implicit declaration"
and "unused variable" warnings. Except for enabling
cheats in nightmare (to have more fun while testing),
I did not change the game mechanics at all. I would
strongly advise against doing so w/o the proper
separations suggested above. I will not waste time
on fixing detail and blocky mode, lack of resize,
or other stuff that it better addressed by a proper
GLDOOM port.
Sat Aug 16 08:07:16 1997 <bk at hal.gamers.org>
* p_pspr.c:
Moved the sprite animation stuff from doomdef.h here.
* info.h:
Added #ifndef __INFO__ for multiple inclusion. I am
not going to deal with multigen, or changing the
original DOOM monster animation anyway.
* p_spec.h/c:
Moved anim_t etc., locally used only. There is
another anim_t in wi_stuff.h/c, now local as well,
so collisions on header inclusion should not occur.
#include "doomdef.h"
#include "doomstat.h"
these should now be topmost includes.
* doomstat.h, doomdef.h, wi_stuff.h, d_player.h:
I moved wbstartstruct_t to d_player.h, and wminfo
to doomstat.h. Basically, I will try to move all
global state related stuff into doomstat.h, and
all data structures defined for state variables
into doomdef.h - this will be kinda greek tragedy,
and never finished, but a body can try.
* wi_stuff.h/c, wi_data.h:
Removed wi_data.h, put all local stuff blah... see
below.
I have found several unused global variables,
started outcommenting them with //U, will remove
them later. It might be Watcom/PC stuff, or
somebody put the actual numbers into the implementation
instead of using STARDIST, ANIMPERIOD & Cie.
* st_stuff.h/c: from doomdef.h, local stuff moved
into st_stuff.c, etc.
In the current revisions, I am tolerating warnings
of the "implicit declaration" kind - the linker
resolves the stuff, and it will be handy in
unmangling the modules once the headers contain
only the globally visible stuff.
* am_map.h/c, am_data.h:
Removed am_data.h, put all local stuff into
am_map.c, moved globally needed headers from
doomdef.h into am_map.h.
* p_saveg.h, p_setup.h, p_tick.h:
created, stuff from doomde.h moved there
* d_main.c, d_net.c, doomdef.h:
Decided to dump mprintf, as only needed for
Watcom support which is not going to happen.
* doomdef.h:
Moved function prototypes to appropriate headers:
d_main.h, d_net.h.
Fri Aug 15 16:38:53 1997 <bk at hal.gamers.org>
* doomstat.h:
added a few more comments, regrouped some of the
state variables.
* doomdata.h: added a few more comments.
Thu Aug 14 10:38:37 1997 <bk at hal.gamers.org>
* g_game.c (G_DoLoadLevel):
copied the skyflatnum determination here, from
the R_InitSkyMap - once should be sufficient.
* Makefile, r_sky.h/c:
added r_sky module. The sky handling was scattered
over r_bsp, r_main, r_plane, doomstat.h...
* r_bsp.c, r_main.c, r_segs.c:
Removed RD_* calls from R_debug.m, NeXT switches.
* r_local.h:
Removed the R_debug.m NeXT specific debugging
code headers. Removed "drawbsp" flag from
here, and r_main.c, too.
* r_data.c:
Started to remove NORMALUNIX switches, using
LINUX instead. Basically, different UNIX
platforms using the same code should simply
be ANDed in the #ifdef switches.
* r_draw.c:
Removed some more, but not all WATCOMC support.
There is an unresolved problem with the fuzzy
blitting in the lowres (blocky) modes - either
the "detailshift" flag triggered lowres mode
will be removed, or the bug has to be fixed.
* r_bsp.h, r_draw.h, r_things.h, r_data.h,
r_segs.h, r_main.h, r_plane.h:
Created from r_local.h.
* Back to work.
Till March 22nd, a lot of source shuffling and addition
of new header files, separating stuff, and creating
new, smaller modules. Some Watcom/PC/DMX/NeXT etc.
related stuff got removed, but not all (yet). None of
this ended up in the Log (sorry) or the revision control
(CVS is not well suited while number of files and
respective names change a lot, especially if stuff gets
deleted and/or re-introduced).
Major change: part of the sound code got copied from the
separate Linux sndserver sources to the linuxdoom source.
Re-integration and removal of sndserver pending.
Nothing of importance happend since then (priorities).
Mon Feb 3 16:41:05 1997 <bk at gamers.org ()>
* m_misc.c:
Created m_argv, m_random and m_bbox, kept remains in m_misc
for the time being. Misc. files changed to include only
necessary modules. Moved bbox definitions from doomdata.h.
* m_menu.h:
Created from doomdef.h. Misc. changes in dependend modules.
I am not going to list every affected file from now on.
See Log entries within each file.
* dstrings.h:
Now handles multi-language support and switches.
So far, only english (default) and french are available.
* d_englsh.h:
Created from dstrings.h.
* g_game.h:
Created, from doomdef.h.
* am_map.c, st_stuff.c, wi_stuff.c:
* Makefile:
Added m_cheat, removed dutils. Doubly linked list stuff unused.
* m_cheat.h, m_cheat.c:
Created, basci cheat string scrambling and check, from dutils.h
and dutils.c.
* doomdef.h
Moved screen declaration to v_video.h.
* dutils.h, dutils.c
Remode code for f_wipe.h and f_wipe.c.
* Makefile
* d_main.c,
Added f_wipe files.
* f_wipe.h, f_wipe.c:
Created, screen wipe/melt at mission begin, from dutils.h
and dutils.c.
* d_textur.h:
Created from doomdata.h. Separates all the patch/texture
defintions. Needed for v_video module.
* r_local.h, wi_stuff.h, st_lib.h, hu_lib.h:
* i_x.c, d_main.c, m_menu.c, m_misc.c:
Added v_video.h.
* v_video.h:
Created. Using headers from doomdef.h. Forward of patch_t.
Moved bool and byte to doomtype.h.
Thu Jan 30 20:50:16 1997 <bk at gamers.org ()>
* doomtype.h:
Created, for fixed_t. Should add angle_t here, too.
* tables.c:
Added SlopeDiv from r_main.c, added all defines and typedefs
related to basic trig table use here, removed it.
Currently "tables.h" is included in doomdef.h and
r_local.h, too. This is not too cleanly separated, but
we have to start somewhere, right?
* tables.h:
Created from doomdef.h.
Note that tables.c had fixed size tables, while doomdef.h
calculated from the value of FINEANGLES. In addition,
entries were given as either "int" or "fixed_t". Bad boys.
* z_zone.c:
* s_sound.c:
* hu_stuff.c:
* st_lib.c, st_stuff.c:
* wi_stuff.c:
* w_wad.c:
* r_things.c, r_plane.c, r_draw.c, r_data.c:
* p_tick.c, p_mobj.c, p_spec.c, p_setup.c, p_lights.c,
p_plats.c, p_floor.c, p_doors.c, p_ceilng.c:
* am_map.c:
* m_misc.c, m_menu.c:
* g_game.c:
* d_main.c:
* f_finale.c:
Added #include "z_zone.h".
* z_zone.h:
Created, from stuff in doomdef.h
* CVS checkin. Reformatting run, last one.
Took a week to go through all the sources, w/o even
looking to closely.
* st_stuff.c (ST_Responder):
Removed a first tiny bit of redundancy (NO_CLIP checks).
Should remove idspispod completely, later.
Wed Jan 29 19:53:43 1997 <bk at gamers.org ()>
* Another one, while we are on it. All S (Sound) files.
* CVS checkin. Reformatting run, all R (Refresh) files.
* r_draw.c (R_DrawSpanLow):
The non-Watcom, non-asm lowres mode was just a copy
of the default mode. As detailshift was used to scale
the image down, lowres mode just filled the left half
of the buffer.
* r_draw.c (R_DrawColumnLow):
Tried the same hack for walls, horribly broken.
Postponed.
Tue Jan 28 19:32:48 1997 <bk at gamers.org ()>
* CVS checkin. Another reformatting run. Did all P files.
* p_spec.c: P_FindNextHighestFloor
The number of adjoining sectors is limited to 20, because
of a temporary LUT needed for determining lowest height
in adjacent sectors. No overflow checking is done.
Sun Jan 26 08:41:21 1997 <bk at gamers.org ()>
* Another CVS checkin of a formatting run.
D,F,G,HU,I,M have been changed.
* Note: in initial and current release,
linuxxdoom -3 -file plutonia.wad, idclev 12
produces a Segmentation fault.
Wed Jan 22 14:03:00 1997 <bk at gamers.org ()>
* m_menu.c:
initializer-string for array of chars is too long (skullName)
warning: unused parameter `int choice' (a couple of times)
* Attempt to compile as C++. Loads of warnings, a couple of errors.
p_enemy.c (P_Move):
r_things.c (R_ProjectSprite)
`catch', `throw', and `try' are all C++ reserved words,
thus changed "try" to "try_ok". Fixed.
p_pspr.c: In function `void P_SetPsprite(struct player_s *, ... )':
too many arguments to function
No convenient fix - state->action is declared void action(),
but called w/o, with one, or with two parameters.
There are more like this. Going to be a tough one.
Union of pointers?
Postponed.
r_plane.c: In function `void R_DrawPlanes()':
s_sound.c: In function `int S_AdjustSoundParams(struct mobj_s *, .. )':
p_map.c: In function `bool PIT_StompThing(struct mobj_s *)':
p_maputl.c: In function `int P_AproxDistance(int, int)':
r_main.c: In function `int R_PointToDist(int, int)':
p_enemy.c: In function `void P_NewChaseDir(struct mobj_s *)':
warning: implicit declaration of function `int abs(...)' <stdlib.h>
Wed Jan 22 12:15:00 1997 <bk at gamers.org ()>
* CVS checkin of purification run. Sources now compile
without any "-Wall" warnings.
* Note: with -file "tnt.wad", we get an "Error: Bad V_DrawPatch"
abort each time we enter an exit. Invalid or missing
intermission screen?
* Makefile (CFLAGS): added -Wall, first purification run.
d_main.c: In function `D_DoomMain':
warning: implicit declaration of function `mkdir' <fcntl.h>
i_unix.c: In function `I_StartSound':
warning: control reaches end of non-void function
i_unix.c: In function `I_InitNetwork':
warning: implicit declaration of function `inet_addr' <arpa/inet.h>
i_unix.c: At top level:
warning: `endianness' defined but not used
i_x.c: In function `I_Error':
warning: unused variable `string'
i_x.c: In function `I_GetEvent':
warning: suggest parentheses around arithmetic in operand of |
i_x.c: In function `I_FinishUpdate':
warning: unused variable `bigscreen'
i_x.c: In function `grabsharedmemory':
warning: implicit declaration of function `getuid' <unistd.h>
warning: unused variable `done'
i_x.c: In function `I_InitGraphics':
warning: suggest parentheses around assignment used as truth value
warning: char format, different type arg (arg 3)
warning: char format, different type arg (arg 5)
warning: implicit declaration of function `XShmGetEventBase'
i_x.c: In function `InitExpand2':
warning: unused variable `jexp'
warning: unused variable `iexp'
m_menu.c: In function `M_ReadSaveStrings':
warning: implicit declaration of function `read' <sys/types.h>
warning: implicit declaration of function `close' <unistd.h>
m_misc.c: In function `M_WriteFile':
warning: implicit declaration of function `write'
warning: implicit declaration of function `close'
m_misc.c: In function `M_ReadFile':
warning: implicit declaration of function `read'
m_misc.c: In function `M_ScreenShot':
warning: implicit declaration of function `access' <unistd.h>
p_pspr.c: In function `P_MovePsprites':
suggest parentheses around assignment used as truth value
p_spec.c: In function `P_SpawnSpecials':
warning: implicit declaration of function `atoi' <stdlib.h>
w_wad.c: In function `strupr':
warning: implicit declaration of function `toupper' <ctype.h>
w_wad.c: In function `W_AddFile':
warning: implicit declaration of function `read' <sys/types.h>
warning: implicit declaration of function `lseek'
warning: implicit declaration of function `close' <unistd.h>
wi_stuff.c: In function `WI_loadData':
warning: unused variable `pic'
wi_stuff.c: At top level:
warning: `background' defined but not used
Tue Jan 21 22:00:00 1997 <bk at gamers.org ()>
* doomdata.h (__BYTEBOOL__):
Use builtin ANSI C++ bool.
* d_main.c (IdentifyVersion):
Bug fix: insufficient malloc created errors in malloc/realloc
calls later on. Welcome to the risks of Copy'n'paste.
Tue Jan 21 13:20:05 1997 <bk at gamers.org ()>
* First formatting checkin.
A word of explanation: prior to making any changes to the
source, a couple of formatting runs will be made, followed
by some purification runs.
For this run, the Emacs mode selection line has been changed
to use C++ style indenting (cc-mode.el). Each file has
been automatically reformatted using Emacs indent-region.
A few files have been changed manually already (i.e.,
comments, use of tabs).
Warning: using "diff" to compare files of different states
during the reformatting will not give useful results.
* hu_stuff.c:
fixed "assignment discard const", the last remaining error
message with default compilation.
Sun Jan 19 14:27:06 1997 <bk at gamers.org ()>
* Makefile:
Minor fix for sndserver target, removed linuxsdoom target
for the time being, added CVS header (kind of).
* Initial CVS checkin.
* soundsrv/irix/linux/sun.c:
Changed includes (irix.h removed, soundsrv.h included).
* i_svga.c:
Changed to DOS 8+3.
* soundsrv.h/c:
Changed to DOS 8+3, included irix.h in soundsrv.h.
* r_local.h:
Same for PI, include math.h with Linux.
* doomdef.h:
Got rid of multiply defined warnings for Linux,
included values.h.
* FILES2:
created a commented list of all files, removed a few
more files (sndserver test, NeXT leftovers, DMX header).
Identified the following main modules (see FILES2):
AM, HU, M, P, R, S, ST, W, WI. Some stuff is separate
(Z, F), some not clearly separable (G, D). System specific
interfaces are in I. Some of the latter replace i_main.c
(i.e. the void/int main(argc,argv) call), e.g. SVGA,
others (X11, SHM, DGA) don't. There is a certain amount
of overlap, and the largest module (with possibly most
overlap) is P - playing, i.e. all the games state and
animation handling.
Dithering is currently not used.
Sat Jan 18 15:14:41 1997 <bk at gamers.org ()>
* r_draw.c:
fixed !defined(USEASM) lines for R_DrawColumn/Span.
Removed fpfunc.o/S from Makefile, now compiling
X11 w/o any assembler.
Got a running linuxxdoom again. We are in business.
This source is going to be used for the initial CVS
check in.
* Tried a quick hack compiling it as COFF a.out instead
of ELF, with "gcc -b i486-linuxaout". Same linker
errors.
Tried removing -DUSE_ASM. Still using fpfunc.S.
* Tried linuxxdoom.
Compile run: some warnings (redefinition of MAX/MIN
SHORT/INT/LONG) in doomdef.h and (PI redefined)
r_local.h.
Link run: crashed, undefined references in
d_main.c: undefined reference to `FixedDiv2'
am_map.c: undefined reference to `FixedMul'
r_main.c: undefined reference to `R_DrawColumn'
r_main.c: undefined reference to `R_DrawSpan'
r_plane.c: undefined reference to `FixedMul'
This stuff is defined in fpfunc.S (Fixed point) and
in r_draw.c (assembler in tmap.S not used).
However, "nm," shows that r_draw.o does not include
the drawing functions (see below - USE_ASM).
Furthermore, the global symbols in fpfunc.S begin
with an underscore, "_FixedMul" and "_FixedDiv2".
More problems within fpfunc.o: undefined references to
`_dc_yl' `_dc_yh'
`_ylookup'
`_centery'
`_dc_x'
`_columnofs'
`_dc_iscale'
`_dc_texturemid'
`_dc_source'
`_dc_colormap'
`_ds_y' `_ds_x1' `_ds_x2'
`_ds_xfrac' `_ds_yfrac'
`_ds_xstep' `_ds_ystep'
`_ds_colormap'
`_ds_source'
Again, underscore problem.
Note: tmap.S currently obsolete, as somebody pasted all
the texture mapping assembly into fpfunc.S. Gotta clean
that up.
* Created initial release from CD sources, created ChangeLog.
Let the games begin.
**************************************************************
DOOM source code ChangeLog file
**************************************************************
--- NEW FILE: d_think.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_think.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// MapObj data. Map Objects or mobjs are actors, entities,
// thinker, take-your-pick... anything that moves, acts, or
// suffers state changes of more or less violent nature.
//
//-----------------------------------------------------------------------------
#ifndef __D_THINK__
#define __D_THINK__
#ifdef __GNUG__
#pragma interface
#endif
//
// Experimental stuff.
// To compile this as "ANSI C with classes"
// we will need to handle the various
// action functions cleanly.
//
typedef void (*actionf_v)();
typedef void (*actionf_p1)( void* );
typedef void (*actionf_p2)( void*, void* );
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;
} thinker_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_think.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: g_game.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: g_game.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Duh.
//
//-----------------------------------------------------------------------------
#ifndef __G_GAME__
#define __G_GAME__
#include "doomdef.h"
#include "d_event.h"
//
// GAME
//
void G_DeathMatchSpawnPlayer (int playernum);
void G_InitNew (skill_t skill, int episode, int map);
// Can be called by the startup code or M_Responder.
// A normal game starts at map 1,
// but a warp test can start elsewhere
void G_DeferedInitNew (skill_t skill, int episode, int map);
void G_DeferedPlayDemo (char* demo);
// Can be called by the startup code or M_Responder,
// calls P_SetupLevel or W_EnterWorld.
void G_LoadGame (char* name);
void G_DoLoadGame (void);
// Called by M_Responder.
void G_SaveGame (int slot, char* description);
// Only called by startup code.
void G_RecordDemo (char* name);
void G_BeginRecording (void);
void G_PlayDemo (char* name);
void G_TimeDemo (char* name);
boolean G_CheckDemoStatus (void);
void G_ExitLevel (void);
void G_SecretExitLevel (void);
void G_WorldDone (void);
void G_Ticker (void);
boolean G_Responder (event_t* ev);
void G_ScreenShot (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log: g_game.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: st_lib.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: st_lib.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: st_lib.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// The status bar widget code.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: st_lib.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
#include <ctype.h>
#include "m_swap.h"
#include "doomdef.h"
#include "z_zone.h"
#include "v_video.h"
#include "i_system.h"
#include "w_wad.h"
#include "st_stuff.h"
#include "st_lib.h"
#include "r_local.h"
// in AM_map.c
extern boolean automapactive;
//
// Hack display negative frags.
// Loads and store the stminus lump.
//
patch_t* sttminus;
void STlib_init(void)
{
sttminus = (patch_t *) W_CacheLumpName("STTMINUS", PU_STATIC);
}
// ?
void
STlib_initNum
( st_number_t* n,
int x,
int y,
patch_t** pl,
int* num,
boolean* on,
int width )
{
n->x = x;
n->y = y;
n->oldnum = 0;
n->width = width;
n->num = num;
n->on = on;
n->p = pl;
}
//
// A fairly efficient way to draw a number
// based on differences from the old number.
// Note: worth the trouble?
//
void
STlib_drawNum
( st_number_t* n,
boolean refresh )
{
int numdigits = n->width;
int num = *n->num;
int w = SHORT(n->p[0]->width);
int h = SHORT(n->p[0]->height);
int x = n->x;
int neg;
n->oldnum = *n->num;
neg = num < 0;
if (neg)
{
if (numdigits == 2 && num < -9)
num = -9;
else if (numdigits == 3 && num < -99)
num = -99;
num = -num;
}
// clear the area
x = n->x - numdigits*w;
if (n->y - ST_Y < 0)
I_Error("drawNum: n->y - ST_Y < 0");
V_CopyRect(x, n->y - ST_Y, BG, w*numdigits, h, x, n->y, FG);
// if non-number, do not draw it
if (num == 1994)
return;
x = n->x;
// in the special case of 0, you draw 0
if (!num)
V_DrawPatch(x - w, n->y, FG, n->p[ 0 ]);
// draw the new number
while (num && numdigits--)
{
x -= w;
V_DrawPatch(x, n->y, FG, n->p[ num % 10 ]);
num /= 10;
}
// draw a minus sign if necessary
if (neg)
V_DrawPatch(x - 8, n->y, FG, sttminus);
}
//
void
STlib_updateNum
( st_number_t* n,
boolean refresh )
{
if (*n->on) STlib_drawNum(n, refresh);
}
//
void
STlib_initPercent
( st_percent_t* p,
int x,
int y,
patch_t** pl,
int* num,
boolean* on,
patch_t* percent )
{
STlib_initNum(&p->n, x, y, pl, num, on, 3);
p->p = percent;
}
void
STlib_updatePercent
( st_percent_t* per,
int refresh )
{
if (refresh && *per->n.on)
V_DrawPatch(per->n.x, per->n.y, FG, per->p);
STlib_updateNum(&per->n, refresh);
}
void
STlib_initMultIcon
( st_multicon_t* i,
int x,
int y,
patch_t** il,
int* inum,
boolean* on )
{
i->x = x;
i->y = y;
i->oldinum = -1;
i->inum = inum;
i->on = on;
i->p = il;
}
void
STlib_updateMultIcon
( st_multicon_t* mi,
boolean refresh )
{
int w;
int h;
int x;
int y;
if (*mi->on
&& (mi->oldinum != *mi->inum || refresh)
&& (*mi->inum!=-1))
{
if (mi->oldinum != -1)
{
x = mi->x - SHORT(mi->p[mi->oldinum]->leftoffset);
y = mi->y - SHORT(mi->p[mi->oldinum]->topoffset);
w = SHORT(mi->p[mi->oldinum]->width);
h = SHORT(mi->p[mi->oldinum]->height);
if (y - ST_Y < 0)
I_Error("updateMultIcon: y - ST_Y < 0");
V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG);
}
V_DrawPatch(mi->x, mi->y, FG, mi->p[*mi->inum]);
mi->oldinum = *mi->inum;
}
}
void
STlib_initBinIcon
( st_binicon_t* b,
int x,
int y,
patch_t* i,
boolean* val,
boolean* on )
{
b->x = x;
b->y = y;
b->oldval = 0;
b->val = val;
b->on = on;
b->p = i;
}
void
STlib_updateBinIcon
( st_binicon_t* bi,
boolean refresh )
{
int x;
int y;
int w;
int h;
if (*bi->on
&& (bi->oldval != *bi->val || refresh))
{
x = bi->x - SHORT(bi->p->leftoffset);
y = bi->y - SHORT(bi->p->topoffset);
w = SHORT(bi->p->width);
h = SHORT(bi->p->height);
if (y - ST_Y < 0)
I_Error("updateBinIcon: y - ST_Y < 0");
if (*bi->val)
V_DrawPatch(bi->x, bi->y, FG, bi->p);
else
V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG);
bi->oldval = *bi->val;
}
}
--- NEW FILE: m_random.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_random.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#ifndef __M_RANDOM__
#define __M_RANDOM__
#include "doomtype.h"
// Returns a number from 0 to 255,
// from a lookup table.
int M_Random (void);
// As M_Random, but used only by the play simulation.
int P_Random (void);
// Fix randoms for demos.
void M_ClearRandom (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_random.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: am_map.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: am_map.h,v 1.1 2006-10-03 11:26:14 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// AutoMap module.
//
//-----------------------------------------------------------------------------
#ifndef __AMMAP_H__
#define __AMMAP_H__
// 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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: am_map.h,v $
// Revision 1.1 2006-10-03 11:26:14 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:26 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: README.b ---
README for Linux DOOM Source distribution
=========================================
DISCLAIMER
----------
This is not "The DOOM Source Code" dump for a bunch
of reasons. It is based on a DOOM development directory
snapshot as of January 10th, but has been stripped and
changed. Thus it is the DOOM source, but there are many
minor differences to the source as last used by id
Software.
Note that thus neither John Carmack nor Dave Taylor nor
anybody else at id is responsible for the contents of
this archive, or the changes introduced to the original
source.
If there are any questions, contact me at bk at gamers.org,
or preferably post to the mailing list at
doom-editing at gamers.org
(send mail to majordomo at gamers.org, content just
a single "info doom-editing"). I will post any updates
or notifcation of corrections there. I will probably
put some stuff at
http://www.gamers.org/dEngine/doom/
as well. Look there for the "Unofficial DOOM Specs" as
minimal recommended documentation.
REMARKS
-------
I made a few minor bug fixes, added some experimental sound
code, and, and changed the handling of IWAD dependend game
modes. Most of the changes though have been shuffling
around sources in a sometimes futile attempt to separate
modules more cleanly, and make certain parts easier
to locate and modify. There is still much left to do, but
I hope that the current source is a good base to start
with, especially with a cooperative effort in mind. Those
so inclined will find the source prepared for CVS.
There is a list of changes and fixes I did not get around
to in TODO, and an incomplete worklog in ChangeLog, that
also includes some minor ToDo statements scattered throughout
the log.
a) Linux SVGA
There is no SVGA support. For development and debug
purposes, the X11 version seems to be more handy.
b) Sound - see README.sound,
and the sndserver.tgz archive.
c) GLDOOM - see README.gl
d) Win32
There was no Win32 support in the original dump.
e) DOS
Original DOS support (including the texture
mapping and fixed point assembler) has been
removed, mainly because of the lack of sound
support.
f) DoomEd
The NeXTStep DoomEd sources in the dump were
garbled (filenames - prolly an issue of ISO9660
with or w/o extensions). Somehow Bear never got
around to send me a list of the correct filenames,
and I won't bother guessing without a NeXT box
at hand.
There is a plethora of useful editors
for DOOM. I suggest using DEU for X11.
g) BSP Tools
The BSP builder and other tools have
been released by John Carmack long ago,
and since improved/replaced by others.
Again, I recommend taking a pick among
the tools available for Linux.
h) DOOM game tools
There are a number of tools that have
not been released, namely those which
compiled the Things and State Tables,
the frame animation LUT's, sound tables
etc. Basically, they compile similarly
complex LUT's to generate C files. The
tools are omitted from this distribution.
There are some files in the
distribution (info.h/c, sounds.h/c)
that are essentially the output of these
tools. This is the data that defines
DOOM (as a game) for all practical
purposes.
I recommend keeping them, as they are
part of the source. In the long run,
handling them as well as the action/
animation functions as a separate game.so
library (as with Quake2) seems to be a
good idea.
i) Artwork
Neither the original artwork nor the
misc. WAD files are included in this
archive. You will at least need the
shareware WAD file to run the executable,
but it shouldn't be to difficult to get
a hold of that.
Note that the mechanism to detect the
presence of a registered or commercial
version is still in the source, and
homebrew maps are still disabled. This
is easily removed now, but as FinalDOOM,
Ultimate DOOM and DOOM 2 are still in
the shops, it is probably polite not
to distribute a source or binary without
that mechanism.
This version of Linuxdoom supports Plutonia
and TNT WAD from FinalDOOM as well. No
guarantees, though.
Enjoy!
b. 97/12/22
--- NEW FILE: am_map.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: am_map.c,v 1.1 2006-10-03 11:26:14 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
//
// $Log: am_map.c,v $
// Revision 1.1 2006-10-03 11:26:14 dslinux_amadeus
[...1322 lines suppressed...]
}
void AM_Drawer (void)
{
if (!automapactive) return;
AM_clearFB(BACKGROUND);
if (grid)
AM_drawGrid(GRIDCOLORS);
AM_drawWalls();
AM_drawPlayers();
if (cheating==2)
AM_drawThings(THINGCOLORS, THINGRANGE);
AM_drawCrosshair(XHAIRCOLORS);
AM_drawMarks();
V_MarkRect(f_x, f_y, f_w, f_h);
}
--- NEW FILE: COPYING ---
--- NEW FILE: m_random.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_random.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_random.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Random number LUT.
//
//-----------------------------------------------------------------------------
static const char rcsid[] = "$Id: m_random.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
//
// M_Random
// Returns a 0-255 number
//
unsigned char rndtable[256] = {
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 ,
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 ,
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
120, 163, 236, 249
};
int rndindex = 0;
int prndindex = 0;
// Which one is deterministic?
int P_Random (void)
{
prndindex = (prndindex+1)&0xff;
return rndtable[prndindex];
}
int M_Random (void)
{
rndindex = (rndindex+1)&0xff;
return rndtable[rndindex];
}
void M_ClearRandom (void)
{
rndindex = prndindex = 0;
}
--- NEW FILE: wi_stuff.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: wi_stuff.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Intermission.
//
//-----------------------------------------------------------------------------
#ifndef __WI_STUFF__
#define __WI_STUFF__
//#include "v_video.h"
#include "doomdef.h"
// States for the intermission
typedef enum
{
NoState = -1,
StatCount,
ShowNextLoc
} stateenum_t;
// Called by main loop, animate the intermission.
void WI_Ticker (void);
// Called by main loop,
// draws the intermission directly into the screen buffer.
void WI_Drawer (void);
// Setup for an intermission screen.
void WI_Start(wbstartstruct_t* wbstartstruct);
#endif
//-----------------------------------------------------------------------------
//
// $Log: wi_stuff.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: TODO ---
- create Web repository for sources, patches,
news, and pointer to doom-editing mailing
list.
- get DOOM Public License from id
-----------------------------------------------
- remove m_fixed, switch to floating point
More stable, and prolly even faster.
- make SCREENWIDTH/HEIGHT work at startup?
Well, the HUD/STBar stuff is tied to the
scales implied by the graphics. Rather do
GLDOOM and use texture mapping.
- fix aspect ratio?
320x200 is nothing viable nowadays.
A 320x240 base (4:3) would be a lot better.
See above on width/height.
- limited look up/down by y-shearing?
Prolly not worth it, rather switch to GLDOOM.
- switch to C++?
The action function pointers have varying
argument lists (no parameter, one, etc.).
C++ doesn't like that much. A major rewrite.
- switch to doommain.c plus libdoom? Have
libref, libgame etc.?
Another major rewrite.
- use XFree86 DGA, prolly not that much faster
than MIT SHM, but allows for directly sampled
mouse (and even freelook). Recommended for
GLDOOM.
- put together an accompanying developer toolkit
source distribution: DEU, RMB, BSP for Linux/X.
- move info.h, info.c, sounds.h, sounds.c and
other data to a separate lump in the WAD,
or into a libgame.so, to separate the
generic stuff (refresh, I/O) from the
DOOM specifics.
- decide whether precaching all sounds is
better than retrieving and releasing
every so often. DOOM seems to do that
frequently (8bit stuff, originally for
DOS), and the Linux sound is 16bit
(conversion in the mixing, requires
some padding) - we prolly got the memory
to spare.
- 16bpp CLUT. The lightmaps and the
framebuffer could be changed to switch
to 64K colors. Prolly better to do
GLDOOM right away.
- remove checks for commercial etc., in
non-essential issues (enabling PWAD's).
- change (simplify) determination of
sky texture (done by game version).
Explicit?
- remove all game version checks
- different handling of Demo - don't
exit on "different game version"
- how about shareware/retail "You are here"
intermission animation? Wasn't in
commercial (DOOM 2).
- double shotgun in DOOM1, all weapons with
shareware
- checks for required lumps. We need fallbacks
for lumps that are not present, that is,
default sounds etc. to be used instead,
or removing THINGS w/o sprites etc.
- client/server? I'd suggest ripping off some stuff
from the abandoned IBM WebView project
- Blockmap
The BLOCKMAP lump might be (partly) redundant,
as the BSP allows for clipping (except certain
LineDefs that will not spawn Segs).
- LOS
REJECT and intersection based LOS checking could be
done using the BSP. In case of REJECT, certain
monster AI special effects would be lost, though.
- correct handling of height in collision. This is
not done, and the checks are scattered around in
many places. It does require handling of "player
on top of monster" situations, too - we have to
make sure the players falls off far enough to
avoid getting "stuck in monster".
- remove obsolete menus (Detail. Music Volume?)
- clip explosion range damage (and sprites) using
REJECT? That is, if one Sector/SSector not
visible from the other, do not apply damage,
not render sprite if player in other sector.
Hmmm - explosion behind small pillar might not be
visible at all, but do we care?
- Ungraceful and untimely demise of Linuxdoom (core
instead of I_Error) will leave idle sndserver
processes in your system, blocking /dev/bsp.
A timeout on lack of input for "sndserver"?
- threaded sndserver? SHM mixing buffer?
Or internal, timer-based?
--- NEW FILE: README.SDL ---
Simple DirectMedia Library:
This is a quick and dirty port of DOOM to the SDL library.
The only thing that is system dependent really is the endianness detection
It was very simple, and only took an afternoon, thanks to the efforts
of all those folks who have ported this game to everything but the toaster. :)
Here's the web page for my library:
http://www.devolution.com/~slouken/SDL/
Thanks go to all those involved in the DOOM game. ID Software comes to mind. :)
Note the addition of a "-fullscreen" command line option.
See ya!
-Sam Lantinga (slouken at devolution.com)
--- NEW FILE: r_sky.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_sky.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Sky rendering.
//
//-----------------------------------------------------------------------------
#ifndef __R_SKY__
#define __R_SKY__
#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
//-----------------------------------------------------------------------------
//
// $Log: r_sky.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: DOOMLIC.TXT ---
LIMITED USE SOFTWARE LICENSE AGREEMENT
This Limited Use Software License Agreement (the "Agreement")
is a legal agreement between you, the end-user, and Id Software, Inc.
("ID"). By downloading or purchasing the software material, which
includes source code (the "Source Code"), artwork data, music and
software tools (collectively, the "Software"), you are agreeing to
be bound by the terms of this Agreement. If you do not agree to the
terms of this Agreement, promptly destroy the Software you may have
downloaded or copied.
ID SOFTWARE LICENSE
1. Grant of License. ID grants to you the right to use the
Software. You have no ownership or proprietary rights in or to the
Software, or the Trademark. For purposes of this section, "use" means
loading the Software into RAM, as well as installation on a hard disk
or other storage device. The Software, together with any archive copy
thereof, shall be destroyed when no longer used in accordance with
this Agreement, or when the right to use the Software is terminated.
You agree that the Software will not be shipped, transferred or
exported into any country in violation of the U.S. Export
Administration Act (or any other law governing such matters) and that
you will not utilize, in any other manner, the Software in violation
of any applicable law.
2. Permitted Uses. For educational purposes only, you, the
end-user, may use portions of the Source Code, such as particular
routines, to develop your own software, but may not duplicate the
Source Code, except as noted in paragraph 4. The limited right
referenced in the preceding sentence is hereinafter referred to as
"Educational Use." By so exercising the Educational Use right you
shall not obtain any ownership, copyright, proprietary or other
interest in or to the Source Code, or any portion of the Source
Code. You may dispose of your own software in your sole discretion.
With the exception of the Educational Use right, you may not
otherwise use the Software, or an portion of the Software, which
includes the Source Code, for commercial gain.
3. Prohibited Uses: Under no circumstances shall you, the
end-user, be permitted, allowed or authorized to commercially exploit
the Software. Neither you nor anyone at your direction shall do any
of the following acts with regard to the Software, or any portion
thereof:
Rent;
Sell;
Lease;
Offer on a pay-per-play basis;
Distribute for money or any other consideration; or
In any other manner and through any medium whatsoever
commercially exploit or use for any commercial purpose.
Notwithstanding the foregoing prohibitions, you may commercially
exploit the software you develop by exercising the Educational Use
right, referenced in paragraph 2. hereinabove.
4. Copyright. The Software and all copyrights related thereto
(including all characters and other images generated by the Software
or depicted in the Software) are owned by ID and is protected by
United States copyright laws and international treaty provisions.
Id shall retain exclusive ownership and copyright in and to the
Software and all portions of the Software and you shall have no
ownership or other proprietary interest in such materials. You must
treat the Software like any other copyrighted material. You may not
otherwise reproduce, copy or disclose to others, in whole or in any
part, the Software. You may not copy the written materials
accompanying the Software. You agree to use your best efforts to
see that any user of the Software licensed hereunder complies with
this Agreement.
5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS
IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT
TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO
JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE
WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS.
THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS
WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE
MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF
OF ID.
Exclusive Remedies. The Software is being offered to you
free of any charge. You agree that you have no remedy against ID, its
affiliates, contractors, suppliers, and agents for loss or damage
caused by any defect or failure in the Software regardless of the form
of action, whether in contract, tort, includinegligence, strict
liability or otherwise, with regard to the Software. This Agreement
shall be construed in accordance with and governed by the laws of the
State of Texas. Copyright and other proprietary matters will be
governed by United States laws and international treaties. IN ANY
CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST
SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
OTHER PARTY. Some jurisdictions do not allow the exclusion or
limitation of incidental or consequential damages, so the above
limitation or exclusion may not apply to you.
--- NEW FILE: doomstat.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: doomstat.h,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// All the global variables that store the internal state.
// Theoretically speaking, the internal state of the engine
// should be found by looking at the variables collected
// here, and every relevant module will have to include
// this header file.
// In practice, things are a bit messy.
//
//-----------------------------------------------------------------------------
#ifndef __D_STATE__
#define __D_STATE__
// We need globally shared data structures,
// for defining the global state variables.
#include "doomdata.h"
#include "d_net.h"
// We need the playr data structure as well.
#include "d_player.h"
#ifdef __GNUG__
#pragma interface
#endif
// ------------------------
// Command line parameters.
//
extern boolean nomonsters; // checkparm of -nomonsters
extern boolean respawnparm; // checkparm of -respawn
extern boolean fastparm; // checkparm of -fast
extern boolean devparm; // DEBUG: launched with -devparm
// -----------------------------------------------------
// Game Mode - identify IWAD as shareware, retail etc.
//
extern GameMode_t gamemode;
extern GameMission_t gamemission;
// Set if homebrew PWAD stuff has been added.
extern boolean modifiedgame;
// -------------------------------------------
// Language.
extern Language_t language;
// -------------------------------------------
// Selected skill type, map etc.
//
// Defaults for menu, methinks.
extern skill_t 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
// Current music/sfx card - index useless
// w/o a reference LUT in a sound module.
// Ideally, this would use indices found
// in: /usr/include/linux/soundcard.h
extern int snd_MusicDevice;
extern int snd_SfxDevice;
// Config file? Same disclaimer as above.
extern int snd_DesiredMusicDevice;
extern int snd_DesiredSfxDevice;
// -------------------------
// Status flags for refresh.
//
// Depending on view size - no status bar?
// Note that there is no way to disable the
// status bar explicitely.
extern boolean statusbaractive;
extern boolean automapactive; // In AutoMap mode?
extern boolean menuactive; // Menu overlayed?
extern boolean paused; // Game Pause?
extern boolean viewactive;
extern boolean nodrawers;
extern boolean noblit;
extern int viewwindowx;
extern int viewwindowy;
extern int viewheight;
extern int viewwidth;
extern int scaledviewwidth;
// This one is related to the 3-screen display mode.
// ANG90 = left side, ANG270 = right
extern int viewangleoffset;
// Player taking events, and displaying.
extern int consoleplayer;
extern int displayplayer;
// -------------------------------------
// Scores, rating.
// Statistics on a given map, for intermission.
//
extern int totalkills;
extern int totalitems;
extern int totalsecret;
// Timer, for scores.
extern int levelstarttic; // gametic at level start
extern int leveltime; // tics in game play for par
// --------------------------------------
// DEMO playback/recording related stuff.
// No demo, there is a human player in charge?
// Disable save/end game?
extern boolean usergame;
//?
extern boolean demoplayback;
extern boolean demorecording;
// Quit after playing a demo from cmdline.
extern boolean singledemo;
//?
extern gamestate_t gamestate;
//-----------------------------
// Internal parameters, fixed.
// These are set by the engine, and not changed
// according to user inputs. Partly load from
// WAD, partly set at startup time.
extern int gametic;
// Bookkeeping on players - state.
extern player_t players[MAXPLAYERS];
// Alive? Disconnected?
extern boolean playeringame[MAXPLAYERS];
// Player spawn spots for deathmatch.
#define MAX_DM_STARTS 10
extern mapthing_t deathmatchstarts[MAX_DM_STARTS];
extern mapthing_t* deathmatch_p;
// Player spawn spots.
extern mapthing_t playerstarts[MAXPLAYERS];
// Intermission stats.
// Parameters for world map / intermission.
extern wbstartstruct_t wminfo;
// LUT of ammunition limits for each kind.
// This doubles with BackPack powerup item.
extern int maxammo[NUMAMMO];
//-----------------------------------------
// Internal parameters, used for engine.
//
// File handling stuff.
extern char basedefault[1024];
extern FILE* debugfile;
// if true, load all graphics at level load
extern boolean precache;
// wipegamestate can be set to -1
// to force a wipe on the next draw
extern gamestate_t wipegamestate;
extern int mouseSensitivity;
//?
// debug flag to cancel adaptiveness
extern boolean singletics;
extern int bodyqueslot;
// Needed to store the number of the dummy sky flat.
// Used for rendering,
// as well as tracking projectiles etc.
extern int skyflatnum;
// Netgame stuff (buffers and pointers, i.e. indices).
// This is ???
extern doomcom_t* doomcom;
// This points inside doomcom.
extern doomdata_t* netbuffer;
extern ticcmd_t localcmds[BACKUPTICS];
extern int rndindex;
extern int maketic;
extern int nettics[MAXNETNODES];
extern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
extern int ticdup;
#endif
//-----------------------------------------------------------------------------
//
// $Log: doomstat.h,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: i_net.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_net.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: i_net.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_net.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#if defined(linux) || defined(__SVR4)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/ioctl.h>
#else
#ifdef __BEOS__
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <byteorder.h>
#ifndef IPPORT_USERRESERVED
#define IPPORT_USERRESERVED 5000
#endif
#else
#ifdef __WIN32__
#define Win32_Winsock
#include <windows.h>
#else
#error You should hack this file for your BSD sockets layer
#endif
#endif
#endif
#include "i_system.h"
#include "d_event.h"
#include "d_net.h"
#include "m_argv.h"
#include "doomstat.h"
#ifdef __GNUG__
#pragma implementation "i_net.h"
#endif
#include "i_net.h"
// For some odd reason...
#ifndef B_HOST_IS_LENDIAN
#define B_HOST_IS_LENDIAN 1
#endif
#if !defined(sparc) && B_HOST_IS_LENDIAN
#ifndef ntohl
#define ntohl(x) \
((unsigned 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 ntohs
#define ntohs(x) \
((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
(((unsigned short int)(x) & 0xff00) >> 8)))
#endif
#ifndef htonl
#define htonl(x) ntohl(x)
#endif
#ifndef htons
#define htons(x) ntohs(x)
#endif
#endif
void NetSend (void);
boolean NetListen (void);
//
// NETWORKING
//
int DOOMPORT = (IPPORT_USERRESERVED +0x1d );
int sendsocket;
int insocket;
struct sockaddr_in sendaddress[MAXNETNODES];
void (*netget) (void);
void (*netsend) (void);
//
// UDPsocket
//
int UDPsocket (void)
{
int s;
// allocate a socket
s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s<0)
I_Error ("can't create socket: %s",strerror(errno));
return s;
}
//
// BindToLocalPort
//
void
BindToLocalPort
( int s,
int port )
{
int v;
struct sockaddr_in address;
memset (&address, 0, sizeof(address));
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = port;
v = bind (s, (void *)&address, sizeof(address));
if (v == -1)
I_Error ("BindToPort: bind: %s", strerror(errno));
}
//
// PacketSend
//
void PacketSend (void)
{
int c;
doomdata_t sw;
// byte swap
sw.checksum = htonl(netbuffer->checksum);
sw.player = netbuffer->player;
sw.retransmitfrom = netbuffer->retransmitfrom;
sw.starttic = netbuffer->starttic;
sw.numtics = netbuffer->numtics;
for (c=0 ; c< netbuffer->numtics ; c++)
{
sw.cmds[c].forwardmove = netbuffer->cmds[c].forwardmove;
sw.cmds[c].sidemove = netbuffer->cmds[c].sidemove;
sw.cmds[c].angleturn = htons(netbuffer->cmds[c].angleturn);
sw.cmds[c].consistancy = htons(netbuffer->cmds[c].consistancy);
sw.cmds[c].chatchar = netbuffer->cmds[c].chatchar;
sw.cmds[c].buttons = netbuffer->cmds[c].buttons;
}
//printf ("sending %i\n",gametic);
c = sendto (sendsocket , &sw, doomcom->datalength
,0,(void *)&sendaddress[doomcom->remotenode]
,sizeof(sendaddress[doomcom->remotenode]));
// if (c == -1)
// I_Error ("SendPacket error: %s",strerror(errno));
}
//
// PacketGet
//
void PacketGet (void)
{
int i;
int c;
struct sockaddr_in fromaddress;
int fromlen;
doomdata_t sw;
fromlen = sizeof(fromaddress);
c = recvfrom (insocket, &sw, sizeof(sw), 0
, (struct sockaddr *)&fromaddress, &fromlen );
if (c == -1 )
{
#ifdef EWOULDBLOCK
if (errno != EWOULDBLOCK)
#endif
I_Error ("GetPacket: %s",strerror(errno));
doomcom->remotenode = -1; // no packet
return;
}
{
static int first=1;
if (first)
printf("len=%d:p=[0x%x 0x%x] \n", c, *(int*)&sw, *((int*)&sw+1));
first = 0;
}
// find remote node number
for (i=0 ; i<doomcom->numnodes ; i++)
if ( fromaddress.sin_addr.s_addr == sendaddress[i].sin_addr.s_addr )
break;
if (i == doomcom->numnodes)
{
// packet is not from one of the players (new game broadcast)
doomcom->remotenode = -1; // no packet
return;
}
doomcom->remotenode = i; // good packet from a game player
doomcom->datalength = c;
// byte swap
netbuffer->checksum = ntohl(sw.checksum);
netbuffer->player = sw.player;
netbuffer->retransmitfrom = sw.retransmitfrom;
netbuffer->starttic = sw.starttic;
netbuffer->numtics = sw.numtics;
for (c=0 ; c< netbuffer->numtics ; c++)
{
netbuffer->cmds[c].forwardmove = sw.cmds[c].forwardmove;
netbuffer->cmds[c].sidemove = sw.cmds[c].sidemove;
netbuffer->cmds[c].angleturn = ntohs(sw.cmds[c].angleturn);
netbuffer->cmds[c].consistancy = ntohs(sw.cmds[c].consistancy);
netbuffer->cmds[c].chatchar = sw.cmds[c].chatchar;
netbuffer->cmds[c].buttons = sw.cmds[c].buttons;
}
}
int GetLocalAddress (void)
{
char hostname[1024];
struct hostent* hostentry; // host information entry
int v;
// get local address
v = gethostname (hostname, sizeof(hostname));
if (v == -1)
I_Error ("GetLocalAddress : gethostname: errno %d",errno);
hostentry = gethostbyname (hostname);
if (!hostentry)
I_Error ("GetLocalAddress : gethostbyname: couldn't get local host");
return *(int *)hostentry->h_addr_list[0];
}
//
// I_InitNetwork
//
void I_InitNetwork (void)
{
boolean trueval = true;
int i;
int p;
struct hostent* hostentry; // host information entry
doomcom = malloc (sizeof (*doomcom) );
memset (doomcom, 0, sizeof(*doomcom) );
// set up for network
i = M_CheckParm ("-dup");
if (i && i< myargc-1)
{
doomcom->ticdup = myargv[i+1][0]-'0';
if (doomcom->ticdup < 1)
doomcom->ticdup = 1;
if (doomcom->ticdup > 9)
doomcom->ticdup = 9;
}
else
doomcom-> ticdup = 1;
if (M_CheckParm ("-extratic"))
doomcom-> extratics = 1;
else
doomcom-> extratics = 0;
p = M_CheckParm ("-port");
if (p && p<myargc-1)
{
DOOMPORT = atoi (myargv[p+1]);
printf ("using alternate port %i\n",DOOMPORT);
}
// parse network game options,
// -net <consoleplayer> <host> <host> ...
i = M_CheckParm ("-net");
if (!i)
{
// single player game
netgame = false;
doomcom->id = DOOMCOM_ID;
doomcom->numplayers = doomcom->numnodes = 1;
doomcom->deathmatch = false;
doomcom->consoleplayer = 0;
return;
}
netsend = PacketSend;
netget = PacketGet;
netgame = true;
// parse player number and host list
doomcom->consoleplayer = myargv[i+1][0]-'1';
doomcom->numnodes = 1; // this node for sure
i++;
while (++i < myargc && myargv[i][0] != '-')
{
sendaddress[doomcom->numnodes].sin_family = AF_INET;
sendaddress[doomcom->numnodes].sin_port = htons(DOOMPORT);
if (myargv[i][0] == '.')
{
sendaddress[doomcom->numnodes].sin_addr.s_addr
= inet_addr (myargv[i]+1);
}
else
{
hostentry = gethostbyname (myargv[i]);
if (!hostentry)
I_Error ("gethostbyname: couldn't find %s", myargv[i]);
sendaddress[doomcom->numnodes].sin_addr.s_addr
= *(int *)hostentry->h_addr_list[0];
}
doomcom->numnodes++;
}
doomcom->id = DOOMCOM_ID;
doomcom->numplayers = doomcom->numnodes;
// build message to receive
insocket = UDPsocket ();
BindToLocalPort (insocket,htons(DOOMPORT));
#ifdef linux
ioctl (insocket, FIONBIO, &trueval);
#endif
sendsocket = UDPsocket ();
}
void I_NetCmd (void)
{
if (doomcom->command == CMD_SEND)
{
netsend ();
}
else if (doomcom->command == CMD_GET)
{
netget ();
}
else
I_Error ("Bad net cmd: %i\n",doomcom->command);
}
--- NEW FILE: z_zone.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: z_zone.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Zone Memory Allocation, perhaps NeXT ObjectiveC inspired.
// Remark: this was the only stuff that, according
// to John Carmack, might have been useful for
// Quake.
//
//---------------------------------------------------------------------
#ifndef __Z_ZONE__
#define __Z_ZONE__
#include <stdio.h>
//
// ZONE MEMORY
// PU - purge tags.
// Tags < 100 are not overwritten until freed.
#define PU_STATIC 1 // static entire execution time
#define PU_SOUND 2 // static while playing
#define PU_MUSIC 3 // static while playing
#define PU_DAVE 4 // anything else Dave wants static
#define PU_LEVEL 50 // static until level exited
#define PU_LEVSPEC 51 // a special thinker in a level
// Tags >= 100 are purgable whenever needed.
#define PU_PURGELEVEL 100
#define PU_CACHE 101
void Z_Init (void);
void* Z_Malloc (int size, int tag, void *ptr);
void Z_Free (void *ptr);
void Z_FreeTags (int lowtag, int hightag);
void Z_DumpHeap (int lowtag, int hightag);
void Z_FileDumpHeap (FILE *f);
void Z_CheckHeap (void);
void Z_ChangeTag2 (void *ptr, int tag);
int Z_FreeMemory (void);
typedef struct memblock_s
{
int size; // including the header and possibly tiny fragments
void** user; // NULL if a free block
int tag; // purgelevel
int id; // should be ZONEID
struct memblock_s* next;
struct memblock_s* prev;
} memblock_t;
//
// This is used to get the local FILE:LINE info from CPP
// prior to really call the function in question.
//
#define Z_ChangeTag(p,t) \
{ \
if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
I_Error("Z_CT at "__FILE__":%i",__LINE__); \
Z_ChangeTag2(p,t); \
};
#endif
//-----------------------------------------------------------------------------
//
// $Log: z_zone.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_tick.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_tick.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// ?
//
//-----------------------------------------------------------------------------
#ifndef __P_TICK__
#define __P_TICK__
#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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_tick.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_data.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_data.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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"
#ifdef __GNUG__
#pragma interface
#endif
// Retrieve column data for span blitting.
byte*
R_GetColumn
( int tex,
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 (char* name);
// Called by P_Ticker for switches and animations,
// returns the texture number for the texture name.
int R_TextureNumForName (char *name);
int R_CheckTextureNumForName (char *name);
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_data.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: i_main.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_main.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: i_main.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Main program, simply calls D_DoomMain high level loop.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_main.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
//#include "SDL.h"
#include "doomdef.h"
#include "m_argv.h"
#include "d_main.h"
int
main
( int argc,
char** argv )
{
myargc = argc;
myargv = argv;
D_DoomMain ();
return 0;
}
--- NEW FILE: doomstat.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: doomstat.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: doomstat.c,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Put all global tate variables here.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: doomstat.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $";
#ifdef __GNUG__
#pragma implementation "doomstat.h"
#endif
#include "doomstat.h"
// Game Mode - identify IWAD as shareware, retail etc.
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
// Language.
Language_t language = english;
// Set if homebrew PWAD stuff has been added.
boolean modifiedgame;
--- NEW FILE: d_textur.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_textur.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Typedefs related to to textures etc.,
// isolated here to make it easier separating modules.
//
//-----------------------------------------------------------------------------
#ifndef __D_TEXTUR__
#define __D_TEXTUR__
#include "doomtype.h"
//
// Flats?
//
// a pic is an unmasked block of pixels
typedef struct
{
byte width;
byte height;
byte data;
} pic_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_textur.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_data.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_data.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_data.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// Revision 1.3 1997/01/29 20:10
// DESCRIPTION:
// Preparation of data for rendering,
// generation of lookups, caching, retrieval by name.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: r_data.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#ifdef __BEOS__
#ifdef __GNUC__
extern void *alloca(int);
#else
#include <alloca.h>
#endif
#endif /* __BEOS__ */
#include "m_swap.h"
#include "i_system.h"
#include "z_zone.h"
#include "w_wad.h"
#include "doomdef.h"
#include "r_local.h"
#include "p_local.h"
#include "doomstat.h"
#include "r_sky.h"
#include "r_data.h"
//
// Graphics.
// DOOM graphics for walls and sprites
// is stored in vertical runs of opaque pixels (posts).
// A column is composed of zero or more posts,
// a patch or sprite is composed of zero or more columns.
//
//
// Texture definition.
// Each texture is composed of one or more patches,
// with patches being lumps stored in the WAD.
// The lumps are referenced by number, and patched
// into the rectangular texture space using origin
// and possibly other attributes.
//
typedef __attribute__ ((packed)) struct
{
short __attribute__ ((packed)) originx;
short __attribute__ ((packed)) originy;
short __attribute__ ((packed)) patch;
short __attribute__ ((packed)) stepdir;
short __attribute__ ((packed)) colormap;
} mappatch_t;
//
// Texture definition.
// A DOOM wall texture is a list of patches
// which are to be combined in a predefined order.
//
typedef __attribute__ ((packed)) struct
{
char name[8];
boolean masked;
short width;
short height;
void **columndirectory; // OBSOLETE
short __attribute__ ((packed)) patchcount;
mappatch_t __attribute__ ((packed)) patches[1];
} maptexture_t;
// A single patch from a texture definition,
// basically a rectangular area within
// the texture rectangle.
typedef struct
{
// Block origin (allways UL),
// which has allready accounted
// for the internal origin of the patch.
int originx;
int originy;
int patch;
} texpatch_t;
// A maptexturedef_t describes a rectangular texture,
// which is composed of one or more mappatch_t structures
// that arrange graphic patches.
typedef struct
{
// Keep name for switch changing, etc.
char name[8];
short width;
short height;
// All the patches[patchcount]
// are drawn back to front into the cached texture.
short patchcount;
texpatch_t patches[1];
} texture_t;
int firstflat;
int lastflat;
int numflats;
int firstpatch;
int lastpatch;
int numpatches;
int firstspritelump;
int lastspritelump;
int numspritelumps;
int numtextures;
texture_t** textures;
int* texturewidthmask;
// needed for texture pegging
fixed_t* textureheight;
int* texturecompositesize;
short** texturecolumnlump;
unsigned short** texturecolumnofs;
byte** texturecomposite;
// for global animation
int* flattranslation;
int* texturetranslation;
// needed for pre rendering
fixed_t* spritewidth;
fixed_t* spriteoffset;
fixed_t* spritetopoffset;
lighttable_t *colormaps;
//
// MAPTEXTURE_T CACHING
// When a texture is first needed,
// it counts the number of composite columns
// required in the texture and allocates space
// for a column directory and any new columns.
// The directory will simply point inside other patches
// if there is only one patch in a given column,
// but any columns with multiple patches
// will have new column_ts generated.
//
//
// R_DrawColumnInCache
// Clip and draw a column
// from a patch into a cached post.
//
void
R_DrawColumnInCache
( column_t* patch,
byte* cache,
int originy,
int cacheheight )
{
int count;
int position;
byte* source;
byte* dest;
dest = (byte *)cache + 3;
while (patch->topdelta != 0xff)
{
source = (byte *)patch + 3;
count = patch->length;
position = originy + patch->topdelta;
if (position < 0)
{
count += position;
position = 0;
}
if (position + count > cacheheight)
count = cacheheight - position;
if (count > 0)
memcpy (cache + position, source, count);
patch = (column_t *)( (byte *)patch + patch->length + 4);
}
}
//
// R_GenerateComposite
// Using the texture definition,
// the composite texture is created from the patches,
// and each column is cached.
//
void R_GenerateComposite (int texnum)
{
byte* block;
texture_t* texture;
texpatch_t* patch;
patch_t* realpatch;
int x;
int x1;
int x2;
int i;
column_t* patchcol;
short* collump;
unsigned short* colofs;
texture = textures[texnum];
block = Z_Malloc (texturecompositesize[texnum],
PU_STATIC,
&texturecomposite[texnum]);
collump = texturecolumnlump[texnum];
colofs = texturecolumnofs[texnum];
// Composite the columns together.
patch = texture->patches;
for (i=0 , patch = texture->patches;
i<texture->patchcount;
i++, patch++)
{
realpatch = W_CacheLumpNum (patch->patch, PU_CACHE);
x1 = patch->originx;
x2 = x1 + SHORT(realpatch->width);
if (x1<0)
x = 0;
else
x = x1;
if (x2 > texture->width)
x2 = texture->width;
for ( ; x<x2 ; x++)
{
// Column does not have multiple patches?
if (collump[x] >= 0)
continue;
patchcol = (column_t *)((byte *)realpatch
+ LONG(realpatch->columnofs[x-x1]));
R_DrawColumnInCache (patchcol,
block + colofs[x],
patch->originy,
texture->height);
}
}
// Now that the texture has been built in column cache,
// it is purgable from zone memory.
Z_ChangeTag (block, PU_CACHE);
}
//
// R_GenerateLookup
//
void R_GenerateLookup (int texnum)
{
texture_t* texture;
byte* patchcount; // patchcount[texture->width]
texpatch_t* patch;
patch_t* realpatch;
int x;
int x1;
int x2;
int i;
short* collump;
unsigned short* colofs;
texture = textures[texnum];
// Composited texture not created yet.
texturecomposite[texnum] = 0;
texturecompositesize[texnum] = 0;
collump = texturecolumnlump[texnum];
colofs = texturecolumnofs[texnum];
// Now count the number of columns
// that are covered by more than one patch.
// Fill in the lump / offset, so columns
// with only a single patch are all done.
patchcount = (byte *)alloca (texture->width);
memset (patchcount, 0, texture->width);
patch = texture->patches;
for (i=0 , patch = texture->patches;
i<texture->patchcount;
i++, patch++)
{
realpatch = W_CacheLumpNum (patch->patch, PU_CACHE);
x1 = patch->originx;
x2 = x1 + SHORT(realpatch->width);
if (x1 < 0)
x = 0;
else
x = x1;
if (x2 > texture->width)
x2 = texture->width;
for ( ; x<x2 ; x++)
{
patchcount[x]++;
collump[x] = patch->patch;
colofs[x] = LONG(realpatch->columnofs[x-x1])+3;
}
}
for (x=0 ; x<texture->width ; x++)
{
if (!patchcount[x])
{
printf ("R_GenerateLookup: column without a patch (%s)\n",
texture->name);
return;
}
// I_Error ("R_GenerateLookup: column without a patch");
if (patchcount[x] > 1)
{
// Use the cached block.
collump[x] = -1;
colofs[x] = texturecompositesize[texnum];
if (texturecompositesize[texnum] > 0x10000-texture->height)
{
I_Error ("R_GenerateLookup: texture %i is >64k",
texnum);
}
texturecompositesize[texnum] += texture->height;
}
}
}
//
// R_GetColumn
//
byte*
R_GetColumn
( int tex,
int col )
{
int lump;
int ofs;
col &= texturewidthmask[tex];
lump = texturecolumnlump[tex][col];
ofs = texturecolumnofs[tex][col];
if (lump > 0)
return (byte *)W_CacheLumpNum(lump,PU_CACHE)+ofs;
if (!texturecomposite[tex])
R_GenerateComposite (tex);
return texturecomposite[tex] + ofs;
}
//
// R_InitTextures
// Initializes the texture list
// with the textures from the world map.
//
void R_InitTextures (void)
{
maptexture_t* mtexture;
texture_t* texture;
mappatch_t* mpatch;
texpatch_t* patch;
int i;
int j;
int* maptex;
int* maptex2;
int* maptex1;
char name[9];
char* names;
char* name_p;
int* patchlookup;
int totalwidth;
int nummappatches;
int offset;
int maxoff;
int maxoff2;
int numtextures1;
int numtextures2;
int* directory;
int temp1;
int temp2;
int temp3;
// Load the patch names from pnames.lmp.
name[8] = 0;
names = W_CacheLumpName ("PNAMES", PU_STATIC);
nummappatches = LONG ( *((int *)names) );
name_p = names+4;
// printf("nummappatches = %d\n",nummappatches);
patchlookup = alloca (nummappatches*sizeof(*patchlookup));
for (i=0 ; i<nummappatches ; i++)
{
strncpy (name,name_p+i*8, 8);
patchlookup[i] = W_CheckNumForName (name);
}
Z_Free (names);
// Load the map texture definitions from textures.lmp.
// The data is contained in one or two lumps,
// TEXTURE1 for shareware, plus TEXTURE2 for commercial.
maptex = maptex1 = W_CacheLumpName ("TEXTURE1", PU_STATIC);
numtextures1 = LONG(*maptex);
maxoff = W_LumpLength (W_GetNumForName ("TEXTURE1"));
directory = maptex+1;
// printf("read in lump TEXTURE1 size %d\n",maxoff);
/*
for(i=0; i<maxoff; i++) {
if(!(i%16))
printf("\n");
printf("%02x ", (int)*(((unsigned char * )maptex) + i) );
}
*/
if (W_CheckNumForName ("TEXTURE2") != -1)
{
maptex2 = W_CacheLumpName ("TEXTURE2", PU_STATIC);
numtextures2 = LONG(*maptex2);
maxoff2 = W_LumpLength (W_GetNumForName ("TEXTURE2"));
}
else
{
maptex2 = NULL;
numtextures2 = 0;
maxoff2 = 0;
}
numtextures = numtextures1 + numtextures2;
textures = Z_Malloc (numtextures*4, PU_STATIC, 0);
texturecolumnlump = Z_Malloc (numtextures*4, PU_STATIC, 0);
texturecolumnofs = Z_Malloc (numtextures*4, PU_STATIC, 0);
texturecomposite = Z_Malloc (numtextures*4, PU_STATIC, 0);
texturecompositesize = Z_Malloc (numtextures*4, PU_STATIC, 0);
texturewidthmask = Z_Malloc (numtextures*4, PU_STATIC, 0);
textureheight = Z_Malloc (numtextures*4, PU_STATIC, 0);
totalwidth = 0;
// Really complex printing shit...
temp1 = W_GetNumForName ("S_START"); // P_???????
temp2 = W_GetNumForName ("S_END") - 1;
temp3 = ((temp2-temp1+63)/64) + ((numtextures+63)/64);
printf("[");
for (i = 0; i < temp3; i++)
printf(" ");
printf(" ]");
for (i = 0; i < temp3; i++)
printf("\x8");
printf("\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");
for (i=0 ; i<numtextures ; i++, directory++)
{
if (!(i&63))
printf (".");
if (i == numtextures1)
{
// Start looking in second texture file.
maptex = maptex2;
maxoff = maxoff2;
directory = maptex+1;
}
offset = LONG(*directory);
if (offset > maxoff)
I_Error ("R_InitTextures: bad texture directory");
mtexture = (maptexture_t *) ( (byte *)maptex + offset);
texture = textures[i] =
Z_Malloc (sizeof(texture_t)
+ sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1),
PU_STATIC, 0);
texture->width = SHORT(mtexture->width);
texture->height = SHORT(mtexture->height);
texture->patchcount = SHORT(mtexture->patchcount);
/* memcpy() generates a BUS error on Solaris with optimization on */
#if 0
memcpy (texture->name, mtexture->name, sizeof(texture->name));
#else
{ char *src; char *dst;
src = (char *)mtexture->name;
dst = (char *)texture->name;
for (j=0; j<sizeof(texture->name); ++j )
*dst++ = *src++;
}
#endif
mpatch = &mtexture->patches[0];
patch = &texture->patches[0];
// printf(" ** i = %d offset = %d mtexture = %x mpatch = %x\n",
// i,offset,mtexture,mpatch);
// printf(" ** numpatches for texture %s is %d\n",mtexture->name,
// texture->patchcount);
for (j=0 ; j<texture->patchcount ; j++, mpatch++, patch++)
{
patch->originx = SHORT(mpatch->originx);
patch->originy = SHORT(mpatch->originy);
// printf(" ** Getting patchlookup %x %d\n",mpatch,(int)mpatch->patch);
patch->patch = patchlookup[SHORT(mpatch->patch)];
if (patch->patch == -1)
{
I_Error ("R_InitTextures: Missing patch in texture %s",
texture->name);
}
}
texturecolumnlump[i] = Z_Malloc (texture->width*2, PU_STATIC,0);
texturecolumnofs[i] = Z_Malloc (texture->width*2, PU_STATIC,0);
j = 1;
while (j*2 <= texture->width)
j<<=1;
texturewidthmask[i] = j-1;
textureheight[i] = texture->height<<FRACBITS;
totalwidth += texture->width;
}
Z_Free (maptex1);
if (maptex2)
Z_Free (maptex2);
// Precalculate whatever possible.
for (i=0 ; i<numtextures ; i++)
R_GenerateLookup (i);
// Create translation table for global animation.
texturetranslation = Z_Malloc ((numtextures+1)*4, PU_STATIC, 0);
for (i=0 ; i<numtextures ; i++)
texturetranslation[i] = i;
}
//
// R_InitFlats
//
void R_InitFlats (void)
{
int i;
firstflat = W_GetNumForName ("F_START") + 1;
lastflat = W_GetNumForName ("F_END") - 1;
numflats = lastflat - firstflat + 1;
// Create translation table for global animation.
flattranslation = Z_Malloc ((numflats+1)*4, PU_STATIC, 0);
for (i=0 ; i<numflats ; i++)
flattranslation[i] = i;
}
//
// R_InitSpriteLumps
// Finds the width and hoffset of all sprites in the wad,
// so the sprite does not need to be cached completely
// just for having the header info ready during rendering.
//
void R_InitSpriteLumps (void)
{
int i;
patch_t *patch;
firstspritelump = W_GetNumForName ("S_START") + 1;
lastspritelump = W_GetNumForName ("S_END") - 1;
numspritelumps = lastspritelump - firstspritelump + 1;
spritewidth = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
spriteoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
spritetopoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
for (i=0 ; i< numspritelumps ; i++)
{
if (!(i&63))
printf (".");
patch = W_CacheLumpNum (firstspritelump+i, PU_CACHE);
spritewidth[i] = SHORT(patch->width)<<FRACBITS;
spriteoffset[i] = SHORT(patch->leftoffset)<<FRACBITS;
spritetopoffset[i] = SHORT(patch->topoffset)<<FRACBITS;
}
}
//
// R_InitColormaps
//
void R_InitColormaps (void)
{
int lump, length;
// Load in the light tables,
// 256 byte align tables.
lump = W_GetNumForName("COLORMAP");
length = W_LumpLength (lump) + 255;
colormaps = Z_Malloc (length, PU_STATIC, 0);
colormaps = (byte *)( ((int)colormaps + 255)&~0xff);
W_ReadLump (lump,colormaps);
}
//
// R_InitData
// Locates all the lumps
// that will be used by all views
// Must be called after W_Init.
//
void R_InitData (void)
{
R_InitTextures ();
printf ("\nInitTextures");
R_InitFlats ();
printf ("\nInitFlats");
R_InitSpriteLumps ();
printf ("\nInitSprites");
R_InitColormaps ();
printf ("\nInitColormaps");
}
//
// R_FlatNumForName
// Retrieval, get a flat number for a flat name.
//
int R_FlatNumForName (char* name)
{
int i;
char namet[9];
i = W_CheckNumForName (name);
if (i == -1)
{
namet[8] = 0;
memcpy (namet, name,8);
I_Error ("R_FlatNumForName: %s not found",namet);
}
return i - firstflat;
}
//
// R_CheckTextureNumForName
// Check whether texture is available.
// Filter out NoTexture indicator.
//
int R_CheckTextureNumForName (char *name)
{
int i;
// "NoTexture" marker.
if (name[0] == '-')
return 0;
for (i=0 ; i<numtextures ; i++)
if (!I_strncasecmp (textures[i]->name, name, 8) )
return i;
return -1;
}
//
// R_TextureNumForName
// Calls R_CheckTextureNumForName,
// aborts with error message.
//
int R_TextureNumForName (char* name)
{
int i;
i = R_CheckTextureNumForName (name);
if (i==-1)
{
I_Error ("R_TextureNumForName: %s not found",
name);
}
return i;
}
//
// R_PrecacheLevel
// Preloads all relevant graphics for the level.
//
int flatmemory;
int texturememory;
int spritememory;
void R_PrecacheLevel (void)
{
char* flatpresent;
char* texturepresent;
char* spritepresent;
int i;
int j;
int k;
int lump;
texture_t* texture;
thinker_t* th;
spriteframe_t* sf;
if (demoplayback)
return;
// Precache flats.
flatpresent = alloca(numflats);
memset (flatpresent,0,numflats);
for (i=0 ; i<numsectors ; i++)
{
flatpresent[sectors[i].floorpic] = 1;
flatpresent[sectors[i].ceilingpic] = 1;
}
flatmemory = 0;
for (i=0 ; i<numflats ; i++)
{
if (flatpresent[i])
{
lump = firstflat + i;
flatmemory += lumpinfo[lump].size;
W_CacheLumpNum(lump, PU_CACHE);
}
}
// Precache textures.
texturepresent = alloca(numtextures);
memset (texturepresent,0, numtextures);
for (i=0 ; i<numsides ; i++)
{
texturepresent[sides[i].toptexture] = 1;
texturepresent[sides[i].midtexture] = 1;
texturepresent[sides[i].bottomtexture] = 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.
texturepresent[skytexture] = 1;
texturememory = 0;
for (i=0 ; i<numtextures ; i++)
{
if (!texturepresent[i])
continue;
texture = textures[i];
for (j=0 ; j<texture->patchcount ; j++)
{
lump = texture->patches[j].patch;
texturememory += lumpinfo[lump].size;
W_CacheLumpNum(lump , PU_CACHE);
}
}
// Precache sprites.
spritepresent = alloca(numsprites);
memset (spritepresent,0, numsprites);
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
{
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
spritepresent[((mobj_t *)th)->sprite] = 1;
}
spritememory = 0;
for (i=0 ; i<numsprites ; i++)
{
if (!spritepresent[i])
continue;
for (j=0 ; j<sprites[i].numframes ; j++)
{
sf = &sprites[i].spriteframes[j];
for (k=0 ; k<8 ; k++)
{
lump = firstspritelump + sf->lump[k];
spritememory += lumpinfo[lump].size;
W_CacheLumpNum(lump , PU_CACHE);
}
}
}
}
--- NEW FILE: p_tick.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_tick.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_tick.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Archiving: SaveGame I/O.
// Thinker, Ticker.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_tick.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "p_local.h"
#include "doomstat.h"
int leveltime;
//
// THINKERS
// All thinkers should be allocated by Z_Malloc
// so they can be operated on uniformly.
// The actual structures will vary in size,
// but the first element must be thinker_t.
//
// Both the head and tail of the thinker list.
thinker_t thinkercap;
//
// P_InitThinkers
//
void P_InitThinkers (void)
{
thinkercap.prev = thinkercap.next = &thinkercap;
}
//
// P_AddThinker
// Adds a new thinker at the end of the list.
//
void P_AddThinker (thinker_t* thinker)
{
thinkercap.prev->next = thinker;
thinker->next = &thinkercap;
thinker->prev = thinkercap.prev;
thinkercap.prev = thinker;
}
//
// P_RemoveThinker
// Deallocation is lazy -- it will not actually be freed
// until its thinking turn comes up.
//
void P_RemoveThinker (thinker_t* thinker)
{
// FIXME: NOP.
thinker->function.acv = (actionf_v)(-1);
}
//
// P_AllocateThinker
// Allocates memory and adds a new thinker at the end of the list.
//
void P_AllocateThinker (thinker_t* thinker)
{
}
//
// P_RunThinkers
//
void P_RunThinkers (void)
{
thinker_t* currentthinker;
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
if ( currentthinker->function.acv == (actionf_v)(-1) )
{
// time to remove it
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
Z_Free (currentthinker);
}
else
{
if (currentthinker->function.acp1)
currentthinker->function.acp1 (currentthinker);
}
currentthinker = currentthinker->next;
}
}
//
// P_Ticker
//
void P_Ticker (void)
{
int i;
// run the tic
if (paused)
return;
// pause if in menu and at least one tic has been run
if ( !netgame
&& menuactive
&& !demoplayback
&& players[consoleplayer].viewz != 1)
{
return;
}
for (i=0 ; i<MAXPLAYERS ; i++)
if (playeringame[i])
P_PlayerThink (&players[i]);
P_RunThinkers ();
P_UpdateSpecials ();
P_RespawnSpecials ();
// for par times
leveltime++;
}
--- NEW FILE: z_zone.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: z_zone.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: z_zone.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Zone Memory Allocation. Neat.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: z_zone.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "i_system.h"
#include "doomdef.h"
//
// ZONE MEMORY ALLOCATION
//
// There is never any space between memblocks,
// and there will never be two contiguous free memblocks.
// The rover can be left pointing at a non-empty block.
//
// It is of no value to free a cachable block,
// because it will get overwritten automatically if needed.
//
#define ZONEID 0x1d4a11
typedef struct
{
// total bytes malloced, including header
int size;
// start / end cap for linked list
memblock_t blocklist;
memblock_t* rover;
} memzone_t;
memzone_t* mainzone;
//
// Z_ClearZone
//
void Z_ClearZone (memzone_t* zone)
{
memblock_t* block;
// set the entire zone to one free block
zone->blocklist.next =
zone->blocklist.prev =
block = (memblock_t *)( (byte *)zone + sizeof(memzone_t) );
zone->blocklist.user = (void *)zone;
zone->blocklist.tag = PU_STATIC;
zone->rover = block;
block->prev = block->next = &zone->blocklist;
// NULL indicates a free block.
block->user = NULL;
block->size = zone->size - sizeof(memzone_t);
}
//
// Z_Init
//
void Z_Init (void)
{
memblock_t* block;
int size;
mainzone = (memzone_t *)I_ZoneBase (&size);
mainzone->size = size;
// set the entire zone to one free block
mainzone->blocklist.next =
mainzone->blocklist.prev =
block = (memblock_t *)( (byte *)mainzone + sizeof(memzone_t) );
mainzone->blocklist.user = (void *)mainzone;
mainzone->blocklist.tag = PU_STATIC;
mainzone->rover = block;
block->prev = block->next = &mainzone->blocklist;
// NULL indicates a free block.
block->user = NULL;
block->size = mainzone->size - sizeof(memzone_t);
}
//
// Z_Free
//
void Z_Free (void* ptr)
{
memblock_t* block;
memblock_t* other;
block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
if (block->id != ZONEID)
I_Error ("Z_Free: freed a pointer without ZONEID");
if (block->user > (void **)0x100)
{
// smaller values are not pointers
// Note: OS-dependend?
// clear the user's mark
*block->user = 0;
}
// mark as free
block->user = NULL;
block->tag = 0;
block->id = 0;
other = block->prev;
if (!other->user)
{
// merge with previous free block
other->size += block->size;
other->next = block->next;
other->next->prev = other;
if (block == mainzone->rover)
mainzone->rover = other;
block = other;
}
other = block->next;
if (!other->user)
{
// merge the next free block onto the end
block->size += other->size;
block->next = other->next;
block->next->prev = block;
if (other == mainzone->rover)
mainzone->rover = block;
}
}
//
// Z_Malloc
// You can pass a NULL user if the tag is < PU_PURGELEVEL.
//
#define MINFRAGMENT 64
void*
Z_Malloc
( int size,
int tag,
void* user )
{
int extra;
memblock_t* start;
memblock_t* rover;
memblock_t* newblock;
memblock_t* base;
size = (size + 3) & ~3;
// scan through the block list,
// looking for the first free block
// of sufficient size,
// throwing out any purgable blocks along the way.
// account for size of block header
size += sizeof(memblock_t);
// if there is a free block behind the rover,
// back up over them
base = mainzone->rover;
if (!base->prev->user)
base = base->prev;
rover = base;
start = base->prev;
do
{
if (rover == start)
{
// scanned all the way around the list
I_Error ("Z_Malloc: failed on allocation of %i bytes", size);
}
if (rover->user)
{
if (rover->tag < PU_PURGELEVEL)
{
// hit a block that can't be purged,
// so move base past it
base = rover = rover->next;
}
else
{
// free the rover block (adding the size to base)
// the rover can be the base block
base = base->prev;
Z_Free ((byte *)rover+sizeof(memblock_t));
base = base->next;
rover = base->next;
}
}
else
rover = rover->next;
} while (base->user || base->size < size);
// found a block big enough
extra = base->size - size;
if (extra > MINFRAGMENT)
{
// there will be a free fragment after the allocated block
newblock = (memblock_t *) ((byte *)base + size );
newblock->size = extra;
// NULL indicates free block.
newblock->user = NULL;
newblock->tag = 0;
newblock->prev = base;
newblock->next = base->next;
newblock->next->prev = newblock;
base->next = newblock;
base->size = size;
}
if (user)
{
// mark as an in use block
base->user = user;
*(void **)user = (void *) ((byte *)base + sizeof(memblock_t));
}
else
{
if (tag >= PU_PURGELEVEL)
I_Error ("Z_Malloc: an owner is required for purgable blocks");
// mark as in use, but unowned
base->user = (void *)2;
}
base->tag = tag;
// next allocation will start looking here
mainzone->rover = base->next;
base->id = ZONEID;
return (void *) ((byte *)base + sizeof(memblock_t));
}
//
// Z_FreeTags
//
void
Z_FreeTags
( int lowtag,
int hightag )
{
memblock_t* block;
memblock_t* next;
for (block = mainzone->blocklist.next ;
block != &mainzone->blocklist ;
block = next)
{
// get link before freeing
next = block->next;
// free block?
if (!block->user)
continue;
if (block->tag >= lowtag && block->tag <= hightag)
Z_Free ( (byte *)block+sizeof(memblock_t));
}
}
//
// Z_DumpHeap
// Note: TFileDumpHeap( stdout ) ?
//
void
Z_DumpHeap
( int lowtag,
int hightag )
{
memblock_t* block;
printf ("zone size: %i location: %p\n",
mainzone->size,mainzone);
printf ("tag range: %i to %i\n",
lowtag, hightag);
for (block = mainzone->blocklist.next ; ; block = block->next)
{
if (block->tag >= lowtag && block->tag <= hightag)
printf ("block:%p size:%7i user:%p tag:%3i\n",
block, block->size, block->user, block->tag);
if (block->next == &mainzone->blocklist)
{
// all blocks have been hit
break;
}
if ( (byte *)block + block->size != (byte *)block->next)
printf ("ERROR: block size does not touch the next block\n");
if ( block->next->prev != block)
printf ("ERROR: next block doesn't have proper back link\n");
if (!block->user && !block->next->user)
printf ("ERROR: two consecutive free blocks\n");
}
}
//
// Z_FileDumpHeap
//
void Z_FileDumpHeap (FILE* f)
{
memblock_t* block;
fprintf (f,"zone size: %i location: %p\n",mainzone->size,mainzone);
for (block = mainzone->blocklist.next ; ; block = block->next)
{
fprintf (f,"block:%p size:%7i user:%p tag:%3i\n",
block, block->size, block->user, block->tag);
if (block->next == &mainzone->blocklist)
{
// all blocks have been hit
break;
}
if ( (byte *)block + block->size != (byte *)block->next)
fprintf (f,"ERROR: block size does not touch the next block\n");
if ( block->next->prev != block)
fprintf (f,"ERROR: next block doesn't have proper back link\n");
if (!block->user && !block->next->user)
fprintf (f,"ERROR: two consecutive free blocks\n");
}
}
//
// Z_CheckHeap
//
void Z_CheckHeap (void)
{
memblock_t* block;
for (block = mainzone->blocklist.next ; ; block = block->next)
{
if (block->next == &mainzone->blocklist)
{
// all blocks have been hit
break;
}
if ( (byte *)block + block->size != (byte *)block->next)
I_Error ("Z_CheckHeap: block size does not touch the next block\n");
if ( block->next->prev != block)
I_Error ("Z_CheckHeap: next block doesn't have proper back link\n");
if (!block->user && !block->next->user)
I_Error ("Z_CheckHeap: two consecutive free blocks\n");
}
}
//
// Z_ChangeTag
//
void
Z_ChangeTag2
( void* ptr,
int tag )
{
memblock_t* block;
block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
if (block->id != ZONEID)
I_Error ("Z_ChangeTag: freed a pointer without ZONEID");
if (tag >= PU_PURGELEVEL && (unsigned)block->user < 0x100)
I_Error ("Z_ChangeTag: an owner is required for purgable blocks");
block->tag = tag;
}
//
// Z_FreeMemory
//
int Z_FreeMemory (void)
{
memblock_t* block;
int free;
free = 0;
for (block = mainzone->blocklist.next ;
block != &mainzone->blocklist;
block = block->next)
{
if (!block->user || block->tag >= PU_PURGELEVEL)
free += block->size;
}
return free;
}
--- NEW FILE: p_lights.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_lights.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_lights.c,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Handle Sector base lighting effects.
// Muzzle flash?
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_lights.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "m_random.h"
#include "doomdef.h"
#include "p_local.h"
// State.
#include "r_state.h"
//
// FIRELIGHT FLICKER
//
//
// T_FireFlicker
//
void T_FireFlicker (fireflicker_t* flick)
{
int amount;
if (--flick->count)
return;
amount = (P_Random()&3)*16;
if (flick->sector->lightlevel - amount < flick->minlight)
flick->sector->lightlevel = flick->minlight;
else
flick->sector->lightlevel = flick->maxlight - amount;
flick->count = 4;
}
//
// P_SpawnFireFlicker
//
void P_SpawnFireFlicker (sector_t* sector)
{
fireflicker_t* flick;
// Note that we are resetting sector attributes.
// Nothing special about it during gameplay.
sector->special = 0;
flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);
P_AddThinker (&flick->thinker);
flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
flick->sector = sector;
flick->maxlight = sector->lightlevel;
flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
flick->count = 4;
}
//
// BROKEN LIGHT FLASHING
//
//
// T_LightFlash
// Do flashing lights.
//
void T_LightFlash (lightflash_t* flash)
{
if (--flash->count)
return;
if (flash->sector->lightlevel == flash->maxlight)
{
flash-> sector->lightlevel = flash->minlight;
flash->count = (P_Random()&flash->mintime)+1;
}
else
{
flash-> sector->lightlevel = flash->maxlight;
flash->count = (P_Random()&flash->maxtime)+1;
}
}
//
// P_SpawnLightFlash
// After the map has been loaded, scan each sector
// for specials that spawn thinkers
//
void P_SpawnLightFlash (sector_t* sector)
{
lightflash_t* flash;
// nothing special about it during gameplay
sector->special = 0;
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker (&flash->thinker);
flash->thinker.function.acp1 = (actionf_p1) T_LightFlash;
flash->sector = sector;
flash->maxlight = sector->lightlevel;
flash->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
flash->maxtime = 64;
flash->mintime = 7;
flash->count = (P_Random()&flash->maxtime)+1;
}
//
// STROBE LIGHT FLASHING
//
//
// T_StrobeFlash
//
void T_StrobeFlash (strobe_t* flash)
{
if (--flash->count)
return;
if (flash->sector->lightlevel == flash->minlight)
{
flash-> sector->lightlevel = flash->maxlight;
flash->count = flash->brighttime;
}
else
{
flash-> sector->lightlevel = flash->minlight;
flash->count =flash->darktime;
}
}
//
// P_SpawnStrobeFlash
// After the map has been loaded, scan each sector
// for specials that spawn thinkers
//
void
P_SpawnStrobeFlash
( sector_t* sector,
int fastOrSlow,
int inSync )
{
strobe_t* flash;
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker (&flash->thinker);
flash->sector = sector;
flash->darktime = fastOrSlow;
flash->brighttime = STROBEBRIGHT;
flash->thinker.function.acp1 = (actionf_p1) T_StrobeFlash;
flash->maxlight = sector->lightlevel;
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
if (flash->minlight == flash->maxlight)
flash->minlight = 0;
// nothing special about it during gameplay
sector->special = 0;
if (!inSync)
flash->count = (P_Random()&7)+1;
else
flash->count = 1;
}
//
// Start strobing lights (usually from a trigger)
//
void EV_StartLightStrobing(line_t* line)
{
int secnum;
sector_t* sec;
secnum = -1;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
P_SpawnStrobeFlash (sec,SLOWDARK, 0);
}
}
//
// TURN LINE'S TAG LIGHTS OFF
//
void EV_TurnTagLightsOff(line_t* line)
{
int i;
int j;
int min;
sector_t* sector;
sector_t* tsec;
line_t* templine;
sector = sectors;
for (j = 0;j < numsectors; j++, sector++)
{
if (sector->tag == line->tag)
{
min = sector->lightlevel;
for (i = 0;i < sector->linecount; i++)
{
templine = sector->lines[i];
tsec = getNextSector(templine,sector);
if (!tsec)
continue;
if (tsec->lightlevel < min)
min = tsec->lightlevel;
}
sector->lightlevel = min;
}
}
}
//
// TURN LINE'S TAG LIGHTS ON
//
void
EV_LightTurnOn
( line_t* line,
int bright )
{
int i;
int j;
sector_t* sector;
sector_t* temp;
line_t* templine;
sector = sectors;
for (i=0;i<numsectors;i++, sector++)
{
if (sector->tag == line->tag)
{
// bright = 0 means to search
// for highest light level
// surrounding sector
if (!bright)
{
for (j = 0;j < sector->linecount; j++)
{
templine = sector->lines[j];
temp = getNextSector(templine,sector);
if (!temp)
continue;
if (temp->lightlevel > bright)
bright = temp->lightlevel;
}
}
sector-> lightlevel = bright;
}
}
}
//
// Spawn glowing light
//
void T_Glow(glow_t* g)
{
switch(g->direction)
{
case -1:
// DOWN
g->sector->lightlevel -= GLOWSPEED;
if (g->sector->lightlevel <= g->minlight)
{
g->sector->lightlevel += GLOWSPEED;
g->direction = 1;
}
break;
case 1:
// UP
g->sector->lightlevel += GLOWSPEED;
if (g->sector->lightlevel >= g->maxlight)
{
g->sector->lightlevel -= GLOWSPEED;
g->direction = -1;
}
break;
}
}
void P_SpawnGlowingLight(sector_t* sector)
{
glow_t* g;
g = Z_Malloc( sizeof(*g), PU_LEVSPEC, 0);
P_AddThinker(&g->thinker);
g->sector = sector;
g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
g->maxlight = sector->lightlevel;
g->thinker.function.acp1 = (actionf_p1) T_Glow;
g->direction = -1;
sector->special = 0;
}
--- NEW FILE: hu_lib.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: hu_lib.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: hu_lib.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION: heads-up text and input code
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: hu_lib.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include <ctype.h>
#include "m_swap.h"
#include "doomdef.h"
#include "v_video.h"
#include "hu_lib.h"
#include "r_local.h"
#include "r_draw.h"
// boolean : whether the screen is always erased
#define noterased viewwindowx
extern boolean automapactive; // in AM_map.c
void HUlib_init(void)
{
}
void HUlib_clearTextLine(hu_textline_t* t)
{
t->len = 0;
t->l[0] = 0;
t->needsupdate = true;
}
void
HUlib_initTextLine
( hu_textline_t* t,
int x,
int y,
patch_t** f,
int sc )
{
t->x = x;
t->y = y;
t->f = f;
t->sc = sc;
HUlib_clearTextLine(t);
}
boolean
HUlib_addCharToTextLine
( hu_textline_t* t,
char ch )
{
if (t->len == HU_MAXLINELENGTH)
return false;
else
{
t->l[t->len++] = ch;
t->l[t->len] = 0;
t->needsupdate = 4;
return true;
}
}
boolean HUlib_delCharFromTextLine(hu_textline_t* t)
{
if (!t->len) return false;
else
{
t->l[--t->len] = 0;
t->needsupdate = 4;
return true;
}
}
void
HUlib_drawTextLine
( hu_textline_t* l,
boolean drawcursor )
{
int i;
int w;
int x;
unsigned char c;
// draw the new stuff
x = l->x;
for (i=0;i<l->len;i++)
{
c = toupper(l->l[i]);
if (c != ' '
&& c >= l->sc
&& c <= '_')
{
w = SHORT(l->f[c - l->sc]->width);
if (x+w > SCREENWIDTH)
break;
V_DrawPatchDirect(x, l->y, FG, l->f[c - l->sc]);
x += w;
}
else
{
x += 4;
if (x >= SCREENWIDTH)
break;
}
}
// draw the cursor if requested
if (drawcursor
&& x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH)
{
V_DrawPatchDirect(x, l->y, FG, l->f['_' - l->sc]);
}
}
// sorta called by HU_Erase and just better darn get things straight
void HUlib_eraseTextLine(hu_textline_t* l)
{
int lh;
int y;
int yoffset;
static boolean lastautomapactive = true;
// 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 (!automapactive &&
viewwindowx && l->needsupdate)
{
lh = SHORT(l->f[0]->height) + 1;
for (y=l->y,yoffset=y*SCREENWIDTH ; y<l->y+lh ; y++,yoffset+=SCREENWIDTH)
{
if (y < viewwindowy || y >= viewwindowy + viewheight)
R_VideoErase(yoffset, SCREENWIDTH); // erase entire line
else
{
R_VideoErase(yoffset, viewwindowx); // erase left border
R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx);
// erase right border
}
}
}
lastautomapactive = automapactive;
if (l->needsupdate) l->needsupdate--;
}
void
HUlib_initSText
( hu_stext_t* s,
int x,
int y,
int h,
patch_t** font,
int startchar,
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*(SHORT(font[0]->height)+1),
font, startchar);
}
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;
}
void
HUlib_addMessageToSText
( hu_stext_t* s,
char* prefix,
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++));
}
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
}
}
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;
}
void
HUlib_initIText
( hu_itext_t* it,
int x,
int y,
patch_t** font,
int startchar,
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);
}
// The following deletion routines adhere to the left margin restriction
void HUlib_delCharFromIText(hu_itext_t* it)
{
if (it->l.len != it->lm)
HUlib_delCharFromTextLine(&it->l);
}
void HUlib_eraseLineFromIText(hu_itext_t* it)
{
while (it->lm != it->l.len)
HUlib_delCharFromTextLine(&it->l);
}
// Resets left margin as well
void HUlib_resetIText(hu_itext_t* it)
{
it->lm = 0;
HUlib_clearTextLine(&it->l);
}
void
HUlib_addPrefixToIText
( hu_itext_t* it,
char* str )
{
while (*str)
HUlib_addCharToTextLine(&it->l, *(str++));
it->lm = it->l.len;
}
// wrapper function for handling general keyed 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)
HUlib_delCharFromIText(it);
else
if (ch != KEY_ENTER)
return false; // did not eat key
return true; // ate the key
}
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
}
void HUlib_eraseIText(hu_itext_t* it)
{
if (it->laston && !*it->on)
it->l.needsupdate = 4;
HUlib_eraseTextLine(&it->l);
it->laston = *it->on;
}
--- NEW FILE: tables.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: tables.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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__
#ifndef PI
#define PI 3.141592657
#endif
#include "m_fixed.h"
#define FINEANGLES 8192
#define FINEMASK (FINEANGLES-1)
// 0x100000000 to 0x2000
#define ANGLETOFINESHIFT 19
// Effective size is 10240.
extern fixed_t finesine[5*FINEANGLES/4];
// Re-use data, is just PI/2 pahse shift.
extern fixed_t* finecosine;
// Effective size is 4096.
extern fixed_t finetangent[FINEANGLES/2];
// Binary Angle Measument, BAM.
#define ANG45 0x20000000
#define ANG90 0x40000000
#define ANG180 0x80000000
#define ANG270 0xc0000000
#define SLOPERANGE 2048
#define SLOPEBITS 11
#define DBITS (FRACBITS-SLOPEBITS)
typedef unsigned angle_t;
// 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
//-----------------------------------------------------------------------------
//
// $Log: tables.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: d_net.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_net.c,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: d_net.c,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// DOOM Network game communication and protocol,
// all OS independend parts.
//
//-----------------------------------------------------------------------------
static const char rcsid[] = "$Id: d_net.c,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $";
#include "m_menu.h"
#include "i_system.h"
#include "i_video.h"
#include "i_net.h"
#include "g_game.h"
#include "doomdef.h"
#include "doomstat.h"
#define NCMD_EXIT 0x80000000
#define NCMD_RETRANSMIT 0x40000000
#define NCMD_SETUP 0x20000000
#define NCMD_KILL 0x10000000 // kill game
#define NCMD_CHECKSUM 0x0fffffff
doomcom_t* doomcom;
doomdata_t* netbuffer; // points inside doomcom
//
// NETWORKING
//
// gametic is the tic about to (or currently being) run
// maketic is the tick that hasn't had control made for it yet
// nettics[] has the maketics for all players
//
// a gametic cannot be run until nettics[] > gametic for all players
//
#define RESENDCOUNT 10
#define PL_DRONE 0x80 // bit flag in doomdata->player
ticcmd_t localcmds[BACKUPTICS];
ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
int nettics[MAXNETNODES];
boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
boolean remoteresend[MAXNETNODES]; // set when local needs tics
int resendto[MAXNETNODES]; // set when remote needs tics
int resendcount[MAXNETNODES];
int nodeforplayer[MAXPLAYERS];
int maketic;
int lastnettic;
int skiptics;
int ticdup;
int maxsend; // BACKUPTICS/(2*ticdup)-1
void D_ProcessEvents (void);
void G_BuildTiccmd (ticcmd_t *cmd);
void D_DoAdvanceDemo (void);
boolean reboundpacket;
doomdata_t reboundstore;
//
//
//
int NetbufferSize (void)
{
return (int)&(((doomdata_t *)0)->cmds[netbuffer->numtics]);
}
//
// Checksum
//
unsigned NetbufferChecksum (void)
{
unsigned c;
int i,l;
c = 0x1234567;
// FIXME -endianess?
#ifdef NORMALUNIX
return 0; // byte order problems
#endif
l = (NetbufferSize () - (int)&(((doomdata_t *)0)->retransmitfrom))/4;
for (i=0 ; i<l ; i++)
c += ((unsigned *)&netbuffer->retransmitfrom)[i] * (i+1);
return c & NCMD_CHECKSUM;
}
//
//
//
int ExpandTics (int low)
{
int delta;
delta = low - (maketic&0xff);
if (delta >= -64 && delta <= 64)
return (maketic&~0xff) + low;
if (delta > 64)
return (maketic&~0xff) - 256 + low;
if (delta < -64)
return (maketic&~0xff) + 256 + low;
I_Error ("ExpandTics: strange value %i at maketic %i",low,maketic);
return 0;
}
//
// HSendPacket
//
void
HSendPacket
(int node,
int flags )
{
netbuffer->checksum = NetbufferChecksum () | flags;
if (!node)
{
reboundstore = *netbuffer;
reboundpacket = true;
return;
}
if (demoplayback)
return;
if (!netgame)
I_Error ("Tried to transmit to another node");
doomcom->command = CMD_SEND;
doomcom->remotenode = node;
doomcom->datalength = NetbufferSize ();
if (debugfile)
{
int i;
int realretrans;
if (netbuffer->checksum & NCMD_RETRANSMIT)
realretrans = ExpandTics (netbuffer->retransmitfrom);
else
realretrans = -1;
fprintf (debugfile,"send (%i + %i, R %i) [%i] ",
ExpandTics(netbuffer->starttic),
netbuffer->numtics, realretrans, doomcom->datalength);
for (i=0 ; i<doomcom->datalength ; i++)
fprintf (debugfile,"%i ",((byte *)netbuffer)[i]);
fprintf (debugfile,"\n");
}
I_NetCmd ();
}
//
// HGetPacket
// Returns false if no packet is waiting
//
boolean HGetPacket (void)
{
if (reboundpacket)
{
*netbuffer = reboundstore;
doomcom->remotenode = 0;
reboundpacket = false;
return true;
}
if (!netgame)
return false;
if (demoplayback)
return false;
doomcom->command = CMD_GET;
I_NetCmd ();
if (doomcom->remotenode == -1)
return false;
if (doomcom->datalength != NetbufferSize ())
{
if (debugfile)
fprintf (debugfile,"bad packet length %i\n",doomcom->datalength);
return false;
}
if (NetbufferChecksum () != (netbuffer->checksum&NCMD_CHECKSUM) )
{
if (debugfile)
fprintf (debugfile,"bad packet checksum\n");
return false;
}
if (debugfile)
{
int realretrans;
int i;
if (netbuffer->checksum & NCMD_SETUP)
fprintf (debugfile,"setup packet\n");
else
{
if (netbuffer->checksum & NCMD_RETRANSMIT)
realretrans = ExpandTics (netbuffer->retransmitfrom);
else
realretrans = -1;
fprintf (debugfile,"get %i = (%i + %i, R %i)[%i] ",
doomcom->remotenode,
ExpandTics(netbuffer->starttic),
netbuffer->numtics, realretrans, doomcom->datalength);
for (i=0 ; i<doomcom->datalength ; i++)
fprintf (debugfile,"%i ",((byte *)netbuffer)[i]);
fprintf (debugfile,"\n");
}
}
return true;
}
//
// GetPackets
//
char exitmsg[80];
void GetPackets (void)
{
int netconsole;
int netnode;
ticcmd_t *src, *dest;
int realend;
int realstart;
while ( HGetPacket() )
{
if (netbuffer->checksum & NCMD_SETUP)
continue; // extra setup packet
netconsole = netbuffer->player & ~PL_DRONE;
netnode = doomcom->remotenode;
// to save bytes, only the low byte of tic numbers are sent
// Figure out what the rest of the bytes are
realstart = ExpandTics (netbuffer->starttic);
realend = (realstart+netbuffer->numtics);
// check for exiting the game
if (netbuffer->checksum & NCMD_EXIT)
{
if (!nodeingame[netnode])
continue;
nodeingame[netnode] = false;
playeringame[netconsole] = false;
strcpy (exitmsg, "Player 1 left the game");
exitmsg[7] += netconsole;
players[consoleplayer].message = exitmsg;
if (demorecording)
G_CheckDemoStatus ();
continue;
}
// check for a remote game kill
if (netbuffer->checksum & NCMD_KILL)
I_Error ("Killed by network driver");
nodeforplayer[netconsole] = netnode;
// check for retransmit request
if ( resendcount[netnode] <= 0
&& (netbuffer->checksum & NCMD_RETRANSMIT) )
{
resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
if (debugfile)
fprintf (debugfile,"retransmit from %i\n", resendto[netnode]);
resendcount[netnode] = RESENDCOUNT;
}
else
resendcount[netnode]--;
// check for out of order / duplicated packet
if (realend == nettics[netnode])
continue;
if (realend < nettics[netnode])
{
if (debugfile)
fprintf (debugfile,
"out of order packet (%i + %i)\n" ,
realstart,netbuffer->numtics);
continue;
}
// check for a missed packet
if (realstart > nettics[netnode])
{
// stop processing until the other system resends the missed tics
if (debugfile)
fprintf (debugfile,
"missed tics from %i (%i - %i)\n",
netnode, realstart, nettics[netnode]);
remoteresend[netnode] = true;
continue;
}
// update command store from the packet
{
int start;
remoteresend[netnode] = false;
start = nettics[netnode] - realstart;
src = &netbuffer->cmds[start];
while (nettics[netnode] < realend)
{
dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS];
nettics[netnode]++;
*dest = *src;
src++;
}
}
}
}
//
// NetUpdate
// Builds ticcmds for console player,
// sends out a packet
//
int gametime;
void NetUpdate (void)
{
int nowtime;
int newtics;
int i,j;
int realstart;
int gameticdiv;
// check time
nowtime = I_GetTime ()/ticdup;
newtics = nowtime - gametime;
gametime = nowtime;
if (newtics <= 0) // nothing new to update
goto listen;
if (skiptics <= newtics)
{
newtics -= skiptics;
skiptics = 0;
}
else
{
skiptics -= newtics;
newtics = 0;
}
netbuffer->player = consoleplayer;
// build new ticcmds for console player
gameticdiv = gametic/ticdup;
for (i=0 ; i<newtics ; i++)
{
I_StartTic ();
D_ProcessEvents ();
if (maketic - gameticdiv >= BACKUPTICS/2-1)
break; // can't hold any more
//printf ("mk:%i ",maketic);
G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
maketic++;
}
if (singletics)
return; // singletic update is syncronous
// send the packet to the other nodes
for (i=0 ; i<doomcom->numnodes ; i++)
if (nodeingame[i])
{
netbuffer->starttic = realstart = resendto[i];
netbuffer->numtics = maketic - realstart;
if (netbuffer->numtics > BACKUPTICS)
I_Error ("NetUpdate: netbuffer->numtics > BACKUPTICS");
resendto[i] = maketic - doomcom->extratics;
for (j=0 ; j< netbuffer->numtics ; j++)
netbuffer->cmds[j] =
localcmds[(realstart+j)%BACKUPTICS];
if (remoteresend[i])
{
netbuffer->retransmitfrom = nettics[i];
HSendPacket (i, NCMD_RETRANSMIT);
}
else
{
netbuffer->retransmitfrom = 0;
HSendPacket (i, 0);
}
}
// listen for other packets
listen:
GetPackets ();
}
//
// CheckAbort
//
void CheckAbort (void)
{
event_t *ev;
int stoptic;
stoptic = I_GetTime () + 2;
while (I_GetTime() < stoptic)
I_StartTic ();
I_StartTic ();
for ( ; eventtail != eventhead
; eventtail = (++eventtail)&(MAXEVENTS-1) )
{
ev = &events[eventtail];
if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
I_Error ("Network game synchronization aborted.");
}
}
//
// D_ArbitrateNetStart
//
void D_ArbitrateNetStart (void)
{
int i;
boolean gotinfo[MAXNETNODES];
autostart = true;
memset (gotinfo,0,sizeof(gotinfo));
if (doomcom->consoleplayer)
{
// listen for setup info from key player
printf ("listening for network start info...\n");
while (1)
{
CheckAbort ();
if (!HGetPacket ())
continue;
if (netbuffer->checksum & NCMD_SETUP)
{
if (netbuffer->player != VERSION_NUM)
I_Error ("Different DOOM versions cannot play a net game!");
startskill = netbuffer->retransmitfrom & 15;
deathmatch = (netbuffer->retransmitfrom & 0xc0) >> 6;
nomonsters = (netbuffer->retransmitfrom & 0x20) > 0;
respawnparm = (netbuffer->retransmitfrom & 0x10) > 0;
startmap = netbuffer->starttic & 0x3f;
startepisode = netbuffer->starttic >> 6;
return;
}
}
}
else
{
// key player, send the setup info
printf ("sending network start info...\n");
do
{
CheckAbort ();
for (i=0 ; i<doomcom->numnodes ; i++)
{
netbuffer->retransmitfrom = startskill;
if (deathmatch)
netbuffer->retransmitfrom |= (deathmatch<<6);
if (nomonsters)
netbuffer->retransmitfrom |= 0x20;
if (respawnparm)
netbuffer->retransmitfrom |= 0x10;
netbuffer->starttic = startepisode * 64 + startmap;
netbuffer->player = VERSION_NUM;
netbuffer->numtics = 0;
HSendPacket (i, NCMD_SETUP);
}
#if 1
for(i = 10 ; i && HGetPacket(); --i)
{
if((netbuffer->player&0x7f) < MAXNETNODES)
gotinfo[netbuffer->player&0x7f] = true;
}
#else
while (HGetPacket ())
{
gotinfo[netbuffer->player&0x7f] = true;
}
#endif
for (i=1 ; i<doomcom->numnodes ; i++)
if (!gotinfo[i])
break;
} while (i < doomcom->numnodes);
}
}
//
// D_CheckNetGame
// Works out player numbers among the net participants
//
extern int viewangleoffset;
void D_CheckNetGame (void)
{
int i;
for (i=0 ; i<MAXNETNODES ; i++)
{
nodeingame[i] = false;
nettics[i] = 0;
remoteresend[i] = false; // set when local needs tics
resendto[i] = 0; // which tic to start sending
}
// I_InitNetwork sets doomcom and netgame
I_InitNetwork ();
if (doomcom->id != DOOMCOM_ID)
I_Error ("Doomcom buffer invalid!");
netbuffer = &doomcom->data;
consoleplayer = displayplayer = doomcom->consoleplayer;
if (netgame)
D_ArbitrateNetStart ();
printf ("startskill %i deathmatch: %i startmap: %i startepisode: %i\n",
startskill, deathmatch, startmap, startepisode);
// read values out of doomcom
ticdup = doomcom->ticdup;
maxsend = BACKUPTICS/(2*ticdup)-1;
if (maxsend<1)
maxsend = 1;
for (i=0 ; i<doomcom->numplayers ; i++)
playeringame[i] = true;
for (i=0 ; i<doomcom->numnodes ; i++)
nodeingame[i] = true;
printf ("player %i of %i (%i nodes)\n",
consoleplayer+1, doomcom->numplayers, doomcom->numnodes);
}
//
// D_QuitNetGame
// Called before quitting to leave a net game
// without hanging the other players
//
void D_QuitNetGame (void)
{
int i, j;
if (debugfile)
fclose (debugfile);
if (!netgame || !usergame || consoleplayer == -1 || demoplayback)
return;
// send a bunch of packets for security
netbuffer->player = consoleplayer;
netbuffer->numtics = 0;
for (i=0 ; i<4 ; i++)
{
for (j=1 ; j<doomcom->numnodes ; j++)
if (nodeingame[j])
HSendPacket (j, NCMD_EXIT);
I_WaitVBL (1);
}
}
//
// TryRunTics
//
int frametics[4];
int frameon;
int frameskip[4];
int oldnettics;
extern boolean advancedemo;
void TryRunTics (void)
{
int i;
int lowtic;
int entertic;
static int oldentertics;
int realtics;
int availabletics;
int counts;
int numplaying;
// get real tics
entertic = I_GetTime ()/ticdup;
realtics = entertic - oldentertics;
oldentertics = entertic;
// get available tics
NetUpdate ();
lowtic = MAXINT;
numplaying = 0;
for (i=0 ; i<doomcom->numnodes ; i++)
{
if (nodeingame[i])
{
numplaying++;
if (nettics[i] < lowtic)
lowtic = nettics[i];
}
}
availabletics = lowtic - gametic/ticdup;
// decide how many tics to run
if (realtics < availabletics-1)
counts = realtics+1;
else if (realtics < availabletics)
counts = realtics;
else
counts = availabletics;
if (counts < 1)
counts = 1;
frameon++;
if (debugfile)
fprintf (debugfile,
"=======real: %i avail: %i game: %i\n",
realtics, availabletics,counts);
if (!demoplayback)
{
// ideally nettics[0] should be 1 - 3 tics above lowtic
// if we are consistantly slower, speed up time
for (i=0 ; i<MAXPLAYERS ; i++)
if (playeringame[i])
break;
if (consoleplayer == i)
{
// the key player does not adapt
}
else
{
if (nettics[0] <= nettics[nodeforplayer[i]])
{
gametime--;
// printf ("-");
}
frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]);
oldnettics = nettics[0];
if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
{
skiptics = 1;
// printf ("+");
}
}
}// demoplayback
// wait for new tics if needed
while (lowtic < gametic/ticdup + counts)
{
NetUpdate ();
lowtic = MAXINT;
for (i=0 ; i<doomcom->numnodes ; i++)
if (nodeingame[i] && nettics[i] < lowtic)
lowtic = nettics[i];
if (lowtic < gametic/ticdup)
I_Error ("TryRunTics: lowtic < gametic");
// don't stay in here forever -- give the menu a chance to work
if (I_GetTime ()/ticdup - entertic >= 20)
{
M_Ticker ();
return;
}
}
// run the count * ticdup dics
while (counts--)
{
for (i=0 ; i<ticdup ; i++)
{
if (gametic/ticdup > lowtic)
I_Error ("gametic>lowtic");
if (advancedemo)
D_DoAdvanceDemo ();
M_Ticker ();
G_Ticker ();
gametic++;
// modify command for duplicated tics
if (i != ticdup-1)
{
ticcmd_t *cmd;
int buf;
int j;
buf = (gametic/ticdup)%BACKUPTICS;
for (j=0 ; j<MAXPLAYERS ; j++)
{
cmd = &netcmds[j][buf];
cmd->chatchar = 0;
if (cmd->buttons & BT_SPECIAL)
cmd->buttons = 0;
}
}
}
NetUpdate (); // check for new console commands
}
}
--- NEW FILE: m_fixed.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_fixed.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_fixed.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Fixed point implementation.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_fixed.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#include "stdlib.h"
#include "doomtype.h"
#include "i_system.h"
#ifdef __GNUG__
#pragma implementation "m_fixed.h"
#endif
#include "m_fixed.h"
// Fixme. __USE_C_FIXED__ or something.
fixed_t
FixedMul
( fixed_t a,
fixed_t b )
{
return ((long long) a * (long long) b) >> FRACBITS;
}
//
// FixedDiv, C version.
//
fixed_t
FixedDiv
( fixed_t a,
fixed_t b )
{
if ( (abs(a)>>14) >= abs(b))
return (a^b)<0 ? MININT : MAXINT;
return FixedDiv2 (a,b);
}
fixed_t
FixedDiv2
( fixed_t a,
fixed_t b )
{
#if 0
long long c;
c = ((long long)a<<16) / ((long long)b);
return (fixed_t) c;
#endif
double c;
c = ((double)a) / ((double)b) * FRACUNIT;
if (c >= 2147483648.0 || c < -2147483648.0)
I_Error("FixedDiv: divide by zero");
return (fixed_t) c;
}
--- NEW FILE: r_bsp.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_bsp.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_bsp.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// BSP traversal, handling of LineSegs for rendering.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: r_bsp.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "doomdef.h"
#include "m_bbox.h"
#include "i_system.h"
#include "r_main.h"
#include "r_plane.h"
#include "r_things.h"
// State.
#include "doomstat.h"
#include "r_state.h"
//#include "r_local.h"
seg_t* curline;
side_t* sidedef;
line_t* linedef;
sector_t* frontsector;
sector_t* backsector;
drawseg_t drawsegs[MAXDRAWSEGS];
drawseg_t* ds_p;
void
R_StoreWallRange
( int start,
int stop );
//
// R_ClearDrawSegs
//
void R_ClearDrawSegs (void)
{
ds_p = drawsegs;
}
//
// ClipWallSegment
// Clips the given range of columns
// and includes it in the new clip list.
//
typedef struct
{
int first;
int last;
} cliprange_t;
#define MAXSEGS 32
// newend is one past the last valid seg
cliprange_t* newend;
cliprange_t solidsegs[MAXSEGS];
//
// R_ClipSolidWallSegment
// Does handle solid walls,
// e.g. single sided LineDefs (middle texture)
// that entirely block the view.
//
void
R_ClipSolidWallSegment
( int first,
int last )
{
cliprange_t* next;
cliprange_t* start;
// Find the first range that touches the range
// (adjacent pixels are touching).
start = solidsegs;
while (start->last < first-1)
start++;
if (first < start->first)
{
if (last < start->first-1)
{
// Post is entirely visible (above start),
// so insert a new clippost.
R_StoreWallRange (first, last);
next = newend;
newend++;
while (next != start)
{
*next = *(next-1);
next--;
}
next->first = first;
next->last = last;
return;
}
// There is a fragment above *start.
R_StoreWallRange (first, start->first - 1);
// Now adjust the clip size.
start->first = first;
}
// Bottom contained in start?
if (last <= start->last)
return;
next = start;
while (last >= (next+1)->first-1)
{
// There is a fragment between two posts.
R_StoreWallRange (next->last + 1, (next+1)->first - 1);
next++;
if (last <= next->last)
{
// Bottom is contained in next.
// Adjust the clip size.
start->last = next->last;
goto crunch;
}
}
// There is a fragment after *next.
R_StoreWallRange (next->last + 1, last);
// Adjust the clip size.
start->last = last;
// Remove start+1 to next from the clip list,
// because start now covers their area.
crunch:
if (next == start)
{
// Post just extended past the bottom of one post.
return;
}
while (next++ != newend)
{
// Remove a post.
*++start = *next;
}
newend = start+1;
}
//
// R_ClipPassWallSegment
// Clips the given range of columns,
// but does not includes it in the clip list.
// Does handle windows,
// e.g. LineDefs with upper and lower texture.
//
void
R_ClipPassWallSegment
( int first,
int last )
{
cliprange_t* start;
// Find the first range that touches the range
// (adjacent pixels are touching).
start = solidsegs;
while (start->last < first-1)
start++;
if (first < start->first)
{
if (last < start->first-1)
{
// Post is entirely visible (above start).
R_StoreWallRange (first, last);
return;
}
// There is a fragment above *start.
R_StoreWallRange (first, start->first - 1);
}
// Bottom contained in start?
if (last <= start->last)
return;
while (last >= (start+1)->first-1)
{
// There is a fragment between two posts.
R_StoreWallRange (start->last + 1, (start+1)->first - 1);
start++;
if (last <= start->last)
return;
}
// There is a fragment after *next.
R_StoreWallRange (start->last + 1, last);
}
//
// R_ClearClipSegs
//
void R_ClearClipSegs (void)
{
solidsegs[0].first = -0x7fffffff;
solidsegs[0].last = -1;
solidsegs[1].first = viewwidth;
solidsegs[1].last = 0x7fffffff;
newend = solidsegs+2;
}
//
// R_AddLine
// Clips the given segment
// and adds any visible pieces to the line list.
//
void R_AddLine (seg_t* line)
{
int x1;
int x2;
angle_t angle1;
angle_t angle2;
angle_t span;
angle_t tspan;
curline = line;
// OPTIMIZE: quickly reject orthogonal back sides.
angle1 = R_PointToAngle (line->v1->x, line->v1->y);
angle2 = R_PointToAngle (line->v2->x, line->v2->y);
// Clip to view edges.
// OPTIMIZE: make constant out of 2*clipangle (FIELDOFVIEW).
span = angle1 - angle2;
// Back side? I.e. backface culling?
if (span >= ANG180)
return;
// Global angle needed by segcalc.
rw_angle1 = angle1;
angle1 -= viewangle;
angle2 -= viewangle;
tspan = angle1 + clipangle;
if (tspan > 2*clipangle)
{
tspan -= 2*clipangle;
// Totally off the left edge?
if (tspan >= span)
return;
angle1 = clipangle;
}
tspan = clipangle - angle2;
if (tspan > 2*clipangle)
{
tspan -= 2*clipangle;
// Totally off the left edge?
if (tspan >= span)
return;
angle2 = -clipangle;
}
// The seg is in the view range,
// but not necessarily visible.
angle1 = (angle1+ANG90)>>ANGLETOFINESHIFT;
angle2 = (angle2+ANG90)>>ANGLETOFINESHIFT;
x1 = viewangletox[angle1];
x2 = viewangletox[angle2];
// Does not cross a pixel?
if (x1 == x2)
return;
backsector = line->backsector;
// Single sided line?
if (!backsector)
goto clipsolid;
// Closed door.
if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight)
goto clipsolid;
// Window.
if (backsector->ceilingheight != frontsector->ceilingheight
|| backsector->floorheight != frontsector->floorheight)
goto clippass;
// Reject empty lines used for triggers
// and special events.
// Identical floor and ceiling on both sides,
// identical light levels on both sides,
// and no middle texture.
if (backsector->ceilingpic == frontsector->ceilingpic
&& backsector->floorpic == frontsector->floorpic
&& backsector->lightlevel == frontsector->lightlevel
&& curline->sidedef->midtexture == 0)
{
return;
}
clippass:
R_ClipPassWallSegment (x1, x2-1);
return;
clipsolid:
R_ClipSolidWallSegment (x1, x2-1);
}
//
// R_CheckBBox
// Checks BSP node/subtree bounding box.
// Returns true
// if some part of the bbox might be visible.
//
int checkcoord[12][4] =
{
{3,0,2,1},
{3,0,2,0},
{3,1,2,0},
{0},
{2,0,2,1},
{0,0,0,0},
{3,1,3,0},
{0},
{2,0,3,1},
{2,1,3,1},
{2,1,3,0}
};
boolean R_CheckBBox (fixed_t* bspcoord)
{
int boxx;
int boxy;
int boxpos;
fixed_t x1;
fixed_t y1;
fixed_t x2;
fixed_t y2;
angle_t angle1;
angle_t angle2;
angle_t span;
angle_t tspan;
cliprange_t* start;
int sx1;
int sx2;
// Find the corners of the box
// that define the edges from current viewpoint.
if (viewx <= bspcoord[BOXLEFT])
boxx = 0;
else if (viewx < bspcoord[BOXRIGHT])
boxx = 1;
else
boxx = 2;
if (viewy >= bspcoord[BOXTOP])
boxy = 0;
else if (viewy > bspcoord[BOXBOTTOM])
boxy = 1;
else
boxy = 2;
boxpos = (boxy<<2)+boxx;
if (boxpos == 5)
return true;
x1 = bspcoord[checkcoord[boxpos][0]];
y1 = bspcoord[checkcoord[boxpos][1]];
x2 = bspcoord[checkcoord[boxpos][2]];
y2 = bspcoord[checkcoord[boxpos][3]];
// check clip list for an open space
angle1 = R_PointToAngle (x1, y1) - viewangle;
angle2 = R_PointToAngle (x2, y2) - viewangle;
span = angle1 - angle2;
// Sitting on a line?
if (span >= ANG180)
return true;
tspan = angle1 + clipangle;
if (tspan > 2*clipangle)
{
tspan -= 2*clipangle;
// Totally off the left edge?
if (tspan >= span)
return false;
angle1 = clipangle;
}
tspan = clipangle - angle2;
if (tspan > 2*clipangle)
{
tspan -= 2*clipangle;
// Totally off the left edge?
if (tspan >= span)
return false;
angle2 = -clipangle;
}
// Find the first clippost
// that touches the source post
// (adjacent pixels are touching).
angle1 = (angle1+ANG90)>>ANGLETOFINESHIFT;
angle2 = (angle2+ANG90)>>ANGLETOFINESHIFT;
sx1 = viewangletox[angle1];
sx2 = viewangletox[angle2];
// Does not cross a pixel.
if (sx1 == sx2)
return false;
sx2--;
start = solidsegs;
while (start->last < sx2)
start++;
if (sx1 >= start->first
&& sx2 <= start->last)
{
// The clippost contains the new span.
return false;
}
return true;
}
//
// R_Subsector
// Determine floor/ceiling planes.
// Add sprites of things in sector.
// Draw one or more line segments.
//
void R_Subsector (int num)
{
int count;
seg_t* line;
subsector_t* sub;
#ifdef RANGECHECK
if (num>=numsubsectors)
I_Error ("R_Subsector: ss %i with numss = %i",
num,
numsubsectors);
#endif
sscount++;
sub = &subsectors[num];
frontsector = sub->sector;
count = sub->numlines;
line = &segs[sub->firstline];
if (frontsector->floorheight < viewz)
{
floorplane = R_FindPlane (frontsector->floorheight,
frontsector->floorpic,
frontsector->lightlevel);
}
else
floorplane = NULL;
if (frontsector->ceilingheight > viewz
|| frontsector->ceilingpic == skyflatnum)
{
ceilingplane = R_FindPlane (frontsector->ceilingheight,
frontsector->ceilingpic,
frontsector->lightlevel);
}
else
ceilingplane = NULL;
R_AddSprites (frontsector);
while (count--)
{
R_AddLine (line);
line++;
}
}
//
// RenderBSPNode
// Renders all subsectors below a given node,
// traversing subtree recursively.
// Just call with BSP root.
void R_RenderBSPNode (int bspnum)
{
node_t* bsp;
int side;
// Found a subsector?
if (bspnum & NF_SUBSECTOR)
{
if (bspnum == -1)
R_Subsector (0);
else
R_Subsector (bspnum&(~NF_SUBSECTOR));
return;
}
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSide (viewx, viewy, bsp);
// Recursively divide front space.
R_RenderBSPNode (bsp->children[side]);
// Possibly divide back space.
if (R_CheckBBox (bsp->bbox[side^1]))
R_RenderBSPNode (bsp->children[side^1]);
}
--- NEW FILE: AUTHORS ---
nxDOOM - A Microwindows port of SDL Doom 1.0 which was based
on ID Software DOOM.
nxDOOM was ported by Greg Haerr and Jason Kingan of Century Sofware.
http://embedded.censoft.com
SDL Doom was created by Sam Lantinga (slouken at devolution.com)
ID Doom was created by ID Software
--- NEW FILE: d_net.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_net.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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
// Networking and tick handling related.
#define BACKUPTICS 12
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;
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.
void NetUpdate (void);
// Broadcasts special packets to other players
// to notify of game exit
void D_QuitNetGame (void);
//? how many ticks to run?
void TryRunTics (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_net.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: tables.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: tables.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: tables.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...2103 lines suppressed...]
513404160,513582432,513760640,513938784,514116800,514294752,514472608,514650368,
514828064,515005664,515183168,515360608,515537952,515715200,515892352,516069440,
516246432,516423328,516600160,516776896,516953536,517130112,517306592,517482976,
517659264,517835488,518011616,518187680,518363648,518539520,518715296,518891008,
519066624,519242144,519417600,519592960,519768256,519943424,520118528,520293568,
520468480,520643328,520818112,520992800,521167392,521341888,521516320,521690656,
521864896,522039072,522213152,522387168,522561056,522734912,522908640,523082304,
523255872,523429376,523602784,523776096,523949312,524122464,524295552,524468512,
524641440,524814240,524986976,525159616,525332192,525504640,525677056,525849344,
526021568,526193728,526365792,526537760,526709632,526881440,527053152,527224800,
527396352,527567840,527739200,527910528,528081728,528252864,528423936,528594880,
528765760,528936576,529107296,529277920,529448480,529618944,529789344,529959648,
530129856,530300000,530470048,530640000,530809888,530979712,531149440,531319072,
531488608,531658080,531827488,531996800,532166016,532335168,532504224,532673184,
532842080,533010912,533179616,533348288,533516832,533685312,533853728,534022048,
534190272,534358432,534526496,534694496,534862400,535030240,535197984,535365632,
535533216,535700704,535868128,536035456,536202720,536369888,536536992,536704000,
536870912
};
--- NEW FILE: m_bbox.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_bbox.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Nil.
//
//-----------------------------------------------------------------------------
#ifndef __M_BBOX__
#define __M_BBOX__
#include "doomtype.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
//-----------------------------------------------------------------------------
//
// $Log: m_bbox.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_bsp.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_bsp.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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;
extern int rw_x;
extern int rw_stopx;
extern boolean segtextured;
// false if the back side is the same plane
extern boolean markfloor;
extern boolean markceiling;
extern boolean skymap;
extern drawseg_t drawsegs[MAXDRAWSEGS];
extern drawseg_t* ds_p;
extern lighttable_t** hscalelight;
extern lighttable_t** vscalelight;
extern lighttable_t** dscalelight;
typedef void (*drawfunc_t) (int start, int stop);
// BSP?
void R_ClearClipSegs (void);
void R_ClearDrawSegs (void);
void R_RenderBSPNode (int bspnum);
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_bsp.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_saveg.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_saveg.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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);
extern byte* save_p;
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_saveg.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_doors.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_doors.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_doors.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION: Door animation code (opening/closing)
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_doors.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "doomdef.h"
#include "p_local.h"
#include "s_sound.h"
// State.
#include "doomstat.h"
#include "r_state.h"
// Data.
#include "dstrings.h"
#include "sounds.h"
#if 0
//
// Sliding door frame information
//
slidename_t slideFrameNames[MAXSLIDEDOORS] =
{
{"GDOORF1","GDOORF2","GDOORF3","GDOORF4", // front
"GDOORB1","GDOORB2","GDOORB3","GDOORB4"}, // back
{"\0","\0","\0","\0"}
};
#endif
//
// VERTICAL DOORS
//
//
// T_VerticalDoor
//
void T_VerticalDoor (vldoor_t* door)
{
result_e res;
switch(door->direction)
{
case 0:
// WAITING
if (!--door->topcountdown)
{
switch(door->type)
{
case blazeRaise:
door->direction = -1; // time to go back down
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_bdcls);
break;
case normal:
door->direction = -1; // time to go back down
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_dorcls);
break;
case close30ThenOpen:
door->direction = 1;
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_doropn);
break;
default:
break;
}
}
break;
case 2:
// INITIAL WAIT
if (!--door->topcountdown)
{
switch(door->type)
{
case raiseIn5Mins:
door->direction = 1;
door->type = normal;
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_doropn);
break;
default:
break;
}
}
break;
case -1:
// DOWN
res = T_MovePlane(door->sector,
door->speed,
door->sector->floorheight,
false,1,door->direction);
if (res == pastdest)
{
switch(door->type)
{
case blazeRaise:
case blazeClose:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); // unlink and free
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_bdcls);
break;
case normal:
case close:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); // unlink and free
break;
case close30ThenOpen:
door->direction = 0;
door->topcountdown = 35*30;
break;
default:
break;
}
}
else if (res == crushed)
{
switch(door->type)
{
case blazeClose:
case close: // DO NOT GO BACK UP!
break;
default:
door->direction = 1;
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_doropn);
break;
}
}
break;
case 1:
// UP
res = T_MovePlane(door->sector,
door->speed,
door->topheight,
false,1,door->direction);
if (res == pastdest)
{
switch(door->type)
{
case blazeRaise:
case normal:
door->direction = 0; // wait at top
door->topcountdown = door->topwait;
break;
case close30ThenOpen:
case blazeOpen:
case open:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); // unlink and free
break;
default:
break;
}
}
break;
}
}
//
// EV_DoLockedDoor
// Move a locked door up/down
//
int
EV_DoLockedDoor
( line_t* line,
vldoor_e type,
mobj_t* thing )
{
player_t* p;
p = thing->player;
if (!p)
return 0;
switch(line->special)
{
case 99: // Blue Lock
case 133:
if ( !p )
return 0;
if (!p->cards[it_bluecard] && !p->cards[it_blueskull])
{
p->message = PD_BLUEO;
S_StartSound(NULL,sfx_oof);
return 0;
}
break;
case 134: // Red Lock
case 135:
if ( !p )
return 0;
if (!p->cards[it_redcard] && !p->cards[it_redskull])
{
p->message = PD_REDO;
S_StartSound(NULL,sfx_oof);
return 0;
}
break;
case 136: // Yellow Lock
case 137:
if ( !p )
return 0;
if (!p->cards[it_yellowcard] &&
!p->cards[it_yellowskull])
{
p->message = PD_YELLOWO;
S_StartSound(NULL,sfx_oof);
return 0;
}
break;
}
return EV_DoDoor(line,type);
}
int
EV_DoDoor
( line_t* line,
vldoor_e type )
{
int secnum,rtn;
sector_t* sec;
vldoor_t* door;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
// new door thinker
rtn = 1;
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor;
door->sector = sec;
door->type = type;
door->topwait = VDOORWAIT;
door->speed = VDOORSPEED;
switch(type)
{
case blazeClose:
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->direction = -1;
door->speed = VDOORSPEED * 4;
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_bdcls);
break;
case close:
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->direction = -1;
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_dorcls);
break;
case close30ThenOpen:
door->topheight = sec->ceilingheight;
door->direction = -1;
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_dorcls);
break;
case blazeRaise:
case blazeOpen:
door->direction = 1;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->speed = VDOORSPEED * 4;
if (door->topheight != sec->ceilingheight)
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_bdopn);
break;
case normal:
case open:
door->direction = 1;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
if (door->topheight != sec->ceilingheight)
S_StartSound((mobj_t *)&door->sector->soundorg,
sfx_doropn);
break;
default:
break;
}
}
return rtn;
}
//
// EV_VerticalDoor : open a door manually, no tag value
//
void
EV_VerticalDoor
( line_t* line,
mobj_t* thing )
{
player_t* player;
int secnum;
sector_t* sec;
vldoor_t* door;
int side;
side = 0; // only front sides can be used
// Check for locks
player = thing->player;
switch(line->special)
{
case 26: // Blue Lock
case 32:
if ( !player )
return;
if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
{
player->message = PD_BLUEK;
S_StartSound(NULL,sfx_oof);
return;
}
break;
case 27: // Yellow Lock
case 34:
if ( !player )
return;
if (!player->cards[it_yellowcard] &&
!player->cards[it_yellowskull])
{
player->message = PD_YELLOWK;
S_StartSound(NULL,sfx_oof);
return;
}
break;
case 28: // Red Lock
case 33:
if ( !player )
return;
if (!player->cards[it_redcard] && !player->cards[it_redskull])
{
player->message = PD_REDK;
S_StartSound(NULL,sfx_oof);
return;
}
break;
}
// if the sector has an active thinker, use it
sec = sides[ line->sidenum[side^1]] .sector;
secnum = sec-sectors;
if (sec->specialdata)
{
door = sec->specialdata;
switch(line->special)
{
case 1: // ONLY FOR "RAISE" DOORS, NOT "OPEN"s
case 26:
case 27:
case 28:
case 117:
if (door->direction == -1)
door->direction = 1; // go back up
else
{
if (!thing->player)
return; // JDC: bad guys never close doors
door->direction = -1; // start going down immediately
}
return;
}
}
// for proper sound
switch(line->special)
{
case 117: // BLAZING DOOR RAISE
case 118: // BLAZING DOOR OPEN
S_StartSound((mobj_t *)&sec->soundorg,sfx_bdopn);
break;
case 1: // NORMAL DOOR SOUND
case 31:
S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn);
break;
default: // LOCKED DOOR SOUND
S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn);
break;
}
// new door thinker
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor;
door->sector = sec;
door->direction = 1;
door->speed = VDOORSPEED;
door->topwait = VDOORWAIT;
switch(line->special)
{
case 1:
case 26:
case 27:
case 28:
door->type = normal;
break;
case 31:
case 32:
case 33:
case 34:
door->type = open;
line->special = 0;
break;
case 117: // blazing door raise
door->type = blazeRaise;
door->speed = VDOORSPEED*4;
break;
case 118: // blazing door open
door->type = blazeOpen;
line->special = 0;
door->speed = VDOORSPEED*4;
break;
}
// find the top and bottom of the movement range
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
}
//
// Spawn a door that closes after 30 seconds
//
void P_SpawnDoorCloseIn30 (sector_t* sec)
{
vldoor_t* door;
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
sec->special = 0;
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
door->sector = sec;
door->direction = 0;
door->type = normal;
door->speed = VDOORSPEED;
door->topcountdown = 30 * 35;
}
//
// Spawn a door that opens after 5 minutes
//
void
P_SpawnDoorRaiseIn5Mins
( sector_t* sec,
int secnum )
{
vldoor_t* door;
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
sec->special = 0;
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
door->sector = sec;
door->direction = 2;
door->type = raiseIn5Mins;
door->speed = VDOORSPEED;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->topwait = VDOORWAIT;
door->topcountdown = 5 * 60 * 35;
}
// UNUSED
// Separate into p_slidoor.c?
#if 0 // ABANDONED TO THE MISTS OF TIME!!!
//
// EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line)
//
slideframe_t slideFrames[MAXSLIDEDOORS];
void P_InitSlidingDoorFrames(void)
{
int i;
int f1;
int f2;
int f3;
int f4;
// DOOM II ONLY...
if ( gamemode != commercial)
return;
for (i = 0;i < MAXSLIDEDOORS; i++)
{
if (!slideFrameNames[i].frontFrame1[0])
break;
f1 = R_TextureNumForName(slideFrameNames[i].frontFrame1);
f2 = R_TextureNumForName(slideFrameNames[i].frontFrame2);
f3 = R_TextureNumForName(slideFrameNames[i].frontFrame3);
f4 = R_TextureNumForName(slideFrameNames[i].frontFrame4);
slideFrames[i].frontFrames[0] = f1;
slideFrames[i].frontFrames[1] = f2;
slideFrames[i].frontFrames[2] = f3;
slideFrames[i].frontFrames[3] = f4;
f1 = R_TextureNumForName(slideFrameNames[i].backFrame1);
f2 = R_TextureNumForName(slideFrameNames[i].backFrame2);
f3 = R_TextureNumForName(slideFrameNames[i].backFrame3);
f4 = R_TextureNumForName(slideFrameNames[i].backFrame4);
slideFrames[i].backFrames[0] = f1;
slideFrames[i].backFrames[1] = f2;
slideFrames[i].backFrames[2] = f3;
slideFrames[i].backFrames[3] = f4;
}
}
//
// Return index into "slideFrames" array
// for which door type to use
//
int P_FindSlidingDoorType(line_t* line)
{
int i;
int val;
for (i = 0;i < MAXSLIDEDOORS;i++)
{
val = sides[line->sidenum[0]].midtexture;
if (val == slideFrames[i].frontFrames[0])
return i;
}
return -1;
}
void T_SlidingDoor (slidedoor_t* door)
{
switch(door->status)
{
case sd_opening:
if (!door->timer--)
{
if (++door->frame == SNUMFRAMES)
{
// IF DOOR IS DONE OPENING...
sides[door->line->sidenum[0]].midtexture = 0;
sides[door->line->sidenum[1]].midtexture = 0;
door->line->flags &= ML_BLOCKING^0xff;
if (door->type == sdt_openOnly)
{
door->frontsector->specialdata = NULL;
P_RemoveThinker (&door->thinker);
break;
}
door->timer = SDOORWAIT;
door->status = sd_waiting;
}
else
{
// IF DOOR NEEDS TO ANIMATE TO NEXT FRAME...
door->timer = SWAITTICS;
sides[door->line->sidenum[0]].midtexture =
slideFrames[door->whichDoorIndex].
frontFrames[door->frame];
sides[door->line->sidenum[1]].midtexture =
slideFrames[door->whichDoorIndex].
backFrames[door->frame];
}
}
break;
case sd_waiting:
// IF DOOR IS DONE WAITING...
if (!door->timer--)
{
// CAN DOOR CLOSE?
if (door->frontsector->thinglist != NULL ||
door->backsector->thinglist != NULL)
{
door->timer = SDOORWAIT;
break;
}
//door->frame = SNUMFRAMES-1;
door->status = sd_closing;
door->timer = SWAITTICS;
}
break;
case sd_closing:
if (!door->timer--)
{
if (--door->frame < 0)
{
// IF DOOR IS DONE CLOSING...
door->line->flags |= ML_BLOCKING;
door->frontsector->specialdata = NULL;
P_RemoveThinker (&door->thinker);
break;
}
else
{
// IF DOOR NEEDS TO ANIMATE TO NEXT FRAME...
door->timer = SWAITTICS;
sides[door->line->sidenum[0]].midtexture =
slideFrames[door->whichDoorIndex].
frontFrames[door->frame];
sides[door->line->sidenum[1]].midtexture =
slideFrames[door->whichDoorIndex].
backFrames[door->frame];
}
}
break;
}
}
void
EV_SlidingDoor
( line_t* line,
mobj_t* thing )
{
sector_t* sec;
slidedoor_t* door;
// DOOM II ONLY...
if (gamemode != commercial)
return;
// Make sure door isn't already being animated
sec = line->frontsector;
door = NULL;
if (sec->specialdata)
{
if (!thing->player)
return;
door = sec->specialdata;
if (door->type == sdt_openAndClose)
{
if (door->status == sd_waiting)
door->status = sd_closing;
}
else
return;
}
// Init sliding door vars
if (!door)
{
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
door->type = sdt_openAndClose;
door->status = sd_opening;
door->whichDoorIndex = P_FindSlidingDoorType(line);
if (door->whichDoorIndex < 0)
I_Error("EV_SlidingDoor: Can't use texture for sliding door!");
door->frontsector = sec;
door->backsector = line->backsector;
door->thinker.function = T_SlidingDoor;
door->timer = SWAITTICS;
door->frame = 0;
door->line = line;
}
}
#endif
--- NEW FILE: i_system.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_system.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_SYSTEM__
#define __I_SYSTEM__
#include "d_ticcmd.h"
#include "d_event.h"
#ifdef __GNUG__
#pragma interface
#endif
// Called by DoomMain.
void I_Init (void);
// Called by startup code
// to get the ammount of memory to malloc
// for the zone management.
byte* I_ZoneBase (int *size);
// Called by D_DoomLoop,
// returns current time in tics.
int I_GetTime (void);
//
// 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);
//
// 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);
// Asynchronous interrupt functions should maintain private queues
// that are read by the synchronous functions
// to be converted into events.
// Either returns a null ticcmd,
// or calls a loadable driver to build it.
// This ticcmd will then be modified by the gameloop
// for normal input.
ticcmd_t* I_BaseTiccmd (void);
// Called by M_Responder when quit is selected.
// Clean exit, displays sell blurb.
void I_Quit (void);
// Allocates from low memory under dos,
// just mallocs under unix
byte* I_AllocLow (int length);
void I_Tactile (int on, int off, int total);
void I_Error (char *error, ...);
// fixes bug under Win32 (mingwin32)
int I_strncasecmp(char *str1, char *str2, int len);
#endif
//-----------------------------------------------------------------------------
//
// $Log: i_system.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: wi_stuff.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: wi_stuff.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: wi_stuff.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1824 lines suppressed...]
wbs->maxsecret = 1;
if ( gamemode != retail )
if (wbs->epsd > 2)
wbs->epsd -= 3;
}
void WI_Start(wbstartstruct_t* wbstartstruct)
{
WI_initVariables(wbstartstruct);
WI_loadData();
if (deathmatch)
WI_initDeathmatchStats();
else if (netgame)
WI_initNetgameStats();
else
WI_initStats();
}
--- NEW FILE: sounds.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: sounds.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: sounds.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Created by a sound utility.
// Kept as a sample, DOOM2 sounds.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: sounds.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
#include "doomtype.h"
#include "sounds.h"
//
// Information about all the music
//
musicinfo_t S_music[] =
{
{ 0 },
{ "e1m1", 0 },
{ "e1m2", 0 },
{ "e1m3", 0 },
{ "e1m4", 0 },
{ "e1m5", 0 },
{ "e1m6", 0 },
{ "e1m7", 0 },
{ "e1m8", 0 },
{ "e1m9", 0 },
{ "e2m1", 0 },
{ "e2m2", 0 },
{ "e2m3", 0 },
{ "e2m4", 0 },
{ "e2m5", 0 },
{ "e2m6", 0 },
{ "e2m7", 0 },
{ "e2m8", 0 },
{ "e2m9", 0 },
{ "e3m1", 0 },
{ "e3m2", 0 },
{ "e3m3", 0 },
{ "e3m4", 0 },
{ "e3m5", 0 },
{ "e3m6", 0 },
{ "e3m7", 0 },
{ "e3m8", 0 },
{ "e3m9", 0 },
{ "inter", 0 },
{ "intro", 0 },
{ "bunny", 0 },
{ "victor", 0 },
{ "introa", 0 },
{ "runnin", 0 },
{ "stalks", 0 },
{ "countd", 0 },
{ "betwee", 0 },
{ "doom", 0 },
{ "the_da", 0 },
{ "shawn", 0 },
{ "ddtblu", 0 },
{ "in_cit", 0 },
{ "dead", 0 },
{ "stlks2", 0 },
{ "theda2", 0 },
{ "doom2", 0 },
{ "ddtbl2", 0 },
{ "runni2", 0 },
{ "dead2", 0 },
{ "stlks3", 0 },
{ "romero", 0 },
{ "shawn2", 0 },
{ "messag", 0 },
{ "count2", 0 },
{ "ddtbl3", 0 },
{ "ampie", 0 },
{ "theda3", 0 },
{ "adrian", 0 },
{ "messg2", 0 },
{ "romer2", 0 },
{ "tense", 0 },
{ "shawn3", 0 },
{ "openin", 0 },
{ "evil", 0 },
{ "ultima", 0 },
{ "read_m", 0 },
{ "dm2ttl", 0 },
{ "dm2int", 0 }
};
//
// Information about all the sfx
//
sfxinfo_t S_sfx[] =
{
// S_sfx[0] needs to be a dummy for odd reasons.
{ "none", false, 0, 0, -1, -1, 0 },
{ "pistol", false, 64, 0, -1, -1, 0 },
{ "shotgn", false, 64, 0, -1, -1, 0 },
{ "sgcock", false, 64, 0, -1, -1, 0 },
{ "dshtgn", false, 64, 0, -1, -1, 0 },
{ "dbopn", false, 64, 0, -1, -1, 0 },
{ "dbcls", false, 64, 0, -1, -1, 0 },
{ "dbload", false, 64, 0, -1, -1, 0 },
{ "plasma", false, 64, 0, -1, -1, 0 },
{ "bfg", false, 64, 0, -1, -1, 0 },
{ "sawup", false, 64, 0, -1, -1, 0 },
{ "sawidl", false, 118, 0, -1, -1, 0 },
{ "sawful", false, 64, 0, -1, -1, 0 },
{ "sawhit", false, 64, 0, -1, -1, 0 },
{ "rlaunc", false, 64, 0, -1, -1, 0 },
{ "rxplod", false, 70, 0, -1, -1, 0 },
{ "firsht", false, 70, 0, -1, -1, 0 },
{ "firxpl", false, 70, 0, -1, -1, 0 },
{ "pstart", false, 100, 0, -1, -1, 0 },
{ "pstop", false, 100, 0, -1, -1, 0 },
{ "doropn", false, 100, 0, -1, -1, 0 },
{ "dorcls", false, 100, 0, -1, -1, 0 },
{ "stnmov", false, 119, 0, -1, -1, 0 },
{ "swtchn", false, 78, 0, -1, -1, 0 },
{ "swtchx", false, 78, 0, -1, -1, 0 },
{ "plpain", false, 96, 0, -1, -1, 0 },
{ "dmpain", false, 96, 0, -1, -1, 0 },
{ "popain", false, 96, 0, -1, -1, 0 },
{ "vipain", false, 96, 0, -1, -1, 0 },
{ "mnpain", false, 96, 0, -1, -1, 0 },
{ "pepain", false, 96, 0, -1, -1, 0 },
{ "slop", false, 78, 0, -1, -1, 0 },
{ "itemup", true, 78, 0, -1, -1, 0 },
{ "wpnup", true, 78, 0, -1, -1, 0 },
{ "oof", false, 96, 0, -1, -1, 0 },
{ "telept", false, 32, 0, -1, -1, 0 },
{ "posit1", true, 98, 0, -1, -1, 0 },
{ "posit2", true, 98, 0, -1, -1, 0 },
{ "posit3", true, 98, 0, -1, -1, 0 },
{ "bgsit1", true, 98, 0, -1, -1, 0 },
{ "bgsit2", true, 98, 0, -1, -1, 0 },
{ "sgtsit", true, 98, 0, -1, -1, 0 },
{ "cacsit", true, 98, 0, -1, -1, 0 },
{ "brssit", true, 94, 0, -1, -1, 0 },
{ "cybsit", true, 92, 0, -1, -1, 0 },
{ "spisit", true, 90, 0, -1, -1, 0 },
{ "bspsit", true, 90, 0, -1, -1, 0 },
{ "kntsit", true, 90, 0, -1, -1, 0 },
{ "vilsit", true, 90, 0, -1, -1, 0 },
{ "mansit", true, 90, 0, -1, -1, 0 },
{ "pesit", true, 90, 0, -1, -1, 0 },
{ "sklatk", false, 70, 0, -1, -1, 0 },
{ "sgtatk", false, 70, 0, -1, -1, 0 },
{ "skepch", false, 70, 0, -1, -1, 0 },
{ "vilatk", false, 70, 0, -1, -1, 0 },
{ "claw", false, 70, 0, -1, -1, 0 },
{ "skeswg", false, 70, 0, -1, -1, 0 },
{ "pldeth", false, 32, 0, -1, -1, 0 },
{ "pdiehi", false, 32, 0, -1, -1, 0 },
{ "podth1", false, 70, 0, -1, -1, 0 },
{ "podth2", false, 70, 0, -1, -1, 0 },
{ "podth3", false, 70, 0, -1, -1, 0 },
{ "bgdth1", false, 70, 0, -1, -1, 0 },
{ "bgdth2", false, 70, 0, -1, -1, 0 },
{ "sgtdth", false, 70, 0, -1, -1, 0 },
{ "cacdth", false, 70, 0, -1, -1, 0 },
{ "skldth", false, 70, 0, -1, -1, 0 },
{ "brsdth", false, 32, 0, -1, -1, 0 },
{ "cybdth", false, 32, 0, -1, -1, 0 },
{ "spidth", false, 32, 0, -1, -1, 0 },
{ "bspdth", false, 32, 0, -1, -1, 0 },
{ "vildth", false, 32, 0, -1, -1, 0 },
{ "kntdth", false, 32, 0, -1, -1, 0 },
{ "pedth", false, 32, 0, -1, -1, 0 },
{ "skedth", false, 32, 0, -1, -1, 0 },
{ "posact", true, 120, 0, -1, -1, 0 },
{ "bgact", true, 120, 0, -1, -1, 0 },
{ "dmact", true, 120, 0, -1, -1, 0 },
{ "bspact", true, 100, 0, -1, -1, 0 },
{ "bspwlk", true, 100, 0, -1, -1, 0 },
{ "vilact", true, 100, 0, -1, -1, 0 },
{ "noway", false, 78, 0, -1, -1, 0 },
{ "barexp", false, 60, 0, -1, -1, 0 },
{ "punch", false, 64, 0, -1, -1, 0 },
{ "hoof", false, 70, 0, -1, -1, 0 },
{ "metal", false, 70, 0, -1, -1, 0 },
{ "chgun", false, 64, &S_sfx[sfx_pistol], 150, 0, 0 },
{ "tink", false, 60, 0, -1, -1, 0 },
{ "bdopn", false, 100, 0, -1, -1, 0 },
{ "bdcls", false, 100, 0, -1, -1, 0 },
{ "itmbk", false, 100, 0, -1, -1, 0 },
{ "flame", false, 32, 0, -1, -1, 0 },
{ "flamst", false, 32, 0, -1, -1, 0 },
{ "getpow", false, 60, 0, -1, -1, 0 },
{ "bospit", false, 70, 0, -1, -1, 0 },
{ "boscub", false, 70, 0, -1, -1, 0 },
{ "bossit", false, 70, 0, -1, -1, 0 },
{ "bospn", false, 70, 0, -1, -1, 0 },
{ "bosdth", false, 70, 0, -1, -1, 0 },
{ "manatk", false, 70, 0, -1, -1, 0 },
{ "mandth", false, 70, 0, -1, -1, 0 },
{ "sssit", false, 70, 0, -1, -1, 0 },
{ "ssdth", false, 70, 0, -1, -1, 0 },
{ "keenpn", false, 70, 0, -1, -1, 0 },
{ "keendt", false, 70, 0, -1, -1, 0 },
{ "skeact", false, 70, 0, -1, -1, 0 },
{ "skesit", false, 70, 0, -1, -1, 0 },
{ "skeatk", false, 70, 0, -1, -1, 0 },
{ "radio", false, 60, 0, -1, -1, 0 }
};
--- NEW FILE: configure.in ---
dnl # nxDOOM configure script
dnl # Based on the SDL DOOM 1.10 which was based on ID Software DOOM
dnl # Process this file with autoconf to come up with a configure script
AC_INIT(README.NANOX)
dnl Setup for automake
AM_INIT_AUTOMAKE(nxdoom, 1.00)
dnl # Check the various tools we need
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_INSTALL
dnl # Check if the user specifed where Microwindows lives
dnl # Otherwise, we will assume that it lives in the standard location
AC_ARG_WITH(microwin, [ --with-microwin=[microwindows path] Prefix where microwindows is installed],
nanox_prefix="$withval", nanox_prefix="/usr/local/censoft/ipaq/strongarm")
AC_ARG_ENABLE(dsp, [ --enable-dsp Use /dev/dsp for sound],
SOUNDFLAGS="-DUSE_DSP")
AC_ARG_ENABLE(esd, [ --enable-esound Use ESD for sound],
SOUNDFLAGS="-DUSE_ESOUND")
AC_ARG_ENABLE(ipaq, [ --enable-ipaq Sets the system to build an binary for the Compaq Ipaq],
[ do_ipaq="1"
echo "Building for the Ipaq... adding structure packing"
],
echo "Bulding for the X86 desktop..."
)
#file_list="$nanox_prefix/include/nano-X.h $nanox_prefix/lib/libnano-X.a"
#AC_CHECK_FILES($file_list, ,
#AC_MSG_ERROR([** nano-X.h not found in $nanox_prefix/include!])
#)
CFLAGS="-g -O2 $SOUNDFLAGS"
if test x$do_ipaq != x; then
CFLAGS="$CFLAGS -fpack-struct -mstructure-size-boundary=8"
fi
CFLAGS="$CFLAGS -I$nanox_prefix/include -L$nanox_prefix/lib -D_REENTRANT"
LIBS="-lnano-X"
NANOX_CFLAGS=$CFLAGS
NANOX_LIBS=$LIBS
AC_SUBST(NANOX_CFLAGS)
AC_SUBST(NANOX_LIBS)
AC_SUBST(LIBS)
# Finally create all the generated files
AC_OUTPUT([
Makefile
])
--- NEW FILE: i_system.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_system.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: i_system.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_system.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <sys/time.h>
#include <nano-X.h>
#include "doomdef.h"
#include "m_misc.h"
#include "i_video.h"
#include "i_sound.h"
#include "d_net.h"
#include "g_game.h"
#ifdef __GNUG__
#pragma implementation "i_system.h"
#endif
#include "i_system.h"
int mb_used = 6;
int I_strncasecmp(char *str1, char *str2, int len)
{
char c1, c2;
while ( *str1 && *str2 && len-- ) {
c1 = *str1++;
c2 = *str2++;
if ( toupper(c1) != toupper(c2) )
return(1);
}
return(0);
}
void
I_Tactile
( int on,
int off,
int total )
{
// UNUSED.
on = off = total = 0;
}
ticcmd_t emptycmd;
ticcmd_t* I_BaseTiccmd(void)
{
return &emptycmd;
}
int I_GetHeapSize (void)
{
return mb_used*1024*1024;
}
byte* I_ZoneBase (int* size)
{
*size = mb_used*1024*1024;
return (byte *) malloc (*size);
}
static unsigned long
GetTicks(void)
{
struct timeval now;
unsigned long ticks;
static struct timeval start;
if (start.tv_sec == 0) {
/* Set first ticks value */
gettimeofday(&start, NULL);
}
gettimeofday(&now, NULL);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
return(ticks);
}
//
// I_GetTime
// returns time in 1/35 second tics
//
int I_GetTime (void)
{
return (GetTicks()*TICRATE)/1000;
}
//
// I_Init
//
void I_Init (void)
{
if (GrOpen() < 0)
I_Error("Can't open graphics\n");
#if defined(USE_DSP) || defined(USE_ESOUND)
I_InitSound();
#endif
// I_InitGraphics();
}
//
// I_Quit
//
void I_Quit (void)
{
D_QuitNetGame ();
#if defined(USE_DSP) || defined(USE_ESOUND)
I_ShutdownSound();
I_ShutdownMusic();
#endif
M_SaveDefaults ();
I_ShutdownGraphics();
exit(0);
}
void I_WaitVBL(int count)
{
//SDL_Delay((count*1000)/70);
}
void I_BeginRead(void)
{
}
void I_EndRead(void)
{
}
byte* I_AllocLow(int length)
{
byte* mem;
mem = (byte *)malloc (length);
memset (mem,0,length);
return mem;
}
//
// I_Error
//
extern boolean demorecording;
void I_Error (char *error, ...)
{
va_list argptr;
// Message first.
va_start (argptr,error);
fprintf (stderr, "Error: ");
vfprintf (stderr,error,argptr);
fprintf (stderr, "\n");
va_end (argptr);
fflush( stderr );
// Shutdown. Here might be other errors.
if (demorecording)
G_CheckDemoStatus();
D_QuitNetGame ();
I_ShutdownGraphics();
exit(-1);
}
--- NEW FILE: m_cheat.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_cheat.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_cheat.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Cheat sequence checking.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_cheat.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#include "m_cheat.h"
//
// CHEAT SEQUENCE PACKAGE
//
static int firsttime = 1;
static unsigned char cheat_xlate_table[256];
//
// Called in st_stuff module, which handles the input.
// Returns a 1 if the cheat was successful, 0 if failed.
//
int
cht_CheckCheat
( cheatseq_t* cht,
char key )
{
int i;
int rc = 0;
if (firsttime)
{
firsttime = 0;
for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i);
}
if (!cht->p)
cht->p = cht->sequence; // initialize if first time
if (*cht->p == 0)
*(cht->p++) = key;
else if
(cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++;
else
cht->p = cht->sequence;
if (*cht->p == 1)
cht->p++;
else if (*cht->p == 0xff) // end of sequence character
{
cht->p = cht->sequence;
rc = 1;
}
return rc;
}
void
cht_GetParam
( cheatseq_t* cht,
char* buffer )
{
unsigned char *p, c;
p = cht->sequence;
while (*(p++) != 1);
do
{
c = *p;
*(buffer++) = c;
*(p++) = 0;
}
while (c && *p!=0xff );
if (*p==0xff)
*buffer = 0;
}
--- NEW FILE: p_saveg.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_saveg.c,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_saveg.c,v $
// Revision 1.1 2006-10-03 11:26:20 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Archiving: SaveGame I/O.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_saveg.c,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $";
#include "i_system.h"
#include "z_zone.h"
#include "p_local.h"
// State.
#include "doomstat.h"
#include "r_state.h"
byte* save_p;
// Pads save_p to a 4-byte boundary
// so that the load/save works on SGI&Gecko.
#define PADSAVEP() save_p += (4 - ((int) save_p & 3)) & 3
//
// P_ArchivePlayers
//
void P_ArchivePlayers (void)
{
int i;
int j;
player_t* dest;
for (i=0 ; i<MAXPLAYERS ; i++)
{
if (!playeringame[i])
continue;
PADSAVEP();
dest = (player_t *)save_p;
memcpy (dest,&players[i],sizeof(player_t));
save_p += sizeof(player_t);
for (j=0 ; j<NUMPSPRITES ; j++)
{
if (dest->psprites[j].state)
{
dest->psprites[j].state
= (state_t *)(dest->psprites[j].state-states);
}
}
}
}
//
// P_UnArchivePlayers
//
void P_UnArchivePlayers (void)
{
int i;
int j;
for (i=0 ; i<MAXPLAYERS ; i++)
{
if (!playeringame[i])
continue;
PADSAVEP();
memcpy (&players[i],save_p, sizeof(player_t));
save_p += sizeof(player_t);
// will be set when unarc thinker
players[i].mo = NULL;
players[i].message = NULL;
players[i].attacker = NULL;
for (j=0 ; j<NUMPSPRITES ; j++)
{
if (players[i]. psprites[j].state)
{
players[i]. psprites[j].state
= &states[ (int)players[i].psprites[j].state ];
}
}
}
}
//
// P_ArchiveWorld
//
void P_ArchiveWorld (void)
{
int i;
int j;
sector_t* sec;
line_t* li;
side_t* si;
short* put;
put = (short *)save_p;
// do sectors
for (i=0, sec = sectors ; i<numsectors ; i++,sec++)
{
*put++ = sec->floorheight >> FRACBITS;
*put++ = sec->ceilingheight >> FRACBITS;
*put++ = sec->floorpic;
*put++ = sec->ceilingpic;
*put++ = sec->lightlevel;
*put++ = sec->special; // needed?
*put++ = sec->tag; // needed?
}
// do lines
for (i=0, li = lines ; i<numlines ; i++,li++)
{
*put++ = li->flags;
*put++ = li->special;
*put++ = li->tag;
for (j=0 ; j<2 ; j++)
{
if (li->sidenum[j] == -1)
continue;
si = &sides[li->sidenum[j]];
*put++ = si->textureoffset >> FRACBITS;
*put++ = si->rowoffset >> FRACBITS;
*put++ = si->toptexture;
*put++ = si->bottomtexture;
*put++ = si->midtexture;
}
}
save_p = (byte *)put;
}
//
// P_UnArchiveWorld
//
void P_UnArchiveWorld (void)
{
int i;
int j;
sector_t* sec;
line_t* li;
side_t* si;
short* get;
get = (short *)save_p;
// do sectors
for (i=0, sec = sectors ; i<numsectors ; i++,sec++)
{
sec->floorheight = *get++ << FRACBITS;
sec->ceilingheight = *get++ << FRACBITS;
sec->floorpic = *get++;
sec->ceilingpic = *get++;
sec->lightlevel = *get++;
sec->special = *get++; // needed?
sec->tag = *get++; // needed?
sec->specialdata = 0;
sec->soundtarget = 0;
}
// do lines
for (i=0, li = lines ; i<numlines ; i++,li++)
{
li->flags = *get++;
li->special = *get++;
li->tag = *get++;
for (j=0 ; j<2 ; j++)
{
if (li->sidenum[j] == -1)
continue;
si = &sides[li->sidenum[j]];
si->textureoffset = *get++ << FRACBITS;
si->rowoffset = *get++ << FRACBITS;
si->toptexture = *get++;
si->bottomtexture = *get++;
si->midtexture = *get++;
}
}
save_p = (byte *)get;
}
//
// Thinkers
//
typedef enum
{
tc_end,
tc_mobj
} thinkerclass_t;
//
// P_ArchiveThinkers
//
void P_ArchiveThinkers (void)
{
thinker_t* th;
mobj_t* mobj;
// save off the current thinkers
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
{
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{
*save_p++ = tc_mobj;
PADSAVEP();
mobj = (mobj_t *)save_p;
memcpy (mobj, th, sizeof(*mobj));
save_p += sizeof(*mobj);
mobj->state = (state_t *)(mobj->state - states);
if (mobj->player)
mobj->player = (player_t *)((mobj->player-players) + 1);
continue;
}
// I_Error ("P_ArchiveThinkers: Unknown thinker function");
}
// add a terminating marker
*save_p++ = tc_end;
}
//
// P_UnArchiveThinkers
//
void P_UnArchiveThinkers (void)
{
byte tclass;
thinker_t* currentthinker;
thinker_t* next;
mobj_t* mobj;
// remove all the current thinkers
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
next = currentthinker->next;
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
P_RemoveMobj ((mobj_t *)currentthinker);
else
Z_Free (currentthinker);
currentthinker = next;
}
P_InitThinkers ();
// read in saved thinkers
while (1)
{
tclass = *save_p++;
switch (tclass)
{
case tc_end:
return; // end of list
case tc_mobj:
PADSAVEP();
mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL);
memcpy (mobj, save_p, sizeof(*mobj));
save_p += sizeof(*mobj);
mobj->state = &states[(int)mobj->state];
mobj->target = NULL;
if (mobj->player)
{
mobj->player = &players[(int)mobj->player-1];
mobj->player->mo = mobj;
}
P_SetThingPosition (mobj);
mobj->info = &mobjinfo[mobj->type];
mobj->floorz = mobj->subsector->sector->floorheight;
mobj->ceilingz = mobj->subsector->sector->ceilingheight;
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
P_AddThinker (&mobj->thinker);
break;
default:
I_Error ("Unknown tclass %i in savegame",tclass);
}
}
}
//
// P_ArchiveSpecials
//
enum
{
tc_ceiling,
tc_door,
tc_floor,
tc_plat,
tc_flash,
tc_strobe,
tc_glow,
tc_endspecials
} specials_e;
//
// Things to handle:
//
// T_MoveCeiling, (ceiling_t: sector_t * swizzle), - active list
// T_VerticalDoor, (vldoor_t: sector_t * swizzle),
// T_MoveFloor, (floormove_t: sector_t * swizzle),
// T_LightFlash, (lightflash_t: sector_t * swizzle),
// T_StrobeFlash, (strobe_t: sector_t *),
// T_Glow, (glow_t: sector_t *),
// T_PlatRaise, (plat_t: sector_t *), - active list
//
void P_ArchiveSpecials (void)
{
thinker_t* th;
ceiling_t* ceiling;
vldoor_t* door;
floormove_t* floor;
plat_t* plat;
lightflash_t* flash;
strobe_t* strobe;
glow_t* glow;
int i;
// save off the current thinkers
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
{
if (th->function.acv == (actionf_v)NULL)
{
for (i = 0; i < MAXCEILINGS;i++)
if (activeceilings[i] == (ceiling_t *)th)
break;
if (i<MAXCEILINGS)
{
*save_p++ = tc_ceiling;
PADSAVEP();
ceiling = (ceiling_t *)save_p;
memcpy (ceiling, th, sizeof(*ceiling));
save_p += sizeof(*ceiling);
ceiling->sector = (sector_t *)(ceiling->sector - sectors);
}
continue;
}
if (th->function.acp1 == (actionf_p1)T_MoveCeiling)
{
*save_p++ = tc_ceiling;
PADSAVEP();
ceiling = (ceiling_t *)save_p;
memcpy (ceiling, th, sizeof(*ceiling));
save_p += sizeof(*ceiling);
ceiling->sector = (sector_t *)(ceiling->sector - sectors);
continue;
}
if (th->function.acp1 == (actionf_p1)T_VerticalDoor)
{
*save_p++ = tc_door;
PADSAVEP();
door = (vldoor_t *)save_p;
memcpy (door, th, sizeof(*door));
save_p += sizeof(*door);
door->sector = (sector_t *)(door->sector - sectors);
continue;
}
if (th->function.acp1 == (actionf_p1)T_MoveFloor)
{
*save_p++ = tc_floor;
PADSAVEP();
floor = (floormove_t *)save_p;
memcpy (floor, th, sizeof(*floor));
save_p += sizeof(*floor);
floor->sector = (sector_t *)(floor->sector - sectors);
continue;
}
if (th->function.acp1 == (actionf_p1)T_PlatRaise)
{
*save_p++ = tc_plat;
PADSAVEP();
plat = (plat_t *)save_p;
memcpy (plat, th, sizeof(*plat));
save_p += sizeof(*plat);
plat->sector = (sector_t *)(plat->sector - sectors);
continue;
}
if (th->function.acp1 == (actionf_p1)T_LightFlash)
{
*save_p++ = tc_flash;
PADSAVEP();
flash = (lightflash_t *)save_p;
memcpy (flash, th, sizeof(*flash));
save_p += sizeof(*flash);
flash->sector = (sector_t *)(flash->sector - sectors);
continue;
}
if (th->function.acp1 == (actionf_p1)T_StrobeFlash)
{
*save_p++ = tc_strobe;
PADSAVEP();
strobe = (strobe_t *)save_p;
memcpy (strobe, th, sizeof(*strobe));
save_p += sizeof(*strobe);
strobe->sector = (sector_t *)(strobe->sector - sectors);
continue;
}
if (th->function.acp1 == (actionf_p1)T_Glow)
{
*save_p++ = tc_glow;
PADSAVEP();
glow = (glow_t *)save_p;
memcpy (glow, th, sizeof(*glow));
save_p += sizeof(*glow);
glow->sector = (sector_t *)(glow->sector - sectors);
continue;
}
}
// add a terminating marker
*save_p++ = tc_endspecials;
}
//
// P_UnArchiveSpecials
//
void P_UnArchiveSpecials (void)
{
byte tclass;
ceiling_t* ceiling;
vldoor_t* door;
floormove_t* floor;
plat_t* plat;
lightflash_t* flash;
strobe_t* strobe;
glow_t* glow;
// read in saved thinkers
while (1)
{
tclass = *save_p++;
switch (tclass)
{
case tc_endspecials:
return; // end of list
case tc_ceiling:
PADSAVEP();
ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL);
memcpy (ceiling, save_p, sizeof(*ceiling));
save_p += sizeof(*ceiling);
ceiling->sector = §ors[(int)ceiling->sector];
ceiling->sector->specialdata = ceiling;
if (ceiling->thinker.function.acp1)
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
P_AddThinker (&ceiling->thinker);
P_AddActiveCeiling(ceiling);
break;
case tc_door:
PADSAVEP();
door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL);
memcpy (door, save_p, sizeof(*door));
save_p += sizeof(*door);
door->sector = §ors[(int)door->sector];
door->sector->specialdata = door;
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
P_AddThinker (&door->thinker);
break;
case tc_floor:
PADSAVEP();
floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
memcpy (floor, save_p, sizeof(*floor));
save_p += sizeof(*floor);
floor->sector = §ors[(int)floor->sector];
floor->sector->specialdata = floor;
floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor;
P_AddThinker (&floor->thinker);
break;
case tc_plat:
PADSAVEP();
plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
memcpy (plat, save_p, sizeof(*plat));
save_p += sizeof(*plat);
plat->sector = §ors[(int)plat->sector];
plat->sector->specialdata = plat;
if (plat->thinker.function.acp1)
plat->thinker.function.acp1 = (actionf_p1)T_PlatRaise;
P_AddThinker (&plat->thinker);
P_AddActivePlat(plat);
break;
case tc_flash:
PADSAVEP();
flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
memcpy (flash, save_p, sizeof(*flash));
save_p += sizeof(*flash);
flash->sector = §ors[(int)flash->sector];
flash->thinker.function.acp1 = (actionf_p1)T_LightFlash;
P_AddThinker (&flash->thinker);
break;
case tc_strobe:
PADSAVEP();
strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
memcpy (strobe, save_p, sizeof(*strobe));
save_p += sizeof(*strobe);
strobe->sector = §ors[(int)strobe->sector];
strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
P_AddThinker (&strobe->thinker);
break;
case tc_glow:
PADSAVEP();
glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
memcpy (glow, save_p, sizeof(*glow));
save_p += sizeof(*glow);
glow->sector = §ors[(int)glow->sector];
glow->thinker.function.acp1 = (actionf_p1)T_Glow;
P_AddThinker (&glow->thinker);
break;
default:
I_Error ("P_UnarchiveSpecials:Unknown tclass %i "
"in savegame",tclass);
}
}
}
--- NEW FILE: sounds.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: sounds.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Created by the sound utility written by Dave Taylor.
// Kept as a sample, DOOM2 sounds. Frozen.
//
//-----------------------------------------------------------------------------
#ifndef __SOUNDS__
#define __SOUNDS__
//
// SoundFX struct.
//
typedef struct sfxinfo_struct sfxinfo_t;
struct sfxinfo_struct
{
// up to 6-character name
char* name;
// 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
char* name;
// lump number of music
int lumpnum;
// music data
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,
NUMSFX
} sfxenum_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: sounds.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: w_wad.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: w_wad.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// WAD I/O functions.
//
//-----------------------------------------------------------------------------
#ifndef __W_WAD__
#define __W_WAD__
#ifdef __GNUG__
#pragma interface
#endif
//
// TYPES
//
typedef struct
{
// Should be "IWAD" or "PWAD".
char identification[4];
int numlumps;
int infotableofs;
} wadinfo_t;
typedef struct
{
int filepos;
int size;
char name[8];
} filelump_t;
//
// WADFILE I/O related stuff.
//
typedef struct
{
char name[8];
int handle;
int position;
int size;
} lumpinfo_t;
extern void** lumpcache;
extern lumpinfo_t* lumpinfo;
extern int numlumps;
void W_InitMultipleFiles (char** filenames);
void W_Reload (void);
int W_CheckNumForName (char* name);
int W_GetNumForName (char* name);
int W_LumpLength (int lump);
void W_ReadLump (int lump, void *dest);
void* W_CacheLumpNum (int lump, int tag);
void* W_CacheLumpName (char* name, int tag);
#endif
//-----------------------------------------------------------------------------
//
// $Log: w_wad.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:32 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:14 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_sight.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_sight.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_sight.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// LineOfSight/Visibility checks, uses REJECT Lookup Table.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_sight.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "doomdef.h"
#include "i_system.h"
#include "p_local.h"
// State.
#include "r_state.h"
//
// P_CheckSight
//
fixed_t sightzstart; // eye z of looker
fixed_t topslope;
fixed_t bottomslope; // slopes to top and bottom of target
divline_t strace; // from t1 to t2
fixed_t t2x;
fixed_t t2y;
int sightcounts[2];
//
// P_DivlineSide
// Returns side 0 (front), 1 (back), or 2 (on).
//
int
P_DivlineSide
( fixed_t x,
fixed_t y,
divline_t* node )
{
fixed_t dx;
fixed_t dy;
fixed_t left;
fixed_t right;
if (!node->dx)
{
if (x==node->x)
return 2;
if (x <= node->x)
return node->dy > 0;
return node->dy < 0;
}
if (!node->dy)
{
if (x==node->y)
return 2;
if (y <= node->y)
return node->dx < 0;
return node->dx > 0;
}
dx = (x - node->x);
dy = (y - node->y);
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
if (right < left)
return 0; // front side
if (left == right)
return 2;
return 1; // back side
}
//
// P_InterceptVector2
// Returns the fractional intercept point
// along the first divline.
// This is only called by the addthings and addlines traversers.
//
fixed_t
P_InterceptVector2
( divline_t* v2,
divline_t* v1 )
{
fixed_t frac;
fixed_t num;
fixed_t den;
den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy);
if (den == 0)
return 0;
// I_Error ("P_InterceptVector: parallel");
num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy) +
FixedMul ( (v2->y - v1->y)>>8 , v1->dx);
frac = FixedDiv (num , den);
return frac;
}
//
// P_CrossSubsector
// Returns true
// if strace crosses the given subsector successfully.
//
boolean P_CrossSubsector (int num)
{
seg_t* seg;
line_t* line;
int s1;
int s2;
int count;
subsector_t* sub;
sector_t* front;
sector_t* back;
fixed_t opentop;
fixed_t openbottom;
divline_t divl;
vertex_t* v1;
vertex_t* v2;
fixed_t frac;
fixed_t slope;
#ifdef RANGECHECK
if (num>=numsubsectors)
I_Error ("P_CrossSubsector: ss %i with numss = %i",
num,
numsubsectors);
#endif
sub = &subsectors[num];
// check lines
count = sub->numlines;
seg = &segs[sub->firstline];
for ( ; count ; seg++, count--)
{
line = seg->linedef;
// allready checked other side?
if (line->validcount == validcount)
continue;
line->validcount = validcount;
v1 = line->v1;
v2 = line->v2;
s1 = P_DivlineSide (v1->x,v1->y, &strace);
s2 = P_DivlineSide (v2->x, v2->y, &strace);
// line isn't crossed?
if (s1 == s2)
continue;
divl.x = v1->x;
divl.y = v1->y;
divl.dx = v2->x - v1->x;
divl.dy = v2->y - v1->y;
s1 = P_DivlineSide (strace.x, strace.y, &divl);
s2 = P_DivlineSide (t2x, t2y, &divl);
// line isn't crossed?
if (s1 == s2)
continue;
// stop because it is not two sided anyway
// might do this after updating validcount?
if ( !(line->flags & ML_TWOSIDED) )
return false;
// crosses a two sided line
front = seg->frontsector;
back = seg->backsector;
// no wall to block sight with?
if (front->floorheight == back->floorheight
&& front->ceilingheight == back->ceilingheight)
continue;
// possible occluder
// because of ceiling height differences
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
// because of ceiling height differences
if (front->floorheight > back->floorheight)
openbottom = front->floorheight;
else
openbottom = back->floorheight;
// quick test for totally closed doors
if (openbottom >= opentop)
return false; // stop
frac = P_InterceptVector2 (&strace, &divl);
if (front->floorheight != back->floorheight)
{
slope = FixedDiv (openbottom - sightzstart , frac);
if (slope > bottomslope)
bottomslope = slope;
}
if (front->ceilingheight != back->ceilingheight)
{
slope = FixedDiv (opentop - sightzstart , frac);
if (slope < topslope)
topslope = slope;
}
if (topslope <= bottomslope)
return false; // stop
}
// passed the subsector ok
return true;
}
//
// P_CrossBSPNode
// Returns true
// if strace crosses the given node successfully.
//
boolean P_CrossBSPNode (int bspnum)
{
node_t* bsp;
int side;
if (bspnum & NF_SUBSECTOR)
{
if (bspnum == -1)
return P_CrossSubsector (0);
else
return P_CrossSubsector (bspnum&(~NF_SUBSECTOR));
}
bsp = &nodes[bspnum];
// decide which side the start point is on
side = P_DivlineSide (strace.x, strace.y, (divline_t *)bsp);
if (side == 2)
side = 0; // an "on" should cross both sides
// cross the starting side
if (!P_CrossBSPNode (bsp->children[side]) )
return false;
// the partition plane is crossed here
if (side == P_DivlineSide (t2x, t2y,(divline_t *)bsp))
{
// the line doesn't touch the other side
return true;
}
// cross the ending side
return P_CrossBSPNode (bsp->children[side^1]);
}
//
// P_CheckSight
// Returns true
// if a straight line between t1 and t2 is unobstructed.
// Uses REJECT.
//
boolean
P_CheckSight
( mobj_t* t1,
mobj_t* t2 )
{
int s1;
int s2;
int pnum;
int bytenum;
int bitnum;
// First check for trivial rejection.
// Determine subsector entries in REJECT table.
s1 = (t1->subsector->sector - sectors);
s2 = (t2->subsector->sector - sectors);
pnum = s1*numsectors + s2;
bytenum = pnum>>3;
bitnum = 1 << (pnum&7);
// Check in REJECT table.
if (rejectmatrix[bytenum]&bitnum)
{
sightcounts[0]++;
// can't possibly be connected
return false;
}
// An unobstructed LOS is possible.
// Now look from eyes of t1 to any part of t2.
sightcounts[1]++;
validcount++;
sightzstart = t1->z + t1->height - (t1->height>>2);
topslope = (t2->z+t2->height) - sightzstart;
bottomslope = (t2->z) - sightzstart;
strace.x = t1->x;
strace.y = t1->y;
t2x = t2->x;
t2y = t2->y;
strace.dx = t2->x - t1->x;
strace.dy = t2->y - t1->y;
// the head node is the last node output
return P_CrossBSPNode (numnodes-1);
}
--- NEW FILE: doomtype.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: doomtype.h,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Simple basic typedefs, isolated here to make it easier
// separating modules.
//
//-----------------------------------------------------------------------------
#ifndef __DOOMTYPE__
#define __DOOMTYPE__
#ifndef __BYTEBOOL__
#define __BYTEBOOL__
// Fixed to use builtin bool type with C++.
#ifdef __cplusplus
typedef bool boolean;
#else
#ifdef __BEOS__ /* boolean is a builtin type for MWCC */
#define boolean D_BOOL
#undef false
#define false D_false
#undef true
#define true D_true
#endif
typedef enum {false, true} boolean;
#endif
typedef unsigned char byte;
#endif
// Predefined with some OS.
#ifdef LINUX
#include <values.h>
#else
#ifndef MAXCHAR
#define MAXCHAR ((char)0x7f)
#endif
#ifndef MAXSHORT
#define MAXSHORT ((short)0x7fff)
#endif
// Max pos 32-bit int.
#ifndef MAXINT
#define MAXINT ((int)0x7fffffff)
#endif
#ifndef MAXLONG
#define MAXLONG ((long)0x7fffffff)
#endif
#ifndef MINCHAR
#define MINCHAR ((char)0x80)
#endif
#ifndef MINSHORT
#define MINSHORT ((short)0x8000)
#endif
// Max negative 32-bit integer.
#ifndef MININT
#define MININT ((int)0x80000000)
#endif
#ifndef MINLONG
#define MINLONG ((long)0x80000000)
#endif
#endif
#endif
//-----------------------------------------------------------------------------
//
// $Log: doomtype.h,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_swap.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_swap.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_swap.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Endianess handling, swapping 16bit and 32bit.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_swap.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#ifdef __GNUG__
#pragma implementation "m_swap.h"
#endif
#include "m_swap.h"
// Swap 16bit, that is, MSB and LSB byte.
unsigned short SwapSHORT(unsigned short x)
{
// No masking with 0xFF should be necessary.
return (x>>8) | (x<<8);
}
// Swapping 32bit.
unsigned long SwapLONG( unsigned long x)
{
return
(x>>24)
| ((x>>8) & 0xff00)
| ((x<<8) & 0xff0000)
| (x<<24);
}
--- NEW FILE: st_stuff.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: st_stuff.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: st_stuff.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1444 lines suppressed...]
st_stopped = false;
}
void ST_Stop (void)
{
if (st_stopped)
return;
I_SetPalette (W_CacheLumpNum (lu_palette, PU_CACHE));
st_stopped = true;
}
void ST_Init (void)
{
veryfirsttime = 0;
ST_loadData();
screens[4] = (byte *) Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0);
}
--- NEW FILE: i_sound.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_sound.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
//
// DESCRIPTION:
// System interface, sound.
//
//-----------------------------------------------------------------------------
#ifndef __I_SOUND__
#define __I_SOUND__
#include "doomdef.h"
#include "doomstat.h"
#include "sounds.h"
// Init at program start...
void I_InitSound();
// ... shut down and relase at program termination.
void I_ShutdownSound(void);
//
// SFX I/O
//
// Initialize channels?
void I_SetChannels();
// 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 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);
// 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);
// 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(void *data);
// 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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: i_sound.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: NEWS ---
--- NEW FILE: aclocal.m4 ---
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
--- NEW FILE: d_player.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_player.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#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;
// This is only used between levels,
// mo->health is used during levels.
int health;
int armorpoints;
// Armor type is 0-2.
int armortype;
// Power ups. invinc and invis are tic counters.
int powers[NUMPOWERS];
boolean cards[NUMCARDS];
boolean backpack;
// Frags, kills of other players.
int frags[MAXPLAYERS];
weapontype_t readyweapon;
// Is wp_nochange if not changing.
weapontype_t pendingweapon;
boolean weaponowned[NUMWEAPONS];
int ammo[NUMAMMO];
int maxammo[NUMAMMO];
// True if button down last tic.
int attackdown;
int usedown;
// Bit flags, for cheats and debug.
// See cheat_t, above.
int cheats;
// Refired shots are less accurate.
int refire;
// For intermission stats.
int killcount;
int itemcount;
int secretcount;
// Hint messages.
char* message;
// 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];
} wbstartstruct_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_player.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: i_sound.c ---
/* Simple ESD handling for sounds and whatnot */
#include <fcntl.h>
#ifdef USE_ESOUND
#include <esd.h>
#endif
#ifdef USE_DSP
#include <linux/soundcard.h>
#endif
#include "z_zone.h"
#include "m_swap.h"
#include "i_system.h"
#include "i_sound.h"
#include "m_argv.h"
#include "m_misc.h"
#include "w_wad.h"
#include "doomdef.h"
#define SAMPLERATE 11025
static int SAMPLECOUNT= 2048;
#ifdef USE_ESOUND
int esd_sock;
int esd_stream;
#endif
#ifdef USE_DSP
int dsp_sock;
#endif
int sample_ids[NUMSFX];
// The actual lengths of all sound effects.
int lengths[NUMSFX];
#define CHANNEL_COUNT 8
struct
{
int active;
int position;
int size;
char *data;
int age;
} channel[CHANNEL_COUNT];
static int open_dsp();
static int configure_dsp(int, int, int, int);
static void close_dsp(int);
void*
getsfx
( char* sfxname,
int* len )
{
unsigned char* sfx;
unsigned char* paddedsfx;
int i;
int size;
int paddedsize;
char name[20];
int sfxlump;
// Get the sound data from the WAD, allocate lump
// in zone memory.
sprintf(name, "ds%s", sfxname);
// Now, there is a severe problem with the
// sound handling, in it is not (yet/anymore)
// gamemode aware. That means, sounds from
// DOOM II will be requested even with DOOM
// shareware.
// The sound list is wired into sounds.c,
// which sets the external variable.
// I do not do runtime patches to that
// variable. Instead, we will use a
// default sound for replacement.
if ( W_CheckNumForName(name) == -1 )
sfxlump = W_GetNumForName("dspistol");
else
sfxlump = W_GetNumForName(name);
size = W_LumpLength( sfxlump );
// Debug.
// fprintf( stderr, "." );
//fprintf( stderr, " -loading %s (lump %d, %d bytes)\n",
// sfxname, sfxlump, size );
//fflush( stderr );
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_STATIC );
// Pads the sound effect out to the mixing buffer size.
// The original realloc would interfere with zone memory.
paddedsize = ((size-8 + (SAMPLECOUNT-1)) / SAMPLECOUNT) * SAMPLECOUNT;
// Allocate from zone memory.
paddedsfx = (unsigned char *)Z_Malloc( paddedsize+8, PU_STATIC, 0 );
// ddt: (unsigned char *) realloc(sfx, paddedsize+8);
// This should interfere with zone memory handling,
// which does not kick in in the soundserver.
// Now copy and pad.
memcpy( paddedsfx, sfx, size );
for (i=size ; i<paddedsize+8 ; i++)
paddedsfx[i] = 128;
// Remove the cached lump.
Z_Free( sfx );
// Preserve padded length.
*len = paddedsize;
// Return allocated padded data.
return (void *) (paddedsfx + 8);
}
int I_GetSfxLumpNum(sfxinfo_t* sfx)
{
char namebuf[9];
sprintf(namebuf, "ds%s", sfx->name);
return W_GetNumForName(namebuf);
}
void I_SetChannels() {}
#ifdef NOTUSED
int I_StartSound(int id, int vol, int sep, int pitch, int priority)
{
/* Ok, lets just start playing the sound */
if (sample_ids[id])
esd_sample_play(esd_sock, sample_ids[id]);
return(sample_ids[id]);
}
#endif
int I_StartSound(int id, int vol, int sep, int pitch, int priority)
{
int i;
int oldestval = -1;
int old_index = -1;
/* First ensure that this sound isn't already being played */
for(i = 0; i < CHANNEL_COUNT;i++)
{
if (channel[i].active)
if (channel[i].data = S_sfx[id].data)
{
channel[i].active = 0;
break;
}
}
for(i = 0; i < CHANNEL_COUNT; i++)
{
if (!channel[i].active)
{
channel[i].position = 0;
channel[i].size = lengths[id];
channel[i].data = S_sfx[id].data;
channel[i].age = gametic;
channel[i].active = 1;
return;
}
if (old_index == -1)
{
oldestval = channel[i].age;
old_index = i;
}
else
{
if (channel[i].age < oldestval)
{
oldestval = channel[i].age;
old_index = i;
}
}
}
if (old_index != -1)
{
channel[old_index].position = 0;
channel[old_index].size = lengths[id];
channel[old_index].data = S_sfx[id].data;
channel[old_index].age = gametic;
channel[old_index].active = 1;
}
}
void I_UpdateSound()
{
int i;
int size = SAMPLECOUNT; /* 16 bit */
#ifdef USE_ESOUND
if (esd_stream <= 0)
return;
#endif
#ifdef USE_DSP
if (dsp_sock <= 0)
return;
#endif
/* Do a step, and mix in the current channels */
for(i = 0; i < CHANNEL_COUNT; i++)
{
if(channel[i].active)
{
int sizeleft = channel[i].size - channel[i].position;
if (sizeleft < (SAMPLECOUNT))
size = sizeleft;
#ifdef USE_ESOUND
if (write(esd_stream, channel[i].data + channel[i].position,
size) <= 0)
fprintf(stderr, "Errror writing sound!\n");
#endif
#ifdef USE_DSP
if (write(dsp_sock, channel[i].data + channel[i].position,
size) <= 0)
{
perror("dsp write");
fprintf(stderr, "Errror writing sound!\n");
}
#endif
channel[i].position += size;
if (channel[i].position >= channel[i].size)
{
channel[i].active = 0;
}
}
}
}
void I_StopSound(int handle)
{
}
void I_UpdateSoundParams(int handle, int vol, int sep, int pitch)
{
// unused
}
void I_ShutdownSound(void)
{
int i;
#ifdef NOTUSED
for(i = 0; i < NUMSFX; i++)
if(sample_ids[i])
esd_sample_free(esd_sock, sample_ids[i]);
#endif
#ifdef USE_ESOUND
close(esd_stream);
close(esd_sock);
#endif
#ifdef USE_DSP
close_dsp(dsp_sock);
#endif
}
int I_SoundIsPlaying(int handle)
{
return(1);
}
void I_SetMusicVolume(int volume)
{}
void I_InitSound()
{
#ifdef USE_ESOUND
esd_format_t format = ESD_BITS8 | ESD_STEREO | ESD_STREAM | ESD_PLAY;
#endif
int i, size = 0;
int len = 0;
int confirm_id = 0;
fprintf(stderr, "I_InitSound starting: ");
#ifdef USE_ESOUND
SAMPLECOUNT = SAMPLECOUNT * 1 * 1;
/* Open up the ESD daemon */
esd_sock = esd_open_sound(NULL);
if (esd_sock == -1)
{
fprintf(stderr, "Unable to contact the sound server\n");
return;
}
esd_stream = esd_play_stream_fallback(format, SAMPLERATE, NULL, "doom");
if (esd_stream <= 0)
return;
#endif
#ifdef USE_DSP
dsp_sock = open_dsp();
if (dsp_sock == -1)
{
fprintf(stderr, "Unable to open /dev/dsp for writing\n");
return;
}
if (configure_dsp(dsp_sock, 16, 0, SAMPLERATE) == -1)
{
fprintf(stderr, "Unable to configure /dev/dsp\n");
dsp_sock = 0;
return;
}
#endif
/* Now, load up all of the desired sounds */
for(i = 1; i < NUMSFX; i++)
{
if (!S_sfx[i].link)
{
// Load data from WAD file.
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
}
else
{
// Previously loaded already?
S_sfx[i].data = S_sfx[i].link->data;
lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)];
}
}
fprintf(stderr, "Sound init completed\n");
}
void I_InitMusic(void) { }
void I_ShutdownMusic(void) { }
void I_PauseSong (int handle)
{
}
void I_ResumeSong (int handle)
{
}
int I_RegisterSong(void* data)
{
return 1;
}
void I_PlaySong(int handle, int looping)
{}
void I_StopSong(int handle)
{}
void I_UnRegisterSong(int handle)
{
}
#ifdef USE_DSP
static int open_dsp()
{
int fd = open("/dev/dsp", O_WRONLY, 0);
if (fd == -1)
{
perror("open dsp");
return(-1);
}
}
static void close_dsp(int fd)
{
close(fd);
}
static int configure_dsp(int fd, int size, int stereo, int speed)
{
int bsize, lsize, lrate;
/* Determine how big a block we can write at once */
bsize = -1;
if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &bsize) < 0)
{
perror("GETBLOCKSIZE");
return(-1);
}
if (bsize < 4 || bsize > 65536)
bsize = 1024;
/* First sync it so we can change it */
if (ioctl(fd, SNDCTL_DSP_SYNC, NULL) < 0)
{
perror("SYNC");
return(-1);
}
lsize = AFMT_S16_LE;
/* Set the sample size */
if (ioctl(fd, SNDCTL_DSP_SETFMT, &lsize) == -1)
{
perror("SAMPLESIZE");
return(-1);
}
fprintf(stderr, "Set %d as the size\n", lsize);
/* set stereo */
if (stereo)
{
if (ioctl(fd, SNDCTL_DSP_STEREO, &stereo) < 0)
perror("STEREO");
}
/* set the speed */
lrate = speed;
if (ioctl(fd, SNDCTL_DSP_SPEED, &lrate) < 0)
{
perror("SPEED");
return(-1);
}
/* Ok, now we're set. We know how bit a block to */
/* send, and we have set everything we need to set */
/* go ahead and return */
return(bsize);
}
#endif
--- NEW FILE: st_stuff.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: st_stuff.h,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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.
#define ST_HEIGHT 32*SCREEN_MUL
#define ST_WIDTH SCREENWIDTH
#define ST_Y (SCREENHEIGHT - ST_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 fullscreen, 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;
boolean ST_Responder(event_t* ev);
#endif
//-----------------------------------------------------------------------------
//
// $Log: st_stuff.h,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_swap.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_swap.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Endianess handling, swapping 16bit and 32bit.
//
//-----------------------------------------------------------------------------
#ifndef __M_SWAP__
#define __M_SWAP__
#ifdef __GNUG__
#pragma interface
#endif
// Endianess handling.
// WAD files are stored little endian.
#ifdef sparc
#define __BIG_ENDIAN__
#endif
#ifdef __BEOS__
#include <byteorder.h>
#if B_HOST_IS_BENDIAN
#define __BIG_ENDIAN__
#endif
#endif
#ifdef __BIG_ENDIAN__
#define SHORT(x) ((short)SwapSHORT((unsigned short) (x)))
#define LONG(x) ((long)SwapLONG((unsigned long) (x)))
#else
#define SHORT(x) (x)
#define LONG(x) (x)
#endif
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_swap.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_map.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_map.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_map.c,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1312 lines suppressed...]
boolean
P_ChangeSector
( sector_t* sector,
boolean crunch )
{
int x;
int y;
nofit = false;
crushchange = crunch;
// re-check heights for all things near the moving sector
for (x=sector->blockbox[BOXLEFT] ; x<= sector->blockbox[BOXRIGHT] ; x++)
for (y=sector->blockbox[BOXBOTTOM];y<= sector->blockbox[BOXTOP] ; y++)
P_BlockThingsIterator (x, y, PIT_ChangeSector);
return nofit;
}
--- NEW FILE: p_telept.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_telept.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_telept.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Teleportation.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_telept.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "doomdef.h"
#include "s_sound.h"
#include "p_local.h"
// Data.
#include "sounds.h"
// State.
#include "r_state.h"
//
// TELEPORTATION
//
int
EV_Teleport
( line_t* line,
int side,
mobj_t* thing )
{
int i;
int tag;
mobj_t* m;
mobj_t* fog;
unsigned an;
thinker_t* thinker;
sector_t* sector;
fixed_t oldx;
fixed_t oldy;
fixed_t oldz;
// don't teleport missiles
if (thing->flags & MF_MISSILE)
return 0;
// Don't teleport if hit back of line,
// so you can get out of teleporter.
if (side == 1)
return 0;
tag = line->tag;
for (i = 0; i < numsectors; i++)
{
if (sectors[ i ].tag == tag )
{
thinker = thinkercap.next;
for (thinker = thinkercap.next;
thinker != &thinkercap;
thinker = thinker->next)
{
// not a mobj
if (thinker->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
m = (mobj_t *)thinker;
// not a teleportman
if (m->type != MT_TELEPORTMAN )
continue;
sector = m->subsector->sector;
// wrong sector
if (sector-sectors != i )
continue;
oldx = thing->x;
oldy = thing->y;
oldz = thing->z;
if (!P_TeleportMove (thing, m->x, m->y))
return 0;
thing->z = thing->floorz; //fixme: not needed?
if (thing->player)
thing->player->viewz = thing->z+thing->player->viewheight;
// spawn teleport fog at source and destination
fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
S_StartSound (fog, sfx_telept);
an = m->angle >> ANGLETOFINESHIFT;
fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
, thing->z, MT_TFOG);
// emit sound, where?
S_StartSound (fog, sfx_telept);
// don't move for a bit
if (thing->player)
thing->reactiontime = 18;
thing->angle = m->angle;
thing->momx = thing->momy = thing->momz = 0;
return 1;
}
}
}
return 0;
}
--- NEW FILE: r_main.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_main.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_main.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Rendering main loop and setup functions,
// utility functions (BSP, geometry, trigonometry).
// See tables.c, too.
//
//-----------------------------------------------------------------------------
static const char rcsid[] = "$Id: r_main.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include <stdlib.h>
#include <math.h>
#include "doomdef.h"
#include "d_net.h"
#include "m_bbox.h"
#include "r_local.h"
#include "r_sky.h"
// Fineangles in the SCREENWIDTH wide window.
#define FIELDOFVIEW 2048
int viewangleoffset;
// increment every time a check is made
int validcount = 1;
lighttable_t* fixedcolormap;
extern lighttable_t** walllights;
int centerx;
int centery;
fixed_t centerxfrac;
fixed_t centeryfrac;
fixed_t projection;
// just for profiling purposes
int framecount;
int sscount;
int linecount;
int loopcount;
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
fixed_t viewcos;
fixed_t viewsin;
player_t* viewplayer;
// 0 = high, 1 = low
int detailshift;
//
// precalculated math tables
//
angle_t clipangle;
// The viewangletox[viewangle + FINEANGLES/4] lookup
// maps the visible view angles to screen X coordinates,
// flattening the arc to a flat projection plane.
// There will be many angles mapped to the same X.
int viewangletox[FINEANGLES/2];
// The xtoviewangleangle[] table maps a screen pixel
// to the lowest viewangle that maps back to x ranges
// from clipangle to -clipangle.
angle_t xtoviewangle[SCREENWIDTH+1];
// UNUSED.
// The finetangentgent[angle+FINEANGLES/4] table
// holds the fixed_t tangent values for view angles,
// ranging from MININT to 0 to MAXINT.
// fixed_t finetangent[FINEANGLES/2];
// fixed_t finesine[5*FINEANGLES/4];
fixed_t* finecosine = &finesine[FINEANGLES/4];
lighttable_t* scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
lighttable_t* scalelightfixed[MAXLIGHTSCALE];
lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ];
// bumped light from gun blasts
int extralight;
void (*colfunc) (void);
void (*basecolfunc) (void);
void (*fuzzcolfunc) (void);
void (*transcolfunc) (void);
void (*spanfunc) (void);
//
// R_AddPointToBox
// Expand a given bbox
// so that it encloses a given point.
//
void
R_AddPointToBox
( int x,
int y,
fixed_t* box )
{
if (x< box[BOXLEFT])
box[BOXLEFT] = x;
if (x> box[BOXRIGHT])
box[BOXRIGHT] = x;
if (y< box[BOXBOTTOM])
box[BOXBOTTOM] = y;
if (y> box[BOXTOP])
box[BOXTOP] = y;
}
//
// R_PointOnSide
// Traverse BSP (sub) tree,
// check point against partition plane.
// Returns side 0 (front) or 1 (back).
//
int
R_PointOnSide
( fixed_t x,
fixed_t y,
node_t* node )
{
fixed_t dx;
fixed_t dy;
fixed_t left;
fixed_t right;
if (!node->dx)
{
if (x <= node->x)
return node->dy > 0;
return node->dy < 0;
}
if (!node->dy)
{
if (y <= node->y)
return node->dx < 0;
return node->dx > 0;
}
dx = (x - node->x);
dy = (y - node->y);
// Try to quickly decide by looking at sign bits.
if ( (node->dy ^ node->dx ^ dx ^ dy)&0x80000000 )
{
if ( (node->dy ^ dx) & 0x80000000 )
{
// (left is negative)
return 1;
}
return 0;
}
left = FixedMul ( node->dy>>FRACBITS , dx );
right = FixedMul ( dy , node->dx>>FRACBITS );
if (right < left)
{
// front side
return 0;
}
// back side
return 1;
}
int
R_PointOnSegSide
( fixed_t x,
fixed_t y,
seg_t* line )
{
fixed_t lx;
fixed_t ly;
fixed_t ldx;
fixed_t ldy;
fixed_t dx;
fixed_t dy;
fixed_t left;
fixed_t right;
lx = line->v1->x;
ly = line->v1->y;
ldx = line->v2->x - lx;
ldy = line->v2->y - ly;
if (!ldx)
{
if (x <= lx)
return ldy > 0;
return ldy < 0;
}
if (!ldy)
{
if (y <= ly)
return ldx < 0;
return ldx > 0;
}
dx = (x - lx);
dy = (y - ly);
// Try to quickly decide by looking at sign bits.
if ( (ldy ^ ldx ^ dx ^ dy)&0x80000000 )
{
if ( (ldy ^ dx) & 0x80000000 )
{
// (left is negative)
return 1;
}
return 0;
}
left = FixedMul ( ldy>>FRACBITS , dx );
right = FixedMul ( dy , ldx>>FRACBITS );
if (right < left)
{
// front side
return 0;
}
// back side
return 1;
}
//
// R_PointToAngle
// To get a global angle from cartesian coordinates,
// the coordinates are flipped until they are in
// the first octant of the coordinate system, then
// the y (<=x) is scaled and divided by x to get a
// tangent (slope) value which is looked up in the
// tantoangle[] table.
//
angle_t
R_PointToAngle
( fixed_t x,
fixed_t y )
{
x -= viewx;
y -= viewy;
if ( (!x) && (!y) )
return 0;
if (x>= 0)
{
// x >=0
if (y>= 0)
{
// y>= 0
if (x>y)
{
// octant 0
return tantoangle[ SlopeDiv(y,x)];
}
else
{
// octant 1
return ANG90-1-tantoangle[ SlopeDiv(x,y)];
}
}
else
{
// y<0
y = -y;
if (x>y)
{
// octant 8
return -tantoangle[SlopeDiv(y,x)];
}
else
{
// octant 7
return ANG270+tantoangle[ SlopeDiv(x,y)];
}
}
}
else
{
// x<0
x = -x;
if (y>= 0)
{
// y>= 0
if (x>y)
{
// octant 3
return ANG180-1-tantoangle[ SlopeDiv(y,x)];
}
else
{
// octant 2
return ANG90+ tantoangle[ SlopeDiv(x,y)];
}
}
else
{
// y<0
y = -y;
if (x>y)
{
// octant 4
return ANG180+tantoangle[ SlopeDiv(y,x)];
}
else
{
// octant 5
return ANG270-1-tantoangle[ SlopeDiv(x,y)];
}
}
}
return 0;
}
angle_t
R_PointToAngle2
( fixed_t x1,
fixed_t y1,
fixed_t x2,
fixed_t y2 )
{
viewx = x1;
viewy = y1;
return R_PointToAngle (x2, y2);
}
fixed_t
R_PointToDist
( fixed_t x,
fixed_t y )
{
int angle;
fixed_t dx;
fixed_t dy;
fixed_t temp;
fixed_t dist;
dx = abs(x - viewx);
dy = abs(y - viewy);
if (dy>dx)
{
temp = dx;
dx = dy;
dy = temp;
}
angle = (tantoangle[ FixedDiv(dy,dx)>>DBITS ]+ANG90) >> ANGLETOFINESHIFT;
// use as cosine
dist = FixedDiv (dx, finesine[angle] );
return dist;
}
//
// R_InitPointToAngle
//
void R_InitPointToAngle (void)
{
// UNUSED - now getting from tables.c
#if 0
int i;
long t;
float f;
//
// slope (tangent) to angle lookup
//
for (i=0 ; i<=SLOPERANGE ; i++)
{
f = atan( (float)i/SLOPERANGE )/(3.141592657*2);
t = 0xffffffff*f;
tantoangle[i] = t;
}
#endif
}
//
// R_ScaleFromGlobalAngle
// Returns the texture mapping scale
// for the current line (horizontal span)
// at the given angle.
// rw_distance must be calculated first.
//
fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
{
fixed_t scale;
int anglea;
int angleb;
int sinea;
int sineb;
fixed_t num;
int den;
// UNUSED
#if 0
{
fixed_t dist;
fixed_t z;
fixed_t sinv;
fixed_t cosv;
sinv = finesine[(visangle-rw_normalangle)>>ANGLETOFINESHIFT];
dist = FixedDiv (rw_distance, sinv);
cosv = finecosine[(viewangle-visangle)>>ANGLETOFINESHIFT];
z = abs(FixedMul (dist, cosv));
scale = FixedDiv(projection, z);
return scale;
}
#endif
anglea = ANG90 + (visangle-viewangle);
angleb = ANG90 + (visangle-rw_normalangle);
// both sines are allways positive
sinea = finesine[anglea>>ANGLETOFINESHIFT];
sineb = finesine[angleb>>ANGLETOFINESHIFT];
num = FixedMul(projection,sineb)<<detailshift;
den = FixedMul(rw_distance,sinea);
if (den > num>>16)
{
scale = FixedDiv (num, den);
if (scale > 64*FRACUNIT)
scale = 64*FRACUNIT;
else if (scale < 256)
scale = 256;
}
else
scale = 64*FRACUNIT;
return scale;
}
//
// R_InitTables
//
void R_InitTables (void)
{
// UNUSED: now getting from tables.c
#if 0
int i;
float a;
float fv;
int t;
// viewangle tangent table
for (i=0 ; i<FINEANGLES/2 ; i++)
{
a = (i-FINEANGLES/4+0.5)*PI*2/FINEANGLES;
fv = FRACUNIT*tan (a);
t = fv;
finetangent[i] = t;
}
// finesine table
for (i=0 ; i<5*FINEANGLES/4 ; i++)
{
// OPTIMIZE: mirror...
a = (i+0.5)*PI*2/FINEANGLES;
t = FRACUNIT*sin (a);
finesine[i] = t;
}
#endif
}
//
// R_InitTextureMapping
//
void R_InitTextureMapping (void)
{
int i;
int x;
int t;
fixed_t focallength;
// Use tangent table to generate viewangletox:
// viewangletox will give the next greatest x
// after the view angle.
//
// Calc focallength
// so FIELDOFVIEW angles covers SCREENWIDTH.
focallength = FixedDiv (centerxfrac,
finetangent[FINEANGLES/4+FIELDOFVIEW/2] );
for (i=0 ; i<FINEANGLES/2 ; i++)
{
if (finetangent[i] > FRACUNIT*2)
t = -1;
else if (finetangent[i] < -FRACUNIT*2)
t = viewwidth+1;
else
{
t = FixedMul (finetangent[i], focallength);
t = (centerxfrac - t+FRACUNIT-1)>>FRACBITS;
if (t < -1)
t = -1;
else if (t>viewwidth+1)
t = viewwidth+1;
}
viewangletox[i] = t;
}
// Scan viewangletox[] to generate xtoviewangle[]:
// xtoviewangle will give the smallest view angle
// that maps to x.
for (x=0;x<=viewwidth;x++)
{
i = 0;
while (viewangletox[i]>x)
i++;
xtoviewangle[x] = (i<<ANGLETOFINESHIFT)-ANG90;
}
// Take out the fencepost cases from viewangletox.
for (i=0 ; i<FINEANGLES/2 ; i++)
{
t = FixedMul (finetangent[i], focallength);
t = centerx - t;
if (viewangletox[i] == -1)
viewangletox[i] = 0;
else if (viewangletox[i] == viewwidth+1)
viewangletox[i] = viewwidth;
}
clipangle = xtoviewangle[0];
}
//
// R_InitLightTables
// Only inits the zlight table,
// because the scalelight table changes with view size.
//
#define DISTMAP 2
void R_InitLightTables (void)
{
int i;
int j;
int level;
int startmap;
int scale;
// Calculate the light levels to use
// for each level / distance combination.
for (i=0 ; i< LIGHTLEVELS ; i++)
{
startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
for (j=0 ; j<MAXLIGHTZ ; j++)
{
scale = FixedDiv ((SCREENWIDTH/2*FRACUNIT), (j+1)<<LIGHTZSHIFT);
scale >>= LIGHTSCALESHIFT;
level = startmap - scale/DISTMAP;
if (level < 0)
level = 0;
if (level >= NUMCOLORMAPS)
level = NUMCOLORMAPS-1;
zlight[i][j] = colormaps + level*256;
}
}
}
//
// R_SetViewSize
// Do not really change anything here,
// because it might be in the middle of a refresh.
// The change will take effect next refresh.
//
boolean setsizeneeded;
int setblocks;
int setdetail;
void
R_SetViewSize
( int blocks,
int detail )
{
setsizeneeded = true;
setblocks = blocks;
setdetail = detail;
}
//
// R_ExecuteSetViewSize
//
void R_ExecuteSetViewSize (void)
{
fixed_t cosadj;
fixed_t dy;
int i;
int j;
int level;
int startmap;
setsizeneeded = false;
if (setblocks == 11)
{
scaledviewwidth = SCREENWIDTH;
viewheight = SCREENHEIGHT;
}
else
{
scaledviewwidth = setblocks*32;
viewheight = (setblocks*168/10)&~7;
}
detailshift = setdetail;
viewwidth = scaledviewwidth>>detailshift;
centery = viewheight/2;
centerx = viewwidth/2;
centerxfrac = centerx<<FRACBITS;
centeryfrac = centery<<FRACBITS;
projection = centerxfrac;
if (!detailshift)
{
colfunc = basecolfunc = R_DrawColumn;
fuzzcolfunc = R_DrawFuzzColumn;
transcolfunc = R_DrawTranslatedColumn;
spanfunc = R_DrawSpan;
}
else
{
colfunc = basecolfunc = R_DrawColumnLow;
fuzzcolfunc = R_DrawFuzzColumn;
transcolfunc = R_DrawTranslatedColumn;
spanfunc = R_DrawSpanLow;
}
R_InitBuffer (scaledviewwidth, viewheight);
R_InitTextureMapping ();
// psprite scales
pspritescale = FRACUNIT*viewwidth/SCREENWIDTH;
pspriteiscale = FRACUNIT*SCREENWIDTH/viewwidth;
// thing clipping
for (i=0 ; i<viewwidth ; i++)
screenheightarray[i] = viewheight;
// planes
for (i=0 ; i<viewheight ; i++)
{
dy = ((i-viewheight/2)<<FRACBITS)+FRACUNIT/2;
dy = abs(dy);
yslope[i] = FixedDiv ( (viewwidth<<detailshift)/2*FRACUNIT, dy);
}
for (i=0 ; i<viewwidth ; i++)
{
cosadj = abs(finecosine[xtoviewangle[i]>>ANGLETOFINESHIFT]);
distscale[i] = FixedDiv (FRACUNIT,cosadj);
}
// Calculate the light levels to use
// for each level / scale combination.
for (i=0 ; i< LIGHTLEVELS ; i++)
{
startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
for (j=0 ; j<MAXLIGHTSCALE ; j++)
{
level = startmap - j*SCREENWIDTH/(viewwidth<<detailshift)/DISTMAP;
if (level < 0)
level = 0;
if (level >= NUMCOLORMAPS)
level = NUMCOLORMAPS-1;
scalelight[i][j] = colormaps + level*256;
}
}
}
//
// R_Init
//
extern int detailLevel;
extern int screenblocks;
void R_Init (void)
{
R_InitData ();
printf ("\nR_InitData");
R_InitPointToAngle ();
printf ("\nR_InitPointToAngle");
R_InitTables ();
// viewwidth / viewheight / detailLevel are set by the defaults
printf ("\nR_InitTables");
R_SetViewSize (screenblocks, detailLevel);
R_InitPlanes ();
printf ("\nR_InitPlanes");
R_InitLightTables ();
printf ("\nR_InitLightTables");
R_InitSkyMap ();
printf ("\nR_InitSkyMap");
R_InitTranslationTables ();
printf ("\nR_InitTranslationsTables");
framecount = 0;
}
//
// R_PointInSubsector
//
subsector_t*
R_PointInSubsector
( fixed_t x,
fixed_t y )
{
node_t* node;
int side;
int nodenum;
// single subsector is a special case
if (!numnodes)
return subsectors;
nodenum = numnodes-1;
while (! (nodenum & NF_SUBSECTOR) )
{
node = &nodes[nodenum];
side = R_PointOnSide (x, y, node);
nodenum = node->children[side];
}
return &subsectors[nodenum & ~NF_SUBSECTOR];
}
//
// R_SetupFrame
//
void R_SetupFrame (player_t* player)
{
int i;
viewplayer = player;
viewx = player->mo->x;
viewy = player->mo->y;
viewangle = player->mo->angle + viewangleoffset;
extralight = player->extralight;
viewz = player->viewz;
viewsin = finesine[viewangle>>ANGLETOFINESHIFT];
viewcos = finecosine[viewangle>>ANGLETOFINESHIFT];
sscount = 0;
if (player->fixedcolormap)
{
fixedcolormap =
colormaps
+ player->fixedcolormap*256*sizeof(lighttable_t);
walllights = scalelightfixed;
for (i=0 ; i<MAXLIGHTSCALE ; i++)
scalelightfixed[i] = fixedcolormap;
}
else
fixedcolormap = 0;
framecount++;
validcount++;
}
//
// R_RenderView
//
void R_RenderPlayerView (player_t* player)
{
R_SetupFrame (player);
// Clear buffers.
R_ClearClipSegs ();
R_ClearDrawSegs ();
R_ClearPlanes ();
R_ClearSprites ();
// check for new console commands.
NetUpdate ();
// The head node is the last node output.
R_RenderBSPNode (numnodes-1);
// Check for new console commands.
NetUpdate ();
R_DrawPlanes ();
// Check for new console commands.
NetUpdate ();
R_DrawMasked ();
// Check for new console commands.
NetUpdate ();
}
--- NEW FILE: missing ---
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard at iro.umontreal.ca>, 1996.
# 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, 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.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
--- NEW FILE: r_main.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_main.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#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 projection;
extern int validcount;
extern int linecount;
extern int loopcount;
//
// Lighting LUT.
// Used for z-depth cuing per column/row,
// and other lighting effects (sector ambient, flash).
//
// Lighting constants.
// Now why not 32 levels here?
#define LIGHTLEVELS 16
#define LIGHTSEGSHIFT 4
#define MAXLIGHTSCALE 48
#define LIGHTSCALESHIFT 12
#define MAXLIGHTZ 128
#define LIGHTZSHIFT 20
extern lighttable_t* scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
extern lighttable_t* scalelightfixed[MAXLIGHTSCALE];
extern lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ];
extern int extralight;
extern lighttable_t* fixedcolormap;
// Number of diminishing brightness levels.
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
#define NUMCOLORMAPS 32
// Blocky/low detail mode.
//B remove this?
// 0 = high, 1 = low
extern int detailshift;
//
// Function pointers to switch refresh/drawing functions.
// Used to select shadow mode etc.
//
extern void (*colfunc) (void);
extern void (*basecolfunc) (void);
extern void (*fuzzcolfunc) (void);
// No shadow effects on floors.
extern void (*spanfunc) (void);
//
// Utility functions.
int
R_PointOnSide
( fixed_t x,
fixed_t y,
node_t* node );
int
R_PointOnSegSide
( fixed_t x,
fixed_t y,
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 );
fixed_t
R_PointToDist
( fixed_t x,
fixed_t y );
fixed_t R_ScaleFromGlobalAngle (angle_t visangle);
subsector_t*
R_PointInSubsector
( fixed_t x,
fixed_t y );
void
R_AddPointToBox
( int x,
int y,
fixed_t* box );
//
// REFRESH - the actual rendering functions.
//
// Called by G_Drawer.
void R_RenderPlayerView (player_t *player);
// Called by startup code.
void R_Init (void);
// Called by M_Responder.
void R_SetViewSize (int blocks, int detail);
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_main.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_sky.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_sky.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_sky.c,v $
// Revision 1.1 2006-10-03 11:26:22 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Sky rendering. The DOOM sky is a texture map like any
// wall, wrapping around. A 1024 columns equal 360 degrees.
// The default sky map is 256 columns and repeats 4 times
// on a 320 screen?
//
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: r_sky.c,v 1.1 2006-10-03 11:26:22 dslinux_amadeus Exp $";
// Needed for FRACUNIT.
#include "m_fixed.h"
// Needed for Flat retrieval.
#include "r_data.h"
#ifdef __GNUG__
#pragma implementation "r_sky.h"
#endif
#include "r_sky.h"
//
// sky mapping
//
int skyflatnum;
int skytexture;
int skytexturemid;
//
// R_InitSkyMap
// Called whenever the view size changes.
//
void R_InitSkyMap (void)
{
// skyflatnum = R_FlatNumForName ( SKYFLATNAME );
skytexturemid = 100*FRACUNIT;
}
--- NEW FILE: FILES2 ---
ChangeLog
FILES
FILES2
Makefile
-----------------------------------------------------------------------
Global and misc. stuff
-----------------------------------------------------------------------
doomdata.h - external data definitions (WAD file structure)
doomdef.h - internal data definitions (game structs)
dstrings.h - printed strings for translation, english
d_french.h - printed strings for translation
info.h
info.c - LUT's for Thing TAB, Frame TAB,
generated by multigen utility
dutils.h
dutils.c - Dave's utilities
including doubly-linked lists & simple state machines.
Used in WI, ST, AM, and d_main.c
------------------------------------------------------------------------
DOOM game loop and top level stuff
------------------------------------------------------------------------
g_game.c - Game loop functions, event handling etc.
boolean G_CheckDemoStatus (void);
void G_ReadDemoTiccmd (ticcmd_t *cmd);
void G_WriteDemoTiccmd (ticcmd_t *cmd);
void G_PlayerReborn (int player);
void G_InitNew (skill_t skill, int episode, int map);
void G_DoReborn (int playernum);
void G_DoLoadLevel (void);
void G_DoNewGame (void);
void G_DoLoadGame (void);
void G_DoPlayDemo (void);
void G_DoCompleted (void);
void G_DoVictory (void);
void G_DoWorldDone (void);
void G_DoSaveGame (void);
d_main.c - event handling, D_DoomMain() and other functions
NOT int main()
d_net.c - high level networking protocol code
------------------------------------------------------------------
I Interfaces, system specifics
------------------------------------------------------------------
i_main.c - main(), calls D_DoomMain().
i_svgalib.c - Linux SVGAlib code, including main(),
replaces i_main.c
i_x.c - X11 with SHM code, use with i_main.c
i_dga.c - X11 DGA code, use with i_main.c
i_unix.c - fixed point, networking, and display stuff for UNIX
i_ibm.c - IBM DOS VGA graphics and key/mouse/joystick,
use with i_main.c
i_pcnet.c - IPX networking, DOS
fpfunc.S - fixed point assembly and (currently) duplicate of
tmap.S - texture mapping assembly (currently unused)
------------------------------------------------------------------
AM AutoMap
------------------------------------------------------------------
am_data.h - vector graphics for the automap
am_map.h
am_map.c - automap code
------------------------------------------------------------------
HU Heads Up
------------------------------------------------------------------
hu_lib.h
hu_lib.c - heads-up text and input code
hu_stuff.h
hu_stuff.c - Heads-up displays
-------------------------------------------------------------------
M Menu
-------------------------------------------------------------------
m_menu.c - DOOM options code and leaving messages
m_misc.c - misc. HUD text display, input checks, and
random table, file I/O
-------------------------------------------------------------------
P Play???
-------------------------------------------------------------------
p_local.h - header for all play modules
p_spec.h - specials, lighting, doors, plats, texture animation
p_spec.c - specials, texture animation
p_doors.c - door code
p_plats.c - platform raising/lowering code
p_ceilng.c - active (e.g. crushing) ceilings
p_floor.c - active (e.g. raising) floors
p_lights.c - dynamic (e.g. flickering) lighting
p_switch.c - button switches and animation
p_enemy.c - enemy AI and animation
p_inter.c - object/object interaction?
p_map.c - movement objects, handling of collisions
p_maputl.c - distance, position etc. utilities for movement
p_mobj.c - mobile objects handling, spawn etc.
p_user.c - more movement, bobbing etc.
p_telept.c - teleportation code
p_sight.c - LOS checks, REJECT
p_pspr.c - weapon overlays, bobbing, raising, sprite tables,
firing, ammo bookkeeping
p_setup.c - load map from WAF file, setup code
p_tick.c - savegame function (archive/unarchive),
thinker list handling, allocation,
game tick execution (updates)
-------------------------------------------------------------------
R Rendering
-------------------------------------------------------------------
r_local.h - header for all rendering modules,
internal map data structure definitions
r_bsp.c - BSP seg's clipping
r_data.c - texture column caching, patch assembly,
flats, colormaps, sprites,
lookup by name
r_draw.c - access to framebuffer API, drawing C functions
r_main.c - geometry functions, trigonometry lookups,
R_RenderPlayerView
r_plane.c - floor/ceiling visplanes, sky
r_segs.c - drawing segs, marking hslices for floors/ceilings
r_things.c - sprite and sprite frame/rotation handling, drawing
tables.c - trigonometry lookup tables, static
v_video.c - gamma correction lookup, patch drawing to rectangle
-------------------------------------------------------------------
S Sound
-------------------------------------------------------------------
s_sound.c - more sound and music handling
soundst.h - sound and music data structures
sounds.h
sounds.c - sound and music lump LUT's (manually maintained)
sndserver.h
sndserver.c - (Irix) sndserver code
irix.h
irix.c - SGI Irix sound/sndserver support code
linux.c - Linux voxware sound/sndserver support code,
replaces irix.c, uses irix.h
sun.c - SUN replacement for irix.c
i_sound.h
i_sound.c - DOS DMX music and sound interface
-------------------------------------------------------------------
ST STatus bar
-------------------------------------------------------------------
st_lib.h
st_lib.c - status bar widget code
st_stuff.c
st_stuff.h - status bar code
-------------------------------------------------------------------
W Wad file I/O
-------------------------------------------------------------------
w_wad.c - lump based functions
wadread.h
wadread.c - lump I/O, get SFX
-------------------------------------------------------------------
WI WIn / level end screens
-------------------------------------------------------------------
wi_data.h - lookups for intermission screens, patch positions
wi_stuff.h
wi_stuff.c - intermission animation patchwork
-------------------------------------------------------------------
Z Zone memory allocation
-------------------------------------------------------------------
z_zone.c
-------------------------------------------------------------------
F Final screen animation
-------------------------------------------------------------------
f_finale.c - DOOM mission end screens? (bunny)
-------------------------------------------------------------------
--- NEW FILE: p_mobj.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_mobj.h,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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"
#ifdef __GNUG__
#pragma interface
#endif
//
// 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
//
typedef enum
{
// Call P_SpecialThing when touched.
MF_SPECIAL = 1,
// Blocks.
MF_SOLID = 2,
// Can be hit.
MF_SHOOTABLE = 4,
// Don't use the sector links (invisible but touchable).
MF_NOSECTOR = 8,
// Don't use the blocklinks (inert but displayable)
MF_NOBLOCKMAP = 16,
// Not to be activated by sound, deaf monster.
MF_AMBUSH = 32,
// Will try to attack right back.
MF_JUSTHIT = 64,
// Will take at least one step before attacking.
MF_JUSTATTACKED = 128,
// On level spawning (initial position),
// hang from ceiling instead of stand on floor.
MF_SPAWNCEILING = 256,
// Don't apply gravity (every tic),
// that is, object will float, keeping current height
// or changing it actively.
MF_NOGRAVITY = 512,
// Movement flags.
// This allows jumps from high places.
MF_DROPOFF = 0x400,
// For players, will pick up items.
MF_PICKUP = 0x800,
// Player cheat. ???
MF_NOCLIP = 0x1000,
// Player: keep info about sliding along walls.
MF_SLIDE = 0x2000,
// Allow moves to any height, no gravity.
// For active floaters, e.g. cacodemons, pain elementals.
MF_FLOAT = 0x4000,
// Don't cross lines
// ??? or look at heights on teleport.
MF_TELEPORT = 0x8000,
// Don't hit same species, explode on block.
// Player missiles as well as fireballs of various kinds.
MF_MISSILE = 0x10000,
// Dropped by a demon, not level spawned.
// E.g. ammo clips dropped by dying former humans.
MF_DROPPED = 0x20000,
// Use fuzzy draw (shadow demons or spectres),
// temporary player invisibility powerup.
MF_SHADOW = 0x40000,
// Flag: don't bleed when shot (use puff),
// barrels and shootable furniture shall not bleed.
MF_NOBLOOD = 0x80000,
// Don't stop moving halfway off a step,
// that is, have dead bodies slide down all the way.
MF_CORPSE = 0x100000,
// Floating to a height for a move, ???
// don't auto float to target's height.
MF_INFLOAT = 0x200000,
// On kill, count this enemy object
// towards intermission kill total.
// Happy gathering.
MF_COUNTKILL = 0x400000,
// On picking up, count this item object
// towards intermission item total.
MF_COUNTITEM = 0x800000,
// Special handling: skull in flight.
// Neither a cacodemon nor a missile.
MF_SKULLFLY = 0x1000000,
// Don't spawn this object
// in death match mode (e.g. key cards).
MF_NOTDMATCH = 0x2000000,
// 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
MF_TRANSLATION = 0xc000000,
// Hmm ???.
MF_TRANSSHIFT = 26
} mobjflag_t;
// Map Object definition.
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;
//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;
struct subsector_s* subsector;
// The closest interval over all contacted Sectors.
fixed_t floorz;
fixed_t ceilingz;
// 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;
int flags;
int health;
// Movement direction, movement generation (zig-zagging).
int movedir; // 0-7
int movecount; // when 0, select a new dir
// 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.
int reactiontime;
// If >0, the target will be chased
// no matter what (even if shot)
int threshold;
// Additional info record for player avatars only.
// Only valid if type == MT_PLAYER
struct player_s* player;
// Player number last looked for.
int lastlook;
// For nightmare respawn.
mapthing_t spawnpoint;
// Thing being chased/attacked for tracers.
struct mobj_s* tracer;
} mobj_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_mobj.h,v $
// Revision 1.1 2006-10-03 11:26:20 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_ceilng.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_ceilng.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_ceilng.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION: Ceiling aninmation (lowering, crushing, raising)
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_ceilng.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "doomdef.h"
#include "p_local.h"
#include "s_sound.h"
// State.
#include "doomstat.h"
#include "r_state.h"
// Data.
#include "sounds.h"
//
// CEILINGS
//
ceiling_t* activeceilings[MAXCEILINGS];
//
// T_MoveCeiling
//
void T_MoveCeiling (ceiling_t* ceiling)
{
result_e res;
switch(ceiling->direction)
{
case 0:
// IN STASIS
break;
case 1:
// UP
res = T_MovePlane(ceiling->sector,
ceiling->speed,
ceiling->topheight,
false,1,ceiling->direction);
if (!(leveltime&7))
{
switch(ceiling->type)
{
case silentCrushAndRaise:
break;
default:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,
sfx_stnmov);
// ?
break;
}
}
if (res == pastdest)
{
switch(ceiling->type)
{
case raiseToHighest:
P_RemoveActiveCeiling(ceiling);
break;
case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,
sfx_pstop);
case fastCrushAndRaise:
case crushAndRaise:
ceiling->direction = -1;
break;
default:
break;
}
}
break;
case -1:
// DOWN
res = T_MovePlane(ceiling->sector,
ceiling->speed,
ceiling->bottomheight,
ceiling->crush,1,ceiling->direction);
if (!(leveltime&7))
{
switch(ceiling->type)
{
case silentCrushAndRaise: break;
default:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,
sfx_stnmov);
}
}
if (res == pastdest)
{
switch(ceiling->type)
{
case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg,
sfx_pstop);
case crushAndRaise:
ceiling->speed = CEILSPEED;
case fastCrushAndRaise:
ceiling->direction = 1;
break;
case lowerAndCrush:
case lowerToFloor:
P_RemoveActiveCeiling(ceiling);
break;
default:
break;
}
}
else // ( res != pastdest )
{
if (res == crushed)
{
switch(ceiling->type)
{
case silentCrushAndRaise:
case crushAndRaise:
case lowerAndCrush:
ceiling->speed = CEILSPEED / 8;
break;
default:
break;
}
}
}
break;
}
}
//
// EV_DoCeiling
// Move a ceiling up/down and all around!
//
int
EV_DoCeiling
( line_t* line,
ceiling_e type )
{
int secnum;
int rtn;
sector_t* sec;
ceiling_t* ceiling;
secnum = -1;
rtn = 0;
// Reactivate in-stasis ceilings...for certain types.
switch(type)
{
case fastCrushAndRaise:
case silentCrushAndRaise:
case crushAndRaise:
P_ActivateInStasisCeiling(line);
default:
break;
}
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
// new door thinker
rtn = 1;
ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVSPEC, 0);
P_AddThinker (&ceiling->thinker);
sec->specialdata = ceiling;
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
ceiling->sector = sec;
ceiling->crush = false;
switch(type)
{
case fastCrushAndRaise:
ceiling->crush = true;
ceiling->topheight = sec->ceilingheight;
ceiling->bottomheight = sec->floorheight + (8*FRACUNIT);
ceiling->direction = -1;
ceiling->speed = CEILSPEED * 2;
break;
case silentCrushAndRaise:
case crushAndRaise:
ceiling->crush = true;
ceiling->topheight = sec->ceilingheight;
case lowerAndCrush:
case lowerToFloor:
ceiling->bottomheight = sec->floorheight;
if (type != lowerToFloor)
ceiling->bottomheight += 8*FRACUNIT;
ceiling->direction = -1;
ceiling->speed = CEILSPEED;
break;
case raiseToHighest:
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
ceiling->direction = 1;
ceiling->speed = CEILSPEED;
break;
}
ceiling->tag = sec->tag;
ceiling->type = type;
P_AddActiveCeiling(ceiling);
}
return rtn;
}
//
// Add an active ceiling
//
void P_AddActiveCeiling(ceiling_t* c)
{
int i;
for (i = 0; i < MAXCEILINGS;i++)
{
if (activeceilings[i] == NULL)
{
activeceilings[i] = c;
return;
}
}
}
//
// Remove a ceiling's thinker
//
void P_RemoveActiveCeiling(ceiling_t* c)
{
int i;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i] == c)
{
activeceilings[i]->sector->specialdata = NULL;
P_RemoveThinker (&activeceilings[i]->thinker);
activeceilings[i] = NULL;
break;
}
}
}
//
// Restart a ceiling that's in-stasis
//
void P_ActivateInStasisCeiling(line_t* line)
{
int i;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i]
&& (activeceilings[i]->tag == line->tag)
&& (activeceilings[i]->direction == 0))
{
activeceilings[i]->direction = activeceilings[i]->olddirection;
activeceilings[i]->thinker.function.acp1
= (actionf_p1)T_MoveCeiling;
}
}
}
//
// EV_CeilingCrushStop
// Stop a ceiling from crushing!
//
int EV_CeilingCrushStop(line_t *line)
{
int i;
int rtn;
rtn = 0;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i]
&& (activeceilings[i]->tag == line->tag)
&& (activeceilings[i]->direction != 0))
{
activeceilings[i]->olddirection = activeceilings[i]->direction;
activeceilings[i]->thinker.function.acv = (actionf_v)NULL;
activeceilings[i]->direction = 0; // in-stasis
rtn = 1;
}
}
return rtn;
}
--- NEW FILE: Makefile.am ---
EXTRA_DIST = \
Changelog \
DOOMLIC.TXT \
FILES \
FILES2 \
README.SDL \
README.asm \
README.b \
README.book \
README.gl \
TODO
bin_PROGRAMS = doom
doom_SOURCES = \
am_map.c \
am_map.h \
d_englsh.h \
d_event.h \
d_french.h \
d_items.c \
d_items.h \
d_main.c \
d_main.h \
d_net.c \
d_net.h \
d_player.h \
d_textur.h \
d_think.h \
d_ticcmd.h \
doomdata.h \
doomdef.c \
doomdef.h \
doomstat.c \
doomstat.h \
doomtype.h \
dstrings.c \
dstrings.h \
f_finale.c \
f_finale.h \
f_wipe.c \
f_wipe.h \
g_game.c \
g_game.h \
hu_lib.c \
hu_lib.h \
hu_stuff.c \
hu_stuff.h \
i_main.c \
i_net.c \
i_net.h \
i_sound.c \
i_sound.h \
i_system.c \
i_system.h \
i_video.c \
i_video.h \
info.c \
info.h \
m_argv.c \
m_argv.h \
m_bbox.c \
m_bbox.h \
m_cheat.c \
m_cheat.h \
m_fixed.c \
m_fixed.h \
m_menu.c \
m_menu.h \
m_misc.c \
m_misc.h \
m_random.c \
m_random.h \
m_swap.c \
m_swap.h \
p_ceilng.c \
p_doors.c \
p_enemy.c \
p_floor.c \
p_inter.c \
p_inter.h \
p_lights.c \
p_local.h \
p_map.c \
p_maputl.c \
p_mobj.c \
p_mobj.h \
p_plats.c \
p_pspr.c \
p_pspr.h \
p_saveg.c \
p_saveg.h \
p_setup.c \
p_setup.h \
p_sight.c \
p_spec.c \
p_spec.h \
p_switch.c \
p_telept.c \
p_tick.c \
p_tick.h \
p_user.c \
r_bsp.c \
r_bsp.h \
r_data.c \
r_data.h \
r_defs.h \
r_draw.c \
r_draw.h \
r_local.h \
r_main.c \
r_main.h \
r_plane.c \
r_plane.h \
r_segs.c \
r_segs.h \
r_sky.c \
r_sky.h \
r_state.h \
r_things.c \
r_things.h \
s_sound.c \
s_sound.h \
sounds.c \
sounds.h \
st_lib.c \
st_lib.h \
st_stuff.c \
st_stuff.h \
tables.c \
tables.h \
v_video.c \
v_video.h \
w_wad.c \
w_wad.h \
wi_stuff.c \
wi_stuff.h \
z_zone.c \
z_zone.h
doom_LDADD = -lm
--- NEW FILE: p_pspr.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_pspr.h,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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;
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_pspr.h,v $
// Revision 1.1 2006-10-03 11:26:20 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_segs.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_segs.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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 );
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_segs.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_mobj.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_mobj.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_mobj.c,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...961 lines suppressed...]
x = source->x;
y = source->y;
z = source->z + 4*8*FRACUNIT;
th = P_SpawnMobj (x,y,z, type);
if (th->info->seesound)
S_StartSound (th, th->info->seesound);
th->target = source;
th->angle = an;
th->momx = FixedMul( th->info->speed,
finecosine[an>>ANGLETOFINESHIFT]);
th->momy = FixedMul( th->info->speed,
finesine[an>>ANGLETOFINESHIFT]);
th->momz = FixedMul( th->info->speed, slope);
P_CheckMissileSpawn (th);
}
--- NEW FILE: configure ---
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# Defaults:
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--with-microwin=[microwindows path] Prefix where microwindows is installed"
ac_help="$ac_help
--enable-dsp Use /dev/dsp for sound"
ac_help="$ac_help
--enable-esound Use ESD for sound"
[...1395 lines suppressed...]
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
EOF
cat >> $CONFIG_STATUS <<EOF
EOF
cat >> $CONFIG_STATUS <<\EOF
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
--- NEW FILE: r_segs.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_segs.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_segs.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// All the clipping: columns, horizontal spans, sky columns.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: r_segs.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include <stdlib.h>
#include "i_system.h"
#include "doomdef.h"
#include "doomstat.h"
#include "r_local.h"
#include "r_sky.h"
// OPTIMIZE: closed two sided lines as single sided
// True if any of the segs textures might be visible.
boolean segtextured;
// False if the back side is the same plane.
boolean markfloor;
boolean markceiling;
boolean maskedtexture;
int toptexture;
int bottomtexture;
int midtexture;
angle_t rw_normalangle;
// angle to line origin
int rw_angle1;
//
// regular wall
//
int rw_x;
int rw_stopx;
angle_t rw_centerangle;
fixed_t rw_offset;
fixed_t rw_distance;
fixed_t rw_scale;
fixed_t rw_scalestep;
fixed_t rw_midtexturemid;
fixed_t rw_toptexturemid;
fixed_t rw_bottomtexturemid;
int worldtop;
int worldbottom;
int worldhigh;
int worldlow;
fixed_t pixhigh;
fixed_t pixlow;
fixed_t pixhighstep;
fixed_t pixlowstep;
fixed_t topfrac;
fixed_t topstep;
fixed_t bottomfrac;
fixed_t bottomstep;
lighttable_t** walllights;
short* maskedtexturecol;
//
// R_RenderMaskedSegRange
//
void
R_RenderMaskedSegRange
( drawseg_t* ds,
int x1,
int x2 )
{
unsigned index;
column_t* col;
int lightnum;
int texnum;
// Calculate light table.
// Use different light tables
// for horizontal / vertical / diagonal. Diagonal?
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
curline = ds->curline;
frontsector = curline->frontsector;
backsector = curline->backsector;
texnum = texturetranslation[curline->sidedef->midtexture];
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT)+extralight;
if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
if (lightnum < 0)
walllights = scalelight[0];
else if (lightnum >= LIGHTLEVELS)
walllights = scalelight[LIGHTLEVELS-1];
else
walllights = scalelight[lightnum];
maskedtexturecol = ds->maskedtexturecol;
rw_scalestep = ds->scalestep;
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;
mfloorclip = ds->sprbottomclip;
mceilingclip = ds->sprtopclip;
// find positioning
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
{
dc_texturemid = frontsector->floorheight > backsector->floorheight
? frontsector->floorheight : backsector->floorheight;
dc_texturemid = dc_texturemid + textureheight[texnum] - viewz;
}
else
{
dc_texturemid =frontsector->ceilingheight<backsector->ceilingheight
? frontsector->ceilingheight : backsector->ceilingheight;
dc_texturemid = dc_texturemid - viewz;
}
dc_texturemid += curline->sidedef->rowoffset;
if (fixedcolormap)
dc_colormap = fixedcolormap;
// draw the columns
for (dc_x = x1 ; dc_x <= x2 ; dc_x++)
{
// calculate lighting
if (maskedtexturecol[dc_x] != MAXSHORT)
{
if (!fixedcolormap)
{
index = spryscale>>LIGHTSCALESHIFT;
if (index >= MAXLIGHTSCALE )
index = MAXLIGHTSCALE-1;
dc_colormap = walllights[index];
}
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
dc_iscale = 0xffffffffu / (unsigned)spryscale;
// draw the texture
col = (column_t *)(
(byte *)R_GetColumn(texnum,maskedtexturecol[dc_x]) -3);
R_DrawMaskedColumn (col);
maskedtexturecol[dc_x] = MAXSHORT;
}
spryscale += rw_scalestep;
}
}
//
// R_RenderSegLoop
// Draws zero, one, or two textures (and possibly a masked
// texture) for walls.
// Can draw or mark the starting pixel of floor and ceiling
// textures.
// CALLED: CORE LOOPING ROUTINE.
//
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
void R_RenderSegLoop (void)
{
angle_t angle;
unsigned index;
int yl;
int yh;
int mid;
fixed_t texturecolumn;
int top;
int bottom;
//texturecolumn = 0; // shut up compiler warning
for ( ; rw_x < rw_stopx ; rw_x++)
{
// mark floor / ceiling areas
yl = (topfrac+HEIGHTUNIT-1)>>HEIGHTBITS;
// no space above wall?
if (yl < ceilingclip[rw_x]+1)
yl = ceilingclip[rw_x]+1;
if (markceiling)
{
top = ceilingclip[rw_x]+1;
bottom = yl-1;
if (bottom >= floorclip[rw_x])
bottom = floorclip[rw_x]-1;
if (top <= bottom)
{
ceilingplane->top[rw_x] = top;
ceilingplane->bottom[rw_x] = bottom;
}
}
yh = bottomfrac>>HEIGHTBITS;
if (yh >= floorclip[rw_x])
yh = floorclip[rw_x]-1;
if (markfloor)
{
top = yh+1;
bottom = floorclip[rw_x]-1;
if (top <= ceilingclip[rw_x])
top = ceilingclip[rw_x]+1;
if (top <= bottom)
{
floorplane->top[rw_x] = top;
floorplane->bottom[rw_x] = bottom;
}
}
// texturecolumn and lighting are independent of wall tiers
if (segtextured)
{
// calculate texture offset
angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT;
texturecolumn = rw_offset-FixedMul(finetangent[angle],rw_distance);
texturecolumn >>= FRACBITS;
// calculate lighting
index = rw_scale>>LIGHTSCALESHIFT;
if (index >= MAXLIGHTSCALE )
index = MAXLIGHTSCALE-1;
dc_colormap = walllights[index];
dc_x = rw_x;
dc_iscale = 0xffffffffu / (unsigned)rw_scale;
}
// draw the wall tiers
if (midtexture)
{
// single sided line
dc_yl = yl;
dc_yh = yh;
dc_texturemid = rw_midtexturemid;
dc_source = R_GetColumn(midtexture,texturecolumn);
colfunc ();
ceilingclip[rw_x] = viewheight;
floorclip[rw_x] = -1;
}
else
{
// two sided line
if (toptexture)
{
// top wall
mid = pixhigh>>HEIGHTBITS;
pixhigh += pixhighstep;
if (mid >= floorclip[rw_x])
mid = floorclip[rw_x]-1;
if (mid >= yl)
{
dc_yl = yl;
dc_yh = mid;
dc_texturemid = rw_toptexturemid;
dc_source = R_GetColumn(toptexture,texturecolumn);
colfunc ();
ceilingclip[rw_x] = mid;
}
else
ceilingclip[rw_x] = yl-1;
}
else
{
// no top wall
if (markceiling)
ceilingclip[rw_x] = yl-1;
}
if (bottomtexture)
{
// bottom wall
mid = (pixlow+HEIGHTUNIT-1)>>HEIGHTBITS;
pixlow += pixlowstep;
// no space above wall?
if (mid <= ceilingclip[rw_x])
mid = ceilingclip[rw_x]+1;
if (mid <= yh)
{
dc_yl = mid;
dc_yh = yh;
dc_texturemid = rw_bottomtexturemid;
dc_source = R_GetColumn(bottomtexture,
texturecolumn);
colfunc ();
floorclip[rw_x] = mid;
}
else
floorclip[rw_x] = yh+1;
}
else
{
// no bottom wall
if (markfloor)
floorclip[rw_x] = yh+1;
}
if (maskedtexture)
{
// save texturecol
// for backdrawing of masked mid texture
maskedtexturecol[rw_x] = texturecolumn;
}
}
rw_scale += rw_scalestep;
topfrac += topstep;
bottomfrac += bottomstep;
}
}
//
// R_StoreWallRange
// A wall segment will be drawn
// between start and stop pixels (inclusive).
//
void
R_StoreWallRange
( int start,
int stop )
{
fixed_t hyp;
fixed_t sineval;
angle_t distangle, offsetangle;
fixed_t vtop;
int lightnum;
// don't overflow and crash
if (ds_p == &drawsegs[MAXDRAWSEGS])
return;
#ifdef RANGECHECK
if (start >=viewwidth || start > stop)
I_Error ("Bad R_RenderWallRange: %i to %i", start , stop);
#endif
sidedef = curline->sidedef;
linedef = curline->linedef;
// mark the segment as visible for auto map
linedef->flags |= ML_MAPPED;
// calculate rw_distance for scale calculation
rw_normalangle = curline->angle + ANG90;
offsetangle = abs(rw_normalangle-rw_angle1);
if (offsetangle > ANG90)
offsetangle = ANG90;
distangle = ANG90 - offsetangle;
hyp = R_PointToDist (curline->v1->x, curline->v1->y);
sineval = finesine[distangle>>ANGLETOFINESHIFT];
rw_distance = FixedMul (hyp, sineval);
ds_p->x1 = rw_x = start;
ds_p->x2 = stop;
ds_p->curline = curline;
rw_stopx = stop+1;
// calculate scale at both ends and step
ds_p->scale1 = rw_scale =
R_ScaleFromGlobalAngle (viewangle + xtoviewangle[start]);
if (stop > start )
{
ds_p->scale2 = R_ScaleFromGlobalAngle (viewangle + xtoviewangle[stop]);
ds_p->scalestep = rw_scalestep =
(ds_p->scale2 - rw_scale) / (stop-start);
}
else
{
// UNUSED: try to fix the stretched line bug
#if 0
if (rw_distance < FRACUNIT/2)
{
fixed_t trx,try;
fixed_t gxt,gyt;
trx = curline->v1->x - viewx;
try = curline->v1->y - viewy;
gxt = FixedMul(trx,viewcos);
gyt = -FixedMul(try,viewsin);
ds_p->scale1 = FixedDiv(projection, gxt-gyt)<<detailshift;
}
#endif
ds_p->scale2 = ds_p->scale1;
}
// calculate texture boundaries
// and decide if floor / ceiling marks are needed
worldtop = frontsector->ceilingheight - viewz;
worldbottom = frontsector->floorheight - viewz;
midtexture = toptexture = bottomtexture = maskedtexture = 0;
ds_p->maskedtexturecol = NULL;
if (!backsector)
{
// single sided line
midtexture = texturetranslation[sidedef->midtexture];
// a single sided line is terminal, so it must mark ends
markfloor = markceiling = true;
if (linedef->flags & ML_DONTPEGBOTTOM)
{
vtop = frontsector->floorheight +
textureheight[sidedef->midtexture];
// bottom of texture at bottom
rw_midtexturemid = vtop - viewz;
}
else
{
// top of texture at top
rw_midtexturemid = worldtop;
}
rw_midtexturemid += sidedef->rowoffset;
ds_p->silhouette = SIL_BOTH;
ds_p->sprtopclip = screenheightarray;
ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = MAXINT;
ds_p->tsilheight = MININT;
}
else
{
// two sided line
ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
ds_p->silhouette = 0;
if (frontsector->floorheight > backsector->floorheight)
{
ds_p->silhouette = SIL_BOTTOM;
ds_p->bsilheight = frontsector->floorheight;
}
else if (backsector->floorheight > viewz)
{
ds_p->silhouette = SIL_BOTTOM;
ds_p->bsilheight = MAXINT;
// ds_p->sprbottomclip = negonearray;
}
if (frontsector->ceilingheight < backsector->ceilingheight)
{
ds_p->silhouette |= SIL_TOP;
ds_p->tsilheight = frontsector->ceilingheight;
}
else if (backsector->ceilingheight < viewz)
{
ds_p->silhouette |= SIL_TOP;
ds_p->tsilheight = MININT;
// ds_p->sprtopclip = screenheightarray;
}
if (backsector->ceilingheight <= frontsector->floorheight)
{
ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = MAXINT;
ds_p->silhouette |= SIL_BOTTOM;
}
if (backsector->floorheight >= frontsector->ceilingheight)
{
ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = MININT;
ds_p->silhouette |= SIL_TOP;
}
worldhigh = backsector->ceilingheight - viewz;
worldlow = backsector->floorheight - viewz;
// hack to allow height changes in outdoor areas
if (frontsector->ceilingpic == skyflatnum
&& backsector->ceilingpic == skyflatnum)
{
worldtop = worldhigh;
}
if (worldlow != worldbottom
|| backsector->floorpic != frontsector->floorpic
|| backsector->lightlevel != frontsector->lightlevel)
{
markfloor = true;
}
else
{
// same plane on both sides
markfloor = false;
}
if (worldhigh != worldtop
|| backsector->ceilingpic != frontsector->ceilingpic
|| backsector->lightlevel != frontsector->lightlevel)
{
markceiling = true;
}
else
{
// same plane on both sides
markceiling = false;
}
if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight)
{
// closed door
markceiling = markfloor = true;
}
if (worldhigh < worldtop)
{
// top texture
toptexture = texturetranslation[sidedef->toptexture];
if (linedef->flags & ML_DONTPEGTOP)
{
// top of texture at top
rw_toptexturemid = worldtop;
}
else
{
vtop =
backsector->ceilingheight
+ textureheight[sidedef->toptexture];
// bottom of texture
rw_toptexturemid = vtop - viewz;
}
}
if (worldlow > worldbottom)
{
// bottom texture
bottomtexture = texturetranslation[sidedef->bottomtexture];
if (linedef->flags & ML_DONTPEGBOTTOM )
{
// bottom of texture at bottom
// top of texture at top
rw_bottomtexturemid = worldtop;
}
else // top of texture at top
rw_bottomtexturemid = worldlow;
}
rw_toptexturemid += sidedef->rowoffset;
rw_bottomtexturemid += sidedef->rowoffset;
// allocate space for masked texture tables
if (sidedef->midtexture)
{
// masked midtexture
maskedtexture = true;
ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x;
lastopening += rw_stopx - rw_x;
}
}
// calculate rw_offset (only needed for textured lines)
segtextured = midtexture | toptexture | bottomtexture | maskedtexture;
if (segtextured)
{
offsetangle = rw_normalangle-rw_angle1;
if (offsetangle > ANG180)
offsetangle = -offsetangle;
if (offsetangle > ANG90)
offsetangle = ANG90;
sineval = finesine[offsetangle >>ANGLETOFINESHIFT];
rw_offset = FixedMul (hyp, sineval);
if (rw_normalangle-rw_angle1 < ANG180)
rw_offset = -rw_offset;
rw_offset += sidedef->textureoffset + curline->offset;
rw_centerangle = ANG90 + viewangle - rw_normalangle;
// calculate light table
// use different light tables
// for horizontal / vertical / diagonal
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
if (!fixedcolormap)
{
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT)+extralight;
if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
if (lightnum < 0)
walllights = scalelight[0];
else if (lightnum >= LIGHTLEVELS)
walllights = scalelight[LIGHTLEVELS-1];
else
walllights = scalelight[lightnum];
}
}
// if a floor / ceiling plane is on the wrong side
// of the view plane, it is definitely invisible
// and doesn't need to be marked.
if (frontsector->floorheight >= viewz)
{
// above view plane
markfloor = false;
}
if (frontsector->ceilingheight <= viewz
&& frontsector->ceilingpic != skyflatnum)
{
// below view plane
markceiling = false;
}
// calculate incremental stepping values for texture edges
worldtop >>= 4;
worldbottom >>= 4;
topstep = -FixedMul (rw_scalestep, worldtop);
topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale);
bottomstep = -FixedMul (rw_scalestep,worldbottom);
bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale);
if (backsector)
{
worldhigh >>= 4;
worldlow >>= 4;
if (worldhigh < worldtop)
{
pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw_scale);
pixhighstep = -FixedMul (rw_scalestep,worldhigh);
}
if (worldlow > worldbottom)
{
pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale);
pixlowstep = -FixedMul (rw_scalestep,worldlow);
}
}
// render it
if (markceiling)
ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
if (markfloor)
floorplane = R_CheckPlane (floorplane, rw_x, rw_stopx-1);
R_RenderSegLoop ();
// save sprite clipping info
if ( ((ds_p->silhouette & SIL_TOP) || maskedtexture)
&& !ds_p->sprtopclip)
{
memcpy (lastopening, ceilingclip+start, 2*(rw_stopx-start));
ds_p->sprtopclip = lastopening - start;
lastopening += rw_stopx - start;
}
if ( ((ds_p->silhouette & SIL_BOTTOM) || maskedtexture)
&& !ds_p->sprbottomclip)
{
memcpy (lastopening, floorclip+start, 2*(rw_stopx-start));
ds_p->sprbottomclip = lastopening - start;
lastopening += rw_stopx - start;
}
if (maskedtexture && !(ds_p->silhouette&SIL_TOP))
{
ds_p->silhouette |= SIL_TOP;
ds_p->tsilheight = MININT;
}
if (maskedtexture && !(ds_p->silhouette&SIL_BOTTOM))
{
ds_p->silhouette |= SIL_BOTTOM;
ds_p->bsilheight = MAXINT;
}
ds_p++;
}
--- NEW FILE: p_pspr.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_pspr.c,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_pspr.c,v $
// Revision 1.1 2006-10-03 11:26:20 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Weapon sprite animation, weapon objects.
// Action functions for weapons.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_pspr.c,v 1.1 2006-10-03 11:26:20 dslinux_amadeus Exp $";
#include "doomdef.h"
#include "d_event.h"
#include "m_random.h"
#include "p_local.h"
#include "s_sound.h"
// State.
#include "doomstat.h"
// Data.
#include "sounds.h"
#include "p_pspr.h"
#define LOWERSPEED FRACUNIT*6
#define RAISESPEED FRACUNIT*6
#define WEAPONBOTTOM 128*FRACUNIT
#define WEAPONTOP 32*FRACUNIT
// plasma cells for a bfg attack
#define BFGCELLS 40
//
// P_SetPsprite
//
void
P_SetPsprite
( player_t* player,
int position,
statenum_t stnum )
{
pspdef_t* psp;
state_t* state;
psp = &player->psprites[position];
do
{
if (!stnum)
{
// object removed itself
psp->state = NULL;
break;
}
state = &states[stnum];
psp->state = state;
psp->tics = state->tics; // could be 0
if (state->misc1)
{
// coordinate set
psp->sx = state->misc1 << FRACBITS;
psp->sy = state->misc2 << FRACBITS;
}
// Call action routine.
// Modified handling.
if (state->action.acp2)
{
state->action.acp2(player, psp);
if (!psp->state)
break;
}
stnum = psp->state->nextstate;
} while (!psp->tics);
// an initial state of 0 could cycle through
}
//
// P_CalcSwing
//
fixed_t swingx;
fixed_t swingy;
void P_CalcSwing (player_t* player)
{
fixed_t swing;
int angle;
// OPTIMIZE: tablify this.
// A LUT would allow for different modes,
// and add flexibility.
swing = player->bob;
angle = (FINEANGLES/70*leveltime)&FINEMASK;
swingx = FixedMul ( swing, finesine[angle]);
angle = (FINEANGLES/70*leveltime+FINEANGLES/2)&FINEMASK;
swingy = -FixedMul ( swingx, finesine[angle]);
}
//
// P_BringUpWeapon
// Starts bringing the pending weapon up
// from the bottom of the screen.
// Uses player
//
void P_BringUpWeapon (player_t* player)
{
statenum_t newstate;
if (player->pendingweapon == wp_nochange)
player->pendingweapon = player->readyweapon;
if (player->pendingweapon == wp_chainsaw)
S_StartSound (player->mo, sfx_sawup);
newstate = weaponinfo[player->pendingweapon].upstate;
player->pendingweapon = wp_nochange;
player->psprites[ps_weapon].sy = WEAPONBOTTOM;
P_SetPsprite (player, ps_weapon, newstate);
}
//
// P_CheckAmmo
// Returns true if there is enough ammo to shoot.
// If not, selects the next weapon to use.
//
boolean P_CheckAmmo (player_t* player)
{
ammotype_t ammo;
int count;
ammo = weaponinfo[player->readyweapon].ammo;
// Minimal amount for one shot varies.
if (player->readyweapon == wp_bfg)
count = BFGCELLS;
else if (player->readyweapon == wp_supershotgun)
count = 2; // Double barrel.
else
count = 1; // Regular.
// Some do not need ammunition anyway.
// Return if current ammunition sufficient.
if (ammo == am_noammo || player->ammo[ammo] >= count)
return true;
// Out of ammo, pick a weapon to change to.
// Preferences are set here.
do
{
if (player->weaponowned[wp_plasma]
&& player->ammo[am_cell]
&& (gamemode != shareware) )
{
player->pendingweapon = wp_plasma;
}
else if (player->weaponowned[wp_supershotgun]
&& player->ammo[am_shell]>2
&& (gamemode == commercial) )
{
player->pendingweapon = wp_supershotgun;
}
else if (player->weaponowned[wp_chaingun]
&& player->ammo[am_clip])
{
player->pendingweapon = wp_chaingun;
}
else if (player->weaponowned[wp_shotgun]
&& player->ammo[am_shell])
{
player->pendingweapon = wp_shotgun;
}
else if (player->ammo[am_clip])
{
player->pendingweapon = wp_pistol;
}
else if (player->weaponowned[wp_chainsaw])
{
player->pendingweapon = wp_chainsaw;
}
else if (player->weaponowned[wp_missile]
&& player->ammo[am_misl])
{
player->pendingweapon = wp_missile;
}
else if (player->weaponowned[wp_bfg]
&& player->ammo[am_cell]>40
&& (gamemode != shareware) )
{
player->pendingweapon = wp_bfg;
}
else
{
// If everything fails.
player->pendingweapon = wp_fist;
}
} while (player->pendingweapon == wp_nochange);
// Now set appropriate weapon overlay.
P_SetPsprite (player,
ps_weapon,
weaponinfo[player->readyweapon].downstate);
return false;
}
//
// P_FireWeapon.
//
void P_FireWeapon (player_t* player)
{
statenum_t newstate;
if (!P_CheckAmmo (player))
return;
P_SetMobjState (player->mo, S_PLAY_ATK1);
newstate = weaponinfo[player->readyweapon].atkstate;
P_SetPsprite (player, ps_weapon, newstate);
P_NoiseAlert (player->mo, player->mo);
}
//
// P_DropWeapon
// Player died, so put the weapon away.
//
void P_DropWeapon (player_t* player)
{
P_SetPsprite (player,
ps_weapon,
weaponinfo[player->readyweapon].downstate);
}
//
// A_WeaponReady
// The player can fire the weapon
// or change to another weapon at this time.
// Follows after getting weapon up,
// or after previous attack/fire sequence.
//
void
A_WeaponReady
( player_t* player,
pspdef_t* psp )
{
statenum_t newstate;
int angle;
// get out of attack state
if (player->mo->state == &states[S_PLAY_ATK1]
|| player->mo->state == &states[S_PLAY_ATK2] )
{
P_SetMobjState (player->mo, S_PLAY);
}
if (player->readyweapon == wp_chainsaw
&& psp->state == &states[S_SAW])
{
S_StartSound (player->mo, sfx_sawidl);
}
// check for change
// if player is dead, put the weapon away
if (player->pendingweapon != wp_nochange || !player->health)
{
// change weapon
// (pending weapon should allready be validated)
newstate = weaponinfo[player->readyweapon].downstate;
P_SetPsprite (player, ps_weapon, newstate);
return;
}
// check for fire
// the missile launcher and bfg do not auto fire
if (player->cmd.buttons & BT_ATTACK)
{
if ( !player->attackdown
|| (player->readyweapon != wp_missile
&& player->readyweapon != wp_bfg) )
{
player->attackdown = true;
P_FireWeapon (player);
return;
}
}
else
player->attackdown = false;
// bob the weapon based on movement speed
angle = (128*leveltime)&FINEMASK;
psp->sx = FRACUNIT + FixedMul (player->bob, finecosine[angle]);
angle &= FINEANGLES/2-1;
psp->sy = WEAPONTOP + FixedMul (player->bob, finesine[angle]);
}
//
// A_ReFire
// The player can re-fire the weapon
// without lowering it entirely.
//
void A_ReFire
( player_t* player,
pspdef_t* psp )
{
// check for fire
// (if a weaponchange is pending, let it go through instead)
if ( (player->cmd.buttons & BT_ATTACK)
&& player->pendingweapon == wp_nochange
&& player->health)
{
player->refire++;
P_FireWeapon (player);
}
else
{
player->refire = 0;
P_CheckAmmo (player);
}
}
void
A_CheckReload
( player_t* player,
pspdef_t* psp )
{
P_CheckAmmo (player);
#if 0
if (player->ammo[am_shell]<2)
P_SetPsprite (player, ps_weapon, S_DSNR1);
#endif
}
//
// A_Lower
// Lowers current weapon,
// and changes weapon at bottom.
//
void
A_Lower
( player_t* player,
pspdef_t* psp )
{
psp->sy += LOWERSPEED;
// Is already down.
if (psp->sy < WEAPONBOTTOM )
return;
// Player is dead.
if (player->playerstate == PST_DEAD)
{
psp->sy = WEAPONBOTTOM;
// don't bring weapon back up
return;
}
// The old weapon has been lowered off the screen,
// so change the weapon and start raising it
if (!player->health)
{
// Player is dead, so keep the weapon off screen.
P_SetPsprite (player, ps_weapon, S_NULL);
return;
}
player->readyweapon = player->pendingweapon;
P_BringUpWeapon (player);
}
//
// A_Raise
//
void
A_Raise
( player_t* player,
pspdef_t* psp )
{
statenum_t newstate;
psp->sy -= RAISESPEED;
if (psp->sy > WEAPONTOP )
return;
psp->sy = WEAPONTOP;
// The weapon has been raised all the way,
// so change to the ready state.
newstate = weaponinfo[player->readyweapon].readystate;
P_SetPsprite (player, ps_weapon, newstate);
}
//
// A_GunFlash
//
void
A_GunFlash
( player_t* player,
pspdef_t* psp )
{
P_SetMobjState (player->mo, S_PLAY_ATK2);
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate);
}
//
// WEAPON ATTACKS
//
//
// A_Punch
//
void
A_Punch
( player_t* player,
pspdef_t* psp )
{
angle_t angle;
int damage;
int slope;
damage = (P_Random ()%10+1)<<1;
if (player->powers[pw_strength])
damage *= 10;
angle = player->mo->angle;
angle += (P_Random()-P_Random())<<18;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage);
// turn to face target
if (linetarget)
{
S_StartSound (player->mo, sfx_punch);
player->mo->angle = R_PointToAngle2 (player->mo->x,
player->mo->y,
linetarget->x,
linetarget->y);
}
}
//
// A_Saw
//
void
A_Saw
( player_t* player,
pspdef_t* psp )
{
angle_t angle;
int damage;
int slope;
damage = 2*(P_Random ()%10+1);
angle = player->mo->angle;
angle += (P_Random()-P_Random())<<18;
// use meleerange + 1 se the puff doesn't skip the flash
slope = P_AimLineAttack (player->mo, angle, MELEERANGE+1);
P_LineAttack (player->mo, angle, MELEERANGE+1, slope, damage);
if (!linetarget)
{
S_StartSound (player->mo, sfx_sawful);
return;
}
S_StartSound (player->mo, sfx_sawhit);
// turn to face target
angle = R_PointToAngle2 (player->mo->x, player->mo->y,
linetarget->x, linetarget->y);
if (angle - player->mo->angle > ANG180)
{
if (angle - player->mo->angle < -ANG90/20)
player->mo->angle = angle + ANG90/21;
else
player->mo->angle -= ANG90/20;
}
else
{
if (angle - player->mo->angle > ANG90/20)
player->mo->angle = angle - ANG90/21;
else
player->mo->angle += ANG90/20;
}
player->mo->flags |= MF_JUSTATTACKED;
}
//
// A_FireMissile
//
void
A_FireMissile
( player_t* player,
pspdef_t* psp )
{
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SpawnPlayerMissile (player->mo, MT_ROCKET);
}
//
// A_FireBFG
//
void
A_FireBFG
( player_t* player,
pspdef_t* psp )
{
player->ammo[weaponinfo[player->readyweapon].ammo] -= BFGCELLS;
P_SpawnPlayerMissile (player->mo, MT_BFG);
}
//
// A_FirePlasma
//
void
A_FirePlasma
( player_t* player,
pspdef_t* psp )
{
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,
ps_flash,
weaponinfo[player->readyweapon].flashstate+(P_Random ()&1) );
P_SpawnPlayerMissile (player->mo, MT_PLASMA);
}
//
// P_BulletSlope
// Sets a slope so a near miss is at aproximately
// the height of the intended target
//
fixed_t bulletslope;
void P_BulletSlope (mobj_t* mo)
{
angle_t an;
// see which target is to be aimed at
an = mo->angle;
bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
if (!linetarget)
{
an += 1<<26;
bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
if (!linetarget)
{
an -= 2<<26;
bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT);
}
}
}
//
// P_GunShot
//
void
P_GunShot
( mobj_t* mo,
boolean accurate )
{
angle_t angle;
int damage;
damage = 5*(P_Random ()%3+1);
angle = mo->angle;
if (!accurate)
angle += (P_Random()-P_Random())<<18;
P_LineAttack (mo, angle, MISSILERANGE, bulletslope, damage);
}
//
// A_FirePistol
//
void
A_FirePistol
( player_t* player,
pspdef_t* psp )
{
S_StartSound (player->mo, sfx_pistol);
P_SetMobjState (player->mo, S_PLAY_ATK2);
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,
ps_flash,
weaponinfo[player->readyweapon].flashstate);
P_BulletSlope (player->mo);
P_GunShot (player->mo, !player->refire);
}
//
// A_FireShotgun
//
void
A_FireShotgun
( player_t* player,
pspdef_t* psp )
{
int i;
S_StartSound (player->mo, sfx_shotgn);
P_SetMobjState (player->mo, S_PLAY_ATK2);
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,
ps_flash,
weaponinfo[player->readyweapon].flashstate);
P_BulletSlope (player->mo);
for (i=0 ; i<7 ; i++)
P_GunShot (player->mo, false);
}
//
// A_FireShotgun2
//
void
A_FireShotgun2
( player_t* player,
pspdef_t* psp )
{
int i;
angle_t angle;
int damage;
S_StartSound (player->mo, sfx_dshtgn);
P_SetMobjState (player->mo, S_PLAY_ATK2);
player->ammo[weaponinfo[player->readyweapon].ammo]-=2;
P_SetPsprite (player,
ps_flash,
weaponinfo[player->readyweapon].flashstate);
P_BulletSlope (player->mo);
for (i=0 ; i<20 ; i++)
{
damage = 5*(P_Random ()%3+1);
angle = player->mo->angle;
angle += (P_Random()-P_Random())<<19;
P_LineAttack (player->mo,
angle,
MISSILERANGE,
bulletslope + ((P_Random()-P_Random())<<5), damage);
}
}
//
// A_FireCGun
//
void
A_FireCGun
( player_t* player,
pspdef_t* psp )
{
S_StartSound (player->mo, sfx_pistol);
if (!player->ammo[weaponinfo[player->readyweapon].ammo])
return;
P_SetMobjState (player->mo, S_PLAY_ATK2);
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,
ps_flash,
weaponinfo[player->readyweapon].flashstate
+ psp->state
- &states[S_CHAIN1] );
P_BulletSlope (player->mo);
P_GunShot (player->mo, !player->refire);
}
//
// ?
//
void A_Light0 (player_t *player, pspdef_t *psp)
{
player->extralight = 0;
}
void A_Light1 (player_t *player, pspdef_t *psp)
{
player->extralight = 1;
}
void A_Light2 (player_t *player, pspdef_t *psp)
{
player->extralight = 2;
}
//
// A_BFGSpray
// Spawn a BFG explosion on every monster in view
//
void A_BFGSpray (mobj_t* mo)
{
int i;
int j;
int damage;
angle_t an;
// offset angles from its attack angle
for (i=0 ; i<40 ; i++)
{
an = mo->angle - ANG90/2 + ANG90/40*i;
// mo->target is the originator (player)
// of the missile
P_AimLineAttack (mo->target, an, 16*64*FRACUNIT);
if (!linetarget)
continue;
P_SpawnMobj (linetarget->x,
linetarget->y,
linetarget->z + (linetarget->height>>2),
MT_EXTRABFG);
damage = 0;
for (j=0;j<15;j++)
damage += (P_Random()&7) + 1;
P_DamageMobj (linetarget, mo->target,mo->target, damage);
}
}
//
// A_BFGsound
//
void
A_BFGsound
( player_t* player,
pspdef_t* psp )
{
S_StartSound (player->mo, sfx_bfg);
}
//
// P_SetupPsprites
// Called at start of level for each player.
//
void P_SetupPsprites (player_t* player)
{
int i;
// remove all psprites
for (i=0 ; i<NUMPSPRITES ; i++)
player->psprites[i].state = NULL;
// spawn the gun
player->pendingweapon = player->readyweapon;
P_BringUpWeapon (player);
}
//
// P_MovePsprites
// Called every tic by player thinking routine.
//
void P_MovePsprites (player_t* player)
{
int i;
pspdef_t* psp;
state_t* state;
psp = &player->psprites[0];
for (i=0 ; i<NUMPSPRITES ; i++, psp++)
{
// a null state means not active
if ( (state = psp->state) )
{
// drop tic count and possibly change state
// a -1 tic count never changes
if (psp->tics != -1)
{
psp->tics--;
if (!psp->tics)
P_SetPsprite (player, i, psp->state->nextstate);
}
}
}
player->psprites[ps_flash].sx = player->psprites[ps_weapon].sx;
player->psprites[ps_flash].sy = player->psprites[ps_weapon].sy;
}
--- NEW FILE: doomdata.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: doomdata.h,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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 "doomtype.h"
// Some global defines, that configure the game.
#include "doomdef.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
};
// A single Vertex.
typedef struct
{
short x;
short y;
} 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];
// Front sector, towards viewer.
short sector;
} mapsidedef_t;
// A LineDef, as used for editing, and as input
// to the BSP builder.
typedef struct
{
short v1;
short v2;
short flags;
short special;
short tag;
// sidenum[1] will be -1 if one sided
short sidenum[2];
} maplinedef_t;
//
// LineDef attributes.
//
// Solid, is an obstacle.
#define ML_BLOCKING 1
// Blocks monsters only.
#define ML_BLOCKMONSTERS 2
// Backside will not be present at all
// 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 allways 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
// Sector definition, from editing.
typedef struct
{
short floorheight;
short ceilingheight;
char floorpic[8];
char ceilingpic[8];
short lightlevel;
short special;
short tag;
} mapsector_t;
// SubSector, as generated by BSP.
typedef struct
{
short numsegs;
// Index of first one, segs are stored sequentially.
short firstseg;
} mapsubsector_t;
// LineSeg, generated by splitting LineDefs
// using partition lines selected by BSP builder.
typedef struct
{
short v1;
short v2;
short angle;
short linedef;
short side;
short offset;
} mapseg_t;
// BSP node structure.
// Indicate a leaf.
#define NF_SUBSECTOR 0x8000
typedef struct
{
// Partition line from (x,y) to x+dx,y+dy)
short x;
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];
} 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;
} mapthing_t;
#endif // __DOOMDATA__
//-----------------------------------------------------------------------------
//
// $Log: doomdata.h,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: d_items.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_items.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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
//-----------------------------------------------------------------------------
//
// $Log: d_items.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: INSTALL ---
Installing Doom! for Microwindows:
There are two ways to build Doom for Microwindows:
1. Quick build:
./build-ipaq.sh [microwindows path] - This will configure and build Doom for
the compaq Ipaq with no sound enabled.
2. Running configure:
Run configure with the following options:
--with-microwin: Specify where your microwindows headers and libraries exist
--enable-ipaq: Turn this option on to build for the Compaq Ipaq
(turns on the required structure packing)
--enable-dsp: Tries to use /dev/dsp for sound
--enable-esd: Tries to use an esound device for sound
3. Installing doom on your Ipaq
- Copy the doom binary and doom1.wad to the a directory on your Ipaq.
- Start your nano-X server
- Use the terminal or the console to start doom.
- Enjoy!
Check the README.NANOX for details. Enjoy!
--- NEW FILE: p_inter.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_inter.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_inter.c,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Handling interactions (i.e., collisions).
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_inter.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $";
// Data.
#include "doomdef.h"
#include "dstrings.h"
#include "sounds.h"
#include "doomstat.h"
#include "m_random.h"
#include "i_system.h"
#include "am_map.h"
#include "p_local.h"
#include "s_sound.h"
#ifdef __GNUG__
#pragma implementation "p_inter.h"
#endif
#include "p_inter.h"
#define BONUSADD 6
// a weapon is found with two clip loads,
// a big item has five clip loads
int maxammo[NUMAMMO] = {200, 50, 300, 50};
int clipammo[NUMAMMO] = {10, 4, 20, 1};
//
// GET STUFF
//
//
// P_GiveAmmo
// Num is the number of clip loads,
// not the individual count (0= 1/2 clip).
// Returns false if the ammo can't be picked up at all
//
boolean
P_GiveAmmo
( player_t* player,
ammotype_t ammo,
int num )
{
int oldammo;
if (ammo == am_noammo)
return false;
if (ammo < 0 || ammo > NUMAMMO)
I_Error ("P_GiveAmmo: bad type %i", ammo);
if ( player->ammo[ammo] == player->maxammo[ammo] )
return false;
if (num)
num *= clipammo[ammo];
else
num = clipammo[ammo]/2;
if (gameskill == sk_baby
|| gameskill == sk_nightmare)
{
// give double ammo in trainer mode,
// you'll need in nightmare
num <<= 1;
}
oldammo = player->ammo[ammo];
player->ammo[ammo] += num;
if (player->ammo[ammo] > player->maxammo[ammo])
player->ammo[ammo] = player->maxammo[ammo];
// If non zero ammo,
// don't change up weapons,
// player was lower on purpose.
if (oldammo)
return true;
// We were down to zero,
// so select a new weapon.
// Preferences are not user selectable.
switch (ammo)
{
case am_clip:
if (player->readyweapon == wp_fist)
{
if (player->weaponowned[wp_chaingun])
player->pendingweapon = wp_chaingun;
else
player->pendingweapon = wp_pistol;
}
break;
case am_shell:
if (player->readyweapon == wp_fist
|| player->readyweapon == wp_pistol)
{
if (player->weaponowned[wp_shotgun])
player->pendingweapon = wp_shotgun;
}
break;
case am_cell:
if (player->readyweapon == wp_fist
|| player->readyweapon == wp_pistol)
{
if (player->weaponowned[wp_plasma])
player->pendingweapon = wp_plasma;
}
break;
case am_misl:
if (player->readyweapon == wp_fist)
{
if (player->weaponowned[wp_missile])
player->pendingweapon = wp_missile;
}
default:
break;
}
return true;
}
//
// P_GiveWeapon
// The weapon name may have a MF_DROPPED flag ored in.
//
boolean
P_GiveWeapon
( player_t* player,
weapontype_t weapon,
boolean dropped )
{
boolean gaveammo;
boolean gaveweapon;
if (netgame
&& (deathmatch!=2)
&& !dropped )
{
// leave placed weapons forever on net games
if (player->weaponowned[weapon])
return false;
player->bonuscount += BONUSADD;
player->weaponowned[weapon] = true;
if (deathmatch)
P_GiveAmmo (player, weaponinfo[weapon].ammo, 5);
else
P_GiveAmmo (player, weaponinfo[weapon].ammo, 2);
player->pendingweapon = weapon;
if (player == &players[consoleplayer])
S_StartSound (NULL, sfx_wpnup);
return false;
}
if (weaponinfo[weapon].ammo != am_noammo)
{
// give one clip with a dropped weapon,
// two clips with a found weapon
if (dropped)
gaveammo = P_GiveAmmo (player, weaponinfo[weapon].ammo, 1);
else
gaveammo = P_GiveAmmo (player, weaponinfo[weapon].ammo, 2);
}
else
gaveammo = false;
if (player->weaponowned[weapon])
gaveweapon = false;
else
{
gaveweapon = true;
player->weaponowned[weapon] = true;
player->pendingweapon = weapon;
}
return (gaveweapon || gaveammo);
}
//
// P_GiveBody
// Returns false if the body isn't needed at all
//
boolean
P_GiveBody
( player_t* player,
int num )
{
if (player->health >= MAXHEALTH)
return false;
player->health += num;
if (player->health > MAXHEALTH)
player->health = MAXHEALTH;
player->mo->health = player->health;
return true;
}
//
// P_GiveArmor
// Returns false if the armor is worse
// than the current armor.
//
boolean
P_GiveArmor
( player_t* player,
int armortype )
{
int hits;
hits = armortype*100;
if (player->armorpoints >= hits)
return false; // don't pick up
player->armortype = armortype;
player->armorpoints = hits;
return true;
}
//
// P_GiveCard
//
void
P_GiveCard
( player_t* player,
card_t card )
{
if (player->cards[card])
return;
player->bonuscount = BONUSADD;
player->cards[card] = 1;
}
//
// P_GivePower
//
boolean
P_GivePower
( player_t* player,
int /*powertype_t*/ power )
{
if (power == pw_invulnerability)
{
player->powers[power] = INVULNTICS;
return true;
}
if (power == pw_invisibility)
{
player->powers[power] = INVISTICS;
player->mo->flags |= MF_SHADOW;
return true;
}
if (power == pw_infrared)
{
player->powers[power] = INFRATICS;
return true;
}
if (power == pw_ironfeet)
{
player->powers[power] = IRONTICS;
return true;
}
if (power == pw_strength)
{
P_GiveBody (player, 100);
player->powers[power] = 1;
return true;
}
if (player->powers[power])
return false; // already got it
player->powers[power] = 1;
return true;
}
//
// P_TouchSpecialThing
//
void
P_TouchSpecialThing
( mobj_t* special,
mobj_t* toucher )
{
player_t* player;
int i;
fixed_t delta;
int sound;
delta = special->z - toucher->z;
if (delta > toucher->height
|| delta < -8*FRACUNIT)
{
// out of reach
return;
}
sound = sfx_itemup;
player = toucher->player;
// Dead thing touching.
// Can happen with a sliding player corpse.
if (toucher->health <= 0)
return;
// Identify by sprite.
switch (special->sprite)
{
// armor
case SPR_ARM1:
if (!P_GiveArmor (player, 1))
return;
player->message = GOTARMOR;
break;
case SPR_ARM2:
if (!P_GiveArmor (player, 2))
return;
player->message = GOTMEGA;
break;
// bonus items
case SPR_BON1:
player->health++; // can go over 100%
if (player->health > 200)
player->health = 200;
player->mo->health = player->health;
player->message = GOTHTHBONUS;
break;
case SPR_BON2:
player->armorpoints++; // can go over 100%
if (player->armorpoints > 200)
player->armorpoints = 200;
if (!player->armortype)
player->armortype = 1;
player->message = GOTARMBONUS;
break;
case SPR_SOUL:
player->health += 100;
if (player->health > 200)
player->health = 200;
player->mo->health = player->health;
player->message = GOTSUPER;
sound = sfx_getpow;
break;
case SPR_MEGA:
if (gamemode != commercial)
return;
player->health = 200;
player->mo->health = player->health;
P_GiveArmor (player,2);
player->message = GOTMSPHERE;
sound = sfx_getpow;
break;
// cards
// leave cards for everyone
case SPR_BKEY:
if (!player->cards[it_bluecard])
player->message = GOTBLUECARD;
P_GiveCard (player, it_bluecard);
if (!netgame)
break;
return;
case SPR_YKEY:
if (!player->cards[it_yellowcard])
player->message = GOTYELWCARD;
P_GiveCard (player, it_yellowcard);
if (!netgame)
break;
return;
case SPR_RKEY:
if (!player->cards[it_redcard])
player->message = GOTREDCARD;
P_GiveCard (player, it_redcard);
if (!netgame)
break;
return;
case SPR_BSKU:
if (!player->cards[it_blueskull])
player->message = GOTBLUESKUL;
P_GiveCard (player, it_blueskull);
if (!netgame)
break;
return;
case SPR_YSKU:
if (!player->cards[it_yellowskull])
player->message = GOTYELWSKUL;
P_GiveCard (player, it_yellowskull);
if (!netgame)
break;
return;
case SPR_RSKU:
if (!player->cards[it_redskull])
player->message = GOTREDSKULL;
P_GiveCard (player, it_redskull);
if (!netgame)
break;
return;
// medikits, heals
case SPR_STIM:
if (!P_GiveBody (player, 10))
return;
player->message = GOTSTIM;
break;
case SPR_MEDI:
if (!P_GiveBody (player, 25))
return;
if (player->health < 25)
player->message = GOTMEDINEED;
else
player->message = GOTMEDIKIT;
break;
// power ups
case SPR_PINV:
if (!P_GivePower (player, pw_invulnerability))
return;
player->message = GOTINVUL;
sound = sfx_getpow;
break;
case SPR_PSTR:
if (!P_GivePower (player, pw_strength))
return;
player->message = GOTBERSERK;
if (player->readyweapon != wp_fist)
player->pendingweapon = wp_fist;
sound = sfx_getpow;
break;
case SPR_PINS:
if (!P_GivePower (player, pw_invisibility))
return;
player->message = GOTINVIS;
sound = sfx_getpow;
break;
case SPR_SUIT:
if (!P_GivePower (player, pw_ironfeet))
return;
player->message = GOTSUIT;
sound = sfx_getpow;
break;
case SPR_PMAP:
if (!P_GivePower (player, pw_allmap))
return;
player->message = GOTMAP;
sound = sfx_getpow;
break;
case SPR_PVIS:
if (!P_GivePower (player, pw_infrared))
return;
player->message = GOTVISOR;
sound = sfx_getpow;
break;
// ammo
case SPR_CLIP:
if (special->flags & MF_DROPPED)
{
if (!P_GiveAmmo (player,am_clip,0))
return;
}
else
{
if (!P_GiveAmmo (player,am_clip,1))
return;
}
player->message = GOTCLIP;
break;
case SPR_AMMO:
if (!P_GiveAmmo (player, am_clip,5))
return;
player->message = GOTCLIPBOX;
break;
case SPR_ROCK:
if (!P_GiveAmmo (player, am_misl,1))
return;
player->message = GOTROCKET;
break;
case SPR_BROK:
if (!P_GiveAmmo (player, am_misl,5))
return;
player->message = GOTROCKBOX;
break;
case SPR_CELL:
if (!P_GiveAmmo (player, am_cell,1))
return;
player->message = GOTCELL;
break;
case SPR_CELP:
if (!P_GiveAmmo (player, am_cell,5))
return;
player->message = GOTCELLBOX;
break;
case SPR_SHEL:
if (!P_GiveAmmo (player, am_shell,1))
return;
player->message = GOTSHELLS;
break;
case SPR_SBOX:
if (!P_GiveAmmo (player, am_shell,5))
return;
player->message = GOTSHELLBOX;
break;
case SPR_BPAK:
if (!player->backpack)
{
for (i=0 ; i<NUMAMMO ; i++)
player->maxammo[i] *= 2;
player->backpack = true;
}
for (i=0 ; i<NUMAMMO ; i++)
P_GiveAmmo (player, i, 1);
player->message = GOTBACKPACK;
break;
// weapons
case SPR_BFUG:
if (!P_GiveWeapon (player, wp_bfg, false) )
return;
player->message = GOTBFG9000;
sound = sfx_wpnup;
break;
case SPR_MGUN:
if (!P_GiveWeapon (player, wp_chaingun, special->flags&MF_DROPPED) )
return;
player->message = GOTCHAINGUN;
sound = sfx_wpnup;
break;
case SPR_CSAW:
if (!P_GiveWeapon (player, wp_chainsaw, false) )
return;
player->message = GOTCHAINSAW;
sound = sfx_wpnup;
break;
case SPR_LAUN:
if (!P_GiveWeapon (player, wp_missile, false) )
return;
player->message = GOTLAUNCHER;
sound = sfx_wpnup;
break;
case SPR_PLAS:
if (!P_GiveWeapon (player, wp_plasma, false) )
return;
player->message = GOTPLASMA;
sound = sfx_wpnup;
break;
case SPR_SHOT:
if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) )
return;
player->message = GOTSHOTGUN;
sound = sfx_wpnup;
break;
case SPR_SGN2:
if (!P_GiveWeapon (player, wp_supershotgun, special->flags&MF_DROPPED ) )
return;
player->message = GOTSHOTGUN2;
sound = sfx_wpnup;
break;
default:
I_Error ("P_SpecialThing: Unknown gettable thing");
}
if (special->flags & MF_COUNTITEM)
player->itemcount++;
P_RemoveMobj (special);
player->bonuscount += BONUSADD;
if (player == &players[consoleplayer])
S_StartSound (NULL, sound);
}
//
// KillMobj
//
void
P_KillMobj
( mobj_t* source,
mobj_t* target )
{
mobjtype_t item;
mobj_t* mo;
target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY);
if (target->type != MT_SKULL)
target->flags &= ~MF_NOGRAVITY;
target->flags |= MF_CORPSE|MF_DROPOFF;
target->height >>= 2;
if (source && source->player)
{
// count for intermission
if (target->flags & MF_COUNTKILL)
source->player->killcount++;
if (target->player)
source->player->frags[target->player-players]++;
}
else if (!netgame && (target->flags & MF_COUNTKILL) )
{
// count all monster deaths,
// even those caused by other monsters
players[0].killcount++;
}
if (target->player)
{
// count environment kills against you
if (!source)
target->player->frags[target->player-players]++;
target->flags &= ~MF_SOLID;
target->player->playerstate = PST_DEAD;
P_DropWeapon (target->player);
if (target->player == &players[consoleplayer]
&& automapactive)
{
// don't die in auto map,
// switch view prior to dying
AM_Stop ();
}
}
if (target->health < -target->info->spawnhealth
&& target->info->xdeathstate)
{
P_SetMobjState (target, target->info->xdeathstate);
}
else
P_SetMobjState (target, target->info->deathstate);
target->tics -= P_Random()&3;
if (target->tics < 1)
target->tics = 1;
// I_StartSound (&actor->r, actor->info->deathsound);
// Drop stuff.
// This determines the kind of object spawned
// during the death frame of a thing.
switch (target->type)
{
case MT_WOLFSS:
case MT_POSSESSED:
item = MT_CLIP;
break;
case MT_SHOTGUY:
item = MT_SHOTGUN;
break;
case MT_CHAINGUY:
item = MT_CHAINGUN;
break;
default:
return;
}
mo = P_SpawnMobj (target->x,target->y,ONFLOORZ, item);
mo->flags |= MF_DROPPED; // special versions of items
}
//
// P_DamageMobj
// Damages both enemies and players
// "inflictor" is the thing that caused the damage
// creature or missile, can be NULL (slime, etc)
// "source" is the thing to target after taking damage
// creature or NULL
// Source and inflictor are the same for melee attacks.
// Source can be NULL for slime, barrel explosions
// and other environmental stuff.
//
void
P_DamageMobj
( mobj_t* target,
mobj_t* inflictor,
mobj_t* source,
int damage )
{
unsigned ang;
int saved;
player_t* player;
fixed_t thrust;
int temp;
if ( !(target->flags & MF_SHOOTABLE) )
return; // shouldn't happen...
if (target->health <= 0)
return;
if ( target->flags & MF_SKULLFLY )
{
target->momx = target->momy = target->momz = 0;
}
player = target->player;
if (player && gameskill == sk_baby)
damage >>= 1; // take half damage in trainer mode
// Some close combat weapons should not
// inflict thrust and push the victim out of reach,
// thus kick away unless using the chainsaw.
if (inflictor
&& !(target->flags & MF_NOCLIP)
&& (!source
|| !source->player
|| source->player->readyweapon != wp_chainsaw))
{
ang = R_PointToAngle2 ( inflictor->x,
inflictor->y,
target->x,
target->y);
thrust = damage*(FRACUNIT>>3)*100/target->info->mass;
// make fall forwards sometimes
if ( damage < 40
&& damage > target->health
&& target->z - inflictor->z > 64*FRACUNIT
&& (P_Random ()&1) )
{
ang += ANG180;
thrust *= 4;
}
ang >>= ANGLETOFINESHIFT;
target->momx += FixedMul (thrust, finecosine[ang]);
target->momy += FixedMul (thrust, finesine[ang]);
}
// player specific
if (player)
{
// end of game hell hack
if (target->subsector->sector->special == 11
&& damage >= target->health)
{
damage = target->health - 1;
}
// Below certain threshold,
// ignore damage in GOD mode, or with INVUL power.
if ( damage < 1000
&& ( (player->cheats&CF_GODMODE)
|| player->powers[pw_invulnerability] ) )
{
return;
}
if (player->armortype)
{
if (player->armortype == 1)
saved = damage/3;
else
saved = damage/2;
if (player->armorpoints <= saved)
{
// armor is used up
saved = player->armorpoints;
player->armortype = 0;
}
player->armorpoints -= saved;
damage -= saved;
}
player->health -= damage; // mirror mobj health here for Dave
if (player->health < 0)
player->health = 0;
player->attacker = source;
player->damagecount += damage; // add damage after armor / invuln
if (player->damagecount > 100)
player->damagecount = 100; // teleport stomp does 10k points...
temp = damage < 100 ? damage : 100;
if (player == &players[consoleplayer])
I_Tactile (40,10,40+temp*2);
}
// do the damage
target->health -= damage;
if (target->health <= 0)
{
P_KillMobj (source, target);
return;
}
if ( (P_Random () < target->info->painchance)
&& !(target->flags&MF_SKULLFLY) )
{
target->flags |= MF_JUSTHIT; // fight back!
P_SetMobjState (target, target->info->painstate);
}
target->reactiontime = 0; // we're awake now...
if ( (!target->threshold || target->type == MT_VILE)
&& source && source != target
&& source->type != MT_VILE)
{
// if not intent on another player,
// chase after this one
target->target = source;
target->threshold = BASETHRESHOLD;
if (target->state == &states[target->info->spawnstate]
&& target->info->seestate != S_NULL)
P_SetMobjState (target, target->info->seestate);
}
}
--- NEW FILE: README.gl ---
README: glDOOM
I never got around to do anything with respect to
a Linux glDOOM port except for assembling a Linux3Dfx
HOWTO (which, at that time, was a prerequisite
to get permission to publicly distribute the
already finished LinuxGlide port by Daryll Strauss).
Linux q2test (and soon LinuxQuake2) demonstrate that
Mesa with the MesaVoodoo driver is quite up to the
requirements for a glDOOM port. If anybody wants to
get into Linux glDOOM, please drop me a line.
There is a Win32 GLDOOM port in the works, by Jim Dose.
Quoting a recent posting by him:
"I haven't had as much time lately to really work on
the conversion. I currently have the renderer drawing
the walls and floors as texture spans as the are in
the software renderer. There's lighting on the walls,
but not the floors, and sprites are being drawn, but
not with the right texture. I figure that this is one
nights work to get the game looking "normal". I haven't
tested the game on less than a p200, so I'm not sure
how it will perform under the average machine, but I
don't expect it to be blindingly fast because of the
number of spans that have to be drawn each frame.
Rendering as polys is definitely the way to go.
The reason I chose to do spans first was because it
left the base renderer intact and I could concentrate
on ironing out any Windows compatibility problems.
Actually, the first version I had running was simply
a blit of the 320x200 game screen through Open GL.
Surprisingly, this actually was very playable, but
certainly wasn't taking any advantage of 3D acceleration.
Once the game was running, I started converting all
the span routines over."
Comment: for merging Linuxdoom with Win32, this is
probably the best source for getting the Win32
environment done - before more significant changes
occur.
"One problem with drawing spans is that the engine
doesn't calculate the texture coordinates with
fractional accuracy, so the bilinear filtering works
vertically, but not horizontally on the walls. I may
try to fix this, but since I plan to use polys for
the final version, it's not really high priority.
Also, spans don't really allow for looking up and
down."
Comment: true looking up/down vs. Heretic-style
y-shearing seems to require either a strange kind
of transofrmation matrix (he probably does not use
the OpenGL transformation at all), or rendering
all the spans as textured rectangular slices
instead of using glDrawBitmap. No, polys are the
way to go.
"When I tackle the conversion to polys, one big problem
I'll encounter is drawing floors. Since the world is
stored in a 2D bsp tree, there is no information on
the shape of the floors. In fact the floors can be
concave and may include holes (typically, most renderers
break concave polys down into a collection of convex
polys or triangles). In software, the floors are actually
drawn using an algorithm that's similar to a flood fill
(except that a list of open spans is kept instead of a
buffer of pixels). This makes drawing the floors as
polys fairly difficult."
A polygon based approach will require significant changes
to the data structures used in the refresh module. I
recommend either separating a libref_soft.so first (a
Quake2 like approach), and creating libref_gl afterwards,
or abandoning the software rendering entirely.
John Carmack wrote once upon a time:
"... the U64 DOOM engine is much more what I would consider
The Right Thing now -- it turns the subsector boundaries
into polygons for the floors and ceilings ahead of time,
then for rendering it walks the BSP front to back, doing
visibility determination of subsectors by the one dimensional
occlusion buffer and clipping sprites into subsectors, then
it goes backwards through the visible subsectors, drawing
floors, ceilings, walls, then sorted internal sprite fragments.
It's a ton simpler and a ton faster, although it does suffer
some overdraw when a high subsector overlooks a low one (but
that is more than made up for by the simplicity of everything
else)."
Well, IMO compiling a separate list of floor/ceiling polygons
after having read the WAD file, and thus introducing this as
a completely separate data structure to the current code base
might be the easiest thing to do. Jim Dose writes:
"One method I may use to draw the floors as polys was suggested
by Billy Zelsnack of Rebel Boat Rocker when we were working
at 3D Realms together a few years ago. Basically, Billy was
designing an engine that dealt with the world in a 2D portal
format similar to the one that Build used, except that it had
true looking up and down (no shearing). Since floors were
basically implicit and could be concave, Billy drew them as
if the walls extended downwards to infinity, but fixed the
texture coordinates to appear that they were on the plane of
the floor. The effect was that you could look up and down and
there were no gaps or overdraw. It's a fairly clever method
and allows you to store the world in a simpler data format.
Had perspective texture mapping been fast enough back then,
both Build and Doom could have done this in software."
Perhaps the above is sufficient to get you started.
Other Issues:
1. Occlusion
DOOM uses a per-column lookup (top/bottom index) to do HLHSR.
This works fine with span based rendering (well, getting
horizontal spans of floors/ceilings into the picture is a
separate story). It isn't really mindboggling with polygon
based rendering. GLDOOM should abandon that.
2. Precalculated Visibility
DOOM has the data used by Quake's PVS - in REJECT.
During Quake development, lots of replacements for the
occlusion buffer were tried, and PVS turned out to be best.
I suggest usind the REJECT as PVS.
There have been special effects using a utility named RMB.
REJECT is a lump meant for enemy AI LoS calculation - a
nonstandard REJECT will not work as a PVS, and introduce
rendering errors. I suggest looking for a PVS lump in the
WAD, and using REJECT if none is found. That way, it might
be feasible to eat the cake and keep it.
3. Mipmaps
DOOM does not have mipmapping. As we have 8bit palettized
textures, OpenGL mipmapping might not give the desired
results. Plus, composing textures from patches at runtime
would require runtime mipmapping. Precalculated mipmaps
in the WAD?
4. Sprites
Partly transparent textures and sprites impose another
problem related to mipmapping. Without alpha channel,
this could give strange results. Precalculated, valid
sprite mipmaps (w/o alpha)?
--- NEW FILE: p_inter.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_inter.h,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#ifndef __P_INTER__
#define __P_INTER__
#ifdef __GNUG__
#pragma interface
#endif
boolean P_GivePower(player_t*, int);
#endif
//-----------------------------------------------------------------------------
//
// $Log: p_inter.h,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_local.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_local.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Refresh (R_*) module, global header.
// All the rendering/drawing stuff is here.
//
//-----------------------------------------------------------------------------
#ifndef __R_LOCAL__
#define __R_LOCAL__
// Binary Angles, sine/cosine/atan lookups.
#include "tables.h"
// Screen size related parameters.
#include "doomdef.h"
// Include the refresh/render data structs.
#include "r_data.h"
//
// Separate header file for each module.
//
#include "r_main.h"
#include "r_bsp.h"
#include "r_segs.h"
#include "r_plane.h"
#include "r_data.h"
#include "r_things.h"
#include "r_draw.h"
#endif // __R_LOCAL__
//-----------------------------------------------------------------------------
//
// $Log: r_local.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: d_ticcmd.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_ticcmd.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __D_TICCMD__
#define __D_TICCMD__
#include "doomtype.h"
#ifdef __GNUG__
#pragma interface
#endif
// The data sampled per tick (single player)
// and transmitted to other peers (multiplayer).
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
typedef struct
{
signed char forwardmove; // *2048 for move
char sidemove; // *2048 for move
short angleturn; // <<16 for angle delta
short consistancy; // checks for net game
byte chatchar;
byte buttons;
} ticcmd_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log: d_ticcmd.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: f_finale.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: f_finale.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#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
//-----------------------------------------------------------------------------
//
// $Log: f_finale.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: i_video.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_video.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: i_video.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// DOOM graphics stuff for Microwindows
// Ported from SDL Doom by Greg Haerr
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_video.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include <stdlib.h>
#define MWINCLUDECOLORS
#include <nano-X.h>
#include "m_swap.h"
#include "doomstat.h"
#include "i_system.h"
#include "v_video.h"
#include "m_argv.h"
#include "d_main.h"
#include "doomdef.h"
/* create 16 bit 5/6/5 format pixel from RGB triplet */
#define RGB2PIXEL565(r,g,b) \
((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
#define GETPALENTRY(pal,index) ((unsigned long)(pal[index].r |\
(pal[index].g << 8) | (pal[index].b << 16)))
static GR_WINDOW_ID win;
static GR_GC_ID gc;
// Blocky mode,
// replace each 320x200 pixel with multiply*multiply pixels.
// According to Dave Taylor, it still is a bonehead thing
// to use ....
static int multiply = 1;
static int flip = 1;
static int video_w, video_h;
static byte * finalimage;
static int pixtype;
static GR_PALETTE pal;
//
// Translates the key
//
int
xlatekey(int key)
{
int rc;
switch(key) {
case MWKEY_LEFT:
if (flip)
rc = KEY_UPARROW;
else
rc = KEY_LEFTARROW;
break;
case MWKEY_RIGHT:
if (flip)
rc = KEY_DOWNARROW;
else
rc = KEY_RIGHTARROW;
break;
case MWKEY_DOWN:
if (flip)
rc = KEY_LEFTARROW;
else
rc = KEY_DOWNARROW;
break;
case MWKEY_UP:
if (flip)
rc = KEY_RIGHTARROW;
else
rc = KEY_UPARROW;
break;
case MWKEY_HOME:rc = KEY_ESCAPE; break;
case MWKEY_ENTER:
case MWKEY_KP_ENTER:
case MWKEY_MENU: rc = KEY_ENTER; break;
case MWKEY_TAB: rc = KEY_TAB; break;
case MWKEY_F1: rc = KEY_F1; break;
case MWKEY_F2: rc = KEY_F2; break;
case MWKEY_F3: rc = KEY_F3; break;
case MWKEY_F4: rc = KEY_F4; break;
case MWKEY_F5: rc = KEY_F5; break;
case MWKEY_F6: rc = KEY_F6; break;
case MWKEY_F7: rc = KEY_F7; break;
case MWKEY_F8: rc = KEY_F8; break;
case MWKEY_F9: rc = KEY_F9; break;
case MWKEY_F10: rc = KEY_F10; break;
case MWKEY_F11: rc = KEY_F11; break;
case MWKEY_F12: rc = KEY_F12; break;
case MWKEY_APP2: rc = 'y'; break;
case MWKEY_BACKSPACE:
case MWKEY_APP1:
case MWKEY_DELETE:rc = ' '; printf("Got space\n"); break;
case MWKEY_PAUSE: rc = KEY_PAUSE; break;
case MWKEY_KP_EQUALS:
case MWKEY_KP_PLUS:
case '=': rc = KEY_EQUALS; break;
case MWKEY_KP_MINUS:
case '-': rc = KEY_MINUS; break;
case MWKEY_LSHIFT:
case MWKEY_RSHIFT:rc = KEY_RSHIFT; break;
case MWKEY_LCTRL:
case MWKEY_RECORD:
case MWKEY_RCTRL: rc = KEY_RCTRL; break;
case MWKEY_LALT:
case MWKEY_LMETA:
case MWKEY_RALT:
case MWKEY_RMETA: rc = KEY_RALT; break;
default: rc = key; break;
}
return rc;
}
void I_ShutdownGraphics(void)
{
GrClose();
}
//
// I_StartFrame
//
void I_StartFrame (void)
{
}
/* This processes Nano-X events */
void I_GetEvent(GR_EVENT *Event)
{
int ch;
unsigned int buttonstate;
event_t event;
int xpos, ypos, xrel, yrel;
int factor;
static int lastx = 0;
static int lasty = 0;
switch (Event->type)
{
/* Coming soon to a Nano-X server near you: Joystick support */
#ifdef NOTUSED
case GR_EVENT_TYPE_JOYSTICK_MOVE:
case GR_EVENT_TYPE_JOYSTICK_BUTTON:
event.type = ev_joystick;
/* We can support more than 4 buttons, we might */
/* as well grab as many as we can */
event.data1 = ((GR_EVENT_JOYSTICK *)Event)->button_value;
event.data2 = (((GR_EVENT_JOYSTICK *)Event)->axis[GR_JOYSTICK_XAXIS]);
event.data3 = -((GR_EVENT_JOYSTICK *)Event)->axis[GR_JOYSTICK_YAXIS];
D_PostEvent(&event);
break;
#endif
case GR_EVENT_TYPE_KEY_DOWN:
event.type = ev_keydown;
ch = ((GR_EVENT_KEYSTROKE *)Event)->ch;
event.data1 = xlatekey(ch);
D_PostEvent(&event);
break;
case GR_EVENT_TYPE_KEY_UP:
event.type = ev_keyup;
ch = ((GR_EVENT_KEYSTROKE *)Event)->ch;
event.data1 = xlatekey(ch);
D_PostEvent(&event);
break;
case GR_EVENT_TYPE_BUTTON_DOWN:
case GR_EVENT_TYPE_BUTTON_UP:
buttonstate = ((GR_EVENT_MOUSE *)Event)->buttons;
event.type = ev_mouse;
event.data1 = 0
| (buttonstate & GR_BUTTON_L ? 1 : 0)
| (buttonstate & GR_BUTTON_M ? 2 : 0)
| (buttonstate & GR_BUTTON_R ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
break;
case GR_EVENT_TYPE_MOUSE_MOTION:
buttonstate = ((GR_EVENT_MOUSE *)Event)->buttons;
xpos = ((GR_EVENT_MOUSE *)Event)->x;
ypos = ((GR_EVENT_MOUSE *)Event)->y;
/* ignore warped mouse events*/
if (xpos == video_w/2 && ypos == video_h/2)
break;
xrel = xpos - lastx;
yrel = ypos - lasty;
lastx = xpos;
lasty = ypos;
event.type = ev_mouse;
event.data1 = 0
| (buttonstate & GR_BUTTON_L ? 1 : 0)
| (buttonstate & GR_BUTTON_M ? 2 : 0)
| (buttonstate & GR_BUTTON_R ? 4 : 0);
factor = 3;
if (xpos > video_w || xpos < video_w/2-50)
++factor;
event.data2 = xrel << factor;
if (ypos > video_h/2+50 || ypos < video_h/2-50)
++factor;
event.data3 = -yrel << factor;
D_PostEvent(&event);
#define MINVALUE 10
if (xpos < MINVALUE || xpos > video_w-MINVALUE ||
ypos < MINVALUE || ypos > video_h-MINVALUE) {
GrInjectPointerEvent(video_w/2, video_h/2, 0, 0);
lastx = video_w/2;
lasty = video_h/2;
}
break;
case GR_EVENT_TYPE_CLOSE_REQ:
I_Quit();
break;
}
}
//
// I_StartTic
//
void I_StartTic (void)
{
GR_EVENT Event;
do {
GrCheckNextEvent(&Event);
I_GetEvent(&Event);
} while (Event.type != GR_EVENT_TYPE_NONE);
}
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
// what is this?
}
//
// I_FinishUpdate
//
void I_FinishUpdate (void)
{
// draws little dots on the bottom of the screen
if (devparm) {
int tics;
int i;
static int lasttic;
i = I_GetTime();
tics = i - lasttic;
lasttic = i;
if (tics > 20) tics = 20;
for (i=0 ; i<tics*2 ; i+=2)
screens[0][ (video_h-1)*video_w + i] = 0xff;
for ( ; i<20*2 ; i+=2)
screens[0][ (video_h-1)*video_w + i] = 0x0;
}
if (multiply == 1) {
/*
* Yep, it's ugly.
*/
if (pixtype == MWPF_PALETTE) {
if (flip) {
unsigned char *ilineptr = (unsigned char *)screens[0];
int y, x;
for (x=0; x<SCREENHEIGHT; ++x) {
for (y=SCREENWIDTH-1; y>=0; --y) {
finalimage[y*SCREENHEIGHT + x] = *ilineptr++;
}
}
// printf("GrArea #1\n");
GrArea(win, gc, 0, 0, SCREENHEIGHT, SCREENWIDTH, finalimage,
MWPF_PALETTE);
} else {
// printf("GrArea #2\n");
GrArea(win, gc, 0, 0, video_w, video_h, screens[0],
MWPF_PALETTE);
}
} else {
unsigned char *ilineptr = (unsigned char *)screens[0];
unsigned short *olineptr = (unsigned short *)finalimage;
int y, x;
unsigned char index;
if (flip) {
for (x=0; x<SCREENHEIGHT; ++x) {
for (y=SCREENWIDTH-1; y>=0; --y) {
index = *ilineptr++;
olineptr[y*SCREENHEIGHT + x] =
RGB2PIXEL565(pal.palette[index].r,
pal.palette[index].g, pal.palette[index].b);
}
}
// printf("GrArea #3\n");
GrArea(win, gc, 0, 0, SCREENHEIGHT, SCREENWIDTH, finalimage,
MWPF_TRUECOLOR565);
} else {
for (y=0; y<SCREENHEIGHT; ++y) {
for (x=0; x<SCREENWIDTH; ++x) {
index = *ilineptr++;
*olineptr++ = RGB2PIXEL565(pal.palette[index].r,
pal.palette[index].g, pal.palette[index].b);
}
}
// printf("GrArea #4 %d/%d\n",video_w,video_h);
GrArea(win, gc, 0, 0, video_w, video_h, finalimage,
MWPF_TRUECOLOR565);
}
}
} else if (multiply == 2) {
unsigned int *olineptrs[2];
unsigned int *ilineptr;
int x, y, i;
unsigned int twoopixels;
unsigned int twomoreopixels;
unsigned int fouripixels;
ilineptr = (unsigned int *) (screens[0]);
for (i=0; i<2 ; i++)
olineptrs[i] = (unsigned int *)
&((unsigned char *)finalimage)[i*video_w];
y = SCREENHEIGHT;
while (y--)
{
x = SCREENWIDTH;
do
{
fouripixels = *ilineptr++;
twoopixels = (fouripixels & 0xff000000)
| ((fouripixels>>8) & 0xffff00)
| ((fouripixels>>16) & 0xff);
twomoreopixels = ((fouripixels<<16) & 0xff000000)
| ((fouripixels<<8) & 0xffff00)
| (fouripixels & 0xff);
#ifdef __BIG_ENDIAN__
*olineptrs[0]++ = twoopixels;
*olineptrs[1]++ = twoopixels;
*olineptrs[0]++ = twomoreopixels;
*olineptrs[1]++ = twomoreopixels;
#else
*olineptrs[0]++ = twomoreopixels;
*olineptrs[1]++ = twomoreopixels;
*olineptrs[0]++ = twoopixels;
*olineptrs[1]++ = twoopixels;
#endif
} while (x-=4);
olineptrs[0] += video_w/4;
olineptrs[1] += video_w/4;
}
// printf("GrArea #5\n");
GrArea(win, gc, 0, 0, video_w, video_h, finalimage, MWPF_PALETTE);
} else if (multiply == 3) {
unsigned int *olineptrs[3];
unsigned int *ilineptr;
int x, y, i;
unsigned int fouropixels[3];
unsigned int fouripixels;
ilineptr = (unsigned int *) (screens[0]);
for (i=0 ; i<3 ; i++)
olineptrs[i] = (unsigned int *)
&((unsigned char *)finalimage)[i*video_w];
y = SCREENHEIGHT;
while (y--)
{
x = SCREENWIDTH;
do
{
fouripixels = *ilineptr++;
fouropixels[0] = (fouripixels & 0xff000000)
| ((fouripixels>>8) & 0xff0000)
| ((fouripixels>>16) & 0xffff);
fouropixels[1] = ((fouripixels<<8) & 0xff000000)
| (fouripixels & 0xffff00)
| ((fouripixels>>8) & 0xff);
fouropixels[2] = ((fouripixels<<16) & 0xffff0000)
| ((fouripixels<<8) & 0xff00)
| (fouripixels & 0xff);
#ifdef __BIG_ENDIAN__
*olineptrs[0]++ = fouropixels[0];
*olineptrs[1]++ = fouropixels[0];
*olineptrs[2]++ = fouropixels[0];
*olineptrs[0]++ = fouropixels[1];
*olineptrs[1]++ = fouropixels[1];
*olineptrs[2]++ = fouropixels[1];
*olineptrs[0]++ = fouropixels[2];
*olineptrs[1]++ = fouropixels[2];
*olineptrs[2]++ = fouropixels[2];
#else
*olineptrs[0]++ = fouropixels[2];
*olineptrs[1]++ = fouropixels[2];
*olineptrs[2]++ = fouropixels[2];
*olineptrs[0]++ = fouropixels[1];
*olineptrs[1]++ = fouropixels[1];
*olineptrs[2]++ = fouropixels[1];
*olineptrs[0]++ = fouropixels[0];
*olineptrs[1]++ = fouropixels[0];
*olineptrs[2]++ = fouropixels[0];
#endif
} while (x-=4);
olineptrs[0] += 2*video_w/4;
olineptrs[1] += 2*video_w/4;
olineptrs[2] += 2*video_w/4;
}
// printf("GrArea #6\n");
GrArea(win, gc, 0, 0, video_w, video_h, finalimage, MWPF_PALETTE);
}
}
//
// I_ReadScreen
//
void I_ReadScreen (byte* scr)
{
memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT);
}
//
// I_SetPalette
//
void I_SetPalette (byte* palette)
{
int i;
pal.count = 256;
for ( i=0; i<256; ++i ) {
pal.palette[i].r = gammatable[usegamma][*palette++];
pal.palette[i].g = gammatable[usegamma][*palette++];
pal.palette[i].b = gammatable[usegamma][*palette++];
}
GrSetSystemPalette(0, &pal);
}
void I_InitGraphics(void)
{
static int firsttime=1;
int bytesperpixel;
GR_SCREEN_INFO info;
if (!firsttime)
return;
firsttime = 0;
//if (!!M_CheckParm("-fullscreen"))
//video_flags |= SDL_FULLSCREEN;
if (M_CheckParm("-2"))
multiply = 2;
if (M_CheckParm("-3"))
multiply = 3;
if (M_CheckParm("-flip"))
flip = 0;
GrGetScreenInfo(&info);
pixtype = info.pixtype;
switch (pixtype) {
case MWPF_PALETTE:
case MWPF_TRUECOLOR332:
bytesperpixel = 1;
break;
case MWPF_TRUECOLOR565:
bytesperpixel = 2;
break;
default:
I_Error("Pixel depth not supported\n");
}
if (flip) {
video_h = SCREENWIDTH * multiply;
video_w = SCREENHEIGHT * multiply;
} else {
video_w = SCREENWIDTH * multiply;
video_h = SCREENHEIGHT * multiply;
}
#ifdef NOTUSED
GrOpenJoystick();
#endif
win = GrNewWindowEx(GR_WM_PROPS_NOAUTOMOVE | GR_WM_PROPS_CLOSEBOX, "Microwindows Doom! v1.10",
GR_ROOT_WINDOW_ID, 0, 0, info.cols, info.rows, BLACK);
GrSelectEvents(win, GR_EVENT_MASK_CLOSE_REQ | GR_EVENT_MASK_MOUSE_MOTION |
GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP |
GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP |
GR_EVENT_MASK_EXPOSURE
#ifdef NOTUSED
| GR_EVENT_MASK_JOYSTICK_BUTTON | GR_EVENT_MASK_JOYSTICK_MOVE
#endif
);
gc = GrNewGC();
GrMapWindow(win);
//SDL_ShowCursor(0);
/* Set up the screen displays */
screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT);
if (screens[0] == NULL)
I_Error("Couldn't allocate screen memory");
if (multiply > 1 || flip || bytesperpixel != 1) {
finalimage = (unsigned char *)
malloc (video_w * video_h * bytesperpixel);
if (finalimage == NULL)
I_Error("Couldn't allocate screen memory");
}
}
--- NEW FILE: m_menu.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_menu.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// 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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_menu.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: r_plane.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_plane.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Refresh, visplane stuff (floor, ceilings).
//
//-----------------------------------------------------------------------------
#ifndef __R_PLANE__
#define __R_PLANE__
#include "r_data.h"
#ifdef __GNUG__
#pragma interface
#endif
// Visplane related.
extern short* lastopening;
typedef void (*planefunction_t) (int top, int bottom);
extern planefunction_t floorfunc;
extern planefunction_t ceilingfunc_t;
extern short floorclip[SCREENWIDTH];
extern short ceilingclip[SCREENWIDTH];
extern fixed_t yslope[SCREENHEIGHT];
extern fixed_t distscale[SCREENWIDTH];
void R_InitPlanes (void);
void R_ClearPlanes (void);
void
R_MapPlane
( int y,
int x1,
int x2 );
void
R_MakeSpans
( int x,
int t1,
int b1,
int t2,
int b2 );
void R_DrawPlanes (void);
visplane_t*
R_FindPlane
( fixed_t height,
int picnum,
int lightlevel );
visplane_t*
R_CheckPlane
( visplane_t* pl,
int start,
int stop );
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_plane.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_argv.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_argv.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Nil.
//
//-----------------------------------------------------------------------------
#ifndef __M_ARGV__
#define __M_ARGV__
//
// MISC
//
extern int myargc;
extern char** myargv;
// Returns the position of the given parameter
// in the arg list (0 if not found).
int M_CheckParm (char* check);
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_argv.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: i_video.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: i_video.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_VIDEO__
#define __I_VIDEO__
#include "doomtype.h"
#ifdef __GNUG__
#pragma interface
#endif
// Called by D_DoomMain,
// determines the hardware configuration
// and sets up the video mode
void I_InitGraphics (void);
void I_ShutdownGraphics(void);
// Takes full 8 bit values.
void I_SetPalette (byte* palette);
void I_UpdateNoBlit (void);
void I_FinishUpdate (void);
// Wait for vertical retrace or pause a bit.
void I_WaitVBL(int count);
void I_ReadScreen (byte* scr);
void I_BeginRead (void);
void I_EndRead (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log: i_video.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: f_finale.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: f_finale.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: f_finale.c,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Game completion, final screen animation.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: f_finale.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $";
#include <ctype.h>
// Functions.
#include "m_swap.h"
#include "i_system.h"
#include "z_zone.h"
#include "v_video.h"
#include "w_wad.h"
#include "s_sound.h"
// Data.
#include "dstrings.h"
#include "sounds.h"
#include "doomstat.h"
#include "r_state.h"
// ?
//#include "doomstat.h"
//#include "r_local.h"
//#include "f_finale.h"
// Stage of animation:
// 0 = text, 1 = art screen, 2 = character cast
int finalestage;
int finalecount;
#define TEXTSPEED 3
#define TEXTWAIT 250
char* e1text = E1TEXT;
char* e2text = E2TEXT;
char* e3text = E3TEXT;
char* e4text = E4TEXT;
char* c1text = C1TEXT;
char* c2text = C2TEXT;
char* c3text = C3TEXT;
char* c4text = C4TEXT;
char* c5text = C5TEXT;
char* c6text = C6TEXT;
char* p1text = P1TEXT;
char* p2text = P2TEXT;
char* p3text = P3TEXT;
char* p4text = P4TEXT;
char* p5text = P5TEXT;
char* p6text = P6TEXT;
char* t1text = T1TEXT;
char* t2text = T2TEXT;
char* t3text = T3TEXT;
char* t4text = T4TEXT;
char* t5text = T5TEXT;
char* t6text = T6TEXT;
char* finaletext;
char* finaleflat;
void F_StartCast (void);
void F_CastTicker (void);
boolean F_CastResponder (event_t *ev);
void F_CastDrawer (void);
//
// F_StartFinale
//
void F_StartFinale (void)
{
gameaction = ga_nothing;
gamestate = GS_FINALE;
viewactive = false;
automapactive = false;
// Okay - IWAD dependend stuff.
// This has been changed severly, and
// some stuff might have changed in the process.
switch ( gamemode )
{
// DOOM 1 - E1, E3 or E4, but each nine missions
case shareware:
case registered:
case retail:
{
S_ChangeMusic(mus_victor, true);
switch (gameepisode)
{
case 1:
finaleflat = "FLOOR4_8";
finaletext = e1text;
break;
case 2:
finaleflat = "SFLR6_1";
finaletext = e2text;
break;
case 3:
finaleflat = "MFLR8_4";
finaletext = e3text;
break;
case 4:
finaleflat = "MFLR8_3";
finaletext = e4text;
break;
default:
// Ouch.
break;
}
break;
}
// DOOM II and missions packs with E1, M34
case commercial:
{
S_ChangeMusic(mus_read_m, true);
switch (gamemap)
{
case 6:
finaleflat = "SLIME16";
finaletext = c1text;
break;
case 11:
finaleflat = "RROCK14";
finaletext = c2text;
break;
case 20:
finaleflat = "RROCK07";
finaletext = c3text;
break;
case 30:
finaleflat = "RROCK17";
finaletext = c4text;
break;
case 15:
finaleflat = "RROCK13";
finaletext = c5text;
break;
case 31:
finaleflat = "RROCK19";
finaletext = c6text;
break;
default:
// Ouch.
break;
}
break;
}
// Indeterminate.
default:
S_ChangeMusic(mus_read_m, true);
finaleflat = "F_SKY1"; // Not used anywhere else.
finaletext = c1text; // FIXME - other text, music?
break;
}
finalestage = 0;
finalecount = 0;
}
boolean F_Responder (event_t *event)
{
if (finalestage == 2)
return F_CastResponder (event);
return false;
}
//
// F_Ticker
//
void F_Ticker (void)
{
int i;
// check for skipping
if ( (gamemode == commercial)
&& ( finalecount > 50) )
{
// go on to the next level
for (i=0 ; i<MAXPLAYERS ; i++)
if (players[i].cmd.buttons)
break;
if (i < MAXPLAYERS)
{
if (gamemap == 30)
F_StartCast ();
else
gameaction = ga_worlddone;
}
}
// advance animation
finalecount++;
if (finalestage == 2)
{
F_CastTicker ();
return;
}
if ( gamemode == commercial)
return;
if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT)
{
finalecount = 0;
finalestage = 1;
wipegamestate = -1; // force a wipe
if (gameepisode == 3)
S_StartMusic (mus_bunny);
}
}
//
// F_TextWrite
//
#include "hu_stuff.h"
extern patch_t *hu_font[HU_FONTSIZE];
void F_TextWrite (void)
{
byte* src;
byte* dest;
int x,y,w;
int count;
char* ch;
int c;
int cx;
int cy;
// erase the entire screen to a tiled background
src = W_CacheLumpName ( finaleflat , PU_CACHE);
dest = screens[0];
for (y=0 ; y<SCREENHEIGHT ; y++)
{
for (x=0 ; x<SCREENWIDTH/64 ; x++)
{
memcpy (dest, src+((y&63)<<6), 64);
dest += 64;
}
if (SCREENWIDTH&63)
{
memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
dest += (SCREENWIDTH&63);
}
}
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
// draw some of the text onto the screen
cx = 10;
cy = 10;
ch = finaletext;
count = (finalecount - 10)/TEXTSPEED;
if (count < 0)
count = 0;
for ( ; count ; count-- )
{
c = *ch++;
if (!c)
break;
if (c == '\n')
{
cx = 10;
cy += 11;
continue;
}
c = toupper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE)
{
cx += 4;
continue;
}
w = SHORT (hu_font[c]->width);
if (cx+w > SCREENWIDTH)
break;
V_DrawPatch(cx, cy, 0, hu_font[c]);
cx+=w;
}
}
//
// Final DOOM 2 animation
// Casting by id Software.
// in order of appearance
//
typedef struct
{
char *name;
mobjtype_t type;
} castinfo_t;
castinfo_t castorder[] = {
{CC_ZOMBIE, MT_POSSESSED},
{CC_SHOTGUN, MT_SHOTGUY},
{CC_HEAVY, MT_CHAINGUY},
{CC_IMP, MT_TROOP},
{CC_DEMON, MT_SERGEANT},
{CC_LOST, MT_SKULL},
{CC_CACO, MT_HEAD},
{CC_HELL, MT_KNIGHT},
{CC_BARON, MT_BRUISER},
{CC_ARACH, MT_BABY},
{CC_PAIN, MT_PAIN},
{CC_REVEN, MT_UNDEAD},
{CC_MANCU, MT_FATSO},
{CC_ARCH, MT_VILE},
{CC_SPIDER, MT_SPIDER},
{CC_CYBER, MT_CYBORG},
{CC_HERO, MT_PLAYER},
{NULL,0}
};
int castnum;
int casttics;
state_t* caststate;
boolean castdeath;
int castframes;
int castonmelee;
boolean castattacking;
//
// F_StartCast
//
extern gamestate_t wipegamestate;
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;
}
void F_CastPrint (char* text)
{
char* ch;
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 = SHORT (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 = SHORT (hu_font[c]->width);
V_DrawPatch(cx, 180, 0, hu_font[c]);
cx+=w;
}
}
//
// F_CastDrawer
//
void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch);
void F_CastDrawer (void)
{
spritedef_t* sprdef;
spriteframe_t* sprframe;
int lump;
boolean flip;
patch_t* patch;
// erase the entire screen to a background
V_DrawPatch (0,0,0, W_CacheLumpName ("BOSSBACK", PU_CACHE));
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];
patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE);
if (flip)
V_DrawPatchFlipped (160,170,0,patch);
else
V_DrawPatch (160,170,0,patch);
}
//
// F_DrawPatchCol
//
void
F_DrawPatchCol
( int x,
patch_t* patch,
int col )
{
column_t* column;
byte* source;
byte* dest;
byte* desttop;
int count;
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
desttop = screens[0]+x;
// step through the posts in a column
while (column->topdelta != 0xff )
{
source = (byte *)column + 3;
dest = desttop + column->topdelta*SCREENWIDTH;
count = column->length;
while (count--)
{
*dest = *source++;
dest += SCREENWIDTH;
}
column = (column_t *)( (byte *)column + column->length + 4 );
}
}
//
// F_BunnyScroll
//
void F_BunnyScroll (void)
{
int scrolled;
int x;
patch_t* p1;
patch_t* p2;
char name[10];
int stage;
static int laststage;
p1 = W_CacheLumpName ("PFUB2", PU_LEVEL);
p2 = W_CacheLumpName ("PFUB1", PU_LEVEL);
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
scrolled = 320 - (finalecount-230)/2;
if (scrolled > 320)
scrolled = 320;
if (scrolled < 0)
scrolled = 0;
for ( x=0 ; x<SCREENWIDTH ; x++)
{
if (x+scrolled < 320)
F_DrawPatchCol (x, p1, x+scrolled);
else
F_DrawPatchCol (x, p2, x+scrolled - 320);
}
if (finalecount < 1130)
return;
if (finalecount < 1180)
{
V_DrawPatch ((SCREENWIDTH-13*8)/2,
(SCREENHEIGHT-8*8)/2,0, W_CacheLumpName ("END0",PU_CACHE));
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);
V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName (name,PU_CACHE));
}
//
// F_Drawer
//
void F_Drawer (void)
{
if (finalestage == 2)
{
F_CastDrawer ();
return;
}
if (!finalestage)
F_TextWrite ();
else
{
switch (gameepisode)
{
case 1:
if ( gamemode == retail )
V_DrawPatch (0,0,0,
W_CacheLumpName("CREDIT",PU_CACHE));
else
V_DrawPatch (0,0,0,
W_CacheLumpName("HELP2",PU_CACHE));
break;
case 2:
V_DrawPatch(0,0,0,
W_CacheLumpName("VICTORY2",PU_CACHE));
break;
case 3:
F_BunnyScroll ();
break;
case 4:
V_DrawPatch (0,0,0,
W_CacheLumpName("ENDPIC",PU_CACHE));
break;
}
}
}
--- NEW FILE: r_plane.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_plane.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_plane.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Here is a core component: drawing the floors and ceilings,
// while maintaining a per column clipping list only.
// Moreover, the sky areas have to be determined.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: r_plane.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include <stdlib.h>
#include "i_system.h"
#include "z_zone.h"
#include "w_wad.h"
#include "doomdef.h"
#include "doomstat.h"
#include "r_local.h"
#include "r_sky.h"
planefunction_t floorfunc;
planefunction_t ceilingfunc;
//
// opening
//
// Here comes the obnoxious "visplane".
#define MAXVISPLANES 128
visplane_t visplanes[MAXVISPLANES];
visplane_t* lastvisplane;
visplane_t* floorplane;
visplane_t* ceilingplane;
// ?
#define MAXOPENINGS SCREENWIDTH*64
short openings[MAXOPENINGS];
short* lastopening;
//
// Clip values are the solid pixel bounding the range.
// floorclip starts out SCREENHEIGHT
// ceilingclip starts out -1
//
short floorclip[SCREENWIDTH];
short ceilingclip[SCREENWIDTH];
//
// spanstart holds the start of a plane span
// initialized to 0 at start
//
int spanstart[SCREENHEIGHT];
int spanstop[SCREENHEIGHT];
//
// texture mapping
//
lighttable_t** planezlight;
fixed_t planeheight;
fixed_t yslope[SCREENHEIGHT];
fixed_t distscale[SCREENWIDTH];
fixed_t basexscale;
fixed_t baseyscale;
fixed_t cachedheight[SCREENHEIGHT];
fixed_t cacheddistance[SCREENHEIGHT];
fixed_t cachedxstep[SCREENHEIGHT];
fixed_t cachedystep[SCREENHEIGHT];
//
// R_InitPlanes
// Only at game startup.
//
void R_InitPlanes (void)
{
// Doh!
}
//
// R_MapPlane
//
// Uses global vars:
// planeheight
// ds_source
// basexscale
// baseyscale
// viewx
// viewy
//
// BASIC PRIMITIVE
//
void
R_MapPlane
( int y,
int x1,
int x2 )
{
angle_t angle;
fixed_t distance;
fixed_t length;
unsigned index;
#ifdef RANGECHECK
if (x2 < x1
|| x1<0
|| x2>=viewwidth
|| (unsigned)y>viewheight)
{
I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y);
}
#endif
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
distance = cacheddistance[y] = FixedMul (planeheight, yslope[y]);
ds_xstep = cachedxstep[y] = FixedMul (distance,basexscale);
ds_ystep = cachedystep[y] = FixedMul (distance,baseyscale);
}
else
{
distance = cacheddistance[y];
ds_xstep = cachedxstep[y];
ds_ystep = cachedystep[y];
}
length = FixedMul (distance,distscale[x1]);
angle = (viewangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
ds_xfrac = viewx + FixedMul(finecosine[angle], length);
ds_yfrac = -viewy - FixedMul(finesine[angle], length);
if (fixedcolormap)
ds_colormap = fixedcolormap;
else
{
index = distance >> LIGHTZSHIFT;
if (index >= MAXLIGHTZ )
index = MAXLIGHTZ-1;
ds_colormap = planezlight[index];
}
ds_y = y;
ds_x1 = x1;
ds_x2 = x2;
// high or low detail
spanfunc ();
}
//
// R_ClearPlanes
// At begining of frame.
//
void R_ClearPlanes (void)
{
int i;
angle_t angle;
// opening / clipping determination
for (i=0 ; i<viewwidth ; i++)
{
floorclip[i] = viewheight;
ceilingclip[i] = -1;
}
lastvisplane = visplanes;
lastopening = openings;
// texture calculation
memset (cachedheight, 0, sizeof(cachedheight));
// left to right mapping
angle = (viewangle-ANG90)>>ANGLETOFINESHIFT;
// scale will be unit scale at SCREENWIDTH/2 distance
basexscale = FixedDiv (finecosine[angle],centerxfrac);
baseyscale = -FixedDiv (finesine[angle],centerxfrac);
}
//
// R_FindPlane
//
visplane_t*
R_FindPlane
( fixed_t height,
int picnum,
int lightlevel )
{
visplane_t* check;
if (picnum == skyflatnum)
{
height = 0; // all skys map together
lightlevel = 0;
}
for (check=visplanes; check<lastvisplane; check++)
{
if (height == check->height
&& picnum == check->picnum
&& lightlevel == check->lightlevel)
{
break;
}
}
if (check < lastvisplane)
return check;
if (lastvisplane - visplanes == MAXVISPLANES)
I_Error ("R_FindPlane: no more visplanes");
lastvisplane++;
check->height = height;
check->picnum = picnum;
check->lightlevel = lightlevel;
check->minx = SCREENWIDTH;
check->maxx = -1;
memset (check->top,0xff,sizeof(check->top));
return check;
}
//
// R_CheckPlane
//
visplane_t*
R_CheckPlane
( visplane_t* pl,
int start,
int stop )
{
int intrl;
int intrh;
int unionl;
int unionh;
int x;
if (start < pl->minx)
{
intrl = pl->minx;
unionl = start;
}
else
{
unionl = pl->minx;
intrl = start;
}
if (stop > pl->maxx)
{
intrh = pl->maxx;
unionh = stop;
}
else
{
unionh = pl->maxx;
intrh = stop;
}
for (x=intrl ; x<= intrh ; x++)
if (pl->top[x] != 0xff)
break;
if (x > intrh)
{
pl->minx = unionl;
pl->maxx = unionh;
// use the same one
return pl;
}
// make a new visplane
lastvisplane->height = pl->height;
lastvisplane->picnum = pl->picnum;
lastvisplane->lightlevel = pl->lightlevel;
pl = lastvisplane++;
pl->minx = start;
pl->maxx = stop;
memset (pl->top,0xff,sizeof(pl->top));
return pl;
}
//
// R_MakeSpans
//
void
R_MakeSpans
( int x,
int t1,
int b1,
int t2,
int b2 )
{
while (t1 < t2 && t1<=b1)
{
R_MapPlane (t1,spanstart[t1],x-1);
t1++;
}
while (b1 > b2 && b1>=t1)
{
R_MapPlane (b1,spanstart[b1],x-1);
b1--;
}
while (t2 < t1 && t2<=b2)
{
spanstart[t2] = x;
t2++;
}
while (b2 > b1 && b2>=t2)
{
spanstart[b2] = x;
b2--;
}
}
//
// R_DrawPlanes
// At the end of each frame.
//
void R_DrawPlanes (void)
{
visplane_t* pl;
int light;
int x;
int stop;
int angle;
#ifdef RANGECHECK
if (ds_p - drawsegs > MAXDRAWSEGS)
I_Error ("R_DrawPlanes: drawsegs overflow (%i)",
ds_p - drawsegs);
if (lastvisplane - visplanes > MAXVISPLANES)
I_Error ("R_DrawPlanes: visplane overflow (%i)",
lastvisplane - visplanes);
if (lastopening - openings > MAXOPENINGS)
I_Error ("R_DrawPlanes: opening overflow (%i)",
lastopening - openings);
#endif
for (pl = visplanes ; pl < lastvisplane ; pl++)
{
if (pl->minx > pl->maxx)
continue;
// sky flat
if (pl->picnum == skyflatnum)
{
dc_iscale = pspriteiscale>>detailshift;
// Sky is allways drawn full bright,
// i.e. colormaps[0] is used.
// Because of this hack, sky is not affected
// by INVUL inverse mapping.
dc_colormap = colormaps;
dc_texturemid = skytexturemid;
for (x=pl->minx ; x <= pl->maxx ; x++)
{
dc_yl = pl->top[x];
dc_yh = pl->bottom[x];
if (dc_yl <= dc_yh)
{
angle = (viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT;
dc_x = x;
dc_source = R_GetColumn(skytexture, angle);
colfunc ();
}
}
continue;
}
// regular flat
ds_source = W_CacheLumpNum(firstflat +
flattranslation[pl->picnum],
PU_STATIC);
planeheight = abs(pl->height-viewz);
light = (pl->lightlevel >> LIGHTSEGSHIFT)+extralight;
if (light >= LIGHTLEVELS)
light = LIGHTLEVELS-1;
if (light < 0)
light = 0;
planezlight = zlight[light];
pl->top[pl->maxx+1] = 0xff;
pl->top[pl->minx-1] = 0xff;
stop = pl->maxx + 1;
for (x=pl->minx ; x<= stop ; x++)
{
R_MakeSpans(x,pl->top[x-1],
pl->bottom[x-1],
pl->top[x],
pl->bottom[x]);
}
Z_ChangeTag (ds_source, PU_CACHE);
}
}
--- NEW FILE: d_items.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_items.c,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: d_items.c,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: d_items.c,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $";
// We are referring to sprite numbers.
#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
},
};
--- NEW FILE: FILES ---
total 1258
-rw-r--r-- 1 b1 prog 0 Jan 18 15:08 FILES
-rw-r--r-- 1 b1 prog 5799 Jan 18 15:07 Makefile
-rw-r--r-- 1 b1 prog 1943 Jan 18 15:07 am_data.h
-rw-r--r-- 1 b1 prog 20263 Jan 18 15:07 am_map.c
-rw-r--r-- 1 b1 prog 2494 Jan 18 15:07 am_map.h
-rw-r--r-- 1 b1 prog 1499 Jan 18 15:07 am_oids.c
-rw-r--r-- 1 b1 prog 338 Jan 18 15:07 am_oids.h
-rw-r--r-- 1 b1 prog 14005 Jan 18 15:07 d_french.h
-rw-r--r-- 1 b1 prog 25287 Jan 18 15:07 d_main.c
-rw-r--r-- 1 b1 prog 15586 Jan 18 15:07 d_net.c
-rw-r--r-- 1 b1 prog 744 Jan 18 15:07 defs.inc
-rw-r--r-- 1 b1 prog 3569 Jan 18 15:07 dither.c
-rw-r--r-- 1 b1 prog 355 Jan 18 15:07 dither.h
-rw-r--r-- 1 b1 prog 4234 Jan 18 15:07 doomdata.h
-rw-r--r-- 1 b1 prog 32779 Jan 18 15:07 doomdef.h
-rw-r--r-- 1 b1 prog 192 Jan 18 15:07 drcoord.h
-rw-r--r-- 1 b1 prog 22377 Jan 18 15:07 dstrings.h
-rw-r--r-- 1 b1 prog 6582 Jan 18 15:07 dutils.c
-rw-r--r-- 1 b1 prog 1821 Jan 18 15:07 dutils.h
-rw-r--r-- 1 b1 prog 14072 Jan 18 15:07 f_finale.c
-rw-r--r-- 1 b1 prog 7357 Jan 18 15:07 fpfunc.S
-rw-r--r-- 1 b1 prog 34770 Jan 18 15:07 g_game.c
-rw-r--r-- 1 b1 prog 5394 Jan 18 15:07 hu_lib.c
-rw-r--r-- 1 b1 prog 2878 Jan 18 15:07 hu_lib.h
-rw-r--r-- 1 b1 prog 12040 Jan 18 15:07 hu_stuff.c
-rw-r--r-- 1 b1 prog 934 Jan 18 15:07 hu_stuff.h
-rw-r--r-- 1 b1 prog 6238 Jan 18 15:07 i_cyber.c
-rw-r--r-- 1 b1 prog 18324 Jan 18 15:07 i_dga.c
-rw-r--r-- 1 b1 prog 2499 Jan 18 15:07 i_header.h
-rw-r--r-- 1 b1 prog 32815 Jan 18 15:07 i_ibm.c
-rw-r--r-- 1 b1 prog 1867 Jan 18 15:07 i_ibm_a.asm
-rw-r--r-- 1 b1 prog 121 Jan 18 15:07 i_main.c
-rw-r--r-- 1 b1 prog 8251 Jan 18 15:07 i_pcnet.c
-rw-r--r-- 1 b1 prog 8561 Jan 18 15:07 i_sound.c
-rw-r--r-- 1 b1 prog 439 Jan 18 15:07 i_sound.h
-rw-r--r-- 1 b1 prog 9537 Jan 18 15:07 i_svgalib.c
-rw-r--r-- 1 b1 prog 10886 Jan 18 15:07 i_unix.c
-rw-r--r-- 1 b1 prog 20891 Jan 18 15:07 i_x.c
-rw-r--r-- 1 b1 prog 128797 Jan 18 15:07 info.c
-rw-r--r-- 1 b1 prog 15840 Jan 18 15:07 info.h
-rw-r--r-- 1 b1 prog 3477 Jan 18 15:07 irix.c
-rw-r--r-- 1 b1 prog 240 Jan 18 15:07 irix.h
-rw-r--r-- 1 b1 prog 1363 Jan 18 15:07 linux.c
-rw-r--r-- 1 b1 prog 34628 Jan 18 15:07 m_menu.c
-rw-r--r-- 1 b1 prog 13741 Jan 18 15:07 m_misc.c
-rw-r--r-- 1 b1 prog 6117 Jan 18 15:07 p_ceilng.c
-rw-r--r-- 1 b1 prog 15062 Jan 18 15:07 p_doors.c
-rw-r--r-- 1 b1 prog 33758 Jan 18 15:07 p_enemy.c
-rw-r--r-- 1 b1 prog 11409 Jan 18 15:07 p_floor.c
-rw-r--r-- 1 b1 prog 16265 Jan 18 15:07 p_inter.c
-rw-r--r-- 1 b1 prog 7592 Jan 18 15:07 p_lights.c
-rw-r--r-- 1 b1 prog 6447 Jan 18 15:07 p_local.h
-rw-r--r-- 1 b1 prog 30138 Jan 18 15:07 p_map.c
-rw-r--r-- 1 b1 prog 14672 Jan 18 15:07 p_maputl.c
-rw-r--r-- 1 b1 prog 17276 Jan 18 15:07 p_mobj.c
-rw-r--r-- 1 b1 prog 5940 Jan 18 15:07 p_plats.c
-rw-r--r-- 1 b1 prog 17084 Jan 18 15:07 p_pspr.c
-rw-r--r-- 1 b1 prog 12828 Jan 18 15:07 p_setup.c
-rw-r--r-- 1 b1 prog 5962 Jan 18 15:07 p_sight.c
-rw-r--r-- 1 b1 prog 23846 Jan 18 15:07 p_spec.c
-rw-r--r-- 1 b1 prog 11140 Jan 18 15:07 p_spec.h
-rw-r--r-- 1 b1 prog 14229 Jan 18 15:07 p_switch.c
-rw-r--r-- 1 b1 prog 1910 Jan 18 15:07 p_telept.c
-rw-r--r-- 1 b1 prog 14075 Jan 18 15:07 p_tick.c
-rw-r--r-- 1 b1 prog 7044 Jan 18 15:07 p_user.c
-rw-r--r-- 1 b1 prog 13013 Jan 18 15:07 planar.asm
-rw-r--r-- 1 b1 prog 9811 Jan 18 15:07 r_bsp.c
-rw-r--r-- 1 b1 prog 14619 Jan 18 15:07 r_data.c
-rw-r--r-- 1 b1 prog 13591 Jan 18 15:07 r_draw.c
-rw-r--r-- 1 b1 prog 11378 Jan 18 15:07 r_local.h
-rw-r--r-- 1 b1 prog 14868 Jan 18 15:07 r_main.c
-rw-r--r-- 1 b1 prog 7108 Jan 18 15:07 r_plane.c
-rw-r--r-- 1 b1 prog 15420 Jan 18 15:07 r_segs.c
-rw-r--r-- 1 b1 prog 18969 Jan 18 15:07 r_things.c
-rw-r--r-- 1 b1 prog 12274 Jan 18 15:07 s_sound.c
-rw-r--r-- 1 b1 prog 12812 Jan 18 15:07 sndserver.c
-rw-r--r-- 1 b1 prog 141 Jan 18 15:07 sndserver.h
-rw-r--r-- 1 b1 prog 5811 Jan 18 15:07 sounds.c
-rw-r--r-- 1 b1 prog 2674 Jan 18 15:07 sounds.h
-rw-r--r-- 1 b1 prog 3975 Jan 18 15:07 soundst.h
-rw-r--r-- 1 b1 prog 3461 Jan 18 15:07 st_lib.c
-rw-r--r-- 1 b1 prog 2254 Jan 18 15:07 st_lib.h
-rw-r--r-- 1 b1 prog 22769 Jan 18 15:07 st_stuff.c
-rw-r--r-- 1 b1 prog 4685 Jan 18 15:07 st_stuff.h
-rw-r--r-- 1 b1 prog 1725 Jan 18 15:07 sun.c
-rw-r--r-- 1 b1 prog 75 Jan 18 15:07 t.c
-rw-r--r-- 1 b1 prog 114621 Jan 18 15:07 tables.c
-rw-r--r-- 1 b1 prog 5485 Jan 18 15:07 tmap.S
-rw-r--r-- 1 b1 prog 10904 Jan 18 15:07 v_video.c
-rw-r--r-- 1 b1 prog 268 Jan 18 15:07 vgaview.h
-rw-r--r-- 1 b1 prog 9920 Jan 18 15:07 w_wad.c
-rw-r--r-- 1 b1 prog 3629 Jan 18 15:07 wadread.c
-rw-r--r-- 1 b1 prog 551 Jan 18 15:07 wadread.h
-rw-r--r-- 1 b1 prog 3583 Jan 18 15:07 wi_data.h
-rw-r--r-- 1 b1 prog 25608 Jan 18 15:07 wi_stuff.c
-rw-r--r-- 1 b1 prog 1544 Jan 18 15:07 wi_stuff.h
-rw-r--r-- 1 b1 prog 8501 Jan 18 15:07 z_zone.c
--- NEW FILE: m_misc.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_misc.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
//
// $Log: m_misc.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Main loop menu stuff.
// Default Config File.
// PCX Screenshots.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_misc.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $";
#include <stdlib.h>
#include <ctype.h>
extern int access(char *file, int mode);
#include "doomdef.h"
#include "z_zone.h"
#include "m_swap.h"
#include "m_argv.h"
#include "w_wad.h"
#include "i_system.h"
#include "i_video.h"
#include "v_video.h"
#include "hu_stuff.h"
// State.
#include "doomstat.h"
// Data.
#include "dstrings.h"
#include "m_misc.h"
//
// M_DrawText
// Returns the final X coordinate
// HU_Init must have been called to init the font
//
extern patch_t* hu_font[HU_FONTSIZE];
int
M_DrawText
( int x,
int y,
boolean direct,
char* string )
{
int c;
int w;
while (*string)
{
c = toupper(*string) - HU_FONTSTART;
string++;
if (c < 0 || c> HU_FONTSIZE)
{
x += 4;
continue;
}
w = SHORT (hu_font[c]->width);
if (x+w > SCREENWIDTH)
break;
if (direct)
V_DrawPatchDirect(x, y, 0, hu_font[c]);
else
V_DrawPatch(x, y, 0, hu_font[c]);
x+=w;
}
return x;
}
//
// M_WriteFile
//
#ifndef O_BINARY
#define O_BINARY 0
#endif
boolean
M_WriteFile
( char const* name,
void* source,
int length )
{
FILE *handle;
int count;
handle = fopen ( name, "wb");
if (handle == NULL)
return false;
count = fwrite (source, 1, length, handle);
fclose (handle);
if (count < length)
return false;
return true;
}
//
// M_ReadFile
//
int
M_ReadFile
( char const* name,
byte** buffer )
{
FILE *handle;
int count, length;
byte *buf;
handle = fopen (name, "rb");
if (handle == NULL)
I_Error ("Couldn't read file %s", name);
fseek(handle, 0, SEEK_END);
length = ftell(handle);
rewind(handle);
buf = Z_Malloc (length, PU_STATIC, NULL);
count = fread (buf, 1, length, handle);
fclose (handle);
if (count < length)
I_Error ("Couldn't read file %s", name);
*buffer = buf;
return length;
}
//
// DEFAULTS
//
int usemouse;
int usejoystick;
extern int key_right;
extern int key_left;
extern int key_up;
extern int key_down;
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 mousebfire;
extern int mousebstrafe;
extern int mousebforward;
extern int joybfire;
extern int joybstrafe;
extern int joybuse;
extern int joybspeed;
extern int viewwidth;
extern int viewheight;
extern int mouseSensitivity;
extern int showMessages;
extern int detailLevel;
extern int screenblocks;
extern int showMessages;
// machine-independent sound params
extern int numChannels;
extern char* chat_macros[];
typedef struct
{
char* name;
int* location;
int defaultvalue;
int scantranslate; // PC scan code hack
int untranslated; // lousy hack
} default_t;
default_t defaults[] =
{
{"mouse_sensitivity",&mouseSensitivity, 5},
{"sfx_volume",&snd_SfxVolume, 8},
{"music_volume",&snd_MusicVolume, 8},
{"show_messages",&showMessages, 1},
{"key_right",&key_right, KEY_RIGHTARROW},
{"key_left",&key_left, KEY_LEFTARROW},
{"key_up",&key_up, KEY_UPARROW},
{"key_down",&key_down, KEY_DOWNARROW},
{"key_strafeleft",&key_strafeleft, ','},
{"key_straferight",&key_straferight, '.'},
{"key_fire",&key_fire, KEY_RCTRL},
{"key_use",&key_use, ' '},
{"key_strafe",&key_strafe, KEY_RALT},
{"key_speed",&key_speed, KEY_RSHIFT},
{"use_mouse",&usemouse, 1},
{"mouseb_fire",&mousebfire,0},
{"mouseb_strafe",&mousebstrafe,1},
{"mouseb_forward",&mousebforward,2},
{"use_joystick",&usejoystick, 0},
{"joyb_fire",&joybfire,0},
{"joyb_strafe",&joybstrafe,1},
{"joyb_use",&joybuse,3},
{"joyb_speed",&joybspeed,2},
{"screenblocks",&screenblocks, 9},
{"detaillevel",&detailLevel, 0},
{"snd_channels",&numChannels, 3},
{"usegamma",&usegamma, 0},
#ifndef __BEOS__
{"chatmacro0", (int *) &chat_macros[0], (int) HUSTR_CHATMACRO0 },
{"chatmacro1", (int *) &chat_macros[1], (int) HUSTR_CHATMACRO1 },
{"chatmacro2", (int *) &chat_macros[2], (int) HUSTR_CHATMACRO2 },
{"chatmacro3", (int *) &chat_macros[3], (int) HUSTR_CHATMACRO3 },
{"chatmacro4", (int *) &chat_macros[4], (int) HUSTR_CHATMACRO4 },
{"chatmacro5", (int *) &chat_macros[5], (int) HUSTR_CHATMACRO5 },
{"chatmacro6", (int *) &chat_macros[6], (int) HUSTR_CHATMACRO6 },
{"chatmacro7", (int *) &chat_macros[7], (int) HUSTR_CHATMACRO7 },
{"chatmacro8", (int *) &chat_macros[8], (int) HUSTR_CHATMACRO8 },
{"chatmacro9", (int *) &chat_macros[9], (int) HUSTR_CHATMACRO9 }
#endif
};
int numdefaults;
char* defaultfile;
//
// M_SaveDefaults
//
void M_SaveDefaults (void)
{
int i;
int v;
FILE* f;
f = fopen (defaultfile, "w");
if (!f)
return; // can't write the file, but don't complain
for (i=0 ; i<numdefaults ; i++)
{
if (defaults[i].defaultvalue > -0xfff
&& defaults[i].defaultvalue < 0xfff)
{
v = *defaults[i].location;
fprintf (f,"%s\t\t%i\n",defaults[i].name,v);
} else {
fprintf (f,"%s\t\t\"%s\"\n",defaults[i].name,
* (char **) (defaults[i].location));
}
}
fclose (f);
}
//
// M_LoadDefaults
//
extern byte scantokey[128];
void M_LoadDefaults (void)
{
int i;
int len;
FILE* f;
char def[80];
char strparm[100];
char* newstring;
int parm;
boolean isstring;
// set everything to base values
numdefaults = sizeof(defaults)/sizeof(defaults[0]);
for (i=0 ; i<numdefaults ; i++)
*defaults[i].location = defaults[i].defaultvalue;
// check for a custom default file
i = M_CheckParm ("-config");
if (i && i<myargc-1)
{
defaultfile = myargv[i+1];
printf (" default file: %s\n",defaultfile);
}
else
defaultfile = basedefault;
// read the file in, overriding any set defaults
f = fopen (defaultfile, "r");
if (f)
{
while (!feof(f))
{
isstring = false;
if (fscanf (f, "%79s %[^\n]\n", def, strparm) == 2)
{
if (strparm[0] == '"')
{
// get a string default
isstring = true;
len = strlen(strparm);
newstring = (char *) malloc(len);
strparm[len-1] = 0;
strcpy(newstring, strparm+1);
}
else if (strparm[0] == '0' && strparm[1] == 'x')
sscanf(strparm+2, "%x", &parm);
else
sscanf(strparm, "%i", &parm);
for (i=0 ; i<numdefaults ; i++)
if (!strcmp(def, defaults[i].name))
{
if (!isstring)
*defaults[i].location = parm;
else
*defaults[i].location =
(int) newstring;
break;
}
}
}
fclose (f);
}
}
//
// SCREEN SHOTS
//
typedef struct
{
char manufacturer;
char version;
char encoding;
char bits_per_pixel;
unsigned short xmin;
unsigned short ymin;
unsigned short xmax;
unsigned short ymax;
unsigned short hres;
unsigned short vres;
unsigned char palette[48];
char reserved;
char color_planes;
unsigned short bytes_per_line;
unsigned short palette_type;
char filler[58];
unsigned char data; // unbounded
} pcx_t;
//
// WritePCXfile
//
void
WritePCXfile
( char* filename,
byte* data,
int width,
int height,
byte* palette )
{
int i;
int length;
pcx_t* pcx;
byte* pack;
pcx = Z_Malloc (width*height*2+1000, PU_STATIC, NULL);
pcx->manufacturer = 0x0a; // PCX id
pcx->version = 5; // 256 color
pcx->encoding = 1; // uncompressed
pcx->bits_per_pixel = 8; // 256 color
pcx->xmin = 0;
pcx->ymin = 0;
pcx->xmax = SHORT(width-1);
pcx->ymax = SHORT(height-1);
pcx->hres = SHORT(width);
pcx->vres = SHORT(height);
memset (pcx->palette,0,sizeof(pcx->palette));
pcx->color_planes = 1; // chunky image
pcx->bytes_per_line = SHORT(width);
pcx->palette_type = SHORT(2); // not a grey scale
memset (pcx->filler,0,sizeof(pcx->filler));
// pack the image
pack = &pcx->data;
for (i=0 ; i<width*height ; i++)
{
if ( (*data & 0xc0) != 0xc0)
*pack++ = *data++;
else
{
*pack++ = 0xc1;
*pack++ = *data++;
}
}
// write the palette
*pack++ = 0x0c; // palette ID byte
for (i=0 ; i<768 ; i++)
*pack++ = *palette++;
// write output file
length = pack - (byte *)pcx;
M_WriteFile (filename, pcx, length);
Z_Free (pcx);
}
//
// M_ScreenShot
//
void M_ScreenShot (void)
{
int i;
byte* linear;
char lbmname[12];
// munge planar buffer to linear
linear = screens[2];
I_ReadScreen (linear);
// find a file name to save it to
strcpy(lbmname,"DOOM00.pcx");
for (i=0 ; i<=99 ; i++)
{
lbmname[4] = i/10 + '0';
lbmname[5] = i%10 + '0';
if (access(lbmname,0) == -1)
break; // file doesn't exist
}
if (i==100)
I_Error ("M_ScreenShot: Couldn't create a PCX");
// save the pcx file
WritePCXfile (lbmname, linear,
SCREENWIDTH, SCREENHEIGHT,
W_CacheLumpName ("PLAYPAL",PU_CACHE));
players[consoleplayer].message = "screen shot";
}
--- NEW FILE: info.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: info.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: info.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...4643 lines suppressed...]
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
20*FRACUNIT, // radius
16*FRACUNIT, // height
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
S_NULL // raisestate
}
};
--- NEW FILE: r_draw.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_draw.h,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __R_DRAW__
#define __R_DRAW__
#ifdef __GNUG__
#pragma interface
#endif
extern lighttable_t* dc_colormap;
extern int dc_x;
extern int dc_yl;
extern int dc_yh;
extern fixed_t dc_iscale;
extern fixed_t dc_texturemid;
// first pixel in a column
extern byte* dc_source;
// The span blitting interface.
// Hook in assembler or system specific BLT
// here.
void R_DrawColumn (void);
void R_DrawColumnLow (void);
// The Spectre/Invisibility effect.
void R_DrawFuzzColumn (void);
void R_DrawFuzzColumnLow (void);
// Draw with color translation tables,
// for player sprite rendering,
// Green/Red/Blue/Indigo shirts.
void R_DrawTranslatedColumn (void);
void R_DrawTranslatedColumnLow (void);
void
R_VideoErase
( unsigned ofs,
int count );
extern int ds_y;
extern int ds_x1;
extern int ds_x2;
extern lighttable_t* ds_colormap;
extern fixed_t ds_xfrac;
extern fixed_t ds_yfrac;
extern fixed_t ds_xstep;
extern fixed_t ds_ystep;
// start of a 64*64 tile image
extern byte* ds_source;
extern byte* translationtables;
extern byte* dc_translation;
// Span blitting for rows, floor/ceiling.
// No Sepctre effect needed.
void R_DrawSpan (void);
// Low resolution mode, 160x200?
void R_DrawSpanLow (void);
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);
#endif
//-----------------------------------------------------------------------------
//
// $Log: r_draw.h,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_cheat.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_cheat.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Cheat code checking.
//
//-----------------------------------------------------------------------------
#ifndef __M_CHEAT__
#define __M_CHEAT__
//
// CHEAT SEQUENCE PACKAGE
//
#define SCRAMBLE(a) \
((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \
+ (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7))
typedef struct
{
unsigned char* sequence;
unsigned char* p;
} cheatseq_t;
int
cht_CheckCheat
( cheatseq_t* cht,
char key );
void
cht_GetParam
( cheatseq_t* cht,
char* buffer );
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_cheat.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: info.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: info.h,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Thing frame/state LUT,
// generated by multigen utilitiy.
[...1313 lines suppressed...]
extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
#endif
//-----------------------------------------------------------------------------
//
// $Log: info.h,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: m_misc.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_misc.h,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#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_LoadDefaults (void);
void M_SaveDefaults (void);
int
M_DrawText
( int x,
int y,
boolean direct,
char* string );
#endif
//-----------------------------------------------------------------------------
//
// $Log: m_misc.h,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_floor.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_floor.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_floor.c,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Floor animation: raising stairs.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_floor.c,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $";
#include "z_zone.h"
#include "doomdef.h"
#include "p_local.h"
#include "s_sound.h"
// State.
#include "doomstat.h"
#include "r_state.h"
// Data.
#include "sounds.h"
//
// FLOORS
//
//
// Move a plane (floor or ceiling) and check for crushing
//
result_e
T_MovePlane
( sector_t* sector,
fixed_t speed,
fixed_t dest,
boolean crush,
int floorOrCeiling,
int direction )
{
boolean flag;
fixed_t lastpos;
switch(floorOrCeiling)
{
case 0:
// FLOOR
switch(direction)
{
case -1:
// DOWN
if (sector->floorheight - speed < dest)
{
lastpos = sector->floorheight;
sector->floorheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->floorheight =lastpos;
P_ChangeSector(sector,crush);
//return crushed;
}
return pastdest;
}
else
{
lastpos = sector->floorheight;
sector->floorheight -= speed;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;
case 1:
// UP
if (sector->floorheight + speed > dest)
{
lastpos = sector->floorheight;
sector->floorheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
//return crushed;
}
return pastdest;
}
else
{
// COULD GET CRUSHED
lastpos = sector->floorheight;
sector->floorheight += speed;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
if (crush == true)
return crushed;
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;
}
break;
case 1:
// CEILING
switch(direction)
{
case -1:
// DOWN
if (sector->ceilingheight - speed < dest)
{
lastpos = sector->ceilingheight;
sector->ceilingheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
//return crushed;
}
return pastdest;
}
else
{
// COULD GET CRUSHED
lastpos = sector->ceilingheight;
sector->ceilingheight -= speed;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
if (crush == true)
return crushed;
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;
case 1:
// UP
if (sector->ceilingheight + speed > dest)
{
lastpos = sector->ceilingheight;
sector->ceilingheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
//return crushed;
}
return pastdest;
}
else
{
lastpos = sector->ceilingheight;
sector->ceilingheight += speed;
flag = P_ChangeSector(sector,crush);
// UNUSED
#if 0
if (flag == true)
{
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
#endif
}
break;
}
break;
}
return ok;
}
//
// MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN)
//
void T_MoveFloor(floormove_t* floor)
{
result_e res;
res = T_MovePlane(floor->sector,
floor->speed,
floor->floordestheight,
floor->crush,0,floor->direction);
if (!(leveltime&7))
S_StartSound((mobj_t *)&floor->sector->soundorg,
sfx_stnmov);
if (res == pastdest)
{
floor->sector->specialdata = NULL;
if (floor->direction == 1)
{
switch(floor->type)
{
case donutRaise:
floor->sector->special = floor->newspecial;
floor->sector->floorpic = floor->texture;
default:
break;
}
}
else if (floor->direction == -1)
{
switch(floor->type)
{
case lowerAndChange:
floor->sector->special = floor->newspecial;
floor->sector->floorpic = floor->texture;
default:
break;
}
}
P_RemoveThinker(&floor->thinker);
S_StartSound((mobj_t *)&floor->sector->soundorg,
sfx_pstop);
}
}
//
// HANDLE FLOOR TYPES
//
int
EV_DoFloor
( line_t* line,
floor_e floortype )
{
int secnum;
int rtn;
int i;
sector_t* sec;
floormove_t* floor;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
// ALREADY MOVING? IF SO, KEEP GOING...
if (sec->specialdata)
continue;
// new floor thinker
rtn = 1;
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
sec->specialdata = floor;
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
floor->type = floortype;
floor->crush = false;
switch(floortype)
{
case lowerFloor:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight =
P_FindHighestFloorSurrounding(sec);
break;
case lowerFloorToLowest:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight =
P_FindLowestFloorSurrounding(sec);
break;
case turboLower:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED * 4;
floor->floordestheight =
P_FindHighestFloorSurrounding(sec);
if (floor->floordestheight != sec->floorheight)
floor->floordestheight += 8*FRACUNIT;
break;
case raiseFloorCrush:
floor->crush = true;
case raiseFloor:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight =
P_FindLowestCeilingSurrounding(sec);
if (floor->floordestheight > sec->ceilingheight)
floor->floordestheight = sec->ceilingheight;
floor->floordestheight -= (8*FRACUNIT)*
(floortype == raiseFloorCrush);
break;
case raiseFloorTurbo:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED*4;
floor->floordestheight =
P_FindNextHighestFloor(sec,sec->floorheight);
break;
case raiseFloorToNearest:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight =
P_FindNextHighestFloor(sec,sec->floorheight);
break;
case raiseFloor24:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = floor->sector->floorheight +
24 * FRACUNIT;
break;
case raiseFloor512:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = floor->sector->floorheight +
512 * FRACUNIT;
break;
case raiseFloor24AndChange:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = floor->sector->floorheight +
24 * FRACUNIT;
sec->floorpic = line->frontsector->floorpic;
sec->special = line->frontsector->special;
break;
case raiseToTexture:
{
int minsize = MAXINT;
side_t* side;
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
for (i = 0; i < sec->linecount; i++)
{
if (twoSided (secnum, i) )
{
side = getSide(secnum,i,0);
if (side->bottomtexture >= 0)
if (textureheight[side->bottomtexture] <
minsize)
minsize =
textureheight[side->bottomtexture];
side = getSide(secnum,i,1);
if (side->bottomtexture >= 0)
if (textureheight[side->bottomtexture] <
minsize)
minsize =
textureheight[side->bottomtexture];
}
}
floor->floordestheight =
floor->sector->floorheight + minsize;
}
break;
case lowerAndChange:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight =
P_FindLowestFloorSurrounding(sec);
floor->texture = sec->floorpic;
for (i = 0; i < sec->linecount; i++)
{
if ( twoSided(secnum, i) )
{
if (getSide(secnum,i,0)->sector-sectors == secnum)
{
sec = getSector(secnum,i,1);
if (sec->floorheight == floor->floordestheight)
{
floor->texture = sec->floorpic;
floor->newspecial = sec->special;
break;
}
}
else
{
sec = getSector(secnum,i,0);
if (sec->floorheight == floor->floordestheight)
{
floor->texture = sec->floorpic;
floor->newspecial = sec->special;
break;
}
}
}
}
default:
break;
}
}
return rtn;
}
//
// BUILD A STAIRCASE!
//
int
EV_BuildStairs
( line_t* line,
stair_e type )
{
int secnum;
int height;
int i;
int newsecnum;
int texture;
int ok;
int rtn;
sector_t* sec;
sector_t* tsec;
floormove_t* floor;
fixed_t stairsize;
fixed_t speed;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
// ALREADY MOVING? IF SO, KEEP GOING...
if (sec->specialdata)
continue;
// new floor thinker
rtn = 1;
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
sec->specialdata = floor;
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
floor->direction = 1;
floor->sector = sec;
switch(type)
{
case build8:
speed = FLOORSPEED/4;
stairsize = 8*FRACUNIT;
break;
case turbo16:
speed = FLOORSPEED*4;
stairsize = 16*FRACUNIT;
break;
}
floor->speed = speed;
height = sec->floorheight + stairsize;
floor->floordestheight = height;
texture = sec->floorpic;
// Find next sector to raise
// 1. Find 2-sided line with same sector side[0]
// 2. Other side is the next sector to raise
do
{
ok = 0;
for (i = 0;i < sec->linecount;i++)
{
if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
continue;
tsec = (sec->lines[i])->frontsector;
newsecnum = tsec-sectors;
if (secnum != newsecnum)
continue;
tsec = (sec->lines[i])->backsector;
newsecnum = tsec - sectors;
if (tsec->floorpic != texture)
continue;
height += stairsize;
if (tsec->specialdata)
continue;
sec = tsec;
secnum = newsecnum;
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
sec->specialdata = floor;
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
floor->direction = 1;
floor->sector = sec;
floor->speed = speed;
floor->floordestheight = height;
ok = 1;
break;
}
} while(ok);
}
return rtn;
}
--- NEW FILE: r_draw.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: r_draw.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: r_draw.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:31 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// The actual span/column drawing functions.
// Here find the main potential for optimization,
// e.g. inline assembly, different algorithms.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: r_draw.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "doomdef.h"
#include "i_system.h"
#include "z_zone.h"
#include "w_wad.h"
#include "r_local.h"
// Needs access to LFB (guess what).
#include "v_video.h"
// State.
#include "doomstat.h"
// ?
#define MAXWIDTH 1120
#define MAXHEIGHT 832
// status bar height at bottom of screen
#define SBARHEIGHT 32
//
// All drawing to the view buffer is accomplished in this file.
// The other refresh files only know about ccordinates,
// not the architecture of the frame buffer.
// Conveniently, the frame buffer is a linear one,
// and we need only the base address,
// and the total size == width*height*depth/8.,
//
byte* viewimage;
int viewwidth;
int scaledviewwidth;
int viewheight;
int viewwindowx;
int viewwindowy;
byte* ylookup[MAXHEIGHT];
int columnofs[MAXWIDTH];
// Color tables for different players,
// translate a limited part to another
// (color ramps used for suit colors).
//
byte translations[3][256];
//
// R_DrawColumn
// Source is the top of the column to scale.
//
lighttable_t* dc_colormap;
int dc_x;
int dc_yl;
int dc_yh;
fixed_t dc_iscale;
fixed_t dc_texturemid;
// first pixel in a column (possibly virtual)
byte* dc_source;
// just for profiling
int dccount;
//
// A column is a vertical slice/span from a wall texture that,
// given the DOOM style restrictions on the view orientation,
// will always have constant z depth.
// Thus a special case loop for very fast rendering can
// be used. It has also been used with Wolfenstein 3D.
//
void R_DrawColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
// Zero length, column does not exceed a pixel.
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
#endif
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
dest = ylookup[dc_yl] + columnofs[dc_x];
// Determine scaling,
// which is the only mapping to be done.
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
// Inner loop that does the actual texture mapping,
// e.g. a DDA-lile scaling.
// This is as fast as it gets.
do
{
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
*dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
dest += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
// UNUSED.
// Loop unrolled.
#if 0
void R_DrawColumn (void)
{
int count;
byte* source;
byte* dest;
byte* colormap;
unsigned frac;
unsigned fracstep;
unsigned fracstep2;
unsigned fracstep3;
unsigned fracstep4;
count = dc_yh - dc_yl + 1;
source = dc_source;
colormap = dc_colormap;
dest = ylookup[dc_yl] + columnofs[dc_x];
fracstep = dc_iscale<<9;
frac = (dc_texturemid + (dc_yl-centery)*dc_iscale)<<9;
fracstep2 = fracstep+fracstep;
fracstep3 = fracstep2+fracstep;
fracstep4 = fracstep3+fracstep;
while (count >= 8)
{
dest[0] = colormap[source[frac>>25]];
dest[SCREENWIDTH] = colormap[source[(frac+fracstep)>>25]];
dest[SCREENWIDTH*2] = colormap[source[(frac+fracstep2)>>25]];
dest[SCREENWIDTH*3] = colormap[source[(frac+fracstep3)>>25]];
frac += fracstep4;
dest[SCREENWIDTH*4] = colormap[source[frac>>25]];
dest[SCREENWIDTH*5] = colormap[source[(frac+fracstep)>>25]];
dest[SCREENWIDTH*6] = colormap[source[(frac+fracstep2)>>25]];
dest[SCREENWIDTH*7] = colormap[source[(frac+fracstep3)>>25]];
frac += fracstep4;
dest += SCREENWIDTH*8;
count -= 8;
}
while (count > 0)
{
*dest = colormap[source[frac>>25]];
dest += SCREENWIDTH;
frac += fracstep;
count--;
}
}
#endif
void R_DrawColumnLow (void)
{
int count;
byte* dest;
byte* dest2;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
// Zero length.
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
{
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
}
// dccount++;
#endif
// Blocky mode, need to multiply by 2.
dc_x <<= 1;
dest = ylookup[dc_yl] + columnofs[dc_x];
dest2 = ylookup[dc_yl] + columnofs[dc_x+1];
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
do
{
// Hack. Does not work corretly.
*dest2 = *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
dest += SCREENWIDTH;
dest2 += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
//
// Spectre/Invisibility.
//
#define FUZZTABLE 50
#define FUZZOFF (SCREENWIDTH)
int fuzzoffset[FUZZTABLE] =
{
FUZZOFF,-FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,
FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,
FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,
FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF
};
int fuzzpos = 0;
//
// Framebuffer postprocessing.
// Creates a fuzzy image by copying pixels
// from adjacent ones to left and right.
// Used with an all black colormap, this
// could create the SHADOW effect,
// i.e. spectres and invisible players.
//
void R_DrawFuzzColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
// Adjust borders. Low...
if (!dc_yl)
dc_yl = 1;
// .. and high.
if (dc_yh == viewheight-1)
dc_yh = viewheight - 2;
count = dc_yh - dc_yl;
// Zero length.
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0 || dc_yh >= SCREENHEIGHT)
{
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
dc_yl, dc_yh, dc_x);
}
#endif
// Keep till detailshift bug in blocky mode fixed,
// or blocky mode removed.
/* WATCOM code
if (detailshift)
{
if (dc_x & 1)
{
outpw (GC_INDEX,GC_READMAP+(2<<8) );
outp (SC_INDEX+1,12);
}
else
{
outpw (GC_INDEX,GC_READMAP);
outp (SC_INDEX+1,3);
}
dest = destview + dc_yl*80 + (dc_x>>1);
}
else
{
outpw (GC_INDEX,GC_READMAP+((dc_x&3)<<8) );
outp (SC_INDEX+1,1<<(dc_x&3));
dest = destview + dc_yl*80 + (dc_x>>2);
}*/
// Does not work with blocky mode.
dest = ylookup[dc_yl] + columnofs[dc_x];
// Looks familiar.
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
// Looks like an attempt at dithering,
// using the colormap #6 (of 0-31, a bit
// brighter than average).
do
{
// Lookup framebuffer, and retrieve
// a pixel that is either one column
// left or right of the current one.
// Add index from colormap to index.
*dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
// Clamp table lookup index.
if (++fuzzpos == FUZZTABLE)
fuzzpos = 0;
dest += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
//
// R_DrawTranslatedColumn
// Used to draw player sprites
// with the green colorramp mapped to others.
// Could be used with different translation
// tables, e.g. the lighter colored version
// of the BaronOfHell, the HellKnight, uses
// identical sprites, kinda brightened up.
//
byte* dc_translation;
byte* translationtables;
void R_DrawTranslatedColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
{
I_Error ( "R_DrawColumn: %i to %i at %i",
dc_yl, dc_yh, dc_x);
}
#endif
// WATCOM VGA specific.
/* Keep for fixing.
if (detailshift)
{
if (dc_x & 1)
outp (SC_INDEX+1,12);
else
outp (SC_INDEX+1,3);
dest = destview + dc_yl*80 + (dc_x>>1);
}
else
{
outp (SC_INDEX+1,1<<(dc_x&3));
dest = destview + dc_yl*80 + (dc_x>>2);
}*/
// FIXME. As above.
dest = ylookup[dc_yl] + columnofs[dc_x];
// Looks familiar.
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
// Here we do an additional index re-mapping.
do
{
// Translation tables are used
// to map certain colorramps to other ones,
// used with PLAY sprites.
// Thus the "green" ramp of the player 0 sprite
// is mapped to gray, red, black/indigo.
*dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
dest += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
//
// R_InitTranslationTables
// Creates the translation tables to map
// the green color ramp to gray, brown, red.
// Assumes a given structure of the PLAYPAL.
// Could be read from a lump instead.
//
void R_InitTranslationTables (void)
{
int i;
translationtables = Z_Malloc (256*3+255, PU_STATIC, 0);
translationtables = (byte *)(( (int)translationtables + 255 )& ~255);
// translate just the 16 green colors
for (i=0 ; i<256 ; i++)
{
if (i >= 0x70 && i<= 0x7f)
{
// map green ramp to gray, brown, red
translationtables[i] = 0x60 + (i&0xf);
translationtables [i+256] = 0x40 + (i&0xf);
translationtables [i+512] = 0x20 + (i&0xf);
}
else
{
// Keep all other colors as is.
translationtables[i] = translationtables[i+256]
= translationtables[i+512] = i;
}
}
}
//
// R_DrawSpan
// With DOOM style restrictions on view orientation,
// the floors and ceilings consist of horizontal slices
// or spans with constant z depth.
// However, rotation around the world z axis is possible,
// thus this mapping, while simpler and faster than
// perspective correct texture mapping, has to traverse
// the texture at an angle in all but a few cases.
// In consequence, flats are not stored by column (like walls),
// and the inner loop has to step in texture space u and v.
//
int ds_y;
int ds_x1;
int ds_x2;
lighttable_t* ds_colormap;
fixed_t ds_xfrac;
fixed_t ds_yfrac;
fixed_t ds_xstep;
fixed_t ds_ystep;
// start of a 64*64 tile image
byte* ds_source;
// just for profiling
int dscount;
//
// Draws the actual span.
void R_DrawSpan (void)
{
fixed_t xfrac;
fixed_t yfrac;
byte* dest;
int count;
int spot;
#ifdef RANGECHECK
if (ds_x2 < ds_x1
|| ds_x1<0
|| ds_x2>=SCREENWIDTH
|| (unsigned)ds_y>SCREENHEIGHT)
{
I_Error( "R_DrawSpan: %i to %i at %i",
ds_x1,ds_x2,ds_y);
}
// dscount++;
#endif
xfrac = ds_xfrac;
yfrac = ds_yfrac;
dest = ylookup[ds_y] + columnofs[ds_x1];
// We do not check for zero spans here?
count = ds_x2 - ds_x1;
do
{
// Current texture index in u,v.
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
// Lookup pixel from flat texture tile,
// re-index using light/colormap.
*dest++ = ds_colormap[ds_source[spot]];
// Next step in u,v.
xfrac += ds_xstep;
yfrac += ds_ystep;
} while (count--);
}
// UNUSED.
// Loop unrolled by 4.
#if 0
void R_DrawSpan (void)
{
unsigned position, step;
byte* source;
byte* colormap;
byte* dest;
unsigned count;
usingned spot;
unsigned value;
unsigned temp;
unsigned xtemp;
unsigned ytemp;
position = ((ds_xfrac<<10)&0xffff0000) | ((ds_yfrac>>6)&0xffff);
step = ((ds_xstep<<10)&0xffff0000) | ((ds_ystep>>6)&0xffff);
source = ds_source;
colormap = ds_colormap;
dest = ylookup[ds_y] + columnofs[ds_x1];
count = ds_x2 - ds_x1 + 1;
while (count >= 4)
{
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[0] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[1] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[2] = colormap[source[spot]];
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
dest[3] = colormap[source[spot]];
count -= 4;
dest += 4;
}
while (count > 0)
{
ytemp = position>>4;
ytemp = ytemp & 4032;
xtemp = position>>26;
spot = xtemp | ytemp;
position += step;
*dest++ = colormap[source[spot]];
count--;
}
}
#endif
//
// Again..
//
void R_DrawSpanLow (void)
{
fixed_t xfrac;
fixed_t yfrac;
byte* dest;
int count;
int spot;
#ifdef RANGECHECK
if (ds_x2 < ds_x1
|| ds_x1<0
|| ds_x2>=SCREENWIDTH
|| (unsigned)ds_y>SCREENHEIGHT)
{
I_Error( "R_DrawSpan: %i to %i at %i",
ds_x1,ds_x2,ds_y);
}
// dscount++;
#endif
xfrac = ds_xfrac;
yfrac = ds_yfrac;
// Blocky mode, need to multiply by 2.
ds_x1 <<= 1;
ds_x2 <<= 1;
dest = ylookup[ds_y] + columnofs[ds_x1];
count = ds_x2 - ds_x1;
do
{
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
// Lowres/blocky mode does it twice,
// while scale is adjusted appropriately.
*dest++ = ds_colormap[ds_source[spot]];
*dest++ = ds_colormap[ds_source[spot]];
xfrac += ds_xstep;
yfrac += ds_ystep;
} while (count--);
}
//
// R_InitBuffer
// Creats lookup tables that avoid
// multiplies and other hazzles
// for getting the framebuffer address
// of a pixel to draw.
//
void
R_InitBuffer
( int width,
int height )
{
int i;
// Handle resize,
// e.g. smaller view windows
// with border and/or status bar.
viewwindowx = (SCREENWIDTH-width) >> 1;
// Column offset. For windows.
for (i=0 ; i<width ; i++)
columnofs[i] = viewwindowx + i;
// Samw with base row offset.
if (width == SCREENWIDTH)
viewwindowy = 0;
else
viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) >> 1;
// Preclaculate all row offsets.
for (i=0 ; i<height ; i++)
ylookup[i] = screens[0] + (i+viewwindowy)*SCREENWIDTH;
}
//
// R_FillBackScreen
// Fills the back screen with a pattern
// for variable screen sizes
// Also draws a beveled edge.
//
void R_FillBackScreen (void)
{
byte* src;
byte* dest;
int x;
int y;
patch_t* patch;
// DOOM border patch.
char name1[] = "FLOOR7_2";
// DOOM II border patch.
char name2[] = "GRNROCK";
char* name;
if (scaledviewwidth == 320)
return;
if ( gamemode == commercial)
name = name2;
else
name = name1;
src = W_CacheLumpName (name, PU_CACHE);
dest = screens[1];
for (y=0 ; y<SCREENHEIGHT-SBARHEIGHT ; y++)
{
for (x=0 ; x<SCREENWIDTH/64 ; x++)
{
memcpy (dest, src+((y&63)<<6), 64);
dest += 64;
}
if (SCREENWIDTH&63)
{
memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
dest += (SCREENWIDTH&63);
}
}
patch = W_CacheLumpName ("brdr_t",PU_CACHE);
for (x=0 ; x<scaledviewwidth ; x+=8)
V_DrawPatch (viewwindowx+x,viewwindowy-8,1,patch);
patch = W_CacheLumpName ("brdr_b",PU_CACHE);
for (x=0 ; x<scaledviewwidth ; x+=8)
V_DrawPatch (viewwindowx+x,viewwindowy+viewheight,1,patch);
patch = W_CacheLumpName ("brdr_l",PU_CACHE);
for (y=0 ; y<viewheight ; y+=8)
V_DrawPatch (viewwindowx-8,viewwindowy+y,1,patch);
patch = W_CacheLumpName ("brdr_r",PU_CACHE);
for (y=0 ; y<viewheight ; y+=8)
V_DrawPatch (viewwindowx+scaledviewwidth,viewwindowy+y,1,patch);
// Draw beveled edge.
V_DrawPatch (viewwindowx-8,
viewwindowy-8,
1,
W_CacheLumpName ("brdr_tl",PU_CACHE));
V_DrawPatch (viewwindowx+scaledviewwidth,
viewwindowy-8,
1,
W_CacheLumpName ("brdr_tr",PU_CACHE));
V_DrawPatch (viewwindowx-8,
viewwindowy+viewheight,
1,
W_CacheLumpName ("brdr_bl",PU_CACHE));
V_DrawPatch (viewwindowx+scaledviewwidth,
viewwindowy+viewheight,
1,
W_CacheLumpName ("brdr_br",PU_CACHE));
}
//
// Copy a screen buffer.
//
void
R_VideoErase
( unsigned ofs,
int count )
{
// LFB copy.
// This might not be a good idea if memcpy
// is not optiomal, e.g. byte by byte on
// a 32bit CPU, as GNU GCC/Linux libc did
// at one point.
memcpy (screens[0]+ofs, screens[1]+ofs, count);
}
//
// R_DrawViewBorder
// Draws the border around the view
// for different size windows?
//
void
V_MarkRect
( int x,
int y,
int width,
int height );
void R_DrawViewBorder (void)
{
int top;
int side;
int ofs;
int i;
if (scaledviewwidth == SCREENWIDTH)
return;
top = ((SCREENHEIGHT-SBARHEIGHT)-viewheight)/2;
side = (SCREENWIDTH-scaledviewwidth)/2;
// copy top and one line of left side
R_VideoErase (0, top*SCREENWIDTH+side);
// copy one line of right side and bottom
ofs = (viewheight+top)*SCREENWIDTH-side;
R_VideoErase (ofs, top*SCREENWIDTH+side);
// copy sides using wraparound
ofs = top*SCREENWIDTH + SCREENWIDTH-side;
side <<= 1;
for (i=1 ; i<viewheight ; i++)
{
R_VideoErase (ofs, side);
ofs += SCREENWIDTH;
}
// ?
V_MarkRect (0,0,SCREENWIDTH, SCREENHEIGHT-SBARHEIGHT);
}
--- NEW FILE: d_main.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_main.c,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: d_main.c,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1137 lines suppressed...]
{
if (M_CheckParm("-cdrom"))
sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
else
sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
G_LoadGame (file);
}
if ( gameaction != ga_loadgame )
{
if (autostart || netgame)
G_InitNew (startskill, startepisode, startmap);
else
D_StartTitle (); // start up intro loop
}
D_DoomLoop (); // never returns
}
--- NEW FILE: m_argv.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_argv.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: m_argv.c,v $
// Revision 1.1 2006-10-03 11:26:17 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:28 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_argv.c,v 1.1 2006-10-03 11:26:17 dslinux_amadeus Exp $";
#include <string.h>
#include "i_system.h"
int myargc;
char** myargv;
//
// M_CheckParm
// Checks for the given parameter
// in the program's command line arguments.
// Returns the argument number (1 to argc-1)
// or 0 if not present
int M_CheckParm (char *check)
{
int i;
for (i = 1;i<myargc;i++)
{
if ( !I_strncasecmp(check, myargv[i], strlen(check)) )
return i;
}
return 0;
}
--- NEW FILE: dstrings.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: dstrings.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: dstrings.c,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.2 2000/12/20 17:00:52 jordanc
// Added some non offensive dstrings
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Globally defined strings.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: dstrings.c,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $";
#ifdef __GNUG__
#pragma implementation "dstrings.h"
#endif
#include "dstrings.h"
char* endmsg[NUM_QUITMESSAGES+1]=
{
// DOOM1
QUITMSG,
"please don't leave, there's more\ndemons to toast!",
"let's beat it -- this is turning\ninto a bloodbath!",
"i wouldn't leave if i were you.\ndos is much worse.",
"you're trying to say you like dos\nbetter than me, right?",
"don't leave yet -- there's a\ndemon around that corner!",
"ya know, next time you come in here\ni'm gonna toast ya.",
"go ahead and leave. see if i care."
// QuitDOOM II messages
"you want to quit?\nthen, thou hast lost an eighth!",
"don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!",
"get outta here and go back\nto your boring programs.",
"if i were your boss, i'd \n deathmatch ya in a minute!",
"look, bud. you leave now\nand you forfeit your body count!",
"just leave. when you come\nback, i'll be waiting with a bat.",
"you're lucky i don't smack\nyou for thinking about leaving."
// FinalDOOM?
"ok, fine.. go back to work\nbut you'll miss me.",
"this game brough to you by\nmicrowindowsn\nhttp://www.microwindows.org.",
"sure, go back to solitare\ni'll just play with myself.",
"come on!\ni was going to let you win.",
"i'll give you a dollar\nif you don't hit yes.",
"thanks for playing\narn't you glad you put linux on your pda?",
"don't leave me alone\ni'm scared of the dark!",
// Internal debug. Different style, too.
"THIS IS NO MESSAGE!\nPage intentionally left blank."
};
--- NEW FILE: d_main.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: d_main.h,v 1.1 2006-10-03 11:26:15 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: d_main.h,v $
// Revision 1.1 2006-10-03 11:26:15 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:51 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __D_MAIN__
#define __D_MAIN__
#include "d_event.h"
#ifdef __GNUG__
#pragma interface
#endif
#define MAXWADFILES 20
extern char* wadfiles[MAXWADFILES];
void D_AddFile (char *file);
//
// D_DoomMain()
// Not a globally visible function, just included for source reference,
// calls all startup code, parses command line options.
// If not overrided by user input, calls N_AdvanceDemo.
//
void D_DoomMain (void);
// Called by IO functions when input is detected.
void D_PostEvent (event_t* ev);
//
// BASE LEVEL
//
void D_PageTicker (void);
void D_PageDrawer (void);
void D_AdvanceDemo (void);
void D_StartTitle (void);
#endif
--- NEW FILE: install-sh ---
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
--- NEW FILE: p_local.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_local.h,v 1.1 2006-10-03 11:26:19 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Play functions, animation, global header.
//
//-----------------------------------------------------------------------------
#ifndef __P_LOCAL__
#define __P_LOCAL__
#ifndef __R_LOCAL__
#include "r_local.h"
#endif
#define FLOATSPEED (FRACUNIT*4)
#define MAXHEALTH 100
#define VIEWHEIGHT (41*FRACUNIT)
// 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)
// player radius for movement checking
#define PLAYERRADIUS 16*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
#define GRAVITY FRACUNIT
#define MAXMOVE (30*FRACUNIT)
#define USERANGE (64*FRACUNIT)
#define MELEERANGE (64*FRACUNIT)
#define MISSILERANGE (32*64*FRACUNIT)
// follow a player exlusively for 3 seconds
#define BASETHRESHOLD 100
//
// P_TICK
//
// both the head and tail of the thinker list
extern thinker_t thinkercap;
void P_InitThinkers (void);
void P_AddThinker (thinker_t* thinker);
void P_RemoveThinker (thinker_t* thinker);
//
// P_PSPR
//
void P_SetupPsprites (player_t* curplayer);
void P_MovePsprites (player_t* curplayer);
void P_DropWeapon (player_t* player);
//
// P_USER
//
void P_PlayerThink (player_t* player);
//
// P_MOBJ
//
#define ONFLOORZ MININT
#define ONCEILINGZ MAXINT
// Time interval for item respawning.
#define ITEMQUESIZE 128
extern mapthing_t itemrespawnque[ITEMQUESIZE];
extern int itemrespawntime[ITEMQUESIZE];
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);
//
// P_ENEMY
//
void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
//
// P_MAPUTL
//
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;
#define MAXINTERCEPTS 128
extern intercept_t intercepts[MAXINTERCEPTS];
extern intercept_t* intercept_p;
typedef boolean (*traverser_t) (intercept_t *in);
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
void P_MakeDivline (line_t* li, divline_t* dl);
fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
extern fixed_t opentop;
extern fixed_t openbottom;
extern fixed_t openrange;
extern fixed_t lowfloor;
void P_LineOpening (line_t* linedef);
boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
#define PT_ADDLINES 1
#define PT_ADDTHINGS 2
#define PT_EARLYOUT 4
extern divline_t trace;
boolean
P_PathTraverse
( fixed_t x1,
fixed_t y1,
fixed_t x2,
fixed_t y2,
int flags,
boolean (*trav) (intercept_t *));
void P_UnsetThingPosition (mobj_t* thing);
void P_SetThingPosition (mobj_t* thing);
//
// P_MAP
//
// If "floatok" true, move would be ok
// if within "tmfloorz - tmceilingz".
extern boolean floatok;
extern fixed_t tmfloorz;
extern fixed_t tmceilingz;
extern line_t* ceilingline;
boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
void P_SlideMove (mobj_t* mo);
boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
void P_UseLines (player_t* player);
boolean P_ChangeSector (sector_t* sector, boolean crunch);
extern mobj_t* linetarget; // who got hit (or NULL)
fixed_t
P_AimLineAttack
( mobj_t* t1,
angle_t angle,
fixed_t distance );
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 );
//
// P_SETUP
//
extern byte* rejectmatrix; // for fast sight rejection
extern short* blockmaplump; // offsets in blockmap are from here
extern short* 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
//
// P_INTER
//
extern int maxammo[NUMAMMO];
extern int clipammo[NUMAMMO];
void
P_TouchSpecialThing
( mobj_t* special,
mobj_t* toucher );
void
P_DamageMobj
( mobj_t* target,
mobj_t* inflictor,
mobj_t* source,
int damage );
//
// P_SPEC
//
#include "p_spec.h"
#endif // __P_LOCAL__
//-----------------------------------------------------------------------------
//
// $Log: p_local.h,v $
// Revision 1.1 2006-10-03 11:26:19 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:29 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
--- NEW FILE: p_switch.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_switch.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
//
// $Log: p_switch.c,v $
// Revision 1.1 2006-10-03 11:26:21 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:30 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:13 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:54 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// Switches, buttons. Two-state animation. Exits.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: p_switch.c,v 1.1 2006-10-03 11:26:21 dslinux_amadeus Exp $";
#include "i_system.h"
#include "doomdef.h"
#include "p_local.h"
#include "g_game.h"
#include "s_sound.h"
// Data.
#include "sounds.h"
// State.
#include "doomstat.h"
#include "r_state.h"
//
// CHANGE THE TEXTURE OF A WALL SWITCH TO ITS OPPOSITE
//
switchlist_t alphSwitchList[] =
{
// Doom shareware episode 1 switches
{"SW1BRCOM", "SW2BRCOM", 1},
{"SW1BRN1", "SW2BRN1", 1},
{"SW1BRN2", "SW2BRN2", 1},
{"SW1BRNGN", "SW2BRNGN", 1},
{"SW1BROWN", "SW2BROWN", 1},
{"SW1COMM", "SW2COMM", 1},
{"SW1COMP", "SW2COMP", 1},
{"SW1DIRT", "SW2DIRT", 1},
{"SW1EXIT", "SW2EXIT", 1},
{"SW1GRAY", "SW2GRAY", 1},
{"SW1GRAY1", "SW2GRAY1", 1},
{"SW1METAL", "SW2METAL", 1},
{"SW1PIPE", "SW2PIPE", 1},
{"SW1SLAD", "SW2SLAD", 1},
{"SW1STARG", "SW2STARG", 1},
{"SW1STON1", "SW2STON1", 1},
{"SW1STON2", "SW2STON2", 1},
{"SW1STONE", "SW2STONE", 1},
{"SW1STRTN", "SW2STRTN", 1},
// Doom registered episodes 2&3 switches
{"SW1BLUE", "SW2BLUE", 2},
{"SW1CMT", "SW2CMT", 2},
{"SW1GARG", "SW2GARG", 2},
{"SW1GSTON", "SW2GSTON", 2},
{"SW1HOT", "SW2HOT", 2},
{"SW1LION", "SW2LION", 2},
{"SW1SATYR", "SW2SATYR", 2},
{"SW1SKIN", "SW2SKIN", 2},
{"SW1VINE", "SW2VINE", 2},
{"SW1WOOD", "SW2WOOD", 2},
// Doom II switches
{"SW1PANEL", "SW2PANEL", 3},
{"SW1ROCK", "SW2ROCK", 3},
{"SW1MET2", "SW2MET2", 3},
{"SW1WDMET", "SW2WDMET", 3},
{"SW1BRIK", "SW2BRIK", 3},
{"SW1MOD1", "SW2MOD1", 3},
{"SW1ZIM", "SW2ZIM", 3},
{"SW1STON6", "SW2STON6", 3},
{"SW1TEK", "SW2TEK", 3},
{"SW1MARB", "SW2MARB", 3},
{"SW1SKULL", "SW2SKULL", 3},
{"\0", "\0", 0}
};
int switchlist[MAXSWITCHES * 2];
int numswitches;
button_t buttonlist[MAXBUTTONS];
//
// P_InitSwitchList
// Only called at game initialization.
//
void P_InitSwitchList(void)
{
int i;
int index;
int episode;
episode = 1;
if (gamemode == registered)
episode = 2;
else
if ( gamemode == commercial )
episode = 3;
for (index = 0,i = 0;i < MAXSWITCHES;i++)
{
if (!alphSwitchList[i].episode)
{
numswitches = index/2;
switchlist[index] = -1;
break;
}
if (alphSwitchList[i].episode <= episode)
{
#if 0 // UNUSED - debug?
int value;
if (R_CheckTextureNumForName(alphSwitchList[i].name1) < 0)
{
I_Error("Can't find switch texture '%s'!",
alphSwitchList[i].name1);
continue;
}
value = R_TextureNumForName(alphSwitchList[i].name1);
#endif
switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1);
switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2);
}
}
}
//
// Start a button counting down till it turns off.
//
void
P_StartButton
( line_t* line,
bwhere_e w,
int texture,
int time )
{
int i;
// See if button is already pressed
for (i = 0;i < MAXBUTTONS;i++)
{
if (buttonlist[i].btimer
&& buttonlist[i].line == line)
{
return;
}
}
for (i = 0;i < MAXBUTTONS;i++)
{
if (!buttonlist[i].btimer)
{
buttonlist[i].line = line;
buttonlist[i].where = w;
buttonlist[i].btexture = texture;
buttonlist[i].btimer = time;
buttonlist[i].soundorg = (mobj_t *)&line->frontsector->soundorg;
return;
}
}
I_Error("P_StartButton: no button slots left!");
}
//
// Function that changes wall texture.
// Tell it if switch is ok to use again (1=yes, it's a button).
//
void
P_ChangeSwitchTexture
( line_t* line,
int useAgain )
{
int texTop;
int texMid;
int texBot;
int i;
int sound;
if (!useAgain)
line->special = 0;
texTop = sides[line->sidenum[0]].toptexture;
texMid = sides[line->sidenum[0]].midtexture;
texBot = sides[line->sidenum[0]].bottomtexture;
sound = sfx_swtchn;
// EXIT SWITCH?
if (line->special == 11)
sound = sfx_swtchx;
for (i = 0;i < numswitches*2;i++)
{
if (switchlist[i] == texTop)
{
S_StartSound(buttonlist->soundorg,sound);
sides[line->sidenum[0]].toptexture = switchlist[i^1];
if (useAgain)
P_StartButton(line,top,switchlist[i],BUTTONTIME);
return;
}
else
{
if (switchlist[i] == texMid)
{
S_StartSound(buttonlist->soundorg,sound);
sides[line->sidenum[0]].midtexture = switchlist[i^1];
if (useAgain)
P_StartButton(line, middle,switchlist[i],BUTTONTIME);
return;
}
else
{
if (switchlist[i] == texBot)
{
S_StartSound(buttonlist->soundorg,sound);
sides[line->sidenum[0]].bottomtexture = switchlist[i^1];
if (useAgain)
P_StartButton(line, bottom,switchlist[i],BUTTONTIME);
return;
}
}
}
}
}
//
// P_UseSpecialLine
// Called when a thing uses a special line.
// Only the front sides of lines are usable.
//
boolean
P_UseSpecialLine
( mobj_t* thing,
line_t* line,
int side )
{
// Err...
// Use the back sides of VERY SPECIAL lines...
if (side)
{
switch(line->special)
{
case 124:
// Sliding door open&close
// UNUSED?
break;
default:
return false;
break;
}
}
// Switches that other things can activate.
if (!thing->player)
{
// never open secret doors
if (line->flags & ML_SECRET)
return false;
switch(line->special)
{
case 1: // MANUAL DOOR RAISE
case 32: // MANUAL BLUE
case 33: // MANUAL RED
case 34: // MANUAL YELLOW
break;
default:
return false;
break;
}
}
// do something
switch (line->special)
{
// MANUALS
case 1: // Vertical Door
case 26: // Blue Door/Locked
case 27: // Yellow Door /Locked
case 28: // Red Door /Locked
case 31: // Manual door open
case 32: // Blue locked door open
case 33: // Red locked door open
case 34: // Yellow locked door open
case 117: // Blazing door raise
case 118: // Blazing door open
EV_VerticalDoor (line, thing);
break;
//UNUSED - Door Slide Open&Close
// case 124:
// EV_SlidingDoor (line, thing);
// break;
// SWITCHES
case 7:
// Build Stairs
if (EV_BuildStairs(line,build8))
P_ChangeSwitchTexture(line,0);
break;
case 9:
// Change Donut
if (EV_DoDonut(line))
P_ChangeSwitchTexture(line,0);
break;
case 11:
// Exit level
P_ChangeSwitchTexture(line,0);
G_ExitLevel ();
break;
case 14:
// Raise Floor 32 and change texture
if (EV_DoPlat(line,raiseAndChange,32))
P_ChangeSwitchTexture(line,0);
break;
case 15:
// Raise Floor 24 and change texture
if (EV_DoPlat(line,raiseAndChange,24))
P_ChangeSwitchTexture(line,0);
break;
case 18:
// Raise Floor to next highest floor
if (EV_DoFloor(line, raiseFloorToNearest))
P_ChangeSwitchTexture(line,0);
break;
case 20:
// Raise Plat next highest floor and change texture
if (EV_DoPlat(line,raiseToNearestAndChange,0))
P_ChangeSwitchTexture(line,0);
break;
case 21:
// PlatDownWaitUpStay
if (EV_DoPlat(line,downWaitUpStay,0))
P_ChangeSwitchTexture(line,0);
break;
case 23:
// Lower Floor to Lowest
if (EV_DoFloor(line,lowerFloorToLowest))
P_ChangeSwitchTexture(line,0);
break;
case 29:
// Raise Door
if (EV_DoDoor(line,normal))
P_ChangeSwitchTexture(line,0);
break;
case 41:
// Lower Ceiling to Floor
if (EV_DoCeiling(line,lowerToFloor))
P_ChangeSwitchTexture(line,0);
break;
case 71:
// Turbo Lower Floor
if (EV_DoFloor(line,turboLower))
P_ChangeSwitchTexture(line,0);
break;
case 49:
// Ceiling Crush And Raise
if (EV_DoCeiling(line,crushAndRaise))
P_ChangeSwitchTexture(line,0);
break;
case 50:
// Close Door
if (EV_DoDoor(line,close))
P_ChangeSwitchTexture(line,0);
break;
case 51:
// Secret EXIT
P_ChangeSwitchTexture(line,0);
G_SecretExitLevel ();
break;
case 55:
// Raise Floor Crush
if (EV_DoFloor(line,raiseFloorCrush))
P_ChangeSwitchTexture(line,0);
break;
case 101:
// Raise Floor
if (EV_DoFloor(line,raiseFloor))
P_ChangeSwitchTexture(line,0);
break;
case 102:
// Lower Floor to Surrounding floor height
if (EV_DoFloor(line,lowerFloor))
P_ChangeSwitchTexture(line,0);
break;
case 103:
// Open Door
if (EV_DoDoor(line,open))
P_ChangeSwitchTexture(line,0);
break;
case 111:
// Blazing Door Raise (faster than TURBO!)
if (EV_DoDoor (line,blazeRaise))
P_ChangeSwitchTexture(line,0);
break;
case 112:
// Blazing Door Open (faster than TURBO!)
if (EV_DoDoor (line,blazeOpen))
P_ChangeSwitchTexture(line,0);
break;
case 113:
// Blazing Door Close (faster than TURBO!)
if (EV_DoDoor (line,blazeClose))
P_ChangeSwitchTexture(line,0);
break;
case 122:
// Blazing PlatDownWaitUpStay
if (EV_DoPlat(line,blazeDWUS,0))
P_ChangeSwitchTexture(line,0);
break;
case 127:
// Build Stairs Turbo 16
if (EV_BuildStairs(line,turbo16))
P_ChangeSwitchTexture(line,0);
break;
case 131:
// Raise Floor Turbo
if (EV_DoFloor(line,raiseFloorTurbo))
P_ChangeSwitchTexture(line,0);
break;
case 133:
// BlzOpenDoor BLUE
case 135:
// BlzOpenDoor RED
case 137:
// BlzOpenDoor YELLOW
if (EV_DoLockedDoor (line,blazeOpen,thing))
P_ChangeSwitchTexture(line,0);
break;
case 140:
// Raise Floor 512
if (EV_DoFloor(line,raiseFloor512))
P_ChangeSwitchTexture(line,0);
break;
// BUTTONS
case 42:
// Close Door
if (EV_DoDoor(line,close))
P_ChangeSwitchTexture(line,1);
break;
case 43:
// Lower Ceiling to Floor
if (EV_DoCeiling(line,lowerToFloor))
P_ChangeSwitchTexture(line,1);
break;
case 45:
// Lower Floor to Surrounding floor height
if (EV_DoFloor(line,lowerFloor))
P_ChangeSwitchTexture(line,1);
break;
case 60:
// Lower Floor to Lowest
if (EV_DoFloor(line,lowerFloorToLowest))
P_ChangeSwitchTexture(line,1);
break;
case 61:
// Open Door
if (EV_DoDoor(line,open))
P_ChangeSwitchTexture(line,1);
break;
case 62:
// PlatDownWaitUpStay
if (EV_DoPlat(line,downWaitUpStay,1))
P_ChangeSwitchTexture(line,1);
break;
case 63:
// Raise Door
if (EV_DoDoor(line,normal))
P_ChangeSwitchTexture(line,1);
break;
case 64:
// Raise Floor to ceiling
if (EV_DoFloor(line,raiseFloor))
P_ChangeSwitchTexture(line,1);
break;
case 66:
// Raise Floor 24 and change texture
if (EV_DoPlat(line,raiseAndChange,24))
P_ChangeSwitchTexture(line,1);
break;
case 67:
// Raise Floor 32 and change texture
if (EV_DoPlat(line,raiseAndChange,32))
P_ChangeSwitchTexture(line,1);
break;
case 65:
// Raise Floor Crush
if (EV_DoFloor(line,raiseFloorCrush))
P_ChangeSwitchTexture(line,1);
break;
case 68:
// Raise Plat to next highest floor and change texture
if (EV_DoPlat(line,raiseToNearestAndChange,0))
P_ChangeSwitchTexture(line,1);
break;
case 69:
// Raise Floor to next highest floor
if (EV_DoFloor(line, raiseFloorToNearest))
P_ChangeSwitchTexture(line,1);
break;
case 70:
// Turbo Lower Floor
if (EV_DoFloor(line,turboLower))
P_ChangeSwitchTexture(line,1);
break;
case 114:
// Blazing Door Raise (faster than TURBO!)
if (EV_DoDoor (line,blazeRaise))
P_ChangeSwitchTexture(line,1);
break;
case 115:
// Blazing Door Open (faster than TURBO!)
if (EV_DoDoor (line,blazeOpen))
P_ChangeSwitchTexture(line,1);
break;
case 116:
// Blazing Door Close (faster than TURBO!)
if (EV_DoDoor (line,blazeClose))
P_ChangeSwitchTexture(line,1);
break;
case 123:
// Blazing PlatDownWaitUpStay
if (EV_DoPlat(line,blazeDWUS,0))
P_ChangeSwitchTexture(line,1);
break;
case 132:
// Raise Floor Turbo
if (EV_DoFloor(line,raiseFloorTurbo))
P_ChangeSwitchTexture(line,1);
break;
case 99:
// BlzOpenDoor BLUE
case 134:
// BlzOpenDoor RED
case 136:
// BlzOpenDoor YELLOW
if (EV_DoLockedDoor (line,blazeOpen,thing))
P_ChangeSwitchTexture(line,1);
break;
case 138:
// Light Turn On
EV_LightTurnOn(line,255);
P_ChangeSwitchTexture(line,1);
break;
case 139:
// Light Turn Off
EV_LightTurnOn(line,35);
P_ChangeSwitchTexture(line,1);
break;
}
return true;
}
--- NEW FILE: p_enemy.c ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: p_enemy.c,v 1.1 2006-10-03 11:26:18 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log: p_enemy.c,v $
// Revision 1.1 2006-10-03 11:26:18 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
[...1981 lines suppressed...]
P_RemoveMobj (mo);
}
void A_PlayerScream (mobj_t* mo)
{
// Default death sound.
int sound = sfx_pldeth;
if ( (gamemode == commercial)
&& (mo->health < -50))
{
// IF THE PLAYER DIES
// LESS THAN -50% WITHOUT GIBBING
sound = sfx_pdiehi;
}
S_StartSound (mo, sound);
}
--- NEW FILE: dstrings.h ---
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: dstrings.h,v 1.1 2006-10-03 11:26:16 dslinux_amadeus Exp $
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
//
// $Log: dstrings.h,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
// DESCRIPTION:
// DOOM strings, by language.
//
//-----------------------------------------------------------------------------
#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
// Misc. other strings.
#define SAVEGAMENAME "doomsav"
//
// File locations,
// relative to current position.
// Path names are OS-sensitive.
//
#define DEVMAPS "devmaps"
#define DEVDATA "devdata"
// Not done in french?
// QuitDOOM messages
#define NUM_QUITMESSAGES 22
extern char* endmsg[];
#endif
//-----------------------------------------------------------------------------
//
// $Log: dstrings.h,v $
// Revision 1.1 2006-10-03 11:26:16 dslinux_amadeus
// adding pristine copy of pixil to HEAD so I can branch from it
//
// Revision 1.2 2003/09/08 22:34:27 jasonk
// Updated files because this fucker won't build for no fucking good reason.
//
// Revision 1.1.1.1 2003/09/04 21:08:12 jasonk
// Initial import
//
// Revision 1.1 2000/12/08 21:07:53 jeffw
// nxdoom initial entry -- No nxdoom/Makefile so it won't build automatically
//
//
//-----------------------------------------------------------------------------
More information about the dslinux-commit
mailing list