This commit is contained in:
mozzwald 2012-12-24 12:14:43 -06:00
commit 3e9d49d1b5
96 changed files with 52158 additions and 0 deletions

17
Changes-dc.txt Normal file
View File

@ -0,0 +1,17 @@
1.7 <February 01, 2009>
- Saved game description saved to VMS header
- Adjustments made to LCD
- VMU loading code improved
- Miscellaneous code clean ups
- Work started on new disc check code
1.6 <October 04, 2008>
- Getting the DC port up-to-date
1.5 <May 25, 2008>
- Mouse support
- Weapon switch support
- Controllers with C & Z button support
- Command line parameters via 'params.txt' support
- SOD mission pack support via menu
- Commercial CD-ROM swap support

157
Changes.txt Normal file
View File

@ -0,0 +1,157 @@
Wolf4SDL v1.7 (released 2011-05-15, revision 256)
- Added support for Mac OS X
(thanks to Chris Ballinger)
- Added support for .sd1 SOD game files as delivered by Steam
by changing --mission parameter slightly
(thanks to Pickle)
- Added --windowed-mouse parameter to start windowed mode with grabbed mouse
(thanks to Jared Breland)
- Rain and snow speed fix (thanks to Tricob)
- Floor/ceiling fix (thanks to Tricob / Adam Biser)
- Fixed moon out of screen bug (thanks to Tricob)
- Rain/snow leaking ceilings fix (thanks to Adam Biser / Tricob)
- Per-user configuration/savegame directories (~/.wolf4sdl) on
Linux like systems per default (thanks to Jared Breland)
- Added --configdir parameter
- Use SDL_DOUBLEBUF for vsync to avoid or at least reduce flickering
(thanks to Greg Ayrton for the hint, use --nodblbuf to disable it)
- Removed remainings of the frame rate counter on screen, when disabled
- Don't quit game when using TAB+E with --tedlevel
- Added --extravbls parameter
- Changed default for "extra VBLs" from 1 to 0
- Fixed missing umask parameter for open with O_CREAT
(bug reported by Daniel Fass)
- Fixed support for 1.0 shareware data files
(bug reported by Marcus Naylor)
- Fixed xtile and ytile not being valid in HitHorizWall and HitVertWall,
respectively. This caused problems with some tutorials.
- Removed unused HitHorizPWall and HitVertPWall.
Wolf4SDL v1.6 (released 2008-09-01, revision 233)
- Fixed songs not really supporting more than 64kb
- Try to recognize whether data files don't fit to program version
instead of just using them and probably crash
(can be disabled with --ignorenumchunks)
- Fizzle fade now works for resolutions up to 8191x4095
(thanks to Xilinx, Inc. for the list of maximum-length LFSR counters)
- Fixed demos being dependent on actual duration of GETGATLINGSND
(fixes second demo, which even rarely worked in vanilla Wolf3D)
- Fixed demos by disabling some bugfixes during recording and playback
(see PLAYDEMOLIKEORIGINAL define in version.h)
- Removed system menu on Windows in windowed mode to avoid ALT to open it
- Fixed palette issues occurring on some Windows systems by using the
"best" color depth reported by libSDL per default (also see --bits option)
- Fixed directional 3d sprites on architectures only allowing aligned memory
access (bug reported by Pickle)
- Fixed remaining status bar after end of demo in 320x240s resolutions
(bug reported by Pickle)
- Removed last busy waiting (fixes very unstable framerates on machines with
stricter schedulers like FreeBSD; thanks to Tron for making me notice)
- Fixed compiling of SOD on case sensitive file systems
(thanks to Michael)
Wolf4SDL v1.5 (released 2008-05-25, revision 215)
- Reduced minimum distance to back of moving pushwall to PLAYERSIZE
- Fixed pushwall rendering when player's eye is in the pushwall back tile
(bug reported by Pickle)
- Enable 'End game' menu item also when using --tedlevel
- Removed some unneccessary fade outs
(DrawPlayScreen does not call VW_FadeOut anymore!!)
- When using 'End game', 'View scores' does not directly show up anymore
- Fixed quickload/quicksave not working when started with --tedlevel (vanilla
bug). This now also only checks for save games once at startup (may speed
up entering the menu on Dreamcast)
- Fixed drawing moving pushwalls viewed at acute angles near the level border
- Fixed vanilla bug hiding bonus items on same tile as player, when he cannot
pick them up (e.g. medikit at 100% health) (thanks to Pickle for noticing)
- Added GP2X specific code by Pickle
- Reimplemented picture grabber to support all screen resolutions
(<TAB>+P in debug mode)
- Added --resf option to force to use unsupported resolutions >= 320x200
- Added support for resolutions being a multiple of 320x240
(thanks for your help, Pickle!)
- Fixed crash when cheat-hurting oneself to death (bug reported by Tricob)
- Cleaned up id_sd.cpp (kept PC speaker stuff for future reference)
- Added move buttons (invalidates config file, only hardcoded yet)
- Added joystick support to US_LineInput used for highscore names
and save games
- Added US_Printf and US_CPrintf (works just like printf)
- Fixed wrong surface locks/unlocks
- Added Visual C++ 6 support
- Removed some useless VW_WaitVBLs (Thanks to TexZK)
- Added some asserts in id_vl.cpp to check for screen access out of bounds
- Fixed BJ face popping up in fullsize mode sometimes
(Thanks to Andy_Nonymous)
- Rewrote page manager to support page >= 64kB
and to correctly handle sounds >= 4kB
- Improved SOD mission packs support (Thanks to fackue)
- Updated Code::Blocks search paths to ..\SDL-devel\
- Added version.h to Dev-C++ and Code::Blocks project file
- Fixed some files being read in text mode on MinGW
Wolf4SDL v1.4 (released 2008-03-10, revision 164)
- Added MinGW/MSYS compatibility
- Updated Code::Blocks project
- Updated Dev-C++ project and added a README-devcpp.txt
- Fixed some busy waiting situations
- Added directional 3D sprites support (USE_DIR3DSPR)
- Added support for Spear mission packs (by fackue)
- Added support for Wolf3D full v1.1 and shareware v1.0, v1.1 and v1.2
- Added shading support (USE_SHADING)
- Added object flags (see objflag_t enum in wl_def.h)
- Reintroduced version.h
- Increased MAXVISABLE from 50 to 250
- Added outside atmosphere features (USE_STARSKY, USE_RAIN, USE_SNOW)
- Added cloud sky support (USE_CLOUDSKY)
- Added support for SoD demo
- Fixed SoD on systems with case sensitive filenames
- Added DarkOne's/Adam's multi-textured floors/ceiling (USE_FLOORCEILINGTEX)
- Added parallax sky support (USE_PARALLAX define)
- Introduced level feature flags (USE_FEATUREFLAGS define)
- Added high resolution support (USE_HIRES define)
- Added support for music > 64 kB as supported by WDC
- Added --samplerate and --audiobuffer parameters
- Added support for GP2X (ARM processor, thanks to Pickle)
- Added support for Dreamcast (SH-4 processor, thanks to fackue)
- Added joystick support (up to 32 buttons)
Wolf4SDL v1.3 (released 2008-01-20, revision 113)
- Added parameter for SOD to disable copy protection quiz
- F12 now also grabs the mouse (for keyboards without scrolllock)
- Fixed out of bounds array access in key processing
Wolf4SDL v1.2 (released 2008-01-09, revision 108)
- Fixed fading for 'End Game'
- Corrected fading speed
- Added Spear of Destiny compile support
- Reimplemented palette file (Sorry...)
- Fixed end game crash, when player did not die yet
(Thanks to Agent87 for noticing this bug!)
- Added full size screen feature
- Added project files for Code::Blocks and Dev-C++
(Thanks to Codetech84!)
- Made it MinGW compatible
- Fixed demo fading issues
- Reformatted many source code files
- Resolved all warnings reported by VC++ 8 and GCC
- Fixed crash when starting the game with no sound >effects<
(Thanks to Agent87 for noticing this bug!)
- Always grab mouse when started in fullscreen
- Map left and right alt, shift and ctrl keys to the same keys
- Fix numpad keys with numlock off
- Fixed a buffer overflow causing a crash
Wolf4SDL v1.1 (released 2007-12-28, revision 70)
- Fixed Pause
- Fixed IN_Ack()
- Added command line parameters for windowed mode and screen resolution
- Reimplemented command line parameters (try --help)
- Improved scaled "Get Psyched" progress bar graphic
- Improved scaled screen borders
- Fixed "Fade in black screen" bug
- Avoid asserts when shutting down with an error
- Use software surfaces to reduce problems with palette on Windows
- Windows: Statically links to MSVCR80.DLL now to avoid missing files
Wolf4SDL v1.0 (released 2007-12-26, revision 53)
- Initial release

818
GP2X/fmopl.cpp Normal file
View File

@ -0,0 +1,818 @@
/*
** based on:
**
** File: fmopl.c - software implementation of FM sound generator
** types OPL and OPL2
**
** Copyright (C) 2002,2003 Jarek Burczynski (bujar at mame dot net)
** Copyright (C) 1999,2000 Tatsuyuki Satoh , MultiArcadeMachineEmulator development
**
** Version 0.70
**
** from the dosbox 0.72 source
*/
#define LOG_MSG printf
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include "fmopl.h"
#include "fmopl_940/fmopl_shared.h"
#ifndef PI
#define PI 3.14159265358979323846
#endif
/* output final shift */
#if (OPL_SAMPLE_BITS==16)
#define FINAL_SH (0)
#define MAXOUT (+32767)
#define MINOUT (-32768)
#else
#define FINAL_SH (8)
#define MAXOUT (+127)
#define MINOUT (-128)
#endif
#define FREQ_SH 16 /* 16.16 fixed point (frequency calculations) */
#define EG_SH 16 /* 16.16 fixed point (EG timing) */
#define LFO_SH 24 /* 8.24 fixed point (LFO calculations) */
#define TIMER_SH 16 /* 16.16 fixed point (timers calculations) */
#define FREQ_MASK ((1<<FREQ_SH)-1)
/* envelope output entries */
#define ENV_BITS 10
#define ENV_LEN (1<<ENV_BITS)
#define ENV_STEP (128.0/ENV_LEN)
#define MAX_ATT_INDEX ((1<<(ENV_BITS-1))-1) /*511*/
#define MIN_ATT_INDEX (0)
/* register number to channel number , slot offset */
#define SLOT1 0
#define SLOT2 1
/* Envelope Generator phases */
#define EG_ATT 4
#define EG_DEC 3
#define EG_SUS 2
#define EG_REL 1
#define EG_OFF 0
#define OPL_TYPE_WAVESEL 0x01 /* waveform select */
#define OPL_TYPE_ADPCM 0x02 /* DELTA-T ADPCM unit */
#define OPL_TYPE_KEYBOARD 0x04 /* keyboard interface */
#define OPL_TYPE_IO 0x08 /* I/O port */
/* ---------- Generic interface section ---------- */
#define OPL_TYPE_YM3526 (0)
#define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
#define OPL_TYPE_Y8950 (OPL_TYPE_ADPCM|OPL_TYPE_KEYBOARD|OPL_TYPE_IO)
#define WAIT_IF_MSG_BUF_FULL while( *NSubmittedMessages - *NExecutedMessages>= MSG_BUF_SIZE){};
#define WAIT_FOR_SYNC \
while( (*NSubmittedMessages - *NExecutedMessages) % (int) MSG_BUF_SIZE !=0 ){};
#define ADD_MESSAGE(mtype, i,j,k) \
{ \
int n = ((*NSubmittedMessages)+1) % ((int) MSG_BUF_SIZE); \
MessageBuffer[n].type=mtype; \
MessageBuffer[n].data1=i; \
MessageBuffer[n].data2=j; \
MessageBuffer[n].data3=k; \
(*NSubmittedMessages)++; \
}
//if((*NSubmittedMessages) % (int) 500 ==0)
// LOG_MSG("OPL2: %d %d %d\n",*NSubmittedMessages,*NExecutedMessages,*NSubmittedMessages-*NExecutedMessages);
typedef struct fm_opl_lite {
int T[2]; /* timer counters */
int TC[2];
UINT8 st[2]; /* timer enable */
UINT32 *fn_tab;
/* external event callback handlers */
OPL_TIMERHANDLER TimerHandler; /* TIMER handler */
int TimerParam; /* TIMER parameter */
OPL_IRQHANDLER IRQHandler; /* IRQ handler */
int IRQParam; /* IRQ parameter */
OPL_UPDATEHANDLER UpdateHandler; /* stream update handler */
int UpdateParam; /* stream update parameter */
UINT8 type; /* chip type */
UINT8 address; /* address register */
UINT8 status; /* status flag */
UINT8 statusmask; /* status mask */
UINT8 mode; /* Reg.08 : CSM,notesel,etc. */
int clock; /* master clock (Hz) */
int rate; /* sampling rate (Hz) */
double freqbase; /* frequency base */
double TimerBase; /* Timer base time (==sampling time)*/
} FM_OPLlite;
/* status set and IRQ handling */
inline void OPL_STATUS_SET(FM_OPLlite *OPL,int flag)
{
/* set status flag */
OPL->status |= flag;
if(!(OPL->status & 0x80))
{
if(OPL->status & OPL->statusmask)
{ /* IRQ on */
OPL->status |= 0x80;
/* callback user interrupt handler (IRQ is OFF to ON) */
if(OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,1);
}
}
}
/* status reset and IRQ handling */
inline void OPL_STATUS_RESET(FM_OPLlite *OPL,int flag)
{
/* reset status flag */
OPL->status &=~flag;
if((OPL->status & 0x80))
{
if (!(OPL->status & OPL->statusmask) )
{
OPL->status &= 0x7f;
/* callback user interrupt handler (IRQ is ON to OFF) */
if(OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,0);
}
}
}
/* IRQ mask set */
inline void OPL_STATUSMASK_SET(FM_OPLlite *OPL,int flag)
{
OPL->statusmask = flag;
/* IRQ handling check */
OPL_STATUS_SET(OPL,0);
OPL_STATUS_RESET(OPL,0);
}
/* generic table initialize */
static int init_tables(void)
{
signed int i,x;
signed int n;
double o,m;
for (x=0; x<TL_RES_LEN; x++)
{
m = (1<<16) / pow(2.0, (x+1) * (ENV_STEP/4.0) / 8.0);
m = floor(m);
/* we never reach (1<<16) here due to the (x+1) */
/* result fits within 16 bits at maximum */
n = (int)m; /* 16 bits here */
n >>= 4; /* 12 bits here */
if (n&1) /* round to nearest */
n = (n>>1)+1;
else
n = n>>1;
/* 11 bits here (rounded) */
n <<= 1; /* 12 bits here (as in real chip) */
tl_tab[ x*2 + 0 ] = n;
tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ];
for (i=1; i<12; i++)
{
tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i;
tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ];
}
}
for (i=0; i<SIN_LEN; i++)
{
/* non-standard sinus */
m = sin( ((i*2)+1) * PI / SIN_LEN ); /* checked against the real chip */
/* we never reach zero here due to ((i*2)+1) */
if (m>0.0)
o = 8*log(1.0/m)/log(2.0); /* convert to 'decibels' */
else
o = 8*log(-1.0/m)/log(2.0); /* convert to 'decibels' */
o = o / (ENV_STEP/4);
n = (int)(2.0*o);
if (n&1) /* round to nearest */
n = (n>>1)+1;
else
n = n>>1;
sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 );
}
for (i=0; i<SIN_LEN; i++)
{
/* waveform 1: __ __ */
/* / \____/ \____*/
/* output only first half of the sinus waveform (positive one) */
if (i & (1<<(SIN_BITS-1)) )
sin_tab[1*SIN_LEN+i] = TL_TAB_LEN;
else
sin_tab[1*SIN_LEN+i] = sin_tab[i];
/* waveform 2: __ __ __ __ */
/* / \/ \/ \/ \*/
/* abs(sin) */
sin_tab[2*SIN_LEN+i] = sin_tab[i & (SIN_MASK>>1) ];
/* waveform 3: _ _ _ _ */
/* / |_/ |_/ |_/ |_*/
/* abs(output only first quarter of the sinus waveform) */
if (i & (1<<(SIN_BITS-2)) )
sin_tab[3*SIN_LEN+i] = TL_TAB_LEN;
else
sin_tab[3*SIN_LEN+i] = sin_tab[i & (SIN_MASK>>2)];
}
return 1;
}
static void OPL_initalize(FM_OPLlite *OPL, FM_OPL *OPLs)
{
int i;
/* frequency base */
OPL->freqbase = (OPL->rate) ? ((double)OPL->clock / 72.0) / OPL->rate : 0;
/* Timer base time */
OPL->TimerBase = 1.0 / ((double)OPL->clock / 72.0 );
/* make fnumber -> increment counter table */
for( i=0 ; i < 1024 ; i++ )
{
/* opn phase increment counter = 20bit */
OPL->fn_tab[i] = (UINT32)( (double)i * 64 * OPL->freqbase * (1<<(FREQ_SH-10)) );
/* -10 because chip works with 10.10 fixed point, while we use 16.16 */
}
/* Amplitude modulation: 27 output levels (triangle waveform); 1 level takes one of: 192, 256 or 448 samples */
/* One entry from LFO_AM_TABLE lasts for 64 samples */
OPLs->lfo_am_inc = (UINT32)((1.0 / 64.0 ) * (1<<LFO_SH) * OPL->freqbase);
/* Vibrato: 8 output levels (triangle waveform); 1 level takes 1024 samples */
OPLs->lfo_pm_inc = (UINT32)((1.0 / 1024.0) * (1<<LFO_SH) * OPL->freqbase);
/* Noise generator: a step takes 1 sample */
OPLs->noise_f = (UINT32)((1.0 / 1.0) * (1<<FREQ_SH) * OPL->freqbase);
OPLs->eg_timer_add = (UINT32)((1<<EG_SH) * OPL->freqbase);
OPLs->eg_timer_overflow = ( 1 ) * (1<<EG_SH);
}
/* write a value v to register r on OPL chip */
static void OPLWriteReg(FM_OPLlite *OPL, int r, int v)
{
/* adjust bus to 8 bits */
r &= 0xff;
v &= 0xff;
switch(r&0xe0)
{
case 0x00: /* 00-1f:control */
switch(r&0x1f)
{
case 0x01: /* waveform select enable */
break;
case 0x02: /* Timer 1 */
OPL->T[0] = (256-v)*4;
break;
case 0x03: /* Timer 2 */
OPL->T[1] = (256-v)*16;
break;
case 0x04: /* IRQ clear / mask and Timer enable */
if(v&0x80)
{ /* IRQ flag clear */
OPL_STATUS_RESET(OPL,0x7f);
}
else
{ /* set IRQ mask ,timer enable*/
OPL->st[0] = v&1;
OPL->st[1] = (v>>1)&1;
/* IRQRST,T1MSK,t2MSK,EOSMSK,BRMSK,x,ST2,ST1 */
OPL_STATUS_RESET(OPL, v & 0x78 );
OPL_STATUSMASK_SET(OPL, (~v) & 0x78 );
/* timer 1 */
if(OPL->st[0])
{
OPL->TC[0]=OPL->T[0]*20;
double interval = (double)OPL->T[0]*OPL->TimerBase;
if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam+0,interval);
}
/* timer 2 */
if(OPL->st[1])
{
OPL->TC[1]=OPL->T[1]*20;
double interval =(double)OPL->T[1]*OPL->TimerBase;
if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam+1,interval);
}
}
break;
case 0x08: /* MODE,DELTA-T control 2 : CSM,NOTESEL,x,x,smpl,da/ad,64k,rom */
OPL->mode = v;
break;
default:
//logerror("FMOPL.C: write to unknown register: %02x\n",r);
break;
}
break;
case 0x20: /* am ON, vib ON, ksr, eg_type, mul */
break;
case 0x40:
break;
case 0x60:
break;
case 0x80:
break;
case 0xa0:
break;
case 0xc0:
break;
case 0xe0: /* waveform select */
break;
}
}
static void OPLResetChip(FM_OPLlite *OPL)
{
int c,s;
int i;
OPL->mode = 0; /* normal mode */
OPL_STATUS_RESET(OPL,0x7f);
/* reset with register write */
OPLWriteReg(OPL,0x01,0); /* wavesel disable */
OPLWriteReg(OPL,0x02,0); /* Timer1 */
OPLWriteReg(OPL,0x03,0); /* Timer2 */
OPLWriteReg(OPL,0x04,0); /* IRQ mask clear */
for(i = 0xff ; i >= 0x20 ; i-- ) OPLWriteReg(OPL,i,0);
}
/* Create one of virtual YM3812/YM3526/Y8950 */
/* 'clock' is chip clock in Hz */
/* 'rate' is sampling rate */
void OPLCreate(int type, int clock, int rate, FM_OPLlite* OPL, FM_OPL* OPLs)
{
OPL->type = type;
OPL->clock = clock;
OPL->rate = rate;
/* init global tables */
OPL_initalize(OPL,OPLs);
}
/* Destroy one of virtual YM3812 */
static void OPLDestroy(FM_OPLlite *OPL)
{
free(OPL);
}
/* Optional handlers */
static void OPLSetTimerHandler(FM_OPLlite *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset)
{
OPL->TimerHandler = TimerHandler;
OPL->TimerParam = channelOffset;
}
static void OPLSetIRQHandler(FM_OPLlite *OPL,OPL_IRQHANDLER IRQHandler,int param)
{
OPL->IRQHandler = IRQHandler;
OPL->IRQParam = param;
}
static void OPLSetUpdateHandler(FM_OPLlite *OPL,OPL_UPDATEHANDLER UpdateHandler,int param)
{
OPL->UpdateHandler = UpdateHandler;
OPL->UpdateParam = param;
}
static int OPLWrite(FM_OPLlite *OPL,int a,int v)
{
if( !(a&1) )
{ /* address port */
OPL->address = v & 0xff;
}
else
{ /* data port */
if(OPL->UpdateHandler) OPL->UpdateHandler(OPL->UpdateParam,0);
OPLWriteReg(OPL,OPL->address,v);
}
return OPL->status>>7;
}
static unsigned char OPLRead(FM_OPLlite *OPL,int a)
{
if( !(a&1) )
{
/* status port */
if (OPL->st[0]) {
if (OPL->TC[0]) OPL->TC[0]--;
else {
OPL->TC[0]=OPL->T[0]*20;
OPL_STATUS_SET(OPL,0x40);
}
}
if (OPL->st[1]) {
if (OPL->TC[1]) OPL->TC[1]--;
else {
OPL->TC[1]=OPL->T[1]*20;
OPL_STATUS_SET(OPL,0x40);
}
}
return OPL->status & (OPL->statusmask|0x80);
}
return 0xff;
}
static int OPLTimerOver(FM_OPLlite *OPL,int c)
{
if( c )
{ /* Timer B */
OPL_STATUS_SET(OPL,0x20);
}
else
{ /* Timer A */
OPL_STATUS_SET(OPL,0x40);
/* CSM mode key,TL controll */
if( OPL->mode & 0x80 )
{ /* CSM mode total level latch and auto key on */
int ch;
if(OPL->UpdateHandler) OPL->UpdateHandler(OPL->UpdateParam,0);
}
}
return OPL->status>>7;
}
#define MAX_OPL_CHIPS 2
#if (BUILD_YM3812)
static FM_OPLlite *OPLlite_YM3812[MAX_OPL_CHIPS];
extern "C" {
static int Status940=0;
static int g_hMemory=0;
static volatile unsigned short *g_pusRegs;
static unsigned char *g_pSharedMemory = 0;
void UpdateThreadEntry(void);
void Pause940(int n);
void Reset940(int yes);
void Startup940();
void Shutdown940();
void CleanUp(void);
void InitSharedMemory();
}
void Pause940(int n)
{
if(n)
g_pusRegs[0x0904>>1] &= 0xFFFE;
else
g_pusRegs[0x0904>>1] |= 1;
}
void Reset940(int yes)
{
g_pusRegs[0x3B48>>1] = ((yes&1) << 7) | (0x03);
}
void Startup940()
{
int nLen, nRead;
FILE *fp;
unsigned char ucData[1000];
Reset940(1);
Pause940(1);
g_pusRegs[0x3B40>>1] = 0;
g_pusRegs[0x3B42>>1] = 0;
g_pusRegs[0x3B44>>1] = 0xffff;
g_pusRegs[0x3B46>>1] = 0xffff;
// load code940.bin
nLen = 0;
fp = fopen("code940.bin", "r");
if(!fp) {
LOG_MSG("no 940 core found\n");
return;
} else
{
LOG_MSG("940 core found\n");
}
while(1)
{
nRead = fread(ucData, 1, 1000, fp);
if(nRead <= 0)
break;
memcpy(g_pSharedMemory + nLen, ucData, nRead);
nLen += nRead;
}
fclose(fp);
Reset940(0);
Pause940(0);
usleep(10000);
}
void Shutdown940()
{
Reset940(1);
Pause940(1);
}
void CleanUp(void)
{
Status940--;
//if(Status940>0) return;
//if(g_pSharedMemory)
// munmap(g_pSharedMemory, 0xF80000);
g_pSharedMemory = 0;
Shutdown940();
close(g_hMemory);
printf("Core shutdown\n");
}
void InitSharedMemory()
{
if(g_hMemory) return;
LOG_MSG("Once?\n");
g_hMemory = open("/dev/mem", O_RDWR);
g_pusRegs = (unsigned short *) mmap(0, 0x10000,
PROT_READ|PROT_WRITE, MAP_SHARED, g_hMemory, 0xc0000000);
g_pSharedMemory = (unsigned char *) mmap(0, 0xF80000,
PROT_READ|PROT_WRITE, MAP_SHARED, g_hMemory, 0x3000000);
memset(g_pSharedMemory,0,0x400000);
}
void UpdateThreadEntry(void)
{
Status940++;
if(Status940==1) Startup940();
}
static void InitMemory()
{
SharedBuff_ptr = (char *) (g_pSharedMemory + BUFF_BASE_ADDRESS);
SharedData_ptr = (char *) (g_pSharedMemory + DATA_BASE_ADDRESS);
memset(SharedBuff_ptr,0, END_OFFSET);
memset(SharedData_ptr,0, END_OFFSET2);
}
int YM3812Init(int num, int clock, int rate)
{
int i;
char *ptr;
if (YM3812NumChips)
return -1; /* duplicate init. */
if(END_OFFSET>OPL2_MSG_SIZE ||
END_OFFSET2>OPL2_DAT_SIZE) {
LOG_MSG("OPL2 memory data error\n");
return -1;
}
InitSharedMemory();
InitMemory();
LOG_MSG("OPL2 reports\n");
LOG_MSG("OPL2 mem: %d %d %d %d\n", sizeof(OPL_SLOT),
sizeof(OPL_CH),sizeof(FM_OPL),OPL_SIZE);
ptr=(SharedData_ptr + NUMCHIP_OFFSET);
YM3812NumChips=(int *) ptr;
*YM3812NumChips = num;
ptr=(SharedBuff_ptr + NSUB_OFFSET);
NSubmittedMessages=(int *) ptr;
*NSubmittedMessages=-1;
ptr=(SharedBuff_ptr + NEX_OFFSET);
NExecutedMessages=(int *) ptr;
*NExecutedMessages=-1;
ptr=(SharedBuff_ptr + MSG_BUF_OFFSET);
MessageBuffer=(CoreMessage *) ptr;
ptr=(SharedBuff_ptr + TL_TAB_OFFSET);
tl_tab=(signed int *) ptr;
ptr=(SharedBuff_ptr + SIN_TAB_OFFSET);
sin_tab=(unsigned int *) ptr;
init_tables();
for (i = 0;i < *YM3812NumChips; i++)
{
ptr=(SharedBuff_ptr + BUFPOS_OFFSET+ i*sizeof(int));
BufWritePos[i]=(int *) ptr;
*BufWritePos[i]=0;
ptr=(SharedBuff_ptr + READPOS_OFFSET +i*sizeof(int));
BufReadPos[i]=(int *) ptr;
*BufReadPos[i]=0;
ptr=(SharedBuff_ptr + DATA_OFFSET + i * SHARED_BUF_SIZE * sizeof(INT16));
SharedBuffer[i]=(INT16 *) ptr;
ptr=(SharedData_ptr + OPL_OFFSET + i*OPL_SIZE);
OPL_YM3812[i] = (FM_OPL*) ptr;
ptr = (char *) malloc(sizeof(FM_OPLlite));
memset(ptr , 0, sizeof(FM_OPLlite));
OPLlite_YM3812[i] = (FM_OPLlite *) ptr;
ptr=(SharedBuff_ptr + FNTAB_OFFSET+i*1024*sizeof(UINT32));
OPLlite_YM3812[i]->fn_tab=(UINT32 *) ptr;
OPLCreate(OPL_TYPE_YM3812,clock,rate,OPLlite_YM3812[i],OPL_YM3812[i]);
}
UpdateThreadEntry();
ADD_MESSAGE(INIT ,num ,clock ,rate );
for (i = 0;i < *YM3812NumChips; i++)
{
YM3812ResetChip(i);
}
return 0;
}
void YM3812Shutdown(void)
{
int i;
LOG_MSG("OPL2 ...\n");
ADD_MESSAGE(SHUTDOWN,0,0,0);
WAIT_FOR_SYNC;
LOG_MSG("OPL2 end\n");
for (i = 0;i < *YM3812NumChips; i++)
{
/* emulator shutdown */
OPLDestroy(OPLlite_YM3812[i]);
OPL_YM3812[i] = NULL;
OPLlite_YM3812[i] = NULL;
}
*YM3812NumChips = 0;
CleanUp();
}
void YM3812ResetChip(int which)
{
ADD_MESSAGE(RESET,which,0,0);
OPLResetChip(OPLlite_YM3812[which]);
}
int YM3812Write(int which, int a, int v)
{
ADD_MESSAGE(WRITE,which,0,a);
ADD_MESSAGE(WRITE,which,1,v);
OPLWriteReg(OPLlite_YM3812[which], a, v);
return (OPLlite_YM3812[which]->status>>7);
}
unsigned char YM3812Read(int which, int a)
{
ADD_MESSAGE(READ,which,a,0);
/* YM3812 always returns bit2 and bit1 in HIGH state */
return OPLRead(OPLlite_YM3812[which], a) | 0x06 ;
}
int YM3812TimerOver(int which, int c)
{
ADD_MESSAGE(TIMEROVER,which,c,0);
return OPLTimerOver(OPLlite_YM3812[which], c);
}
void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset)
{
OPLSetTimerHandler(OPLlite_YM3812[which], TimerHandler, channelOffset);
}
void YM3812SetIRQHandler(int which,OPL_IRQHANDLER IRQHandler,int param)
{
OPLSetIRQHandler(OPLlite_YM3812[which], IRQHandler, param);
}
void YM3812SetUpdateHandler(int which,OPL_UPDATEHANDLER UpdateHandler,int param)
{
OPLSetUpdateHandler(OPLlite_YM3812[which], UpdateHandler, param);
}
void YM3812UpdateOne(int which, INT16 *buffer, int length)
{
int i,ncopy,nfree,nbuff,d,bufpos;
INT16 lt;
static int warn=1;
d=*NSubmittedMessages-*NExecutedMessages;
if(warn && d>MSG_BUF_SIZE)
{
LOG_MSG("OPL2: buffer running full");
warn=0;
}
else
{
if(d<MSG_BUF_SIZE) warn=1;
}
bufpos=*BufReadPos[which];
d=*BufWritePos[which]- bufpos;
nbuff=WRAPPED(d,SHARED_BUF_SIZE);
ncopy=MIN(length, nbuff);
nfree=SHARED_BUF_SIZE - bufpos;
if(ncopy < nfree)
{
for(i=0;i<ncopy;i++)
{
lt=Amp( SharedBuffer[which][ bufpos+i ] );
buffer[2*i]=lt;
buffer[2*i+1]=lt; //for stereo
}
(*BufReadPos[which])+=ncopy;
}
else
{
for(i=0;i<nfree;i++)
{
lt=Amp( SharedBuffer[which][ bufpos+i ] );
buffer[2*i]=lt;
buffer[2*i+1]=lt;
}
for(i=0;i<ncopy-nfree;i++)
{
lt=Amp( SharedBuffer[which][i] );
buffer[2*i+2*nfree]=lt;
buffer[2*i+2*nfree+1]=lt;
}
*BufReadPos[which]=ncopy-nfree;
}
if(ncopy < length)
{
bufpos=*BufReadPos[which];
lt=Amp( SharedBuffer[which][WRAPPED(bufpos-1,SHARED_BUF_SIZE)] );
for(i=ncopy;i<length;i++)
{
buffer[2*i]=lt;
buffer[2*i+1]=lt;
}
}
ADD_MESSAGE(UPDATE, which, length, 0);
}
INT16 Amp( INT16 value )
{
INT32 temp;
int offset = 2;
temp = value;
temp <<= offset;
if( temp > MAXOUT ) temp = MAXOUT;
if( temp < MINOUT ) temp = MINOUT;
return (INT16)temp;
}
#endif /* BUILD_YM3812 */

58
GP2X/fmopl.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef __FMOPL_H_
#define __FMOPL_H_
#define HAS_YM3812 1
/* --- select emulation chips --- */
#define BUILD_YM3812 (HAS_YM3812)
#define BUILD_YM3526 (HAS_YM3526)
#define BUILD_Y8950 (HAS_Y8950)
/* select output bits size of output : 8 or 16 */
#define OPL_SAMPLE_BITS 16
/* compiler dependence */
#ifndef OSD_CPU_H
#define OSD_CPU_H
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
#endif
#if (OPL_SAMPLE_BITS==16)
typedef INT16 OPLSAMPLE;
#endif
#if (OPL_SAMPLE_BITS==8)
typedef INT8 OPLSAMPLE;
#endif
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
typedef void (*OPL_IRQHANDLER)(int param,int irq);
typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
#if BUILD_YM3812
int YM3812Init(int num, int clock, int rate);
void YM3812Shutdown(void);
void YM3812ResetChip(int which);
int YM3812Write(int which, int a, int v);
unsigned char YM3812Read(int which, int a);
int YM3812TimerOver(int which, int c);
void YM3812UpdateOne(int which, INT16 *buffer, int length);
void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
INT16 Amp( INT16 );
#endif
#endif

27
GP2X/fmopl_940/Makefile Normal file
View File

@ -0,0 +1,27 @@
CROSS_COMPILE = /mythtv/media/devel/toolchains/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-
LDFLAGS = -static
CXX = $(CROSS_COMPILE)gcc
CPP = $(CROSS_COMPILE)g++
LD = $(CROSS_COMPILE)ld
STRIP = $(CROSS_COMPILE)strip
CXXFLAGS = -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include -Wall -Werror -Os -fomit-frame-pointer
LIBS = -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
CODE940_TARGET = code940.gpe
CODE940_OBJS = main.o fmopl_core.o
all : $(CODE940_TARGET)
$(CODE940_TARGET) : $(CODE940_OBJS)
$(LD) -marmelf -e code940 -Ttext 0x0 $(CODE940_OBJS) -o $(CODE940_TARGET)
$(CROSS_COMPILE)objcopy -O binary code940.gpe code940.bin
ls -l code940.bin
main.o: main.c
$(CXX) $(CXXFLAGS) -O0 -c main.c
fmopl_core.o: fmopl_core.c fmopl_core.h fmopl_shared.h memory_layout.h
$(CPP) $(CXXFLAGS) -Os -c fmopl_core.c

1532
GP2X/fmopl_940/fmopl_core.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
#ifndef __FMOPL_H_
#define __FMOPL_H_
#define HAS_YM3812 1
/* --- select emulation chips --- */
#define BUILD_YM3812 (HAS_YM3812)
#define BUILD_YM3526 (HAS_YM3526)
#define BUILD_Y8950 (HAS_Y8950)
/* select output bits size of output : 8 or 16 */
#define OPL_SAMPLE_BITS 16
/* compiler dependence */
#ifndef OSD_CPU_H
#define OSD_CPU_H
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
#endif
#if (OPL_SAMPLE_BITS==16)
typedef INT16 OPLSAMPLE;
#endif
#if (OPL_SAMPLE_BITS==8)
typedef INT8 OPLSAMPLE;
#endif
#endif

View File

@ -0,0 +1,175 @@
#include "memory_layout.h"
#define WRAPPED(x,y) ((x)>=0?(x):(x)+(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
typedef struct{
UINT32 ar; /* attack rate: AR<<2 */
UINT32 dr; /* decay rate: DR<<2 */
UINT32 rr; /* release rate:RR<<2 */
UINT8 KSR; /* key scale rate */
UINT8 ksl; /* keyscale level */
UINT8 ksr; /* key scale rate: kcode>>KSR */
UINT8 mul; /* multiple: mul_tab[ML] */
/* Phase Generator */
UINT32 Cnt; /* frequency counter */
UINT32 Incr; /* frequency counter step */
UINT8 FB; /* feedback shift value */
INT32 *connect1; /* slot1 output pointer */
INT32 op1_out[2]; /* slot1 output for feedback */
UINT8 CON; /* connection (algorithm) type */
/* Envelope Generator */
UINT8 eg_type; /* percussive/non-percussive mode */
UINT8 state; /* phase type */
UINT32 TL; /* total level: TL << 2 */
INT32 TLL; /* adjusted now TL */
INT32 volume; /* envelope counter */
UINT32 sl; /* sustain level: sl_tab[SL] */
UINT8 eg_sh_ar; /* (attack state) */
UINT8 eg_sel_ar; /* (attack state) */
UINT8 eg_sh_dr; /* (decay state) */
UINT8 eg_sel_dr; /* (decay state) */
UINT8 eg_sh_rr; /* (release state) */
UINT8 eg_sel_rr; /* (release state) */
UINT32 key; /* 0 = KEY OFF, >0 = KEY ON */
/* LFO */
UINT32 AMmask; /* LFO Amplitude Modulation enable mask */
UINT8 vib; /* LFO Phase Modulation enable flag (active high)*/
/* waveform select */
unsigned int wavetable;
} OPL_SLOT;
typedef struct{
OPL_SLOT SLOT[2];
/* phase generator state */
UINT32 block_fnum; /* block+fnum */
UINT32 fc; /* Freq. Increment base */
UINT32 ksl_base; /* KeyScaleLevel Base step */
UINT8 kcode; /* key code (for key scaling) */
} OPL_CH;
/* OPL state */
typedef struct fm_opl_f {
/* FM channel slots */
OPL_CH P_CH[9]; /* OPL/OPL2 chips have 9 channels*/
UINT32 eg_cnt; /* global envelope generator counter */
UINT32 eg_timer; /* global envelope generator counter works at frequency = chipclock/72 */
UINT32 eg_timer_add; /* step of eg_timer */
UINT32 eg_timer_overflow; /* envelope generator timer overlfows every 1 sample (on real chip) */
UINT8 rhythm; /* Rhythm mode */
UINT32 *fn_tab; /* fnumber->increment counter */
/* LFO */
UINT8 lfo_am_depth;
UINT8 lfo_pm_depth_range;
UINT32 lfo_am_cnt;
UINT32 lfo_am_inc;
UINT32 lfo_pm_cnt;
UINT32 lfo_pm_inc;
UINT32 noise_rng; /* 23 bit noise shift register */
UINT32 noise_p; /* current noise 'phase' */
UINT32 noise_f; /* current noise period */
UINT8 wavesel; /* waveform select enable flag */
int T[2]; /* timer counters */
int TC[2];
UINT8 st[2]; /* timer enable */
/* external event callback handlers */
UINT8 type; /* chip type */
UINT8 address; /* address register */
UINT8 status; /* status flag */
UINT8 statusmask; /* status mask */
UINT8 mode; /* Reg.08 : CSM,notesel,etc. */
int clock; /* master clock (Hz) */
int rate; /* sampling rate (Hz) */
} FM_OPL;
#define OPL_SIZE 2048
/* TL_TAB_LEN is calculated as:
* 12 - sinus amplitude bits (Y axis)
* 2 - sinus sign bit (Y axis)
* TL_RES_LEN - sinus resolution (X axis)
*/
#define TL_RES_LEN (256) /* 8 bits addressing (real chip) */
#define TL_TAB_LEN (12*2*TL_RES_LEN)
static signed int *tl_tab;
#define SIN_BITS 10
#define SIN_LEN (1<<SIN_BITS)
#define SIN_MASK (SIN_LEN-1)
/* sin waveform table in 'decibel' scale */
/* four waveforms on OPL2 type chips */
/* sinwave entries */
static unsigned int *sin_tab;
enum CMESSAGE {
INIT,
READ,
WRITE,
UPDATE,
TIMEROVER,
RESET,
SHUTDOWN
};
typedef struct {
int type;
// int no;
int data1;
int data2;
int data3;
} CoreMessage;
#define MAX_OPL_CHIPS 2
#define MSG_BUF_SIZE 4*1024
volatile static CoreMessage* MessageBuffer;
volatile static int* NSubmittedMessages;
volatile static int* NExecutedMessages;
#define SHARED_BUF_SIZE 256
volatile static INT16* SharedBuffer[MAX_OPL_CHIPS];
volatile static int* BufWritePos[MAX_OPL_CHIPS];
volatile static int* BufReadPos[MAX_OPL_CHIPS];
#if (BUILD_YM3812)
static FM_OPL *OPL_YM3812[MAX_OPL_CHIPS]; /* array of pointers to the YM3812's */
static int *YM3812NumChips=0; /* number of chips */
#endif
#define BUFF_BASE_ADDRESS OPL2_MSG_BASE
#define NSUB_OFFSET 0
#define NEX_OFFSET (NSUB_OFFSET+sizeof(int))
#define MSG_BUF_OFFSET (NEX_OFFSET+sizeof(int))
#define BUFPOS_OFFSET (MSG_BUF_OFFSET+MSG_BUF_SIZE*sizeof(CoreMessage))
#define READPOS_OFFSET (BUFPOS_OFFSET+MAX_OPL_CHIPS*sizeof(int))
#define DATA_OFFSET (READPOS_OFFSET+MAX_OPL_CHIPS*sizeof(int))
#define TL_TAB_OFFSET (DATA_OFFSET+MAX_OPL_CHIPS*SHARED_BUF_SIZE*sizeof(INT16))
#define SIN_TAB_OFFSET (TL_TAB_OFFSET+TL_TAB_LEN*sizeof(signed int))
#define FNTAB_OFFSET (SIN_TAB_OFFSET+4*SIN_LEN*sizeof(unsigned int))
#define END_OFFSET (FNTAB_OFFSET+1024*MAX_OPL_CHIPS*sizeof(UINT32))
#define DATA_BASE_ADDRESS OPL2_DAT_BASE
#define NUMCHIP_OFFSET 0
#define OPL_OFFSET (NUMCHIP_OFFSET+sizeof(int))
#define END_OFFSET2 (OPL_OFFSET+OPL_SIZE*MAX_OPL_CHIPS)
static char* SharedData_ptr;
static char* SharedBuff_ptr;

54
GP2X/fmopl_940/main.c Normal file
View File

@ -0,0 +1,54 @@
extern void fmopl_Init();
extern int fmopl_core_control();
void Main940();
void code940(void) __attribute__((naked))
{
asm ("b .DzzBegin"); // reset, interrupt table
asm ("b .DzzBegin");
asm ("b .DzzBegin");
asm ("b .DzzBegin");
asm ("b .DzzBegin");
asm ("b .DzzBegin");
asm ("b .DzzBegin");
asm ("b .DzzBegin");
asm (".DzzBegin:");
asm ("mov sp, #0x100000"); // set the stack top (1M)
asm ("sub sp, sp, #4"); // minus 4
// set up memory region 0 -- the whole 4GB address space
asm ("mov r0, #63"); // region data
asm ("mcr p15, 0, r0, c6, c0, 0");
asm ("mcr p15, 0, r0, c6, c0, 1");
// set up region 1 which is the first 2 megabytes.
asm ("mov r0, #0x00000029"); // region data
asm ("mcr p15, 0, r0, c6, c1, 0");
asm ("mcr p15, 0, r0, c6, c1, 1");
// set region 1 to be cacheable (so the first 2M will be cacheable)
asm ("mov r0, #2");
asm ("mcr p15, 0, r0, c2, c0, 0");
asm ("mcr p15, 0, r0, c2, c0, 1");
// set region 1 to be bufferable too (only data)
asm ("mcr p15, 0, r0, c3, c0, 0");
// set protection on for all regions
asm ("mov r0, #15");
asm ("mcr p15, 0, r0, c5, c0, 0");
asm ("mcr p15, 0, r0, c5, c0, 1");
asm ("mrc p15, 0, r0, c1, c0, 0"); // fetch current control reg
asm ("orr r0, r0, #1"); // 0x00000001: enable protection unit
asm ("orr r0, r0, #4"); // 0x00000004: enable D cache
asm ("orr r0, r0, #0x1000"); // 0x00001000: enable I cache
asm ("orr r0, r0, #0xC0000000"); // 0xC0000000: async+fastbus
asm ("mcr p15, 0, r0, c1, c0, 0"); // set control reg
Main940();
}
void Main940(void)
{
fmopl_Init();
while(fmopl_core_control()) {};
}

View File

@ -0,0 +1,34 @@
/*
memory layout for OPL2+OPL3
*/
#define OPL2_MSG_BASE 0x200000
#define OPL2_MSG_SIZE 0x100000
#define OPL2_DAT_BASE 0x14C000
#define OPL2_DAT_SIZE 0x14000
#define OPL3_MSG_BASE 0x300000
#define OPL3_MSG_SIZE 0x100000
#define OPL3_DAT_BASE 0x160000
#define OPL3_DAT_SIZE 0x40000
#undef BUFF_BASE_ADDRESS
#undef NSUB_OFFSET
#undef NEX_OFFSET
#undef MSG_BUF_OFFSET
#undef BUFPOS_OFFSET
#undef READPOS_OFFSET
#undef DATA_OFFSET
#undef FNTAB_OFFSET
#undef END_OFFSET
#undef DATA_BASE_ADDRESS
#undef NUMCHIP_OFFSET
#undef TL_TAB_OFFSET
#undef SIN_TAB_OFFSET
#undef OPL_OFFSET
#undef END_OFFSET2
#undef MSG_BUF_SIZE
#undef SHARED_BUF_SIZE
#undef OPL_SIZE

327
GP2X/gp2x.cpp Normal file
View File

@ -0,0 +1,327 @@
//
// GP2X specific code
//
// by Pickle
//
#if defined(GP2X)
#include "gp2x.h"
static bool volume_init = false;
static unsigned int screenshot_count = 0;
#if defined(GP2X_940)
static int volume = 70;
#else
static int volume = 10;
#endif
static int intUp = 0;
static int intDown = 0;
static int intLeft = 0;
static int intRight = 0;
static int intUpRight = 0;
static int intUpLeft = 0;
static int intDownRight = 0;
static int intDownLeft = 0;
static int intButtonR = 0;
static int intButtonL = 0;
static int intButtonA = 0;
static int intButtonB = 0;
static int intButtonX = 0;
static int intButtonY = 0;
static int intButtonSel = 0;
static int intButtonSrt = 0;
static int intButtonStick = 0;
#if defined(GP2X_940)
void GP2X_Shutdown(void)
{
YM3812Shutdown();
}
void GP2X_MemoryInit( void )
{
SDL_GP2X_AllowGfxMemory(NULL,0);
}
#endif
void GP2X_AdjustVolume( int direction )
{
if( volume <= 10 )
{
if( direction == VOLUME_UP ) volume += VOLUME_CHANGE_RATE/2;
if( direction == VOLUME_DOWN ) volume -= VOLUME_CHANGE_RATE/2;
}
else
{
if( direction == VOLUME_UP ) volume += VOLUME_CHANGE_RATE;
if( direction == VOLUME_DOWN ) volume -= VOLUME_CHANGE_RATE;
}
if( volume < VOLUME_MIN ) volume = VOLUME_MIN;
if( volume > VOLUME_MAX ) volume = VOLUME_MAX;
printf( "Volume Change: %i\n", volume );
unsigned long soundDev = open("/dev/mixer", O_RDWR);
if(soundDev)
{
int vol = ((volume << 8) | volume);
ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
close(soundDev);
}
}
void GP2X_ButtonDown( int button )
{
if( !volume_init )
{
GP2X_AdjustVolume(VOLUME_NOCHG);
volume_init = 1;
}
switch( button )
{
case GP2X_BUTTON_UP: intUp = 1; break;
case GP2X_BUTTON_DOWN: intDown = 1; break;
case GP2X_BUTTON_RIGHT: intRight = 1; break;
case GP2X_BUTTON_LEFT: intLeft = 1; break;
case GP2X_BUTTON_UPRIGHT: intUpRight = 1; break;
case GP2X_BUTTON_UPLEFT: intUpLeft = 1; break;
case GP2X_BUTTON_DOWNRIGHT: intDownRight = 1; break;
case GP2X_BUTTON_DOWNLEFT: intDownLeft = 1; break;
case GP2X_BUTTON_SELECT: intButtonSel = 1; break;
case GP2X_BUTTON_START: intButtonSrt = 1; break;
case GP2X_BUTTON_X: intButtonX = 1; LastASCII = 'x'; break;
case GP2X_BUTTON_Y: intButtonY = 1; LastASCII = 'y'; break;
case GP2X_BUTTON_A: intButtonA = 1; LastASCII = 'a'; break;
case GP2X_BUTTON_B: intButtonB = 1; LastASCII = 'b'; break;
case GP2X_BUTTON_R: intButtonR = 1; break;
case GP2X_BUTTON_L: intButtonL = 1; break;
case GP2X_BUTTON_VOLUP: GP2X_AdjustVolume( VOLUME_UP ); break;
case GP2X_BUTTON_VOLDOWN: GP2X_AdjustVolume( VOLUME_DOWN ); break;
case GP2X_BUTTON_CLICK: intButtonStick = 1; break;
}
if( intButtonL & intButtonR )
{
// Status Bar
SetKeyboard( SDLK_TAB, KEY_DOWN );
// Music Player (doesnt work, it appears the event's arnt happening soon enough)
SetKeyboard( sc_M, KEY_DOWN );
SetKeyboard( SDLK_LALT, KEY_UP );
SetKeyboard( SDLK_LEFT, KEY_UP );
SetKeyboard( SDLK_RIGHT, KEY_UP );
}
else if( intButtonL & !intButtonR )
{
// Strafe Left
SetKeyboard( SDLK_LALT, KEY_DOWN );
SetKeyboard( SDLK_LEFT, KEY_DOWN );
}
else if( intButtonR & !intButtonL )
{
// Strafe Right
SetKeyboard( SDLK_LALT, KEY_DOWN );
SetKeyboard( SDLK_RIGHT, KEY_DOWN );
}
// Left Direction
if( intLeft | intDownLeft | intUpLeft )
{
// UNstrafe
SetKeyboard( SDLK_LALT, KEY_UP );
SetKeyboard( SDLK_RIGHT, KEY_UP );
// Turn
SetKeyboard( SDLK_LEFT, KEY_DOWN );
}
// Right Direction
if( intRight | intDownRight | intUpRight )
{
// UNstrafe
SetKeyboard( SDLK_LALT, KEY_UP );
SetKeyboard( SDLK_LEFT, KEY_UP );
// Turn
SetKeyboard( SDLK_RIGHT, KEY_DOWN );
}
// Up Direction
if( intUp | intUpRight | intUpLeft ) {
SetKeyboard( SDLK_UP, KEY_DOWN );
}
// Down Direction
if( intDown | intDownRight | intDownLeft ) {
SetKeyboard( SDLK_DOWN, KEY_DOWN );
}
if( intButtonSel & intButtonSrt ) {
// Pause
SetKeyboard( SDLK_PAUSE, KEY_DOWN );
}
else if( intButtonL & intButtonSel ) {
fpscounter ^= 1; // Turn On FPS Counter
}
else if( intButtonL & intButtonSrt ) {
Screenshot();
}
else if( intButtonSel & !intButtonSrt ) {
// Escape
SetKeyboard( SDLK_ESCAPE, KEY_DOWN );
}
else if( !intButtonSel & intButtonSrt ) {
// Enter
SetKeyboard( SDLK_RETURN, KEY_DOWN );
}
if( intButtonX ) {
// Shoot
SetKeyboard( SDLK_LCTRL, KEY_DOWN );
}
if( intButtonY ) {
// Yes
SetKeyboard( SDLK_y, KEY_DOWN );
if( gamestate.chosenweapon == gamestate.bestweapon )
{
SetKeyboard( SDLK_1, KEY_DOWN );
}
else
{
SetKeyboard( SDLK_1 + gamestate.chosenweapon + 1, KEY_DOWN );
}
}
if( intButtonA ) {
// Open
SetKeyboard( SDLK_SPACE, KEY_DOWN );
}
if( intButtonB ) {
// No
SetKeyboard( SDLK_n, KEY_DOWN );
// Run
SetKeyboard( SDLK_LSHIFT, KEY_DOWN );
}
}
void GP2X_ButtonUp( int button )
{
switch( button )
{
case GP2X_BUTTON_UP: intUp = 0; break;
case GP2X_BUTTON_DOWN: intDown = 0; break;
case GP2X_BUTTON_RIGHT: intRight = 0; break;
case GP2X_BUTTON_LEFT: intLeft = 0; break;
case GP2X_BUTTON_UPRIGHT: intUpRight = 0; break;
case GP2X_BUTTON_UPLEFT: intUpLeft = 0; break;
case GP2X_BUTTON_DOWNRIGHT: intDownRight = 0; break;
case GP2X_BUTTON_DOWNLEFT: intDownLeft = 0; break;
case GP2X_BUTTON_SELECT: intButtonSel = 0; break;
case GP2X_BUTTON_START: intButtonSrt = 0; break;
case GP2X_BUTTON_X: intButtonX = 0; break;
case GP2X_BUTTON_Y: intButtonY = 0; break;
case GP2X_BUTTON_A: intButtonA = 0; break;
case GP2X_BUTTON_B: intButtonB = 0; break;
case GP2X_BUTTON_R: intButtonR = 0; break;
case GP2X_BUTTON_L: intButtonL = 0; break;
case GP2X_BUTTON_CLICK: intButtonStick = 0; break;
}
if( !intButtonL | !intButtonR )
{
SetKeyboard( SDLK_TAB, KEY_UP );
SetKeyboard( sc_M, KEY_UP );
SetKeyboard( SDLK_LALT, KEY_UP );
}
if( !intLeft & !intDownLeft & !intUpLeft )
{
if( !intButtonL )
{
SetKeyboard( SDLK_LALT, KEY_UP );
SetKeyboard( SDLK_LEFT, KEY_UP );
}
if( intButtonR )
{
SetKeyboard( SDLK_LALT, KEY_DOWN );
SetKeyboard( SDLK_RIGHT, KEY_DOWN );
}
}
if( !intRight & !intDownRight & !intUpRight )
{
if( !intButtonR )
{
SetKeyboard( SDLK_LALT, KEY_UP );
SetKeyboard( SDLK_RIGHT, KEY_UP );
}
if( intButtonL )
{
SetKeyboard( SDLK_LALT, KEY_DOWN );
SetKeyboard( SDLK_LEFT, KEY_DOWN );
}
}
if( !intUp & !intUpRight & !intUpLeft ) {
SetKeyboard( SDLK_UP, KEY_UP );
}
if( !intDown & !intDownRight & !intDownLeft ) {
SetKeyboard( SDLK_DOWN, KEY_UP );
}
if( !intButtonSel & !intButtonSrt ) {
SetKeyboard( SDLK_PAUSE, KEY_UP );
}
if( !intButtonSel ) {
SetKeyboard( SDLK_ESCAPE, KEY_UP );
}
if( !intButtonSrt ) {
SetKeyboard( SDLK_RETURN, KEY_UP );
}
if( !intButtonX ) {
SetKeyboard( SDLK_LCTRL, KEY_UP );
}
if( !intButtonY ) {
SetKeyboard( SDLK_y, KEY_UP );
SetKeyboard( SDLK_1, KEY_UP );
SetKeyboard( SDLK_2, KEY_UP );
SetKeyboard( SDLK_3, KEY_UP );
SetKeyboard( SDLK_4, KEY_UP );
}
if( !intButtonA ) {
SetKeyboard( SDLK_SPACE, KEY_UP );
}
if( !intButtonB ) {
SetKeyboard( SDLK_n, KEY_UP );
SetKeyboard( SDLK_LSHIFT, KEY_UP );
}
}
void Screenshot( void )
{
char filename[32];
snprintf( filename, sizeof(filename), "Screenshot_%i.bmp", screenshot_count );
SDL_SaveBMP(screen, filename );
screenshot_count++;
}
void SetKeyboard( unsigned int key, int press )
{
// press = 1 = down, press = 0 = up
if( press )
{
LastScan = key;
Keyboard[key] = 1;
}
else
{
Keyboard[key] = 0;
}
}
#endif // GP2X

54
GP2X/gp2x.h Normal file
View File

@ -0,0 +1,54 @@
#ifndef GP2X_H
#define GP2X_H
#include <SDL/SDL.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <fcntl.h>
#include <unistd.h>
#include "../wl_def.h"
#if defined(GP2X_940)
#include "fmopl.h"
#include <SDL_gp2x.h>
#endif
#define GP2X_BUTTON_UP (0)
#define GP2X_BUTTON_DOWN (4)
#define GP2X_BUTTON_LEFT (2)
#define GP2X_BUTTON_RIGHT (6)
#define GP2X_BUTTON_UPLEFT (1)
#define GP2X_BUTTON_UPRIGHT (7)
#define GP2X_BUTTON_DOWNLEFT (3)
#define GP2X_BUTTON_DOWNRIGHT (5)
#define GP2X_BUTTON_CLICK (18)
#define GP2X_BUTTON_A (12)
#define GP2X_BUTTON_B (13)
#define GP2X_BUTTON_X (14)
#define GP2X_BUTTON_Y (15)
#define GP2X_BUTTON_L (10)
#define GP2X_BUTTON_R (11)
#define GP2X_BUTTON_START (8)
#define GP2X_BUTTON_SELECT (9)
#define GP2X_BUTTON_VOLUP (16)
#define GP2X_BUTTON_VOLDOWN (17)
#define VOLUME_MIN 0
#define VOLUME_MAX 100
#define VOLUME_CHANGE_RATE 2
#define VOLUME_NOCHG 0
#define VOLUME_DOWN 1
#define VOLUME_UP 2
#define KEY_DOWN 1
#define KEY_UP 0
void GP2X_MemoryInit(void);
void GP2X_Shutdown(void);
void GP2X_AdjustVolume( int direction );
void GP2X_ButtonDown( int button );
void GP2X_ButtonUp( int button );
void Screenshot( void );
void SetKeyboard( unsigned int key, int press );
#endif // GP2X_H

113
Makefile Normal file
View File

@ -0,0 +1,113 @@
CONFIG ?= config.default
-include $(CONFIG)
BINARY ?= wolf3d
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL) -m 555 -s
INSTALL_MAN ?= $(INSTALL) -m 444
INSTALL_DATA ?= $(INSTALL) -m 444
SDL_CONFIG ?= sdl-config
CFLAGS_SDL ?= $(shell $(SDL_CONFIG) --cflags)
LDFLAGS_SDL ?= $(shell $(SDL_CONFIG) --libs)
CFLAGS += $(CFLAGS_SDL)
#CFLAGS += -Wall
#CFLAGS += -W
CFLAGS += -Wpointer-arith
CFLAGS += -Wreturn-type
CFLAGS += -Wwrite-strings
CFLAGS += -Wcast-align
CCFLAGS += $(CFLAGS)
CCFLAGS += -std=gnu99
CCFLAGS += -Werror-implicit-function-declaration
CCFLAGS += -Wimplicit-int
CCFLAGS += -Wsequence-point
CXXFLAGS += $(CFLAGS)
LDFLAGS += $(LDFLAGS_SDL)
LDFLAGS += -lSDL_mixer
SRCS :=
SRCS += fmopl.cpp
SRCS += id_ca.cpp
SRCS += id_in.cpp
SRCS += id_pm.cpp
SRCS += id_sd.cpp
SRCS += id_us_1.cpp
SRCS += id_vh.cpp
SRCS += id_vl.cpp
SRCS += signon.cpp
SRCS += wl_act1.cpp
SRCS += wl_act2.cpp
SRCS += wl_agent.cpp
SRCS += wl_atmos.cpp
SRCS += wl_cloudsky.cpp
SRCS += wl_debug.cpp
SRCS += wl_draw.cpp
SRCS += wl_floorceiling.cpp
SRCS += wl_game.cpp
SRCS += wl_inter.cpp
SRCS += wl_main.cpp
SRCS += wl_menu.cpp
SRCS += wl_parallax.cpp
SRCS += wl_play.cpp
SRCS += wl_state.cpp
SRCS += wl_text.cpp
DEPS = $(filter %.d, $(SRCS:.c=.d) $(SRCS:.cpp=.d))
OBJS = $(filter %.o, $(SRCS:.c=.o) $(SRCS:.cpp=.o))
.SUFFIXES:
.SUFFIXES: .c .cpp .d .o
Q ?= @
all: $(BINARY)
ifndef NO_DEPS
depend: $(DEPS)
ifeq ($(findstring $(MAKECMDGOALS), clean depend Data),)
-include $(DEPS)
endif
endif
$(BINARY): $(OBJS)
@echo '===> LD $@'
$(Q)$(CXX) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $@
.c.o:
@echo '===> CC $<'
$(Q)$(CC) $(CCFLAGS) -c $< -o $@
.cpp.o:
@echo '===> CXX $<'
$(Q)$(CXX) $(CXXFLAGS) -c $< -o $@
.c.d:
@echo '===> DEP $<'
$(Q)$(CC) $(CCFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@
.cpp.d:
@echo '===> DEP $<'
$(Q)$(CXX) $(CXXFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@
clean distclean:
@echo '===> CLEAN'
$(Q)rm -fr $(DEPS) $(OBJS) $(BINARY)
install: $(BINARY)
@echo '===> INSTALL'
$(Q)$(INSTALL) -d $(PREFIX)/bin
$(Q)$(INSTALL_PROGRAM) $(BINARY) $(PREFIX)/bin

79
Makefile.dc Normal file
View File

@ -0,0 +1,79 @@
TARGET = 1ST_READ.BIN
include $(KOS_BASE)/Makefile.rules
#KOS_ROMDISK_DIR = romdisk
#OBJS += romdisk.o
OBJS += dc/dc_cd.o
OBJS += dc/dc_main.o
OBJS += dc/dc_maple.o
OBJS += dc/dc_video.o
OBJS += dc/dc_vmu.o
OBJS += fmopl.o
OBJS += id_ca.o
OBJS += id_in.o
OBJS += id_pm.o
OBJS += id_sd.o
OBJS += id_us_1.o
OBJS += id_vh.o
OBJS += id_vl.o
OBJS += signon.o
OBJS += wl_act1.o
OBJS += wl_act2.o
OBJS += wl_agent.o
OBJS += wl_atmos.o
OBJS += wl_cloudsky.o
OBJS += wl_debug.o
OBJS += wl_draw.o
OBJS += wl_floorceiling.o
OBJS += wl_game.o
OBJS += wl_inter.o
OBJS += wl_main.o
OBJS += wl_menu.o
OBJS += wl_parallax.o
OBJS += wl_play.o
OBJS += wl_state.o
OBJS += wl_text.o
KOS_CFLAGS += -I${KOS_BASE}/../kos-ports/include/SDL
all: rm-elf $(TARGET)
clean:
-rm -f Wolf4SDL.bin Wolf4SDL.elf $(OBJS)
rm-elf:
-rm -f $(TARGET) Wolf4SDL.bin Wolf4SDL.elf
Wolf4SDL.elf: $(OBJS)
$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o Wolf4SDL.elf $(KOS_START) \
$(OBJS) -lSDL_mixer -lSDL -lm -lz $(OBJEXTRA) $(KOS_LIBS)
Wolf4SDL.bin: Wolf4SDL.elf
kos-objcopy -O binary -R .stack Wolf4SDL.elf Wolf4SDL.bin
1ST_READ.BIN: Wolf4SDL.bin
$(SCRAMBLE) Wolf4SDL.bin make-cd/1ST_READ.BIN
##############################################################################
#dc-tool IP commands for BBA\LAN owners.
#
#It enables uploading binaries directly to your Dreamcast from your PC and
#also allows for remote debugging.
#
#You'll have to change the IP to your BBA\LAN's IP and also the MAC address,
#if your dc-tool IP needs ARP.
##############################################################################
#arp:
# arp.exe -s 192.168.1.137 00-d0-f1-02-8a-f9
run: Wolf4SDL.elf
$(DCTOOL_IP) -t 192.168.1.137 -i data.iso -x Wolf4SDL.elf
debug: Wolf4SDL.elf
$(DCTOOL_IP) -g -t 192.168.1.137 -i data.iso -x Wolf4SDL.elf & sh-elf-insight.exe Wolf4SDL.elf
reset:
$(DCTOOL_IP) -r -t 192.168.1.137

70
README-GP2X.txt Normal file
View File

@ -0,0 +1,70 @@
Wolf4SDL by Moritz "Ripper" Kroll (http://www.chaos-software.de.vu)
Original Wolfenstein 3D by id Software (http://www.idsoftware.com)
GP2X support by Pickle
Source and Windows Binary: http://www.stud.uni-karlsruhe.de/~uvaue/chaos/downloads.html
GP2X Binary: http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,20,2479
SUMMARY:
See main README.txt
GP2X CONTROLS:
Directional: these are mapped to the arrow keys.
A : mapped to space, which opens doors
B : mapped to left shift, which enables running. Also mapped
to key n, for the NO response in the menu.
X : mapped to left control, which enables shooting.
Y : mapped to the number keys, to select weapons. It cycles
through each weapon in order. Also mapped to key y, for
the YES responses in the menu.
** NOTE: In "enter text" mode each button sends its letter,
for example a=a, y=y
Select: mapped to the escape key
Start: mapped to the enter key
Select+Start: mapped to pause
Shoulder Left: this is mapped in a way to strafe left
Shoulder Right: this is mapped in a way to strafe right
** NOTE: If you press both the left and right shoulder buttons the statusbar
will be shown in the fullscreen mode described above.
Volume Buttons: raise and lower the volume.
Either Volume Button + Select: show fps
Either Volume Button + Start: take a screenshot
** NOTE: The directional stick is given precedence over the strafe keys.
For example if you hold the shoulder right to strafe right and you
then move the stick right you will stop strafing and turn. If you
then release the stick you will resume strafing the right.
(I've tested this and it seems to work fairly well)
INSTALL:
Pick your Wolf4SDL binary and copy the files at the root of the zip to any
folder together with the data files of the according game (e.g. *.WL6 for
Wolfenstein 3D or *.SOD for Spear of Destiny).
The binaries do not restart the GP2X menu application.
If you use GMenu2x, select the wrapper option for your icon.
If you use the GPH menu, you will have to create your own script to restart it.
Compiling from source code:
I used the Code::Blocks dev kit. (http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,14,2295)
You can use the template example. Add all of the source files to the project.
Under build options (pick your GP2X compilier) and under "Compilier Settings"
-> "Defines" add GP2X. Just press the build button.
The Makefile should also work for linux type environments, although I have
not tried it this way. If you use it, the GP2X define should be added to the
Makefile using CFLAGS += -DGP2X.
I also added the compiler flags
"-fmerge-all-constants -ffast-math -funswitch-loops"
which give a good performance increase.
For Code::Blocks put this line in "Compiler Settings" - "Other Options".
PERFORMANCE:
The game runs good at 200 Mhz.

85
README-dc.txt Normal file
View File

@ -0,0 +1,85 @@
Wolf4SDL\DC 1.7
ported to Dreamcast by dcbasic
A port of Wolf4SDL by Moritz "Ripper" Kroll.
What's new in 1.7:
- See Changes-dc.txt
Instructions:
- Extract the Wolf4SDL\DC archive to it's own folder.
- Put your *.wl6 files inside /cd/data/wolf3d (if you have a commercial CD-ROM
release of Wolfenstein you can skip this step).
- If you want to use the command line, create a text file called 'args.txt'
(without quotes) in the /cd/data/wolf3d folder and add any valid
arguments. Please keep them on one line.
- Download and install BootDreams (http://dchelp.dcemulation.org/?BootDreams).
- Open the folder you extracted Wolf4SDL\DC to in BootDreams.
- Select a task. If you'd like to burn Wolf4SDL\DC directly to a CD-R, select
the CDRecord task and set the disc format to either Audio\Data or Data\Data
(both do essentially the same thing).
- Click Process.
- If you created a CD image, burn it with the appropriate burning program
e.g. Alcohol 120%.
- Pop the CD-R in your Dreamcast and play.
- If you have a commercial CD-ROM, wait until you're asked to swap in your
copy of Wolfenstein 3D, swap your copy in, press start and play.
Valid Arguments:
--goobers (Wolfenstein 3D only)
--debugkeys (Spear of Destiny only)
--goodtimes (Spear of Destiny only)
--nowait
--baby
--easy
--normal
--hard
--tedlevel <level>
--res <width> <height> (default 320x200)
--resf <width> <height>
--bits <screen_bits> (default 8)
--dblbuf
--extravbls <vbls>
--samplerate <rate> (default 11025)
--audiobuffer <size> (default 4096)
Notes:
- The --res argument will also except '640 400' but will slow rendering down
greatly. The width must be a multiple of 320 and the height must be a
multiple of 200 or 240.
- The --resf argument will force the passed screen resolution but may result
in graphic corruption.
- The default samplerate is 11025 to keep the extra SOD missions from running
out of memory. Wolfenstein 3D and the original SOD mission will happily run
with the samplerate set to 22050.
- The --dblbuf argument works but slows speed down by about 10 frames.
Compiling:
This port was developed under Code::Blocks 8.02 with the DC Dev ISO R4
integrated within it. I've also included a Makefile in case you don't use
Code::Blocks. You will need SDL and SDL mixer to compile Wolf4SDL\DC.
DC Dev ISO can be downloaded from here:
http://dcemulation.org/?title=DC_Dev_ISO
It contains everything you need to compile Wolf4SDL. It includes Code::Blocks
8.02 and a tool to integrate Code::Blocks with DC Dev ISO. It uses Cygwin as
the terminal environment and includes the DC compilers and all the SDL
libraries that are needed to compile Wolf4SDL.
To compile Wolf4SDL\DC under Code::Blocks, extract the source to it's own
folder, open 'Wolf4SDL-DC.cbp' and goto 'Build' | 'Build'.
To compile Wolf4SDL\DC using the supplied Makefile, extract the source to it's
own directory in C:\cygwin\usr\local\dc and type 'make -f Makefile.dc' in your
terminal while inside the folder Wolf4SDL\DC was extracted to. By default the
Makefile will create a scrambled 1ST_READ.BIN, unscrambled Wolf4SDL.bin and of
course, Wolf4SDL.elf.
Credits & Thanks:
- OneThiryt8 for which parts of this port was based on his port, sdlWolf
- BlueCrab who wrote parts of the swap disc menu
- BlackAura for which I stole parts of his menu code from nxDoom
- Ripper for such a clean and friendly Wolfenstein 3D engine
- Bero for the Dreamcast port of SDL, which this port uses
- Dan Potter and team for KOS, which this port uses

43
README-devcpp.txt Normal file
View File

@ -0,0 +1,43 @@
This file explains how you can compile Wolf4SDL using Bloodshed's Dev-C++.
Keep in mind, that Dev-C++ is a dead project since 2005. The recommended way
to compile Wolf4SDL on Windows is using Visual Studio 2005 C++ or the free
Visual C++ 2005 Express. But for dial-up users Dev-C++ is probably still a
good option.
Needed files:
- "Dev-C++ 5.0 Beta 9.2 (4.9.9.2)" with Mingw/GCC 3.4.2 (about 9 MB)
http://www.bloodshed.net/dev/devcpp.html
- SDL-1.2.13-1chaos.DevPak (544 kB)
http://www.chaos-software.de.vu -> Downloads
- SDL_mixer-1.2.6-2mol.DevPak (347 kB)
http://sourceforge.net/project/showfiles.php?group_id=94270&package_id=151751
Installation:
- Install Dev-C++ to C:\Dev-Cpp
- Open Wolf4SDL.dev
- Go to "Tools" -> "Package Manager"
- Click on the "Install" button in the toolbar
- Select "SDL-1.2.13-1chaos.DevPak" (where ever you saved it)
- Some "Next" buttons and a "Finish" button later...
- Click on the "Install" button in the toolbar
- Select "SDL_mixer-1.2.6-2mol.DevPak" (where ever you saved it)
- Some "Next" buttons and a "Finish" button later...
- Close the Package Manager
Data file setup:
- Copy the data files (e.g. *.WL6) you want to use to the Wolf4SDL
source code folder
- If you want to use the data files of the full Activision version of
Wolfenstein 3D v1.4, you can just skip to the next section
- Otherwise open "version.h" and comment/uncomment the definitions
according to the description given in this file
Compiling Wolf4SDL:
- Compile via "Execute" -> "Compile"
- No errors should be displayed
- Run Wolf4SDL via "Execute" -> "Run"
Troubleshooting:
- If you get an error message "undefined reference to `__cpu_features_init'",
make sure, there is no c:\mingw folder. Otherwise Dev-C++ will mix different
versions of MinGW libraries...

224
README.txt Normal file
View File

@ -0,0 +1,224 @@
Wolf4SDL by Moritz "Ripper" Kroll (http://www.chaos-software.de.vu)
Original Wolfenstein 3D by id Software (http://www.idsoftware.com)
=============================================================================
Wolf4SDL is an open-source port of id Software's classic first-person shooter
Wolfenstein 3D to the cross-plattform multimedia library "Simple DirectMedia
Layer (SDL)" (http://www.libsdl.org). It is meant to keep the original feel
while taking advantage of some improvements mentioned in the list below.
Main features:
--------------
- Cross-plattform:
Supported operating systems are at least:
- Windows 98, Windows ME, Windows 2000, Windows XP, Windows Vista
(32 and 64 bit), Windows 7 (32 and 64 bit)
- Linux
- BSD variants
- Mac OS X (x86)
- KallistiOS (used for Dreamcast)
Only little endian platforms like x86, ARM and SH-4 are supported, yet.
- AdLib sounds and music:
This port includes the OPL2 emulator from MAME, so you can not only
hear the AdLib sounds but also music without any AdLib-compatible
soundcard in near to perfect quality!
- Multichannel digitized sounds:
Digitized sounds play on 8 channels! So in a fire fight you will
always hear, when a guard opens the door behind you ;)
- Higher screen resolutions:
Aside from the original 320x200 resolution, Wolf4SDL currently
supports any resolutions being multiples of 320x200 or 320x240,
the default being 640x400.
Unlike some other ports, Wolf4SDL does NOT apply any bilinear
or similar filtering, so the graphics are NOT blurred but
pixelated just as we love it.
- Fully playable with only a game controller:
Wolf4SDL can be played completely without a keyboard. At least two
buttons are required (shoot/YES and open door/NO), but five or more
are recommended (run, strafe, ESC).
Additional features:
--------------------
- Two additional view sizes:
Wolf4SDL supports one view size using the full width of the screen
and showing the status bar, like in Mac-enstein, and one view size
filling the whole screen (press TAB to see the status bar).
- (Nearly) unlimited sound and song lengths:
Mod developers are not restricted to 64kB for digitized sounds and
IMF songs anymore, so longer songs and digitized sounds with better
quality are possible.
- Resuming ingame music:
When you come back to the game from the menu or load a save game, the
music will be resumed where it was suspended rather than started from
the beginning.
- Freely movable pushwalls:
Moving pushwalls can be viewed from all sides, allowing mod developers
to place them with fewer restrictions. The player can also follow the
pushwall directly instead of having to wait until the pushwall has left
a whole tile.
- Optional integrated features for mod developers:
Wolf4SDL already contains the shading, directional 3D sprites,
floor and ceiling textures, high resolution textures/sprites,
parallax sky, cloud sky and outside atmosphere features, which
can be easily activated in version.h.
The following versions of Wolfenstein 3D data files are currently supported
by the source code (choose the version by commenting/uncommenting lines in
version.h as described in that file):
- Wolfenstein 3D v1.1 full Apogee
- Wolfenstein 3D v1.4 full Apogee (not tested)
- Wolfenstein 3D v1.4 full GT/ID/Activision
- Wolfenstein 3D v1.0 shareware Apogee
- Wolfenstein 3D v1.1 shareware Apogee
- Wolfenstein 3D v1.2 shareware Apogee
- Wolfenstein 3D v1.4 shareware
- Spear of Destiny full
- Spear of Destiny demo
- Spear of Destiny - Mission 2: Return to Danger (not tested)
- Spear of Destiny - Mission 3: Ultimate Challenge (not tested)
How to play:
------------
To play Wolfenstein 3D with Wolf4SDL, you just have to copy the original data
files (e.g. *.WL6) into the same directory as the Wolf4SDL executable.
Please make sure, that you use the correct version of the executable with the
according data files version as the differences are hardcoded into the binary!
On Windows SDL.dll and SDL_mixer.dll must also be copied into this directory.
They are also available at http://www.chaos-software.de.vu
If you play in windowed mode (--windowed parameter), press SCROLLLOCK or F12
to grab the mouse. Press it again to release the mouse.
Usage:
------
Wolf4SDL supports the following command line options:
--help This help page
--tedlevel <level> Starts the game in the given level
--baby Sets the difficulty to baby for tedlevel
--easy Sets the difficulty to easy for tedlevel
--normal Sets the difficulty to normal for tedlevel
--hard Sets the difficulty to hard for tedlevel
--nowait Skips intro screens
--windowed[-mouse] Starts the game in a window [and grabs mouse]
--res <width> <height> Sets the screen resolution
(must be multiple of 320x200 or 320x240)
--resf <w> <h> Sets any screen resolution >= 320x200
(which may result in graphic errors)
--bits <b> Sets the screen color depth
(Use this when you have palette/fading problem
or perhaps to optimize speed on old systems.
Allowed: 8, 16, 24, 32, default: "best" depth)
--nodblbuf Don't use SDL's double buffering
--extravbls <vbls> Sets a delay after each frame, which may help to
reduce flickering (SDL does not support vsync...)
(unit is currently 8 ms, default: 0)
--joystick <index> Use the index-th joystick if available
--joystickhat <index> Enables movement with the given coolie hat
--samplerate <rate> Sets the sound sample rate (given in Hz)
--audiobuffer <size> Sets the size of the audio buffer (-> sound latency)
(given in bytes)
--ignorenumchunks Ignores the number of chunks in VGAHEAD.*
(may be useful for some broken mods)
--configdir <dir> Directory where config file and save games are stored
(Windows default: current directory,
others: $HOME/.wolf4sdl)
For Spear of Destiny the following additional options are available:
--mission <mission> Mission number to play (1-3)
--goodtimes Disable copy protection quiz
Compiling from source code:
---------------------------
The current version of the source code is available in the svn repository at:
svn://tron.homeunix.org:3690/wolf3d/trunk
The following ways of compiling the source code are supported:
- Makefile (for Linux, BSD variants and MinGW/MSYS)
- Visual C++ 2008 (Wolf4SDL.VC9.sln and Wolf4SDL.VC9.vcproj)
- Visual C++ 2005 (Wolf4SDL.sln and Wolf4SDL.vcproj)
- Visual C++ 6 (Wolf4SDL.dsw and Wolf4SDL.dsp)
- Code::Blocks 8.02 (Wolf4SDL.cbp)
- Dev-C++ 5.0 Beta 9.2 (4.9.9.2) (Wolf4SDL.dev) (see README-devcpp.txt)
- Xcode (for Mac OS X, macosx/Wolf4SDL.xcodeproj/project.pbxproj)
- Special compiling for Dreamcast (see README-dc.txt)
- Special compiling for GP2X (see README-GP2X.txt)
To compile the source code you need the development libraries of
- SDL (http://www.libsdl.org/download-1.2.php) and
- SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/)
and have to adjust the include and library paths in the projects accordingly.
Please note, that there is no official SDL_mixer development pack for MinGW,
yet, but you can get the needed files from a Dev-C++ package here:
http://sourceforge.net/project/showfiles.php?group_id=94270&package_id=151751
Just rename the file extension from ".devpack" to ".tar.bz2" and unpack it
with for example WinRAR. Then add the directories include/SDL and lib to the
according search paths in your project.
IMPORTANT: Do not forget to take care of version.h!
By default it compiles for "Wolfenstein 3D v1.4 full GT/ID/Activision"!
TODOs:
------
- Add PC speaker emulation
- Center non-ingame screens for resolutions being a multiple of 320x240
- Add support for any graphic resolution >= 320x200
Known bugs:
-----------
- None! ;D
Troubleshooting:
----------------
- If your frame rate is low, consider using the original screen resolution
(--res 320 200) or lowering the sound quality (--samplerate 22050)
Credits:
--------
- Special thanks to id Software! Without the source code we would still have
to pelt Wolfenstein 3D with hex editors and disassemblers ;D
- Special thanks to the MAME developer team for providing the source code
of the OPL2 emulator!
- Many thanks to "Der Tron" for hosting the svn repository, making Wolf4SDL
FreeBSD compatible, testing, bugfixing and cleaning up the code!
- Thanks to Chris for his improvements on Wolf4GW, on which Wolf4SDL bases.
- Thanks to Pickle for the GP2X support and help on 320x240 support
- Thanks to fackue for the Dreamcast support
- Thanks to Chris Ballinger for the Mac OS X support
- Thanks to Xilinx, Inc. for providing a list of maximum-length LFSR counters
used for higher resolutions of fizzle fade
Licenses:
---------
- The original source code of Wolfenstein 3D: license-id.txt
- The OPL2 emulator (fmopl.cpp): license-mame.txt

86
Wolf4SDL-DC.cbp Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Wolf4SDL\DC" />
<Option pch_mode="2" />
<Option compiler="dreamcast_shelf_dependent" />
<Build>
<Target title="default">
<Option output="Wolf4SDL.elf" prefix_auto="0" extension_auto="0" />
<Option type="1" />
<Option compiler="dreamcast_shelf_dependent" />
<Option use_console_runner="0" />
<Compiler>
<Add directory="C:\cygwin\usr\local\dc\kos\kos-ports\include\SDL" />
</Compiler>
<Linker>
<Add option="-lSDL_mixer" />
<Add option="-lSDL" />
<Add option="-lm" />
<Add option="-lz" />
</Linker>
</Target>
</Build>
<Unit filename="audiosod.h" />
<Unit filename="audiowl6.h" />
<Unit filename="dc\dc_cd.cpp" />
<Unit filename="dc\dc_main.cpp" />
<Unit filename="dc\dc_main.h" />
<Unit filename="dc\dc_maple.cpp" />
<Unit filename="dc\dc_video.cpp" />
<Unit filename="dc\dc_vmu.cpp" />
<Unit filename="dc\dc_vmu.h" />
<Unit filename="f_spear.h" />
<Unit filename="fmopl.cpp" />
<Unit filename="fmopl.h" />
<Unit filename="foreign.h" />
<Unit filename="gfxv_apo.h" />
<Unit filename="gfxv_sod.h" />
<Unit filename="gfxv_wl6.h" />
<Unit filename="id_ca.cpp" />
<Unit filename="id_ca.h" />
<Unit filename="id_in.cpp" />
<Unit filename="id_in.h" />
<Unit filename="id_pm.cpp" />
<Unit filename="id_pm.h" />
<Unit filename="id_sd.cpp" />
<Unit filename="id_sd.h" />
<Unit filename="id_us.h" />
<Unit filename="id_us_1.cpp" />
<Unit filename="id_vh.cpp" />
<Unit filename="id_vh.h" />
<Unit filename="id_vl.cpp" />
<Unit filename="id_vl.h" />
<Unit filename="signon.cpp" />
<Unit filename="version.h" />
<Unit filename="wl_act1.cpp" />
<Unit filename="wl_act2.cpp" />
<Unit filename="wl_agent.cpp" />
<Unit filename="wl_atmos.cpp" />
<Unit filename="wl_atmos.h" />
<Unit filename="wl_cloudsky.cpp" />
<Unit filename="wl_cloudsky.h" />
<Unit filename="wl_debug.cpp" />
<Unit filename="wl_def.h" />
<Unit filename="wl_dir3dspr.cpp" />
<Unit filename="wl_draw.cpp" />
<Unit filename="wl_floorceiling.cpp" />
<Unit filename="wl_game.cpp" />
<Unit filename="wl_inter.cpp" />
<Unit filename="wl_main.cpp" />
<Unit filename="wl_menu.cpp" />
<Unit filename="wl_menu.h" />
<Unit filename="wl_parallax.cpp" />
<Unit filename="wl_play.cpp" />
<Unit filename="wl_shade.cpp" />
<Unit filename="wl_shade.h" />
<Unit filename="wl_state.cpp" />
<Unit filename="wl_text.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

71
Wolf4SDL-GP2X.cbp Normal file
View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Wolf4SDL" />
<Option pch_mode="2" />
<Option compiler="devkitgp2x" />
<Build>
<Target title="default">
<Option output="Wolf4SDL" prefix_auto="1" extension_auto="1" />
<Option type="0" />
<Option compiler="devkitgp2x" />
</Target>
</Build>
<Compiler>
<Add option="-DGP2X" />
</Compiler>
<Linker>
<Add library="SDL" />
<Add library="SDL_mixer" />
<Add library="iconv" />
</Linker>
<Unit filename="GP2X/gp2x.cpp" />
<Unit filename="GP2X/gp2x.h" />
<Unit filename="audiosod.h" />
<Unit filename="audiowl6.h" />
<Unit filename="f_spear.h" />
<Unit filename="fmopl.cpp" />
<Unit filename="fmopl.h" />
<Unit filename="foreign.h" />
<Unit filename="gfxv_apo.h" />
<Unit filename="gfxv_sod.h" />
<Unit filename="gfxv_wl6.h" />
<Unit filename="id_ca.cpp" />
<Unit filename="id_ca.h" />
<Unit filename="id_in.cpp" />
<Unit filename="id_in.h" />
<Unit filename="id_pm.cpp" />
<Unit filename="id_sd.cpp" />
<Unit filename="id_sd.h" />
<Unit filename="id_us.h" />
<Unit filename="id_us_1.cpp" />
<Unit filename="id_vh.cpp" />
<Unit filename="id_vh.h" />
<Unit filename="id_vl.cpp" />
<Unit filename="id_vl.h" />
<Unit filename="sdl_winmain.cpp" />
<Unit filename="signon.cpp" />
<Unit filename="version.h" />
<Unit filename="wl_act1.cpp" />
<Unit filename="wl_act2.cpp" />
<Unit filename="wl_agent.cpp" />
<Unit filename="wl_debug.cpp" />
<Unit filename="wl_def.h" />
<Unit filename="wl_draw.cpp" />
<Unit filename="wl_game.cpp" />
<Unit filename="wl_inter.cpp" />
<Unit filename="wl_main.cpp" />
<Unit filename="wl_menu.cpp" />
<Unit filename="wl_menu.h" />
<Unit filename="wl_play.cpp" />
<Unit filename="wl_state.cpp" />
<Unit filename="wl_text.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder />
</Extensions>
</Project>
</CodeBlocks_project_file>

20
Wolf4SDL.VC9.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wolf4SDL", "Wolf4SDL.VC9.vcproj", "{411B026A-F58B-4E25-840B-4FE67710F762}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{411B026A-F58B-4E25-840B-4FE67710F762}.Debug|Win32.ActiveCfg = Debug|Win32
{411B026A-F58B-4E25-840B-4FE67710F762}.Debug|Win32.Build.0 = Debug|Win32
{411B026A-F58B-4E25-840B-4FE67710F762}.Release|Win32.ActiveCfg = Release|Win32
{411B026A-F58B-4E25-840B-4FE67710F762}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

450
Wolf4SDL.VC9.vcproj Normal file
View File

@ -0,0 +1,450 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="Wolf4SDL"
ProjectGUID="{411B026A-F58B-4E25-840B-4FE67710F762}"
RootNamespace="Wolf4SDL"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;F:\SDL-1.2.12\include&quot;"
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDL_mixer.lib"
AdditionalLibraryDirectories="&quot;F:\SDL-1.2.12\lib&quot;"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;F:\SDL-1.2.12\include&quot;"
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDL_mixer.lib"
AdditionalLibraryDirectories="&quot;F:\SDL-1.2.12\lib&quot;"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol=""
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\fmopl.cpp"
>
</File>
<File
RelativePath=".\id_ca.cpp"
>
</File>
<File
RelativePath=".\id_in.cpp"
>
</File>
<File
RelativePath=".\id_pm.cpp"
>
</File>
<File
RelativePath=".\id_sd.cpp"
>
</File>
<File
RelativePath=".\id_us_1.cpp"
>
</File>
<File
RelativePath=".\id_vh.cpp"
>
</File>
<File
RelativePath=".\id_vl.cpp"
>
</File>
<File
RelativePath=".\sdl_winmain.cpp"
>
</File>
<File
RelativePath=".\signon.cpp"
>
</File>
<File
RelativePath=".\sodpal.inc"
>
</File>
<File
RelativePath=".\wl_act1.cpp"
>
</File>
<File
RelativePath=".\wl_act2.cpp"
>
</File>
<File
RelativePath=".\wl_agent.cpp"
>
</File>
<File
RelativePath=".\wl_atmos.cpp"
>
</File>
<File
RelativePath=".\wl_cloudsky.cpp"
>
</File>
<File
RelativePath=".\wl_debug.cpp"
>
</File>
<File
RelativePath=".\wl_dir3dspr.cpp"
>
</File>
<File
RelativePath=".\wl_draw.cpp"
>
</File>
<File
RelativePath=".\wl_floorceiling.cpp"
>
</File>
<File
RelativePath=".\wl_game.cpp"
>
</File>
<File
RelativePath=".\wl_inter.cpp"
>
</File>
<File
RelativePath=".\wl_main.cpp"
>
</File>
<File
RelativePath=".\wl_menu.cpp"
>
</File>
<File
RelativePath=".\wl_parallax.cpp"
>
</File>
<File
RelativePath=".\wl_play.cpp"
>
</File>
<File
RelativePath=".\wl_shade.cpp"
>
</File>
<File
RelativePath=".\wl_state.cpp"
>
</File>
<File
RelativePath=".\wl_text.cpp"
>
</File>
<File
RelativePath=".\wolfpal.inc"
>
</File>
<Filter
Name="dc"
>
<File
RelativePath=".\dc\dc_cd.cpp"
>
</File>
<File
RelativePath=".\dc\dc_main.cpp"
>
</File>
<File
RelativePath=".\dc\dc_maple.cpp"
>
</File>
<File
RelativePath=".\dc\dc_video.cpp"
>
</File>
<File
RelativePath=".\dc\dc_vmu.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\audiosod.h"
>
</File>
<File
RelativePath=".\audiowl6.h"
>
</File>
<File
RelativePath=".\dc_vmu.h"
>
</File>
<File
RelativePath=".\f_spear.h"
>
</File>
<File
RelativePath=".\fmopl.h"
>
</File>
<File
RelativePath=".\foreign.h"
>
</File>
<File
RelativePath=".\gfxv_apo.h"
>
</File>
<File
RelativePath=".\gfxv_sod.h"
>
</File>
<File
RelativePath=".\gfxv_wl6.h"
>
</File>
<File
RelativePath=".\gp2x.h"
>
</File>
<File
RelativePath=".\id_ca.h"
>
</File>
<File
RelativePath=".\id_in.h"
>
</File>
<File
RelativePath=".\id_pm.h"
>
</File>
<File
RelativePath=".\id_sd.h"
>
</File>
<File
RelativePath=".\id_us.h"
>
</File>
<File
RelativePath=".\id_vh.h"
>
</File>
<File
RelativePath=".\id_vl.h"
>
</File>
<File
RelativePath=".\version.h"
>
</File>
<File
RelativePath=".\wl_atmos.h"
>
</File>
<File
RelativePath=".\wl_cloudsky.h"
>
</File>
<File
RelativePath=".\wl_def.h"
>
</File>
<File
RelativePath=".\wl_menu.h"
>
</File>
<File
RelativePath=".\wl_shade.h"
>
</File>
<Filter
Name="dc"
>
<File
RelativePath=".\dc\dc_main.h"
>
</File>
<File
RelativePath=".\dc\dc_vmu.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\Changes.txt"
>
</File>
<File
RelativePath=".\README.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

71
Wolf4SDL.cbp Normal file
View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Wolf4SDL" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="Wolf4SDL" prefix_auto="1" extension_auto="1" />
<Option type="0" />
<Option compiler="gcc" />
</Target>
</Build>
<Compiler>
<Add option="-Dmain=SDL_main" />
<Add directory="..\SDL-devel\include\SDL" />
</Compiler>
<Linker>
<Add library="mingw32" />
<Add library="SDL" />
<Add library="SDL_mixer" />
<Add directory="..\SDL-devel\lib" />
</Linker>
<Unit filename="audiosod.h" />
<Unit filename="audiowl6.h" />
<Unit filename="f_spear.h" />
<Unit filename="fmopl.cpp" />
<Unit filename="fmopl.h" />
<Unit filename="foreign.h" />
<Unit filename="gfxv_apo.h" />
<Unit filename="gfxv_sod.h" />
<Unit filename="gfxv_wl6.h" />
<Unit filename="id_ca.cpp" />
<Unit filename="id_ca.h" />
<Unit filename="id_in.cpp" />
<Unit filename="id_in.h" />
<Unit filename="id_pm.cpp" />
<Unit filename="id_sd.cpp" />
<Unit filename="id_sd.h" />
<Unit filename="id_us.h" />
<Unit filename="id_us_1.cpp" />
<Unit filename="id_vh.cpp" />
<Unit filename="id_vh.h" />
<Unit filename="id_vl.cpp" />
<Unit filename="id_vl.h" />
<Unit filename="sdl_winmain.cpp" />
<Unit filename="signon.cpp" />
<Unit filename="version.h" />
<Unit filename="wl_act1.cpp" />
<Unit filename="wl_act2.cpp" />
<Unit filename="wl_agent.cpp" />
<Unit filename="wl_debug.cpp" />
<Unit filename="wl_def.h" />
<Unit filename="wl_draw.cpp" />
<Unit filename="wl_game.cpp" />
<Unit filename="wl_inter.cpp" />
<Unit filename="wl_main.cpp" />
<Unit filename="wl_menu.cpp" />
<Unit filename="wl_menu.h" />
<Unit filename="wl_play.cpp" />
<Unit filename="wl_state.cpp" />
<Unit filename="wl_text.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder />
</Extensions>
</Project>
</CodeBlocks_project_file>

439
Wolf4SDL.dev Normal file
View File

@ -0,0 +1,439 @@
[Project]
FileName=Wolf4SDL.dev
Name=Wolf4SDL
UnitCount=39
Type=0
Ver=1
ObjFiles=
Includes=C:\Dev-Cpp\include\SDL
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-Dmain=SDL_main_@@_
CppCompiler=
Linker=-lmingw32 -lSDL -lSDL_mixer_@@_
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=Wolf4SDL.exe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000
[Unit1]
FileName=audiosod.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=audiowl6.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=f_spear.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=fmopl.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=fmopl.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=foreign.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit7]
FileName=wl_text.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit8]
FileName=gfxv_apo.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit9]
FileName=gfxv_sod.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit10]
FileName=gfxv_wl6.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit11]
FileName=id_ca.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit12]
FileName=id_ca.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit13]
FileName=id_in.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit14]
FileName=id_in.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit15]
FileName=id_pm.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit16]
FileName=id_sd.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit17]
FileName=id_sd.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit18]
FileName=id_us.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit19]
FileName=id_us_1.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit20]
FileName=id_vh.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit21]
FileName=id_vh.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit22]
FileName=id_vl.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit23]
FileName=id_vl.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit25]
FileName=wl_act1.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit26]
FileName=wl_act2.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit27]
FileName=wl_agent.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit28]
FileName=wl_debug.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit29]
FileName=wl_def.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit30]
FileName=wl_draw.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit31]
FileName=wl_game.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit32]
FileName=wl_inter.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit33]
FileName=wl_main.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit34]
FileName=wl_menu.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit35]
FileName=wl_menu.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit36]
FileName=wl_play.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit37]
FileName=wl_state.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit24]
FileName=signon.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit38]
FileName=sdl_winmain.cpp
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit39]
FileName=version.h
CompileCpp=1
Folder=Wolf4SDL
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

303
Wolf4SDL.dsp Normal file
View File

@ -0,0 +1,303 @@
# Microsoft Developer Studio Project File - Name="Wolf4SDL" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Wolf4SDL - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Wolf4SDL.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Wolf4SDL.mak" CFG="Wolf4SDL - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Wolf4SDL - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Wolf4SDL - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Wolf4SDL - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\sdl-1.2.12\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL_mixer.lib SDL.lib /nologo /subsystem:windows /machine:I386 /libpath:"c:\sdl-1.2.12\lib"
!ELSEIF "$(CFG)" == "Wolf4SDL - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "c:\sdl-1.2.12\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL_mixer.lib SDL.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"c:\sdl-1.2.12\lib"
!ENDIF
# Begin Target
# Name "Wolf4SDL - Win32 Release"
# Name "Wolf4SDL - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\fmopl.cpp
# End Source File
# Begin Source File
SOURCE=.\id_ca.cpp
# End Source File
# Begin Source File
SOURCE=.\id_in.cpp
# End Source File
# Begin Source File
SOURCE=.\id_pm.cpp
# End Source File
# Begin Source File
SOURCE=.\id_sd.cpp
# End Source File
# Begin Source File
SOURCE=.\id_us_1.cpp
# End Source File
# Begin Source File
SOURCE=.\id_vh.cpp
# End Source File
# Begin Source File
SOURCE=.\id_vl.cpp
# End Source File
# Begin Source File
SOURCE=.\sdl_winmain.cpp
# End Source File
# Begin Source File
SOURCE=.\signon.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_act1.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_act2.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_agent.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_atmos.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_cloudsky.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_debug.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_dir3dspr.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_draw.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_floorceiling.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_game.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_inter.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_main.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_menu.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_parallax.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_play.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_shade.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_state.cpp
# End Source File
# Begin Source File
SOURCE=.\wl_text.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\audiosod.h
# End Source File
# Begin Source File
SOURCE=.\audiowl6.h
# End Source File
# Begin Source File
SOURCE=.\dc_vmu.h
# End Source File
# Begin Source File
SOURCE=.\f_spear.h
# End Source File
# Begin Source File
SOURCE=.\fmopl.h
# End Source File
# Begin Source File
SOURCE=.\foreign.h
# End Source File
# Begin Source File
SOURCE=.\gfxv_apo.h
# End Source File
# Begin Source File
SOURCE=.\gfxv_sod.h
# End Source File
# Begin Source File
SOURCE=.\gfxv_wl6.h
# End Source File
# Begin Source File
SOURCE=.\id_ca.h
# End Source File
# Begin Source File
SOURCE=.\id_in.h
# End Source File
# Begin Source File
SOURCE=.\id_pm.h
# End Source File
# Begin Source File
SOURCE=.\id_sd.h
# End Source File
# Begin Source File
SOURCE=.\id_us.h
# End Source File
# Begin Source File
SOURCE=.\id_vh.h
# End Source File
# Begin Source File
SOURCE=.\id_vl.h
# End Source File
# Begin Source File
SOURCE=.\version.h
# End Source File
# Begin Source File
SOURCE=.\wl_atmos.h
# End Source File
# Begin Source File
SOURCE=.\wl_cloudsky.h
# End Source File
# Begin Source File
SOURCE=.\wl_def.h
# End Source File
# Begin Source File
SOURCE=.\wl_menu.h
# End Source File
# Begin Source File
SOURCE=.\wl_shade.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

29
Wolf4SDL.dsw Normal file
View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Wolf4SDL"=".\Wolf4SDL.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

20
Wolf4SDL.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wolf4SDL", "Wolf4SDL.vcproj", "{411B026A-F58B-4E25-840B-4FE67710F762}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{411B026A-F58B-4E25-840B-4FE67710F762}.Debug|Win32.ActiveCfg = Debug|Win32
{411B026A-F58B-4E25-840B-4FE67710F762}.Debug|Win32.Build.0 = Debug|Win32
{411B026A-F58B-4E25-840B-4FE67710F762}.Release|Win32.ActiveCfg = Release|Win32
{411B026A-F58B-4E25-840B-4FE67710F762}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

427
Wolf4SDL.vcproj Normal file
View File

@ -0,0 +1,427 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Wolf4SDL"
ProjectGUID="{411B026A-F58B-4E25-840B-4FE67710F762}"
RootNamespace="Wolf4SDL"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;F:\SDL-1.2.12\include&quot;"
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDL_mixer.lib"
AdditionalLibraryDirectories="&quot;F:\SDL-1.2.12\lib&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;F:\SDL-1.2.12\include&quot;"
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDL_mixer.lib"
AdditionalLibraryDirectories="&quot;F:\SDL-1.2.12\lib&quot;"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol=""
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\dc_main.cpp"
>
</File>
<File
RelativePath=".\dc_vmu.cpp"
>
</File>
<File
RelativePath=".\fmopl.cpp"
>
</File>
<File
RelativePath=".\gp2x.cpp"
>
</File>
<File
RelativePath=".\id_ca.cpp"
>
</File>
<File
RelativePath=".\id_in.cpp"
>
</File>
<File
RelativePath=".\id_pm.cpp"
>
</File>
<File
RelativePath=".\id_sd.cpp"
>
</File>
<File
RelativePath=".\id_us_1.cpp"
>
</File>
<File
RelativePath=".\id_vh.cpp"
>
</File>
<File
RelativePath=".\id_vl.cpp"
>
</File>
<File
RelativePath=".\sdl_winmain.cpp"
>
</File>
<File
RelativePath=".\signon.cpp"
>
</File>
<File
RelativePath=".\sodpal.inc"
>
</File>
<File
RelativePath=".\wl_act1.cpp"
>
</File>
<File
RelativePath=".\wl_act2.cpp"
>
</File>
<File
RelativePath=".\wl_agent.cpp"
>
</File>
<File
RelativePath=".\wl_atmos.cpp"
>
</File>
<File
RelativePath=".\wl_cloudsky.cpp"
>
</File>
<File
RelativePath=".\wl_debug.cpp"
>
</File>
<File
RelativePath=".\wl_dir3dspr.cpp"
>
</File>
<File
RelativePath=".\wl_draw.cpp"
>
</File>
<File
RelativePath=".\wl_floorceiling.cpp"
>
</File>
<File
RelativePath=".\wl_game.cpp"
>
</File>
<File
RelativePath=".\wl_inter.cpp"
>
</File>
<File
RelativePath=".\wl_main.cpp"
>
</File>
<File
RelativePath=".\wl_menu.cpp"
>
</File>
<File
RelativePath=".\wl_parallax.cpp"
>
</File>
<File
RelativePath=".\wl_play.cpp"
>
</File>
<File
RelativePath=".\wl_shade.cpp"
>
</File>
<File
RelativePath=".\wl_state.cpp"
>
</File>
<File
RelativePath=".\wl_text.cpp"
>
</File>
<File
RelativePath=".\wolfpal.inc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\audiosod.h"
>
</File>
<File
RelativePath=".\audiowl6.h"
>
</File>
<File
RelativePath=".\dc_vmu.h"
>
</File>
<File
RelativePath=".\f_spear.h"
>
</File>
<File
RelativePath=".\fmopl.h"
>
</File>
<File
RelativePath=".\foreign.h"
>
</File>
<File
RelativePath=".\gfxv_apo.h"
>
</File>
<File
RelativePath=".\gfxv_sod.h"
>
</File>
<File
RelativePath=".\gfxv_wl6.h"
>
</File>
<File
RelativePath=".\gp2x.h"
>
</File>
<File
RelativePath=".\id_ca.h"
>
</File>
<File
RelativePath=".\id_in.h"
>
</File>
<File
RelativePath=".\id_pm.h"
>
</File>
<File
RelativePath=".\id_sd.h"
>
</File>
<File
RelativePath=".\id_us.h"
>
</File>
<File
RelativePath=".\id_vh.h"
>
</File>
<File
RelativePath=".\id_vl.h"
>
</File>
<File
RelativePath=".\version.h"
>
</File>
<File
RelativePath=".\wl_atmos.h"
>
</File>
<File
RelativePath=".\wl_cloudsky.h"
>
</File>
<File
RelativePath=".\wl_def.h"
>
</File>
<File
RelativePath=".\wl_menu.h"
>
</File>
<File
RelativePath=".\wl_shade.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\Changes.txt"
>
</File>
<File
RelativePath=".\README.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

142
audiosod.h Normal file
View File

@ -0,0 +1,142 @@
/////////////////////////////////////////////////
//
// MUSE Header for .SOD
// Created Thu Aug 13 09:25:58 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81
#define NUMSNDCHUNKS 267
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
MISSILEHITSND, // 1
SELECTITEMSND, // 2
GHOSTSIGHTSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
MISSILEFIRESND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
DEATHSCREAM4SND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DEATHSCREAM5SND, // 53
DEATHSCREAM7SND, // 54
DEATHSCREAM8SND, // 55
LEBENSND, // 56
DEATHSCREAM6SND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
GHOSTFADESND, // 62
DEATHSCREAM9SND, // 63
GETAMMOBOXSND, // 64
ANGELSIGHTSND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
ANGELFIRESND, // 69
TRANSSIGHTSND, // 70
TRANSDEATHSND, // 71
WILHELMSIGHTSND, // 72
WILHELMDEATHSND, // 73
UBERDEATHSND, // 74
KNIGHTSIGHTSND, // 75
KNIGHTDEATHSND, // 76
ANGELDEATHSND, // 77
KNIGHTMISSILESND, // 78
GETSPEARSND, // 79
ANGELTIREDSND, // 80
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 81
#define STARTDIGISOUNDS 162
#define STARTMUSIC 243
//
// Music names & indexes
//
typedef enum {
XFUNKIE_MUS, // 0
DUNGEON_MUS, // 1
XDEATH_MUS, // 2
GETTHEM_MUS, // 3
XTIPTOE_MUS, // 4
GOINGAFT_MUS, // 5
URAHERO_MUS, // 6
XTHEEND_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
TWELFTH_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
ZEROHOUR_MUS, // 13
WONDERIN_MUS, // 14
ULTIMATE_MUS, // 15
ENDLEVEL_MUS, // 16
XEVIL_MUS, // 17
XJAZNAZI_MUS, // 18
COPYPRO_MUS, // 19
XAWARD_MUS, // 20
XPUTIT_MUS, // 21
XGETYOU_MUS, // 22
XTOWER2_MUS, // 23
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

153
audiowl6.h Normal file
View File

@ -0,0 +1,153 @@
/////////////////////////////////////////////////
//
// MUSE Header for .WL6
// Created Tue Jul 14 15:04:53 1992
//
/////////////////////////////////////////////////
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
SELECTWPNSND, // 1
SELECTITEMSND, // 2
HEARTBEATSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
SCHABBSTHROWSND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
MUTTISND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DIESND, // 53
EVASND, // 54
GUTENTAGSND, // 55
LEBENSND, // 56
SCHEISTSND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
TOT_HUNDSND, // 62
MEINGOTTSND, // 63
SCHABBSHASND, // 64
HITLERHASND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
FLAMETHROWERSND, // 69
MECHSTEPSND, // 70
GOOBSSND, // 71
YEAHSND, // 72
#ifndef APOGEE_1_0
DEATHSCREAM4SND, // 73
DEATHSCREAM5SND, // 74
DEATHSCREAM6SND, // 75
DEATHSCREAM7SND, // 76
DEATHSCREAM8SND, // 77
DEATHSCREAM9SND, // 78
DONNERSND, // 79
EINESND, // 80
ERLAUBENSND, // 81
KEINSND, // 82
MEINSND, // 83
ROSESND, // 84
MISSILEFIRESND, // 85
MISSILEHITSND, // 86
#endif
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS LASTSOUND
#define STARTDIGISOUNDS (2*LASTSOUND)
#define STARTMUSIC (3*LASTSOUND)
//
// Music names & indexes
//
typedef enum {
CORNER_MUS, // 0
DUNGEON_MUS, // 1
WARMARCH_MUS, // 2
GETTHEM_MUS, // 3
HEADACHE_MUS, // 4
HITLWLTZ_MUS, // 5
INTROCW3_MUS, // 6
NAZI_NOR_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
SALUTE_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
VICTORS_MUS, // 13
WONDERIN_MUS, // 14
FUNKYOU_MUS, // 15
ENDLEVEL_MUS, // 16
GOINGAFT_MUS, // 17
PREGNANT_MUS, // 18
ULTIMATE_MUS, // 19
NAZI_RAP_MUS, // 20
ZEROHOUR_MUS, // 21
TWELFTH_MUS, // 22
ROSTER_MUS, // 23
URAHERO_MUS, // 24
VICMARCH_MUS, // 25
PACMAN_MUS, // 26
LASTMUSIC
} musicnames;
#define NUMSOUNDS LASTSOUND
#define NUMSNDCHUNKS (STARTMUSIC + LASTMUSIC)
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

1
config.default Normal file
View File

@ -0,0 +1 @@
CFLAGS += -O2

16
dc/dc_cd.cpp Normal file
View File

@ -0,0 +1,16 @@
//Wolf4SDL\DC
//dc_cd.cpp
//2009 - Cyle Terry
#if defined(_arch_dreamcast)
#include "dc/cdrom.h"
int DC_CheckDrive() {
int disc_status;
int disc_type;
cdrom_get_status(&disc_status, &disc_type);
return disc_status;
}
#endif

377
dc/dc_main.cpp Normal file
View File

@ -0,0 +1,377 @@
//Wolf4SDL\DC
//dc_main.cpp
//2009 - Cyle Terry
#if defined(_arch_dreamcast)
//TODO: Use Port A Only
#include <string.h>
#include "../wl_def.h"
#include "dc/video.h"
#include "kos/dbglog.h"
#include "kos/fs.h"
#include "zlib/zlib.h"
char dcwolf3dpath[1024];
void DC_CheckArguments() {
FILE *fp;
char *buf;
char *result = NULL;
bool sampleRateGiven = false;
bool audioBufferGiven = false;
int length = 0;
fp = fopen("/cd/data/wolf3d/args.txt", "r");
if (!fp)
return;
fseek(fp, 0, SEEK_END);
length = ftell (fp);
fseek(fp, 0, SEEK_SET);
buf = (char *)malloc(length + 2);
fread(buf, 1, length, fp);
buf[length] = 0;
fclose(fp);
result = strtok(buf, " ");
while (result != NULL) {
#ifndef SPEAR
if (!strcmp(result, "--goobers"))
#else
if (!strcmp(result, "--debugmode"))
#endif
param_debugmode = true;
else if (!strcmp(result, "--baby"))
param_difficulty = 0;
else if (!strcmp(result, "--easy"))
param_difficulty = 1;
else if (!strcmp(result, "--normal"))
param_difficulty = 2;
else if (!strcmp(result, "--hard"))
param_difficulty = 3;
else if (!strcmp(result, "--nowait"))
param_nowait = true;
else if (!strcmp(result, "--tedlevel")) {
result = strtok(NULL, " ");
param_tedlevel = atoi(result);
} else if (!strcmp(result, "--res")) {
result = strtok(NULL, " ");
screenWidth = atoi(result);
result = strtok(NULL, " ");
screenHeight = atoi(result);
if ( screenWidth % 320 && screenHeight % 200) {
dbglog(DBG_DEBUG, "Screen height\\width must be a multiple of 320x200\n");
dbglog(DBG_DEBUG, "Defaulting to 320x200\n");
screenWidth = 320;
screenHeight = 200;
}
} else if (!strcmp(result, "--resf")) {
result = strtok(NULL, " ");
screenWidth = atoi(result);
result = strtok(NULL, " ");
screenHeight = atoi(result);
if (screenWidth < 320 && screenHeight < 200) {
dbglog(DBG_DEBUG, "Screen height\\width must be at least 320x200\n");
dbglog(DBG_DEBUG, "Defaulting to 320x200\n");
screenWidth = 320;
screenHeight = 200;
}
} else if (!strcmp(result, "--bits")) {
result = strtok(NULL, " ");
screenBits = atoi(result);
switch (screenBits) {
case 8:
case 16:
case 24:
case 32:
break;
default:
dbglog(DBG_DEBUG, "Screen bits must be either 8, 16, 24 or 32\n");
dbglog(DBG_DEBUG, "Defaulting to 8\n");
screenBits = 8;
break;
}
result = strtok(NULL, " ");
param_samplerate = atoi(result);
sampleRateGiven = true;
} else if (!strcmp(result, "--dblbuf")) { //Was --nodblbuf
usedoublebuffering = true;
} else if (!strcmp(result, "--extravbls")) {
result = strtok(NULL, " ");
extravbls = atoi(result);
if(extravbls < 0) {
dbglog(DBG_DEBUG, "Extravbls must be positive!\n");
dbglog(DBG_DEBUG, "Defaulting to 0\n");
extravbls = 0;
}
} else if (!strcmp(result, "--samplerate")) {
result = strtok(NULL, " ");
param_samplerate = atoi(result);
sampleRateGiven = true;
} else if (!strcmp(result, "--audiobuffer")) {
result = strtok(NULL, " ");
param_audiobuffer = atoi(result);
audioBufferGiven = true;
} else if (!strcmp(result, "--goodtimes"))
param_goodtimes = true;
result = strtok(NULL, " ");
}
free(buf);
if (sampleRateGiven && !audioBufferGiven)
param_audiobuffer = 4096 / (44100 / param_samplerate);
}
int DC_CheckForMaps(char *path) {
file_t dir;
dirent_t *dirent;
char fpath[1024];
int disc_status;
for(;;) {
SDL_Delay(5);
disc_status = DC_CheckDrive();
#ifdef SPEAR
DC_DrawString(4, 1, "Sod4SDL\\DC");
#else
DC_DrawString(4, 1, "Wolf4SDL\\DC");
#endif
switch(disc_status) {
//case CD_STATUS_BUSY:
//case CD_STATUS_OPEN:
// DC_DrawString(4, 6, "Please insert your Wolfenstein 3D CD.");
// break;
default:
dir = fs_open(path, O_DIR);
while(dirent = fs_readdir(dir)) {
#ifdef SPEAR
#ifdef SPEARDEMO
if(!strcmp(dirent->name, "AUDIOHED.SDM")) {
fs_close(dir);
strcpy(dcwolf3dpath, path);
return 0;
}
#else
if(!strcmp(dirent->name, "AUDIOHED.SOD")) {
fs_close(dir);
strcpy(dcwolf3dpath, path);
param_mission = DC_SetMission(path);
return 0;
}
#endif
#else
#ifdef UPLOAD
if(!strcmp(dirent->name, "AUDIOHED.WL1")) {
fs_close(dir);
strcpy(dcwolf3dpath, path);
return 0;
}
#else
if(!strcmp(dirent->name, "AUDIOHED.WL6")) {
fs_close(dir);
strcpy(dcwolf3dpath, path);
return 0;
}
#endif
#endif
strcpy(fpath, path);
sprintf(fpath, "%s/%s", fpath, dirent->name);
DC_CheckForMaps(fpath);
}
fs_close(dir);
return -1;
}
DC_Flip();
}
}
void DC_LoadMaps() {
DC_CheckForMaps("/cd");
DC_CLS();
fs_chdir(dcwolf3dpath);
#ifdef SPEAR
#ifndef SPEARDEMO
fs_copy("audiohed.sod", "/ram/audiohed.sod");
fs_copy("audiot.sod", "/ram/audiot.sod");
fs_copy("vgadict.sod", "/ram/vgadict.sod");
fs_copy("vgagraph.sod", "/ram/vgagraph.sod");
fs_copy("vgahead.sod", "/ram/vgahead.sod");
switch(param_mission) {
case 0:
fs_copy("gamemaps.sod", "/ram/gamemaps.sod");
fs_copy("maphead.sod", "/ram/maphead.sod");
fs_copy("vswap.sod", "/ram/vswap.sod");
break;
case 1:
fs_copy("gamemaps.sd1", "/ram/gamemaps.sd1");
fs_copy("maphead.sd1", "/ram/maphead.sd1");
fs_copy("vswap.sd1", "/ram/vswap.sd1");
break;
case 2:
fs_copy("gamemaps.sd2", "/ram/gamemaps.sd2");
fs_copy("maphead.sd2", "/ram/maphead.sd2");
fs_copy("vswap.sd2", "/ram/vswap.sd2");
break;
case 3:
fs_copy("gamemaps.sd3", "/ram/gamemaps.sd3");
fs_copy("maphead.sd3", "/ram/maphead.sd3");
fs_copy("vswap.sd3", "/ram/vswap.sd3");
break;
}
#else
fs_copy("audiohed.sdm", "/ram/audiohed.sdm");
fs_copy("audiot.sdm", "/ram/audiot.sdm");
fs_copy("vgadict.sdm", "/ram/vgadict.sdm");
fs_copy("vgagraph.sdm", "/ram/vgagraph.sdm");
fs_copy("vgahead.sdm", "/ram/vgahead.sdm");
fs_copy("gamemaps.sdm", "/ram/gamemaps.sdm");
fs_copy("maphead.sdm", "/ram/maphead.sdm");
fs_copy("vswap.sdm", "/ram/vswap.sdm");
#endif
#else
#ifndef UPLOAD
fs_copy("audiohed.wl6", "/ram/audiohed.wl6");
fs_copy("audiot.wl6", "/ram/audiot.wl6");
fs_copy("vgadict.wl6", "/ram/vgadict.wl6");
fs_copy("vgagraph.wl6", "/ram/vgagraph.wl6");
fs_copy("vgahead.wl6", "/ram/vgahead.wl6");
fs_copy("gamemaps.wl6", "/ram/gamemaps.wl6");
fs_copy("maphead.wl6", "/ram/maphead.wl6");
fs_copy("vswap.wl6", "/ram/vswap.wl6");
#else
fs_copy("audiohed.wl1", "/ram/audiohed.wl1");
fs_copy("audiot.wl1", "/ram/audiot.wl1");
fs_copy("vgadict.wl1", "/ram/vgadict.wl1");
fs_copy("vgagraph.wl1", "/ram/vgagraph.wl1");
fs_copy("vgahead.wl1", "/ram/vgahead.wl1");
fs_copy("gamemaps.wl1", "/ram/gamemaps.wl1");
fs_copy("maphead.wl1", "/ram/maphead.wl1");
fs_copy("vswap.wl1", "/ram/vswap.wl1");
#endif
#endif
fs_chdir("/ram");
}
void DC_Init() {
DC_CheckArguments();
DC_VideoInit();
DC_LoadMaps();
DC_CLS();
}
#ifdef SPEAR
#ifndef SPEARDEMO
int DC_SetMission(char *path) {
int mission1 = 0;
int mission2 = 0;
int mission3 = 0;
int missions = 0;
int last_mission = 0;
int current_mission = 0;
int previous_mission = 0;
int font_y = 0;
char fname[1024];
bool finished = false;
FILE *fp;
sprintf(fname, "%s/MAPHEAD.SOD", path);
fp = fopen(fname, "r");
if(fp) {
fclose(fp);
last_mission = 1;
mission1 = 1;
missions++;
}
sprintf(fname, "%s/MAPHEAD.SD2", path);
fp = fopen(fname, "r");
if(fp) {
fclose(fp);
last_mission = 2;
mission2 = 1;
missions++;
}
sprintf(fname, "%s/MAPHEAD.SD3", path);
fp = fopen(fname, "r");
if(fp) {
fclose(fp);
last_mission = 3;
mission3 = 1;
missions++;
}
if(missions > 1) {
while(!finished) {
SDL_Delay(5);
DC_CLS();
DC_DrawString(2, 6 + current_mission, ">");
font_y = 6;
DC_DrawString(4, 1, "Sod4SDL\\DC");
if(mission1 == 1) {
DC_DrawString(4, font_y, "Spear of Destiny (Original Mission)");
font_y++;
}
if(mission2 == 1) {
DC_DrawString(4, font_y, "Mission 2 - Return to Danger");
font_y++;
}
if(mission3 == 1) {
DC_DrawString(4, font_y, "Mission 3 - Ultimate Challenge");
font_y++;
}
if(DC_ButtonPress(CONT_A)) {
finished = true;
break;
} else if(DC_ButtonPress(CONT_DPAD_DOWN)) {
current_mission++;
previous_mission = -1;
if(current_mission > (missions - 1))
current_mission = 0;
DC_WaitButtonRelease(CONT_DPAD_DOWN);
} else if(DC_ButtonPress(CONT_DPAD_UP)) {
current_mission--;
previous_mission = -1;
if(current_mission < 0)
current_mission = missions - 1;
DC_WaitButtonRelease(CONT_DPAD_UP);
}
DC_Flip();
}
/* Return Selected Mission */
// XXX: What does this do? Are the fall throughs intended?!
switch(current_mission) {
case 1:
if(mission1) return 1;
if(mission2 && !mission1) return 2;
case 2:
if(mission2 && mission1) return 2;
if(mission3 && mission1 && !mission2) return 3;
if(mission3 && mission2 && !mission1) return 3;
case 3:
if(mission3 && mission2 && mission1) return 3;
}
}
return last_mission;
}
#endif
#endif
#endif

49
dc/dc_main.h Normal file
View File

@ -0,0 +1,49 @@
//Wolf4SDL\DC
//dc_main.h
//2009 - Cyle Terry
#ifndef __DC_MAIN_H_
#define __DC_MAIN_H_
typedef uint8 uint8_t;
typedef uint16 uint16_t;
typedef uint32 uint32_t;
typedef int8 int8_t;
typedef int16 int16_t;
typedef int32 int32_t;
typedef int64 int64_t;
typedef ptr_t uintptr_t;
//dc_cd.cpp
int DC_CheckDrive();
//dc_main.cpp
void DC_Init();
void DC_CheckArguments();
int DC_CheckForMaps(char *path);
#ifdef SPEAR
#ifndef SPEARDEMO
int DC_SetMission(char *path);
#endif
#endif
//dc_maple.cpp
int DC_ButtonPress(int button);
int DC_MousePresent();
void DC_WaitButtonPress(int button);
void DC_WaitButtonRelease(int button);
//dc_video.cpp
void DC_VideoInit();
void DC_DrawString(int x, int y, char *str);
void DC_CLS();
void DC_Flip();
//dc_vmu.cpp
extern void DiskFlopAnim(int x, int y);
void DC_StatusDrawLCD(int index);
void DC_StatusClearLCD();
void DC_SaveToVMU(char *fname, char *str);
int DC_LoadFromVMU(char *fname);
#endif

60
dc/dc_maple.cpp Normal file
View File

@ -0,0 +1,60 @@
//Wolf4SDL\DC
//dc_maple.cpp
//2009 - Cyle Terry
#if defined(_arch_dreamcast)
#include <SDL.h>
#include "dc/maple.h"
#include "dc/maple/controller.h"
#include "dc/maple/vmu.h"
int DC_MousePresent() {
return maple_first_mouse() != 0;
}
void DC_WaitButtonPress(int button)
{
int first_controller = 0;
cont_cond_t controller_condition;
first_controller = maple_first_controller();
cont_get_cond(first_controller, &controller_condition);
while((controller_condition.buttons & button)) {
SDL_Delay(5);
cont_get_cond(first_controller, &controller_condition);
}
}
void DC_WaitButtonRelease(int button)
{
int first_controller = 0;
cont_cond_t controller_condition;
first_controller = maple_first_controller();
cont_get_cond(first_controller, &controller_condition);
while(!(controller_condition.buttons & button)) {
SDL_Delay(5);
cont_get_cond(first_controller, &controller_condition);
}
}
int DC_ButtonPress(int button)
{
int first_controller = 0;
cont_cond_t controller_condition;
first_controller = maple_first_controller();
cont_get_cond(first_controller, &controller_condition);
if(!(controller_condition.buttons & button))
return 1;
else
return 0;
}
#endif

37
dc/dc_video.cpp Normal file
View File

@ -0,0 +1,37 @@
//Wolf4SDL\DC
//dc_video.cpp
//2009 - Cyle Terry
#if defined(_arch_dreamcast)
#include <string.h>
#include <malloc.h>
#include "../wl_def.h"
#include "dc/biosfont.h"
#include "dc/video.h"
static uint16 *bbuffer;
void DC_VideoInit() {
bbuffer = (uint16 *)malloc(640 * 480 * 2);
DC_CLS();
}
void DC_DrawString(int x, int y, char *str) {
bfont_draw_str(bbuffer + ((y + 1) * 24 * 640) + (x * 12), 640, 0, str);
}
void DC_Flip() {
memcpy(vram_s, bbuffer, 640 * 480 * 2);
}
void DC_CLS() {
int x, y, ofs;
for(y = 0; y < 480; y++) {
ofs = (640 * y);
for(x = 0; x < 640; x++)
bbuffer[ofs + x] = 0;
}
}
#endif

181
dc/dc_vmu.cpp Normal file
View File

@ -0,0 +1,181 @@
//Wolf4SDL\DC
//dc_vmu.cpp
//2009 - Cyle Terry
#if defined(_arch_dreamcast)
#include <string.h>
#include "../wl_def.h"
#include "dc/maple.h"
#include "dc/maple/controller.h"
#include "dc/maple/vmu.h"
#include "dc/vmu_pkg.h"
#include "kos/fs.h"
#include "zlib/zlib.h"
#include "dc_vmu.h"
maple_device_t *vmu_lcd_addr[8];
void DC_StatusDrawLCD(int lcd) {
const char *character;
int x, y;
int xi, xb;
int i = 0;
uint8 bitmap[48 * 32 / 8];
maple_device_t *vmu_lcd_addr;
memset(bitmap, 0, sizeof(bitmap));
character = e_BJFaces[lcd - FACE1APIC];
if(character) {
for(y = 0; y < LCD_HEIGHT; y++) {
for(x = 0; x < LCD_WIDTH; x++) {
xi = x / 8;
xb = 0x80 >> (x % 8);
if(character[(31 - y) * 48 + (47 - x)] == '.')
bitmap[y * (48 / 8) + xi] |= xb;
}
}
}
while ((vmu_lcd_addr = maple_enum_type(i++, MAPLE_FUNC_LCD)))
vmu_draw_lcd(vmu_lcd_addr, bitmap);
vmu_shutdown ();
}
void DC_StatusClearLCD() {
int x, y;
int xi;
int i = 0;
uint8 bitmap[48 * 32 / 8];
maple_device_t *vmu_lcd_addr;
memset(bitmap, 0, sizeof(bitmap));
for(y = 0; y < LCD_HEIGHT; y++) {
for(x = 0; x < LCD_WIDTH; x++) {
xi = x / 8;
bitmap[y * (48 / 8) + xi] |= 0;
}
}
while ((vmu_lcd_addr = maple_enum_type(i++, MAPLE_FUNC_LCD)))
vmu_draw_lcd(vmu_lcd_addr, bitmap);
vmu_shutdown ();
}
void DC_SaveToVMU(char *fname, char *str) {
char destination[32];
int filesize = 0;
int vmu_package_size;
unsigned long zipsize = 0;
unsigned char *vmu_package_out;
unsigned char *data;
unsigned char *zipdata;
file_t file;
vmu_pkg_t vmu_package;
DiskFlopAnim(102, 85);
strcpy(destination, "/vmu/a1/");
strcat(destination, fname);
file = fs_open(fname, O_RDONLY);
filesize = fs_total(file);
data = (unsigned char*)malloc(filesize);
fs_read(file, data, filesize);
fs_close(file);
DiskFlopAnim(102, 85);
zipsize = filesize * 2;
zipdata = (unsigned char*)malloc(zipsize);
compress(zipdata, &zipsize, data, filesize);
DiskFlopAnim(102, 85);
#ifdef SPEAR
strcpy(vmu_package.desc_short, "Sod4SDL\\DC");
strcpy(vmu_package.app_id, "Sod4SDL\\DC");
#else
strcpy(vmu_package.desc_short, "Wolf4SDL\\DC");
strcpy(vmu_package.app_id, "Wolf4SDL\\DC");
#endif
if(str == NULL)
strcpy(vmu_package.desc_long, "Configuration");
else {
strcpy(vmu_package.desc_long, "Game Save - ");
strcat(vmu_package.desc_long, str);
}
vmu_package.icon_cnt = 1;
vmu_package.icon_anim_speed = 0;
memcpy(&vmu_package.icon_pal[0], vmu_bios_save_icon, 32);
vmu_package.icon_data = vmu_bios_save_icon + 32;
vmu_package.eyecatch_type = VMUPKG_EC_NONE;
vmu_package.data_len = zipsize;
vmu_package.data = zipdata;
vmu_pkg_build(&vmu_package, &vmu_package_out, &vmu_package_size);
DiskFlopAnim(102, 85);
fs_unlink(destination);
file = fs_open(destination, O_WRONLY);
fs_write(file, vmu_package_out, vmu_package_size);
fs_close(file);
DiskFlopAnim(102, 85);
free(vmu_package_out);
free(data);
free(zipdata);
}
int DC_LoadFromVMU(char *fname) {
char fpath[64];
int file;
int filesize;
unsigned long unzipsize;
unsigned char *data;
unsigned char *unzipdata;
vmu_pkg_t vmu_package;
sprintf(fpath, "/vmu/a1/%s", fname);
file = fs_open(fpath, O_RDONLY);
if(file == 0) return 0;
filesize = fs_total(file);
if(filesize <= 0) return 0;
data = (unsigned char*)malloc(filesize);
fs_read(file, data, filesize);
fs_close(file);
if(!strcmp(fname, configname))
DiskFlopAnim(102, 85);
vmu_pkg_parse(data, &vmu_package);
if(!strcmp(fname, configname))
DiskFlopAnim(102, 85);
unzipdata = (unsigned char*)malloc(65536);
unzipsize = 65536;
uncompress(unzipdata, &unzipsize, (unsigned char*)vmu_package.data, vmu_package.data_len);
if(!strcmp(fname, configname))
DiskFlopAnim(102, 85);
fs_unlink(fname);
file = fs_open(fname, O_WRONLY);
fs_write(file, unzipdata, unzipsize);
fs_close(file);
if(!strcmp(fname, configname))
DiskFlopAnim(102, 85);
free(data);
free(unzipdata);
return 1;
}
#endif

1168
dc/dc_vmu.h Normal file

File diff suppressed because it is too large Load Diff

76
f_spear.h Normal file
View File

@ -0,0 +1,76 @@
#define STR_ENDGAME1 "We owe you a great debt, Mr. Blazkowicz."
#define STR_ENDGAME2 "You have served your country well."
#define STR_ENDGAME3 "With the spear gone, the Allies will finally"
#define STR_ENDGAME4 "by able to destroy Hitler..."
#define STR_COPY1 "That's close, but not close enough to get"
#define STR_COPY2 "you into the game."
#define STR_COPY3 "Wow, you must have the early version of the"
#define STR_COPY4 "manual with the totally false information in it."
#define STR_COPY5 "I would let you into the game, but seeing"
#define STR_COPY6 "as that was not at all the right answer..."
#define STR_COPY7 "It's just too bad we can't get together on"
#define STR_COPY8 "this one. Sorry."
#define STR_COPY9 "Hey, you're just SO off base!"
#define STR_COPY10 "You know, I once typed that myself when"
#define STR_COPY11 "I was your age."
#define STR_COPY12 "Nops. Zero points. Zugga."
#define STR_COPY13 "Yeah...right."
#define STR_COPY14 "You must like these quizzes."
#define STR_COPY15 "Could be called \"PixelMeister\"?"
#define STR_COPY16 "Might engineer some software?"
#define STR_COPY17 "Would be found"
#define STR_COPY18 "directing creatively?"
#define STR_COPY19 "Might be found"
#define STR_COPY20 "handling operations?"
#define STR_COPY21 "Has a name familiar"
#define STR_COPY22 "to your weatherman?"
#define STR_NOPE1 "Welcome to the DOS prompt, pirate!"
#define STR_NOPE2 "Eat hot DOS prompt, goober!"
#define STR_NOPE3 "Ya know, this program doesn't cost that much."
#define STR_NOPE4 "Hey...weren't you just AT this DOS prompt?"
#define STR_NOPE5 "What's a nice user like you doin' at a DOS prompt like this?"
#define STR_NOPE6 "Well, I'm sure you just \"misplaced\" the manual..."
#define STR_NOPE7 "Run me again when you've boned up on your manual a bit."
#define STR_NOPE8 "Nice try, but no Spear."
#define STR_NOPE9 "That information is in the Spear of Destiny manual, by the way."
#define STR_MISC1 "Under \"Killing the Enemy\", what"
#define STR_MISC2 "type of enemy is pictured?"
#define STR_MISC3 "How many eyelets are on B.J.'s"
#define STR_MISC4 "boots? (see page 2)"
#define STR_MISC5 "The word \"minister\" appears in"
#define STR_MISC6 "what gray shape on page 2?"
#define STR_MISC7 "How many bullets does B.J. have"
#define STR_MISC8 "on the screen-shot in the middle"
#define STR_MISC9 "of page 9?"
#define STR_STAR "star"
#define STR_DEBRIEF " DEBRIEFING\n SESSION\n"
#define STR_ENEMY1 "Name the member of the"
#define STR_ENEMY2 "enemy forces shown above"
#define STR_CHECKMAN "CHECK YER MANUAL!"
#define STR_MAN1 "Which manual page"
#define STR_MAN2 "is the Options Menu"
#define STR_MAN3 "function"
#define STR_MAN4 "on?"
#define STR_ID1 "Which member of Id Software:"

2591
fmopl.cpp Normal file

File diff suppressed because it is too large Load Diff

114
fmopl.h Normal file
View File

@ -0,0 +1,114 @@
#ifndef __FMOPL_H_
#define __FMOPL_H_
#define HAS_YM3812 1
/* --- select emulation chips --- */
#define BUILD_YM3812 (HAS_YM3812)
#define BUILD_YM3526 (HAS_YM3526)
#define BUILD_Y8950 (HAS_Y8950)
/* select output bits size of output : 8 or 16 */
#define OPL_SAMPLE_BITS 16
/* compiler dependence */
#ifndef OSD_CPU_H
#define OSD_CPU_H
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
typedef int BOOL;
#endif
#if (OPL_SAMPLE_BITS==16)
typedef INT16 OPLSAMPLE;
#endif
#if (OPL_SAMPLE_BITS==8)
typedef INT8 OPLSAMPLE;
#endif
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
typedef void (*OPL_IRQHANDLER)(int param,int irq);
typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
#if BUILD_YM3812
int YM3812Init(int num, int clock, int rate);
void YM3812Shutdown(void);
void YM3812ResetChip(int which);
int YM3812Write(int which, int a, int v);
unsigned char YM3812Read(int which, int a);
void YM3812Mute(int which,int channel,BOOL mute);
int YM3812TimerOver(int which, int c);
void YM3812UpdateOne(int which, INT16 *buffer, int length);
void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
#endif
#if BUILD_YM3526
/*
** Initialize YM3526 emulator(s).
**
** 'num' is the number of virtual YM3526's to allocate
** 'clock' is the chip clock in Hz
** 'rate' is sampling rate
*/
int YM3526Init(int num, int clock, int rate);
/* shutdown the YM3526 emulators*/
void YM3526Shutdown(void);
void YM3526ResetChip(int which);
int YM3526Write(int which, int a, int v);
unsigned char YM3526Read(int which, int a);
int YM3526TimerOver(int which, int c);
/*
** Generate samples for one of the YM3526's
**
** 'which' is the virtual YM3526 number
** '*buffer' is the output buffer pointer
** 'length' is the number of samples that should be generated
*/
void YM3526UpdateOne(int which, INT16 *buffer, int length);
void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
#endif
#if BUILD_Y8950
/* Y8950 port handlers */
void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param);
void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param);
void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size );
int Y8950Init (int num, int clock, int rate);
void Y8950Shutdown (void);
void Y8950ResetChip (int which);
int Y8950Write (int which, int a, int v);
unsigned char Y8950Read (int which, int a);
int Y8950TimerOver (int which, int c);
void Y8950UpdateOne (int which, INT16 *buffer, int length);
void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param);
void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param);
#endif
#endif /* __FMOPL_H_ */

131
foreign.h Normal file
View File

@ -0,0 +1,131 @@
#define QUITSUR "Are you sure you want\n"\
"to quit this great game?"
#define CURGAME "You are currently in\n"\
"a game. Continuing will\n"\
"erase old game. Ok?"
#define GAMESVD "There's already a game\n"\
"saved at this position.\n"\
" Overwrite?"
#define ENDGAMESTR "Are you sure you want\n"\
"to end the game you\n"\
"are playing? (Y or N):"
#define STR_NG "New Game"
#define STR_SD "Sound"
#define STR_CL "Control"
#define STR_LG "Load Game"
#define STR_SG "Save Game"
#define STR_CV "Change View"
#define STR_VS "View Scores"
#define STR_EG "End Game"
#define STR_BD "Back to Demo"
#define STR_QT "Quit"
#define STR_LOADING "Loading"
#define STR_SAVING "Saving"
#define STR_GAME "Game"
#define STR_DEMO "Demo"
#define STR_LGC "Load Game called\n\""
#define STR_EMPTY "empty"
#define STR_CALIB "Calibrate"
#define STR_JOYST "Joystick"
#define STR_MOVEJOY "Move joystick to\nupper left and\npress button 0\n"
#define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n"
#define STR_ESCEXIT "ESC to exit"
#define STR_NONE "None"
#define STR_PC "PC Speaker"
#define STR_ALSB "AdLib/Sound Blaster"
#define STR_DISNEY "Disney Sound Source"
#define STR_SB "Sound Blaster"
#define STR_MOUSEEN "Mouse Enabled"
#define STR_JOYEN "Joystick Enabled"
#define STR_PORT2 "Use joystick port 2"
#define STR_GAMEPAD "Gravis GamePad Enabled"
#define STR_SENS "Mouse Sensitivity"
#define STR_CUSTOM "Customize controls"
#define STR_DADDY "Can I play, Daddy?"
#define STR_HURTME "Don't hurt me."
#define STR_BRINGEM "Bring 'em on!"
#define STR_DEATH "I am Death incarnate!"
#define STR_MOUSEADJ "Adjust Mouse Sensitivity"
#define STR_SLOW "Slow"
#define STR_FAST "Fast"
#define STR_CRUN "Run"
#define STR_COPEN "Open"
#define STR_CFIRE "Fire"
#define STR_CSTRAFE "Strafe"
#define STR_LEFT "Left"
#define STR_RIGHT "Right"
#define STR_FRWD "Frwd"
#define STR_BKWD "Bkwrd"
#define STR_THINK "Thinking"
#define STR_SIZE1 "Use arrows to size"
#define STR_SIZE2 "ENTER to accept"
#define STR_SIZE3 "ESC to cancel"
#define STR_YOUWIN "you win!"
#define STR_TOTALTIME "total time"
#define STR_RATKILL "kill %"
#define STR_RATSECRET "secret %"
#define STR_RATTREASURE "treasure %"
#define STR_BONUS "bonus"
#define STR_TIME "time"
#define STR_PAR " par"
#define STR_RAT2KILL "kill ratio %"
#define STR_RAT2SECRET "secret ratio %"
#define STR_RAT2TREASURE "treasure ratio %"
#define STR_DEFEATED "defeated!"
#define STR_CHEATER1 "You now have 100% Health,"
#define STR_CHEATER2 "99 Ammo and both Keys!"
#define STR_CHEATER3 "Note that you have basically"
#define STR_CHEATER4 "eliminated your chances of"
#define STR_CHEATER5 "getting a high score!"
#define STR_NOSPACE1 "There is not enough space"
#define STR_NOSPACE2 "on your disk to Save Game!"
#define STR_SAVECHT1 "Your Save Game file is,"
#define STR_SAVECHT2 "shall we say, \"corrupted\"."
#define STR_SAVECHT3 "But I'll let you go on and"
#define STR_SAVECHT4 "play anyway...."
#define STR_SEEAGAIN "Let's see that again!"
#ifdef SPEAR
#define ENDSTR1 "Heroes don't quit, but\ngo ahead and press " YESBUTTONNAME "\nif you aren't one."
#define ENDSTR2 "Press " YESBUTTONNAME " to quit,\nor press " NOBUTTONNAME " to enjoy\nmore violent diversion."
#define ENDSTR3 "Depressing the " YESBUTTONNAME " key means\nyou must return to the\nhumdrum workday world."
#define ENDSTR4 "Hey, quit or play,\n" YESBUTTONNAME " or " NOBUTTONNAME ":\nit's your choice."
#define ENDSTR5 "Sure you don't want to\nwaste a few more\nproductive hours?"
#define ENDSTR6 "I think you had better\nplay some more. Please\npress " NOBUTTONNAME "...please?"
#define ENDSTR7 "If you are tough, press " NOBUTTONNAME ".\nIf not, press " YESBUTTONNAME " daintily."
#define ENDSTR8 "I'm thinkin' that\nyou might wanna press " NOBUTTONNAME "\nto play more. You do it."
#define ENDSTR9 "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress " YESBUTTONNAME "."
#else
#define ENDSTR1 "Dost thou wish to\nleave with such hasty\nabandon?"
#define ENDSTR2 "Chickening out...\nalready?"
#define ENDSTR3 "Press " NOBUTTONNAME " for more carnage.\nPress " YESBUTTONNAME " to be a weenie."
#define ENDSTR4 "So, you think you can\nquit this easily, huh?"
#define ENDSTR5 "Press " NOBUTTONNAME " to save the world.\nPress " YESBUTTONNAME " to abandon it in\nits hour of need."
#define ENDSTR6 "Press " NOBUTTONNAME " if you are brave.\nPress " YESBUTTONNAME " to cower in shame."
#define ENDSTR7 "Heroes, press " NOBUTTONNAME ".\nWimps, press " YESBUTTONNAME "."
#define ENDSTR8 "You are at an intersection.\nA sign says, 'Press " YESBUTTONNAME " to quit.'\n>"
#define ENDSTR9 "For guns and glory, press " NOBUTTONNAME ".\nFor work and worry, press " YESBUTTONNAME "."
#endif

244
gfxv_apo.h Normal file
View File

@ -0,0 +1,244 @@
//////////////////////////////////////
//
// Graphics .H file for Apogee v1.4
// IGRAB-ed on Sun May 03 01:19:32 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
H_BJPIC=3,
H_CASTLEPIC, // 4
H_KEYBOARDPIC, // 5
H_JOYPIC, // 6
H_HEALPIC, // 7
H_TREASUREPIC, // 8
H_GUNPIC, // 9
H_KEYPIC, // 10
H_BLAZEPIC, // 11
H_WEAPON1234PIC, // 12
H_WOLFLOGOPIC, // 13
H_VISAPIC, // 14
H_MCPIC, // 15
H_IDLOGOPIC, // 16
H_TOPWINDOWPIC, // 17
H_LEFTWINDOWPIC, // 18
H_RIGHTWINDOWPIC, // 19
H_BOTTOMINFOPIC, // 20
#if !defined(APOGEE_1_0) && !defined(APOGEE_1_1) && !defined(APOGEE_1_2)
H_SPEARADPIC, // 21
#endif
// Lump Start
C_OPTIONSPIC, // 22
C_CURSOR1PIC, // 23
C_CURSOR2PIC, // 24
C_NOTSELECTEDPIC, // 25
C_SELECTEDPIC, // 26
C_FXTITLEPIC, // 27
C_DIGITITLEPIC, // 28
C_MUSICTITLEPIC, // 29
C_MOUSELBACKPIC, // 30
C_BABYMODEPIC, // 31
C_EASYPIC, // 32
C_NORMALPIC, // 33
C_HARDPIC, // 34
C_LOADSAVEDISKPIC, // 35
C_DISKLOADING1PIC, // 36
C_DISKLOADING2PIC, // 37
C_CONTROLPIC, // 38
C_CUSTOMIZEPIC, // 39
C_LOADGAMEPIC, // 40
C_SAVEGAMEPIC, // 41
C_EPISODE1PIC, // 42
C_EPISODE2PIC, // 43
C_EPISODE3PIC, // 44
C_EPISODE4PIC, // 45
C_EPISODE5PIC, // 46
C_EPISODE6PIC, // 47
C_CODEPIC, // 48
#ifndef APOGEE_1_0
C_TIMECODEPIC, // 49
C_LEVELPIC, // 50
C_NAMEPIC, // 51
C_SCOREPIC, // 52
#if !defined(APOGEE_1_1) && !defined(APOGEE_1_2)
C_JOY1PIC, // 53
C_JOY2PIC, // 54
#endif
#else
C_TIMECODEPIC=C_CODEPIC, // 47
#endif
// Lump Start
L_GUYPIC, // 55
L_COLONPIC, // 56
L_NUM0PIC, // 57
L_NUM1PIC, // 58
L_NUM2PIC, // 59
L_NUM3PIC, // 60
L_NUM4PIC, // 61
L_NUM5PIC, // 62
L_NUM6PIC, // 63
L_NUM7PIC, // 64
L_NUM8PIC, // 65
L_NUM9PIC, // 66
L_PERCENTPIC, // 67
L_APIC, // 68
L_BPIC, // 69
L_CPIC, // 70
L_DPIC, // 71
L_EPIC, // 72
L_FPIC, // 73
L_GPIC, // 74
L_HPIC, // 75
L_IPIC, // 76
L_JPIC, // 77
L_KPIC, // 78
L_LPIC, // 79
L_MPIC, // 80
L_NPIC, // 81
L_OPIC, // 82
L_PPIC, // 83
L_QPIC, // 84
L_RPIC, // 85
L_SPIC, // 86
L_TPIC, // 87
L_UPIC, // 88
L_VPIC, // 89
L_WPIC, // 90
L_XPIC, // 91
L_YPIC, // 92
L_ZPIC, // 93
L_EXPOINTPIC, // 94
#ifndef APOGEE_1_0
L_APOSTROPHEPIC, // 95
#endif
L_GUY2PIC, // 96
L_BJWINSPIC, // 97
STATUSBARPIC, // 98
TITLEPIC, // 99
PG13PIC, // 100
CREDITSPIC, // 101
HIGHSCORESPIC, // 102
// Lump Start
KNIFEPIC, // 103
GUNPIC, // 104
MACHINEGUNPIC, // 105
GATLINGGUNPIC, // 106
NOKEYPIC, // 107
GOLDKEYPIC, // 108
SILVERKEYPIC, // 109
N_BLANKPIC, // 110
N_0PIC, // 111
N_1PIC, // 112
N_2PIC, // 113
N_3PIC, // 114
N_4PIC, // 115
N_5PIC, // 116
N_6PIC, // 117
N_7PIC, // 118
N_8PIC, // 119
N_9PIC, // 120
FACE1APIC, // 121
FACE1BPIC, // 122
FACE1CPIC, // 123
FACE2APIC, // 124
FACE2BPIC, // 125
FACE2CPIC, // 126
FACE3APIC, // 127
FACE3BPIC, // 128
FACE3CPIC, // 129
FACE4APIC, // 130
FACE4BPIC, // 131
FACE4CPIC, // 132
FACE5APIC, // 133
FACE5BPIC, // 134
FACE5CPIC, // 135
FACE6APIC, // 136
FACE6BPIC, // 137
FACE6CPIC, // 138
FACE7APIC, // 139
FACE7BPIC, // 140
FACE7CPIC, // 141
FACE8APIC, // 142
GOTGATLINGPIC, // 143
MUTANTBJPIC, // 144
PAUSEDPIC, // 145
GETPSYCHEDPIC, // 146
TILE8, // 147
ORDERSCREEN, // 148
ERRORSCREEN, // 149
T_HELPART, // 150
#ifdef APOGEE_1_0
T_ENDART1, // 143
#endif
T_DEMO0, // 151
T_DEMO1, // 152
T_DEMO2, // 153
T_DEMO3, // 154
#ifndef APOGEE_1_0
T_ENDART1, // 155
T_ENDART2, // 156
T_ENDART3, // 157
T_ENDART4, // 158
T_ENDART5, // 159
T_ENDART6, // 160
#endif
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define README_LUMP_START H_BJPIC
#define README_LUMP_END H_BOTTOMINFOPIC
#define CONTROLS_LUMP_START C_OPTIONSPIC
#define CONTROLS_LUMP_END (L_GUYPIC - 1)
#define LEVELEND_LUMP_START L_GUYPIC
#define LEVELEND_LUMP_END L_BJWINSPIC
#define LATCHPICS_LUMP_START KNIFEPIC
#define LATCHPICS_LUMP_END GETPSYCHEDPIC
//
// Amount of each data item
//
#define NUMCHUNKS ENUMEND
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS (GETPSYCHEDPIC - NUMFONT)
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 13
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM TILE8
#define STARTSPRITES TILE8
#define STARTTILE8 TILE8
#define STARTTILE8M ORDERSCREEN
#define STARTTILE16 ORDERSCREEN
#define STARTTILE16M ORDERSCREEN
#define STARTTILE32 ORDERSCREEN
#define STARTTILE32M ORDERSCREEN
#define STARTEXTERNS ORDERSCREEN
//
// Thank you for using IGRAB!
//

290
gfxv_sod.h Normal file
View File

@ -0,0 +1,290 @@
//////////////////////////////////////
//
// Graphics .H file for .SOD
// IGRAB-ed on Thu Oct 08 20:38:29 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
C_BACKDROPPIC=3,
C_MOUSELBACKPIC, // 4
C_CURSOR1PIC, // 5
C_CURSOR2PIC, // 6
C_NOTSELECTEDPIC, // 7
C_SELECTEDPIC, // 8
// Lump Start
C_CUSTOMIZEPIC, // 9
C_JOY1PIC, // 10
C_JOY2PIC, // 11
C_MOUSEPIC, // 12
C_JOYSTICKPIC, // 13
C_KEYBOARDPIC, // 14
C_CONTROLPIC, // 15
// Lump Start
C_OPTIONSPIC, // 16
// Lump Start
C_FXTITLEPIC, // 17
C_DIGITITLEPIC, // 18
C_MUSICTITLEPIC, // 19
// Lump Start
C_HOWTOUGHPIC, // 20
C_BABYMODEPIC, // 21
C_EASYPIC, // 22
C_NORMALPIC, // 23
C_HARDPIC, // 24
// Lump Start
C_DISKLOADING1PIC, // 25
C_DISKLOADING2PIC, // 26
C_LOADGAMEPIC, // 27
C_SAVEGAMEPIC, // 28
// Lump Start
HIGHSCORESPIC, // 29
C_WONSPEARPIC, // 30
#ifndef SPEARDEMO
// Lump Start
BJCOLLAPSE1PIC, // 31
BJCOLLAPSE2PIC, // 32
BJCOLLAPSE3PIC, // 33
BJCOLLAPSE4PIC, // 34
ENDPICPIC, // 35
#endif
// Lump Start
L_GUYPIC, // 36
L_COLONPIC, // 37
L_NUM0PIC, // 38
L_NUM1PIC, // 39
L_NUM2PIC, // 40
L_NUM3PIC, // 41
L_NUM4PIC, // 42
L_NUM5PIC, // 43
L_NUM6PIC, // 44
L_NUM7PIC, // 45
L_NUM8PIC, // 46
L_NUM9PIC, // 47
L_PERCENTPIC, // 48
L_APIC, // 49
L_BPIC, // 50
L_CPIC, // 51
L_DPIC, // 52
L_EPIC, // 53
L_FPIC, // 54
L_GPIC, // 55
L_HPIC, // 56
L_IPIC, // 57
L_JPIC, // 58
L_KPIC, // 59
L_LPIC, // 60
L_MPIC, // 61
L_NPIC, // 62
L_OPIC, // 63
L_PPIC, // 64
L_QPIC, // 65
L_RPIC, // 66
L_SPIC, // 67
L_TPIC, // 68
L_UPIC, // 69
L_VPIC, // 70
L_WPIC, // 71
L_XPIC, // 72
L_YPIC, // 73
L_ZPIC, // 74
L_EXPOINTPIC, // 75
L_APOSTROPHEPIC, // 76
L_GUY2PIC, // 77
L_BJWINSPIC, // 78
// Lump Start
TITLE1PIC, // 79
TITLE2PIC, // 80
#ifndef SPEARDEMO
// Lump Start
ENDSCREEN11PIC, // 81
// Lump Start
ENDSCREEN12PIC, // 82
ENDSCREEN3PIC, // 83
ENDSCREEN4PIC, // 84
ENDSCREEN5PIC, // 85
ENDSCREEN6PIC, // 86
ENDSCREEN7PIC, // 87
ENDSCREEN8PIC, // 88
ENDSCREEN9PIC, // 89
#endif
STATUSBARPIC, // 90
PG13PIC, // 91
CREDITSPIC, // 92
#ifndef SPEARDEMO
// Lump Start
IDGUYS1PIC, // 93
IDGUYS2PIC, // 94
// Lump Start
COPYPROTTOPPIC, // 95
COPYPROTBOXPIC, // 96
BOSSPIC1PIC, // 97
BOSSPIC2PIC, // 98
BOSSPIC3PIC, // 99
BOSSPIC4PIC, // 100
#endif
// Lump Start
KNIFEPIC, // 101
GUNPIC, // 102
MACHINEGUNPIC, // 103
GATLINGGUNPIC, // 104
NOKEYPIC, // 105
GOLDKEYPIC, // 106
SILVERKEYPIC, // 107
N_BLANKPIC, // 108
N_0PIC, // 109
N_1PIC, // 110
N_2PIC, // 111
N_3PIC, // 112
N_4PIC, // 113
N_5PIC, // 114
N_6PIC, // 115
N_7PIC, // 116
N_8PIC, // 117
N_9PIC, // 118
FACE1APIC, // 119
FACE1BPIC, // 120
FACE1CPIC, // 121
FACE2APIC, // 122
FACE2BPIC, // 123
FACE2CPIC, // 124
FACE3APIC, // 125
FACE3BPIC, // 126
FACE3CPIC, // 127
FACE4APIC, // 128
FACE4BPIC, // 129
FACE4CPIC, // 130
FACE5APIC, // 131
FACE5BPIC, // 132
FACE5CPIC, // 133
FACE6APIC, // 134
FACE6BPIC, // 135
FACE6CPIC, // 136
FACE7APIC, // 137
FACE7BPIC, // 138
FACE7CPIC, // 139
FACE8APIC, // 140
GOTGATLINGPIC, // 141
GODMODEFACE1PIC, // 142
GODMODEFACE2PIC, // 143
GODMODEFACE3PIC, // 144
BJWAITING1PIC, // 145
BJWAITING2PIC, // 146
BJOUCHPIC, // 147
PAUSEDPIC, // 148
GETPSYCHEDPIC, // 149
TILE8, // 150
ORDERSCREEN, // 151
ERRORSCREEN, // 152
TITLEPALETTE, // 153
#ifndef SPEARDEMO
END1PALETTE, // 154
END2PALETTE, // 155
END3PALETTE, // 156
END4PALETTE, // 157
END5PALETTE, // 158
END6PALETTE, // 159
END7PALETTE, // 160
END8PALETTE, // 161
END9PALETTE, // 162
IDGUYSPALETTE, // 163
#endif
T_DEMO0, // 164
#ifndef SPEARDEMO
T_DEMO1, // 165
T_DEMO2, // 166
T_DEMO3, // 167
T_ENDART1, // 168
#endif
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define BACKDROP_LUMP_START 3
#define BACKDROP_LUMP_END 8
#define CONTROL_LUMP_START 9
#define CONTROL_LUMP_END 15
#define OPTIONS_LUMP_START 16
#define OPTIONS_LUMP_END 16
#define SOUND_LUMP_START 17
#define SOUND_LUMP_END 19
#define NEWGAME_LUMP_START 20
#define NEWGAME_LUMP_END 24
#define LOADSAVE_LUMP_START 25
#define LOADSAVE_LUMP_END 28
#define HIGHSCORES_LUMP_START 29
#define HIGHSCORES_LUMP_END 30
#define ENDGAME_LUMP_START 31
#define ENDGAME_LUMP_END 35
#define LEVELEND_LUMP_START L_GUYPIC
#define LEVELEND_LUMP_END L_BJWINSPIC
#define TITLESCREEN_LUMP_START TITLE1PIC
#define TITLESCREEN_LUMP_END TITLE2PIC
#define ENDGAME1_LUMP_START ENDSCREEN11PIC
#define ENDGAME1_LUMP_END ENDSCREEN11PIC
#define ENDGAME2_LUMP_START ENDSCREEN12PIC
#define ENDGAME2_LUMP_END ENDSCREEN12PIC
#define EASTEREGG_LUMP_START IDGUYS1PIC
#define EASTEREGG_LUMP_END IDGUYS2PIC
#define COPYPROT_LUMP_START COPYPROTTOPPIC
#define COPYPROT_LUMP_END BOSSPIC4PIC
#define LATCHPICS_LUMP_START KNIFEPIC
#define LATCHPICS_LUMP_END GETPSYCHEDPIC
//
// Amount of each data item
//
#define NUMCHUNKS ENUMEND
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS (GETPSYCHEDPIC - NUMFONT)
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 18
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM TILE8
#define STARTSPRITES TILE8
#define STARTTILE8 TILE8
#define STARTTILE8M ORDERSCREEN
#define STARTTILE16 ORDERSCREEN
#define STARTTILE16M ORDERSCREEN
#define STARTTILE32 ORDERSCREEN
#define STARTTILE32M ORDERSCREEN
#define STARTEXTERNS ORDERSCREEN
//
// Thank you for using IGRAB!
//

216
gfxv_wl6.h Normal file
View File

@ -0,0 +1,216 @@
//////////////////////////////////////
//
// Graphics .H file for .WL6
// IGRAB-ed on Wed Apr 13 06:58:44 1994
//
//////////////////////////////////////
typedef enum {
// Lump Start
H_BJPIC=3,
H_CASTLEPIC, // 4
H_BLAZEPIC, // 5
H_TOPWINDOWPIC, // 6
H_LEFTWINDOWPIC, // 7
H_RIGHTWINDOWPIC, // 8
H_BOTTOMINFOPIC, // 9
// Lump Start
C_OPTIONSPIC, // 10
C_CURSOR1PIC, // 11
C_CURSOR2PIC, // 12
C_NOTSELECTEDPIC, // 13
C_SELECTEDPIC, // 14
C_FXTITLEPIC, // 15
C_DIGITITLEPIC, // 16
C_MUSICTITLEPIC, // 17
C_MOUSELBACKPIC, // 18
C_BABYMODEPIC, // 19
C_EASYPIC, // 20
C_NORMALPIC, // 21
C_HARDPIC, // 22
C_LOADSAVEDISKPIC, // 23
C_DISKLOADING1PIC, // 24
C_DISKLOADING2PIC, // 25
C_CONTROLPIC, // 26
C_CUSTOMIZEPIC, // 27
C_LOADGAMEPIC, // 28
C_SAVEGAMEPIC, // 29
C_EPISODE1PIC, // 30
C_EPISODE2PIC, // 31
C_EPISODE3PIC, // 32
C_EPISODE4PIC, // 33
C_EPISODE5PIC, // 34
C_EPISODE6PIC, // 35
C_CODEPIC, // 36
C_TIMECODEPIC, // 37
C_LEVELPIC, // 38
C_NAMEPIC, // 39
C_SCOREPIC, // 40
C_JOY1PIC, // 41
C_JOY2PIC, // 42
// Lump Start
L_GUYPIC, // 43
L_COLONPIC, // 44
L_NUM0PIC, // 45
L_NUM1PIC, // 46
L_NUM2PIC, // 47
L_NUM3PIC, // 48
L_NUM4PIC, // 49
L_NUM5PIC, // 50
L_NUM6PIC, // 51
L_NUM7PIC, // 52
L_NUM8PIC, // 53
L_NUM9PIC, // 54
L_PERCENTPIC, // 55
L_APIC, // 56
L_BPIC, // 57
L_CPIC, // 58
L_DPIC, // 59
L_EPIC, // 60
L_FPIC, // 61
L_GPIC, // 62
L_HPIC, // 63
L_IPIC, // 64
L_JPIC, // 65
L_KPIC, // 66
L_LPIC, // 67
L_MPIC, // 68
L_NPIC, // 69
L_OPIC, // 70
L_PPIC, // 71
L_QPIC, // 72
L_RPIC, // 73
L_SPIC, // 74
L_TPIC, // 75
L_UPIC, // 76
L_VPIC, // 77
L_WPIC, // 78
L_XPIC, // 79
L_YPIC, // 80
L_ZPIC, // 81
L_EXPOINTPIC, // 82
L_APOSTROPHEPIC, // 83
L_GUY2PIC, // 84
L_BJWINSPIC, // 85
STATUSBARPIC, // 86
TITLEPIC, // 87
PG13PIC, // 88
CREDITSPIC, // 89
HIGHSCORESPIC, // 90
// Lump Start
KNIFEPIC, // 91
GUNPIC, // 92
MACHINEGUNPIC, // 93
GATLINGGUNPIC, // 94
NOKEYPIC, // 95
GOLDKEYPIC, // 96
SILVERKEYPIC, // 97
N_BLANKPIC, // 98
N_0PIC, // 99
N_1PIC, // 100
N_2PIC, // 101
N_3PIC, // 102
N_4PIC, // 103
N_5PIC, // 104
N_6PIC, // 105
N_7PIC, // 106
N_8PIC, // 107
N_9PIC, // 108
FACE1APIC, // 109
FACE1BPIC, // 110
FACE1CPIC, // 111
FACE2APIC, // 112
FACE2BPIC, // 113
FACE2CPIC, // 114
FACE3APIC, // 115
FACE3BPIC, // 116
FACE3CPIC, // 117
FACE4APIC, // 118
FACE4BPIC, // 119
FACE4CPIC, // 120
FACE5APIC, // 121
FACE5BPIC, // 122
FACE5CPIC, // 123
FACE6APIC, // 124
FACE6BPIC, // 125
FACE6CPIC, // 126
FACE7APIC, // 127
FACE7BPIC, // 128
FACE7CPIC, // 129
FACE8APIC, // 130
GOTGATLINGPIC, // 131
MUTANTBJPIC, // 132
PAUSEDPIC, // 133
GETPSYCHEDPIC, // 134
ORDERSCREEN=136,
ERRORSCREEN, // 137
T_HELPART, // 138
T_DEMO0, // 139
T_DEMO1, // 140
T_DEMO2, // 141
T_DEMO3, // 142
T_ENDART1, // 143
T_ENDART2, // 144
T_ENDART3, // 145
T_ENDART4, // 146
T_ENDART5, // 147
T_ENDART6, // 148
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define README_LUMP_START 3
#define README_LUMP_END 9
#define CONTROLS_LUMP_START 10
#define CONTROLS_LUMP_END 42
#define LEVELEND_LUMP_START 43
#define LEVELEND_LUMP_END 85
#define LATCHPICS_LUMP_START 91
#define LATCHPICS_LUMP_END 134
//
// Amount of each data item
//
#define NUMCHUNKS 149
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 132
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 13
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 135
#define STARTSPRITES 135
#define STARTTILE8 135
#define STARTTILE8M 136
#define STARTTILE16 136
#define STARTTILE16M 136
#define STARTTILE32 136
#define STARTTILE32M 136
#define STARTEXTERNS 136
//
// Thank you for using IGRAB!
//

51
gp2x.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef GP2X_H
#define GP2X_H
#include <SDL/SDL.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <fcntl.h>
#include <unistd.h>
#include "wl_def.h"
#define GP2X_BUTTON_UP (0)
#define GP2X_BUTTON_DOWN (4)
#define GP2X_BUTTON_LEFT (2)
#define GP2X_BUTTON_RIGHT (6)
#define GP2X_BUTTON_UPLEFT (1)
#define GP2X_BUTTON_UPRIGHT (7)
#define GP2X_BUTTON_DOWNLEFT (3)
#define GP2X_BUTTON_DOWNRIGHT (5)
#define GP2X_BUTTON_CLICK (18)
#define GP2X_BUTTON_A (12)
#define GP2X_BUTTON_B (13)
#define GP2X_BUTTON_X (15)
#define GP2X_BUTTON_Y (14)
#define GP2X_BUTTON_L (11)
#define GP2X_BUTTON_R (10)
#define GP2X_BUTTON_START (8)
#define GP2X_BUTTON_SELECT (9)
#define GP2X_BUTTON_VOLUP (16)
#define GP2X_BUTTON_VOLDOWN (17)
#define VOLUME_MIN 0
#define VOLUME_MAX 100
#define VOLUME_CHANGE_RATE 2
#define VOLUME_NOCHG 0
#define VOLUME_DOWN 1
#define VOLUME_UP 2
#define KEY_DOWN 1
#define KEY_UP 0
void GP2X_Init();
void GP2X_Shutdown();
void GP2X_StartMMUHack();
void GP2X_AdjustVolume( int direction );
void GP2X_ButtonDown( int button );
void GP2X_ButtonUp( int button );
void Screenshot( void );
void SetKeyboard( unsigned int key, int press );
#endif // GP2X_H

1112
id_ca.cpp Normal file

File diff suppressed because it is too large Load Diff

60
id_ca.h Normal file
View File

@ -0,0 +1,60 @@
#ifndef __ID_CA__
#define __ID_CA__
//===========================================================================
#define NUMMAPS 60
#ifdef USE_FLOORCEILINGTEX
#define MAPPLANES 3
#else
#define MAPPLANES 2
#endif
#define UNCACHEGRCHUNK(chunk) {if(grsegs[chunk]) {free(grsegs[chunk]); grsegs[chunk]=NULL;}}
#define UNCACHEAUDIOCHUNK(chunk) {if(audiosegs[chunk]) {free(audiosegs[chunk]); audiosegs[chunk]=NULL;}}
//===========================================================================
typedef struct
{
int32_t planestart[3];
word planelength[3];
word width,height;
char name[16];
} maptype;
//===========================================================================
extern int mapon;
extern word *mapsegs[MAPPLANES];
extern byte *audiosegs[NUMSNDCHUNKS];
extern byte *grsegs[NUMCHUNKS];
extern char extension[5];
extern char graphext[5];
extern char audioext[5];
//===========================================================================
boolean CA_LoadFile (const char *filename, memptr *ptr);
boolean CA_WriteFile (const char *filename, void *ptr, int32_t length);
int32_t CA_RLEWCompress (word *source, int32_t length, word *dest, word rlewtag);
void CA_RLEWexpand (word *source, word *dest, int32_t length, word rlewtag);
void CA_Startup (void);
void CA_Shutdown (void);
int32_t CA_CacheAudioChunk (int chunk);
void CA_LoadAllSounds (void);
void CA_CacheGrChunk (int chunk);
void CA_CacheMap (int mapnum);
void CA_CacheScreen (int chunk);
void CA_CannotOpen(const char *name);
#endif

664
id_in.cpp Normal file
View File

@ -0,0 +1,664 @@
//
// ID Engine
// ID_IN.c - Input Manager
// v1.0d1
// By Jason Blochowiak
//
//
// This module handles dealing with the various input devices
//
// Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),
// User Mgr (for command line parms)
//
// Globals:
// LastScan - The keyboard scan code of the last key pressed
// LastASCII - The ASCII value of the last key pressed
// DEBUG - there are more globals
//
#include "wl_def.h"
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
//
// configuration variables
//
boolean MousePresent;
boolean forcegrabmouse;
// Global variables
volatile boolean Keyboard[SDLK_LAST];
volatile boolean Paused;
volatile char LastASCII;
volatile ScanCode LastScan;
//KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};
static KeyboardDef KbdDefs = {
sc_Control, // button0
sc_Alt, // button1
sc_Home, // upleft
sc_UpArrow, // up
sc_PgUp, // upright
sc_LeftArrow, // left
sc_RightArrow, // right
sc_End, // downleft
sc_DownArrow, // down
sc_PgDn // downright
};
static SDL_Joystick *Joystick;
int JoyNumButtons;
static int JoyNumHats;
static bool GrabInput = false;
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
byte ASCIINames[] = // Unshifted ASCII for scan codes // TODO: keypad
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,8 ,9 ,0 ,0 ,0 ,13 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,27 ,0 ,0 ,0 , // 1
' ',0 ,0 ,0 ,0 ,0 ,0 ,39 ,0 ,0 ,'*','+',',','-','.','/', // 2
'0','1','2','3','4','5','6','7','8','9',0 ,';',0 ,'=',0 ,0 , // 3
'`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', // 4
'p','q','r','s','t','u','v','w','x','y','z','[',92 ,']',0 ,0 , // 5
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
};
byte ShiftNames[] = // Shifted ASCII for scan codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,8 ,9 ,0 ,0 ,0 ,13 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,27 ,0 ,0 ,0 , // 1
' ',0 ,0 ,0 ,0 ,0 ,0 ,34 ,0 ,0 ,'*','+','<','_','>','?', // 2
')','!','@','#','$','%','^','&','*','(',0 ,':',0 ,'+',0 ,0 , // 3
'~','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', // 4
'P','Q','R','S','T','U','V','W','X','Y','Z','{','|','}',0 ,0 , // 5
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
};
byte SpecialNames[] = // ASCII for 0xe0 prefixed codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,13 ,0 ,0 ,0 , // 1
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 2
0 ,0 ,0 ,0 ,0 ,'/',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 3
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 4
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
};
static boolean IN_Started;
static Direction DirTable[] = // Quick lookup for total direction
{
dir_NorthWest, dir_North, dir_NorthEast,
dir_West, dir_None, dir_East,
dir_SouthWest, dir_South, dir_SouthEast
};
///////////////////////////////////////////////////////////////////////////
//
// INL_GetMouseButtons() - Gets the status of the mouse buttons from the
// mouse driver
//
///////////////////////////////////////////////////////////////////////////
static int
INL_GetMouseButtons(void)
{
int buttons = SDL_GetMouseState(NULL, NULL);
int middlePressed = buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE);
int rightPressed = buttons & SDL_BUTTON(SDL_BUTTON_RIGHT);
buttons &= ~(SDL_BUTTON(SDL_BUTTON_MIDDLE) | SDL_BUTTON(SDL_BUTTON_RIGHT));
if(middlePressed) buttons |= 1 << 2;
if(rightPressed) buttons |= 1 << 1;
return buttons;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyDelta() - Returns the relative movement of the specified
// joystick (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void IN_GetJoyDelta(int *dx,int *dy)
{
if(!Joystick)
{
*dx = *dy = 0;
return;
}
SDL_JoystickUpdate();
#ifdef _arch_dreamcast
int x = 0;
int y = 0;
#else
int x = SDL_JoystickGetAxis(Joystick, 0) >> 8;
int y = SDL_JoystickGetAxis(Joystick, 1) >> 8;
#endif
if(param_joystickhat != -1)
{
uint8_t hatState = SDL_JoystickGetHat(Joystick, param_joystickhat);
if(hatState & SDL_HAT_RIGHT)
x += 127;
else if(hatState & SDL_HAT_LEFT)
x -= 127;
if(hatState & SDL_HAT_DOWN)
y += 127;
else if(hatState & SDL_HAT_UP)
y -= 127;
if(x < -128) x = -128;
else if(x > 127) x = 127;
if(y < -128) y = -128;
else if(y > 127) y = 127;
}
*dx = x;
*dy = y;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyFineDelta() - Returns the relative movement of the specified
// joystick without dividing the results by 256 (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void IN_GetJoyFineDelta(int *dx, int *dy)
{
if(!Joystick)
{
*dx = 0;
*dy = 0;
return;
}
SDL_JoystickUpdate();
int x = SDL_JoystickGetAxis(Joystick, 0);
int y = SDL_JoystickGetAxis(Joystick, 1);
if(x < -128) x = -128;
else if(x > 127) x = 127;
if(y < -128) y = -128;
else if(y > 127) y = 127;
*dx = x;
*dy = y;
}
/*
===================
=
= IN_JoyButtons
=
===================
*/
int IN_JoyButtons()
{
if(!Joystick) return 0;
SDL_JoystickUpdate();
int res = 0;
for(int i = 0; i < JoyNumButtons && i < 32; i++)
res |= SDL_JoystickGetButton(Joystick, i) << i;
return res;
}
boolean IN_JoyPresent()
{
return Joystick != NULL;
}
static void processEvent(SDL_Event *event)
{
switch (event->type)
{
// exit if the window is closed
case SDL_QUIT:
Quit(NULL);
// check for keypresses
case SDL_KEYDOWN:
{
if(event->key.keysym.sym==SDLK_SCROLLOCK || event->key.keysym.sym==SDLK_F12)
{
GrabInput = !GrabInput;
SDL_WM_GrabInput(GrabInput ? SDL_GRAB_ON : SDL_GRAB_OFF);
return;
}
LastScan = event->key.keysym.sym;
SDLMod mod = SDL_GetModState();
if(Keyboard[sc_Alt])
{
if(LastScan==SDLK_F4)
Quit(NULL);
}
if(LastScan == SDLK_KP_ENTER) LastScan = SDLK_RETURN;
else if(LastScan == SDLK_RSHIFT) LastScan = SDLK_LSHIFT;
else if(LastScan == SDLK_RALT) LastScan = SDLK_LALT;
else if(LastScan == SDLK_RCTRL) LastScan = SDLK_LCTRL;
else
{
if((mod & KMOD_NUM) == 0)
{
switch(LastScan)
{
case SDLK_KP2: LastScan = SDLK_DOWN; break;
case SDLK_KP4: LastScan = SDLK_LEFT; break;
case SDLK_KP6: LastScan = SDLK_RIGHT; break;
case SDLK_KP8: LastScan = SDLK_UP; break;
}
}
}
int sym = LastScan;
if(sym >= 'a' && sym <= 'z')
sym -= 32; // convert to uppercase
if(mod & (KMOD_SHIFT | KMOD_CAPS))
{
if(sym < lengthof(ShiftNames) && ShiftNames[sym])
LastASCII = ShiftNames[sym];
}
else
{
if(sym < lengthof(ASCIINames) && ASCIINames[sym])
LastASCII = ASCIINames[sym];
}
if(LastScan<SDLK_LAST)
Keyboard[LastScan] = 1;
if(LastScan == SDLK_PAUSE)
Paused = true;
break;
}
case SDL_KEYUP:
{
int key = event->key.keysym.sym;
if(key == SDLK_KP_ENTER) key = SDLK_RETURN;
else if(key == SDLK_RSHIFT) key = SDLK_LSHIFT;
else if(key == SDLK_RALT) key = SDLK_LALT;
else if(key == SDLK_RCTRL) key = SDLK_LCTRL;
else
{
if((SDL_GetModState() & KMOD_NUM) == 0)
{
switch(key)
{
case SDLK_KP2: key = SDLK_DOWN; break;
case SDLK_KP4: key = SDLK_LEFT; break;
case SDLK_KP6: key = SDLK_RIGHT; break;
case SDLK_KP8: key = SDLK_UP; break;
}
}
}
if(key<SDLK_LAST)
Keyboard[key] = 0;
break;
}
#if defined(GP2X)
case SDL_JOYBUTTONDOWN:
GP2X_ButtonDown(event->jbutton.button);
break;
case SDL_JOYBUTTONUP:
GP2X_ButtonUp(event->jbutton.button);
break;
#endif
}
}
void IN_WaitAndProcessEvents()
{
SDL_Event event;
if(!SDL_WaitEvent(&event)) return;
do
{
processEvent(&event);
}
while(SDL_PollEvent(&event));
}
void IN_ProcessEvents()
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
processEvent(&event);
}
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Startup() - Starts up the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Startup(void)
{
if (IN_Started)
return;
IN_ClearKeysDown();
if(param_joystickindex >= 0 && param_joystickindex < SDL_NumJoysticks())
{
Joystick = SDL_JoystickOpen(param_joystickindex);
if(Joystick)
{
JoyNumButtons = SDL_JoystickNumButtons(Joystick);
if(JoyNumButtons > 32) JoyNumButtons = 32; // only up to 32 buttons are supported
JoyNumHats = SDL_JoystickNumHats(Joystick);
if(param_joystickhat < -1 || param_joystickhat >= JoyNumHats)
Quit("The joystickhat param must be between 0 and %i!", JoyNumHats - 1);
}
}
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
if(fullscreen || forcegrabmouse)
{
GrabInput = true;
SDL_WM_GrabInput(SDL_GRAB_ON);
}
// I didn't find a way to ask libSDL whether a mouse is present, yet...
#if defined(GP2X)
MousePresent = false;
#elif defined(_arch_dreamcast)
MousePresent = DC_MousePresent();
#else
MousePresent = true;
#endif
IN_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Shutdown() - Shuts down the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Shutdown(void)
{
if (!IN_Started)
return;
if(Joystick)
SDL_JoystickClose(Joystick);
IN_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ClearKeysDown() - Clears the keyboard array
//
///////////////////////////////////////////////////////////////////////////
void
IN_ClearKeysDown(void)
{
LastScan = sc_None;
LastASCII = key_None;
memset ((void *) Keyboard,0,sizeof(Keyboard));
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ReadControl() - Reads the device associated with the specified
// player and fills in the control info struct
//
///////////////////////////////////////////////////////////////////////////
void
IN_ReadControl(int player,ControlInfo *info)
{
word buttons;
int dx,dy;
Motion mx,my;
dx = dy = 0;
mx = my = motion_None;
buttons = 0;
IN_ProcessEvents();
if (Keyboard[KbdDefs.upleft])
mx = motion_Left,my = motion_Up;
else if (Keyboard[KbdDefs.upright])
mx = motion_Right,my = motion_Up;
else if (Keyboard[KbdDefs.downleft])
mx = motion_Left,my = motion_Down;
else if (Keyboard[KbdDefs.downright])
mx = motion_Right,my = motion_Down;
if (Keyboard[KbdDefs.up])
my = motion_Up;
else if (Keyboard[KbdDefs.down])
my = motion_Down;
if (Keyboard[KbdDefs.left])
mx = motion_Left;
else if (Keyboard[KbdDefs.right])
mx = motion_Right;
if (Keyboard[KbdDefs.button0])
buttons += 1 << 0;
if (Keyboard[KbdDefs.button1])
buttons += 1 << 1;
dx = mx * 127;
dy = my * 127;
info->x = dx;
info->xaxis = mx;
info->y = dy;
info->yaxis = my;
info->button0 = (buttons & (1 << 0)) != 0;
info->button1 = (buttons & (1 << 1)) != 0;
info->button2 = (buttons & (1 << 2)) != 0;
info->button3 = (buttons & (1 << 3)) != 0;
info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
}
///////////////////////////////////////////////////////////////////////////
//
// IN_WaitForKey() - Waits for a scan code, then clears LastScan and
// returns the scan code
//
///////////////////////////////////////////////////////////////////////////
ScanCode
IN_WaitForKey(void)
{
ScanCode result;
while ((result = LastScan)==0)
IN_WaitAndProcessEvents();
LastScan = 0;
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and
// returns the ASCII value
//
///////////////////////////////////////////////////////////////////////////
char
IN_WaitForASCII(void)
{
char result;
while ((result = LastASCII)==0)
IN_WaitAndProcessEvents();
LastASCII = '\0';
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Ack() - waits for a button or key press. If a button is down, upon
// calling, it must be released for it to be recognized
//
///////////////////////////////////////////////////////////////////////////
boolean btnstate[NUMBUTTONS];
void IN_StartAck(void)
{
IN_ProcessEvents();
//
// get initial state of everything
//
IN_ClearKeysDown();
memset(btnstate, 0, sizeof(btnstate));
int buttons = IN_JoyButtons() << 4;
if(MousePresent)
buttons |= IN_MouseButtons();
for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
if(buttons & 1)
btnstate[i] = true;
}
boolean IN_CheckAck (void)
{
IN_ProcessEvents();
//
// see if something has been pressed
//
if(LastScan)
return true;
int buttons = IN_JoyButtons() << 4;
if(MousePresent)
buttons |= IN_MouseButtons();
for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
{
if(buttons & 1)
{
if(!btnstate[i])
{
// Wait until button has been released
do
{
IN_WaitAndProcessEvents();
buttons = IN_JoyButtons() << 4;
if(MousePresent)
buttons |= IN_MouseButtons();
}
while(buttons & (1 << i));
return true;
}
}
else
btnstate[i] = false;
}
return false;
}
void IN_Ack (void)
{
IN_StartAck ();
do
{
IN_WaitAndProcessEvents();
}
while(!IN_CheckAck ());
}
///////////////////////////////////////////////////////////////////////////
//
// IN_UserInput() - Waits for the specified delay time (in ticks) or the
// user pressing a key or a mouse button. If the clear flag is set, it
// then either clears the key or waits for the user to let the mouse
// button up.
//
///////////////////////////////////////////////////////////////////////////
boolean IN_UserInput(longword delay)
{
longword lasttime;
lasttime = GetTimeCount();
IN_StartAck ();
do
{
IN_ProcessEvents();
if (IN_CheckAck())
return true;
SDL_Delay(5);
} while (GetTimeCount() - lasttime < delay);
return(false);
}
//===========================================================================
/*
===================
=
= IN_MouseButtons
=
===================
*/
int IN_MouseButtons (void)
{
if (MousePresent)
return INL_GetMouseButtons();
else
return 0;
}
bool IN_IsInputGrabbed()
{
return GrabInput;
}
void IN_CenterMouse()
{
SDL_WarpMouse(screenWidth / 2, screenHeight / 2);
}

184
id_in.h Normal file
View File

@ -0,0 +1,184 @@
//
// ID Engine
// ID_IN.h - Header file for Input Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_IN__
#define __ID_IN__
#ifdef __DEBUG__
#define __DEBUG_InputMgr__
#endif
typedef int ScanCode;
#define sc_None 0
#define sc_Bad 0xff
#define sc_Return SDLK_RETURN
#define sc_Enter sc_Return
#define sc_Escape SDLK_ESCAPE
#define sc_Space SDLK_SPACE
#define sc_BackSpace SDLK_BACKSPACE
#define sc_Tab SDLK_TAB
#define sc_Alt SDLK_LALT
#define sc_Control SDLK_LCTRL
#define sc_CapsLock SDLK_CAPSLOCK
#define sc_LShift SDLK_LSHIFT
#define sc_RShift SDLK_RSHIFT
#define sc_UpArrow SDLK_UP
#define sc_DownArrow SDLK_DOWN
#define sc_LeftArrow SDLK_LEFT
#define sc_RightArrow SDLK_RIGHT
#define sc_Insert SDLK_INSERT
#define sc_Delete SDLK_DELETE
#define sc_Home SDLK_HOME
#define sc_End SDLK_END
#define sc_PgUp SDLK_PAGEUP
#define sc_PgDn SDLK_PAGEDOWN
#define sc_F1 SDLK_F1
#define sc_F2 SDLK_F2
#define sc_F3 SDLK_F3
#define sc_F4 SDLK_F4
#define sc_F5 SDLK_F5
#define sc_F6 SDLK_F6
#define sc_F7 SDLK_F7
#define sc_F8 SDLK_F8
#define sc_F9 SDLK_F9
#define sc_F10 SDLK_F10
#define sc_F11 SDLK_F11
#define sc_F12 SDLK_F12
#define sc_ScrollLock SDLK_SCROLLOCK
#define sc_PrintScreen SDLK_PRINT
#define sc_1 SDLK_1
#define sc_2 SDLK_2
#define sc_3 SDLK_3
#define sc_4 SDLK_4
#define sc_5 SDLK_5
#define sc_6 SDLK_6
#define sc_7 SDLK_7
#define sc_8 SDLK_8
#define sc_9 SDLK_9
#define sc_0 SDLK_0
#define sc_A SDLK_a
#define sc_B SDLK_b
#define sc_C SDLK_c
#define sc_D SDLK_d
#define sc_E SDLK_e
#define sc_F SDLK_f
#define sc_G SDLK_g
#define sc_H SDLK_h
#define sc_I SDLK_i
#define sc_J SDLK_j
#define sc_K SDLK_k
#define sc_L SDLK_l
#define sc_M SDLK_m
#define sc_N SDLK_n
#define sc_O SDLK_o
#define sc_P SDLK_p
#define sc_Q SDLK_q
#define sc_R SDLK_r
#define sc_S SDLK_s
#define sc_T SDLK_t
#define sc_U SDLK_u
#define sc_V SDLK_v
#define sc_W SDLK_w
#define sc_X SDLK_x
#define sc_Y SDLK_y
#define sc_Z SDLK_z
#define key_None 0
typedef enum {
demo_Off,demo_Record,demo_Playback,demo_PlayDone
} Demo;
typedef enum {
ctrl_Keyboard,
ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
ctrl_Joystick,
ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
ctrl_Mouse
} ControlType;
typedef enum {
motion_Left = -1,motion_Up = -1,
motion_None = 0,
motion_Right = 1,motion_Down = 1
} Motion;
typedef enum {
dir_North,dir_NorthEast,
dir_East,dir_SouthEast,
dir_South,dir_SouthWest,
dir_West,dir_NorthWest,
dir_None
} Direction;
typedef struct {
boolean button0,button1,button2,button3;
short x,y;
Motion xaxis,yaxis;
Direction dir;
} CursorInfo;
typedef CursorInfo ControlInfo;
typedef struct {
ScanCode button0,button1,
upleft, up, upright,
left, right,
downleft, down, downright;
} KeyboardDef;
typedef struct {
word joyMinX,joyMinY,
threshMinX,threshMinY,
threshMaxX,threshMaxY,
joyMaxX,joyMaxY,
joyMultXL,joyMultYL,
joyMultXH,joyMultYH;
} JoystickDef;
// Global variables
extern volatile boolean Keyboard[];
extern boolean MousePresent;
extern volatile boolean Paused;
extern volatile char LastASCII;
extern volatile ScanCode LastScan;
extern int JoyNumButtons;
extern boolean forcegrabmouse;
// Function prototypes
#define IN_KeyDown(code) (Keyboard[(code)])
#define IN_ClearKey(code) {Keyboard[code] = false;\
if (code == LastScan) LastScan = sc_None;}
// DEBUG - put names in prototypes
extern void IN_Startup(void),IN_Shutdown(void);
extern void IN_ClearKeysDown(void);
extern void IN_ReadControl(int,ControlInfo *);
extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
extern void IN_SetupJoy(word joy,word minx,word maxx,
word miny,word maxy);
extern void IN_StopDemo(void),IN_FreeDemoBuffer(void),
IN_Ack(void);
extern boolean IN_UserInput(longword delay);
extern char IN_WaitForASCII(void);
extern ScanCode IN_WaitForKey(void);
extern word IN_GetJoyButtonsDB(word joy);
extern const char *IN_GetScanName(ScanCode);
void IN_WaitAndProcessEvents();
void IN_ProcessEvents();
int IN_MouseButtons (void);
boolean IN_JoyPresent();
void IN_SetJoyCurrent(int joyIndex);
int IN_JoyButtons (void);
void IN_GetJoyDelta(int *dx,int *dy);
void IN_GetJoyFineDelta(int *dx, int *dy);
void IN_StartAck(void);
boolean IN_CheckAck (void);
bool IN_IsInputGrabbed();
void IN_CenterMouse();
#endif

125
id_pm.cpp Normal file
View File

@ -0,0 +1,125 @@
#include "wl_def.h"
int ChunksInFile;
int PMSpriteStart;
int PMSoundStart;
bool PMSoundInfoPagePadded = false;
// holds the whole VSWAP
uint32_t *PMPageData;
size_t PMPageDataSize;
// ChunksInFile+1 pointers to page starts.
// The last pointer points one byte after the last page.
uint8_t **PMPages;
void PM_Startup()
{
char fname[13] = "vswap.";
strcat(fname,extension);
FILE *file = fopen(fname,"rb");
if(!file)
CA_CannotOpen(fname);
ChunksInFile = 0;
fread(&ChunksInFile, sizeof(word), 1, file);
PMSpriteStart = 0;
fread(&PMSpriteStart, sizeof(word), 1, file);
PMSoundStart = 0;
fread(&PMSoundStart, sizeof(word), 1, file);
uint32_t* pageOffsets = (uint32_t *) malloc((ChunksInFile + 1) * sizeof(int32_t));
CHECKMALLOCRESULT(pageOffsets);
fread(pageOffsets, sizeof(uint32_t), ChunksInFile, file);
word *pageLengths = (word *) malloc(ChunksInFile * sizeof(word));
CHECKMALLOCRESULT(pageLengths);
fread(pageLengths, sizeof(word), ChunksInFile, file);
fseek(file, 0, SEEK_END);
long fileSize = ftell(file);
long pageDataSize = fileSize - pageOffsets[0];
if(pageDataSize > (size_t) -1)
Quit("The page file \"%s\" is too large!", fname);
pageOffsets[ChunksInFile] = fileSize;
uint32_t dataStart = pageOffsets[0];
int i;
// Check that all pageOffsets are valid
for(i = 0; i < ChunksInFile; i++)
{
if(!pageOffsets[i]) continue; // sparse page
if(pageOffsets[i] < dataStart || pageOffsets[i] >= (size_t) fileSize)
Quit("Illegal page offset for page %i: %u (filesize: %u)",
i, pageOffsets[i], fileSize);
}
// Calculate total amount of padding needed for sprites and sound info page
int alignPadding = 0;
for(i = PMSpriteStart; i < PMSoundStart; i++)
{
if(!pageOffsets[i]) continue; // sparse page
uint32_t offs = pageOffsets[i] - dataStart + alignPadding;
if(offs & 1)
alignPadding++;
}
if((pageOffsets[ChunksInFile - 1] - dataStart + alignPadding) & 1)
alignPadding++;
PMPageDataSize = (size_t) pageDataSize + alignPadding;
PMPageData = (uint32_t *) malloc(PMPageDataSize);
CHECKMALLOCRESULT(PMPageData);
PMPages = (uint8_t **) malloc((ChunksInFile + 1) * sizeof(uint8_t *));
CHECKMALLOCRESULT(PMPages);
// Load pages and initialize PMPages pointers
uint8_t *ptr = (uint8_t *) PMPageData;
for(i = 0; i < ChunksInFile; i++)
{
if(i >= PMSpriteStart && i < PMSoundStart || i == ChunksInFile - 1)
{
size_t offs = ptr - (uint8_t *) PMPageData;
// pad with zeros to make it 2-byte aligned
if(offs & 1)
{
*ptr++ = 0;
if(i == ChunksInFile - 1) PMSoundInfoPagePadded = true;
}
}
PMPages[i] = ptr;
if(!pageOffsets[i])
continue; // sparse page
// Use specified page length, when next page is sparse page.
// Otherwise, calculate size from the offset difference between this and the next page.
uint32_t size;
if(!pageOffsets[i + 1]) size = pageLengths[i];
else size = pageOffsets[i + 1] - pageOffsets[i];
fseek(file, pageOffsets[i], SEEK_SET);
fread(ptr, 1, size, file);
ptr += size;
}
// last page points after page buffer
PMPages[ChunksInFile] = ptr;
free(pageLengths);
free(pageOffsets);
fclose(file);
}
void PM_Shutdown()
{
free(PMPages);
free(PMPageData);
}

58
id_pm.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef __ID_PM__
#define __ID_PM__
#ifdef USE_HIRES
#define PMPageSize 16384
#else
#define PMPageSize 4096
#endif
extern int ChunksInFile;
extern int PMSpriteStart;
extern int PMSoundStart;
extern bool PMSoundInfoPagePadded;
// ChunksInFile+1 pointers to page starts.
// The last pointer points one byte after the last page.
extern uint8_t **PMPages;
void PM_Startup();
void PM_Shutdown();
static inline uint32_t PM_GetPageSize(int page)
{
if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
return (uint32_t) (PMPages[page + 1] - PMPages[page]);
}
static inline uint8_t *PM_GetPage(int page)
{
if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPage: Tried to access illegal page: %i", page);
return PMPages[page];
}
static inline uint8_t *PM_GetEnd()
{
return PMPages[ChunksInFile];
}
static inline byte *PM_GetTexture(int wallpic)
{
return PM_GetPage(wallpic);
}
static inline uint16_t *PM_GetSprite(int shapenum)
{
// correct alignment is enforced by PM_Startup()
return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
}
static inline byte *PM_GetSound(int soundpagenum)
{
return PM_GetPage(PMSoundStart + soundpagenum);
}
#endif

1423
id_sd.cpp Normal file

File diff suppressed because it is too large Load Diff

156
id_sd.h Normal file
View File

@ -0,0 +1,156 @@
//
// ID Engine
// ID_SD.h - Sound Manager Header
// Version for Wolfenstein
// By Jason Blochowiak
//
#ifndef __ID_SD__
#define __ID_SD__
#define alOut(n,b) YM3812Write(0, n, b)
#define TickBase 70 // 70Hz per tick - used as a base for timer 0
typedef enum
{
sdm_Off,
sdm_PC,sdm_AdLib,
} SDMode;
typedef enum
{
smm_Off,smm_AdLib
} SMMode;
typedef enum
{
sds_Off,sds_PC,sds_SoundBlaster
} SDSMode;
typedef struct
{
longword length;
word priority;
} SoundCommon;
#define ORIG_SOUNDCOMMON_SIZE 6
// PC Sound stuff
#define pcTimer 0x42
#define pcTAccess 0x43
#define pcSpeaker 0x61
#define pcSpkBits 3
typedef struct
{
SoundCommon common;
byte data[1];
} PCSound;
// Register addresses
// Operator stuff
#define alChar 0x20
#define alScale 0x40
#define alAttack 0x60
#define alSus 0x80
#define alWave 0xe0
// Channel stuff
#define alFreqL 0xa0
#define alFreqH 0xb0
#define alFeedCon 0xc0
// Global stuff
#define alEffects 0xbd
typedef struct
{
byte mChar,cChar,
mScale,cScale,
mAttack,cAttack,
mSus,cSus,
mWave,cWave,
nConn,
// These are only for Muse - these bytes are really unused
voice,
mode;
byte unused[3];
} Instrument;
#define ORIG_INSTRUMENT_SIZE 16
typedef struct
{
SoundCommon common;
Instrument inst;
byte block;
byte data[1];
} AdLibSound;
#define ORIG_ADLIBSOUND_SIZE (ORIG_SOUNDCOMMON_SIZE + ORIG_INSTRUMENT_SIZE + 2)
//
// Sequencing stuff
//
#define sqMaxTracks 10
typedef struct
{
word length;
word values[1];
} MusicGroup;
typedef struct
{
int valid;
fixed globalsoundx, globalsoundy;
} globalsoundpos;
extern globalsoundpos channelSoundPos[];
// Global variables
extern boolean AdLibPresent,
SoundBlasterPresent,
SoundPositioned;
extern SDMode SoundMode;
extern SDSMode DigiMode;
extern SMMode MusicMode;
extern int DigiMap[];
extern int DigiChannel[];
#define GetTimeCount() ((SDL_GetTicks()*7)/100)
inline void Delay(int wolfticks)
{
if(wolfticks>0) SDL_Delay(wolfticks * 100 / 7);
}
// Function prototypes
extern void SD_Startup(void),
SD_Shutdown(void);
extern int SD_GetChannelForDigi(int which);
extern void SD_PositionSound(int leftvol,int rightvol);
extern boolean SD_PlaySound(soundnames sound);
extern void SD_SetPosition(int channel, int leftvol,int rightvol);
extern void SD_StopSound(void),
SD_WaitSoundDone(void);
extern void SD_StartMusic(int chunk);
extern void SD_ContinueMusic(int chunk, int startoffs);
extern void SD_MusicOn(void),
SD_FadeOutMusic(void);
extern int SD_MusicOff(void);
extern boolean SD_MusicPlaying(void);
extern boolean SD_SetSoundMode(SDMode mode);
extern boolean SD_SetMusicMode(SMMode mode);
extern word SD_SoundPlaying(void);
extern void SD_SetDigiDevice(SDSMode);
extern void SD_PrepareSound(int which);
extern int SD_PlayDigitized(word which,int leftpos,int rightpos);
extern void SD_StopDigitized(void);
#endif

101
id_us.h Normal file
View File

@ -0,0 +1,101 @@
//
// ID Engine
// ID_US.h - Header file for the User Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_US__
#define __ID_US__
#ifdef __DEBUG__
#define __DEBUG_UserMgr__
#endif
//#define HELPTEXTLINKED
#define MaxX 320
#define MaxY 200
#define MaxHelpLines 500
#define MaxHighName 57
#define MaxScores 7
typedef struct
{
char name[MaxHighName + 1];
int32_t score;
word completed,episode;
} HighScore;
#define MaxGameName 32
#define MaxSaveGames 6
typedef struct
{
char signature[4];
word *oldtest;
boolean present;
char name[MaxGameName + 1];
} SaveGame;
#define MaxString 128 // Maximum input string size
typedef struct
{
int x,y,
w,h,
px,py;
} WindowRec; // Record used to save & restore screen windows
extern boolean ingame, // Set by game code if a game is in progress
loadedgame; // Set if the current game was loaded
extern word PrintX,PrintY; // Current printing location in the window
extern word WindowX,WindowY,// Current location of window
WindowW,WindowH;// Current size of window
extern void (*USL_MeasureString)(const char *,word *,word *);
extern void (*USL_DrawString)(const char *);
extern boolean (*USL_SaveGame)(int),(*USL_LoadGame)(int);
extern void (*USL_ResetGame)(void);
extern SaveGame Games[MaxSaveGames];
extern HighScore Scores[];
#define US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;}
void US_Startup(void);
void US_Shutdown(void);
void US_TextScreen(void),
US_UpdateTextScreen(void),
US_FinishTextScreen(void);
void US_DrawWindow(word x,word y,word w,word h);
void US_CenterWindow(word,word);
void US_SaveWindow(WindowRec *win),
US_RestoreWindow(WindowRec *win);
void US_ClearWindow(void);
void US_SetPrintRoutines(void (*measure)(const char *,word *,word *),
void (*print)(const char *));
void US_PrintCentered(const char *s),
US_CPrint(const char *s),
US_CPrintLine(const char *s),
US_Print(const char *s);
void US_Printf(const char *formatStr, ...);
void US_CPrintf(const char *formatStr, ...);
void US_PrintUnsigned(longword n);
void US_PrintSigned(int32_t n);
void US_StartCursor(void),
US_ShutCursor(void);
void US_CheckHighScore(int32_t score,word other);
void US_DisplayHighScores(int which);
extern boolean US_UpdateCursor(void);
boolean US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
int maxchars,int maxwidth);
void USL_PrintInCenter(const char *s,Rect r);
char *USL_GiveSaveName(word game);
void US_InitRndT(int randomize);
int US_RndT();
#endif

789
id_us_1.cpp Normal file
View File

@ -0,0 +1,789 @@
//
// ID Engine
// ID_US_1.c - User Manager - General routines
// v1.1d1
// By Jason Blochowiak
// Hacked up for Catacomb 3D
//
//
// This module handles dealing with user input & feedback
//
// Depends on: Input Mgr, View Mgr, some variables from the Sound, Caching,
// and Refresh Mgrs, Memory Mgr for background save/restore
//
// Globals:
// ingame - Flag set by game indicating if a game is in progress
// loadedgame - Flag set if a game was loaded
// PrintX, PrintY - Where the User Mgr will print (global coords)
// WindowX,WindowY,WindowW,WindowH - The dimensions of the current
// window
//
#include "wl_def.h"
#pragma hdrstop
#if _MSC_VER == 1200 // Visual C++ 6
#define vsnprintf _vsnprintf
#endif
// Global variables
word PrintX,PrintY;
word WindowX,WindowY,WindowW,WindowH;
// Internal variables
#define ConfigVersion 1
static boolean US_Started;
void (*USL_MeasureString)(const char *,word *,word *) = VW_MeasurePropString;
void (*USL_DrawString)(const char *) = VWB_DrawPropString;
SaveGame Games[MaxSaveGames];
HighScore Scores[MaxScores] =
{
{"id software-'92",10000,1},
{"Adrian Carmack",10000,1},
{"John Carmack",10000,1},
{"Kevin Cloud",10000,1},
{"Tom Hall",10000,1},
{"John Romero",10000,1},
{"Jay Wilbur",10000,1},
};
int rndindex = 0;
static byte rndtable[] = {
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 };
// Internal routines
// Public routines
///////////////////////////////////////////////////////////////////////////
//
// US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void US_Startup()
{
if (US_Started)
return;
US_InitRndT(true); // Initialize the random number generator
US_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// US_Shutdown() - Shuts down the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Shutdown(void)
{
if (!US_Started)
return;
US_Started = false;
}
// Window/Printing routines
///////////////////////////////////////////////////////////////////////////
//
// US_SetPrintRoutines() - Sets the routines used to measure and print
// from within the User Mgr. Primarily provided to allow switching
// between masked and non-masked fonts
//
///////////////////////////////////////////////////////////////////////////
void
US_SetPrintRoutines(void (*measure)(const char *,word *,word *),
void (*print)(const char *))
{
USL_MeasureString = measure;
USL_DrawString = print;
}
///////////////////////////////////////////////////////////////////////////
//
// US_Print() - Prints a string in the current window. Newlines are
// supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_Print(const char *sorg)
{
char c;
char *sstart = strdup(sorg);
char *s = sstart;
char *se;
word w,h;
while (*s)
{
se = s;
while ((c = *se)!=0 && (c != '\n'))
se++;
*se = '\0';
USL_MeasureString(s,&w,&h);
px = PrintX;
py = PrintY;
USL_DrawString(s);
s = se;
if (c)
{
*se = c;
s++;
PrintX = WindowX;
PrintY += h;
}
else
PrintX += w;
}
free(sstart);
}
///////////////////////////////////////////////////////////////////////////
//
// US_PrintUnsigned() - Prints an unsigned long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintUnsigned(longword n)
{
char buffer[32];
sprintf(buffer, "%lu", n);
US_Print(buffer);
}
///////////////////////////////////////////////////////////////////////////
//
// US_PrintSigned() - Prints a signed long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintSigned(int32_t n)
{
char buffer[32];
US_Print(ltoa(n,buffer,10));
}
///////////////////////////////////////////////////////////////////////////
//
// USL_PrintInCenter() - Prints a string in the center of the given rect
//
///////////////////////////////////////////////////////////////////////////
void
USL_PrintInCenter(const char *s,Rect r)
{
word w,h,
rw,rh;
USL_MeasureString(s,&w,&h);
rw = r.lr.x - r.ul.x;
rh = r.lr.y - r.ul.y;
px = r.ul.x + ((rw - w) / 2);
py = r.ul.y + ((rh - h) / 2);
USL_DrawString(s);
}
///////////////////////////////////////////////////////////////////////////
//
// US_PrintCentered() - Prints a string centered in the current window.
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintCentered(const char *s)
{
Rect r;
r.ul.x = WindowX;
r.ul.y = WindowY;
r.lr.x = r.ul.x + WindowW;
r.lr.y = r.ul.y + WindowH;
USL_PrintInCenter(s,r);
}
///////////////////////////////////////////////////////////////////////////
//
// US_CPrintLine() - Prints a string centered on the current line and
// advances to the next line. Newlines are not supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_CPrintLine(const char *s)
{
word w,h;
USL_MeasureString(s,&w,&h);
if (w > WindowW)
Quit("US_CPrintLine() - String exceeds width");
px = WindowX + ((WindowW - w) / 2);
py = PrintY;
USL_DrawString(s);
PrintY += h;
}
///////////////////////////////////////////////////////////////////////////
//
// US_CPrint() - Prints a string centered in the current window.
// Newlines are supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_CPrint(const char *sorg)
{
char c;
char *sstart = strdup(sorg);
char *s = sstart;
char *se;
while (*s)
{
se = s;
while ((c = *se)!=0 && (c != '\n'))
se++;
*se = '\0';
US_CPrintLine(s);
s = se;
if (c)
{
*se = c;
s++;
}
}
free(sstart);
}
///////////////////////////////////////////////////////////////////////////
//
// US_Printf() - Prints a formatted string in the current window.
// Newlines are supported.
//
///////////////////////////////////////////////////////////////////////////
void US_Printf(const char *formatStr, ...)
{
char strbuf[256];
va_list vlist;
va_start(vlist, formatStr);
int len = vsnprintf(strbuf, sizeof(strbuf), formatStr, vlist);
va_end(vlist);
if(len <= -1 || len >= sizeof(strbuf))
strbuf[sizeof(strbuf) - 1] = 0;
US_Print(strbuf);
}
///////////////////////////////////////////////////////////////////////////
//
// US_CPrintf() - Prints a formatted string centered in the current window.
// Newlines are supported.
//
///////////////////////////////////////////////////////////////////////////
void US_CPrintf(const char *formatStr, ...)
{
char strbuf[256];
va_list vlist;
va_start(vlist, formatStr);
int len = vsnprintf(strbuf, sizeof(strbuf), formatStr, vlist);
va_end(vlist);
if(len <= -1 || len >= sizeof(strbuf))
strbuf[sizeof(strbuf) - 1] = 0;
US_CPrint(strbuf);
}
///////////////////////////////////////////////////////////////////////////
//
// US_ClearWindow() - Clears the current window to white and homes the
// cursor
//
///////////////////////////////////////////////////////////////////////////
void
US_ClearWindow(void)
{
VWB_Bar(WindowX,WindowY,WindowW,WindowH,WHITE);
PrintX = WindowX;
PrintY = WindowY;
}
///////////////////////////////////////////////////////////////////////////
//
// US_DrawWindow() - Draws a frame and sets the current window parms
//
///////////////////////////////////////////////////////////////////////////
void
US_DrawWindow(word x,word y,word w,word h)
{
word i,
sx,sy,sw,sh;
WindowX = x * 8;
WindowY = y * 8;
WindowW = w * 8;
WindowH = h * 8;
PrintX = WindowX;
PrintY = WindowY;
sx = (x - 1) * 8;
sy = (y - 1) * 8;
sw = (w + 1) * 8;
sh = (h + 1) * 8;
US_ClearWindow();
VWB_DrawTile8(sx,sy,0),VWB_DrawTile8(sx,sy + sh,5);
for (i = sx + 8;i <= sx + sw - 8;i += 8)
VWB_DrawTile8(i,sy,1),VWB_DrawTile8(i,sy + sh,6);
VWB_DrawTile8(i,sy,2),VWB_DrawTile8(i,sy + sh,7);
for (i = sy + 8;i <= sy + sh - 8;i += 8)
VWB_DrawTile8(sx,i,3),VWB_DrawTile8(sx + sw,i,4);
}
///////////////////////////////////////////////////////////////////////////
//
// US_CenterWindow() - Generates a window of a given width & height in the
// middle of the screen
//
///////////////////////////////////////////////////////////////////////////
void
US_CenterWindow(word w,word h)
{
US_DrawWindow(((MaxX / 8) - w) / 2,((MaxY / 8) - h) / 2,w,h);
}
///////////////////////////////////////////////////////////////////////////
//
// US_SaveWindow() - Saves the current window parms into a record for
// later restoration
//
///////////////////////////////////////////////////////////////////////////
void
US_SaveWindow(WindowRec *win)
{
win->x = WindowX;
win->y = WindowY;
win->w = WindowW;
win->h = WindowH;
win->px = PrintX;
win->py = PrintY;
}
///////////////////////////////////////////////////////////////////////////
//
// US_RestoreWindow() - Sets the current window parms to those held in the
// record
//
///////////////////////////////////////////////////////////////////////////
void
US_RestoreWindow(WindowRec *win)
{
WindowX = win->x;
WindowY = win->y;
WindowW = win->w;
WindowH = win->h;
PrintX = win->px;
PrintY = win->py;
}
// Input routines
///////////////////////////////////////////////////////////////////////////
//
// USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput()
//
///////////////////////////////////////////////////////////////////////////
static void
USL_XORICursor(int x,int y,const char *s,word cursor)
{
static boolean status; // VGA doesn't XOR...
char buf[MaxString];
int temp;
word w,h;
strcpy(buf,s);
buf[cursor] = '\0';
USL_MeasureString(buf,&w,&h);
px = x + w - 1;
py = y;
if (status^=1)
USL_DrawString("\x80");
else
{
temp = fontcolor;
fontcolor = backcolor;
USL_DrawString("\x80");
fontcolor = temp;
}
}
char USL_RotateChar(char ch, int dir)
{
static const char charSet[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ.,-!?0123456789";
const int numChars = sizeof(charSet) / sizeof(char) - 1;
int i;
for(i = 0; i < numChars; i++)
{
if(ch == charSet[i]) break;
}
if(i == numChars) i = 0;
i += dir;
if(i < 0) i = numChars - 1;
else if(i >= numChars) i = 0;
return charSet[i];
}
///////////////////////////////////////////////////////////////////////////
//
// US_LineInput() - Gets a line of user input at (x,y), the string defaults
// to whatever is pointed at by def. Input is restricted to maxchars
// chars or maxwidth pixels wide. If the user hits escape (and escok is
// true), nothing is copied into buf, and false is returned. If the
// user hits return, the current string is copied into buf, and true is
// returned
//
///////////////////////////////////////////////////////////////////////////
boolean
US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
int maxchars,int maxwidth)
{
boolean redraw,
cursorvis,cursormoved,
done,result, checkkey;
ScanCode sc;
char c;
char s[MaxString],olds[MaxString];
int cursor,len;
word i,
w,h,
temp;
longword curtime, lasttime, lastdirtime, lastbuttontime, lastdirmovetime;
ControlInfo ci;
Direction lastdir = dir_None;
if (def)
strcpy(s,def);
else
*s = '\0';
*olds = '\0';
cursor = (int) strlen(s);
cursormoved = redraw = true;
cursorvis = done = false;
lasttime = lastdirtime = lastdirmovetime = GetTimeCount();
lastbuttontime = lasttime + TickBase / 4; // 250 ms => first button press accepted after 500 ms
LastASCII = key_None;
LastScan = sc_None;
while (!done)
{
ReadAnyControl(&ci);
if (cursorvis)
USL_XORICursor(x,y,s,cursor);
sc = LastScan;
LastScan = sc_None;
c = LastASCII;
LastASCII = key_None;
checkkey = true;
curtime = GetTimeCount();
// After each direction change accept the next change after 250 ms and then everz 125 ms
if(ci.dir != lastdir || curtime - lastdirtime > TickBase / 4 && curtime - lastdirmovetime > TickBase / 8)
{
if(ci.dir != lastdir)
{
lastdir = ci.dir;
lastdirtime = curtime;
}
lastdirmovetime = curtime;
switch(ci.dir)
{
case dir_West:
if(cursor)
{
// Remove trailing whitespace if cursor is at end of string
if(s[cursor] == ' ' && s[cursor + 1] == 0)
s[cursor] = 0;
cursor--;
}
cursormoved = true;
checkkey = false;
break;
case dir_East:
if(cursor >= MaxString - 1) break;
if(!s[cursor])
{
USL_MeasureString(s,&w,&h);
if(len >= maxchars || maxwidth && w >= maxwidth) break;
s[cursor] = ' ';
s[cursor + 1] = 0;
}
cursor++;
cursormoved = true;
checkkey = false;
break;
case dir_North:
if(!s[cursor])
{
USL_MeasureString(s,&w,&h);
if(len >= maxchars || maxwidth && w >= maxwidth) break;
s[cursor + 1] = 0;
}
s[cursor] = USL_RotateChar(s[cursor], 1);
redraw = true;
checkkey = false;
break;
case dir_South:
if(!s[cursor])
{
USL_MeasureString(s,&w,&h);
if(len >= maxchars || maxwidth && w >= maxwidth) break;
s[cursor + 1] = 0;
}
s[cursor] = USL_RotateChar(s[cursor], -1);
redraw = true;
checkkey = false;
break;
}
}
if((int)(curtime - lastbuttontime) > TickBase / 4) // 250 ms
{
if(ci.button0) // acts as return
{
strcpy(buf,s);
done = true;
result = true;
checkkey = false;
}
if(ci.button1 && escok) // acts as escape
{
done = true;
result = false;
checkkey = false;
}
if(ci.button2) // acts as backspace
{
lastbuttontime = curtime;
if(cursor)
{
strcpy(s + cursor - 1,s + cursor);
cursor--;
redraw = true;
}
cursormoved = true;
checkkey = false;
}
}
if(checkkey)
{
switch (sc)
{
case sc_LeftArrow:
if (cursor)
cursor--;
c = key_None;
cursormoved = true;
break;
case sc_RightArrow:
if (s[cursor])
cursor++;
c = key_None;
cursormoved = true;
break;
case sc_Home:
cursor = 0;
c = key_None;
cursormoved = true;
break;
case sc_End:
cursor = (int) strlen(s);
c = key_None;
cursormoved = true;
break;
case sc_Return:
strcpy(buf,s);
done = true;
result = true;
c = key_None;
break;
case sc_Escape:
if (escok)
{
done = true;
result = false;
}
c = key_None;
break;
case sc_BackSpace:
if (cursor)
{
strcpy(s + cursor - 1,s + cursor);
cursor--;
redraw = true;
}
c = key_None;
cursormoved = true;
break;
case sc_Delete:
if (s[cursor])
{
strcpy(s + cursor,s + cursor + 1);
redraw = true;
}
c = key_None;
cursormoved = true;
break;
case SDLK_KP5: //0x4c: // Keypad 5 // TODO: hmmm...
case sc_UpArrow:
case sc_DownArrow:
case sc_PgUp:
case sc_PgDn:
case sc_Insert:
c = key_None;
break;
}
if (c)
{
len = (int) strlen(s);
USL_MeasureString(s,&w,&h);
if(isprint(c) && (len < MaxString - 1) && ((!maxchars) || (len < maxchars))
&& ((!maxwidth) || (w < maxwidth)))
{
for (i = len + 1;i > cursor;i--)
s[i] = s[i - 1];
s[cursor++] = c;
redraw = true;
}
}
}
if (redraw)
{
px = x;
py = y;
temp = fontcolor;
fontcolor = backcolor;
USL_DrawString(olds);
fontcolor = (byte) temp;
strcpy(olds,s);
px = x;
py = y;
USL_DrawString(s);
redraw = false;
}
if (cursormoved)
{
cursorvis = false;
lasttime = curtime - TickBase;
cursormoved = false;
}
if (curtime - lasttime > TickBase / 2) // 500 ms
{
lasttime = curtime;
cursorvis ^= true;
}
else SDL_Delay(5);
if (cursorvis)
USL_XORICursor(x,y,s,cursor);
VW_UpdateScreen();
}
if (cursorvis)
USL_XORICursor(x,y,s,cursor);
if (!result)
{
px = x;
py = y;
USL_DrawString(olds);
}
VW_UpdateScreen();
IN_ClearKeysDown();
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// US_InitRndT - Initializes the pseudo random number generator.
// If randomize is true, the seed will be initialized depending on the
// current time
//
///////////////////////////////////////////////////////////////////////////
void US_InitRndT(int randomize)
{
if(randomize)
rndindex = (SDL_GetTicks() >> 4) & 0xff;
else
rndindex = 0;
}
///////////////////////////////////////////////////////////////////////////
//
// US_RndT - Returns the next 8-bit pseudo random number
//
///////////////////////////////////////////////////////////////////////////
int US_RndT()
{
rndindex = (rndindex+1)&0xff;
return rndtable[rndindex];
}

435
id_vh.cpp Normal file
View File

@ -0,0 +1,435 @@
#include "wl_def.h"
pictabletype *pictable;
SDL_Surface *latchpics[NUMLATCHPICS];
int px,py;
byte fontcolor,backcolor;
int fontnumber;
//==========================================================================
void VWB_DrawPropString(const char* string)
{
fontstruct *font;
int width, step, height;
byte *source, *dest;
byte ch;
byte *vbuf = LOCK();
font = (fontstruct *) grsegs[STARTFONT+fontnumber];
height = font->height;
dest = vbuf + scaleFactor * (py * curPitch + px);
while ((ch = (byte)*string++)!=0)
{
width = step = font->width[ch];
source = ((byte *)font)+font->location[ch];
while (width--)
{
for(int i=0;i<height;i++)
{
if(source[i*step])
{
for(unsigned sy=0; sy<scaleFactor; sy++)
for(unsigned sx=0; sx<scaleFactor; sx++)
dest[(scaleFactor*i+sy)*curPitch+sx]=fontcolor;
}
}
source++;
px++;
dest+=scaleFactor;
}
}
UNLOCK();
}
/*
=================
=
= VL_MungePic
=
=================
*/
void VL_MungePic (byte *source, unsigned width, unsigned height)
{
unsigned x,y,plane,size,pwidth;
byte *temp, *dest, *srcline;
size = width*height;
if (width&3)
Quit ("VL_MungePic: Not divisable by 4!");
//
// copy the pic to a temp buffer
//
temp=(byte *) malloc(size);
CHECKMALLOCRESULT(temp);
memcpy (temp,source,size);
//
// munge it back into the original buffer
//
dest = source;
pwidth = width/4;
for (plane=0;plane<4;plane++)
{
srcline = temp;
for (y=0;y<height;y++)
{
for (x=0;x<pwidth;x++)
*dest++ = *(srcline+x*4+plane);
srcline+=width;
}
}
free(temp);
}
void VWL_MeasureString (const char *string, word *width, word *height, fontstruct *font)
{
*height = font->height;
for (*width = 0;*string;string++)
*width += font->width[*((byte *)string)]; // proportional width
}
void VW_MeasurePropString (const char *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,(fontstruct *)grsegs[STARTFONT+fontnumber]);
}
/*
=============================================================================
Double buffer management routines
=============================================================================
*/
void VH_UpdateScreen()
{
SDL_BlitSurface(screenBuffer, NULL, screen, NULL);
SDL_Flip(screen);
}
void VWB_DrawTile8 (int x, int y, int tile)
{
LatchDrawChar(x,y,tile);
}
void VWB_DrawTile8M (int x, int y, int tile)
{
VL_MemToScreen (((byte *)grsegs[STARTTILE8M])+tile*64,8,8,x,y);
}
void VWB_DrawPic (int x, int y, int chunknum)
{
int picnum = chunknum - STARTPICS;
unsigned width,height;
x &= ~7;
width = pictable[picnum].width;
height = pictable[picnum].height;
VL_MemToScreen (grsegs[chunknum],width,height,x,y);
}
void VWB_DrawPicScaledCoord (int scx, int scy, int chunknum)
{
int picnum = chunknum - STARTPICS;
unsigned width,height;
width = pictable[picnum].width;
height = pictable[picnum].height;
VL_MemToScreenScaledCoord (grsegs[chunknum],width,height,scx,scy);
}
void VWB_Bar (int x, int y, int width, int height, int color)
{
VW_Bar (x,y,width,height,color);
}
void VWB_Plot (int x, int y, int color)
{
if(scaleFactor == 1)
VW_Plot(x,y,color);
else
VW_Bar(x, y, 1, 1, color);
}
void VWB_Hlin (int x1, int x2, int y, int color)
{
if(scaleFactor == 1)
VW_Hlin(x1,x2,y,color);
else
VW_Bar(x1, y, x2-x1+1, 1, color);
}
void VWB_Vlin (int y1, int y2, int x, int color)
{
if(scaleFactor == 1)
VW_Vlin(y1,y2,x,color);
else
VW_Bar(x, y1, 1, y2-y1+1, color);
}
/*
=============================================================================
WOLFENSTEIN STUFF
=============================================================================
*/
/*
=====================
=
= LatchDrawPic
=
=====================
*/
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum)
{
VL_LatchToScreen (latchpics[2+picnum-LATCHPICS_LUMP_START], x*8, y);
}
void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum)
{
VL_LatchToScreenScaledCoord (latchpics[2+picnum-LATCHPICS_LUMP_START], scx*8, scy);
}
//==========================================================================
/*
===================
=
= LoadLatchMem
=
===================
*/
void LoadLatchMem (void)
{
int i,width,height,start,end;
byte *src;
SDL_Surface *surf;
//
// tile 8s
//
surf = SDL_CreateRGBSurface(SDL_HWSURFACE, 8*8,
((NUMTILE8 + 7) / 8) * 8, 8, 0, 0, 0, 0);
if(surf == NULL)
{
Quit("Unable to create surface for tiles!");
}
SDL_SetColors(surf, gamepal, 0, 256);
latchpics[0] = surf;
CA_CacheGrChunk (STARTTILE8);
src = grsegs[STARTTILE8];
for (i=0;i<NUMTILE8;i++)
{
VL_MemToLatch (src, 8, 8, surf, (i & 7) * 8, (i >> 3) * 8);
src += 64;
}
UNCACHEGRCHUNK (STARTTILE8);
//
// pics
//
start = LATCHPICS_LUMP_START;
end = LATCHPICS_LUMP_END;
for (i=start;i<=end;i++)
{
width = pictable[i-STARTPICS].width;
height = pictable[i-STARTPICS].height;
surf = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 8, 0, 0, 0, 0);
if(surf == NULL)
{
Quit("Unable to create surface for picture!");
}
SDL_SetColors(surf, gamepal, 0, 256);
latchpics[2+i-start] = surf;
CA_CacheGrChunk (i);
VL_MemToLatch (grsegs[i], width, height, surf, 0, 0);
UNCACHEGRCHUNK(i);
}
}
//==========================================================================
/*
===================
=
= FizzleFade
=
= returns true if aborted
=
= It uses maximum-length Linear Feedback Shift Registers (LFSR) counters.
= You can find a list of them with lengths from 3 to 168 at:
= http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf
= Many thanks to Xilinx for this list!!!
=
===================
*/
// XOR masks for the pseudo-random number sequence starting with n=17 bits
static const uint32_t rndmasks[] = {
// n XNOR from (starting at 1, not 0 as usual)
0x00012000, // 17 17,14
0x00020400, // 18 18,11
0x00040023, // 19 19,6,2,1
0x00090000, // 20 20,17
0x00140000, // 21 21,19
0x00300000, // 22 22,21
0x00420000, // 23 23,18
0x00e10000, // 24 24,23,22,17
0x01200000, // 25 25,22 (this is enough for 8191x4095)
};
static unsigned int rndbits_y;
static unsigned int rndmask;
extern SDL_Color curpal[256];
// Returns the number of bits needed to represent the given value
static int log2_ceil(uint32_t x)
{
int n = 0;
uint32_t v = 1;
while(v < x)
{
n++;
v <<= 1;
}
return n;
}
void VH_Startup()
{
int rndbits_x = log2_ceil(screenWidth);
rndbits_y = log2_ceil(screenHeight);
int rndbits = rndbits_x + rndbits_y;
if(rndbits < 17)
rndbits = 17; // no problem, just a bit slower
else if(rndbits > 25)
rndbits = 25; // fizzle fade will not fill whole screen
rndmask = rndmasks[rndbits - 17];
}
boolean FizzleFade (SDL_Surface *source, int x1, int y1,
unsigned width, unsigned height, unsigned frames, boolean abortable)
{
unsigned x, y, frame, pixperframe;
int32_t rndval, lastrndval;
int first = 1;
lastrndval = 0;
pixperframe = width * height / frames;
IN_StartAck ();
frame = GetTimeCount();
byte *srcptr = VL_LockSurface(source);
do
{
if(abortable && IN_CheckAck ())
{
VL_UnlockSurface(source);
SDL_BlitSurface(source, NULL, screen, NULL);
SDL_Flip(screen);
return true;
}
byte *destptr = VL_LockSurface(screen);
rndval = lastrndval;
// When using double buffering, we have to copy the pixels of the last AND the current frame.
// Only for the first frame, there is no "last frame"
for(int i = first; i < 2; i++)
{
for(unsigned p = 0; p < pixperframe; p++)
{
//
// seperate random value into x/y pair
//
x = rndval >> rndbits_y;
y = rndval & ((1 << rndbits_y) - 1);
//
// advance to next random element
//
rndval = (rndval >> 1) ^ (rndval & 1 ? 0 : rndmask);
if(x >= width || y >= height)
{
if(rndval == 0) // entire sequence has been completed
goto finished;
p--;
continue;
}
//
// copy one pixel
//
if(screenBits == 8)
{
*(destptr + (y1 + y) * screen->pitch + x1 + x)
= *(srcptr + (y1 + y) * source->pitch + x1 + x);
}
else
{
byte col = *(srcptr + (y1 + y) * source->pitch + x1 + x);
uint32_t fullcol = SDL_MapRGB(screen->format, curpal[col].r, curpal[col].g, curpal[col].b);
memcpy(destptr + (y1 + y) * screen->pitch + (x1 + x) * screen->format->BytesPerPixel,
&fullcol, screen->format->BytesPerPixel);
}
if(rndval == 0) // entire sequence has been completed
goto finished;
}
if(!i || first) lastrndval = rndval;
}
// If there is no double buffering, we always use the "first frame" case
if(usedoublebuffering) first = 0;
VL_UnlockSurface(screen);
SDL_Flip(screen);
frame++;
Delay(frame - GetTimeCount()); // don't go too fast
} while (1);
finished:
VL_UnlockSurface(source);
VL_UnlockSurface(screen);
SDL_BlitSurface(source, NULL, screen, NULL);
SDL_Flip(screen);
return false;
}

99
id_vh.h Normal file
View File

@ -0,0 +1,99 @@
// ID_VH.H
#define WHITE 15 // graphics mode independant colors
#define BLACK 0
#define FIRSTCOLOR 1
#define SECONDCOLOR 12
#define F_WHITE 15
#define F_BLACK 0
#define F_FIRSTCOLOR 1
#define F_SECONDCOLOR 12
//===========================================================================
#define MAXSHIFTS 1
typedef struct
{
int16_t width,height;
} pictabletype;
typedef struct
{
int16_t height;
int16_t location[256];
int8_t width[256];
} fontstruct;
//===========================================================================
extern pictabletype *pictable;
extern pictabletype *picmtable;
extern byte fontcolor,backcolor;
extern int fontnumber;
extern int px,py;
#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;
//
// mode independant routines
// coordinates in pixels, rounded to best screen res
// regions marked in double buffer
//
void VWB_DrawPropString (const char *string);
void VWB_DrawTile8 (int x, int y, int tile);
void VWB_DrawTile8M (int x, int y, int tile);
void VWB_DrawTile16 (int x, int y, int tile);
void VWB_DrawTile16M (int x, int y, int tile);
void VWB_DrawPic (int x, int y, int chunknum);
void VWB_DrawPicScaledCoord (int x, int y, int chunknum);
void VWB_DrawMPic(int x, int y, int chunknum);
void VWB_Bar (int x, int y, int width, int height, int color);
#define VWB_BarScaledCoord VL_BarScaledCoord
void VWB_Plot (int x, int y, int color);
#define VWB_PlotScaledCoord VW_Plot
void VWB_Hlin (int x1, int x2, int y, int color);
void VWB_Vlin (int y1, int y2, int x, int color);
#define VWB_HlinScaledCoord VW_Hlin
#define VWB_VlinScaledCoord VW_Vlin
void VH_UpdateScreen();
#define VW_UpdateScreen VH_UpdateScreen
//
// wolfenstein EGA compatability stuff
//
#define VW_Shutdown VL_Shutdown
#define VW_Bar VL_Bar
#define VW_Plot VL_Plot
#define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c)
#define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c)
#define VW_DrawPic VH_DrawPic
#define VW_WaitVBL VL_WaitVBL
#define VW_FadeIn() VL_FadeIn(0,255,gamepal,30);
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
#define VW_ScreenToScreen VL_ScreenToScreen
void VW_MeasurePropString (const char *string, word *width, word *height);
#define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0],((p)&7)*8,((p)>>3)*8*64,8,8,x,y)
#define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1],(p)*64,0,16,16,x,y)
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum);
void LoadLatchMem (void);
void VH_Startup();
boolean FizzleFade (SDL_Surface *source, int x1, int y1,
unsigned width, unsigned height, unsigned frames, boolean abortable);
#define NUMLATCHPICS 100
extern SDL_Surface *latchpics[NUMLATCHPICS];

737
id_vl.cpp Normal file
View File

@ -0,0 +1,737 @@
// ID_VL.C
#include <string.h>
#include "wl_def.h"
#pragma hdrstop
// Uncomment the following line, if you get destination out of bounds
// assertion errors and want to ignore them during debugging
//#define IGNORE_BAD_DEST
#ifdef IGNORE_BAD_DEST
#undef assert
#define assert(x) if(!(x)) return
#define assert_ret(x) if(!(x)) return 0
#else
#define assert_ret(x) assert(x)
#endif
boolean fullscreen = true;
#if defined(_arch_dreamcast)
boolean usedoublebuffering = false;
unsigned screenWidth = 320;
unsigned screenHeight = 200;
unsigned screenBits = 8;
#elif defined(GP2X)
boolean usedoublebuffering = true;
unsigned screenWidth = 320;
unsigned screenHeight = 240;
#if defined(GP2X_940)
unsigned screenBits = 8;
#else
unsigned screenBits = 16;
#endif
#else
boolean usedoublebuffering = true;
unsigned screenWidth = 640;
unsigned screenHeight = 400;
unsigned screenBits = -1; // use "best" color depth according to libSDL
#endif
SDL_Surface *screen = NULL;
unsigned screenPitch;
SDL_Surface *screenBuffer = NULL;
unsigned bufferPitch;
SDL_Surface *curSurface = NULL;
unsigned curPitch;
unsigned scaleFactor;
boolean screenfaded;
unsigned bordercolor;
SDL_Color palette1[256], palette2[256];
SDL_Color curpal[256];
#define CASSERT(x) extern int ASSERT_COMPILE[((x) != 0) * 2 - 1];
#define RGB(r, g, b) {(r)*255/63, (g)*255/63, (b)*255/63, 0}
SDL_Color gamepal[]={
#ifdef SPEAR
#include "sodpal.inc"
#else
#include "wolfpal.inc"
#endif
};
CASSERT(lengthof(gamepal) == 256)
//===========================================================================
/*
=======================
=
= VL_Shutdown
=
=======================
*/
void VL_Shutdown (void)
{
//VL_SetTextMode ();
}
/*
=======================
=
= VL_SetVGAPlaneMode
=
=======================
*/
void VL_SetVGAPlaneMode (void)
{
#ifdef SPEAR
SDL_WM_SetCaption("Spear of Destiny", NULL);
#else
SDL_WM_SetCaption("Wolfenstein 3D", NULL);
#endif
if(screenBits == -1)
{
const SDL_VideoInfo *vidInfo = SDL_GetVideoInfo();
screenBits = vidInfo->vfmt->BitsPerPixel;
}
screen = SDL_SetVideoMode(screenWidth, screenHeight, screenBits,
(usedoublebuffering ? SDL_HWSURFACE | SDL_DOUBLEBUF : 0)
| (screenBits == 8 ? SDL_HWPALETTE : 0)
| (fullscreen ? SDL_FULLSCREEN : 0));
if(!screen)
{
printf("Unable to set %ix%ix%i video mode: %s\n", screenWidth,
screenHeight, screenBits, SDL_GetError());
exit(1);
}
if((screen->flags & SDL_DOUBLEBUF) != SDL_DOUBLEBUF)
usedoublebuffering = false;
SDL_ShowCursor(SDL_DISABLE);
SDL_SetColors(screen, gamepal, 0, 256);
memcpy(curpal, gamepal, sizeof(SDL_Color) * 256);
screenBuffer = SDL_CreateRGBSurface(SDL_SWSURFACE, screenWidth,
screenHeight, 8, 0, 0, 0, 0);
if(!screenBuffer)
{
printf("Unable to create screen buffer surface: %s\n", SDL_GetError());
exit(1);
}
SDL_SetColors(screenBuffer, gamepal, 0, 256);
screenPitch = screen->pitch;
bufferPitch = screenBuffer->pitch;
curSurface = screenBuffer;
curPitch = bufferPitch;
scaleFactor = screenWidth/320;
if(screenHeight/200 < scaleFactor) scaleFactor = screenHeight/200;
pixelangle = (short *) malloc(screenWidth * sizeof(short));
CHECKMALLOCRESULT(pixelangle);
wallheight = (int *) malloc(screenWidth * sizeof(int));
CHECKMALLOCRESULT(wallheight);
}
/*
=============================================================================
PALETTE OPS
To avoid snow, do a WaitVBL BEFORE calling these
=============================================================================
*/
/*
=================
=
= VL_ConvertPalette
=
=================
*/
void VL_ConvertPalette(byte *srcpal, SDL_Color *destpal, int numColors)
{
for(int i=0; i<numColors; i++)
{
destpal[i].r = *srcpal++ * 255 / 63;
destpal[i].g = *srcpal++ * 255 / 63;
destpal[i].b = *srcpal++ * 255 / 63;
}
}
/*
=================
=
= VL_FillPalette
=
=================
*/
void VL_FillPalette (int red, int green, int blue)
{
int i;
SDL_Color pal[256];
for(i=0; i<256; i++)
{
pal[i].r = red;
pal[i].g = green;
pal[i].b = blue;
}
VL_SetPalette(pal, true);
}
//===========================================================================
/*
=================
=
= VL_SetColor
=
=================
*/
void VL_SetColor (int color, int red, int green, int blue)
{
SDL_Color col = { red, green, blue };
curpal[color] = col;
if(screenBits == 8)
SDL_SetPalette(screen, SDL_PHYSPAL, &col, color, 1);
else
{
SDL_SetPalette(curSurface, SDL_LOGPAL, &col, color, 1);
SDL_BlitSurface(curSurface, NULL, screen, NULL);
SDL_Flip(screen);
}
}
//===========================================================================
/*
=================
=
= VL_GetColor
=
=================
*/
void VL_GetColor (int color, int *red, int *green, int *blue)
{
SDL_Color *col = &curpal[color];
*red = col->r;
*green = col->g;
*blue = col->b;
}
//===========================================================================
/*
=================
=
= VL_SetPalette
=
=================
*/
void VL_SetPalette (SDL_Color *palette, bool forceupdate)
{
memcpy(curpal, palette, sizeof(SDL_Color) * 256);
if(screenBits == 8)
SDL_SetPalette(screen, SDL_PHYSPAL, palette, 0, 256);
else
{
SDL_SetPalette(curSurface, SDL_LOGPAL, palette, 0, 256);
if(forceupdate)
{
SDL_BlitSurface(curSurface, NULL, screen, NULL);
SDL_Flip(screen);
}
}
}
//===========================================================================
/*
=================
=
= VL_GetPalette
=
=================
*/
void VL_GetPalette (SDL_Color *palette)
{
memcpy(palette, curpal, sizeof(SDL_Color) * 256);
}
//===========================================================================
/*
=================
=
= VL_FadeOut
=
= Fades the current palette to the given color in the given number of steps
=
=================
*/
void VL_FadeOut (int start, int end, int red, int green, int blue, int steps)
{
int i,j,orig,delta;
SDL_Color *origptr, *newptr;
red = red * 255 / 63;
green = green * 255 / 63;
blue = blue * 255 / 63;
VL_WaitVBL(1);
VL_GetPalette(palette1);
memcpy(palette2, palette1, sizeof(SDL_Color) * 256);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
origptr = &palette1[start];
newptr = &palette2[start];
for (j=start;j<=end;j++)
{
orig = origptr->r;
delta = red-orig;
newptr->r = orig + delta * i / steps;
orig = origptr->g;
delta = green-orig;
newptr->g = orig + delta * i / steps;
orig = origptr->b;
delta = blue-orig;
newptr->b = orig + delta * i / steps;
origptr++;
newptr++;
}
if(!usedoublebuffering || screenBits == 8) VL_WaitVBL(1);
VL_SetPalette (palette2, true);
}
//
// final color
//
VL_FillPalette (red,green,blue);
screenfaded = true;
}
/*
=================
=
= VL_FadeIn
=
=================
*/
void VL_FadeIn (int start, int end, SDL_Color *palette, int steps)
{
int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette(palette1);
memcpy(palette2, palette1, sizeof(SDL_Color) * 256);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j].r-palette1[j].r;
palette2[j].r = palette1[j].r + delta * i / steps;
delta = palette[j].g-palette1[j].g;
palette2[j].g = palette1[j].g + delta * i / steps;
delta = palette[j].b-palette1[j].b;
palette2[j].b = palette1[j].b + delta * i / steps;
}
if(!usedoublebuffering || screenBits == 8) VL_WaitVBL(1);
VL_SetPalette(palette2, true);
}
//
// final color
//
VL_SetPalette (palette, true);
screenfaded = false;
}
/*
=============================================================================
PIXEL OPS
=============================================================================
*/
byte *VL_LockSurface(SDL_Surface *surface)
{
if(SDL_MUSTLOCK(surface))
{
if(SDL_LockSurface(surface) < 0)
return NULL;
}
return (byte *) surface->pixels;
}
void VL_UnlockSurface(SDL_Surface *surface)
{
if(SDL_MUSTLOCK(surface))
{
SDL_UnlockSurface(surface);
}
}
/*
=================
=
= VL_Plot
=
=================
*/
void VL_Plot (int x, int y, int color)
{
assert(x >= 0 && (unsigned) x < screenWidth
&& y >= 0 && (unsigned) y < screenHeight
&& "VL_Plot: Pixel out of bounds!");
VL_LockSurface(curSurface);
((byte *) curSurface->pixels)[y * curPitch + x] = color;
VL_UnlockSurface(curSurface);
}
/*
=================
=
= VL_GetPixel
=
=================
*/
byte VL_GetPixel (int x, int y)
{
assert_ret(x >= 0 && (unsigned) x < screenWidth
&& y >= 0 && (unsigned) y < screenHeight
&& "VL_GetPixel: Pixel out of bounds!");
VL_LockSurface(curSurface);
byte col = ((byte *) curSurface->pixels)[y * curPitch + x];
VL_UnlockSurface(curSurface);
return col;
}
/*
=================
=
= VL_Hlin
=
=================
*/
void VL_Hlin (unsigned x, unsigned y, unsigned width, int color)
{
assert(x >= 0 && x + width <= screenWidth
&& y >= 0 && y < screenHeight
&& "VL_Hlin: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + y * curPitch + x;
memset(dest, color, width);
VL_UnlockSurface(curSurface);
}
/*
=================
=
= VL_Vlin
=
=================
*/
void VL_Vlin (int x, int y, int height, int color)
{
assert(x >= 0 && (unsigned) x < screenWidth
&& y >= 0 && (unsigned) y + height <= screenHeight
&& "VL_Vlin: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + y * curPitch + x;
while (height--)
{
*dest = color;
dest += curPitch;
}
VL_UnlockSurface(curSurface);
}
/*
=================
=
= VL_Bar
=
=================
*/
void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color)
{
assert(scx >= 0 && (unsigned) scx + scwidth <= screenWidth
&& scy >= 0 && (unsigned) scy + scheight <= screenHeight
&& "VL_BarScaledCoord: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + scy * curPitch + scx;
while (scheight--)
{
memset(dest, color, scwidth);
dest += curPitch;
}
VL_UnlockSurface(curSurface);
}
/*
============================================================================
MEMORY OPS
============================================================================
*/
/*
=================
=
= VL_MemToLatch
=
=================
*/
void VL_MemToLatch(byte *source, int width, int height,
SDL_Surface *destSurface, int x, int y)
{
assert(x >= 0 && (unsigned) x + width <= screenWidth
&& y >= 0 && (unsigned) y + height <= screenHeight
&& "VL_MemToLatch: Destination rectangle out of bounds!");
VL_LockSurface(destSurface);
int pitch = destSurface->pitch;
byte *dest = (byte *) destSurface->pixels + y * pitch + x;
for(int ysrc = 0; ysrc < height; ysrc++)
{
for(int xsrc = 0; xsrc < width; xsrc++)
{
dest[ysrc * pitch + xsrc] = source[(ysrc * (width >> 2) + (xsrc >> 2))
+ (xsrc & 3) * (width >> 2) * height];
}
}
VL_UnlockSurface(destSurface);
}
//===========================================================================
/*
=================
=
= VL_MemToScreenScaledCoord
=
= Draws a block of data to the screen with scaling according to scaleFactor.
=
=================
*/
void VL_MemToScreenScaledCoord (byte *source, int width, int height, int destx, int desty)
{
assert(destx >= 0 && destx + width * scaleFactor <= screenWidth
&& desty >= 0 && desty + height * scaleFactor <= screenHeight
&& "VL_MemToScreenScaledCoord: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
byte *vbuf = (byte *) curSurface->pixels;
for(int j=0,scj=0; j<height; j++, scj+=scaleFactor)
{
for(int i=0,sci=0; i<width; i++, sci+=scaleFactor)
{
byte col = source[(j*(width>>2)+(i>>2))+(i&3)*(width>>2)*height];
for(unsigned m=0; m<scaleFactor; m++)
{
for(unsigned n=0; n<scaleFactor; n++)
{
vbuf[(scj+m+desty)*curPitch+sci+n+destx] = col;
}
}
}
}
VL_UnlockSurface(curSurface);
}
/*
=================
=
= VL_MemToScreenScaledCoord
=
= Draws a part of a block of data to the screen.
= The block has the size origwidth*origheight.
= The part at (srcx, srcy) has the size width*height
= and will be painted to (destx, desty) with scaling according to scaleFactor.
=
=================
*/
void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, int srcx, int srcy,
int destx, int desty, int width, int height)
{
assert(destx >= 0 && destx + width * scaleFactor <= screenWidth
&& desty >= 0 && desty + height * scaleFactor <= screenHeight
&& "VL_MemToScreenScaledCoord: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
byte *vbuf = (byte *) curSurface->pixels;
for(int j=0,scj=0; j<height; j++, scj+=scaleFactor)
{
for(int i=0,sci=0; i<width; i++, sci+=scaleFactor)
{
byte col = source[((j+srcy)*(origwidth>>2)+((i+srcx)>>2))+((i+srcx)&3)*(origwidth>>2)*origheight];
for(unsigned m=0; m<scaleFactor; m++)
{
for(unsigned n=0; n<scaleFactor; n++)
{
vbuf[(scj+m+desty)*curPitch+sci+n+destx] = col;
}
}
}
}
VL_UnlockSurface(curSurface);
}
//==========================================================================
/*
=================
=
= VL_LatchToScreen
=
=================
*/
void VL_LatchToScreenScaledCoord(SDL_Surface *source, int xsrc, int ysrc,
int width, int height, int scxdest, int scydest)
{
assert(scxdest >= 0 && scxdest + width * scaleFactor <= screenWidth
&& scydest >= 0 && scydest + height * scaleFactor <= screenHeight
&& "VL_LatchToScreenScaledCoord: Destination rectangle out of bounds!");
if(scaleFactor == 1)
{
// HACK: If screenBits is not 8 and the screen is faded out, the
// result will be black when using SDL_BlitSurface. The reason
// is that the logical palette needed for the transformation
// to the screen color depth is not equal to the logical
// palette of the latch (the latch is not faded). Therefore,
// SDL tries to map the colors...
// The result: All colors are mapped to black.
// So, we do the blit on our own...
if(screenBits != 8)
{
VL_LockSurface(source);
byte *src = (byte *) source->pixels;
unsigned srcPitch = source->pitch;
VL_LockSurface(curSurface);
byte *vbuf = (byte *) curSurface->pixels;
for(int j=0,scj=0; j<height; j++, scj++)
{
for(int i=0,sci=0; i<width; i++, sci++)
{
byte col = src[(ysrc + j)*srcPitch + xsrc + i];
vbuf[(scydest+scj)*curPitch+scxdest+sci] = col;
}
}
VL_UnlockSurface(curSurface);
VL_UnlockSurface(source);
}
else
{
SDL_Rect srcrect = { xsrc, ysrc, width, height };
SDL_Rect destrect = { scxdest, scydest, 0, 0 }; // width and height are ignored
SDL_BlitSurface(source, &srcrect, curSurface, &destrect);
}
}
else
{
VL_LockSurface(source);
byte *src = (byte *) source->pixels;
unsigned srcPitch = source->pitch;
VL_LockSurface(curSurface);
byte *vbuf = (byte *) curSurface->pixels;
for(int j=0,scj=0; j<height; j++, scj+=scaleFactor)
{
for(int i=0,sci=0; i<width; i++, sci+=scaleFactor)
{
byte col = src[(ysrc + j)*srcPitch + xsrc + i];
for(unsigned m=0; m<scaleFactor; m++)
{
for(unsigned n=0; n<scaleFactor; n++)
{
vbuf[(scydest+scj+m)*curPitch+scxdest+sci+n] = col;
}
}
}
}
VL_UnlockSurface(curSurface);
VL_UnlockSurface(source);
}
}
//===========================================================================
/*
=================
=
= VL_ScreenToScreen
=
=================
*/
void VL_ScreenToScreen (SDL_Surface *source, SDL_Surface *dest)
{
SDL_BlitSurface(source, NULL, dest, NULL);
}

101
id_vl.h Normal file
View File

@ -0,0 +1,101 @@
// ID_VL.H
// wolf compatability
void Quit (const char *error,...);
//===========================================================================
#define CHARWIDTH 2
#define TILEWIDTH 4
//===========================================================================
extern SDL_Surface *screen, *screenBuffer, *curSurface;
extern boolean fullscreen, usedoublebuffering;
extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch;
extern unsigned scaleFactor;
extern boolean screenfaded;
extern unsigned bordercolor;
extern SDL_Color gamepal[256];
//===========================================================================
//
// VGA hardware routines
//
#define VL_WaitVBL(a) SDL_Delay((a)*8)
void VL_SetVGAPlaneMode (void);
void VL_SetTextMode (void);
void VL_Shutdown (void);
void VL_ConvertPalette(byte *srcpal, SDL_Color *destpal, int numColors);
void VL_FillPalette (int red, int green, int blue);
void VL_SetColor (int color, int red, int green, int blue);
void VL_GetColor (int color, int *red, int *green, int *blue);
void VL_SetPalette (SDL_Color *palette, bool forceupdate);
void VL_GetPalette (SDL_Color *palette);
void VL_FadeOut (int start, int end, int red, int green, int blue, int steps);
void VL_FadeIn (int start, int end, SDL_Color *palette, int steps);
byte *VL_LockSurface(SDL_Surface *surface);
void VL_UnlockSurface(SDL_Surface *surface);
#define LOCK() VL_LockSurface(curSurface)
#define UNLOCK() VL_UnlockSurface(curSurface)
byte VL_GetPixel (int x, int y);
void VL_Plot (int x, int y, int color);
void VL_Hlin (unsigned x, unsigned y, unsigned width, int color);
void VL_Vlin (int x, int y, int height, int color);
void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color);
void inline VL_Bar (int x, int y, int width, int height, int color)
{
VL_BarScaledCoord(scaleFactor*x, scaleFactor*y,
scaleFactor*width, scaleFactor*height, color);
}
void inline VL_ClearScreen(int color)
{
SDL_FillRect(curSurface, NULL, color);
}
void VL_MungePic (byte *source, unsigned width, unsigned height);
void VL_DrawPicBare (int x, int y, byte *pic, int width, int height);
void VL_MemToLatch (byte *source, int width, int height,
SDL_Surface *destSurface, int x, int y);
void VL_ScreenToScreen (SDL_Surface *source, SDL_Surface *dest);
void VL_MemToScreenScaledCoord (byte *source, int width, int height, int scx, int scy);
void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, int srcx, int srcy,
int destx, int desty, int width, int height);
void inline VL_MemToScreen (byte *source, int width, int height, int x, int y)
{
VL_MemToScreenScaledCoord(source, width, height,
scaleFactor*x, scaleFactor*y);
}
void VL_MaskedToScreen (byte *source, int width, int height, int x, int y);
void VL_LatchToScreenScaledCoord (SDL_Surface *source, int xsrc, int ysrc,
int width, int height, int scxdest, int scydest);
void inline VL_LatchToScreen (SDL_Surface *source, int xsrc, int ysrc,
int width, int height, int xdest, int ydest)
{
VL_LatchToScreenScaledCoord(source,xsrc,ysrc,width,height,
scaleFactor*xdest,scaleFactor*ydest);
}
void inline VL_LatchToScreenScaledCoord (SDL_Surface *source, int scx, int scy)
{
VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,scx,scy);
}
void inline VL_LatchToScreen (SDL_Surface *source, int x, int y)
{
VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,
scaleFactor*x,scaleFactor*y);
}

129
license-id.txt Normal file
View File

@ -0,0 +1,129 @@
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 continuing the downloading of this Wolfenstein 3D
(the "Trademark") 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.
ID SOFTWARE LICENSE
Grant of License. ID grants to you the right to use one (1)
copy of the Software on a single computer. 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.
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.
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.
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, except that you may either (a) make one
copy of the Software solely for back-up or archival purposes, or (b)
transfer the Software to a single hard disk provided you keep the original
solely for back-up or archival purposes. 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.
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.
General Provisions. Neither this Agreement nor any part or portion
hereof shall be assigned, sublicensed or otherwise transferred by you.
Should any provision of this Agreement be held to be void, invalid,
unenforceable or illegal by a court, the validity and enforceability of the
other provisions shall not be affected thereby. If any provision is
determined to be unenforceable, you agree to a modification of such
provision to provide for enforcement of the provision's intent, to the
extent permitted by applicable law. Failure of a party to enforce any
provision of this Agreement shall not constitute or be construed as a
waiver of such provision or of the right to enforce such provision. If
you fail to comply with any terms of this Agreement, YOUR LICENSE IS
AUTOMATICALLY TERMINATED and you agree to the issuance of an injunction
against you in favor of Id. You agree that Id shall not have to post
bond or other security to obtain an injunction against you to prohibit
you from violating Id's rights.
YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, THAT YOU
UNDERSTAND THIS AGREEMENT, AND UNDERSTAND THAT BY CONTINUING THE
DOWNLOADING OF THE SOFTWARE, YOU AGREE TO BE BOUND BY THIS AGREEMENT'S
TERMS AND CONDITIONS. YOU FURTHER AGREE THAT, EXCEPT FOR WRITTEN SEPARATE
AGREEMENTS BETWEEN ID AND YOU, THIS AGREEMENT IS A COMPLETE AND EXCLUSIVE
STATEMENT OF THE RIGHTS AND LIABILITIES OF THE PARTIES. THIS AGREEMENT
SUPERSEDES ALL PRIOR ORAL AGREEMENTS, PROPOSALS OR UNDERSTANDINGS, AND
ANY OTHER COMMUNICATIONS BETWEEN ID AND YOU RELATING TO THE SUBJECT MATTER
OF THIS AGREEMENT

32
license-mame.txt Normal file
View File

@ -0,0 +1,32 @@
Copyright (c) 1997-2005, Nicola Salmoria and the MAME team
All rights reserved.
Redistribution and use of this code or any derivative works are permitted
provided that the following conditions are met:
* Redistributions may not be sold, nor may they be used in a commercial
product or activity.
* Redistributions that are modified from the original source must include the
complete source code, including the source code for all components used by a
binary built from the modified sources. However, as a special exception, the
source code distributed need not include anything that is normally distributed
(in either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
* Redistributions must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

38
macosx/Info.plist Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>wolf4sdl.icns</string>
<key>CFBundleIdentifier</key>
<string>com.chrisballinger.wolf4sdl</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>1.7</string>
<key>NSMainNibFile</key>
<string>SDLMain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSServices</key>
<array/>
<key>UTExportedTypeDeclarations</key>
<array/>
<key>UTImportedTypeDeclarations</key>
<array/>
</dict>
</plist>

16
macosx/SDLMain.h Normal file
View File

@ -0,0 +1,16 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#ifndef _SDLMain_h_
#define _SDLMain_h_
#import <Cocoa/Cocoa.h>
@interface SDLMain : NSObject
@end
#endif /* _SDLMain_h_ */

381
macosx/SDLMain.m Normal file
View File

@ -0,0 +1,381 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#include "SDL.h"
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
but the method still is there and works. To avoid warnings, we declare
it ourselves here. */
@interface NSApplication(SDL_Missing_Methods)
- (void)setAppleMenu:(NSMenu *)menu;
@end
/* Use this flag to determine whether we use SDLMain.nib or not */
#define SDL_USE_NIB_FILE 0
/* Use this flag to determine whether we use CPS (docking) or not */
#define SDL_USE_CPS 1
#ifdef SDL_USE_CPS
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
UInt32 lo;
UInt32 hi;
} CPSProcessSerNum;
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
#endif /* SDL_USE_CPS */
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
static BOOL gCalledAppMainline = FALSE;
static NSString *getApplicationName(void)
{
const NSDictionary *dict;
NSString *appName = 0;
/* Determine the application name */
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict)
appName = [dict objectForKey: @"CFBundleName"];
if (![appName length])
appName = [[NSProcessInfo processInfo] processName];
return appName;
}
#if SDL_USE_NIB_FILE
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
#endif
@interface NSApplication (SDLApplication)
@end
@implementation NSApplication (SDLApplication)
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
chdir(parentdir); /* chdir to the binary app's parent */
}
CFRelease(url);
CFRelease(url2);
}
}
#if SDL_USE_NIB_FILE
/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
aRange = [[menuItem title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
}
#else
static void setApplicationMenu(void)
{
/* warning: this code is very odd */
NSMenu *appleMenu;
NSMenuItem *menuItem;
NSString *title;
NSString *appName;
appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */
title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Hide " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu];
[[NSApp mainMenu] addItem:menuItem];
/* Tell the application object that this is now the application menu */
[NSApp setAppleMenu:appleMenu];
/* Finally give up our references to the objects */
[appleMenu release];
[menuItem release];
}
/* Create a window menu */
static void setupWindowMenu(void)
{
NSMenu *windowMenu;
NSMenuItem *windowMenuItem;
NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem];
[menuItem release];
/* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem];
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
/* Finally give up our references to the objects */
[windowMenu release];
[windowMenuItem release];
}
/* Replacement for NSApplicationMain */
static void CustomApplicationMain (int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDLMain *sdlMain;
/* Ensure the application object is initialised */
[NSApplication sharedApplication];
#ifdef SDL_USE_CPS
{
CPSProcessSerNum PSN;
/* Tell the dock about us */
if (!CPSGetCurrentProcess(&PSN))
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
}
#endif /* SDL_USE_CPS */
/* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu();
setupWindowMenu();
/* Create SDLMain and make it the app delegate */
sdlMain = [[SDLMain alloc] init];
[NSApp setDelegate:sdlMain];
/* Start the main event loop */
[NSApp run];
[sdlMain release];
[pool release];
}
#endif
/*
* Catch document open requests...this lets us notice files when the app
* was launched by double-clicking a document, or when a document was
* dragged/dropped on the app's icon. You need to have a
* CFBundleDocumentsType section in your Info.plist to get this message,
* apparently.
*
* Files are added to gArgv, so to the app, they'll look like command line
* arguments. Previously, apps launched from the finder had nothing but
* an argv[0].
*
* This message may be received multiple times to open several docs on launch.
*
* This message is ignored once the app's mainline has been called.
*/
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
const char *temparg;
size_t arglen;
char *arg;
char **newargv;
if (!gFinderLaunch) /* MacOS is passing command line args. */
return FALSE;
if (gCalledAppMainline) /* app has started, ignore this document. */
return FALSE;
temparg = [filename UTF8String];
arglen = SDL_strlen(temparg) + 1;
arg = (char *) SDL_malloc(arglen);
if (arg == NULL)
return FALSE;
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
if (newargv == NULL)
{
SDL_free(arg);
return FALSE;
}
gArgv = newargv;
SDL_strlcpy(arg, temparg, arglen);
gArgv[gArgc++] = arg;
gArgv[gArgc] = NULL;
return TRUE;
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
#if SDL_USE_NIB_FILE
/* Set the main menu to contain the real app name instead of "SDL App" */
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
#endif
/* Hand off to main application code */
gCalledAppMainline = TRUE;
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
@end
@implementation NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
unsigned int bufferSize;
unsigned int selfLen = [self length];
unsigned int aStringLen = [aString length];
unichar *buffer;
NSRange localRange;
NSString *result;
bufferSize = selfLen + aStringLen - aRange.length;
buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
/* Get first part into buffer */
localRange.location = 0;
localRange.length = aRange.location;
[self getCharacters:buffer range:localRange];
/* Get middle part into buffer */
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
/* Build output string */
result = [NSString stringWithCharacters:buffer length:bufferSize];
NSDeallocateMemoryPages(buffer, bufferSize);
return result;
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
} else {
int i;
gArgc = argc;
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;
}
#if SDL_USE_NIB_FILE
NSApplicationMain (argc, argv);
#else
CustomApplicationMain (argc, argv);
#endif
return 0;
}

View File

@ -0,0 +1,495 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; };
002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; };
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A2C09D0888800EBEB88 /* SDLMain.m */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
D901F4C20FC0DB520040C290 /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D901F4C10FC0DB520040C290 /* SDL_mixer.framework */; };
D901F4FD0FC0DBCB0040C290 /* fmopl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4CB0FC0DBCB0040C290 /* fmopl.cpp */; };
D901F4FE0FC0DBCB0040C290 /* id_pm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4CC0FC0DBCB0040C290 /* id_pm.cpp */; };
D901F5000FC0DBCB0040C290 /* wl_inter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4CF0FC0DBCB0040C290 /* wl_inter.cpp */; };
D901F5010FC0DBCB0040C290 /* wl_game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4D00FC0DBCB0040C290 /* wl_game.cpp */; };
D901F5020FC0DBCB0040C290 /* wl_floorceiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4D10FC0DBCB0040C290 /* wl_floorceiling.cpp */; };
D901F5030FC0DBCB0040C290 /* wl_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4D50FC0DBCB0040C290 /* wl_draw.cpp */; };
D901F5040FC0DBCB0040C290 /* wl_dir3dspr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4D60FC0DBCB0040C290 /* wl_dir3dspr.cpp */; };
D901F5050FC0DBCB0040C290 /* wl_debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4D80FC0DBCB0040C290 /* wl_debug.cpp */; };
D901F5060FC0DBCB0040C290 /* wl_cloudsky.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4DA0FC0DBCB0040C290 /* wl_cloudsky.cpp */; };
D901F5070FC0DBCB0040C290 /* wl_atmos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4DC0FC0DBCB0040C290 /* wl_atmos.cpp */; };
D901F5080FC0DBCB0040C290 /* wl_agent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4DD0FC0DBCB0040C290 /* wl_agent.cpp */; };
D901F5090FC0DBCB0040C290 /* wl_act2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4DE0FC0DBCB0040C290 /* wl_act2.cpp */; };
D901F50A0FC0DBCB0040C290 /* wl_act1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4DF0FC0DBCB0040C290 /* wl_act1.cpp */; };
D901F50B0FC0DBCB0040C290 /* signon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4E10FC0DBCB0040C290 /* signon.cpp */; };
D901F50C0FC0DBCB0040C290 /* sdl_winmain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4E20FC0DBCB0040C290 /* sdl_winmain.cpp */; };
D901F50D0FC0DBCB0040C290 /* id_us_1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4E50FC0DBCB0040C290 /* id_us_1.cpp */; };
D901F50E0FC0DBCB0040C290 /* wl_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4E70FC0DBCB0040C290 /* wl_text.cpp */; };
D901F50F0FC0DBCB0040C290 /* id_sd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4E90FC0DBCB0040C290 /* id_sd.cpp */; };
D901F5100FC0DBCB0040C290 /* wl_state.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4EB0FC0DBCB0040C290 /* wl_state.cpp */; };
D901F5110FC0DBCB0040C290 /* wl_shade.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4ED0FC0DBCB0040C290 /* wl_shade.cpp */; };
D901F5120FC0DBCB0040C290 /* wl_play.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4EE0FC0DBCB0040C290 /* wl_play.cpp */; };
D901F5130FC0DBCB0040C290 /* wl_parallax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4EF0FC0DBCB0040C290 /* wl_parallax.cpp */; };
D901F5140FC0DBCB0040C290 /* wl_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4F10FC0DBCB0040C290 /* wl_menu.cpp */; };
D901F5150FC0DBCB0040C290 /* wl_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4F20FC0DBCB0040C290 /* wl_main.cpp */; };
D901F5160FC0DBCB0040C290 /* id_in.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4F30FC0DBCB0040C290 /* id_in.cpp */; };
D901F5170FC0DBCB0040C290 /* id_vl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4F70FC0DBCB0040C290 /* id_vl.cpp */; };
D901F51A0FC0DBCB0040C290 /* id_vh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4FB0FC0DBCB0040C290 /* id_vh.cpp */; };
D901F51B0FC0DBCB0040C290 /* id_ca.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D901F4FC0FC0DBCB0040C290 /* id_ca.cpp */; };
D901F51F0FC0DBFC0040C290 /* SDL_mixer.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = D901F4C10FC0DB520040C290 /* SDL_mixer.framework */; };
D94B84D50FC0F2F800EADB6F /* wolf4sdl.icns in Resources */ = {isa = PBXBuildFile; fileRef = D94B84D40FC0F2F800EADB6F /* wolf4sdl.icns */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
D901F51F0FC0DBFC0040C290 /* SDL_mixer.framework in Copy Frameworks into .app bundle */,
002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */,
);
name = "Copy Frameworks into .app bundle";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
002F39F909D0881F00EBEB88 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
002F3A2B09D0888800EBEB88 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; };
002F3A2C09D0888800EBEB88 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; };
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Wolf4SDL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wolf4SDL.app; sourceTree = BUILT_PRODUCTS_DIR; };
D901F4C10FC0DB520040C290 /* SDL_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_mixer.framework; path = /Library/Frameworks/SDL_mixer.framework; sourceTree = "<absolute>"; };
D901F4C70FC0DBCB0040C290 /* id_in.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_in.h; path = ../id_in.h; sourceTree = SOURCE_ROOT; };
D901F4C80FC0DBCB0040C290 /* f_spear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = f_spear.h; path = ../f_spear.h; sourceTree = SOURCE_ROOT; };
D901F4C90FC0DBCB0040C290 /* fmopl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fmopl.h; path = ../fmopl.h; sourceTree = SOURCE_ROOT; };
D901F4CA0FC0DBCB0040C290 /* audiosod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audiosod.h; path = ../audiosod.h; sourceTree = SOURCE_ROOT; };
D901F4CB0FC0DBCB0040C290 /* fmopl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fmopl.cpp; path = ../fmopl.cpp; sourceTree = SOURCE_ROOT; };
D901F4CC0FC0DBCB0040C290 /* id_pm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_pm.cpp; path = ../id_pm.cpp; sourceTree = SOURCE_ROOT; };
D901F4CE0FC0DBCB0040C290 /* gfxv_sod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gfxv_sod.h; path = ../gfxv_sod.h; sourceTree = SOURCE_ROOT; };
D901F4CF0FC0DBCB0040C290 /* wl_inter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_inter.cpp; path = ../wl_inter.cpp; sourceTree = SOURCE_ROOT; };
D901F4D00FC0DBCB0040C290 /* wl_game.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_game.cpp; path = ../wl_game.cpp; sourceTree = SOURCE_ROOT; };
D901F4D10FC0DBCB0040C290 /* wl_floorceiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_floorceiling.cpp; path = ../wl_floorceiling.cpp; sourceTree = SOURCE_ROOT; };
D901F4D20FC0DBCB0040C290 /* gfxv_wl6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gfxv_wl6.h; path = ../gfxv_wl6.h; sourceTree = SOURCE_ROOT; };
D901F4D30FC0DBCB0040C290 /* gfxv_apo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gfxv_apo.h; path = ../gfxv_apo.h; sourceTree = SOURCE_ROOT; };
D901F4D50FC0DBCB0040C290 /* wl_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_draw.cpp; path = ../wl_draw.cpp; sourceTree = SOURCE_ROOT; };
D901F4D60FC0DBCB0040C290 /* wl_dir3dspr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_dir3dspr.cpp; path = ../wl_dir3dspr.cpp; sourceTree = SOURCE_ROOT; };
D901F4D70FC0DBCB0040C290 /* wl_def.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wl_def.h; path = ../wl_def.h; sourceTree = SOURCE_ROOT; };
D901F4D80FC0DBCB0040C290 /* wl_debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_debug.cpp; path = ../wl_debug.cpp; sourceTree = SOURCE_ROOT; };
D901F4D90FC0DBCB0040C290 /* wl_cloudsky.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wl_cloudsky.h; path = ../wl_cloudsky.h; sourceTree = SOURCE_ROOT; };
D901F4DA0FC0DBCB0040C290 /* wl_cloudsky.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_cloudsky.cpp; path = ../wl_cloudsky.cpp; sourceTree = SOURCE_ROOT; };
D901F4DB0FC0DBCB0040C290 /* wl_atmos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wl_atmos.h; path = ../wl_atmos.h; sourceTree = SOURCE_ROOT; };
D901F4DC0FC0DBCB0040C290 /* wl_atmos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_atmos.cpp; path = ../wl_atmos.cpp; sourceTree = SOURCE_ROOT; };
D901F4DD0FC0DBCB0040C290 /* wl_agent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_agent.cpp; path = ../wl_agent.cpp; sourceTree = SOURCE_ROOT; };
D901F4DE0FC0DBCB0040C290 /* wl_act2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_act2.cpp; path = ../wl_act2.cpp; sourceTree = SOURCE_ROOT; };
D901F4DF0FC0DBCB0040C290 /* wl_act1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_act1.cpp; path = ../wl_act1.cpp; sourceTree = SOURCE_ROOT; };
D901F4E00FC0DBCB0040C290 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = version.h; path = ../version.h; sourceTree = SOURCE_ROOT; };
D901F4E10FC0DBCB0040C290 /* signon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = signon.cpp; path = ../signon.cpp; sourceTree = SOURCE_ROOT; };
D901F4E20FC0DBCB0040C290 /* sdl_winmain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sdl_winmain.cpp; path = ../sdl_winmain.cpp; sourceTree = SOURCE_ROOT; };
D901F4E30FC0DBCB0040C290 /* audiowl6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audiowl6.h; path = ../audiowl6.h; sourceTree = SOURCE_ROOT; };
D901F4E40FC0DBCB0040C290 /* id_ca.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_ca.h; path = ../id_ca.h; sourceTree = SOURCE_ROOT; };
D901F4E50FC0DBCB0040C290 /* id_us_1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_us_1.cpp; path = ../id_us_1.cpp; sourceTree = SOURCE_ROOT; };
D901F4E60FC0DBCB0040C290 /* id_us.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_us.h; path = ../id_us.h; sourceTree = SOURCE_ROOT; };
D901F4E70FC0DBCB0040C290 /* wl_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_text.cpp; path = ../wl_text.cpp; sourceTree = SOURCE_ROOT; };
D901F4E80FC0DBCB0040C290 /* id_sd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_sd.h; path = ../id_sd.h; sourceTree = SOURCE_ROOT; };
D901F4E90FC0DBCB0040C290 /* id_sd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_sd.cpp; path = ../id_sd.cpp; sourceTree = SOURCE_ROOT; };
D901F4EA0FC0DBCB0040C290 /* gp2x.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gp2x.h; path = ../gp2x.h; sourceTree = SOURCE_ROOT; };
D901F4EB0FC0DBCB0040C290 /* wl_state.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_state.cpp; path = ../wl_state.cpp; sourceTree = SOURCE_ROOT; };
D901F4EC0FC0DBCB0040C290 /* wl_shade.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wl_shade.h; path = ../wl_shade.h; sourceTree = SOURCE_ROOT; };
D901F4ED0FC0DBCB0040C290 /* wl_shade.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_shade.cpp; path = ../wl_shade.cpp; sourceTree = SOURCE_ROOT; };
D901F4EE0FC0DBCB0040C290 /* wl_play.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_play.cpp; path = ../wl_play.cpp; sourceTree = SOURCE_ROOT; };
D901F4EF0FC0DBCB0040C290 /* wl_parallax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_parallax.cpp; path = ../wl_parallax.cpp; sourceTree = SOURCE_ROOT; };
D901F4F00FC0DBCB0040C290 /* wl_menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wl_menu.h; path = ../wl_menu.h; sourceTree = SOURCE_ROOT; };
D901F4F10FC0DBCB0040C290 /* wl_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_menu.cpp; path = ../wl_menu.cpp; sourceTree = SOURCE_ROOT; };
D901F4F20FC0DBCB0040C290 /* wl_main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wl_main.cpp; path = ../wl_main.cpp; sourceTree = SOURCE_ROOT; };
D901F4F30FC0DBCB0040C290 /* id_in.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_in.cpp; path = ../id_in.cpp; sourceTree = SOURCE_ROOT; };
D901F4F40FC0DBCB0040C290 /* foreign.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = foreign.h; path = ../foreign.h; sourceTree = SOURCE_ROOT; };
D901F4F50FC0DBCB0040C290 /* id_pm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_pm.h; path = ../id_pm.h; sourceTree = SOURCE_ROOT; };
D901F4F60FC0DBCB0040C290 /* id_vl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_vl.h; path = ../id_vl.h; sourceTree = SOURCE_ROOT; };
D901F4F70FC0DBCB0040C290 /* id_vl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_vl.cpp; path = ../id_vl.cpp; sourceTree = SOURCE_ROOT; };
D901F4FA0FC0DBCB0040C290 /* id_vh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = id_vh.h; path = ../id_vh.h; sourceTree = SOURCE_ROOT; };
D901F4FB0FC0DBCB0040C290 /* id_vh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_vh.cpp; path = ../id_vh.cpp; sourceTree = SOURCE_ROOT; };
D901F4FC0FC0DBCB0040C290 /* id_ca.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = id_ca.cpp; path = ../id_ca.cpp; sourceTree = SOURCE_ROOT; };
D94B84D40FC0F2F800EADB6F /* wolf4sdl.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = wolf4sdl.icns; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
D901F4C20FC0DB520040C290 /* SDL_mixer.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
002F3A2B09D0888800EBEB88 /* SDLMain.h */,
002F3A2C09D0888800EBEB88 /* SDLMain.m */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
002F39F909D0881F00EBEB88 /* SDL.framework */,
D901F4C10FC0DB520040C290 /* SDL_mixer.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* Wolf4SDL.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* Untitled */ = {
isa = PBXGroup;
children = (
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = Untitled;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
D901F4C70FC0DBCB0040C290 /* id_in.h */,
D901F4C80FC0DBCB0040C290 /* f_spear.h */,
D901F4C90FC0DBCB0040C290 /* fmopl.h */,
D901F4CA0FC0DBCB0040C290 /* audiosod.h */,
D901F4CB0FC0DBCB0040C290 /* fmopl.cpp */,
D901F4CC0FC0DBCB0040C290 /* id_pm.cpp */,
D901F4CE0FC0DBCB0040C290 /* gfxv_sod.h */,
D901F4CF0FC0DBCB0040C290 /* wl_inter.cpp */,
D901F4D00FC0DBCB0040C290 /* wl_game.cpp */,
D901F4D10FC0DBCB0040C290 /* wl_floorceiling.cpp */,
D901F4D20FC0DBCB0040C290 /* gfxv_wl6.h */,
D901F4D30FC0DBCB0040C290 /* gfxv_apo.h */,
D901F4D50FC0DBCB0040C290 /* wl_draw.cpp */,
D901F4D60FC0DBCB0040C290 /* wl_dir3dspr.cpp */,
D901F4D70FC0DBCB0040C290 /* wl_def.h */,
D901F4D80FC0DBCB0040C290 /* wl_debug.cpp */,
D901F4D90FC0DBCB0040C290 /* wl_cloudsky.h */,
D901F4DA0FC0DBCB0040C290 /* wl_cloudsky.cpp */,
D901F4DB0FC0DBCB0040C290 /* wl_atmos.h */,
D901F4DC0FC0DBCB0040C290 /* wl_atmos.cpp */,
D901F4DD0FC0DBCB0040C290 /* wl_agent.cpp */,
D901F4DE0FC0DBCB0040C290 /* wl_act2.cpp */,
D901F4DF0FC0DBCB0040C290 /* wl_act1.cpp */,
D901F4E00FC0DBCB0040C290 /* version.h */,
D901F4E10FC0DBCB0040C290 /* signon.cpp */,
D901F4E20FC0DBCB0040C290 /* sdl_winmain.cpp */,
D901F4E30FC0DBCB0040C290 /* audiowl6.h */,
D901F4E40FC0DBCB0040C290 /* id_ca.h */,
D901F4E50FC0DBCB0040C290 /* id_us_1.cpp */,
D901F4E60FC0DBCB0040C290 /* id_us.h */,
D901F4E70FC0DBCB0040C290 /* wl_text.cpp */,
D901F4E80FC0DBCB0040C290 /* id_sd.h */,
D901F4E90FC0DBCB0040C290 /* id_sd.cpp */,
D901F4EA0FC0DBCB0040C290 /* gp2x.h */,
D901F4EB0FC0DBCB0040C290 /* wl_state.cpp */,
D901F4EC0FC0DBCB0040C290 /* wl_shade.h */,
D901F4ED0FC0DBCB0040C290 /* wl_shade.cpp */,
D901F4EE0FC0DBCB0040C290 /* wl_play.cpp */,
D901F4EF0FC0DBCB0040C290 /* wl_parallax.cpp */,
D901F4F00FC0DBCB0040C290 /* wl_menu.h */,
D901F4F10FC0DBCB0040C290 /* wl_menu.cpp */,
D901F4F20FC0DBCB0040C290 /* wl_main.cpp */,
D901F4F30FC0DBCB0040C290 /* id_in.cpp */,
D901F4F40FC0DBCB0040C290 /* foreign.h */,
D901F4F50FC0DBCB0040C290 /* id_pm.h */,
D901F4F60FC0DBCB0040C290 /* id_vl.h */,
D901F4F70FC0DBCB0040C290 /* id_vl.cpp */,
D901F4FA0FC0DBCB0040C290 /* id_vh.h */,
D901F4FB0FC0DBCB0040C290 /* id_vh.cpp */,
D901F4FC0FC0DBCB0040C290 /* id_ca.cpp */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
D94B84D40FC0F2F800EADB6F /* wolf4sdl.icns */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* Wolf4SDL */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Wolf4SDL" */;
buildPhases = (
002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */,
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Wolf4SDL;
productInstallPath = "$(HOME)/Applications";
productName = Untitled;
productReference = 8D1107320486CEB800E47090 /* Wolf4SDL.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Wolf4SDL" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* Untitled */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* Wolf4SDL */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
D94B84D50FC0F2F800EADB6F /* wolf4sdl.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */,
D901F4FD0FC0DBCB0040C290 /* fmopl.cpp in Sources */,
D901F4FE0FC0DBCB0040C290 /* id_pm.cpp in Sources */,
D901F5000FC0DBCB0040C290 /* wl_inter.cpp in Sources */,
D901F5010FC0DBCB0040C290 /* wl_game.cpp in Sources */,
D901F5020FC0DBCB0040C290 /* wl_floorceiling.cpp in Sources */,
D901F5030FC0DBCB0040C290 /* wl_draw.cpp in Sources */,
D901F5040FC0DBCB0040C290 /* wl_dir3dspr.cpp in Sources */,
D901F5050FC0DBCB0040C290 /* wl_debug.cpp in Sources */,
D901F5060FC0DBCB0040C290 /* wl_cloudsky.cpp in Sources */,
D901F5070FC0DBCB0040C290 /* wl_atmos.cpp in Sources */,
D901F5080FC0DBCB0040C290 /* wl_agent.cpp in Sources */,
D901F5090FC0DBCB0040C290 /* wl_act2.cpp in Sources */,
D901F50A0FC0DBCB0040C290 /* wl_act1.cpp in Sources */,
D901F50B0FC0DBCB0040C290 /* signon.cpp in Sources */,
D901F50C0FC0DBCB0040C290 /* sdl_winmain.cpp in Sources */,
D901F50D0FC0DBCB0040C290 /* id_us_1.cpp in Sources */,
D901F50E0FC0DBCB0040C290 /* wl_text.cpp in Sources */,
D901F50F0FC0DBCB0040C290 /* id_sd.cpp in Sources */,
D901F5100FC0DBCB0040C290 /* wl_state.cpp in Sources */,
D901F5110FC0DBCB0040C290 /* wl_shade.cpp in Sources */,
D901F5120FC0DBCB0040C290 /* wl_play.cpp in Sources */,
D901F5130FC0DBCB0040C290 /* wl_parallax.cpp in Sources */,
D901F5140FC0DBCB0040C290 /* wl_menu.cpp in Sources */,
D901F5150FC0DBCB0040C290 /* wl_main.cpp in Sources */,
D901F5160FC0DBCB0040C290 /* id_in.cpp in Sources */,
D901F5170FC0DBCB0040C290 /* id_vl.cpp in Sources */,
D901F51A0FC0DBCB0040C290 /* id_vh.cpp in Sources */,
D901F51B0FC0DBCB0040C290 /* id_ca.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.6;
PRODUCT_NAME = Wolf4SDL;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
GCC_AUTO_VECTORIZATION = YES;
GCC_ENABLE_SSE3_EXTENSIONS = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.6;
OTHER_CFLAGS = "-fast";
OTHER_CPLUSPLUSFLAGS = "-fast";
PRODUCT_NAME = Wolf4SDL;
SDKROOT = macosx;
WRAPPER_EXTENSION = app;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
FRAMEWORK_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks",
/Library/Frameworks,
"$(FRAMEWORK_SEARCH_PATHS)",
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks/SDL.framework/Headers",
/Library/Frameworks/SDL.framework/Headers,
"$(HOME)/Library/Frameworks/SDL.framework/Headers/SDL_mixer",
/Library/Frameworks/SDL.framework/Headers/SDL_mixer,
"$(HEADER_SEARCH_PATHS)",
);
PREBINDING = NO;
SDKROOT = macosx;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
FRAMEWORK_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks",
/Library/Frameworks,
"$(FRAMEWORK_SEARCH_PATHS)",
);
GCC_DYNAMIC_NO_PIC = YES;
GCC_FAST_MATH = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(HOME)/Library/Frameworks/SDL.framework/Headers",
/Library/Frameworks/SDL.framework/Headers,
"$(HOME)/Library/Frameworks/SDL.framework/Headers/SDL_mixer",
/Library/Frameworks/SDL.framework/Headers/SDL_mixer,
"$(HEADER_SEARCH_PATHS)",
);
LLVM_LTO = YES;
PREBINDING = NO;
SDKROOT = macosx;
VALID_ARCHS = "i386 x86_64";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Wolf4SDL" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Wolf4SDL" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

BIN
macosx/wolf4sdl.icns Normal file

Binary file not shown.

378
sdl_winmain.cpp Normal file
View File

@ -0,0 +1,378 @@
#ifdef _WIN32
/*
SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
Modified to write stdout/stderr to a message box at shutdown by Ripper 2007-12-27
The WinMain function -- calls your program's main() function
*/
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifdef _WIN32_WCE
# define DIR_SEPERATOR TEXT("\\")
# undef _getcwd
# define _getcwd(str,len) wcscpy(str,TEXT(""))
# define setbuf(f,b)
# define setvbuf(w,x,y,z)
# define fopen _wfopen
# define freopen _wfreopen
# define remove(x) DeleteFile(x)
#else
# define DIR_SEPERATOR TEXT("/")
# include <direct.h>
#endif
/* Include the SDL main definition header */
#include "SDL.h"
#include "SDL_main.h"
#ifdef main
# ifndef _WIN32_WCE_EMULATION
# undef main
# endif /* _WIN32_WCE_EMULATION */
#endif /* main */
/* The standard output files */
#define STDOUT_FILE TEXT("stdout.txt")
#define STDERR_FILE TEXT("stderr.txt")
#ifndef NO_STDIO_REDIRECT
# ifdef _WIN32_WCE
static wchar_t stdoutPath[MAX_PATH];
static wchar_t stderrPath[MAX_PATH];
# else
static char stdoutPath[MAX_PATH];
static char stderrPath[MAX_PATH];
# endif
#endif
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
/* seems to be undefined in Win CE although in online help */
#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
#endif /* _WIN32_WCE < 300 */
/* Parse a command line buffer into arguments */
static int ParseCommandLine(char *cmdline, char **argv)
{
char *bufp;
int argc;
argc = 0;
for ( bufp = cmdline; *bufp; ) {
/* Skip leading whitespace */
while ( isspace(*bufp) ) {
++bufp;
}
/* Skip over argument */
if ( *bufp == '"' ) {
++bufp;
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && (*bufp != '"') ) {
++bufp;
}
} else {
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && ! isspace(*bufp) ) {
++bufp;
}
}
if ( *bufp ) {
if ( argv ) {
*bufp = '\0';
}
++bufp;
}
}
if ( argv ) {
argv[argc] = NULL;
}
return(argc);
}
/* Show an error message */
static void ShowError(const char *title, const char *message)
{
/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
#ifdef USE_MESSAGEBOX
MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK);
#else
fprintf(stderr, "%s: %s\n", title, message);
#endif
}
/* Pop up an out of memory message, returns to Windows */
static BOOL OutOfMemory(void)
{
ShowError("Fatal Error", "Out of memory - aborting");
return FALSE;
}
/* SDL_Quit() shouldn't be used with atexit() directly because
calling conventions may differ... */
static void cleanup(void)
{
SDL_Quit();
}
/* Remove the output files if there was no output written */
static void cleanup_output(void)
{
#if 1
#ifndef NO_STDIO_REDIRECT
FILE *file;
#endif
#endif
/* Flush the output in case anything is queued */
fclose(stdout);
fclose(stderr);
#if 1
#ifndef NO_STDIO_REDIRECT
/* See if the files have any output in them */
if ( stdoutPath[0] ) {
file = fopen(stdoutPath, TEXT("r"));
if ( file ) {
char buf[16384];
size_t readbytes = fread(buf, 1, 16383, file);
fclose(file);
if(readbytes != 0)
{
buf[readbytes] = 0; // cut after last byte (<=16383)
MessageBox(NULL, buf, "Wolf4SDL", MB_OK);
}
else
remove(stdoutPath); // remove empty file
}
}
if ( stderrPath[0] ) {
file = fopen(stderrPath, TEXT("rb"));
if ( file ) {
char buf[16384];
size_t readbytes = fread(buf, 1, 16383, file);
fclose(file);
if(readbytes != 0)
{
buf[readbytes] = 0; // cut after last byte (<=16383)
MessageBox(NULL, buf, "Wolf4SDL", MB_OK);
}
else
remove(stderrPath); // remove empty file
}
}
#endif
#endif
}
//#if defined(_MSC_VER) && !defined(_WIN32_WCE)
///* The VC++ compiler needs main defined */
//#define console_main main
//#endif
/* This is where execution begins [console apps] */
int console_main(int argc, char *argv[])
{
size_t n;
char *bufp, *appname;
int status;
/* Get the class name from argv[0] */
appname = argv[0];
if ( (bufp=SDL_strrchr(argv[0], '\\')) != NULL ) {
appname = bufp+1;
} else
if ( (bufp=SDL_strrchr(argv[0], '/')) != NULL ) {
appname = bufp+1;
}
if ( (bufp=SDL_strrchr(appname, '.')) == NULL )
n = SDL_strlen(appname);
else
n = (bufp-appname);
bufp = SDL_stack_alloc(char, n+1);
if ( bufp == NULL ) {
return OutOfMemory();
}
SDL_strlcpy(bufp, appname, n+1);
appname = bufp;
/* Load SDL dynamic link library */
if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
ShowError("WinMain() error", SDL_GetError());
return(FALSE);
}
atexit(cleanup_output);
atexit(cleanup);
/* Sam:
We still need to pass in the application handle so that
DirectInput will initialize properly when SDL_RegisterApp()
is called later in the video initialization.
*/
SDL_SetModuleHandle(GetModuleHandle(NULL));
/* Run the application main() code */
status = SDL_main(argc, argv);
/* Exit cleanly, calling atexit() functions */
exit(status);
/* Hush little compiler, don't you cry... */
return 0;
}
/* This is where execution begins [windowed apps] */
#ifdef _WIN32_WCE
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
#else
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
#endif
{
HINSTANCE handle;
char **argv;
int argc;
char *cmdline;
#ifdef _WIN32_WCE
wchar_t *bufp;
int nLen;
#else
char *bufp;
size_t nLen;
#endif
#ifndef NO_STDIO_REDIRECT
DWORD pathlen;
#ifdef _WIN32_WCE
wchar_t path[MAX_PATH];
#else
char path[MAX_PATH];
#endif
FILE *newfp;
#endif
/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
keep them open. This is a hack.. hopefully it will be fixed
someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
*/
handle = LoadLibrary(TEXT("DDRAW.DLL"));
if ( handle != NULL ) {
FreeLibrary(handle);
}
#ifndef NO_STDIO_REDIRECT
pathlen = GetModuleFileName(NULL, path, SDL_arraysize(path));
while ( pathlen > 0 && path[pathlen] != '\\' ) {
--pathlen;
}
path[pathlen] = '\0';
#ifdef _WIN32_WCE
wcsncpy( stdoutPath, path, SDL_arraysize(stdoutPath) );
wcsncat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
#else
SDL_strlcpy( stdoutPath, path, SDL_arraysize(stdoutPath) );
SDL_strlcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
#endif
/* Redirect standard input and standard output */
newfp = freopen(stdoutPath, TEXT("w"), stdout);
#ifndef _WIN32_WCE
if ( newfp == NULL ) { /* This happens on NT */
#if !defined(stdout)
stdout = fopen(stdoutPath, TEXT("w"));
#else
newfp = fopen(stdoutPath, TEXT("w"));
if ( newfp ) {
*stdout = *newfp;
}
#endif
}
#endif /* _WIN32_WCE */
#ifdef _WIN32_WCE
wcsncpy( stderrPath, path, SDL_arraysize(stdoutPath) );
wcsncat( stderrPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
#else
SDL_strlcpy( stderrPath, path, SDL_arraysize(stderrPath) );
SDL_strlcat( stderrPath, DIR_SEPERATOR STDERR_FILE, SDL_arraysize(stderrPath) );
#endif
newfp = freopen(stderrPath, TEXT("w"), stderr);
#ifndef _WIN32_WCE
if ( newfp == NULL ) { /* This happens on NT */
#if !defined(stderr)
stderr = fopen(stderrPath, TEXT("w"));
#else
newfp = fopen(stderrPath, TEXT("w"));
if ( newfp ) {
*stderr = *newfp;
}
#endif
}
#endif /* _WIN32_WCE */
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */
setbuf(stderr, NULL); /* No buffering */
#endif /* !NO_STDIO_REDIRECT */
#ifdef _WIN32_WCE
nLen = wcslen(szCmdLine)+128+1;
bufp = SDL_stack_alloc(wchar_t, nLen*2);
wcscpy (bufp, TEXT("\""));
GetModuleFileName(NULL, bufp+1, 128-3);
wcscpy (bufp+wcslen(bufp), TEXT("\" "));
wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
nLen = wcslen(bufp)+1;
cmdline = SDL_stack_alloc(char, nLen);
if ( cmdline == NULL ) {
return OutOfMemory();
}
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
#else
/* Grab the command line */
bufp = GetCommandLine();
nLen = SDL_strlen(bufp)+1;
cmdline = SDL_stack_alloc(char, nLen);
if ( cmdline == NULL ) {
return OutOfMemory();
}
SDL_strlcpy(cmdline, bufp, nLen);
#endif
/* Parse it into argv and argc */
argc = ParseCommandLine(cmdline, NULL);
argv = SDL_stack_alloc(char*, argc+1);
if ( argv == NULL ) {
return OutOfMemory();
}
ParseCommandLine(cmdline, argv);
/* Run the main program (after a little SDL initialization) */
console_main(argc, argv);
/* Hush little compiler, don't you cry... */
return 0;
}
#endif // _WIN32

8007
signon.cpp Normal file

File diff suppressed because it is too large Load Diff

52
sodpal.inc Normal file
View File

@ -0,0 +1,52 @@
RGB( 0, 0, 0),RGB( 0, 0, 42),RGB( 0, 42, 0),RGB( 0, 42, 42),RGB( 42, 0, 0),
RGB( 42, 0, 42),RGB( 42, 21, 0),RGB( 42, 42, 42),RGB( 21, 21, 21),RGB( 21, 21, 63),
RGB( 21, 63, 21),RGB( 21, 63, 63),RGB( 63, 21, 21),RGB( 63, 21, 63),RGB( 63, 63, 21),
RGB( 63, 63, 63),RGB( 59, 59, 59),RGB( 55, 55, 55),RGB( 52, 52, 52),RGB( 48, 48, 48),
RGB( 45, 45, 45),RGB( 42, 42, 42),RGB( 38, 38, 38),RGB( 35, 35, 35),RGB( 31, 31, 31),
RGB( 28, 28, 28),RGB( 25, 25, 25),RGB( 21, 21, 21),RGB( 18, 18, 18),RGB( 14, 14, 14),
RGB( 11, 11, 11),RGB( 8, 8, 8),RGB( 63, 0, 0),RGB( 59, 0, 0),RGB( 56, 0, 0),
RGB( 53, 0, 0),RGB( 50, 0, 0),RGB( 47, 0, 0),RGB( 44, 0, 0),RGB( 41, 0, 0),
RGB( 38, 0, 0),RGB( 34, 0, 0),RGB( 31, 0, 0),RGB( 28, 0, 0),RGB( 25, 0, 0),
RGB( 22, 0, 0),RGB( 19, 0, 0),RGB( 16, 0, 0),RGB( 63, 54, 54),RGB( 63, 46, 46),
RGB( 63, 39, 39),RGB( 63, 31, 31),RGB( 63, 23, 23),RGB( 63, 16, 16),RGB( 63, 8, 8),
RGB( 63, 0, 0),RGB( 63, 42, 23),RGB( 63, 38, 16),RGB( 63, 34, 8),RGB( 63, 30, 0),
RGB( 57, 27, 0),RGB( 51, 24, 0),RGB( 45, 21, 0),RGB( 39, 19, 0),RGB( 63, 63, 54),
RGB( 63, 63, 46),RGB( 63, 63, 39),RGB( 63, 63, 31),RGB( 63, 62, 23),RGB( 63, 61, 16),
RGB( 63, 61, 8),RGB( 63, 61, 0),RGB( 57, 54, 0),RGB( 51, 49, 0),RGB( 45, 43, 0),
RGB( 39, 39, 0),RGB( 33, 33, 0),RGB( 28, 27, 0),RGB( 22, 21, 0),RGB( 16, 16, 0),
RGB( 52, 63, 23),RGB( 49, 63, 16),RGB( 45, 63, 8),RGB( 40, 63, 0),RGB( 36, 57, 0),
RGB( 32, 51, 0),RGB( 29, 45, 0),RGB( 24, 39, 0),RGB( 54, 63, 54),RGB( 47, 63, 46),
RGB( 39, 63, 39),RGB( 32, 63, 31),RGB( 24, 63, 23),RGB( 16, 63, 16),RGB( 8, 63, 8),
RGB( 0, 63, 0),RGB( 0, 63, 0),RGB( 0, 59, 0),RGB( 0, 56, 0),RGB( 0, 53, 0),
RGB( 1, 50, 0),RGB( 1, 47, 0),RGB( 1, 44, 0),RGB( 1, 41, 0),RGB( 1, 38, 0),
RGB( 1, 34, 0),RGB( 1, 31, 0),RGB( 1, 28, 0),RGB( 1, 25, 0),RGB( 1, 22, 0),
RGB( 1, 19, 0),RGB( 1, 16, 0),RGB( 54, 63, 63),RGB( 46, 63, 63),RGB( 39, 63, 63),
RGB( 31, 63, 62),RGB( 23, 63, 63),RGB( 16, 63, 63),RGB( 8, 63, 63),RGB( 0, 63, 63),
RGB( 0, 57, 57),RGB( 0, 51, 51),RGB( 0, 45, 45),RGB( 0, 39, 39),RGB( 0, 33, 33),
RGB( 0, 28, 28),RGB( 0, 22, 22),RGB( 0, 16, 16),RGB( 23, 47, 63),RGB( 16, 44, 63),
RGB( 8, 42, 63),RGB( 0, 39, 63),RGB( 0, 35, 57),RGB( 0, 31, 51),RGB( 0, 27, 45),
RGB( 0, 23, 39),RGB( 54, 54, 63),RGB( 46, 47, 63),RGB( 39, 39, 63),RGB( 31, 32, 63),
RGB( 23, 24, 63),RGB( 16, 16, 63),RGB( 8, 9, 63),RGB( 0, 1, 63),RGB( 0, 0, 63),
RGB( 0, 0, 59),RGB( 0, 0, 56),RGB( 0, 0, 53),RGB( 0, 0, 50),RGB( 0, 0, 47),
RGB( 0, 0, 44),RGB( 0, 0, 41),RGB( 0, 0, 38),RGB( 0, 0, 34),RGB( 0, 0, 31),
RGB( 0, 0, 28),RGB( 0, 0, 25),RGB( 0, 0, 22),RGB( 0, 0, 19),RGB( 0, 0, 16),
RGB( 10, 10, 10),RGB( 63, 56, 13),RGB( 63, 53, 9),RGB( 63, 51, 6),RGB( 63, 48, 2),
RGB( 63, 45, 0),RGB( 0, 14, 0),RGB( 0, 10, 0),RGB( 38, 0, 57),RGB( 32, 0, 51),
RGB( 29, 0, 45),RGB( 24, 0, 39),RGB( 20, 0, 33),RGB( 17, 0, 28),RGB( 13, 0, 22),
RGB( 10, 0, 16),RGB( 63, 54, 63),RGB( 63, 46, 63),RGB( 63, 39, 63),RGB( 63, 31, 63),
RGB( 63, 23, 63),RGB( 63, 16, 63),RGB( 63, 8, 63),RGB( 63, 0, 63),RGB( 56, 0, 57),
RGB( 50, 0, 51),RGB( 45, 0, 45),RGB( 39, 0, 39),RGB( 33, 0, 33),RGB( 27, 0, 28),
RGB( 22, 0, 22),RGB( 16, 0, 16),RGB( 63, 58, 55),RGB( 63, 56, 52),RGB( 63, 54, 49),
RGB( 63, 53, 47),RGB( 63, 51, 44),RGB( 63, 49, 41),RGB( 63, 47, 39),RGB( 63, 46, 36),
RGB( 63, 44, 32),RGB( 63, 41, 28),RGB( 63, 39, 24),RGB( 60, 37, 23),RGB( 58, 35, 22),
RGB( 55, 34, 21),RGB( 52, 32, 20),RGB( 50, 31, 19),RGB( 47, 30, 18),RGB( 45, 28, 17),
RGB( 42, 26, 16),RGB( 40, 25, 15),RGB( 39, 24, 14),RGB( 36, 23, 13),RGB( 34, 22, 12),
RGB( 32, 20, 11),RGB( 29, 19, 10),RGB( 27, 18, 9),RGB( 23, 16, 8),RGB( 21, 15, 7),
RGB( 18, 14, 6),RGB( 16, 12, 6),RGB( 14, 11, 5),RGB( 10, 8, 3),RGB( 24, 0, 25),
RGB( 0, 25, 25),RGB( 0, 24, 24),RGB( 0, 0, 7),RGB( 0, 0, 11),RGB( 12, 9, 4),
RGB( 18, 0, 18),RGB( 20, 0, 20),RGB( 0, 0, 13),RGB( 7, 7, 7),RGB( 19, 19, 19),
RGB( 23, 23, 23),RGB( 16, 16, 16),RGB( 12, 12, 12),RGB( 13, 13, 13),RGB( 54, 61, 61),
RGB( 46, 58, 58),RGB( 39, 55, 55),RGB( 29, 50, 50),RGB( 18, 48, 48),RGB( 8, 45, 45),
RGB( 8, 44, 44),RGB( 0, 41, 41),RGB( 0, 38, 38),RGB( 0, 35, 35),RGB( 0, 33, 33),
RGB( 0, 31, 31),RGB( 0, 30, 30),RGB( 0, 29, 29),RGB( 0, 28, 28),RGB( 0, 27, 27),
RGB( 38, 0, 34)

51
version.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef _VERSION_H_
#define _VERSION_H_
#ifndef VERSIONALREADYCHOSEN // used for batch compiling
/* Defines used for different versions */
//#define SPEAR
//#define SPEARDEMO
//#define UPLOAD
#define GOODTIMES
#define CARMACIZED
//#define APOGEE_1_0
//#define APOGEE_1_1
//#define APOGEE_1_2
/*
Wolf3d Full v1.1 Apogee (with ReadThis) - define CARMACIZED and APOGEE_1_1
Wolf3d Full v1.4 Apogee (with ReadThis) - define CARMACIZED
Wolf3d Full v1.4 GT/ID/Activision - define CARMACIZED and GOODTIMES
Wolf3d Shareware v1.0 - define UPLOAD and APOGEE_1_0
Wolf3d Shareware v1.1 - define CARMACIZED and UPLOAD and APOGEE_1_1
Wolf3d Shareware v1.2 - define CARMACIZED and UPLOAD and APOGEE_1_2
Wolf3d Shareware v1.4 - define CARMACIZED and UPLOAD
Spear of Destiny Full and Mission Disks - define CARMACIZED and SPEAR
(and GOODTIMES for no FormGen quiz)
Spear of Destiny Demo - define CARMACIZED and SPEAR and SPEARDEMO
*/
#endif
//#define USE_FEATUREFLAGS // Enables the level feature flags (see bottom of wl_def.h)
//#define USE_SHADING // Enables shading support (see wl_shade.cpp)
//#define USE_DIR3DSPR // Enables directional 3d sprites (see wl_dir3dspr.cpp)
//#define USE_FLOORCEILINGTEX // Enables floor and ceiling textures stored in the third mapplane (see wl_floorceiling.cpp)
//#define USE_HIRES // Enables high resolution textures/sprites (128x128)
//#define USE_PARALLAX 16 // Enables parallax sky with 16 textures per sky (see wl_parallax.cpp)
//#define USE_CLOUDSKY // Enables cloud sky support (see wl_cloudsky.cpp)
//#define USE_STARSKY // Enables star sky support (see wl_atmos.cpp)
//#define USE_RAIN // Enables rain support (see wl_atmos.cpp)
//#define USE_SNOW // Enables snow support (see wl_atmos.cpp)
//#define FIXRAINSNOWLEAKS // Enables leaking ceilings fix (by Adam Biser, only needed if maps with rain/snow and ceilings exist)
#define DEBUGKEYS // Comment this out to compile without the Tab debug keys
#define ARTSEXTERN
#define DEMOSEXTERN
#define PLAYDEMOLIKEORIGINAL // When playing or recording demos, several bug fixes do not take
// effect to let the original demos work as in the original Wolf3D v1.4
// (actually better, as the second demo rarely worked)
#endif

859
wl_act1.cpp Normal file
View File

@ -0,0 +1,859 @@
// WL_ACT1.C
#include "wl_def.h"
#pragma hdrstop
/*
=============================================================================
STATICS
=============================================================================
*/
statobj_t statobjlist[MAXSTATS];
statobj_t *laststatobj;
struct
{
short picnum;
wl_stat_t type;
uint32_t specialFlags; // they are ORed to the statobj_t flags
} statinfo[] =
{
{SPR_STAT_0}, // puddle spr1v
{SPR_STAT_1,block}, // Green Barrel "
{SPR_STAT_2,block}, // Table/chairs "
{SPR_STAT_3,block,FL_FULLBRIGHT}, // Floor lamp "
{SPR_STAT_4,none,FL_FULLBRIGHT}, // Chandelier "
{SPR_STAT_5,block}, // Hanged man "
{SPR_STAT_6,bo_alpo}, // Bad food "
{SPR_STAT_7,block}, // Red pillar "
//
// NEW PAGE
//
{SPR_STAT_8,block}, // Tree spr2v
{SPR_STAT_9}, // Skeleton flat "
{SPR_STAT_10,block}, // Sink " (SOD:gibs)
{SPR_STAT_11,block}, // Potted plant "
{SPR_STAT_12,block}, // Urn "
{SPR_STAT_13,block}, // Bare table "
{SPR_STAT_14,none,FL_FULLBRIGHT}, // Ceiling light "
#ifndef SPEAR
{SPR_STAT_15}, // Kitchen stuff "
#else
{SPR_STAT_15,block}, // Gibs!
#endif
//
// NEW PAGE
//
{SPR_STAT_16,block}, // suit of armor spr3v
{SPR_STAT_17,block}, // Hanging cage "
{SPR_STAT_18,block}, // SkeletoninCage "
{SPR_STAT_19}, // Skeleton relax "
{SPR_STAT_20,bo_key1}, // Key 1 "
{SPR_STAT_21,bo_key2}, // Key 2 "
{SPR_STAT_22,block}, // stuff (SOD:gibs)
{SPR_STAT_23}, // stuff
//
// NEW PAGE
//
{SPR_STAT_24,bo_food}, // Good food spr4v
{SPR_STAT_25,bo_firstaid}, // First aid "
{SPR_STAT_26,bo_clip}, // Clip "
{SPR_STAT_27,bo_machinegun}, // Machine gun "
{SPR_STAT_28,bo_chaingun}, // Gatling gun "
{SPR_STAT_29,bo_cross}, // Cross "
{SPR_STAT_30,bo_chalice}, // Chalice "
{SPR_STAT_31,bo_bible}, // Bible "
//
// NEW PAGE
//
{SPR_STAT_32,bo_crown}, // crown spr5v
{SPR_STAT_33,bo_fullheal,FL_FULLBRIGHT},// one up "
{SPR_STAT_34,bo_gibs}, // gibs "
{SPR_STAT_35,block}, // barrel "
{SPR_STAT_36,block}, // well "
{SPR_STAT_37,block}, // Empty well "
{SPR_STAT_38,bo_gibs}, // Gibs 2 "
{SPR_STAT_39,block}, // flag "
//
// NEW PAGE
//
#ifndef SPEAR
{SPR_STAT_40,block}, // Call Apogee spr7v
#else
{SPR_STAT_40}, // Red light
#endif
//
// NEW PAGE
//
{SPR_STAT_41}, // junk "
{SPR_STAT_42}, // junk "
{SPR_STAT_43}, // junk "
#ifndef SPEAR
{SPR_STAT_44}, // pots "
#else
{SPR_STAT_44,block}, // Gibs!
#endif
{SPR_STAT_45,block}, // stove " (SOD:gibs)
{SPR_STAT_46,block}, // spears " (SOD:gibs)
{SPR_STAT_47}, // vines "
//
// NEW PAGE
//
#ifdef SPEAR
{SPR_STAT_48,block}, // marble pillar
{SPR_STAT_49,bo_25clip}, // bonus 25 clip
{SPR_STAT_50,block}, // truck
{SPR_STAT_51,bo_spear}, // SPEAR OF DESTINY!
#endif
{SPR_STAT_26,bo_clip2}, // Clip "
#ifdef USE_DIR3DSPR
// These are just two examples showing the new way of using dir 3d sprites.
// You can find the allowed values in the objflag_t enum in wl_def.h.
{SPR_STAT_47,none,FL_DIR_VERT_MID},
{SPR_STAT_47,block,FL_DIR_HORIZ_MID},
#endif
{-1} // terminator
};
/*
===============
=
= InitStaticList
=
===============
*/
void InitStaticList (void)
{
laststatobj = &statobjlist[0];
}
/*
===============
=
= SpawnStatic
=
===============
*/
void SpawnStatic (int tilex, int tiley, int type)
{
laststatobj->shapenum = statinfo[type].picnum;
laststatobj->tilex = tilex;
laststatobj->tiley = tiley;
laststatobj->visspot = &spotvis[tilex][tiley];
switch (statinfo[type].type)
{
case block:
actorat[tilex][tiley] = (objtype *) 64; // consider it a blocking tile
case none:
laststatobj->flags = 0;
break;
case bo_cross:
case bo_chalice:
case bo_bible:
case bo_crown:
case bo_fullheal:
if (!loadedgame)
gamestate.treasuretotal++;
case bo_firstaid:
case bo_key1:
case bo_key2:
case bo_key3:
case bo_key4:
case bo_clip:
case bo_25clip:
case bo_machinegun:
case bo_chaingun:
case bo_food:
case bo_alpo:
case bo_gibs:
case bo_spear:
laststatobj->flags = FL_BONUS;
laststatobj->itemnumber = statinfo[type].type;
break;
}
laststatobj->flags |= statinfo[type].specialFlags;
laststatobj++;
if (laststatobj == &statobjlist[MAXSTATS])
Quit ("Too many static objects!\n");
}
/*
===============
=
= PlaceItemType
=
= Called during game play to drop actors' items. It finds the proper
= item number based on the item type (bo_???). If there are no free item
= spots, nothing is done.
=
===============
*/
void PlaceItemType (int itemtype, int tilex, int tiley)
{
int type;
statobj_t *spot;
//
// find the item number
//
for (type=0; ; type++)
{
if (statinfo[type].picnum == -1) // end of list
Quit ("PlaceItemType: couldn't find type!");
if (statinfo[type].type == itemtype)
break;
}
//
// find a spot in statobjlist to put it in
//
for (spot=&statobjlist[0]; ; spot++)
{
if (spot==laststatobj)
{
if (spot == &statobjlist[MAXSTATS])
return; // no free spots
laststatobj++; // space at end
break;
}
if (spot->shapenum == -1) // -1 is a free spot
break;
}
//
// place it
//
spot->shapenum = statinfo[type].picnum;
spot->tilex = tilex;
spot->tiley = tiley;
spot->visspot = &spotvis[tilex][tiley];
spot->flags = FL_BONUS | statinfo[type].specialFlags;
spot->itemnumber = statinfo[type].type;
}
/*
=============================================================================
DOORS
doorobjlist[] holds most of the information for the doors
doorposition[] holds the amount the door is open, ranging from 0 to 0xffff
this is directly accessed by AsmRefresh during rendering
The number of doors is limited to 64 because a spot in tilemap holds the
door number in the low 6 bits, with the high bit meaning a door center
and bit 6 meaning a door side tile
Open doors conect two areas, so sounds will travel between them and sight
will be checked when the player is in a connected area.
Areaconnect is incremented/decremented by each door. If >0 they connect
Every time a door opens or closes the areabyplayer matrix gets recalculated.
An area is true if it connects with the player's current spor.
=============================================================================
*/
#define DOORWIDTH 0x7800
#define OPENTICS 300
doorobj_t doorobjlist[MAXDOORS],*lastdoorobj;
short doornum;
word doorposition[MAXDOORS]; // leading edge of door 0=closed
// 0xffff = fully open
byte areaconnect[NUMAREAS][NUMAREAS];
boolean areabyplayer[NUMAREAS];
/*
==============
=
= ConnectAreas
=
= Scans outward from playerarea, marking all connected areas
=
==============
*/
void RecursiveConnect (int areanumber)
{
int i;
for (i=0;i<NUMAREAS;i++)
{
if (areaconnect[areanumber][i] && !areabyplayer[i])
{
areabyplayer[i] = true;
RecursiveConnect (i);
}
}
}
void ConnectAreas (void)
{
memset (areabyplayer,0,sizeof(areabyplayer));
areabyplayer[player->areanumber] = true;
RecursiveConnect (player->areanumber);
}
void InitAreas (void)
{
memset (areabyplayer,0,sizeof(areabyplayer));
if (player->areanumber < NUMAREAS)
areabyplayer[player->areanumber] = true;
}
/*
===============
=
= InitDoorList
=
===============
*/
void InitDoorList (void)
{
memset (areabyplayer,0,sizeof(areabyplayer));
memset (areaconnect,0,sizeof(areaconnect));
lastdoorobj = &doorobjlist[0];
doornum = 0;
}
/*
===============
=
= SpawnDoor
=
===============
*/
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
{
word *map;
if (doornum==MAXDOORS)
Quit ("64+ doors on level!");
doorposition[doornum] = 0; // doors start out fully closed
lastdoorobj->tilex = tilex;
lastdoorobj->tiley = tiley;
lastdoorobj->vertical = vertical;
lastdoorobj->lock = lock;
lastdoorobj->action = dr_closed;
actorat[tilex][tiley] = (objtype *)(uintptr_t)(doornum | 0x80); // consider it a solid wall
//
// make the door tile a special tile, and mark the adjacent tiles
// for door sides
//
tilemap[tilex][tiley] = doornum | 0x80;
map = mapsegs[0] + (tiley<<mapshift) +tilex;
if (vertical)
{
*map = *(map-1); // set area number
tilemap[tilex][tiley-1] |= 0x40;
tilemap[tilex][tiley+1] |= 0x40;
}
else
{
*map = *(map-mapwidth); // set area number
tilemap[tilex-1][tiley] |= 0x40;
tilemap[tilex+1][tiley] |= 0x40;
}
doornum++;
lastdoorobj++;
}
//===========================================================================
/*
=====================
=
= OpenDoor
=
=====================
*/
void OpenDoor (int door)
{
if (doorobjlist[door].action == dr_open)
doorobjlist[door].ticcount = 0; // reset open time
else
doorobjlist[door].action = dr_opening; // start it opening
}
/*
=====================
=
= CloseDoor
=
=====================
*/
void CloseDoor (int door)
{
int tilex,tiley,area;
objtype *check;
//
// don't close on anything solid
//
tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley;
if (actorat[tilex][tiley])
return;
if (player->tilex == tilex && player->tiley == tiley)
return;
if (doorobjlist[door].vertical)
{
if ( player->tiley == tiley )
{
if ( ((player->x+MINDIST) >>TILESHIFT) == tilex )
return;
if ( ((player->x-MINDIST) >>TILESHIFT) == tilex )
return;
}
check = actorat[tilex-1][tiley];
if (ISPOINTER(check) && ((check->x+MINDIST) >> TILESHIFT) == tilex )
return;
check = actorat[tilex+1][tiley];
if (ISPOINTER(check) && ((check->x-MINDIST) >> TILESHIFT) == tilex )
return;
}
else if (!doorobjlist[door].vertical)
{
if (player->tilex == tilex)
{
if ( ((player->y+MINDIST) >>TILESHIFT) == tiley )
return;
if ( ((player->y-MINDIST) >>TILESHIFT) == tiley )
return;
}
check = actorat[tilex][tiley-1];
if (ISPOINTER(check) && ((check->y+MINDIST) >> TILESHIFT) == tiley )
return;
check = actorat[tilex][tiley+1];
if (ISPOINTER(check) && ((check->y-MINDIST) >> TILESHIFT) == tiley )
return;
}
//
// play door sound if in a connected area
//
area = *(mapsegs[0] + (doorobjlist[door].tiley<<mapshift)
+doorobjlist[door].tilex)-AREATILE;
if (areabyplayer[area])
{
PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}
doorobjlist[door].action = dr_closing;
//
// make the door space solid
//
actorat[tilex][tiley] = (objtype *)(uintptr_t)(door | 0x80);
}
/*
=====================
=
= OperateDoor
=
= The player wants to change the door's direction
=
=====================
*/
void OperateDoor (int door)
{
int lock;
lock = doorobjlist[door].lock;
if (lock >= dr_lock1 && lock <= dr_lock4)
{
if ( ! (gamestate.keys & (1 << (lock-dr_lock1) ) ) )
{
SD_PlaySound (NOWAYSND); // locked
return;
}
}
switch (doorobjlist[door].action)
{
case dr_closed:
case dr_closing:
OpenDoor (door);
break;
case dr_open:
case dr_opening:
CloseDoor (door);
break;
}
}
//===========================================================================
/*
===============
=
= DoorOpen
=
= Close the door after three seconds
=
===============
*/
void DoorOpen (int door)
{
if ( (doorobjlist[door].ticcount += (short) tics) >= OPENTICS)
CloseDoor (door);
}
/*
===============
=
= DoorOpening
=
===============
*/
void DoorOpening (int door)
{
unsigned area1,area2;
word *map;
int32_t position;
position = doorposition[door];
if (!position)
{
//
// door is just starting to open, so connect the areas
//
map = mapsegs[0] + (doorobjlist[door].tiley<<mapshift)
+doorobjlist[door].tilex;
if (doorobjlist[door].vertical)
{
area1 = *(map+1);
area2 = *(map-1);
}
else
{
area1 = *(map-mapwidth);
area2 = *(map+mapwidth);
}
area1 -= AREATILE;
area2 -= AREATILE;
if (area1 < NUMAREAS && area2 < NUMAREAS)
{
areaconnect[area1][area2]++;
areaconnect[area2][area1]++;
if (player->areanumber < NUMAREAS)
ConnectAreas ();
if (areabyplayer[area1])
PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}
}
//
// slide the door by an adaptive amount
//
position += tics<<10;
if (position >= 0xffff)
{
//
// door is all the way open
//
position = 0xffff;
doorobjlist[door].ticcount = 0;
doorobjlist[door].action = dr_open;
actorat[doorobjlist[door].tilex][doorobjlist[door].tiley] = 0;
}
doorposition[door] = (word) position;
}
/*
===============
=
= DoorClosing
=
===============
*/
void DoorClosing (int door)
{
unsigned area1,area2;
word *map;
int32_t position;
int tilex,tiley;
tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley;
if ( ((int)(uintptr_t)actorat[tilex][tiley] != (door | 0x80))
|| (player->tilex == tilex && player->tiley == tiley) )
{ // something got inside the door
OpenDoor (door);
return;
};
position = doorposition[door];
//
// slide the door by an adaptive amount
//
position -= tics<<10;
if (position <= 0)
{
//
// door is closed all the way, so disconnect the areas
//
position = 0;
doorobjlist[door].action = dr_closed;
map = mapsegs[0] + (doorobjlist[door].tiley<<mapshift) + doorobjlist[door].tilex;
if (doorobjlist[door].vertical)
{
area1 = *(map+1);
area2 = *(map-1);
}
else
{
area1 = *(map-mapwidth);
area2 = *(map+mapwidth);
}
area1 -= AREATILE;
area2 -= AREATILE;
if (area1 < NUMAREAS && area2 < NUMAREAS)
{
areaconnect[area1][area2]--;
areaconnect[area2][area1]--;
if (player->areanumber < NUMAREAS)
ConnectAreas ();
}
}
doorposition[door] = (word) position;
}
/*
=====================
=
= MoveDoors
=
= Called from PlayLoop
=
=====================
*/
void MoveDoors (void)
{
int door;
if (gamestate.victoryflag) // don't move door during victory sequence
return;
for (door = 0; door < doornum; door++)
{
switch (doorobjlist[door].action)
{
case dr_open:
DoorOpen (door);
break;
case dr_opening:
DoorOpening(door);
break;
case dr_closing:
DoorClosing(door);
break;
}
}
}
/*
=============================================================================
PUSHABLE WALLS
=============================================================================
*/
word pwallstate;
word pwallpos; // amount a pushable wall has been moved (0-63)
word pwallx,pwally;
byte pwalldir,pwalltile;
int dirs[4][2]={{0,-1},{1,0},{0,1},{-1,0}};
/*
===============
=
= PushWall
=
===============
*/
void PushWall (int checkx, int checky, int dir)
{
int oldtile, dx, dy;
if (pwallstate)
return;
oldtile = tilemap[checkx][checky];
if (!oldtile)
return;
dx = dirs[dir][0];
dy = dirs[dir][1];
if (actorat[checkx+dx][checky+dy])
{
SD_PlaySound (NOWAYSND);
return;
}
actorat[checkx+dx][checky+dy] = (objtype *)(uintptr_t) (tilemap[checkx+dx][checky+dy] = oldtile);
gamestate.secretcount++;
pwallx = checkx;
pwally = checky;
pwalldir = dir;
pwallstate = 1;
pwallpos = 0;
pwalltile = tilemap[pwallx][pwally];
tilemap[pwallx][pwally] = 64;
tilemap[pwallx+dx][pwally+dy] = 64;
*(mapsegs[1]+(pwally<<mapshift)+pwallx) = 0; // remove P tile info
*(mapsegs[0]+(pwally<<mapshift)+pwallx) = *(mapsegs[0]+(player->tiley<<mapshift)+player->tilex); // set correct floorcode (BrotherTank's fix)
SD_PlaySound (PUSHWALLSND);
}
/*
=================
=
= MovePWalls
=
=================
*/
void MovePWalls (void)
{
int oldblock,oldtile;
if (!pwallstate)
return;
oldblock = pwallstate/128;
pwallstate += (word)tics;
if (pwallstate/128 != oldblock)
{
// block crossed into a new block
oldtile = pwalltile;
//
// the tile can now be walked into
//
tilemap[pwallx][pwally] = 0;
actorat[pwallx][pwally] = 0;
*(mapsegs[0]+(pwally<<mapshift)+pwallx) = player->areanumber+AREATILE;
int dx=dirs[pwalldir][0], dy=dirs[pwalldir][1];
//
// see if it should be pushed farther
//
if (pwallstate>=256) // only move two tiles fix
{
//
// the block has been pushed two tiles
//
pwallstate = 0;
tilemap[pwallx+dx][pwally+dy] = oldtile;
return;
}
else
{
int xl,yl,xh,yh;
xl = (player->x-PLAYERSIZE) >> TILESHIFT;
yl = (player->y-PLAYERSIZE) >> TILESHIFT;
xh = (player->x+PLAYERSIZE) >> TILESHIFT;
yh = (player->y+PLAYERSIZE) >> TILESHIFT;
pwallx += dx;
pwally += dy;
if (actorat[pwallx+dx][pwally+dy]
|| xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh)
{
pwallstate = 0;
tilemap[pwallx][pwally] = oldtile;
return;
}
actorat[pwallx+dx][pwally+dy] = (objtype *)(uintptr_t) (tilemap[pwallx+dx][pwally+dy] = oldtile);
tilemap[pwallx+dx][pwally+dy] = 64;
}
}
pwallpos = (pwallstate/2)&63;
}

3899
wl_act2.cpp Normal file

File diff suppressed because it is too large Load Diff

1500
wl_agent.cpp Normal file

File diff suppressed because it is too large Load Diff

229
wl_atmos.cpp Normal file
View File

@ -0,0 +1,229 @@
#include "version.h"
#if defined(USE_STARSKY) || defined(USE_RAIN) || defined(USE_SNOW)
#include "wl_def.h"
#if defined(USE_RAIN) || defined(USE_SNOW)
uint32_t rainpos = 0;
#endif
typedef struct {
int32_t x, y, z;
} point3d_t;
#define MAXPOINTS 400
point3d_t points[MAXPOINTS];
byte moon[100]={
0, 0, 27, 18, 15, 16, 19, 29, 0, 0,
0, 22, 16, 15, 15, 16, 16, 18, 24, 0,
27, 17, 15, 17, 16, 16, 17, 17, 18, 29,
18, 15, 15, 15, 16, 16, 17, 17, 18, 20,
16, 15, 15, 16, 16, 17, 17, 18, 19, 21,
16, 15, 17, 20, 18, 17, 18, 18, 20, 22,
19, 16, 18, 19, 17, 17, 18, 19, 22, 24,
28, 19, 17, 17, 17, 18, 19, 21, 25, 31,
0, 23, 18, 19, 18, 20, 22, 24, 28, 0,
0, 0, 28, 21, 20, 22, 28, 30, 0, 0 };
void Init3DPoints()
{
int hvheight = viewheight >> 1;
for(int i = 0; i < MAXPOINTS; i++)
{
point3d_t *pt = &points[i];
pt->x = 16384 - (rand() & 32767);
pt->z = 16384 - (rand() & 32767);
float len = sqrt((float)pt->x * pt->x + (float)pt->z * pt->z);
int j=50;
do
{
pt->y = 1024 + (rand() & 8191);
j--;
}
while(j > 0 && (float)pt->y * 256.F / len >= hvheight);
}
}
#endif
#ifdef USE_STARSKY
void DrawStarSky(byte *vbuf, uint32_t vbufPitch)
{
int hvheight = viewheight >> 1;
int hvwidth = viewwidth >> 1;
byte *ptr = vbuf;
int i;
for(i = 0; i < hvheight; i++, ptr += vbufPitch)
memset(ptr, 0, viewwidth);
for(i = 0; i < MAXPOINTS; i++)
{
point3d_t *pt = &points[i];
int32_t x = pt->x * viewcos + pt->z * viewsin;
int32_t y = pt->y << 16;
int32_t z = (pt->z * viewcos - pt->x * viewsin) >> 8;
if(z <= 0) continue;
int shade = z >> 18;
if(shade > 15) continue;
int32_t xx = x / z + hvwidth;
int32_t yy = hvheight - y / z;
if(xx >= 0 && xx < viewwidth && yy >= 0 && yy < hvheight)
vbuf[yy * vbufPitch + xx] = shade + 15;
}
int32_t x = 16384 * viewcos + 16384 * viewsin;
int32_t z = (16384 * viewcos - 16384 * viewsin) >> 8;
if(z <= 0) return;
int32_t xx = x / z + hvwidth;
int32_t yy = hvheight - ((hvheight - (hvheight >> 3)) << 22) / z;
if(xx > -10 && xx < viewwidth)
{
int stopx = 10, starty = 0, stopy = 10;
i = 0;
if(xx < 0) i = -xx;
if(xx > viewwidth - 11) stopx = viewwidth - xx;
if(yy < 0) startj = -yy;
if(yy > viewheight - 11) stopy = viewheight - yy;
for(; i < stopx; i++)
for(int j = starty; j < stopy; j++)
vbuf[(yy + j) * vbufPitch + xx + i] = moon[j * 10 + i];
}
}
#endif
#ifdef USE_RAIN
void DrawRain(byte *vbuf, uint32_t vbufPitch)
{
#if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS)
fixed dist; // distance to row projection
fixed tex_step; // global step per one screen pixel
fixed gu, gv, floorx, floory; // global texture coordinates
#endif
fixed px = (player->y + FixedMul(0x7900, viewsin)) >> 6;
fixed pz = (player->x - FixedMul(0x7900, viewcos)) >> 6;
int32_t ax, az, x, y, z, xx, yy, height, actheight;
int shade;
int hvheight = viewheight >> 1;
int hvwidth = viewwidth >> 1;
rainpos -= tics * 900;
for(int i = 0; i < MAXPOINTS; i++)
{
point3d_t *pt = &points[i];
ax = pt->x + px;
ax = 0x1fff - (ax & 0x3fff);
az = pt->z + pz;
az = 0x1fff - (az & 0x3fff);
x = ax * viewcos + az * viewsin;
y = -(heightnumerator << 7) + ((((pt->y << 6) + rainpos) & 0x0ffff) << 11);
z = (az * viewcos - ax * viewsin) >> 8;
if(z <= 0) continue;
shade = z >> 17;
if(shade > 13) continue;
xx = x / z + hvwidth;
if(xx < 0 || xx >= viewwidth) continue;
actheight = y / z;
yy = hvheight - actheight;
height = (heightnumerator << 10) / z;
if(actheight < 0) actheight = -actheight;
if(actheight < (wallheight[xx] >> 3) && height < wallheight[xx]) continue;
if(xx >= 0 && xx < viewwidth && yy > 0 && yy < viewheight)
{
#if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS)
// Find the rain's tile coordinate
// NOTE: This sometimes goes over the map edges.
dist = ((heightnumerator / ((height >> 3) + 1)) << 5);
gu = viewx + FixedMul(dist, viewcos);
gv = -viewy + FixedMul(dist, viewsin);
floorx = ( gu >> TILESHIFT ) & 63;
floory = (-(gv >> TILESHIFT) - 1) & 63;
// Is there a ceiling tile?
if(MAPSPOT(floorx, floory, 2) >> 8) continue;
#endif
vbuf[yy * vbufPitch + xx] = shade+15;
vbuf[(yy - 1) * vbufPitch + xx] = shade+16;
if(yy > 2)
vbuf[(yy - 2) * vbufPitch + xx] = shade+17;
}
}
}
#endif
#ifdef USE_SNOW
void DrawSnow(byte *vbuf, uint32_t vbufPitch)
{
#if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS)
fixed dist; // distance to row projection
fixed tex_step; // global step per one screen pixel
fixed gu, gv, floorx, floory; // global texture coordinates
#endif
fixed px = (player->y + FixedMul(0x7900, viewsin)) >> 6;
fixed pz = (player->x - FixedMul(0x7900, viewcos)) >> 6;
int32_t ax, az, x, y, z, xx, yy, height, actheight;
int shade;
int hvheight = viewheight >> 1;
int hvwidth = viewwidth >> 1;
rainpos -= tics * 256;
for(int i = 0; i < MAXPOINTS; i++)
{
point3d_t *pt = &points[i];
ax = pt->x + px;
ax = 0x1fff - (ax & 0x3fff);
az = pt->z + pz;
az = 0x1fff - (az & 0x3fff);
x = ax * viewcos + az * viewsin;
y = -(heightnumerator << 7) + ((((pt->y << 6) + rainpos) & 0x0ffff) << 11);
z = (az * viewcos - ax * viewsin) >> 8;
if(z <= 0) continue;
shade = z >> 17;
if(shade > 13) continue;
xx = x / z + hvwidth;
if(xx < 0 || xx >= viewwidth) continue;
actheight = y / z;
yy = hvheight - actheight;
height = (heightnumerator << 10) / z;
if(actheight < 0) actheight = -actheight;
if(actheight < (wallheight[xx] >> 3) && height < wallheight[xx]) continue;
if(xx > 0 && xx < viewwidth && yy > 0 && yy < viewheight)
{
#if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS)
// Find the snow's tile coordinate
// NOTE: This sometimes goes over the map edges.
dist = ((heightnumerator / ((height >> 3) + 1)) << 5);
gu = viewx + FixedMul(dist, viewcos);
gv = -viewy + FixedMul(dist, viewsin);
floorx = ( gu >> TILESHIFT ) & 63;
floory = (-(gv >> TILESHIFT) - 1) & 63;
// Is there a ceiling tile?
if(MAPSPOT(floorx, floory, 2) >> 8) continue;
#endif
if(shade < 10)
{
vbuf[yy * vbufPitch + xx] = shade+17;
vbuf[yy * vbufPitch + xx - 1] = shade+16;
vbuf[(yy - 1) * vbufPitch + xx] = shade+16;
vbuf[(yy - 1) * vbufPitch + xx - 1] = shade+15;
}
else
vbuf[yy * vbufPitch + xx] = shade+15;
}
}
}
#endif

20
wl_atmos.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef _WL_ATMOS_H_
#define _WL_ATMOS_H_
#if defined(USE_STARSKY) || defined(USE_RAIN) || defined(USE_SNOW)
void Init3DPoints();
#endif
#ifdef USE_STARSKY
void DrawStarSky(byte *vbuf, uint32_t vbufPitch);
#endif
#ifdef USE_RAIN
void DrawRain(byte *vbuf, uint32_t vbufPitch);
#endif
#ifdef USE_SNOW
void DrawSnow(byte *vbuf, uint32_t vbufPitch);
#endif
#endif

259
wl_cloudsky.cpp Normal file
View File

@ -0,0 +1,259 @@
#include "version.h"
#ifdef USE_CLOUDSKY
#include "wl_def.h"
#include "wl_cloudsky.h"
// Each colormap defines a number of colors which should be mapped from
// the skytable. The according colormapentry_t array defines how these colors should
// be mapped to the wolfenstein palette. The first int of each entry defines
// how many colors are grouped to this entry and the absolute value of the
// second int sets the starting palette index for this pair. If this value is
// negative the index will be decremented for every color, if it's positive
// it will be incremented.
//
// Example colormap:
// colormapentry_t colmapents_1[] = { { 6, -10 }, { 2, 40 } };
// colormap_t colorMaps[] = {
// { 8, colmapents_1 }
// };
//
// The colormap 0 consists of 8 colors. The first color group consists of 6
// colors and starts descending at palette index 10: 10, 9, 8, 7, 6, 5
// The second color group consists of 2 colors and starts ascending at
// index 40: 40, 41
// There's no other color group because all colors of this colormap are
// already used (6+2=8)
//
// Warning: Always make sure that the sum of the amount of the colors in all
// color groups is the number of colors used for your colormap!
colormapentry_t colmapents_1[] = { { 16, -31 }, { 16, 136 } };
colormapentry_t colmapents_2[] = { { 16, -31 } };
colormap_t colorMaps[] = {
{ 32, colmapents_1 },
{ 16, colmapents_2 }
};
const int numColorMaps = lengthof(colorMaps);
// The sky definitions which can be selected as defined by GetCloudSkyDefID() in wl_def.h
// You can use <TAB>+Z in debug mode to find out suitable values for seed and colorMapIndex
// Each entry consists of seed, speed, angle and colorMapIndex
cloudsky_t cloudSkys[] = {
{ 626, 800, 20, 0 },
{ 1234, 650, 60, 1 },
{ 0, 700, 120, 0 },
{ 0, 0, 0, 0 },
{ 11243, 750, 310, 0 },
{ 32141, 750, 87, 0 },
{ 12124, 750, 64, 0 },
{ 55543, 500, 240, 0 },
{ 65535, 200, 54, 1 },
{ 4, 1200, 290, 0 },
};
byte skyc[65536L];
long cloudx = 0, cloudy = 0;
cloudsky_t *curSky = NULL;
#ifdef USE_FEATUREFLAGS
// The lower left tile of every map determines the used cloud sky definition from cloudSkys.
static int GetCloudSkyDefID()
{
int skyID = ffDataBottomLeft;
assert(skyID >= 0 && skyID < lengthof(cloudSkys));
return skyID;
}
#else
static int GetCloudSkyDefID()
{
int skyID;
switch(gamestate.episode * 10 + mapon)
{
case 0: skyID = 0; break;
case 1: skyID = 1; break;
case 2: skyID = 2; break;
case 3: skyID = 3; break;
case 4: skyID = 4; break;
case 5: skyID = 5; break;
case 6: skyID = 6; break;
case 7: skyID = 7; break;
case 8: skyID = 8; break;
case 9: skyID = 9; break;
default: skyID = 9; break;
}
assert(skyID >= 0 && skyID < lengthof(cloudSkys));
return skyID;
}
#endif
void SplitS(unsigned size,unsigned x1,unsigned y1,unsigned x2,unsigned y2)
{
if(size==1) return;
if(!skyc[((x1+size/2)*256+y1)])
{
skyc[((x1+size/2)*256+y1)]=(byte)(((int)skyc[(x1*256+y1)]
+(int)skyc[((x2&0xff)*256+y1)])/2)+rand()%(size*2)-size;
if(!skyc[((x1+size/2)*256+y1)]) skyc[((x1+size/2)*256+y1)]=1;
}
if(!skyc[((x1+size/2)*256+(y2&0xff))])
{
skyc[((x1+size/2)*256+(y2&0xff))]=(byte)(((int)skyc[(x1*256+(y2&0xff))]
+(int)skyc[((x2&0xff)*256+(y2&0xff))])/2)+rand()%(size*2)-size;
if(!skyc[((x1+size/2)*256+(y2&0xff))])
skyc[((x1+size/2)*256+(y2&0xff))]=1;
}
if(!skyc[(x1*256+y1+size/2)])
{
skyc[(x1*256+y1+size/2)]=(byte)(((int)skyc[(x1*256+y1)]
+(int)skyc[(x1*256+(y2&0xff))])/2)+rand()%(size*2)-size;
if(!skyc[(x1*256+y1+size/2)]) skyc[(x1*256+y1+size/2)]=1;
}
if(!skyc[((x2&0xff)*256+y1+size/2)])
{
skyc[((x2&0xff)*256+y1+size/2)]=(byte)(((int)skyc[((x2&0xff)*256+y1)]
+(int)skyc[((x2&0xff)*256+(y2&0xff))])/2)+rand()%(size*2)-size;
if(!skyc[((x2&0xff)*256+y1+size/2)]) skyc[((x2&0xff)*256+y1+size/2)]=1;
}
skyc[((x1+size/2)*256+y1+size/2)]=(byte)(((int)skyc[(x1*256+y1)]
+(int)skyc[((x2&0xff)*256+y1)]+(int)skyc[(x1*256+(y2&0xff))]
+(int)skyc[((x2&0xff)*256+(y2&0xff))])/4)+rand()%(size*2)-size;
SplitS(size/2,x1,y1+size/2,x1+size/2,y2);
SplitS(size/2,x1+size/2,y1,x2,y1+size/2);
SplitS(size/2,x1+size/2,y1+size/2,x2,y2);
SplitS(size/2,x1,y1,x1+size/2,y1+size/2);
}
void InitSky()
{
unsigned cloudskyid = GetCloudSkyDefID();
if(cloudskyid >= lengthof(cloudSkys))
Quit("Illegal cloud sky id: %u", cloudskyid);
curSky = &cloudSkys[cloudskyid];
memset(skyc, 0, sizeof(skyc));
// funny water texture if used instead of memset ;D
// for(int i = 0; i < 65536; i++)
// skyc[i] = rand() % 32 * 8;
srand(curSky->seed);
skyc[0] = rand() % 256;
SplitS(256, 0, 0, 256, 256);
// Smooth the clouds a bit
for(int k = 0; k < 2; k++)
{
for(int i = 0; i < 256; i++)
{
for(int j = 0; j < 256; j++)
{
int32_t val = -skyc[j * 256 + i];
for(int m = 0; m < 3; m++)
{
for(int n = 0; n < 3; n++)
{
val += skyc[((j + n - 1) & 0xff) * 256 + ((i + m - 1) & 0xff)];
}
}
skyc[j * 256 + i] = (byte)(val >> 3);
}
}
}
// the following commented line could be useful, if you're trying to
// create a new color map. This will display your current color map
// in one (of course repeating) stripe of the sky
// for(int i = 0; i < 256; i++)
// skyc[i] = skyc[i + 256] = skyc[i + 512] = i;
if(curSky->colorMapIndex >= lengthof(colorMaps))
Quit("Illegal colorMapIndex for cloud sky def %u: %u", cloudskyid, curSky->colorMapIndex);
colormap_t *curMap = &colorMaps[curSky->colorMapIndex];
int numColors = curMap->numColors;
byte colormap[256];
colormapentry_t *curEntry = curMap->entries;
for(int calcedCols = 0; calcedCols < numColors; curEntry++)
{
if(curEntry->startAndDir < 0)
{
for(int i = 0, ind = -curEntry->startAndDir; i < curEntry->length; i++, ind--)
colormap[calcedCols++] = ind;
}
else
{
for(int i = 0, ind = curEntry->startAndDir; i < curEntry->length; i++, ind++)
colormap[calcedCols++] = ind;
}
}
for(int i = 0; i < 256; i++)
{
for(int j = 0; j < 256; j++)
{
skyc[i * 256 + j] = colormap[skyc[i * 256 + j] * numColors / 256];
}
}
}
// Based on Textured Floor and Ceiling by DarkOne
void DrawClouds(byte *vbuf, unsigned vbufPitch, int min_wallheight)
{
// Move clouds
fixed moveDist = tics * curSky->speed;
cloudx += FixedMul(moveDist,sintable[curSky->angle]);
cloudy -= FixedMul(moveDist,costable[curSky->angle]);
// Draw them
int y0, halfheight;
unsigned top_offset0;
fixed dist; // distance to row projection
fixed tex_step; // global step per one screen pixel
fixed gu, gv, du, dv; // global texture coordinates
int u, v; // local texture coordinates
// ------ * prepare * --------
halfheight = viewheight >> 1;
y0 = min_wallheight >> 3; // starting y value
if(y0 > halfheight)
return; // view obscured by walls
if(!y0) y0 = 1; // don't let division by zero
top_offset0 = vbufPitch * (halfheight - y0 - 1);
// draw horizontal lines
for(int y = y0, top_offset = top_offset0; y < halfheight; y++, top_offset -= vbufPitch)
{
dist = (heightnumerator / y) << 8;
gu = viewx + FixedMul(dist, viewcos) + cloudx;
gv = -viewy + FixedMul(dist, viewsin) + cloudy;
tex_step = (dist << 8) / viewwidth / 175;
du = FixedMul(tex_step, viewsin);
dv = -FixedMul(tex_step, viewcos);
gu -= (viewwidth >> 1)*du;
gv -= (viewwidth >> 1)*dv; // starting point (leftmost)
for(int x = 0, top_add = top_offset; x < viewwidth; x++, top_add++)
{
if(wallheight[x] >> 3 <= y)
{
u = (gu >> 13) & 255;
v = (gv >> 13) & 255;
vbuf[top_add] = skyc[((255 - u) << 8) + 255 - v];
}
gu += du;
gv += dv;
}
}
}
#endif

46
wl_cloudsky.h Normal file
View File

@ -0,0 +1,46 @@
#if defined(USE_CLOUDSKY) && !defined(_WL_CLOUDSKY_H_)
#define _WL_CLOUDSKY_H_
typedef struct
{
int length;
int startAndDir;
} colormapentry_t;
typedef struct
{
int numColors;
colormapentry_t *entries;
} colormap_t;
typedef struct
{
// The seed defines the look of the sky and every value (0-4294967295)
// describes an unique sky. You can play around with these inside the game
// when pressing <TAB>+Z in debug mode. There you'll be able to change the
// active seed to find out a value, which is suitable for your needs.
uint32_t seed;
// The speed defines how fast the clouds will move (0-65535)
uint32_t speed;
// The angle defines the move direction (0-359)
uint32_t angle;
// An index selecting the color map to be used for this sky definition.
// This value can also be chosen with <TAB>+Z
uint32_t colorMapIndex;
} cloudsky_t;
extern cloudsky_t *curSky;
extern colormap_t colorMaps[];
extern const int numColorMaps;
void InitSky();
void DrawClouds(byte *vbuf, unsigned vbufPitch, int min_wallheight);
#ifndef USE_FEATUREFLAGS
int GetCloudSkyDefID();
#endif
#endif

869
wl_debug.cpp Normal file
View File

@ -0,0 +1,869 @@
// WL_DEBUG.C
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#include "wl_def.h"
#pragma hdrstop
#ifdef USE_CLOUDSKY
#include "wl_cloudsky.h"
#endif
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
#define VIEWTILEX (viewwidth/16)
#define VIEWTILEY (viewheight/16)
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
#ifdef DEBUGKEYS
int DebugKeys (void);
// from WL_DRAW.C
void ScalePost();
void SimpleScaleShape (int xcenter, int shapenum, unsigned height);
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
int maporgx;
int maporgy;
enum {mapview,tilemapview,actoratview,visview} viewtype;
void ViewMap (void);
//===========================================================================
/*
==================
=
= CountObjects
=
==================
*/
void CountObjects (void)
{
int i,total,count,active,inactive,doors;
objtype *obj;
CenterWindow (17,7);
active = inactive = count = doors = 0;
US_Print ("Total statics :");
total = (int)(laststatobj-&statobjlist[0]);
US_PrintUnsigned (total);
char str[60];
sprintf(str,"\nlaststatobj=%.8X",(int32_t)(uintptr_t)laststatobj);
US_Print(str);
US_Print ("\nIn use statics:");
for (i=0;i<total;i++)
{
if (statobjlist[i].shapenum != -1)
count++;
else
doors++; //debug
}
US_PrintUnsigned (count);
US_Print ("\nDoors :");
US_PrintUnsigned (doornum);
for (obj=player->next;obj;obj=obj->next)
{
if (obj->active)
active++;
else
inactive++;
}
US_Print ("\nTotal actors :");
US_PrintUnsigned (active+inactive);
US_Print ("\nActive actors :");
US_PrintUnsigned (active);
VW_UpdateScreen();
IN_Ack ();
}
//===========================================================================
/*
===================
=
= PictureGrabber
=
===================
*/
void PictureGrabber (void)
{
static char fname[] = "WSHOT000.BMP";
for(int i = 0; i < 1000; i++)
{
fname[7] = i % 10 + '0';
fname[6] = (i / 10) % 10 + '0';
fname[5] = i / 100 + '0';
int file = open(fname, O_RDONLY | O_BINARY);
if(file == -1) break; // file does not exist, so use that filename
close(file);
}
// overwrites WSHOT999.BMP if all wshot files exist
SDL_SaveBMP(curSurface, fname);
CenterWindow (18,2);
US_PrintCentered ("Screenshot taken");
VW_UpdateScreen();
IN_Ack();
}
//===========================================================================
/*
===================
=
= BasicOverhead
=
===================
*/
void BasicOverhead (void)
{
int x, y, z, offx, offy;
z = 128/MAPSIZE; // zoom scale
offx = 320/2;
offy = (160-MAPSIZE*z)/2;
#ifdef MAPBORDER
int temp = viewsize;
NewViewSize(16);
DrawPlayBorder();
#endif
// right side (raw)
for(x=0;x<MAPSIZE;x++)
for(y=0;y<MAPSIZE;y++)
VWB_Bar(x*z+offx, y*z+offy,z,z,(unsigned)(uintptr_t)actorat[x][y]);
// left side (filtered)
uintptr_t tile;
int color;
offx -= 128;
for(x=0;x<MAPSIZE;x++)
{
for(y=0;y<MAPSIZE;y++)
{
tile = (uintptr_t)actorat[x][y];
if (ISPOINTER(tile) && ((objtype *)tile)->flags&FL_SHOOTABLE) color = 72; // enemy
else if (!tile || ISPOINTER(tile))
{
if (spotvis[x][y]) color = 111; // visable
else color = 0; // nothing
}
else if (MAPSPOT(x,y,1) == PUSHABLETILE) color = 171; // pushwall
else if (tile == 64) color = 158; // solid obj
else if (tile < 128) color = 154; // walls
else if (tile < 256) color = 146; // doors
VWB_Bar(x*z+offx, y*z+offy,z,z,color);
}
}
VWB_Bar(player->tilex*z+offx,player->tiley*z+offy,z,z,15); // player
// resize the border to match
VW_UpdateScreen();
IN_Ack();
#ifdef MAPBORDER
NewViewSize(temp);
DrawPlayBorder();
#endif
}
//===========================================================================
/*
================
=
= ShapeTest
=
================
*/
void ShapeTest (void)
{
//TODO
#if NOTYET
extern word NumDigi;
extern word *DigiList;
extern int postx;
extern int postwidth;
extern byte *postsource;
static char buf[10];
boolean done;
ScanCode scan;
int i,j,k,x;
longword l;
byte *addr;
soundnames sound;
// PageListStruct far *page;
CenterWindow(20,16);
VW_UpdateScreen();
for (i = 0,done = false; !done;)
{
US_ClearWindow();
sound = (soundnames) -1;
// page = &PMPages[i];
US_Print(" Page #");
US_PrintUnsigned(i);
if (i < PMSpriteStart)
US_Print(" (Wall)");
else if (i < PMSoundStart)
US_Print(" (Sprite)");
else if (i == ChunksInFile - 1)
US_Print(" (Sound Info)");
else
US_Print(" (Sound)");
/* US_Print("\n XMS: ");
if (page->xmsPage != -1)
US_PrintUnsigned(page->xmsPage);
else
US_Print("No");
US_Print("\n Main: ");
if (page->mainPage != -1)
US_PrintUnsigned(page->mainPage);
else if (page->emsPage != -1)
{
US_Print("EMS ");
US_PrintUnsigned(page->emsPage);
}
else
US_Print("No");
US_Print("\n Last hit: ");
US_PrintUnsigned(page->lastHit);*/
US_Print("\n Address: ");
addr = (byte *) PM_GetPage(i);
sprintf(buf,"0x%08X",(int32_t) addr);
US_Print(buf);
if (addr)
{
if (i < PMSpriteStart)
{
//
// draw the wall
//
vbuf += 32*SCREENWIDTH;
postx = 128;
postwidth = 1;
postsource = addr;
for (x=0;x<64;x++,postx++,postsource+=64)
{
wallheight[postx] = 256;
ScalePost ();
}
vbuf -= 32*SCREENWIDTH;
}
else if (i < PMSoundStart)
{
//
// draw the sprite
//
vbuf += 32*SCREENWIDTH;
SimpleScaleShape (160, i-PMSpriteStart, 64);
vbuf -= 32*SCREENWIDTH;
}
else if (i == ChunksInFile - 1)
{
US_Print("\n\n Number of sounds: ");
US_PrintUnsigned(NumDigi);
for (l = j = k = 0;j < NumDigi;j++)
{
l += DigiList[(j * 2) + 1];
k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
}
US_Print("\n Total bytes: ");
US_PrintUnsigned(l);
US_Print("\n Total pages: ");
US_PrintUnsigned(k);
}
else
{
byte *dp = addr;
for (j = 0;j < NumDigi;j++)
{
k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
if ((i >= PMSoundStart + DigiList[j * 2])
&& (i < PMSoundStart + DigiList[j * 2] + k))
break;
}
if (j < NumDigi)
{
sound = (soundnames) j;
US_Print("\n Sound #");
US_PrintUnsigned(j);
US_Print("\n Segment #");
US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);
}
for (j = 0;j < PageLengths[i];j += 32)
{
byte v = dp[j];
int v2 = (unsigned)v;
v2 -= 128;
v2 /= 4;
if (v2 < 0)
VWB_Vlin(WindowY + WindowH - 32 + v2,
WindowY + WindowH - 32,
WindowX + 8 + (j / 32),BLACK);
else
VWB_Vlin(WindowY + WindowH - 32,
WindowY + WindowH - 32 + v2,
WindowX + 8 + (j / 32),BLACK);
}
}
}
VW_UpdateScreen();
IN_Ack();
scan = LastScan;
IN_ClearKey(scan);
switch (scan)
{
case sc_LeftArrow:
if (i)
i--;
break;
case sc_RightArrow:
if (++i >= ChunksInFile)
i--;
break;
case sc_W: // Walls
i = 0;
break;
case sc_S: // Sprites
i = PMSpriteStart;
break;
case sc_D: // Digitized
i = PMSoundStart;
break;
case sc_I: // Digitized info
i = ChunksInFile - 1;
break;
/* case sc_L: // Load all pages
for (j = 0;j < ChunksInFile;j++)
PM_GetPage(j);
break;*/
case sc_P:
if (sound != -1)
SD_PlayDigitized(sound,8,8);
break;
case sc_Escape:
done = true;
break;
/* case sc_Enter:
PM_GetPage(i);
break;*/
}
}
SD_StopDigitized();
#endif
}
//===========================================================================
/*
================
=
= DebugKeys
=
================
*/
int DebugKeys (void)
{
boolean esc;
int level;
if (Keyboard[sc_B]) // B = border color
{
CenterWindow(20,3);
PrintY+=6;
US_Print(" Border color (0-56): ");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
if (level>=0 && level<=99)
{
if (level<30) level += 31;
else
{
if (level > 56) level=31;
else level -= 26;
}
bordercol=level*4+3;
if (bordercol == VIEWCOLOR)
DrawStatusBorder(bordercol);
DrawPlayBorder();
return 0;
}
}
return 1;
}
if (Keyboard[sc_C]) // C = count objects
{
CountObjects();
return 1;
}
if (Keyboard[sc_D]) // D = Darkone's FPS counter
{
CenterWindow (22,2);
if (fpscounter)
US_PrintCentered ("Darkone's FPS Counter OFF");
else
US_PrintCentered ("Darkone's FPS Counter ON");
VW_UpdateScreen();
IN_Ack();
fpscounter ^= 1;
return 1;
}
if (Keyboard[sc_E]) // E = quit level
playstate = ex_completed;
if (Keyboard[sc_F]) // F = facing spot
{
char str[60];
CenterWindow (14,6);
US_Print ("x:"); US_PrintUnsigned (player->x);
US_Print (" ("); US_PrintUnsigned (player->x%65536);
US_Print (")\ny:"); US_PrintUnsigned (player->y);
US_Print (" ("); US_PrintUnsigned (player->y%65536);
US_Print (")\nA:"); US_PrintUnsigned (player->angle);
US_Print (" X:"); US_PrintUnsigned (player->tilex);
US_Print (" Y:"); US_PrintUnsigned (player->tiley);
US_Print ("\n1:"); US_PrintUnsigned (tilemap[player->tilex][player->tiley]);
sprintf(str," 2:%.8X",(unsigned)(uintptr_t)actorat[player->tilex][player->tiley]); US_Print(str);
US_Print ("\nf 1:"); US_PrintUnsigned (player->areanumber);
US_Print (" 2:"); US_PrintUnsigned (MAPSPOT(player->tilex,player->tiley,1));
US_Print (" 3:");
if ((unsigned)(uintptr_t)actorat[player->tilex][player->tiley] < 256)
US_PrintUnsigned (spotvis[player->tilex][player->tiley]);
else
US_PrintUnsigned (actorat[player->tilex][player->tiley]->flags);
VW_UpdateScreen();
IN_Ack();
return 1;
}
if (Keyboard[sc_G]) // G = god mode
{
CenterWindow (12,2);
if (godmode == 0)
US_PrintCentered ("God mode ON");
else if (godmode == 1)
US_PrintCentered ("God (no flash)");
else if (godmode == 2)
US_PrintCentered ("God mode OFF");
VW_UpdateScreen();
IN_Ack();
if (godmode != 2)
godmode++;
else
godmode = 0;
return 1;
}
if (Keyboard[sc_H]) // H = hurt self
{
IN_ClearKeysDown ();
TakeDamage (16,NULL);
}
else if (Keyboard[sc_I]) // I = item cheat
{
CenterWindow (12,3);
US_PrintCentered ("Free items!");
VW_UpdateScreen();
GivePoints (100000);
HealSelf (99);
if (gamestate.bestweapon<wp_chaingun)
GiveWeapon (gamestate.bestweapon+1);
gamestate.ammo += 50;
if (gamestate.ammo > 99)
gamestate.ammo = 99;
DrawAmmo ();
IN_Ack ();
return 1;
}
else if (Keyboard[sc_K]) // K = give keys
{
CenterWindow(16,3);
PrintY+=6;
US_Print(" Give Key (1-4): ");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,1,0);
if (!esc)
{
level = atoi (str);
if (level>0 && level<5)
GiveKey(level-1);
}
return 1;
}
else if (Keyboard[sc_L]) // L = level ratios
{
byte x,start,end=LRpack;
if (end == 8) // wolf3d
{
CenterWindow(17,10);
start = 0;
}
else // sod
{
CenterWindow(17,12);
start = 0; end = 10;
}
again:
for(x=start;x<end;x++)
{
US_PrintUnsigned(x+1);
US_Print(" ");
US_PrintUnsigned(LevelRatios[x].time/60);
US_Print(":");
if (LevelRatios[x].time%60 < 10)
US_Print("0");
US_PrintUnsigned(LevelRatios[x].time%60);
US_Print(" ");
US_PrintUnsigned(LevelRatios[x].kill);
US_Print("% ");
US_PrintUnsigned(LevelRatios[x].secret);
US_Print("% ");
US_PrintUnsigned(LevelRatios[x].treasure);
US_Print("%\n");
}
VW_UpdateScreen();
IN_Ack();
if (end == 10 && gamestate.mapon > 9)
{
start = 10; end = 20;
CenterWindow(17,12);
goto again;
}
return 1;
}
else if (Keyboard[sc_N]) // N = no clip
{
noclip^=1;
CenterWindow (18,3);
if (noclip)
US_PrintCentered ("No clipping ON");
else
US_PrintCentered ("No clipping OFF");
VW_UpdateScreen();
IN_Ack ();
return 1;
}
else if (Keyboard[sc_O]) // O = basic overhead
{
BasicOverhead();
return 1;
}
else if(Keyboard[sc_P]) // P = Ripper's picture grabber
{
PictureGrabber();
return 1;
}
else if (Keyboard[sc_Q]) // Q = fast quit
Quit (NULL);
else if (Keyboard[sc_S]) // S = slow motion
{
CenterWindow(30,3);
PrintY+=6;
US_Print(" Slow Motion steps (default 14): ");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
if (level>=0 && level<=50)
singlestep = level;
}
return 1;
}
else if (Keyboard[sc_T]) // T = shape test
{
ShapeTest ();
return 1;
}
else if (Keyboard[sc_V]) // V = extra VBLs
{
CenterWindow(30,3);
PrintY+=6;
US_Print(" Add how many extra VBLs(0-8): ");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,1,0);
if (!esc)
{
level = atoi (str);
if (level>=0 && level<=8)
extravbls = level;
}
return 1;
}
else if (Keyboard[sc_W]) // W = warp to level
{
CenterWindow(26,3);
PrintY+=6;
#ifndef SPEAR
US_Print(" Warp to which level(1-10): ");
#else
US_Print(" Warp to which level(1-21): ");
#endif
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
#ifndef SPEAR
if (level>0 && level<11)
#else
if (level>0 && level<22)
#endif
{
gamestate.mapon = level-1;
playstate = ex_warped;
}
}
return 1;
}
else if (Keyboard[sc_X]) // X = item cheat
{
CenterWindow (12,3);
US_PrintCentered ("Extra stuff!");
VW_UpdateScreen();
// DEBUG: put stuff here
IN_Ack ();
return 1;
}
#ifdef USE_CLOUDSKY
else if(Keyboard[sc_Z])
{
char defstr[15];
CenterWindow(34,4);
PrintY+=6;
US_Print(" Recalculate sky with seek: ");
int seekpx = px, seekpy = py;
US_PrintUnsigned(curSky->seed);
US_Print("\n Use color map (0-");
US_PrintUnsigned(numColorMaps - 1);
US_Print("): ");
int mappx = px, mappy = py;
US_PrintUnsigned(curSky->colorMapIndex);
VW_UpdateScreen();
sprintf(defstr, "%u", curSky->seed);
esc = !US_LineInput(seekpx, seekpy, str, defstr, true, 10, 0);
if(esc) return 0;
curSky->seed = (uint32_t) atoi(str);
sprintf(defstr, "%u", curSky->colorMapIndex);
esc = !US_LineInput(mappx, mappy, str, defstr, true, 10, 0);
if(esc) return 0;
uint32_t newInd = (uint32_t) atoi(str);
if(newInd < (uint32_t) numColorMaps)
{
curSky->colorMapIndex = newInd;
InitSky();
}
else
{
CenterWindow (18,3);
US_PrintCentered ("Illegal color map!");
VW_UpdateScreen();
IN_Ack ();
}
}
#endif
return 0;
}
#if 0
/*
===================
=
= OverheadRefresh
=
===================
*/
void OverheadRefresh (void)
{
unsigned x,y,endx,endy,sx,sy;
unsigned tile;
endx = maporgx+VIEWTILEX;
endy = maporgy+VIEWTILEY;
for (y=maporgy;y<endy;y++)
{
for (x=maporgx;x<endx;x++)
{
sx = (x-maporgx)*16;
sy = (y-maporgy)*16;
switch (viewtype)
{
#if 0
case mapview:
tile = *(mapsegs[0]+farmapylookup[y]+x);
break;
case tilemapview:
tile = tilemap[x][y];
break;
case visview:
tile = spotvis[x][y];
break;
#endif
case actoratview:
tile = (unsigned)actorat[x][y];
break;
}
if (tile<MAXWALLTILES)
LatchDrawTile(sx,sy,tile);
else
{
LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));
LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));
LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));
LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));
}
}
}
}
#endif
#if 0
/*
===================
=
= ViewMap
=
===================
*/
void ViewMap (void)
{
boolean button0held;
viewtype = actoratview;
// button0held = false;
maporgx = player->tilex - VIEWTILEX/2;
if (maporgx<0)
maporgx = 0;
if (maporgx>MAPSIZE-VIEWTILEX)
maporgx=MAPSIZE-VIEWTILEX;
maporgy = player->tiley - VIEWTILEY/2;
if (maporgy<0)
maporgy = 0;
if (maporgy>MAPSIZE-VIEWTILEY)
maporgy=MAPSIZE-VIEWTILEY;
do
{
//
// let user pan around
//
PollControls ();
if (controlx < 0 && maporgx>0)
maporgx--;
if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
maporgx++;
if (controly < 0 && maporgy>0)
maporgy--;
if (controly > 0 && maporgy<mapheight-VIEWTILEY)
maporgy++;
#if 0
if (c.button0 && !button0held)
{
button0held = true;
viewtype++;
if (viewtype>visview)
viewtype = mapview;
}
if (!c.button0)
button0held = false;
#endif
OverheadRefresh ();
} while (!Keyboard[sc_Escape]);
IN_ClearKeysDown ();
}
#endif
#endif

1481
wl_def.h Normal file

File diff suppressed because it is too large Load Diff

230
wl_dir3dspr.cpp Normal file
View File

@ -0,0 +1,230 @@
#include "version.h"
#ifdef USE_DIR3DSPR
#include "wl_def.h"
#include "wl_shade.h"
// Define directional 3d sprites in wl_act1.cpp (there are two examples)
// Make sure you have according entries in ScanInfoPlane in wl_game.cpp.
void Scale3DShaper(int x1, int x2, int shapenum, uint32_t flags, fixed ny1, fixed ny2,
fixed nx1, fixed nx2, byte *vbuf, unsigned vbufPitch)
{
t_compshape *shape;
unsigned scale1,starty,endy;
word *cmdptr;
byte *line;
byte *vmem;
int dx,len,i,newstart,ycnt,pixheight,screndy,upperedge,scrstarty;
unsigned j;
fixed height,dheight,height1,height2;
int xpos[TEXTURESIZE+1];
int slinex;
fixed dxx=(ny2-ny1)<<8,dzz=(nx2-nx1)<<8;
fixed dxa=0,dza=0;
byte col;
shape = (t_compshape *) PM_GetSprite(shapenum);
len=shape->rightpix-shape->leftpix+1;
if(!len) return;
ny1+=dxx>>9;
nx1+=dzz>>9;
dxa=-(dxx>>1),dza=-(dzz>>1);
dxx>>=TEXTURESHIFT,dzz>>=TEXTURESHIFT;
dxa+=shape->leftpix*dxx,dza+=shape->leftpix*dzz;
xpos[0]=(int)((ny1+(dxa>>8))*scale/(nx1+(dza>>8))+centerx);
height1 = heightnumerator/((nx1+(dza>>8))>>8);
height=(((fixed)height1)<<12)+2048;
for(i=1;i<=len;i++)
{
dxa+=dxx,dza+=dzz;
xpos[i]=(int)((ny1+(dxa>>8))*scale/(nx1+(dza>>8))+centerx);
if(xpos[i-1]>viewwidth) break;
}
len=i-1;
dx = xpos[len] - xpos[0];
if(!dx) return;
height2 = heightnumerator/((nx1+(dza>>8))>>8);
dheight=(((fixed)height2-(fixed)height1)<<12)/(fixed)dx;
cmdptr = (word *) shape->dataofs;
i=0;
if(x2>viewwidth) x2=viewwidth;
for(i=0;i<len;i++)
{
for(slinex=xpos[i];slinex<xpos[i+1] && slinex<x2;slinex++)
{
height+=dheight;
if(slinex<0) continue;
scale1=(unsigned)(height>>15);
if(wallheight[slinex]<(height>>12) && scale1 /*&& scale1<=maxscale*/)
{
#ifdef USE_SHADING
byte *curshades;
if(flags & FL_FULLBRIGHT)
curshades = shadetable[0];
else
curshades = shadetable[GetShade(scale1<<3)];
#endif
pixheight=scale1*SPRITESCALEFACTOR;
upperedge=viewheight/2-scale1;
line=(byte *)shape + cmdptr[i];
while((endy = READWORD(line)) != 0)
{
endy >>= 1;
newstart = READWORD(line);
starty = READWORD(line) >> 1;
j=starty;
ycnt=j*pixheight;
screndy=(ycnt>>6)+upperedge;
if(screndy<0) vmem=vbuf+slinex;
else vmem=vbuf+screndy*vbufPitch+slinex;
for(;j<endy;j++)
{
scrstarty=screndy;
ycnt+=pixheight;
screndy=(ycnt>>6)+upperedge;
if(scrstarty!=screndy && screndy>0)
{
#ifdef USE_SHADING
col=curshades[((byte *)shape)[newstart+j]];
#else
col=((byte *)shape)[newstart+j];
#endif
if(scrstarty<0) scrstarty=0;
if(screndy>viewheight) screndy=viewheight,j=endy;
while(scrstarty<screndy)
{
*vmem=col;
vmem+=vbufPitch;
scrstarty++;
}
}
}
}
}
}
}
}
void Scale3DShape(byte *vbuf, unsigned vbufPitch, statobj_t *ob)
{
fixed nx1,nx2,ny1,ny2;
int viewx1,viewx2;
fixed diradd;
fixed playx = viewx;
fixed playy = viewy;
//
// the following values for "diradd" aren't optimized yet
// if you have problems with sprites being visible through wall edges
// where they shouldn't, you can try to adjust these values and SIZEADD
//
#define SIZEADD 1024
switch(ob->flags & FL_DIR_POS_MASK)
{
case FL_DIR_POS_FW: diradd=0x7ff0+0x8000; break;
case FL_DIR_POS_BW: diradd=-0x7ff0+0x8000; break;
case FL_DIR_POS_MID: diradd=0x8000; break;
default:
Quit("Unknown directional 3d sprite position (shapenum = %i)", ob->shapenum);
}
if(ob->flags & FL_DIR_VERT_FLAG) // vertical dir 3d sprite
{
fixed gy1,gy2,gx,gyt1,gyt2,gxt;
//
// translate point to view centered coordinates
//
gy1 = (((long)ob->tiley) << TILESHIFT)+0x8000-playy-0x8000L-SIZEADD;
gy2 = gy1+0x10000L+2*SIZEADD;
gx = (((long)ob->tilex) << TILESHIFT)+diradd-playx;
//
// calculate newx
//
gxt = FixedMul(gx,viewcos);
gyt1 = FixedMul(gy1,viewsin);
gyt2 = FixedMul(gy2,viewsin);
nx1 = gxt-gyt1;
nx2 = gxt-gyt2;
//
// calculate newy
//
gxt = FixedMul(gx,viewsin);
gyt1 = FixedMul(gy1,viewcos);
gyt2 = FixedMul(gy2,viewcos);
ny1 = gyt1+gxt;
ny2 = gyt2+gxt;
}
else // horizontal dir 3d sprite
{
fixed gx1,gx2,gy,gxt1,gxt2,gyt;
//
// translate point to view centered coordinates
//
gx1 = (((long)ob->tilex) << TILESHIFT)+0x8000-playx-0x8000L-SIZEADD;
gx2 = gx1+0x10000L+2*SIZEADD;
gy = (((long)ob->tiley) << TILESHIFT)+diradd-playy;
//
// calculate newx
//
gxt1 = FixedMul(gx1,viewcos);
gxt2 = FixedMul(gx2,viewcos);
gyt = FixedMul(gy,viewsin);
nx1 = gxt1-gyt;
nx2 = gxt2-gyt;
//
// calculate newy
//
gxt1 = FixedMul(gx1,viewsin);
gxt2 = FixedMul(gx2,viewsin);
gyt = FixedMul(gy,viewcos);
ny1 = gyt+gxt1;
ny2 = gyt+gxt2;
}
if(nx1 < 0 || nx2 < 0) return; // TODO: Clip on viewplane
//
// calculate perspective ratio
//
if(nx1>=0 && nx1<=1792) nx1=1792;
if(nx1<0 && nx1>=-1792) nx1=-1792;
if(nx2>=0 && nx2<=1792) nx2=1792;
if(nx2<0 && nx2>=-1792) nx2=-1792;
viewx1=(int)(centerx+ny1*scale/nx1);
viewx2=(int)(centerx+ny2*scale/nx2);
if(viewx2 < viewx1)
{
Scale3DShaper(viewx2,viewx1,ob->shapenum,ob->flags,ny2,ny1,nx2,nx1,vbuf,vbufPitch);
}
else
{
Scale3DShaper(viewx1,viewx2,ob->shapenum,ob->flags,ny1,ny2,nx1,nx2,vbuf,vbufPitch);
}
}
#endif

1647
wl_draw.cpp Normal file

File diff suppressed because it is too large Load Diff

87
wl_floorceiling.cpp Normal file
View File

@ -0,0 +1,87 @@
#include "version.h"
#ifdef USE_FLOORCEILINGTEX
#include "wl_def.h"
#include "wl_shade.h"
// Textured Floor and Ceiling by DarkOne
// With multi-textured floors and ceilings stored in lower and upper bytes of
// according tile in third mapplane, respectively.
void DrawFloorAndCeiling(byte *vbuf, unsigned vbufPitch, int min_wallheight)
{
fixed dist; // distance to row projection
fixed tex_step; // global step per one screen pixel
fixed gu, gv, du, dv; // global texture coordinates
int u, v; // local texture coordinates
byte *toptex, *bottex;
unsigned lasttoptex = 0xffffffff, lastbottex = 0xffffffff;
int halfheight = viewheight >> 1;
int y0 = min_wallheight >> 3; // starting y value
if(y0 > halfheight)
return; // view obscured by walls
if(!y0) y0 = 1; // don't let division by zero
unsigned bot_offset0 = vbufPitch * (halfheight + y0);
unsigned top_offset0 = vbufPitch * (halfheight - y0 - 1);
// draw horizontal lines
for(int y = y0, bot_offset = bot_offset0, top_offset = top_offset0;
y < halfheight; y++, bot_offset += vbufPitch, top_offset -= vbufPitch)
{
dist = (heightnumerator / (y + 1)) << 5;
gu = viewx + FixedMul(dist, viewcos);
gv = -viewy + FixedMul(dist, viewsin);
tex_step = (dist << 8) / viewwidth / 175;
du = FixedMul(tex_step, viewsin);
dv = -FixedMul(tex_step, viewcos);
gu -= (viewwidth >> 1) * du;
gv -= (viewwidth >> 1) * dv; // starting point (leftmost)
#ifdef USE_SHADING
byte *curshades = shadetable[GetShade(y << 3)];
#endif
for(int x = 0, bot_add = bot_offset, top_add = top_offset;
x < viewwidth; x++, bot_add++, top_add++)
{
if(wallheight[x] >> 3 <= y)
{
int curx = (gu >> TILESHIFT) & (MAPSIZE - 1);
int cury = (-(gv >> TILESHIFT) - 1) & (MAPSIZE - 1);
unsigned curtex = MAPSPOT(curx, cury, 2);
if(curtex)
{
unsigned curtoptex = curtex >> 8;
if (curtoptex != lasttoptex)
{
lasttoptex = curtoptex;
toptex = PM_GetTexture(curtoptex);
}
unsigned curbottex = curtex & 0xff;
if (curbottex != lastbottex)
{
lastbottex = curbottex;
bottex = PM_GetTexture(curbottex);
}
u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
unsigned texoffs = (u << TEXTURESHIFT) + (TEXTURESIZE - 1) - v;
#ifdef USE_SHADING
if(curtoptex)
vbuf[top_add] = curshades[toptex[texoffs]];
if(curbottex)
vbuf[bot_add] = curshades[bottex[texoffs]];
#else
if(curtoptex)
vbuf[top_add] = toptex[texoffs];
if(curbottex)
vbuf[bot_add] = bottex[texoffs];
#endif
}
}
gu += du;
gv += dv;
}
}
}
#endif

1604
wl_game.cpp Normal file

File diff suppressed because it is too large Load Diff

1723
wl_inter.cpp Normal file

File diff suppressed because it is too large Load Diff

1959
wl_main.cpp Normal file

File diff suppressed because it is too large Load Diff

4158
wl_menu.cpp Normal file

File diff suppressed because it is too large Load Diff

237
wl_menu.h Normal file
View File

@ -0,0 +1,237 @@
//
// WL_MENU.H
//
#ifdef SPEAR
#define BORDCOLOR 0x99
#define BORD2COLOR 0x93
#define DEACTIVE 0x9b
#define BKGDCOLOR 0x9d
//#define STRIPE 0x9c
#define MenuFadeOut() VL_FadeOut(0,255,0,0,51,10)
#else
#define BORDCOLOR 0x29
#define BORD2COLOR 0x23
#define DEACTIVE 0x2b
#define BKGDCOLOR 0x2d
#define STRIPE 0x2c
#define MenuFadeOut() VL_FadeOut(0,255,43,0,0,10)
#endif
#define READCOLOR 0x4a
#define READHCOLOR 0x47
#define VIEWCOLOR 0x7f
#define TEXTCOLOR 0x17
#define HIGHLIGHT 0x13
#define MenuFadeIn() VL_FadeIn(0,255,gamepal,10)
#define MENUSONG WONDERIN_MUS
#ifndef SPEAR
#define INTROSONG NAZI_NOR_MUS
#else
#define INTROSONG XTOWER2_MUS
#endif
#define SENSITIVE 60
#define CENTERX ((int) screenWidth / 2)
#define CENTERY ((int) screenHeight / 2)
#define MENU_X 76
#define MENU_Y 55
#define MENU_W 178
#ifndef SPEAR
#ifndef GOODTIMES
#define MENU_H 13*10+6
#else
#define MENU_H 13*9+6
#endif
#else
#define MENU_H 13*9+6
#endif
#define SM_X 48
#define SM_W 250
#define SM_Y1 20
#define SM_H1 4*13-7
#define SM_Y2 SM_Y1+5*13
#define SM_H2 4*13-7
#define SM_Y3 SM_Y2+5*13
#define SM_H3 3*13-7
#define CTL_X 24
#define CTL_Y 86
#define CTL_W 284
#define CTL_H 60
#define LSM_X 85
#define LSM_Y 55
#define LSM_W 175
#define LSM_H 10*13+10
#define NM_X 50
#define NM_Y 100
#define NM_W 225
#define NM_H 13*4+15
#define NE_X 10
#define NE_Y 23
#define NE_W 320-NE_X*2
#define NE_H 200-NE_Y*2
#define CST_X 20
#define CST_Y 48
#define CST_START 60
#define CST_SPC 60
//
// TYPEDEFS
//
typedef struct {
short x,y,amount,curpos,indent;
} CP_iteminfo;
typedef struct {
short active;
char string[36];
int (* routine)(int temp1);
} CP_itemtype;
typedef struct {
short allowed[4];
} CustomCtrls;
extern CP_itemtype MainMenu[];
extern CP_iteminfo MainItems;
//
// FUNCTION PROTOTYPES
//
void US_ControlPanel(ScanCode);
void EnableEndGameMenuItem();
void SetupControlPanel(void);
void SetupSaveGames();
void CleanupControlPanel(void);
void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items);
int HandleMenu(CP_iteminfo *item_i,
CP_itemtype *items,
void (*routine)(int w));
void ClearMScreen(void);
void DrawWindow(int x,int y,int w,int h,int wcolor);
void DrawOutline(int x,int y,int w,int h,int color1,int color2);
void WaitKeyUp(void);
void ReadAnyControl(ControlInfo *ci);
void TicDelay(int count);
void CacheLump(int lumpstart,int lumpend);
void UnCacheLump(int lumpstart,int lumpend);
int StartCPMusic(int song);
int Confirm(const char *string);
void Message(const char *string);
void CheckPause(void);
void ShootSnd(void);
void CheckSecretMissions(void);
void BossKey(void);
void DrawGun(CP_iteminfo *item_i,CP_itemtype *items,int x,int *y,int which,int basey,void (*routine)(int w));
void DrawHalfStep(int x,int y);
void EraseGun(CP_iteminfo *item_i,CP_itemtype *items,int x,int y,int which);
void SetTextColor(CP_itemtype *items,int hlight);
void DrawMenuGun(CP_iteminfo *iteminfo);
void DrawStripes(int y);
void DefineMouseBtns(void);
void DefineJoyBtns(void);
void DefineKeyBtns(void);
void DefineKeyMove(void);
void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type);
void DrawMainMenu(void);
void DrawSoundMenu(void);
void DrawLoadSaveScreen(int loadsave);
void DrawNewEpisode(void);
void DrawNewGame(void);
void DrawChangeView(int view);
void DrawMouseSens(void);
void DrawCtlScreen(void);
void DrawCustomScreen(void);
void DrawLSAction(int which);
void DrawCustMouse(int hilight);
void DrawCustJoy(int hilight);
void DrawCustKeybd(int hilight);
void DrawCustKeys(int hilight);
void PrintCustMouse(int i);
void PrintCustJoy(int i);
void PrintCustKeybd(int i);
void PrintCustKeys(int i);
void PrintLSEntry(int w,int color);
void TrackWhichGame(int w);
void DrawNewGameDiff(int w);
void FixupCustom(int w);
int CP_NewGame(int);
int CP_Sound(int);
int CP_LoadGame(int quick);
int CP_SaveGame(int quick);
int CP_Control(int);
int CP_ChangeView(int);
int CP_ExitOptions(int);
int CP_Quit(int);
int CP_ViewScores(int);
int CP_EndGame(int);
int CP_CheckQuick(ScanCode scancode);
int CustomControls(int);
int MouseSensitivity(int);
void CheckForEpisodes(void);
void FreeMusic(void);
enum {MOUSE,JOYSTICK,KEYBOARDBTNS,KEYBOARDMOVE}; // FOR INPUT TYPES
enum menuitems
{
newgame,
soundmenu,
control,
loadgame,
savegame,
changeview,
#ifndef GOODTIMES
#ifndef SPEAR
readthis,
#endif
#endif
viewscores,
backtodemo,
quit
};
//
// WL_INTER
//
typedef struct {
int kill,secret,treasure;
int32_t time;
} LRstruct;
extern LRstruct LevelRatios[];
void Write (int x,int y,const char *string);
void NonShareware(void);
int GetYorN(int x,int y,int pic);

64
wl_parallax.cpp Normal file
View File

@ -0,0 +1,64 @@
#include "version.h"
#ifdef USE_PARALLAX
#include "wl_def.h"
#ifdef USE_FEATUREFLAGS
// The lower left tile of every map determines the start texture of the parallax sky.
static int GetParallaxStartTexture()
{
int startTex = ffDataBottomLeft;
assert(startTex >= 0 && startTex < PMSpriteStart);
return startTex;
}
#else
static int GetParallaxStartTexture()
{
int startTex;
switch(gamestate.episode * 10 + mapon)
{
case 0: startTex = 20; break;
default: startTex = 0; break;
}
assert(startTex >= 0 && startTex < PMSpriteStart);
return startTex;
}
#endif
void DrawParallax(byte *vbuf, unsigned vbufPitch)
{
int startpage = GetParallaxStartTexture();
int midangle = player->angle * (FINEANGLES / ANGLES);
int skyheight = viewheight >> 1;
int curtex = -1;
byte *skytex;
startpage += USE_PARALLAX - 1;
for(int x = 0; x < viewwidth; x++)
{
int curang = pixelangle[x] + midangle;
if(curang < 0) curang += FINEANGLES;
else if(curang >= FINEANGLES) curang -= FINEANGLES;
int xtex = curang * USE_PARALLAX * TEXTURESIZE / FINEANGLES;
int newtex = xtex >> TEXTURESHIFT;
if(newtex != curtex)
{
curtex = newtex;
skytex = PM_GetTexture(startpage - curtex);
}
int texoffs = TEXTUREMASK - ((xtex & (TEXTURESIZE - 1)) << TEXTURESHIFT);
int yend = skyheight - (wallheight[x] >> 3);
if(yend <= 0) continue;
for(int y = 0, offs = x; y < yend; y++, offs += vbufPitch)
vbuf[offs] = skytex[texoffs + (y * TEXTURESIZE) / skyheight];
}
}
#endif

1353
wl_play.cpp Normal file

File diff suppressed because it is too large Load Diff

143
wl_shade.cpp Normal file
View File

@ -0,0 +1,143 @@
#include "version.h"
#ifdef USE_SHADING
#include "wl_def.h"
#include "wl_shade.h"
typedef struct {
uint8_t destRed, destGreen, destBlue; // values between 0 and 255
uint8_t fogStrength;
} shadedef_t;
shadedef_t shadeDefs[] = {
{ 0, 0, 0, LSHADE_NOSHADING },
{ 0, 0, 0, LSHADE_NORMAL },
{ 0, 0, 0, LSHADE_FOG },
{ 40, 40, 40, LSHADE_NORMAL },
{ 60, 60, 60, LSHADE_FOG }
};
uint8_t shadetable[SHADE_COUNT][256];
int LSHADE_flag;
#ifdef USE_FEATUREFLAGS
// The lower 8-bit of the upper left tile of every map determine
// the used shading definition of shadeDefs.
static inline int GetShadeDefID()
{
int shadeID = ffDataTopLeft & 0x00ff;
assert(shadeID >= 0 && shadeID < lengthof(shadeDefs));
return shadeID;
}
#else
static int GetShadeDefID()
{
int shadeID;
switch(gamestate.episode * 10 + mapon)
{
case 0: shadeID = 4; break;
case 1:
case 2:
case 6: shadeID = 1; break;
case 3: shadeID = 0; break;
case 5: shadeID = 2; break;
default: shadeID = 3; break;
}
assert(shadeID >= 0 && shadeID < lengthof(shadeDefs));
return shadeID;
}
#endif
// Returns the palette index of the nearest matching color of the
// given RGB color in given palette
byte GetColor(byte red, byte green, byte blue, SDL_Color *palette)
{
byte mincol = 0;
double mindist = 200000.F, curdist, DRed, DGreen, DBlue;
SDL_Color *palPtr = palette;
for(int col = 0; col < 256; col++, palPtr++)
{
DRed = (double) (red - palPtr->r);
DGreen = (double) (green - palPtr->g);
DBlue = (double) (blue - palPtr->b);
curdist = DRed * DRed + DGreen * DGreen + DBlue * DBlue;
if(curdist < mindist)
{
mindist = curdist;
mincol = (byte) col;
}
}
return mincol;
}
// Fade all colors in 32 steps down to the destination-RGB
// (use gray for fogging, black for standard shading)
void GenerateShadeTable(byte destRed, byte destGreen, byte destBlue,
SDL_Color *palette, int fog)
{
double curRed, curGreen, curBlue, redStep, greenStep, blueStep;
SDL_Color *palPtr = palette;
// Set the fog-flag
LSHADE_flag=fog;
// Color loop
for(int i = 0; i < 256; i++, palPtr++)
{
// Get original palette color
curRed = palPtr->r;
curGreen = palPtr->g;
curBlue = palPtr->b;
// Calculate increment per step
redStep = ((double) destRed - curRed) / (SHADE_COUNT + 8);
greenStep = ((double) destGreen - curGreen) / (SHADE_COUNT + 8);
blueStep = ((double) destBlue - curBlue) / (SHADE_COUNT + 8);
// Calc color for each shade of the current color
for (int shade = 0; shade < SHADE_COUNT; shade++)
{
shadetable[shade][i] = GetColor((byte) curRed, (byte) curGreen, (byte) curBlue, palette);
// Inc to next shade
curRed += redStep;
curGreen += greenStep;
curBlue += blueStep;
}
}
}
void NoShading()
{
for(int shade = 0; shade < SHADE_COUNT; shade++)
for(int i = 0; i < 256; i++)
shadetable[shade][i] = i;
}
void InitLevelShadeTable()
{
shadedef_t *shadeDef = &shadeDefs[GetShadeDefID()];
if(shadeDef->fogStrength == LSHADE_NOSHADING)
NoShading();
else
GenerateShadeTable(shadeDef->destRed, shadeDef->destGreen, shadeDef->destBlue, gamepal, shadeDef->fogStrength);
}
int GetShade(int scale)
{
int shade = (scale >> 1) / (((viewwidth * 3) >> 8) + 1 + LSHADE_flag); // TODO: reconsider this...
if(shade > 32) shade = 32;
else if(shade < 1) shade = 1;
shade = 32 - shade;
return shade;
}
#endif

15
wl_shade.h Normal file
View File

@ -0,0 +1,15 @@
#if defined(USE_SHADING) && !defined(_WL_SHADE_H_)
#define _WL_SHADE_H_
#define SHADE_COUNT 32
#define LSHADE_NOSHADING 0xff
#define LSHADE_NORMAL 0
#define LSHADE_FOG 5
extern uint8_t shadetable[SHADE_COUNT][256];
void InitLevelShadeTable();
int GetShade(int scale);
#endif

1530
wl_state.cpp Normal file

File diff suppressed because it is too large Load Diff

859
wl_text.cpp Normal file
View File

@ -0,0 +1,859 @@
// WL_TEXT.C
#include "wl_def.h"
#pragma hdrstop
/*
=============================================================================
TEXT FORMATTING COMMANDS
------------------------
^C<hex digit> Change text color
^E[enter] End of layout (all pages)
^G<y>,<x>,<pic>[enter] Draw a graphic and push margins
^P[enter] start new page, must be the first chars in a layout
^L<x>,<y>[ENTER] Locate to a specific spot, x in pixels, y in lines
=============================================================================
*/
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
#ifndef SPEAR
#define BACKCOLOR 0x11
#define WORDLIMIT 80
#define FONTHEIGHT 10
#define TOPMARGIN 16
#define BOTTOMMARGIN 32
#define LEFTMARGIN 16
#define RIGHTMARGIN 16
#define PICMARGIN 8
#define TEXTROWS ((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT)
#define SPACEWIDTH 7
#define SCREENPIXWIDTH 320
#define SCREENMID (SCREENPIXWIDTH/2)
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
static int pagenum;
static int numpages;
static unsigned leftmargin[TEXTROWS];
static unsigned rightmargin[TEXTROWS];
static char* text;
static unsigned rowon;
static int picx;
static int picy;
static int picnum;
static int picdelay;
static boolean layoutdone;
//===========================================================================
#ifndef JAPAN
/*
=====================
=
= RipToEOL
=
=====================
*/
void RipToEOL (void)
{
while (*text++ != '\n') // scan to end of line
;
}
/*
=====================
=
= ParseNumber
=
=====================
*/
int ParseNumber (void)
{
char ch;
char num[80];
char *numptr;
//
// scan until a number is found
//
ch = *text;
while (ch < '0' || ch >'9')
ch = *++text;
//
// copy the number out
//
numptr = num;
do
{
*numptr++ = ch;
ch = *++text;
} while (ch >= '0' && ch <= '9');
*numptr = 0;
return atoi (num);
}
/*
=====================
=
= ParsePicCommand
=
= Call with text pointing just after a ^P
= Upon exit text points to the start of next line
=
=====================
*/
void ParsePicCommand (void)
{
picy=ParseNumber();
picx=ParseNumber();
picnum=ParseNumber();
RipToEOL ();
}
void ParseTimedCommand (void)
{
picy=ParseNumber();
picx=ParseNumber();
picnum=ParseNumber();
picdelay=ParseNumber();
RipToEOL ();
}
/*
=====================
=
= TimedPicCommand
=
= Call with text pointing just after a ^P
= Upon exit text points to the start of next line
=
=====================
*/
void TimedPicCommand (void)
{
ParseTimedCommand ();
//
// update the screen, and wait for time delay
//
VW_UpdateScreen ();
//
// wait for time
//
Delay(picdelay);
//
// draw pic
//
VWB_DrawPic (picx&~7,picy,picnum);
}
/*
=====================
=
= HandleCommand
=
=====================
*/
void HandleCommand (void)
{
int i,margin,top,bottom;
int picwidth,picheight,picmid;
switch (toupper(*++text))
{
case 'B':
picy=ParseNumber();
picx=ParseNumber();
picwidth=ParseNumber();
picheight=ParseNumber();
VWB_Bar(picx,picy,picwidth,picheight,BACKCOLOR);
RipToEOL();
break;
case ';': // comment
RipToEOL();
break;
case 'P': // ^P is start of next page, ^E is end of file
case 'E':
layoutdone = true;
text--; // back up to the '^'
break;
case 'C': // ^c<hex digit> changes text color
i = toupper(*++text);
if (i>='0' && i<='9')
fontcolor = i-'0';
else if (i>='A' && i<='F')
fontcolor = i-'A'+10;
fontcolor *= 16;
i = toupper(*++text);
if (i>='0' && i<='9')
fontcolor += i-'0';
else if (i>='A' && i<='F')
fontcolor += i-'A'+10;
text++;
break;
case '>':
px = 160;
text++;
break;
case 'L':
py=ParseNumber();
rowon = (py-TOPMARGIN)/FONTHEIGHT;
py = TOPMARGIN+rowon*FONTHEIGHT;
px=ParseNumber();
while (*text++ != '\n') // scan to end of line
;
break;
case 'T': // ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic
TimedPicCommand ();
break;
case 'G': // ^Gyyy,xxx,ppp draws graphic
ParsePicCommand ();
VWB_DrawPic (picx&~7,picy,picnum);
picwidth = pictable[picnum-STARTPICS].width;
picheight = pictable[picnum-STARTPICS].height;
//
// adjust margins
//
picmid = picx + picwidth/2;
if (picmid > SCREENMID)
margin = picx-PICMARGIN; // new right margin
else
margin = picx+picwidth+PICMARGIN; // new left margin
top = (picy-TOPMARGIN)/FONTHEIGHT;
if (top<0)
top = 0;
bottom = (picy+picheight-TOPMARGIN)/FONTHEIGHT;
if (bottom>=TEXTROWS)
bottom = TEXTROWS-1;
for (i=top;i<=bottom;i++)
if (picmid > SCREENMID)
rightmargin[i] = margin;
else
leftmargin[i] = margin;
//
// adjust this line if needed
//
if (px < (int) leftmargin[rowon])
px = leftmargin[rowon];
break;
}
}
/*
=====================
=
= NewLine
=
=====================
*/
void NewLine (void)
{
char ch;
if (++rowon == TEXTROWS)
{
//
// overflowed the page, so skip until next page break
//
layoutdone = true;
do
{
if (*text == '^')
{
ch = toupper(*(text+1));
if (ch == 'E' || ch == 'P')
{
layoutdone = true;
return;
}
}
text++;
} while (1);
}
px = leftmargin[rowon];
py+= FONTHEIGHT;
}
/*
=====================
=
= HandleCtrls
=
=====================
*/
void HandleCtrls (void)
{
char ch;
ch = *text++; // get the character and advance
if (ch == '\n')
{
NewLine ();
return;
}
}
/*
=====================
=
= HandleWord
=
=====================
*/
void HandleWord (void)
{
char wword[WORDLIMIT];
int wordindex;
word wwidth,wheight,newpos;
//
// copy the next word into [word]
//
wword[0] = *text++;
wordindex = 1;
while (*text>32)
{
wword[wordindex] = *text++;
if (++wordindex == WORDLIMIT)
Quit ("PageLayout: Word limit exceeded");
}
wword[wordindex] = 0; // stick a null at end for C
//
// see if it fits on this line
//
VW_MeasurePropString (wword,&wwidth,&wheight);
while (px+wwidth > (int) rightmargin[rowon])
{
NewLine ();
if (layoutdone)
return; // overflowed page
}
//
// print it
//
newpos = px+wwidth;
VWB_DrawPropString (wword);
px = newpos;
//
// suck up any extra spaces
//
while (*text == ' ')
{
px += SPACEWIDTH;
text++;
}
}
/*
=====================
=
= PageLayout
=
= Clears the screen, draws the pics on the page, and word wraps the text.
= Returns a pointer to the terminating command
=
=====================
*/
void PageLayout (boolean shownumber)
{
int i,oldfontcolor;
char ch;
oldfontcolor = fontcolor;
fontcolor = 0;
//
// clear the screen
//
VWB_Bar (0,0,320,200,BACKCOLOR);
VWB_DrawPic (0,0,H_TOPWINDOWPIC);
VWB_DrawPic (0,8,H_LEFTWINDOWPIC);
VWB_DrawPic (312,8,H_RIGHTWINDOWPIC);
VWB_DrawPic (8,176,H_BOTTOMINFOPIC);
for (i=0; i<TEXTROWS; i++)
{
leftmargin[i] = LEFTMARGIN;
rightmargin[i] = SCREENPIXWIDTH-RIGHTMARGIN;
}
px = LEFTMARGIN;
py = TOPMARGIN;
rowon = 0;
layoutdone = false;
//
// make sure we are starting layout text (^P first command)
//
while (*text <= 32)
text++;
if (*text != '^' || toupper(*++text) != 'P')
Quit ("PageLayout: Text not headed with ^P");
while (*text++ != '\n')
;
//
// process text stream
//
do
{
ch = *text;
if (ch == '^')
HandleCommand ();
else
if (ch == 9)
{
px = (px+8)&0xf8;
text++;
}
else if (ch <= 32)
HandleCtrls ();
else
HandleWord ();
} while (!layoutdone);
pagenum++;
if (shownumber)
{
#ifdef SPANISH
sprintf(str, "Hoja %d de %d", pagenum, numpages);
px = 208;
#else
sprintf(str, "pg %d of %d", pagenum, numpages);
px = 213;
#endif
py = 183;
fontcolor = 0x4f; //12^BACKCOLOR;
VWB_DrawPropString (str);
}
fontcolor = oldfontcolor;
}
//===========================================================================
/*
=====================
=
= BackPage
=
= Scans for a previous ^P
=
=====================
*/
void BackPage (void)
{
pagenum--;
do
{
text--;
if (*text == '^' && toupper(*(text+1)) == 'P')
return;
} while (1);
}
//===========================================================================
/*
=====================
=
= CacheLayoutGraphics
=
= Scans an entire layout file (until a ^E) marking all graphics used, and
= counting pages, then caches the graphics in
=
=====================
*/
void CacheLayoutGraphics (void)
{
char *bombpoint, *textstart;
char ch;
textstart = text;
bombpoint = text+30000;
numpages = pagenum = 0;
do
{
if (*text == '^')
{
ch = toupper(*++text);
if (ch == 'P') // start of a page
numpages++;
if (ch == 'E') // end of file, so load graphics and return
{
#ifndef SPEAR
CA_CacheGrChunk(H_TOPWINDOWPIC);
CA_CacheGrChunk(H_LEFTWINDOWPIC);
CA_CacheGrChunk(H_RIGHTWINDOWPIC);
CA_CacheGrChunk(H_BOTTOMINFOPIC);
#endif
// CA_CacheMarks ();
text = textstart;
return;
}
if (ch == 'G') // draw graphic command, so mark graphics
{
ParsePicCommand ();
CA_CacheGrChunk (picnum);
}
if (ch == 'T') // timed draw graphic command, so mark graphics
{
ParseTimedCommand ();
CA_CacheGrChunk (picnum);
}
}
else
text++;
} while (text<bombpoint);
Quit ("CacheLayoutGraphics: No ^E to terminate file!");
}
#endif
/*
=====================
=
= ShowArticle
=
=====================
*/
#ifdef JAPAN
void ShowArticle (int which)
#else
void ShowArticle (char *article)
#endif
{
#ifdef JAPAN
int snames[10] = {
H_HELP1PIC,
H_HELP2PIC,
H_HELP3PIC,
H_HELP4PIC,
H_HELP5PIC,
H_HELP6PIC,
H_HELP7PIC,
H_HELP8PIC,
H_HELP9PIC,
H_HELP10PIC};
int enames[14] = {
0,0,
#ifndef JAPDEMO
C_ENDGAME1APIC,
C_ENDGAME1BPIC,
C_ENDGAME2APIC,
C_ENDGAME2BPIC,
C_ENDGAME3APIC,
C_ENDGAME3BPIC,
C_ENDGAME4APIC,
C_ENDGAME4BPIC,
C_ENDGAME5APIC,
C_ENDGAME5BPIC,
C_ENDGAME6APIC,
C_ENDGAME6BPIC
#endif
};
#endif
unsigned oldfontnumber;
boolean newpage,firstpage;
ControlInfo ci;
#ifdef JAPAN
pagenum = 1;
if (!which)
numpages = 10;
else
numpages = 2;
#else
text = article;
oldfontnumber = fontnumber;
fontnumber = 0;
CA_CacheGrChunk(STARTFONT);
VWB_Bar (0,0,320,200,BACKCOLOR);
CacheLayoutGraphics ();
#endif
newpage = true;
firstpage = true;
do
{
if (newpage)
{
newpage = false;
#ifdef JAPAN
if (!which)
CA_CacheScreen(snames[pagenum - 1]);
else
CA_CacheScreen(enames[which*2 + pagenum - 1]);
#else
PageLayout (true);
#endif
VW_UpdateScreen ();
if (firstpage)
{
VL_FadeIn(0,255,gamepal,10);
firstpage = false;
}
}
SDL_Delay(5);
LastScan = 0;
ReadAnyControl(&ci);
Direction dir = ci.dir;
switch(dir)
{
case dir_North:
case dir_South:
break;
default:
if(ci.button0) dir = dir_South;
switch(LastScan)
{
case sc_UpArrow:
case sc_PgUp:
case sc_LeftArrow:
dir = dir_North;
break;
case sc_Enter:
case sc_DownArrow:
case sc_PgDn:
case sc_RightArrow:
dir = dir_South;
break;
}
break;
}
switch(dir)
{
case dir_North:
case dir_West:
if (pagenum>1)
{
#ifndef JAPAN
BackPage ();
BackPage ();
#else
pagenum--;
#endif
newpage = true;
}
TicDelay(20);
break;
case dir_South:
case dir_East:
if (pagenum<numpages)
{
newpage = true;
#ifdef JAPAN
pagenum++;
#endif
}
TicDelay(20);
break;
}
} while (LastScan != sc_Escape && !ci.button1);
IN_ClearKeysDown ();
fontnumber = oldfontnumber;
}
//===========================================================================
#ifndef JAPAN
#ifdef ARTSEXTERN
int endextern = T_ENDART1;
#ifndef SPEAR
int helpextern = T_HELPART;
#endif
#endif
char helpfilename[13] = "HELPART.",
endfilename[13] = "ENDART1.";
#endif
/*
=================
=
= HelpScreens
=
=================
*/
#ifndef SPEAR
void HelpScreens (void)
{
int artnum;
char *text;
#ifndef ARTSEXTERN
memptr layout;
#endif
// CA_UpLevel ();
// MM_SortMem ();
#ifdef JAPAN
ShowArticle (0);
VW_FadeOut();
FreeMusic ();
CA_DownLevel ();
MM_SortMem ();
#else
#ifdef ARTSEXTERN
artnum = helpextern;
CA_CacheGrChunk (artnum);
text = (char *)grsegs[artnum];
#else
CA_LoadFile (helpfilename,&layout);
text = (char *)layout;
#endif
ShowArticle (text);
#ifdef ARTSEXTERN
UNCACHEGRCHUNK(artnum);
#else
free(layout);
#endif
VW_FadeOut();
FreeMusic ();
#endif
}
#endif
//
// END ARTICLES
//
void EndText (void)
{
int artnum;
char *text;
#ifndef ARTSEXTERN
memptr layout;
#endif
ClearMemory ();
#ifdef JAPAN
ShowArticle(gamestate.episode + 1);
VW_FadeOut();
SETFONTCOLOR(0,15);
IN_ClearKeysDown();
if (MousePresent && IN_IsInputGrabbed())
IN_CenterMouse(); // Clear accumulated mouse movement
FreeMusic ();
#else
#ifdef ARTSEXTERN
artnum = endextern+gamestate.episode;
CA_CacheGrChunk (artnum);
text = (char *)grsegs[artnum];
#else
endfilename[6] = '1'+gamestate.episode;
CA_LoadFile (endfilename,&layout);
text = (char *)layout;
#endif
ShowArticle (text);
#ifdef ARTSEXTERN
UNCACHEGRCHUNK(artnum);
#else
free(layout);
#endif
VW_FadeOut();
SETFONTCOLOR(0,15);
IN_ClearKeysDown();
if (MousePresent && IN_IsInputGrabbed())
IN_CenterMouse(); // Clear accumulated mouse movement
FreeMusic ();
#endif
}
#endif

52
wolfpal.inc Normal file
View File

@ -0,0 +1,52 @@
RGB( 0, 0, 0),RGB( 0, 0, 42),RGB( 0, 42, 0),RGB( 0, 42, 42),RGB( 42, 0, 0),
RGB( 42, 0, 42),RGB( 42, 21, 0),RGB( 42, 42, 42),RGB( 21, 21, 21),RGB( 21, 21, 63),
RGB( 21, 63, 21),RGB( 21, 63, 63),RGB( 63, 21, 21),RGB( 63, 21, 63),RGB( 63, 63, 21),
RGB( 63, 63, 63),RGB( 59, 59, 59),RGB( 55, 55, 55),RGB( 52, 52, 52),RGB( 48, 48, 48),
RGB( 45, 45, 45),RGB( 42, 42, 42),RGB( 38, 38, 38),RGB( 35, 35, 35),RGB( 31, 31, 31),
RGB( 28, 28, 28),RGB( 25, 25, 25),RGB( 21, 21, 21),RGB( 18, 18, 18),RGB( 14, 14, 14),
RGB( 11, 11, 11),RGB( 8, 8, 8),RGB( 63, 0, 0),RGB( 59, 0, 0),RGB( 56, 0, 0),
RGB( 53, 0, 0),RGB( 50, 0, 0),RGB( 47, 0, 0),RGB( 44, 0, 0),RGB( 41, 0, 0),
RGB( 38, 0, 0),RGB( 34, 0, 0),RGB( 31, 0, 0),RGB( 28, 0, 0),RGB( 25, 0, 0),
RGB( 22, 0, 0),RGB( 19, 0, 0),RGB( 16, 0, 0),RGB( 63, 54, 54),RGB( 63, 46, 46),
RGB( 63, 39, 39),RGB( 63, 31, 31),RGB( 63, 23, 23),RGB( 63, 16, 16),RGB( 63, 8, 8),
RGB( 63, 0, 0),RGB( 63, 42, 23),RGB( 63, 38, 16),RGB( 63, 34, 8),RGB( 63, 30, 0),
RGB( 57, 27, 0),RGB( 51, 24, 0),RGB( 45, 21, 0),RGB( 39, 19, 0),RGB( 63, 63, 54),
RGB( 63, 63, 46),RGB( 63, 63, 39),RGB( 63, 63, 31),RGB( 63, 62, 23),RGB( 63, 61, 16),
RGB( 63, 61, 8),RGB( 63, 61, 0),RGB( 57, 54, 0),RGB( 51, 49, 0),RGB( 45, 43, 0),
RGB( 39, 39, 0),RGB( 33, 33, 0),RGB( 28, 27, 0),RGB( 22, 21, 0),RGB( 16, 16, 0),
RGB( 52, 63, 23),RGB( 49, 63, 16),RGB( 45, 63, 8),RGB( 40, 63, 0),RGB( 36, 57, 0),
RGB( 32, 51, 0),RGB( 29, 45, 0),RGB( 24, 39, 0),RGB( 54, 63, 54),RGB( 47, 63, 46),
RGB( 39, 63, 39),RGB( 32, 63, 31),RGB( 24, 63, 23),RGB( 16, 63, 16),RGB( 8, 63, 8),
RGB( 0, 63, 0),RGB( 0, 63, 0),RGB( 0, 59, 0),RGB( 0, 56, 0),RGB( 0, 53, 0),
RGB( 1, 50, 0),RGB( 1, 47, 0),RGB( 1, 44, 0),RGB( 1, 41, 0),RGB( 1, 38, 0),
RGB( 1, 34, 0),RGB( 1, 31, 0),RGB( 1, 28, 0),RGB( 1, 25, 0),RGB( 1, 22, 0),
RGB( 1, 19, 0),RGB( 1, 16, 0),RGB( 54, 63, 63),RGB( 46, 63, 63),RGB( 39, 63, 63),
RGB( 31, 63, 62),RGB( 23, 63, 63),RGB( 16, 63, 63),RGB( 8, 63, 63),RGB( 0, 63, 63),
RGB( 0, 57, 57),RGB( 0, 51, 51),RGB( 0, 45, 45),RGB( 0, 39, 39),RGB( 0, 33, 33),
RGB( 0, 28, 28),RGB( 0, 22, 22),RGB( 0, 16, 16),RGB( 23, 47, 63),RGB( 16, 44, 63),
RGB( 8, 42, 63),RGB( 0, 39, 63),RGB( 0, 35, 57),RGB( 0, 31, 51),RGB( 0, 27, 45),
RGB( 0, 23, 39),RGB( 54, 54, 63),RGB( 46, 47, 63),RGB( 39, 39, 63),RGB( 31, 32, 63),
RGB( 23, 24, 63),RGB( 16, 16, 63),RGB( 8, 9, 63),RGB( 0, 1, 63),RGB( 0, 0, 63),
RGB( 0, 0, 59),RGB( 0, 0, 56),RGB( 0, 0, 53),RGB( 0, 0, 50),RGB( 0, 0, 47),
RGB( 0, 0, 44),RGB( 0, 0, 41),RGB( 0, 0, 38),RGB( 0, 0, 34),RGB( 0, 0, 31),
RGB( 0, 0, 28),RGB( 0, 0, 25),RGB( 0, 0, 22),RGB( 0, 0, 19),RGB( 0, 0, 16),
RGB( 10, 10, 10),RGB( 63, 56, 13),RGB( 63, 53, 9),RGB( 63, 51, 6),RGB( 63, 48, 2),
RGB( 63, 45, 0),RGB( 45, 8, 63),RGB( 42, 0, 63),RGB( 38, 0, 57),RGB( 32, 0, 51),
RGB( 29, 0, 45),RGB( 24, 0, 39),RGB( 20, 0, 33),RGB( 17, 0, 28),RGB( 13, 0, 22),
RGB( 10, 0, 16),RGB( 63, 54, 63),RGB( 63, 46, 63),RGB( 63, 39, 63),RGB( 63, 31, 63),
RGB( 63, 23, 63),RGB( 63, 16, 63),RGB( 63, 8, 63),RGB( 63, 0, 63),RGB( 56, 0, 57),
RGB( 50, 0, 51),RGB( 45, 0, 45),RGB( 39, 0, 39),RGB( 33, 0, 33),RGB( 27, 0, 28),
RGB( 22, 0, 22),RGB( 16, 0, 16),RGB( 63, 58, 55),RGB( 63, 56, 52),RGB( 63, 54, 49),
RGB( 63, 53, 47),RGB( 63, 51, 44),RGB( 63, 49, 41),RGB( 63, 47, 39),RGB( 63, 46, 36),
RGB( 63, 44, 32),RGB( 63, 41, 28),RGB( 63, 39, 24),RGB( 60, 37, 23),RGB( 58, 35, 22),
RGB( 55, 34, 21),RGB( 52, 32, 20),RGB( 50, 31, 19),RGB( 47, 30, 18),RGB( 45, 28, 17),
RGB( 42, 26, 16),RGB( 40, 25, 15),RGB( 39, 24, 14),RGB( 36, 23, 13),RGB( 34, 22, 12),
RGB( 32, 20, 11),RGB( 29, 19, 10),RGB( 27, 18, 9),RGB( 23, 16, 8),RGB( 21, 15, 7),
RGB( 18, 14, 6),RGB( 16, 12, 6),RGB( 14, 11, 5),RGB( 10, 8, 3),RGB( 24, 0, 25),
RGB( 0, 25, 25),RGB( 0, 24, 24),RGB( 0, 0, 7),RGB( 0, 0, 11),RGB( 12, 9, 4),
RGB( 18, 0, 18),RGB( 20, 0, 20),RGB( 0, 0, 13),RGB( 7, 7, 7),RGB( 19, 19, 19),
RGB( 23, 23, 23),RGB( 16, 16, 16),RGB( 12, 12, 12),RGB( 13, 13, 13),RGB( 54, 61, 61),
RGB( 46, 58, 58),RGB( 39, 55, 55),RGB( 29, 50, 50),RGB( 18, 48, 48),RGB( 8, 45, 45),
RGB( 8, 44, 44),RGB( 0, 41, 41),RGB( 0, 38, 38),RGB( 0, 35, 35),RGB( 0, 33, 33),
RGB( 0, 31, 31),RGB( 0, 30, 30),RGB( 0, 29, 29),RGB( 0, 28, 28),RGB( 0, 27, 27),
RGB( 38, 0, 34)