Commit ae6c51a9 authored by Steven Fuller's avatar Steven Fuller

Made the Jukebox work.

More cleanups.
parent a6936485
CC = gcc CC = gcc
#CC = g++
#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
...@@ -9,7 +8,7 @@ CFLAGS = -g -Wall ...@@ -9,7 +8,7 @@ CFLAGS = -g -Wall
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_null.o wl_debug.o gfxsave.o sd_oss.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
......
//////////////////////////////////////
//
// Graphics .H file for .SDM
// IGRAB-ed on Mon Sep 21 14:20:19 1992
//
//////////////////////////////////////
typedef enum { typedef enum {
// Lump Start // Lump Start
C_BACKDROPPIC=3, C_BACKDROPPIC=3,
...@@ -190,16 +183,8 @@ typedef enum { ...@@ -190,16 +183,8 @@ typedef enum {
// //
#define NUMCHUNKS 133 #define NUMCHUNKS 133
#define NUMFONT 2 #define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 125 #define NUMPICS 125
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35 #define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 4 #define NUMEXTERNS 4
// //
// File offsets for data items // File offsets for data items
...@@ -207,18 +192,6 @@ typedef enum { ...@@ -207,18 +192,6 @@ typedef enum {
#define STRUCTPIC 0 #define STRUCTPIC 0
#define STARTFONT 1 #define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3 #define STARTPICS 3
#define STARTPICM 128
#define STARTSPRITES 128
#define STARTTILE8 128 #define STARTTILE8 128
#define STARTTILE8M 129
#define STARTTILE16 129
#define STARTTILE16M 129
#define STARTTILE32 129
#define STARTTILE32M 129
#define STARTEXTERNS 129 #define STARTEXTERNS 129
//
// Thank you for using IGRAB!
//
//////////////////////////////////////
//
// Graphics .H file for .SOD
// IGRAB-ed on Thu Oct 08 20:38:29 1992
//
//////////////////////////////////////
typedef enum { typedef enum {
// Lump Start // Lump Start
C_BACKDROPPIC=3, C_BACKDROPPIC=3,
...@@ -246,16 +239,8 @@ typedef enum { ...@@ -246,16 +239,8 @@ typedef enum {
// //
#define NUMCHUNKS 169 #define NUMCHUNKS 169
#define NUMFONT 2 #define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 147 #define NUMPICS 147
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35 #define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 18 #define NUMEXTERNS 18
// //
// File offsets for data items // File offsets for data items
...@@ -263,18 +248,6 @@ typedef enum { ...@@ -263,18 +248,6 @@ typedef enum {
#define STRUCTPIC 0 #define STRUCTPIC 0
#define STARTFONT 1 #define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3 #define STARTPICS 3
#define STARTPICM 150
#define STARTSPRITES 150
#define STARTTILE8 150 #define STARTTILE8 150
#define STARTTILE8M 151
#define STARTTILE16 151
#define STARTTILE16M 151
#define STARTTILE32 151
#define STARTTILE32M 151
#define STARTEXTERNS 151 #define STARTEXTERNS 151
//
// Thank you for using IGRAB!
//
//////////////////////////////////////
//
// Graphics .H file for .WL1
// IGRAB-ed on Sun May 03 01:19:32 1992
//
//////////////////////////////////////
typedef enum { typedef enum {
// Lump Start // Lump Start
H_BJPIC=3, H_BJPIC=3,
...@@ -187,16 +180,8 @@ typedef enum { ...@@ -187,16 +180,8 @@ typedef enum {
// //
#define NUMCHUNKS 156 #define NUMCHUNKS 156
#define NUMFONT 2 #define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 144 #define NUMPICS 144
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35 #define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 8 #define NUMEXTERNS 8
// //
// File offsets for data items // File offsets for data items
...@@ -204,18 +189,6 @@ typedef enum { ...@@ -204,18 +189,6 @@ typedef enum {
#define STRUCTPIC 0 #define STRUCTPIC 0
#define STARTFONT 1 #define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3 #define STARTPICS 3
#define STARTPICM 147
#define STARTSPRITES 147
#define STARTTILE8 147 #define STARTTILE8 147
#define STARTTILE8M 148
#define STARTTILE16 148
#define STARTTILE16M 148
#define STARTTILE32 148
#define STARTTILE32M 148
#define STARTEXTERNS 148 #define STARTEXTERNS 148
//
// Thank you for using IGRAB!
//
//////////////////////////////////////
//
// Graphics .H file for .WL6
// IGRAB-ed on Wed Apr 13 06:58:44 1994
//
//////////////////////////////////////
typedef enum { typedef enum {
// Lump Start // Lump Start
H_BJPIC=3, H_BJPIC=3,
...@@ -182,16 +175,8 @@ typedef enum { ...@@ -182,16 +175,8 @@ typedef enum {
// //
#define NUMCHUNKS 149 #define NUMCHUNKS 149
#define NUMFONT 2 #define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 132 #define NUMPICS 132
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35 #define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 13 #define NUMEXTERNS 13
// //
// File offsets for data items // File offsets for data items
...@@ -199,18 +184,6 @@ typedef enum { ...@@ -199,18 +184,6 @@ typedef enum {
#define STRUCTPIC 0 #define STRUCTPIC 0
#define STARTFONT 1 #define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3 #define STARTPICS 3
#define STARTPICM 135
#define STARTSPRITES 135
#define STARTTILE8 135 #define STARTTILE8 135
#define STARTTILE8M 136
#define STARTTILE16 136
#define STARTTILE16M 136
#define STARTTILE32 136
#define STARTTILE32M 136
#define STARTEXTERNS 136 #define STARTEXTERNS 136
//
// Thank you for using IGRAB!
//
...@@ -823,7 +823,7 @@ static void CAL_ExpandGrChunk(int chunk, byte *source) ...@@ -823,7 +823,7 @@ static void CAL_ExpandGrChunk(int chunk, byte *source)
width = 8; width = 8;
height = 8; height = 8;
tilecount = NUMTILE8; tilecount = NUMTILE8;
} else if (chunk >= STARTPICS && chunk < STARTSPRITES) { } else if (chunk >= STARTPICS && chunk < STARTTILE8) {
width = pictable[chunk - STARTPICS].width; width = pictable[chunk - STARTPICS].width;
height = pictable[chunk - STARTPICS].height; height = pictable[chunk - STARTPICS].height;
expanded = *((long *)source); expanded = *((long *)source);
......
...@@ -75,7 +75,7 @@ void VWB_DrawPic(int x, int y, int chunknum) ...@@ -75,7 +75,7 @@ void VWB_DrawPic(int x, int y, int chunknum)
width = pictable[picnum].width; width = pictable[picnum].width;
height = pictable[picnum].height; height = pictable[picnum].height;
VL_MemToScreen (grsegs[chunknum],width,height,x,y); VL_MemToScreen(grsegs[chunknum],width,height,x,y);
} }
/* /*
...@@ -103,10 +103,9 @@ void LoadLatchMem() ...@@ -103,10 +103,9 @@ void LoadLatchMem()
{ {
int i; int i;
CA_CacheGrChunk (STARTTILE8); CA_CacheGrChunk(STARTTILE8);
for (i = LATCHPICS_LUMP_START; i <= LATCHPICS_LUMP_END; i++) { for (i = LATCHPICS_LUMP_START; i <= LATCHPICS_LUMP_END; i++) {
/* TODO: this just caches them for eternity */
CA_CacheGrChunk(i); CA_CacheGrChunk(i);
} }
......
...@@ -39,31 +39,28 @@ typedef struct { ...@@ -39,31 +39,28 @@ typedef struct {
} PACKED MusicGroup; } PACKED MusicGroup;
// Global variables // Global variables
extern boolean AdLibPresent, extern boolean AdLibPresent, SoundSourcePresent, SoundBlasterPresent;
SoundSourcePresent,
SoundBlasterPresent,
SoundPositioned;
extern SDMode SoundMode; extern SDMode SoundMode;
extern SDSMode DigiMode; extern SDSMode DigiMode;
extern SMMode MusicMode; extern SMMode MusicMode;
extern boolean DigiPlaying;
extern int DigiMap[]; extern int DigiMap[];
// Function prototypes // Function prototypes
extern void SD_Startup(void), SD_Shutdown(void); extern void SD_Startup(), SD_Shutdown();
extern void SD_PlaySound(soundnames sound); extern void SD_PlaySound(soundnames sound);
extern void SD_StopSound(void), extern void SD_StopSound(),
SD_WaitSoundDone(void), SD_WaitSoundDone(),
SD_StartMusic(MusicGroup *music), SD_StartMusic(MusicGroup *music),
SD_MusicOn(void), SD_MusicOn(),
SD_MusicOff(void), SD_MusicOff(),
SD_FadeOutMusic(void); SD_FadeOutMusic();
extern boolean SD_MusicPlaying(void), extern boolean SD_MusicPlaying(),
SD_SetSoundMode(SDMode mode), SD_SetSoundMode(SDMode mode),
SD_SetMusicMode(SMMode mode); SD_SetMusicMode(SMMode mode);
extern word SD_SoundPlaying(void); extern word SD_SoundPlaying();
extern void SD_SetDigiDevice(SDSMode); extern void SD_SetDigiDevice(SDSMode);
extern void SD_Poll(); extern void SD_Poll();
......
...@@ -2,26 +2,22 @@ ...@@ -2,26 +2,22 @@
#include "id_heads.h" #include "id_heads.h"
boolean SoundSourcePresent, AdLibPresent, SoundBlasterPresent, boolean SoundSourcePresent, AdLibPresent, SoundBlasterPresent;
SoundPositioned;
static boolean SoundPositioned;
SDMode SoundMode, MusicMode; SDMode SoundMode, MusicMode;
SDSMode DigiMode; SDSMode DigiMode;
int DigiMap[LASTSOUND]; int DigiMap[LASTSOUND];
static boolean SD_Started; static boolean SD_Started;
boolean nextsoundpos; static boolean nextsoundpos;
int LeftPosition, RightPosition;
word NumDigi; static int LeftPosition, RightPosition;
word *DigiList;
boolean DigiPlaying;
boolean sqActive; static boolean sqActive;
void SD_StopDigitized() void SD_StopDigitized()
...@@ -44,7 +40,6 @@ void SD_SetDigiDevice(SDSMode mode) ...@@ -44,7 +40,6 @@ void SD_SetDigiDevice(SDSMode mode)
{ {
} }
// Public routines // Public routines
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -73,7 +68,7 @@ boolean SD_SetMusicMode(SMMode mode) ...@@ -73,7 +68,7 @@ boolean SD_SetMusicMode(SMMode mode)
// Detects all additional sound hardware and installs my ISR // Detects all additional sound hardware and installs my ISR
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_Startup(void) void SD_Startup()
{ {
if (SD_Started) if (SD_Started)
return; return;
...@@ -87,7 +82,7 @@ void SD_Startup(void) ...@@ -87,7 +82,7 @@ void SD_Startup(void)
// Removes sound ISR and turns off whatever sound hardware was active // Removes sound ISR and turns off whatever sound hardware was active
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_Shutdown(void) void SD_Shutdown()
{ {
if (!SD_Started) if (!SD_Started)
return; return;
...@@ -98,19 +93,6 @@ void SD_Shutdown(void) ...@@ -98,19 +93,6 @@ void SD_Shutdown(void)
SD_Started = false; 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 // SD_PlaySound() - plays the specified sound on the appropriate hardware
...@@ -137,7 +119,7 @@ void SD_PlaySound(soundnames sound) ...@@ -137,7 +119,7 @@ void SD_PlaySound(soundnames sound)
// no sound is playing // no sound is playing
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
word SD_SoundPlaying(void) word SD_SoundPlaying()
{ {
return false; return false;
} }
...@@ -147,7 +129,7 @@ word SD_SoundPlaying(void) ...@@ -147,7 +129,7 @@ word SD_SoundPlaying(void)
// SD_StopSound() - if a sound is playing, stops it // SD_StopSound() - if a sound is playing, stops it
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_StopSound(void) void SD_StopSound()
{ {
} }
...@@ -156,8 +138,9 @@ void SD_StopSound(void) ...@@ -156,8 +138,9 @@ void SD_StopSound(void)
// SD_WaitSoundDone() - waits until the current sound is done playing // SD_WaitSoundDone() - waits until the current sound is done playing
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_WaitSoundDone(void) void SD_WaitSoundDone()
{ {
/* TODO: should also "work" when sound is disabled... */
while (SD_SoundPlaying()) while (SD_SoundPlaying())
; ;
} }
...@@ -167,7 +150,7 @@ void SD_WaitSoundDone(void) ...@@ -167,7 +150,7 @@ void SD_WaitSoundDone(void)
// SD_MusicOn() - turns on the sequencer // SD_MusicOn() - turns on the sequencer
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_MusicOn(void) void SD_MusicOn()
{ {
sqActive = true; sqActive = true;
} }
...@@ -177,7 +160,7 @@ void SD_MusicOn(void) ...@@ -177,7 +160,7 @@ void SD_MusicOn(void)
// SD_MusicOff() - turns off the sequencer and any playing notes // SD_MusicOff() - turns off the sequencer and any playing notes
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_MusicOff(void) void SD_MusicOff()
{ {
sqActive = false; sqActive = false;
} }
...@@ -198,7 +181,7 @@ void SD_StartMusic(MusicGroup *music) ...@@ -198,7 +181,7 @@ void SD_StartMusic(MusicGroup *music)
// to see if the fadeout is complete // to see if the fadeout is complete
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_FadeOutMusic(void) void SD_FadeOutMusic()
{ {
} }
...@@ -208,7 +191,7 @@ void SD_FadeOutMusic(void) ...@@ -208,7 +191,7 @@ void SD_FadeOutMusic(void)
// not // not
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
boolean SD_MusicPlaying(void) boolean SD_MusicPlaying()
{ {
return false; return false;
} }
...@@ -228,10 +211,11 @@ boolean SD_MusicPlaying(void) ...@@ -228,10 +211,11 @@ boolean SD_MusicPlaying(void)
========================== ==========================
*/ */
fixed globalsoundx,globalsoundy; static fixed globalsoundx, globalsoundy;
int leftchannel,rightchannel; static int leftchannel, rightchannel;
#define ATABLEMAX 15 #define ATABLEMAX 15
byte righttable[ATABLEMAX][ATABLEMAX * 2] = { static byte righttable[ATABLEMAX][ATABLEMAX * 2] = {
{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 0, 0, 0, 0, 0, 1, 3, 5, 8, 8, 8, 8, 8, 8, 8, 8}, { 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 0, 0, 0, 0, 0, 1, 3, 5, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 6, 4, 0, 0, 0, 0, 0, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8}, { 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 6, 4, 0, 0, 0, 0, 0, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8,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 4, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 2, 1, 0, 0, 0, 1, 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8}, { 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 2, 1, 0, 0, 0, 1, 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},
...@@ -266,12 +250,12 @@ byte lefttable[ATABLEMAX][ATABLEMAX * 2] = { ...@@ -266,12 +250,12 @@ byte lefttable[ATABLEMAX][ATABLEMAX * 2] = {
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
}; };
void SetSoundLoc(fixed gx, fixed gy) static void SetSoundLoc(fixed gx, fixed gy)
{ {
#if 0 // fixed xt, yt;
fixed xt,yt; int x, y;
int x,y;
#if 0
// //
// translate point to view centered coordinates // translate point to view centered coordinates
// //
...@@ -291,6 +275,7 @@ void SetSoundLoc(fixed gx, fixed gy) ...@@ -291,6 +275,7 @@ void SetSoundLoc(fixed gx, fixed gy)
xt = FixedByFrac(gx,viewsin); xt = FixedByFrac(gx,viewsin);
yt = FixedByFrac(gy,viewcos); yt = FixedByFrac(gy,viewcos);
y = (yt + xt) >> TILESHIFT; y = (yt + xt) >> TILESHIFT;
#endif
if (y >= ATABLEMAX) if (y >= ATABLEMAX)
y = ATABLEMAX - 1; y = ATABLEMAX - 1;
...@@ -300,9 +285,22 @@ void SetSoundLoc(fixed gx, fixed gy) ...@@ -300,9 +285,22 @@ void SetSoundLoc(fixed gx, fixed gy)
x = -x; x = -x;
if (x >= ATABLEMAX) if (x >= ATABLEMAX)
x = ATABLEMAX - 1; x = ATABLEMAX - 1;
leftchannel = lefttable[x][y + ATABLEMAX]; leftchannel = lefttable[x][y + ATABLEMAX];
rightchannel = righttable[x][y + ATABLEMAX]; rightchannel = righttable[x][y + ATABLEMAX];
#endif }
///////////////////////////////////////////////////////////////////////////
//
// SD_PositionSound() - Sets up a stereo imaging location for the next
// sound to be played. Each channel ranges from 0 to 15.
//
///////////////////////////////////////////////////////////////////////////
static void SD_PositionSound(int leftvol, int rightvol)
{
LeftPosition = leftvol;
RightPosition = rightvol;
nextsoundpos = true;
} }
/* /*
......
/* id_sd.c */
#include "id_heads.h"
boolean SoundSourcePresent, AdLibPresent, SoundBlasterPresent;
static boolean SoundPositioned;
SDMode SoundMode, MusicMode;
SDSMode DigiMode;
int DigiMap[LASTSOUND];
static boolean SD_Started;
static boolean nextsoundpos;
static int LeftPosition, RightPosition;
static boolean sqActive;
void SD_StopDigitized()
{
}
void SD_Poll()
{
}
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
// Detects all additional sound hardware and installs my ISR
//
///////////////////////////////////////////////////////////////////////////
void SD_Startup()
{
if (SD_Started)
return;
SD_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_Shutdown() - shuts down the Sound Mgr
// Removes sound ISR and turns off whatever sound hardware was active
//
///////////////////////////////////////////////////////////////////////////
void SD_Shutdown()
{
if (!SD_Started)
return;
SD_MusicOff();
SD_StopSound();
SD_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_PlaySound() - plays the specified sound on the appropriate hardware
//
///////////////////////////////////////////////////////////////////////////
void SD_PlaySound(soundnames sound)
{
boolean ispos;
int lp,rp;
lp = LeftPosition;
rp = RightPosition;
LeftPosition = 0;
RightPosition = 0;
ispos = nextsoundpos;
nextsoundpos = false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_SoundPlaying() - returns the sound number that's playing, or 0 if
// no sound is playing
//
///////////////////////////////////////////////////////////////////////////
word SD_SoundPlaying()
{
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_StopSound() - if a sound is playing, stops it
//
///////////////////////////////////////////////////////////////////////////
void SD_StopSound()
{
}
///////////////////////////////////////////////////////////////////////////
//
// SD_WaitSoundDone() - waits until the current sound is done playing
//
///////////////////////////////////////////////////////////////////////////
void SD_WaitSoundDone()
{
/* TODO: should also "work" when sound is disabled... */
while (SD_SoundPlaying())
;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicOn() - turns on the sequencer
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOn()
{
sqActive = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicOff() - turns off the sequencer and any playing notes
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOff()
{
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()
{
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicPlaying() - returns true if music is currently playing, false if
// not
//
///////////////////////////////////////////////////////////////////////////
boolean SD_MusicPlaying()
{
return false;
}
//===========================================================================
/*
==========================
=
= SetSoundLoc - Given the location of an object (in terms of global
= coordinates, held in globalsoundx and globalsoundy), munges the values
= for an approximate distance from the left and right ear, and puts
= those values into leftchannel and rightchannel.
=
= JAB
=
==========================
*/
static fixed globalsoundx, globalsoundy;
static int leftchannel, rightchannel;
#define ATABLEMAX 15
static byte righttable[ATABLEMAX][ATABLEMAX * 2] = {
{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 0, 0, 0, 0, 0, 1, 3, 5, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 6, 4, 0, 0, 0, 0, 0, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 4, 1, 0, 0, 0, 1, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 6, 5, 4, 2, 1, 0, 1, 2, 3, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 5, 4, 3, 2, 2, 3, 3, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 4, 4, 4, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8,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// calculate newx
//
xt = FixedByFrac(gx,viewcos);
yt = FixedByFrac(gy,viewsin);
x = (xt - yt) >> TILESHIFT;
//
// calculate newy
//
xt = FixedByFrac(gx,viewsin);
yt = FixedByFrac(gy,viewcos);
y = (yt + xt) >> TILESHIFT;
#endif
if (y >= ATABLEMAX)
y = ATABLEMAX - 1;
else if (y <= -ATABLEMAX)
y = -ATABLEMAX;
if (x < 0)
x = -x;
if (x >= ATABLEMAX)
x = ATABLEMAX - 1;
leftchannel = lefttable[x][y + ATABLEMAX];
rightchannel = righttable[x][y + ATABLEMAX];
}
///////////////////////////////////////////////////////////////////////////
//
// SD_PositionSound() - Sets up a stereo imaging location for the next
// sound to be played. Each channel ranges from 0 to 15.
//
///////////////////////////////////////////////////////////////////////////
static void SD_PositionSound(int leftvol, int rightvol)
{
LeftPosition = leftvol;
RightPosition = rightvol;
nextsoundpos = true;
}
/*
==========================
=
= SetSoundLocGlobal - Sets up globalsoundx & globalsoundy and then calls
= UpdateSoundLoc() to transform that into relative channel volumes. Those
= values are then passed to the Sound Manager so that they'll be used for
= the next sound played (if possible).
=
==========================
*/
void PlaySoundLocGlobal(word s,fixed gx,fixed gy)
{
SetSoundLoc(gx,gy);
SD_PositionSound(leftchannel,rightchannel);
SD_PlaySound(s);
globalsoundx = gx;
globalsoundy = gy;
}
void UpdateSoundLoc(fixed x, fixed y, int angle)
{
if (SoundPositioned)
{
SetSoundLoc(globalsoundx,globalsoundy);
SD_SetPosition(leftchannel,rightchannel);
}
}
...@@ -578,7 +578,7 @@ void IN_Startup(void) ...@@ -578,7 +578,7 @@ void IN_Startup(void)
// IN_Shutdown() - Shuts down the Input Mgr // IN_Shutdown() - Shuts down the Input Mgr
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void IN_Shutdown(void) void IN_Shutdown()
{ {
word i; word i;
...@@ -598,7 +598,7 @@ void IN_Shutdown(void) ...@@ -598,7 +598,7 @@ void IN_Shutdown(void)
// IN_ClearKeysDown() - Clears the keyboard array // IN_ClearKeysDown() - Clears the keyboard array
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void IN_ClearKeysDown(void) void IN_ClearKeysDown()
{ {
LastScan = sc_None; LastScan = sc_None;
LastASCII = key_None; LastASCII = key_None;
...@@ -701,7 +701,7 @@ IN_CheckAck(); ...@@ -701,7 +701,7 @@ IN_CheckAck();
boolean btnstate[8]; boolean btnstate[8];
void IN_StartAck(void) void IN_StartAck()
{ {
unsigned i,buttons; unsigned i,buttons;
...@@ -720,7 +720,7 @@ void IN_StartAck(void) ...@@ -720,7 +720,7 @@ void IN_StartAck(void)
btnstate[i] = true; btnstate[i] = true;
} }
boolean IN_CheckAck (void) boolean IN_CheckAck()
{ {
unsigned i,buttons; unsigned i,buttons;
...@@ -729,7 +729,7 @@ while (keyboard_update()) ; /* get all events */ ...@@ -729,7 +729,7 @@ while (keyboard_update()) ; /* get all events */
if (LastScan) if (LastScan)
return true; return true;
buttons = IN_JoyButtons () << 4; buttons = IN_JoyButtons() << 4;
if (MousePresent) if (MousePresent)
buttons |= IN_MouseButtons (); buttons |= IN_MouseButtons ();
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
================== ==================
*/ */
void CountObjects (void) void CountObjects()
{ {
int i,total,count,active,inactive,doors; int i, total, count, active, inactive, doors;
objtype *obj; objtype *obj;
CenterWindow (16,7); CenterWindow (16,7);
...@@ -48,11 +48,9 @@ void CountObjects (void) ...@@ -48,11 +48,9 @@ void CountObjects (void)
US_PrintUnsigned (active); US_PrintUnsigned (active);
VW_UpdateScreen(); VW_UpdateScreen();
IN_Ack (); IN_Ack();
} }
//===========================================================================
/* /*
================ ================
= =
...@@ -82,10 +80,6 @@ void PicturePause (void) ...@@ -82,10 +80,6 @@ void PicturePause (void)
Quit(NULL); Quit(NULL);
} }
//===========================================================================
/* /*
================ ================
= =
...@@ -96,174 +90,8 @@ void PicturePause (void) ...@@ -96,174 +90,8 @@ void PicturePause (void)
void ShapeTest() void ShapeTest()
{ {
#if 0 /* TODO: this code want to access the raycasting renderer directly */
extern word NumDigi;
extern word *DigiList;
static char buf[10];
boolean done;
ScanCode scan;
int i,j,k,x;
longword l;
memptr addr;
PageListStruct *page;
CenterWindow(20,16);
VW_UpdateScreen();
for (i = 0,done = false;!done;)
{
US_ClearWindow();
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: ");
US_Print("No");
US_Print("\n Main: ");
US_Print("No");
US_Print("\n Last hit: ");
US_PrintUnsigned(page->lastHit);
US_Print("\n Address: ");
addr = PM_GetPageAddress(i);
sprintf(buf,"%p", addr); /* TODO: might wanna check */
US_Print(buf);
if (addr)
{
if (i < PMSpriteStart)
{
//
// draw the wall
//
postx = 128;
for (x=0;x<64;x++,postx++)
{
wallheight[postx] = 256;
ScalePost((byte *)addr, x);
}
}
else if (i < PMSoundStart)
{
//
// draw the sprite
//
SimpleScaleShape (160, i-PMSpriteStart, 64);
}
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)
{
US_Print("\n Sound #");
US_PrintUnsigned(j);
US_Print("\n Segment #");
US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);
}
for (j = 0;j < page->length;j += 32)
{
byte v = dp[j];
int v2 = (unsigned)v;
v2 -= 128;
v2 /= 4;
if (v2 < 0)
VW_Vlin(WindowY + WindowH - 32 + v2,
WindowY + WindowH - 32,
WindowX + 8 + (j / 32),BLACK);
else
VW_Vlin(WindowY + WindowH - 32,
WindowY + WindowH - 32 + v2,
WindowX + 8 + (j / 32),BLACK);
}
}
}
VW_UpdateScreen();
while (!(scan = LastScan)) {
SD_Poll();
IN_CheckAck();
}
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:
/* TODO: this would play the current digital sound */
break;
case sc_Escape:
done = true;
break;
case sc_Enter:
PM_GetPage(i);
break;
}
}
#endif
} }
//===========================================================================
/* /*
================ ================
= =
......
...@@ -700,8 +700,6 @@ extern int viewheight; ...@@ -700,8 +700,6 @@ extern int viewheight;
extern int centerx; extern int centerx;
extern int shootdelta; extern int shootdelta;
extern int dirangle[9];
extern boolean startgame,loadedgame; extern boolean startgame,loadedgame;
extern int mouseadjustment; extern int mouseadjustment;
extern unsigned xoffset, yoffset; extern unsigned xoffset, yoffset;
......
...@@ -368,6 +368,8 @@ static void ClearScreen() ...@@ -368,6 +368,8 @@ static void ClearScreen()
===================== =====================
*/ */
static int dirangle[9] = {0,ANGLES/8,2*ANGLES/8,3*ANGLES/8,4*ANGLES/8, 5*ANGLES/8,6*ANGLES/8,7*ANGLES/8,ANGLES};
static int CalcRotate(objtype *ob) static int CalcRotate(objtype *ob)
{ {
int angle,viewangle; int angle,viewangle;
......
...@@ -1111,12 +1111,13 @@ startplayloop: ...@@ -1111,12 +1111,13 @@ startplayloop:
{ {
SD_StopSound(); SD_StopSound();
SD_PlaySound(GETSPEARSND); SD_PlaySound(GETSPEARSND);
if (DigiMode != sds_Off) if (DigiMode != sds_Off)
{ {
long lasttimecount = get_TimeCount(); long lasttimecount = get_TimeCount();
while(get_TimeCount() < lasttimecount+150) while(get_TimeCount() < (lasttimecount+150))
//while(DigiPlaying!=false) //while(SD_SoundPlaying()!=false)
SD_Poll(); SD_Poll();
} }
else else
......
This diff is collapsed.
...@@ -2631,7 +2631,7 @@ void DrawOutline(int x,int y,int w,int h,int color1,int color2) ...@@ -2631,7 +2631,7 @@ void DrawOutline(int x,int y,int w,int h,int color1,int color2)
// Setup Control Panel stuff - graphics, etc. // Setup Control Panel stuff - graphics, etc.
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void SetupControlPanel(void) void SetupControlPanel()
{ {
#ifdef DOSISM /* DOS VERSION */ #ifdef DOSISM /* DOS VERSION */
#ifdef HAVE_FFBLK #ifdef HAVE_FFBLK
...@@ -2770,7 +2770,7 @@ void SetupControlPanel(void) ...@@ -2770,7 +2770,7 @@ void SetupControlPanel(void)
// Clean up all the Control Panel stuff // Clean up all the Control Panel stuff
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CleanupControlPanel(void) void CleanupControlPanel()
{ {
#ifndef SPEAR #ifndef SPEAR
UnCacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END); UnCacheLump(CONTROLS_LUMP_START,CONTROLS_LUMP_END);
......
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