Commit ae6c51a9 authored by Steven Fuller's avatar Steven Fuller

Made the Jukebox work.

More cleanups.
parent a6936485
CC = gcc
#CC = g++
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
CFLAGS = -g -Wall
......@@ -9,7 +8,7 @@ CFLAGS = -g -Wall
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_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
SOBJS = $(OBJS) $(ROBJS) vi_svga.o
XOBJS = $(OBJS) $(ROBJS) vi_xlib.o
......
//////////////////////////////////////
//
// Graphics .H file for .SDM
// IGRAB-ed on Mon Sep 21 14:20:19 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
C_BACKDROPPIC=3,
......@@ -190,16 +183,8 @@ typedef enum {
//
#define NUMCHUNKS 133
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 125
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 4
//
// File offsets for data items
......@@ -207,18 +192,6 @@ typedef enum {
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 128
#define STARTSPRITES 128
#define STARTTILE8 128
#define STARTTILE8M 129
#define STARTTILE16 129
#define STARTTILE16M 129
#define STARTTILE32 129
#define STARTTILE32M 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 {
// Lump Start
C_BACKDROPPIC=3,
......@@ -246,16 +239,8 @@ typedef enum {
//
#define NUMCHUNKS 169
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 147
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 18
//
// File offsets for data items
......@@ -263,18 +248,6 @@ typedef enum {
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 150
#define STARTSPRITES 150
#define STARTTILE8 150
#define STARTTILE8M 151
#define STARTTILE16 151
#define STARTTILE16M 151
#define STARTTILE32 151
#define STARTTILE32M 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 {
// Lump Start
H_BJPIC=3,
......@@ -187,16 +180,8 @@ typedef enum {
//
#define NUMCHUNKS 156
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 144
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 8
//
// File offsets for data items
......@@ -204,18 +189,6 @@ typedef enum {
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 147
#define STARTSPRITES 147
#define STARTTILE8 147
#define STARTTILE8M 148
#define STARTTILE16 148
#define STARTTILE16M 148
#define STARTTILE32 148
#define STARTTILE32M 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 {
// Lump Start
H_BJPIC=3,
......@@ -182,16 +175,8 @@ typedef enum {
//
#define NUMCHUNKS 149
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 132
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 35
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 13
//
// File offsets for data items
......@@ -199,18 +184,6 @@ typedef enum {
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 135
#define STARTSPRITES 135
#define STARTTILE8 135
#define STARTTILE8M 136
#define STARTTILE16 136
#define STARTTILE16M 136
#define STARTTILE32 136
#define STARTTILE32M 136
#define STARTEXTERNS 136
//
// Thank you for using IGRAB!
//
......@@ -823,7 +823,7 @@ static void CAL_ExpandGrChunk(int chunk, byte *source)
width = 8;
height = 8;
tilecount = NUMTILE8;
} else if (chunk >= STARTPICS && chunk < STARTSPRITES) {
} else if (chunk >= STARTPICS && chunk < STARTTILE8) {
width = pictable[chunk - STARTPICS].width;
height = pictable[chunk - STARTPICS].height;
expanded = *((long *)source);
......
......@@ -75,7 +75,7 @@ void VWB_DrawPic(int x, int y, int chunknum)
width = pictable[picnum].width;
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()
{
int i;
CA_CacheGrChunk (STARTTILE8);
CA_CacheGrChunk(STARTTILE8);
for (i = LATCHPICS_LUMP_START; i <= LATCHPICS_LUMP_END; i++) {
/* TODO: this just caches them for eternity */
CA_CacheGrChunk(i);
}
......
......@@ -39,31 +39,28 @@ typedef struct {
} PACKED MusicGroup;
// Global variables
extern boolean AdLibPresent,
SoundSourcePresent,
SoundBlasterPresent,
SoundPositioned;
extern boolean AdLibPresent, SoundSourcePresent, SoundBlasterPresent;
extern SDMode SoundMode;
extern SDSMode DigiMode;
extern SMMode MusicMode;
extern boolean DigiPlaying;
extern int DigiMap[];
// 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_StopSound(void),
SD_WaitSoundDone(void),
extern void SD_StopSound(),
SD_WaitSoundDone(),
SD_StartMusic(MusicGroup *music),
SD_MusicOn(void),
SD_MusicOff(void),
SD_FadeOutMusic(void);
SD_MusicOn(),
SD_MusicOff(),
SD_FadeOutMusic();
extern boolean SD_MusicPlaying(void),
extern boolean SD_MusicPlaying(),
SD_SetSoundMode(SDMode mode),
SD_SetMusicMode(SMMode mode);
extern word SD_SoundPlaying(void);
extern word SD_SoundPlaying();
extern void SD_SetDigiDevice(SDSMode);
extern void SD_Poll();
......
......@@ -2,26 +2,22 @@
#include "id_heads.h"
boolean SoundSourcePresent, AdLibPresent, SoundBlasterPresent,
SoundPositioned;
boolean SoundSourcePresent, AdLibPresent, SoundBlasterPresent;
static boolean SoundPositioned;
SDMode SoundMode, MusicMode;
SDSMode DigiMode;
int DigiMap[LASTSOUND];
static boolean SD_Started;
boolean nextsoundpos;
int LeftPosition, RightPosition;
static boolean nextsoundpos;
word NumDigi;
word *DigiList;
boolean DigiPlaying;
static int LeftPosition, RightPosition;
boolean sqActive;
static boolean sqActive;
void SD_StopDigitized()
......@@ -44,7 +40,6 @@ void SD_SetDigiDevice(SDSMode mode)
{
}
// Public routines
///////////////////////////////////////////////////////////////////////////
......@@ -73,7 +68,7 @@ boolean SD_SetMusicMode(SMMode mode)
// Detects all additional sound hardware and installs my ISR
//
///////////////////////////////////////////////////////////////////////////
void SD_Startup(void)
void SD_Startup()
{
if (SD_Started)
return;
......@@ -87,7 +82,7 @@ void SD_Startup(void)
// Removes sound ISR and turns off whatever sound hardware was active
//
///////////////////////////////////////////////////////////////////////////
void SD_Shutdown(void)
void SD_Shutdown()
{
if (!SD_Started)
return;
......@@ -98,19 +93,6 @@ void SD_Shutdown(void)
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
......@@ -137,7 +119,7 @@ void SD_PlaySound(soundnames sound)
// no sound is playing
//
///////////////////////////////////////////////////////////////////////////
word SD_SoundPlaying(void)
word SD_SoundPlaying()
{
return false;
}
......@@ -147,7 +129,7 @@ word SD_SoundPlaying(void)
// SD_StopSound() - if a sound is playing, stops it
//
///////////////////////////////////////////////////////////////////////////
void SD_StopSound(void)
void SD_StopSound()
{
}
......@@ -156,8 +138,9 @@ void SD_StopSound(void)
// 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())
;
}
......@@ -167,7 +150,7 @@ void SD_WaitSoundDone(void)
// SD_MusicOn() - turns on the sequencer
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOn(void)
void SD_MusicOn()
{
sqActive = true;
}
......@@ -177,7 +160,7 @@ void SD_MusicOn(void)
// SD_MusicOff() - turns off the sequencer and any playing notes
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOff(void)
void SD_MusicOff()
{
sqActive = false;
}
......@@ -198,7 +181,7 @@ void SD_StartMusic(MusicGroup *music)
// to see if the fadeout is complete
//
///////////////////////////////////////////////////////////////////////////
void SD_FadeOutMusic(void)
void SD_FadeOutMusic()
{
}
......@@ -208,7 +191,7 @@ void SD_FadeOutMusic(void)
// not
//
///////////////////////////////////////////////////////////////////////////
boolean SD_MusicPlaying(void)
boolean SD_MusicPlaying()
{
return false;
}
......@@ -228,10 +211,11 @@ boolean SD_MusicPlaying(void)
==========================
*/
fixed globalsoundx,globalsoundy;
int leftchannel,rightchannel;
static fixed globalsoundx, globalsoundy;
static int leftchannel, rightchannel;
#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, 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},
......@@ -248,7 +232,7 @@ byte righttable[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}
};
byte lefttable[ATABLEMAX][ATABLEMAX * 2] = {
static byte lefttable[ATABLEMAX][ATABLEMAX * 2] = {
{ 8, 8, 8, 8, 8, 8, 8, 8, 5, 3, 1, 0, 0, 0, 0, 0, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8},
{ 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 2, 0, 0, 0, 0, 0, 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},
......@@ -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}
};
void SetSoundLoc(fixed gx, fixed gy)
static void SetSoundLoc(fixed gx, fixed gy)
{
#if 0
fixed xt,yt;
int x,y;
// fixed xt, yt;
int x, y;
#if 0
//
// translate point to view centered coordinates
//
......@@ -291,6 +275,7 @@ void SetSoundLoc(fixed gx, fixed gy)
xt = FixedByFrac(gx,viewsin);
yt = FixedByFrac(gy,viewcos);
y = (yt + xt) >> TILESHIFT;
#endif
if (y >= ATABLEMAX)
y = ATABLEMAX - 1;
......@@ -300,9 +285,22 @@ void SetSoundLoc(fixed gx, fixed gy)
x = -x;
if (x >= ATABLEMAX)
x = ATABLEMAX - 1;
leftchannel = lefttable[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, 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, 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
};
static void SetSoundLoc(fixed gx, fixed gy)
{
// fixed xt, yt;
int x, y;
#if 0
//
// translate point to view centered coordinates
//
gx -= viewx;
gy -= viewy;
//
// 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)
// IN_Shutdown() - Shuts down the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void IN_Shutdown(void)
void IN_Shutdown()
{
word i;
......@@ -598,7 +598,7 @@ void IN_Shutdown(void)
// IN_ClearKeysDown() - Clears the keyboard array
//
///////////////////////////////////////////////////////////////////////////
void IN_ClearKeysDown(void)
void IN_ClearKeysDown()
{
LastScan = sc_None;
LastASCII = key_None;
......@@ -701,7 +701,7 @@ IN_CheckAck();
boolean btnstate[8];
void IN_StartAck(void)
void IN_StartAck()
{
unsigned i,buttons;
......@@ -720,7 +720,7 @@ void IN_StartAck(void)
btnstate[i] = true;
}
boolean IN_CheckAck (void)
boolean IN_CheckAck()
{
unsigned i,buttons;
......@@ -729,7 +729,7 @@ while (keyboard_update()) ; /* get all events */
if (LastScan)
return true;
buttons = IN_JoyButtons () << 4;
buttons = IN_JoyButtons() << 4;
if (MousePresent)
buttons |= IN_MouseButtons ();
......
......@@ -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;
CenterWindow (16,7);
......@@ -48,11 +48,9 @@ void CountObjects (void)
US_PrintUnsigned (active);
VW_UpdateScreen();
IN_Ack ();
IN_Ack();
}
//===========================================================================
/*
================
=
......@@ -82,10 +80,6 @@ void PicturePause (void)
Quit(NULL);
}
//===========================================================================
/*
================
=
......@@ -96,174 +90,8 @@ void PicturePause (void)
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;
extern int centerx;
extern int shootdelta;
extern int dirangle[9];
extern boolean startgame,loadedgame;
extern int mouseadjustment;
extern unsigned xoffset, yoffset;
......
......@@ -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)
{
int angle,viewangle;
......
......@@ -1111,12 +1111,13 @@ startplayloop:
{
SD_StopSound();
SD_PlaySound(GETSPEARSND);
if (DigiMode != sds_Off)
{
long lasttimecount = get_TimeCount();
while(get_TimeCount() < lasttimecount+150)
//while(DigiPlaying!=false)
while(get_TimeCount() < (lasttimecount+150))
//while(SD_SoundPlaying()!=false)
SD_Poll();
}
else
......
......@@ -35,10 +35,9 @@
*/
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;
int viewwidth;
......@@ -51,7 +50,7 @@ long heightnumerator;
boolean startgame,loadedgame;
int mouseadjustment;
/* These are refuges from wl_draw.c */
/* These are refugees from wl_draw.c */
long frameon;
long lasttimecount;
fixed viewsin, viewcos;
......@@ -75,7 +74,7 @@ char **_argv;
= FixedByFrac
=
= 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()
==========================
*/
void FinishSignon (void)
void FinishSignon()
{
#ifndef SPEAR
VW_Bar (0,189,300,11, introscn[0]);
VW_Bar(0, 189, 300, 11, introscn[0]);
WindowX = 0;
WindowW = 320;
PrintY = 190;
SETFONTCOLOR(14,4);
US_CPrint ("Press a key");
US_CPrint("Press a key");
VW_UpdateScreen();
if (!NoWait)
IN_Ack ();
VW_Bar (0,189,300,11, introscn[0]);
VW_Bar(0, 189, 300, 11, introscn[0]);
PrintY = 190;
SETFONTCOLOR(10,4);
US_CPrint ("Working...");
US_CPrint("Working...");
VW_UpdateScreen();
SETFONTCOLOR(0,15);
......@@ -771,7 +769,7 @@ int MS_CheckParm(char *check)
*/
static int wolfdigimap[] =
{
{
// These first sounds are in the upload version
#ifndef SPEAR
HALTSND, 0,
......@@ -791,20 +789,16 @@ static int wolfdigimap[] =
DEATHSCREAM3SND, 13,
TAKEDAMAGESND, 14,
PUSHWALLSND, 15,
LEBENSND, 20,
NAZIFIRESND, 21,
SLURPIESND, 22,
YEAHSND, 32,
#ifndef UPLOAD
// These are in all other episodes
DOGDEATHSND, 16,
AHHHGSND, 17,
DIESND, 18,
EVASND, 19,
TOT_HUNDSND, 23,
MEINGOTTSND, 24,
SCHABBSHASND, 25,
......@@ -828,7 +822,6 @@ static int wolfdigimap[] =
KEINSND, 43, // EPISODE 5 BOSS SIGHTING
MEINSND, 44, // EPISODE 6 BOSS DIE
ROSESND, 45, // EPISODE 5 BOSS DIE
#endif
#else
//
......@@ -860,7 +853,6 @@ static int wolfdigimap[] =
DEATHSCREAM8SND, 27, // GUH-BOY!
DEATHSCREAM9SND, 28, // AH GEEZ!
GETGATLINGSND, 38, // Got Gat replacement
#ifndef SPEARDEMO
DOGBARKSND, 1,
DOGDEATHSND, 14,
......@@ -880,23 +872,21 @@ static int wolfdigimap[] =
#endif
#endif
LASTSOUND
};
};
void InitDigiMap (void)
void InitDigiMap()
{
int *map;
for (map = wolfdigimap;*map != LASTSOUND;map += 2)
for (map = wolfdigimap; *map != LASTSOUND; map += 2)
DigiMap[map[0]] = map[1];
}
#ifndef SPEAR
CP_iteminfo MusicItems={CTL_X,CTL_Y,6,0,32};
CP_itemtype MusicMenu[]=
{
{
{1,"Get Them!",0},
{1,"Searching",0},
{1,"P.O.W.",0},
......@@ -917,11 +907,11 @@ CP_itemtype MusicMenu[]=
{1,"Zero Hour",0},
{1,"Ultimate Conquest",0},
{1,"Wolfpack",0}
};
};
#else
CP_iteminfo MusicItems={CTL_X,CTL_Y-20,9,0,32};
CP_itemtype MusicMenu[]=
{
{
{1,"Funky Colonel Bill",0},
{1,"Death To The Nazis",0},
{1,"Tiptoeing Around",0},
......@@ -931,15 +921,11 @@ CP_itemtype MusicMenu[]=
{1,"Puttin' It To The Enemy",0},
{1,"The SS Gonna Get You",0},
{1,"Towering Above",0}
};
};
#endif
#ifndef SPEARDEMO
void DoJukebox(void)
static int songs[]=
{
int which,lastsong=-1;
unsigned start,songs[]=
{
#ifndef SPEAR
GETTHEM_MUS,
SEARCHN_MUS,
......@@ -972,38 +958,38 @@ void DoJukebox(void)
XGETYOU_MUS, // 22
XTOWER2_MUS // 23
#endif
};
};
IN_ClearKeysDown();
if (!AdLibPresent && !SoundBlasterPresent)
return;
#ifndef SPEARDEMO
void DoJukebox()
{
int which,lastsong=-1;
unsigned start;
IN_ClearKeysDown();
// if (!AdLibPresent && !SoundBlasterPresent)
// return;
MenuFadeOut();
#ifndef SPEAR
#ifndef UPLOAD
start = (rand()%3)*6;
#if !defined(SPEAR) || !defined(UPLOAD)
start = (rand() % 3) * 6;
#else
start = 0;
#endif
#else
start = 0;
#endif
CA_CacheGrChunk (STARTFONT+1);
CA_CacheGrChunk(STARTFONT+1);
#ifdef SPEAR
CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
CacheLump(BACKDROP_LUMP_START, BACKDROP_LUMP_END);
#else
CacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END);
CacheLump(CONTROLS_LUMP_START, CONTROLS_LUMP_END);
#endif
CA_LoadAllSounds ();
CA_LoadAllSounds();
fontnumber=1;
ClearMScreen ();
ClearMScreen();
VWB_DrawPic(112,184,C_MOUSELBACKPIC);
DrawStripes (10);
DrawStripes(10);
SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR);
#ifndef SPEAR
......@@ -1015,10 +1001,10 @@ void DoJukebox(void)
DrawMenu (&MusicItems,&MusicMenu[start]);
SETFONTCOLOR (READHCOLOR,BKGDCOLOR);
PrintY=15;
PrintY = 15;
WindowX = 0;
WindowY = 320;
US_CPrint ("Robert's Jukebox");
US_CPrint("Robert's Jukebox");
SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR);
VW_UpdateScreen();
......@@ -1043,9 +1029,9 @@ void DoJukebox(void)
MenuFadeOut();
IN_ClearKeysDown();
#ifdef SPEAR
UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
UnCacheLump(BACKDROP_LUMP_START, BACKDROP_LUMP_END);
#else
UnCacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END);
UnCacheLump(CONTROLS_LUMP_START, CONTROLS_LUMP_END);
#endif
}
#endif
......@@ -1061,7 +1047,7 @@ void DoJukebox(void)
==========================
*/
void InitGame(void)
void InitGame()
{
int i;
......@@ -1078,24 +1064,14 @@ void InitGame(void)
//
// build some tables
//
InitDigiMap ();
InitDigiMap();
for (i = 0;i < MAPSIZE; i++)
{
farmapylookup[i] = i*64;
}
ReadConfig ();
//
// HOLDING DOWN 'M' KEY?
//
#ifndef SPEARDEMO
if (IN_KeyDown(sc_M))
DoJukebox();
else
#endif
ReadConfig();
//
// load in and lock down some basic chunks
......@@ -1104,7 +1080,7 @@ void InitGame(void)
CA_CacheGrChunk(STARTFONT);
LoadLatchMem();
BuildTables(); // trig tables
BuildTables();
SetupWalls();
NewViewSize(viewsize);
......@@ -1113,7 +1089,17 @@ void InitGame(void)
//
// initialize variables
//
InitRedShifts ();
InitRedShifts();
IN_CheckAck();
//
// HOLDING DOWN 'M' KEY?
//
#ifndef SPEARDEMO
if (IN_KeyDown(sc_M))
DoJukebox();
#endif
FinishSignon();
}
......@@ -1150,7 +1136,7 @@ boolean SetViewSize(unsigned width, unsigned height)
}
void ShowViewSize (int width)
void ShowViewSize(int width)
{
int oldwidth,oldheight;
......@@ -1168,11 +1154,11 @@ void ShowViewSize (int width)
void NewViewSize(int width)
{
CA_UpLevel ();
MM_SortMem ();
CA_UpLevel();
MM_SortMem();
viewsize = width;
SetViewSize (width*16,width*16*HEIGHTRATIO);
CA_DownLevel ();
SetViewSize(width*16,width*16*HEIGHTRATIO);
CA_DownLevel();
}
......@@ -1205,7 +1191,7 @@ void DemoLoop()
StartCPMusic(INTROSONG);
if (!NoWait)
PG13 ();
PG13();
i = MS_CheckParm("playdemo");
if (i && ((i+1) < _argc)) {
......@@ -1275,7 +1261,7 @@ void DemoLoop()
#ifndef SPEARDEMO
PlayDemo (LastDemo++%4);
#else
PlayDemo (0);
PlayDemo(0);
#endif
if (playstate == ex_abort)
......@@ -1316,6 +1302,8 @@ int WolfMain(int argc, char *argv[])
_argc = argc;
_argv = argv;
srand(time(NULL));
CheckForEpisodes();
InitGame();
......
......@@ -2631,7 +2631,7 @@ void DrawOutline(int x,int y,int w,int h,int color1,int color2)
// Setup Control Panel stuff - graphics, etc.
//
////////////////////////////////////////////////////////////////////
void SetupControlPanel(void)
void SetupControlPanel()
{
#ifdef DOSISM /* DOS VERSION */
#ifdef HAVE_FFBLK
......@@ -2770,7 +2770,7 @@ void SetupControlPanel(void)
// Clean up all the Control Panel stuff
//
////////////////////////////////////////////////////////////////////
void CleanupControlPanel(void)
void CleanupControlPanel()
{
#ifndef SPEAR
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