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
......
...@@ -35,10 +35,9 @@ ...@@ -35,10 +35,9 @@
*/ */
char str[80], str2[20]; char str[80], str2[20];
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};
// //
// proejection variables // projection variables
// //
fixed focallength; fixed focallength;
int viewwidth; int viewwidth;
...@@ -51,7 +50,7 @@ long heightnumerator; ...@@ -51,7 +50,7 @@ long heightnumerator;
boolean startgame,loadedgame; boolean startgame,loadedgame;
int mouseadjustment; int mouseadjustment;
/* These are refuges from wl_draw.c */ /* These are refugees from wl_draw.c */
long frameon; long frameon;
long lasttimecount; long lasttimecount;
fixed viewsin, viewcos; fixed viewsin, viewcos;
...@@ -75,7 +74,7 @@ char **_argv; ...@@ -75,7 +74,7 @@ char **_argv;
= FixedByFrac = FixedByFrac
= =
= multiply a 16/16 bit, 2's complement fixed point number by a 16 bit = multiply a 16/16 bit, 2's complement fixed point number by a 16 bit
= fraction, passed as a signed magnitude 32 bit number = fraction
= =
======================== ========================
*/ */
...@@ -698,29 +697,28 @@ void SignonScreen() ...@@ -698,29 +697,28 @@ void SignonScreen()
========================== ==========================
*/ */
void FinishSignon (void) void FinishSignon()
{ {
#ifndef SPEAR #ifndef SPEAR
VW_Bar (0,189,300,11, introscn[0]); VW_Bar(0, 189, 300, 11, introscn[0]);
WindowX = 0; WindowX = 0;
WindowW = 320; WindowW = 320;
PrintY = 190; PrintY = 190;
SETFONTCOLOR(14,4); SETFONTCOLOR(14,4);
US_CPrint ("Press a key"); US_CPrint("Press a key");
VW_UpdateScreen(); VW_UpdateScreen();
if (!NoWait) if (!NoWait)
IN_Ack (); IN_Ack ();
VW_Bar (0,189,300,11, introscn[0]); VW_Bar(0, 189, 300, 11, introscn[0]);
PrintY = 190; PrintY = 190;
SETFONTCOLOR(10,4); SETFONTCOLOR(10,4);
US_CPrint ("Working..."); US_CPrint("Working...");
VW_UpdateScreen(); VW_UpdateScreen();
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
...@@ -770,240 +768,228 @@ int MS_CheckParm(char *check) ...@@ -770,240 +768,228 @@ int MS_CheckParm(char *check)
===================== =====================
*/ */
static int wolfdigimap[] = static int wolfdigimap[] =
{ {
// These first sounds are in the upload version // These first sounds are in the upload version
#ifndef SPEAR #ifndef SPEAR
HALTSND, 0, HALTSND, 0,
DOGBARKSND, 1, DOGBARKSND, 1,
CLOSEDOORSND, 2, CLOSEDOORSND, 2,
OPENDOORSND, 3, OPENDOORSND, 3,
ATKMACHINEGUNSND, 4, ATKMACHINEGUNSND, 4,
ATKPISTOLSND, 5, ATKPISTOLSND, 5,
ATKGATLINGSND, 6, ATKGATLINGSND, 6,
SCHUTZADSND, 7, SCHUTZADSND, 7,
GUTENTAGSND, 8, GUTENTAGSND, 8,
MUTTISND, 9, MUTTISND, 9,
BOSSFIRESND, 10, BOSSFIRESND, 10,
SSFIRESND, 11, SSFIRESND, 11,
DEATHSCREAM1SND, 12, DEATHSCREAM1SND, 12,
DEATHSCREAM2SND, 13, DEATHSCREAM2SND, 13,
DEATHSCREAM3SND, 13, DEATHSCREAM3SND, 13,
TAKEDAMAGESND, 14, TAKEDAMAGESND, 14,
PUSHWALLSND, 15, PUSHWALLSND, 15,
LEBENSND, 20,
LEBENSND, 20, NAZIFIRESND, 21,
NAZIFIRESND, 21, SLURPIESND, 22,
SLURPIESND, 22, YEAHSND, 32,
YEAHSND, 32,
#ifndef UPLOAD #ifndef UPLOAD
// These are in all other episodes // These are in all other episodes
DOGDEATHSND, 16, DOGDEATHSND, 16,
AHHHGSND, 17, AHHHGSND, 17,
DIESND, 18, DIESND, 18,
EVASND, 19, EVASND, 19,
TOT_HUNDSND, 23,
TOT_HUNDSND, 23, MEINGOTTSND, 24,
MEINGOTTSND, 24, SCHABBSHASND, 25,
SCHABBSHASND, 25, HITLERHASND, 26,
HITLERHASND, 26, SPIONSND, 27,
SPIONSND, 27, NEINSOVASSND, 28,
NEINSOVASSND, 28, DOGATTACKSND, 29,
DOGATTACKSND, 29, LEVELDONESND, 30,
LEVELDONESND, 30, MECHSTEPSND, 31,
MECHSTEPSND, 31,
SCHEISTSND, 33,
SCHEISTSND, 33, DEATHSCREAM4SND, 34, // AIIEEE
DEATHSCREAM4SND, 34, // AIIEEE DEATHSCREAM5SND, 35, // DEE-DEE
DEATHSCREAM5SND, 35, // DEE-DEE DONNERSND, 36, // EPISODE 4 BOSS DIE
DONNERSND, 36, // EPISODE 4 BOSS DIE EINESND, 37, // EPISODE 4 BOSS SIGHTING
EINESND, 37, // EPISODE 4 BOSS SIGHTING ERLAUBENSND, 38, // EPISODE 6 BOSS SIGHTING
ERLAUBENSND, 38, // EPISODE 6 BOSS SIGHTING DEATHSCREAM6SND, 39, // FART
DEATHSCREAM6SND, 39, // FART DEATHSCREAM7SND, 40, // GASP
DEATHSCREAM7SND, 40, // GASP DEATHSCREAM8SND, 41, // GUH-BOY!
DEATHSCREAM8SND, 41, // GUH-BOY! DEATHSCREAM9SND, 42, // AH GEEZ!
DEATHSCREAM9SND, 42, // AH GEEZ! KEINSND, 43, // EPISODE 5 BOSS SIGHTING
KEINSND, 43, // EPISODE 5 BOSS SIGHTING MEINSND, 44, // EPISODE 6 BOSS DIE
MEINSND, 44, // EPISODE 6 BOSS DIE ROSESND, 45, // EPISODE 5 BOSS DIE
ROSESND, 45, // EPISODE 5 BOSS DIE
#endif #endif
#else #else
// //
// SPEAR OF DESTINY DIGISOUNDS // SPEAR OF DESTINY DIGISOUNDS
// //
HALTSND, 0, HALTSND, 0,
CLOSEDOORSND, 2, CLOSEDOORSND, 2,
OPENDOORSND, 3, OPENDOORSND, 3,
ATKMACHINEGUNSND, 4, ATKMACHINEGUNSND, 4,
ATKPISTOLSND, 5, ATKPISTOLSND, 5,
ATKGATLINGSND, 6, ATKGATLINGSND, 6,
SCHUTZADSND, 7, SCHUTZADSND, 7,
BOSSFIRESND, 8, BOSSFIRESND, 8,
SSFIRESND, 9, SSFIRESND, 9,
DEATHSCREAM1SND, 10, DEATHSCREAM1SND, 10,
DEATHSCREAM2SND, 11, DEATHSCREAM2SND, 11,
TAKEDAMAGESND, 12, TAKEDAMAGESND, 12,
PUSHWALLSND, 13, PUSHWALLSND, 13,
AHHHGSND, 15, AHHHGSND, 15,
LEBENSND, 16, LEBENSND, 16,
NAZIFIRESND, 17, NAZIFIRESND, 17,
SLURPIESND, 18, SLURPIESND, 18,
LEVELDONESND, 22, LEVELDONESND, 22,
DEATHSCREAM4SND, 23, // AIIEEE DEATHSCREAM4SND, 23, // AIIEEE
DEATHSCREAM3SND, 23, // DOUBLY-MAPPED!!! DEATHSCREAM3SND, 23, // DOUBLY-MAPPED!!!
DEATHSCREAM5SND, 24, // DEE-DEE DEATHSCREAM5SND, 24, // DEE-DEE
DEATHSCREAM6SND, 25, // FART DEATHSCREAM6SND, 25, // FART
DEATHSCREAM7SND, 26, // GASP DEATHSCREAM7SND, 26, // GASP
DEATHSCREAM8SND, 27, // GUH-BOY! DEATHSCREAM8SND, 27, // GUH-BOY!
DEATHSCREAM9SND, 28, // AH GEEZ! DEATHSCREAM9SND, 28, // AH GEEZ!
GETGATLINGSND, 38, // Got Gat replacement GETGATLINGSND, 38, // Got Gat replacement
#ifndef SPEARDEMO #ifndef SPEARDEMO
DOGBARKSND, 1, DOGBARKSND, 1,
DOGDEATHSND, 14, DOGDEATHSND, 14,
SPIONSND, 19, SPIONSND, 19,
NEINSOVASSND, 20, NEINSOVASSND, 20,
DOGATTACKSND, 21, DOGATTACKSND, 21,
TRANSSIGHTSND, 29, // Trans Sight TRANSSIGHTSND, 29, // Trans Sight
TRANSDEATHSND, 30, // Trans Death TRANSDEATHSND, 30, // Trans Death
WILHELMSIGHTSND, 31, // Wilhelm Sight WILHELMSIGHTSND, 31, // Wilhelm Sight
WILHELMDEATHSND, 32, // Wilhelm Death WILHELMDEATHSND, 32, // Wilhelm Death
UBERDEATHSND, 33, // Uber Death UBERDEATHSND, 33, // Uber Death
KNIGHTSIGHTSND, 34, // Death Knight Sight KNIGHTSIGHTSND, 34, // Death Knight Sight
KNIGHTDEATHSND, 35, // Death Knight Death KNIGHTDEATHSND, 35, // Death Knight Death
ANGELSIGHTSND, 36, // Angel Sight ANGELSIGHTSND, 36, // Angel Sight
ANGELDEATHSND, 37, // Angel Death ANGELDEATHSND, 37, // Angel Death
GETSPEARSND, 39, // Got Spear replacement GETSPEARSND, 39, // Got Spear replacement
#endif #endif
#endif #endif
LASTSOUND LASTSOUND
}; };
void InitDigiMap (void) void InitDigiMap()
{ {
int *map; int *map;
for (map = wolfdigimap;*map != LASTSOUND;map += 2) for (map = wolfdigimap; *map != LASTSOUND; map += 2)
DigiMap[map[0]] = map[1]; DigiMap[map[0]] = map[1];
} }
#ifndef SPEAR #ifndef SPEAR
CP_iteminfo MusicItems={CTL_X,CTL_Y,6,0,32}; CP_iteminfo MusicItems={CTL_X,CTL_Y,6,0,32};
CP_itemtype MusicMenu[]= CP_itemtype MusicMenu[]=
{ {
{1,"Get Them!",0}, {1,"Get Them!",0},
{1,"Searching",0}, {1,"Searching",0},
{1,"P.O.W.",0}, {1,"P.O.W.",0},
{1,"Suspense",0}, {1,"Suspense",0},
{1,"War March",0}, {1,"War March",0},
{1,"Around The Corner!",0}, {1,"Around The Corner!",0},
{1,"Nazi Anthem",0}, {1,"Nazi Anthem",0},
{1,"Lurking...",0}, {1,"Lurking...",0},
{1,"Going After Hitler",0}, {1,"Going After Hitler",0},
{1,"Pounding Headache",0}, {1,"Pounding Headache",0},
{1,"Into the Dungeons",0}, {1,"Into the Dungeons",0},
{1,"Ultimate Conquest",0}, {1,"Ultimate Conquest",0},
{1,"Kill the S.O.B.",0}, {1,"Kill the S.O.B.",0},
{1,"The Nazi Rap",0}, {1,"The Nazi Rap",0},
{1,"Twelfth Hour",0}, {1,"Twelfth Hour",0},
{1,"Zero Hour",0}, {1,"Zero Hour",0},
{1,"Ultimate Conquest",0}, {1,"Ultimate Conquest",0},
{1,"Wolfpack",0} {1,"Wolfpack",0}
}; };
#else #else
CP_iteminfo MusicItems={CTL_X,CTL_Y-20,9,0,32}; CP_iteminfo MusicItems={CTL_X,CTL_Y-20,9,0,32};
CP_itemtype MusicMenu[]= CP_itemtype MusicMenu[]=
{ {
{1,"Funky Colonel Bill",0}, {1,"Funky Colonel Bill",0},
{1,"Death To The Nazis",0}, {1,"Death To The Nazis",0},
{1,"Tiptoeing Around",0}, {1,"Tiptoeing Around",0},
{1,"Is This THE END?",0}, {1,"Is This THE END?",0},
{1,"Evil Incarnate",0}, {1,"Evil Incarnate",0},
{1,"Jazzin' Them Nazis",0}, {1,"Jazzin' Them Nazis",0},
{1,"Puttin' It To The Enemy",0}, {1,"Puttin' It To The Enemy",0},
{1,"The SS Gonna Get You",0}, {1,"The SS Gonna Get You",0},
{1,"Towering Above",0} {1,"Towering Above",0}
}; };
#endif #endif
#ifndef SPEARDEMO static int songs[]=
void DoJukebox(void)
{ {
int which,lastsong=-1;
unsigned start,songs[]=
{
#ifndef SPEAR #ifndef SPEAR
GETTHEM_MUS, GETTHEM_MUS,
SEARCHN_MUS, SEARCHN_MUS,
POW_MUS, POW_MUS,
SUSPENSE_MUS, SUSPENSE_MUS,
WARMARCH_MUS, WARMARCH_MUS,
CORNER_MUS, CORNER_MUS,
NAZI_OMI_MUS, NAZI_OMI_MUS,
PREGNANT_MUS, PREGNANT_MUS,
GOINGAFT_MUS, GOINGAFT_MUS,
HEADACHE_MUS, HEADACHE_MUS,
DUNGEON_MUS, DUNGEON_MUS,
ULTIMATE_MUS, ULTIMATE_MUS,
INTROCW3_MUS, INTROCW3_MUS,
NAZI_RAP_MUS, NAZI_RAP_MUS,
TWELFTH_MUS, TWELFTH_MUS,
ZEROHOUR_MUS, ZEROHOUR_MUS,
ULTIMATE_MUS, ULTIMATE_MUS,
PACMAN_MUS PACMAN_MUS
#else #else
XFUNKIE_MUS, // 0 XFUNKIE_MUS, // 0
XDEATH_MUS, // 2 XDEATH_MUS, // 2
XTIPTOE_MUS, // 4 XTIPTOE_MUS, // 4
XTHEEND_MUS, // 7 XTHEEND_MUS, // 7
XEVIL_MUS, // 17 XEVIL_MUS, // 17
XJAZNAZI_MUS, // 18 XJAZNAZI_MUS, // 18
XPUTIT_MUS, // 21 XPUTIT_MUS, // 21
XGETYOU_MUS, // 22 XGETYOU_MUS, // 22
XTOWER2_MUS // 23 XTOWER2_MUS // 23
#endif #endif
}; };
#ifndef SPEARDEMO
void DoJukebox()
{
int which,lastsong=-1;
unsigned start;
IN_ClearKeysDown(); IN_ClearKeysDown();
if (!AdLibPresent && !SoundBlasterPresent) // if (!AdLibPresent && !SoundBlasterPresent)
return; // return;
MenuFadeOut(); MenuFadeOut();
#ifndef SPEAR #if !defined(SPEAR) || !defined(UPLOAD)
#ifndef UPLOAD start = (rand() % 3) * 6;
start = (rand()%3)*6;
#else
start = 0;
#endif
#else #else
start = 0; start = 0;
#endif #endif
CA_CacheGrChunk(STARTFONT+1);
CA_CacheGrChunk (STARTFONT+1);
#ifdef SPEAR #ifdef SPEAR
CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END); CacheLump(BACKDROP_LUMP_START, BACKDROP_LUMP_END);
#else #else
CacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END); CacheLump(CONTROLS_LUMP_START, CONTROLS_LUMP_END);
#endif #endif
CA_LoadAllSounds (); CA_LoadAllSounds();
fontnumber=1; fontnumber=1;
ClearMScreen (); ClearMScreen();
VWB_DrawPic(112,184,C_MOUSELBACKPIC); VWB_DrawPic(112,184,C_MOUSELBACKPIC);
DrawStripes (10); DrawStripes(10);
SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR); SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR);
#ifndef SPEAR #ifndef SPEAR
...@@ -1015,10 +1001,10 @@ void DoJukebox(void) ...@@ -1015,10 +1001,10 @@ void DoJukebox(void)
DrawMenu (&MusicItems,&MusicMenu[start]); DrawMenu (&MusicItems,&MusicMenu[start]);
SETFONTCOLOR (READHCOLOR,BKGDCOLOR); SETFONTCOLOR (READHCOLOR,BKGDCOLOR);
PrintY=15; PrintY = 15;
WindowX = 0; WindowX = 0;
WindowY = 320; WindowY = 320;
US_CPrint ("Robert's Jukebox"); US_CPrint("Robert's Jukebox");
SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR); SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR);
VW_UpdateScreen(); VW_UpdateScreen();
...@@ -1043,9 +1029,9 @@ void DoJukebox(void) ...@@ -1043,9 +1029,9 @@ void DoJukebox(void)
MenuFadeOut(); MenuFadeOut();
IN_ClearKeysDown(); IN_ClearKeysDown();
#ifdef SPEAR #ifdef SPEAR
UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END); UnCacheLump(BACKDROP_LUMP_START, BACKDROP_LUMP_END);
#else #else
UnCacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END); UnCacheLump(CONTROLS_LUMP_START, CONTROLS_LUMP_END);
#endif #endif
} }
#endif #endif
...@@ -1061,7 +1047,7 @@ void DoJukebox(void) ...@@ -1061,7 +1047,7 @@ void DoJukebox(void)
========================== ==========================
*/ */
void InitGame(void) void InitGame()
{ {
int i; int i;
...@@ -1078,24 +1064,14 @@ void InitGame(void) ...@@ -1078,24 +1064,14 @@ void InitGame(void)
// //
// build some tables // build some tables
// //
InitDigiMap (); InitDigiMap();
for (i = 0;i < MAPSIZE; i++) for (i = 0;i < MAPSIZE; i++)
{ {
farmapylookup[i] = i*64; farmapylookup[i] = i*64;
} }
ReadConfig (); ReadConfig();
//
// HOLDING DOWN 'M' KEY?
//
#ifndef SPEARDEMO
if (IN_KeyDown(sc_M))
DoJukebox();
else
#endif
// //
// load in and lock down some basic chunks // load in and lock down some basic chunks
...@@ -1104,7 +1080,7 @@ void InitGame(void) ...@@ -1104,7 +1080,7 @@ void InitGame(void)
CA_CacheGrChunk(STARTFONT); CA_CacheGrChunk(STARTFONT);
LoadLatchMem(); LoadLatchMem();
BuildTables(); // trig tables BuildTables();
SetupWalls(); SetupWalls();
NewViewSize(viewsize); NewViewSize(viewsize);
...@@ -1113,7 +1089,17 @@ void InitGame(void) ...@@ -1113,7 +1089,17 @@ void InitGame(void)
// //
// initialize variables // initialize variables
// //
InitRedShifts (); InitRedShifts();
IN_CheckAck();
//
// HOLDING DOWN 'M' KEY?
//
#ifndef SPEARDEMO
if (IN_KeyDown(sc_M))
DoJukebox();
#endif
FinishSignon(); FinishSignon();
} }
...@@ -1150,7 +1136,7 @@ boolean SetViewSize(unsigned width, unsigned height) ...@@ -1150,7 +1136,7 @@ boolean SetViewSize(unsigned width, unsigned height)
} }
void ShowViewSize (int width) void ShowViewSize(int width)
{ {
int oldwidth,oldheight; int oldwidth,oldheight;
...@@ -1168,11 +1154,11 @@ void ShowViewSize (int width) ...@@ -1168,11 +1154,11 @@ void ShowViewSize (int width)
void NewViewSize(int width) void NewViewSize(int width)
{ {
CA_UpLevel (); CA_UpLevel();
MM_SortMem (); MM_SortMem();
viewsize = width; viewsize = width;
SetViewSize (width*16,width*16*HEIGHTRATIO); SetViewSize(width*16,width*16*HEIGHTRATIO);
CA_DownLevel (); CA_DownLevel();
} }
...@@ -1205,7 +1191,7 @@ void DemoLoop() ...@@ -1205,7 +1191,7 @@ void DemoLoop()
StartCPMusic(INTROSONG); StartCPMusic(INTROSONG);
if (!NoWait) if (!NoWait)
PG13 (); PG13();
i = MS_CheckParm("playdemo"); i = MS_CheckParm("playdemo");
if (i && ((i+1) < _argc)) { if (i && ((i+1) < _argc)) {
...@@ -1275,7 +1261,7 @@ void DemoLoop() ...@@ -1275,7 +1261,7 @@ void DemoLoop()
#ifndef SPEARDEMO #ifndef SPEARDEMO
PlayDemo (LastDemo++%4); PlayDemo (LastDemo++%4);
#else #else
PlayDemo (0); PlayDemo(0);
#endif #endif
if (playstate == ex_abort) if (playstate == ex_abort)
...@@ -1316,6 +1302,8 @@ int WolfMain(int argc, char *argv[]) ...@@ -1316,6 +1302,8 @@ int WolfMain(int argc, char *argv[])
_argc = argc; _argc = argc;
_argv = argv; _argv = argv;
srand(time(NULL));
CheckForEpisodes(); CheckForEpisodes();
InitGame(); InitGame();
......
...@@ -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