Commit d6a8fb79 authored by Steven Fuller's avatar Steven Fuller

fmopl.c, fmopl.h: Added OPL2 emulation code from MAME

sd_oss.c: Sound/Music!

vi_xlib.c: Added a few more keys to XKeysymToScancode.

Rest: more cleanups and the like
parent ae6c51a9
CC = gcc CC = gcc
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro #CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro -D_REENTRANT
CFLAGS = -g -Wall CFLAGS = -g -Wall -D_REENTRANT
#CFLAGS = -Os -Wall #CFLAGS = -Os -Wall
#CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro #CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \ OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
wl_act1.o wl_act2.o wl_agent.o wl_game.o \ wl_act1.o wl_act2.o wl_agent.o wl_game.o \
wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \ wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \
wl_debug.o gfxsave.o sd_oss.o # sd_null.o wl_debug.o gfxsave.o sd_oss.o fmopl.o # sd_null.o
ROBJS = wl_draw.o wl_scale.o ROBJS = wl_draw.o wl_scale.o
SOBJS = $(OBJS) $(ROBJS) vi_svga.o SOBJS = $(OBJS) $(ROBJS) vi_svga.o
XOBJS = $(OBJS) $(ROBJS) vi_xlib.o XOBJS = $(OBJS) $(ROBJS) vi_xlib.o
LFLAGS = -lm #LFLAGS = -lm
LFLAGS = -lm -lpthread
SLFLAGS = $(LFLAGS) -lvga SLFLAGS = $(LFLAGS) -lvga
XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga
......
This diff is collapsed.
#ifndef __FMOPL_H_
#define __FMOPL_H_
/* --- system optimize --- */
/* select bit size of output : 8 or 16 */
#define OPL_OUTPUT_BIT 16
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 */
#if (OPL_OUTPUT_BIT==16)
typedef INT16 OPLSAMPLE;
#endif
#if (OPL_OUTPUT_BIT==8)
typedef unsigned char 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);
/* !!!!! here is private section , do not access there member direct !!!!! */
#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 */
/* ---------- OPL one of slot ---------- */
typedef struct fm_opl_slot {
INT32 TL; /* total level :TL << 8 */
INT32 TLL; /* adjusted now TL */
UINT8 KSR; /* key scale rate :(shift down bit) */
INT32 *AR; /* attack rate :&AR_TABLE[AR<<2] */
INT32 *DR; /* decay rate :&DR_TALBE[DR<<2] */
INT32 SL; /* sustin level :SL_TALBE[SL] */
INT32 *RR; /* release rate :&DR_TABLE[RR<<2] */
UINT8 ksl; /* keyscale level :(shift down bits) */
UINT8 ksr; /* key scale rate :kcode>>KSR */
UINT32 mul; /* multiple :ML_TABLE[ML] */
UINT32 Cnt; /* frequency count : */
UINT32 Incr; /* frequency step : */
/* envelope generator state */
UINT8 eg_typ; /* envelope type flag */
UINT8 evm; /* envelope phase */
INT32 evc; /* envelope counter */
INT32 eve; /* envelope counter end point */
INT32 evs; /* envelope counter step */
INT32 evsa; /* envelope step for AR :AR[ksr] */
INT32 evsd; /* envelope step for DR :DR[ksr] */
INT32 evsr; /* envelope step for RR :RR[ksr] */
/* LFO */
UINT8 ams; /* ams flag */
UINT8 vib; /* vibrate flag */
/* wave selector */
INT32 **wavetable;
}OPL_SLOT;
/* ---------- OPL one of channel ---------- */
typedef struct fm_opl_channel {
OPL_SLOT SLOT[2];
UINT8 CON; /* connection type */
UINT8 FB; /* feed back :(shift down bit) */
INT32 *connect1; /* slot1 output pointer */
INT32 *connect2; /* slot2 output pointer */
INT32 op1_out[2]; /* slot1 output for selfeedback */
/* phase generator state */
UINT32 block_fnum; /* block+fnum : */
UINT8 kcode; /* key code : KeyScaleCode */
UINT32 fc; /* Freq. Increment base */
UINT32 ksl_base; /* KeyScaleLevel Base step */
UINT8 keyon; /* key on/off flag */
} OPL_CH;
/* OPL state */
typedef struct fm_opl_f {
UINT8 type; /* chip type */
int clock; /* master clock (Hz) */
int rate; /* sampling rate (Hz) */
double freqbase; /* frequency base */
double TimerBase; /* Timer base time (==sampling time) */
UINT8 address; /* address register */
UINT8 status; /* status flag */
UINT8 statusmask; /* status mask */
UINT32 mode; /* Reg.08 : CSM , notesel,etc. */
/* Timer */
int T[2]; /* timer counter */
UINT8 st[2]; /* timer enable */
/* FM channel slots */
OPL_CH *P_CH; /* pointer of CH */
int max_ch; /* maximum channel */
/* Rythm sention */
UINT8 rythm; /* Rythm mode , key flag */
INT32 AR_TABLE[75]; /* attack rate tables */
INT32 DR_TABLE[75]; /* decay rate tables */
UINT32 FN_TABLE[1024]; /* fnumber -> increment counter */
/* LFO */
INT32 *ams_table;
INT32 *vib_table;
INT32 amsCnt;
INT32 amsIncr;
INT32 vibCnt;
INT32 vibIncr;
/* wave selector enable flag */
UINT8 wavesel;
/* external event callback handler */
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 */
} FM_OPL;
/* ---------- Generic interface section ---------- */
#define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL)
FM_OPL *OPLCreate(int type, int clock, int rate);
void OPLDestroy(FM_OPL *OPL);
void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
void OPLSetIRQHandler(FM_OPL *OPL,OPL_IRQHANDLER IRQHandler,int param);
void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param);
void OPLResetChip(FM_OPL *OPL);
int OPLWrite(FM_OPL *OPL,int a,int v);
unsigned char OPLRead(FM_OPL *OPL,int a);
int OPLTimerOver(FM_OPL *OPL,int c);
/* YM3626/YM3812 local section */
void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length);
#endif
...@@ -65,8 +65,8 @@ static long *audiostarts; /* array of offsets in audio / audiot */ ...@@ -65,8 +65,8 @@ static long *audiostarts; /* array of offsets in audio / audiot */
static huffnode grhuffman[255]; static huffnode grhuffman[255];
static int grhandle; /* handle to VGAGRAPH */ static int grhandle; /* handle to VGAGRAPH */
static int maphandle; /* handle to MAPTEMP / GAMEMAPS */ static int maphandle; /* handle to GAMEMAPS */
static int audiohandle; /* handle to AUDIOT / AUDIO */ static int audiohandle; /* handle to AUDIOT */
SDMode oldsoundmode; SDMode oldsoundmode;
...@@ -96,7 +96,7 @@ static long GRFILEPOS(int c) ...@@ -96,7 +96,7 @@ static long GRFILEPOS(int c)
============================================================================= =============================================================================
*/ */
void CA_CannotOpen(char *string) static void CA_CannotOpen(char *string)
{ {
/* TODO Ow, string must be a small one else boom */ /* TODO Ow, string must be a small one else boom */
char str[30]; char str[30];
...@@ -164,34 +164,6 @@ boolean CA_FarWrite(int handle, byte *source, long length) ...@@ -164,34 +164,6 @@ boolean CA_FarWrite(int handle, byte *source, long length)
return true; return true;
} }
/*
==========================
=
= CA_ReadFile
=
= Reads a file into an allready allocated buffer
=
==========================
*/
boolean CA_ReadFile(char *filename, memptr *ptr)
{
int handle;
long size;
if ((handle = open(filename, O_RDONLY | O_BINARY)) == -1)
return false;
size = filelength(handle);
if (!CA_FarRead(handle, *ptr, size)) {
close(handle);
return false;
}
close(handle);
return true;
}
/* /*
========================== ==========================
= =
...@@ -231,7 +203,7 @@ boolean CA_WriteFile(char *filename, void *ptr, long length) ...@@ -231,7 +203,7 @@ boolean CA_WriteFile(char *filename, void *ptr, long length)
========================== ==========================
*/ */
boolean CA_LoadFile (char *filename, memptr *ptr) boolean CA_LoadFile(char *filename, memptr *ptr)
{ {
int handle; int handle;
long size; long size;
...@@ -323,7 +295,6 @@ void CAL_CarmackExpand(word *source, word *dest, word length) ...@@ -323,7 +295,6 @@ void CAL_CarmackExpand(word *source, word *dest, word length)
outptr = dest; outptr = dest;
while (length) { while (length) {
/* LSB */
chlow = *inptr++; /* count */ chlow = *inptr++; /* count */
chhigh = *inptr++; chhigh = *inptr++;
...@@ -367,60 +338,6 @@ void CAL_CarmackExpand(word *source, word *dest, word length) ...@@ -367,60 +338,6 @@ void CAL_CarmackExpand(word *source, word *dest, word length)
} }
} }
#if 0
void CAL_CarmackExpand(word *source, word *dest, word length)
{
word ch, chhigh, count, offset;
word *copyptr, *inptr, *outptr;
byte **byteinc = (byte **)&inptr;
length /= 2;
inptr = source;
outptr = dest;
while (length) {
ch = *inptr++;
chhigh = ch>>8;
if (chhigh == NEARTAG) {
count = ch&0xff;
if (!count) {
/* have to insert a word containing the tag byte */
ch |= **byteinc;
(*byteinc)++;
*outptr++ = ch;
length--;
} else {
offset = **byteinc;
(*byteinc)++;
copyptr = outptr - offset;
length -= count;
while (count--)
*outptr++ = *copyptr++;
}
} else if (chhigh == FARTAG) {
count = ch&0xff;
if (!count) {
/* have to insert a word containing the tag byte */
ch |= **byteinc;
(*byteinc)++;
*outptr++ = ch;
length --;
} else {
offset = *inptr++;
copyptr = dest + offset;
length -= count;
while (count--)
*outptr++ = *copyptr++;
}
} else {
*outptr++ = ch;
length--;
}
}
}
#endif
/* /*
====================== ======================
= =
...@@ -497,7 +414,7 @@ static void CAL_SetupGrFile() ...@@ -497,7 +414,7 @@ static void CAL_SetupGrFile()
long chunkcomplen; long chunkcomplen;
// //
// load ???dict.ext (huffman dictionary for graphics files) // load vgadict.ext (huffman dictionary for graphics files)
// //
strcpy(fname, gdictname); strcpy(fname, gdictname);
...@@ -509,7 +426,7 @@ static void CAL_SetupGrFile() ...@@ -509,7 +426,7 @@ static void CAL_SetupGrFile()
read(handle, &grhuffman, sizeof(grhuffman)); read(handle, &grhuffman, sizeof(grhuffman));
close(handle); close(handle);
// //
// load the data offsets from ???head.ext // load the data offsets from vgahead.ext
// //
MM_GetPtr((memptr)&grstarts, (NUMCHUNKS+1)*FILEPOSSIZE); MM_GetPtr((memptr)&grstarts, (NUMCHUNKS+1)*FILEPOSSIZE);
...@@ -688,11 +605,11 @@ void CA_Startup() ...@@ -688,11 +605,11 @@ void CA_Startup()
====================== ======================
*/ */
void CA_Shutdown (void) void CA_Shutdown()
{ {
close (maphandle); close(maphandle);
close (grhandle); close(grhandle);
close (audiohandle); close(audiohandle);
} }
//=========================================================================== //===========================================================================
...@@ -731,7 +648,7 @@ void CA_CacheAudioChunk(int chunk) ...@@ -731,7 +648,7 @@ void CA_CacheAudioChunk(int chunk)
void CA_UnCacheAudioChunk(int chunk) void CA_UnCacheAudioChunk(int chunk)
{ {
/* TODO: For now the warning is ignorable since wl_menu.c does it */ /* TODO: For now the warning may be ignored since wl_menu.c causes it */
if (audiosegs[chunk] == 0) { if (audiosegs[chunk] == 0) {
fprintf(stderr, "Trying to free null audio chunk %d!\n", chunk); fprintf(stderr, "Trying to free null audio chunk %d!\n", chunk);
return; return;
...@@ -757,6 +674,7 @@ void CA_LoadAllSounds() ...@@ -757,6 +674,7 @@ void CA_LoadAllSounds()
{ {
unsigned start, i; unsigned start, i;
#if 0
switch (oldsoundmode) switch (oldsoundmode)
{ {
case sdm_PC: case sdm_PC:
...@@ -787,9 +705,10 @@ cachein: ...@@ -787,9 +705,10 @@ cachein:
default: default:
return; return;
} }
#endif
for (i=0;i<NUMSOUNDS;i++,start++) for (start = STARTADLIBSOUNDS, i = 0; i < NUMSOUNDS; i++, start++)
CA_CacheAudioChunk (start); CA_CacheAudioChunk(start);
oldsoundmode = SoundMode; oldsoundmode = SoundMode;
} }
...@@ -993,7 +912,7 @@ void CA_CacheMap(int mapnum) ...@@ -993,7 +912,7 @@ void CA_CacheMap(int mapnum)
// //
size = 64*64*2; size = 64*64*2;
for (plane = 0; plane<MAPPLANES; plane++) for (plane = 0; plane < MAPPLANES; plane++)
{ {
pos = mapheaderseg[mapnum]->planestart[plane]; pos = mapheaderseg[mapnum]->planestart[plane];
compressed = mapheaderseg[mapnum]->planelength[plane]; compressed = mapheaderseg[mapnum]->planelength[plane];
...@@ -1014,11 +933,10 @@ void CA_CacheMap(int mapnum) ...@@ -1014,11 +933,10 @@ void CA_CacheMap(int mapnum)
*/ */
expanded = *source; expanded = *source;
source++; source++;
MM_GetPtr (&buffer2seg,expanded); MM_GetPtr(&buffer2seg, expanded);
CAL_CarmackExpand (source, (word *)buffer2seg,expanded); CAL_CarmackExpand(source, (word *)buffer2seg,expanded);
CA_RLEWexpand (((word *)buffer2seg)+1,*dest,size, CA_RLEWexpand(((word *)buffer2seg)+1,*dest,size,((mapfiletype *)tinf)->RLEWtag);
((mapfiletype *)tinf)->RLEWtag); MM_FreePtr(&buffer2seg);
MM_FreePtr (&buffer2seg);
MM_FreePtr(&bigbufferseg); MM_FreePtr(&bigbufferseg);
} }
...@@ -1037,7 +955,7 @@ void CA_CacheMap(int mapnum) ...@@ -1037,7 +955,7 @@ void CA_CacheMap(int mapnum)
====================== ======================
*/ */
void CA_UpLevel (void) void CA_UpLevel()
{ {
/* /*
int i; int i;
...@@ -1066,7 +984,7 @@ void CA_UpLevel (void) ...@@ -1066,7 +984,7 @@ void CA_UpLevel (void)
====================== ======================
*/ */
void CA_DownLevel (void) void CA_DownLevel(d)
{ {
/* /*
if (!ca_levelnum) if (!ca_levelnum)
...@@ -1089,7 +1007,7 @@ void CA_DownLevel (void) ...@@ -1089,7 +1007,7 @@ void CA_DownLevel (void)
====================== ======================
*/ */
#if 0 #if 0
void CA_ClearMarks (void) void CA_ClearMarks()
{ {
int i; int i;
...@@ -1110,7 +1028,7 @@ void CA_ClearMarks (void) ...@@ -1110,7 +1028,7 @@ void CA_ClearMarks (void)
====================== ======================
*/ */
#if 0 #if 0
void CA_ClearAllMarks (void) void CA_ClearAllMarks()
{ {
memset (grneeded,0,sizeof(grneeded)); memset (grneeded,0,sizeof(grneeded));
ca_levelbit = 1; ca_levelbit = 1;
...@@ -1120,58 +1038,6 @@ void CA_ClearAllMarks (void) ...@@ -1120,58 +1038,6 @@ void CA_ClearAllMarks (void)
//=========================================================================== //===========================================================================
/*
======================
=
= CA_FreeGraphics
=
======================
*/
#if 0
void CA_SetGrPurge (void)
{
int i;
//
// free graphics
//
CA_ClearMarks ();
for (i=0;i<NUMCHUNKS;i++)
if (grsegs[i])
MM_SetPurge ((memptr)&grsegs[i],3);
}
#endif
/*
======================
=
= CA_SetAllPurge
=
= Make everything possible purgable
=
======================
*/
#if 0
void CA_SetAllPurge (void)
{
int i;
//
// free sounds
//
for (i=0;i<NUMSNDCHUNKS;i++)
if (audiosegs[i])
MM_SetPurge ((memptr)&audiosegs[i],3);
//
// free graphics
//
CA_SetGrPurge ();
}
#endif
//===========================================================================
#if 0 #if 0
/* /*
====================== ======================
...@@ -1182,7 +1048,7 @@ void CA_SetAllPurge (void) ...@@ -1182,7 +1048,7 @@ void CA_SetAllPurge (void)
*/ */
#define MAXEMPTYREAD 1024 #define MAXEMPTYREAD 1024
void CA_CacheMarks (void) void CA_CacheMarks()
{ {
int i,next,numcache; int i,next,numcache;
long pos,endpos,nextpos,nextendpos,compressed; long pos,endpos,nextpos,nextendpos,compressed;
...@@ -1334,7 +1200,7 @@ void MM_GetPtr(memptr *baseptr, unsigned long size) ...@@ -1334,7 +1200,7 @@ void MM_GetPtr(memptr *baseptr, unsigned long size)
==================== ====================
*/ */
void MM_FreePtr (memptr *baseptr) void MM_FreePtr(memptr *baseptr)
{ {
/* TODO: add some sort of linked list for purging, etc */ /* TODO: add some sort of linked list for purging, etc */
free(*baseptr); free(*baseptr);
...@@ -1352,7 +1218,7 @@ void MM_FreePtr (memptr *baseptr) ...@@ -1352,7 +1218,7 @@ void MM_FreePtr (memptr *baseptr)
===================== =====================
*/ */
void MM_SetPurge (memptr *baseptr, int purge) void MM_SetPurge(memptr *baseptr, int purge)
{ {
} }
...@@ -1366,7 +1232,7 @@ void MM_SetPurge (memptr *baseptr, int purge) ...@@ -1366,7 +1232,7 @@ void MM_SetPurge (memptr *baseptr, int purge)
===================== =====================
*/ */
void MM_SetLock (memptr *baseptr, boolean locked) void MM_SetLock(memptr *baseptr, boolean locked)
{ {
} }
...@@ -1387,7 +1253,7 @@ void MM_SortMem() ...@@ -1387,7 +1253,7 @@ void MM_SortMem()
static boolean PMStarted; static boolean PMStarted;
static int PageFile = -1; static int PageFile = -1;
static word ChunksInFile; word ChunksInFile;
word PMSpriteStart, PMSoundStart; word PMSpriteStart, PMSoundStart;
word PMNumBlocks; word PMNumBlocks;
...@@ -1546,7 +1412,7 @@ void PM_NextFrame() ...@@ -1546,7 +1412,7 @@ void PM_NextFrame()
// Frame count overrun - kill the LRU hit entries & reset frame count // Frame count overrun - kill the LRU hit entries & reset frame count
if (++PMFrameCount >= MAXLONG - 4) if (++PMFrameCount >= MAXLONG - 4)
{ {
for (i = 0;i < PMNumBlocks;i++) for (i = 0; i < PMNumBlocks; i++)
PMPages[i].lastHit = 0; PMPages[i].lastHit = 0;
PMFrameCount = 0; PMFrameCount = 0;
} }
......
...@@ -37,7 +37,6 @@ extern char extension[5], ...@@ -37,7 +37,6 @@ extern char extension[5],
boolean CA_FarRead(int handle, byte *dest, long length); boolean CA_FarRead(int handle, byte *dest, long length);
boolean CA_FarWrite(int handle, byte *source, long length); boolean CA_FarWrite(int handle, byte *source, long length);
boolean CA_ReadFile(char *filename, memptr *ptr);
boolean CA_LoadFile(char *filename, memptr *ptr); boolean CA_LoadFile(char *filename, memptr *ptr);
boolean CA_WriteFile(char *filename, void *ptr, long length); boolean CA_WriteFile(char *filename, void *ptr, long length);
...@@ -46,7 +45,6 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag); ...@@ -46,7 +45,6 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag);
void CA_Startup(); void CA_Startup();
void CA_Shutdown(); void CA_Shutdown();
void CA_SetGrPurge();
void CA_CacheAudioChunk(int chunk); void CA_CacheAudioChunk(int chunk);
void CA_UnCacheAudioChunk(int chunk); void CA_UnCacheAudioChunk(int chunk);
void CA_LoadAllSounds(); void CA_LoadAllSounds();
...@@ -58,8 +56,6 @@ void CA_UnCacheGrChunk(int chunk); ...@@ -58,8 +56,6 @@ void CA_UnCacheGrChunk(int chunk);
void CA_UpLevel(); void CA_UpLevel();
void CA_DownLevel(); void CA_DownLevel();
/* /*
void CA_SetAllPurge();
void CA_ClearMarks(); void CA_ClearMarks();
void CA_ClearAllMarks(); void CA_ClearAllMarks();
......
...@@ -49,7 +49,7 @@ extern int DigiMap[]; ...@@ -49,7 +49,7 @@ extern int DigiMap[];
// Function prototypes // Function prototypes
extern void SD_Startup(), SD_Shutdown(); extern void SD_Startup(), SD_Shutdown();
extern void SD_PlaySound(soundnames sound); extern boolean SD_PlaySound(soundnames sound);
extern void SD_StopSound(), extern void SD_StopSound(),
SD_WaitSoundDone(), SD_WaitSoundDone(),
SD_StartMusic(MusicGroup *music), SD_StartMusic(MusicGroup *music),
......
...@@ -13,35 +13,17 @@ int DigiMap[LASTSOUND]; ...@@ -13,35 +13,17 @@ int DigiMap[LASTSOUND];
static boolean SD_Started; static boolean SD_Started;
static boolean nextsoundpos;
static int LeftPosition, RightPosition;
static boolean sqActive; static boolean sqActive;
void SD_StopDigitized()
{
}
void SD_Poll() void SD_Poll()
{ {
} }
void SD_SetPosition(int leftpos, int rightpos)
{
}
void SD_PlayDigitized(word which, int leftpos, int rightpos)
{
}
void SD_SetDigiDevice(SDSMode mode) void SD_SetDigiDevice(SDSMode mode)
{ {
} }
// Public routines
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// SD_SetSoundMode() - Sets which sound hardware to use for sound effects // SD_SetSoundMode() - Sets which sound hardware to use for sound effects
...@@ -65,7 +47,6 @@ boolean SD_SetMusicMode(SMMode mode) ...@@ -65,7 +47,6 @@ boolean SD_SetMusicMode(SMMode mode)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// SD_Startup() - starts up the Sound Mgr // SD_Startup() - starts up the Sound Mgr
// Detects all additional sound hardware and installs my ISR
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_Startup() void SD_Startup()
...@@ -79,7 +60,6 @@ void SD_Startup() ...@@ -79,7 +60,6 @@ void SD_Startup()
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// SD_Shutdown() - shuts down the Sound Mgr // SD_Shutdown() - shuts down the Sound Mgr
// Removes sound ISR and turns off whatever sound hardware was active
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_Shutdown() void SD_Shutdown()
...@@ -100,17 +80,6 @@ void SD_Shutdown() ...@@ -100,17 +80,6 @@ void SD_Shutdown()
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_PlaySound(soundnames sound) void SD_PlaySound(soundnames sound)
{ {
boolean ispos;
int lp,rp;
lp = LeftPosition;
rp = RightPosition;
LeftPosition = 0;
RightPosition = 0;
ispos = nextsoundpos;
nextsoundpos = false;
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -298,9 +267,10 @@ static void SetSoundLoc(fixed gx, fixed gy) ...@@ -298,9 +267,10 @@ static void SetSoundLoc(fixed gx, fixed gy)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
static void SD_PositionSound(int leftvol, int rightvol) static void SD_PositionSound(int leftvol, int rightvol)
{ {
LeftPosition = leftvol; }
RightPosition = rightvol;
nextsoundpos = true; static void SD_SetPosition(int leftpos, int rightpos)
{
} }
/* /*
......
This diff is collapsed.
...@@ -871,6 +871,26 @@ static Direction DirTable[] = // Quick lookup for total direction ...@@ -871,6 +871,26 @@ static Direction DirTable[] = // Quick lookup for total direction
int XKeysymToScancode(unsigned int keysym) int XKeysymToScancode(unsigned int keysym)
{ {
switch (keysym) { switch (keysym) {
case XK_1:
return sc_1;
case XK_2:
return sc_2;
case XK_3:
return sc_3;
case XK_4:
return sc_4;
case XK_a:
return sc_A;
case XK_b:
return sc_B;
case XK_i:
return sc_I;
case XK_l:
return sc_L;
case XK_m:
return sc_M;
case XK_t:
return sc_T;
case XK_Left: case XK_Left:
case XK_KP_Left: case XK_KP_Left:
return sc_LeftArrow; return sc_LeftArrow;
......
...@@ -11,16 +11,11 @@ ...@@ -11,16 +11,11 @@
unsigned wallheight[MAXVIEWWIDTH]; unsigned wallheight[MAXVIEWWIDTH];
#define mindist MINDIST
//int pixelangle[MAXVIEWWIDTH]; /* TODO: i put these in wl_main */
//long finetangent[FINEANGLES/4];
// //
// refresh variables // refresh variables
// //
static fixed viewx,viewy; // the focal point fixed viewx,viewy; // the focal point
static int viewangle; int viewangle;
// //
// ray casting variables // ray casting variables
...@@ -110,7 +105,7 @@ static void TransformActor(objtype *ob) ...@@ -110,7 +105,7 @@ static void TransformActor(objtype *ob)
ob->transx = nx; ob->transx = nx;
ob->transy = ny; ob->transy = ny;
if (nx < mindist) /* too close, don't overflow the divide */ if (nx < MINDIST) /* too close, don't overflow the divide */
{ {
ob->viewheight = 0; ob->viewheight = 0;
return; return;
...@@ -173,7 +168,7 @@ static boolean TransformTile(int tx, int ty, int *dispx, int *dispheight) ...@@ -173,7 +168,7 @@ static boolean TransformTile(int tx, int ty, int *dispx, int *dispheight)
// //
// calculate perspective ratio // calculate perspective ratio
// //
if (nx<mindist) /* too close, don't overflow the divide */ if (nx<MINDIST) /* too close, don't overflow the divide */
{ {
*dispheight = 0; *dispheight = 0;
return false; return false;
...@@ -219,8 +214,8 @@ static int CalcHeight() ...@@ -219,8 +214,8 @@ static int CalcHeight()
// //
// calculate perspective ratio (heightnumerator/(nx>>8)) // calculate perspective ratio (heightnumerator/(nx>>8))
// //
if (nx<mindist) if (nx<MINDIST)
nx=mindist; /* don't let divide overflow */ nx=MINDIST; /* don't let divide overflow */
return heightnumerator/(nx>>8); return heightnumerator/(nx>>8);
} }
...@@ -624,7 +619,7 @@ void ThreeDRefresh() ...@@ -624,7 +619,7 @@ void ThreeDRefresh()
DrawPlayBorder(); DrawPlayBorder();
ClearScreen(); ClearScreen();
WallRefresh (); WallRefresh();
// //
// draw all the scaled images // draw all the scaled images
...@@ -637,15 +632,14 @@ void ThreeDRefresh() ...@@ -637,15 +632,14 @@ void ThreeDRefresh()
// //
if (fizzlein) if (fizzlein)
{ {
FizzleFade(xoffset, yoffset, viewwidth,viewheight,20,false); FizzleFade(xoffset, yoffset, viewwidth, viewheight, 20, false);
fizzlein = false; fizzlein = false;
lasttimecount = 0; /* don't make a big tic count */ lasttimecount = 0; /* don't make a big tic count */
set_TimeCount(0); set_TimeCount(0);
} }
VW_UpdateScreen (); VW_UpdateScreen();
frameon++; frameon++;
} }
...@@ -831,12 +825,12 @@ static void AsmRefresh() ...@@ -831,12 +825,12 @@ static void AsmRefresh()
goto passhoriz; goto passhoriz;
xintercept = doorxhit; xintercept = doorxhit;
yintercept = (ytile << 16) + 32768; yintercept = (ytile << 16) + 32768;
HitHorizDoor (); HitHorizDoor();
} }
} }
else { else {
yintercept = ytile << 16; yintercept = ytile << 16;
HitHorizWall (); HitHorizWall();
} }
goto nextpix; goto nextpix;
} }
......
...@@ -3276,12 +3276,6 @@ void Message(char *string) ...@@ -3276,12 +3276,6 @@ void Message(char *string)
VW_UpdateScreen(); VW_UpdateScreen();
} }
////////////////////////////////////////////////////////////////////
//
// THIS MAY BE FIXED A LITTLE LATER...
//
////////////////////////////////////////////////////////////////////
static int lastmusic; static int lastmusic;
void StartCPMusic(int song) void StartCPMusic(int song)
...@@ -3299,19 +3293,17 @@ void StartCPMusic(int song) ...@@ -3299,19 +3293,17 @@ void StartCPMusic(int song)
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]); SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
} }
void FreeMusic(void) void FreeMusic()
{ {
CA_UnCacheAudioChunk(STARTMUSIC + lastmusic); CA_UnCacheAudioChunk(STARTMUSIC + lastmusic);
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// CHECK FOR PAUSE KEY (FOR MUSIC ONLY) // CHECK FOR PAUSE KEY (FOR MUSIC ONLY)
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void CheckPause(void) void CheckPause()
{ {
if (Paused) if (Paused)
{ {
......
...@@ -1328,7 +1328,7 @@ void PlayLoop() ...@@ -1328,7 +1328,7 @@ void PlayLoop()
UpdateSoundLoc(player->x, player->y, player->angle); UpdateSoundLoc(player->x, player->y, player->angle);
if (screenfaded) if (screenfaded)
VW_FadeIn (); VW_FadeIn();
CheckKeys(); CheckKeys();
...@@ -1345,9 +1345,9 @@ void PlayLoop() ...@@ -1345,9 +1345,9 @@ void PlayLoop()
if (demoplayback) if (demoplayback)
{ {
if (IN_CheckAck ()) if (IN_CheckAck())
{ {
IN_ClearKeysDown (); IN_ClearKeysDown();
playstate = ex_abort; playstate = ex_abort;
} }
} }
...@@ -1355,5 +1355,5 @@ void PlayLoop() ...@@ -1355,5 +1355,5 @@ void PlayLoop()
} while (!playstate && !startgame); } while (!playstate && !startgame);
if (playstate != ex_died) if (playstate != ex_died)
FinishPaletteShifts (); FinishPaletteShifts();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment