Commit c030b94b authored by Steven Fuller's avatar Steven Fuller

Added Pause key support. Renamed id_sd to sd_* and started on sd_oal

(OpenAL).
parent 4e05fcd2
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
CFLAGS = -g -Wall #CFLAGS = -g -Wall
#CFLAGS = -g #CFLAGS = -g
#CFLAGS = -Os #CFLAGS = -Os
OBJS = objs.o misc.o id_ca.o id_sd.o id_vh.o id_us.o \ CFLAGS = -g -Wall -I/usr/local/openal/include
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 wl_debug.o sd_oal.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
GOBJS = $(OBJS) vi_ogl.o vi_glx.o GOBJS = $(OBJS) vi_ogl.o vi_glx.o
LFLAGS = -lm #LFLAGS = -lm
#LFLAGS = -lm -lvga ElectricFence-2.2.2/libefence.a -lpthread LFLAGS = -lm -L/usr/local/openal/lib -lopenal -lpthread -ldl
SLFLAGS = $(LFLAGS) -lvga SLFLAGS = $(LFLAGS) -lvga
XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext
GLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lGL GLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lGL
......
...@@ -644,8 +644,7 @@ void CAL_SetupMapFile (void) ...@@ -644,8 +644,7 @@ void CAL_SetupMapFile (void)
} }
//========================================================================== /* ======================================================================== */
/* /*
====================== ======================
...@@ -657,13 +656,12 @@ void CAL_SetupMapFile (void) ...@@ -657,13 +656,12 @@ void CAL_SetupMapFile (void)
void CAL_SetupAudioFile (void) void CAL_SetupAudioFile (void)
{ {
int handle, i; int handle;
long length; long length;
char fname[13]; char fname[13];
// /* load maphead.ext (offsets and tileinfo for map file) */
// load maphead.ext (offsets and tileinfo for map file)
//
strcpy(fname,aheadname); strcpy(fname,aheadname);
strcat(fname,extension); strcat(fname,extension);
...@@ -677,11 +675,8 @@ void CAL_SetupAudioFile (void) ...@@ -677,11 +675,8 @@ void CAL_SetupAudioFile (void)
close(handle); close(handle);
for (i = 0; i < length/4; i++) /* open the data file */
printf("chunk %03d: %08ld\n", i, audiostarts[i]);
//
// open the data file
//
strcpy(fname,afilename); strcpy(fname,afilename);
strcat(fname,extension); strcat(fname,extension);
...@@ -690,8 +685,7 @@ void CAL_SetupAudioFile (void) ...@@ -690,8 +685,7 @@ void CAL_SetupAudioFile (void)
CA_CannotOpen(fname); CA_CannotOpen(fname);
} }
//========================================================================== /* ======================================================================== */
/* /*
====================== ======================
......
...@@ -69,10 +69,10 @@ typedef struct ...@@ -69,10 +69,10 @@ typedef struct
} Rect; } Rect;
#include "vi_comm.h" #include "vi_comm.h"
#include "sd_comm.h"
#include "id_ca.h" #include "id_ca.h"
#include "id_vh.h" #include "id_vh.h"
#include "id_sd.h"
#include "id_us.h" #include "id_us.h"
extern byte signon[]; extern byte signon[];
......
#ifndef __ID_SD_H__ #ifndef __SD_COMM_H__
#define __ID_SD_H__ #define __SD_COMM_H__
#define TickBase 70 // 70Hz per tick - used as a base for timer 0 #define TickBase 70 // 70Hz per tick
typedef enum { typedef enum {
sdm_Off, sdm_Off,
......
/* id_sd.c */
#include "id_heads.h"
#include <AL/al.h>
#include <AL/alc.h>
// Global variables
boolean SoundSourcePresent,
AdLibPresent,
SoundBlasterPresent,SBProPresent,
NeedsDigitized,NeedsMusic,
SoundPositioned;
SDMode SoundMode;
SMMode MusicMode;
SDSMode DigiMode;
word *SoundTable;
word ssPort = 2;
int DigiMap[LASTSOUND];
// Internal variables
static boolean SD_Started;
boolean nextsoundpos;
soundnames SoundNumber,DigiNumber;
word SoundPriority,DigiPriority;
int LeftPosition,RightPosition;
word NumDigi,DigiLeft,DigiPage;
word *DigiList;
word DigiLastStart,DigiLastEnd;
boolean DigiPlaying;
static boolean DigiMissed,DigiLastSegment;
static memptr DigiNextAddr;
static word DigiNextLen;
// SoundBlaster variables
static boolean sbNoCheck,sbNoProCheck;
static byte sbOldIntMask = -1;
static byte *sbNextSegPtr;
static longword sbNextSegLen;
static SampledSound *sbSamples;
// SoundSource variables
boolean ssNoCheck;
boolean ssActive;
word ssControl,ssStatus,ssData;
byte ssOn,ssOff;
byte *ssSample;
longword ssLengthLeft;
// PC Sound variables
volatile byte pcLastSample, *pcSound;
longword pcLengthLeft;
word pcSoundLookup[255];
// AdLib variables
boolean alNoCheck;
byte *alSound;
word alBlock;
longword alLengthLeft;
Instrument alZeroInst;
// Sequencer variables
boolean sqActive;
static word alFXReg;
static ActiveTrack *tracks[sqMaxTracks],
mytracks[sqMaxTracks];
static word sqMode,sqFadeStep;
/* ------------------------------------------------------------------------ */
void *cc;
void SD_StopDigitized(void)
{
}
void SD_Poll(void)
{
}
void SD_SetPosition(int leftpos,int rightpos)
{
}
void SD_PlayDigitized(word which,int leftpos,int rightpos)
{
}
void SD_SetDigiDevice(SDSMode mode)
{
}
// Public routines
///////////////////////////////////////////////////////////////////////////
//
// SD_SetSoundMode() - Sets which sound hardware to use for sound effects
//
///////////////////////////////////////////////////////////////////////////
boolean SD_SetSoundMode(SDMode mode)
{
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_SetMusicMode() - sets the device to use for background music
//
///////////////////////////////////////////////////////////////////////////
boolean SD_SetMusicMode(SMMode mode)
{
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_Startup() - starts up the Sound Mgr
//
///////////////////////////////////////////////////////////////////////////
void SD_Startup(void)
{
if (SD_Started)
return;
cc = alcCreateContext(NULL);
if (cc == NULL)
printf("alcCreateContext failed..\n");
SD_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_Shutdown() - shuts down the Sound Mgr
// Removes sound ISR and turns off whatever sound hardware was active
//
///////////////////////////////////////////////////////////////////////////
void SD_Shutdown(void)
{
if (!SD_Started)
return;
if (cc) {
alcDestroyContext(cc);
cc = NULL;
}
SD_MusicOff();
SD_StopSound();
SD_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_PositionSound() - Sets up a stereo imaging location for the next
// sound to be played. Each channel ranges from 0 to 15.
//
///////////////////////////////////////////////////////////////////////////
void SD_PositionSound(int leftvol,int rightvol)
{
LeftPosition = leftvol;
RightPosition = rightvol;
nextsoundpos = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_PlaySound() - plays the specified sound on the appropriate hardware
//
///////////////////////////////////////////////////////////////////////////
boolean SD_PlaySound(soundnames sound)
{
boolean ispos;
int lp,rp;
lp = LeftPosition;
rp = RightPosition;
LeftPosition = 0;
RightPosition = 0;
ispos = nextsoundpos;
nextsoundpos = false;
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_SoundPlaying() - returns the sound number that's playing, or 0 if
// no sound is playing
//
///////////////////////////////////////////////////////////////////////////
word SD_SoundPlaying(void)
{
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_StopSound() - if a sound is playing, stops it
//
///////////////////////////////////////////////////////////////////////////
void SD_StopSound(void)
{
}
///////////////////////////////////////////////////////////////////////////
//
// SD_WaitSoundDone() - waits until the current sound is done playing
//
///////////////////////////////////////////////////////////////////////////
void SD_WaitSoundDone(void)
{
while (SD_SoundPlaying())
;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicOn() - turns on the sequencer
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOn(void)
{
sqActive = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicOff() - turns off the sequencer and any playing notes
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOff(void)
{
sqActive = false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_StartMusic() - starts playing the music pointed to
//
///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music)
{
SD_MusicOff();
}
///////////////////////////////////////////////////////////////////////////
//
// SD_FadeOutMusic() - starts fading out the music. Call SD_MusicPlaying()
// to see if the fadeout is complete
//
///////////////////////////////////////////////////////////////////////////
void SD_FadeOutMusic(void)
{
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicPlaying() - returns true if music is currently playing, false if
// not
//
///////////////////////////////////////////////////////////////////////////
boolean SD_MusicPlaying(void)
{
return false;
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
/* SDM = 2 */ /* SDM = 2 */
/* SOD = 3 */ /* SOD = 3 */
#ifndef WMODE #ifndef WMODE
#define WMODE 3 #define WMODE 1
#endif #endif
#if WMODE == 0 #if WMODE == 0
......
...@@ -508,6 +508,8 @@ int XKeysymToScancode(unsigned int keysym) ...@@ -508,6 +508,8 @@ int XKeysymToScancode(unsigned int keysym)
return sc_Y; return sc_Y;
case XK_n: case XK_n:
return sc_N; return sc_N;
case XK_Pause:
return 0xE1;
default: default:
printf("unknown: %s\n", XKeysymToString(keysym)); printf("unknown: %s\n", XKeysymToString(keysym));
return sc_None; return sc_None;
......
...@@ -358,7 +358,7 @@ void keyboard_handler(int code, int press) ...@@ -358,7 +358,7 @@ void keyboard_handler(int code, int press)
if (k == 0xe0) // Special key prefix if (k == 0xe0) // Special key prefix
special = true; special = true;
else if (k == 0xe1) // Handle Pause key else if ( (k == SCANCODE_BREAK) || (k == SCANCODE_BREAK_ALTERNATIVE) ) // Handle Pause key
Paused = true; Paused = true;
else else
{ {
......
...@@ -759,6 +759,8 @@ int XKeysymToScancode(unsigned int keysym) ...@@ -759,6 +759,8 @@ int XKeysymToScancode(unsigned int keysym)
return sc_Y; return sc_Y;
case XK_n: case XK_n:
return sc_N; return sc_N;
case XK_Pause:
return 0xE1;
default: default:
printf("unknown: %s\n", XKeysymToString(keysym)); printf("unknown: %s\n", XKeysymToString(keysym));
return sc_None; return sc_None;
......
...@@ -24,19 +24,7 @@ boolean spearflag; ...@@ -24,19 +24,7 @@ boolean spearflag;
// //
int ElevatorBackTo[]={1,1,7,3,5,3}; int ElevatorBackTo[]={1,1,7,3,5,3};
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
//=========================================================================== //===========================================================================
//===========================================================================
/* /*
========================== ==========================
......
...@@ -694,12 +694,11 @@ void CheckKeys (void) ...@@ -694,12 +694,11 @@ void CheckKeys (void)
DrawAllPlayBorder (); DrawAllPlayBorder ();
} }
//
// pause key weirdness can't be checked as a scan code
//
if (Paused) if (Paused)
{ {
LatchDrawPic (20-4,80-2*8,PAUSEDPIC); VWB_DrawPic(128, 64, PAUSEDPIC);
VW_UpdateScreen();
SD_MusicOff(); SD_MusicOff();
IN_Ack(); IN_Ack();
IN_ClearKeysDown (); IN_ClearKeysDown ();
......
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