Commit 6fe38b42 authored by Steven Fuller's avatar Steven Fuller

Few more minor code reformats.

Removed OpenAL/OpenGL code for now.  Want to concentrate more on improving
the current code before adding extra features.
parent 0ce3e007
......@@ -13,7 +13,8 @@
* Fully compile with no warnings/errors using -Wall -ansi -pedantic and with
other compilers (would need to turn off warnings about unused parameters)
* Port to: Linux/SVGAlib, Linux/X (Windowed and DGA), Linux/OpenGL,
DOS/Allegro, Win32/GDI?, Win32/DX, Win32/D3D, Win32/OpenGL, BeOS?, MacOS?
DOS/Allegro, Win32/GDI?, Win32/DX, Win32/D3D, Win32/OpenGL, BeOS?, MacOS?,
QNX?
* Ease in using demos. Playing demos from files, recording to files, batch
playing, and so on.
* Make Wolf3D the game it was originally planned to be... More strategy...
......@@ -21,12 +22,10 @@
regardless of future plans [IDEAS]) and no TODO/FIXME/XXXs in the source
code
* Have some sort of way of playing both digital and adlib sounds on all
platforms (if possible)
platforms [fmopl.c] (if possible)
* Test with other available mods (that were compatible with the original
game)
* Unified input handling
* Configuration files and save games which work regardless of operating
system/processor/binary build
* Suite of utilities to edit the game data.
* Building on previous idea, have some way to break out of requiring the
game to be recompiled for each game dataset
......@@ -5,34 +5,28 @@ CC = gcc
CFLAGS = -g -Wall
#CFLAGS = -Os -Wall
#CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall -I/home/relnev/cvs/oal/include
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
wl_act1.o wl_act2.o wl_agent.o wl_game.o \
wl_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 # sd_oal.o # sd_null.o
wl_debug.o gfxsave.o sd_null.o
ROBJS = wl_draw.o wl_scale.o
SOBJS = $(OBJS) $(ROBJS) vi_svga.o
XOBJS = $(OBJS) $(ROBJS) vi_xlib.o
#GOBJS = $(OBJS) vi_ogl.o vi_glx.o
LFLAGS = -lm
#LFLAGS = -lm /home/relnev/cvs/oal/linux/src/libopenal.a -lpthread -ldl
SLFLAGS = $(LFLAGS) -lvga
XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga
#GLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lGL
NASM = nasm
.SUFFIXES: .asm
#all: swolf3d xwolf3d gwolf3d
all: swolf3d xwolf3d
$(SOBJS): version.h id_heads.h wl_def.h
$(XOBJS): version.h id_heads.h wl_def.h
$(GOBJS): version.h id_heads.h wl_def.h
.asm.o:
$(NASM) -f elf -o $@ $<
......@@ -43,11 +37,8 @@ swolf3d: $(SOBJS)
xwolf3d: $(XOBJS)
gcc -o xwolf3d $(XOBJS) $(XLFLAGS)
gwolf3d: $(GOBJS)
gcc -o gwolf3d $(GOBJS) $(GLFLAGS)
clean:
rm -rf swolf3d xwolf3d gwolf3d *.o
rm -rf swolf3d xwolf3d *.o
distclean: clean
rm -rf *~ DEADJOE
......
/* id_sd.c */
#include "id_heads.h"
#include <AL/al.h>
#include <AL/alc.h>
#error "This code is out of date/broken"
// Global variables
boolean SoundSourcePresent,
AdLibPresent,
SoundBlasterPresent,
SoundPositioned;
SDMode SoundMode;
SMMode MusicMode;
SDSMode DigiMode;
int DigiMap[LASTSOUND];
// Internal variables
static boolean SD_Started;
boolean nextsoundpos;
int LeftPosition,RightPosition;
word NumDigi;
word *DigiList;
boolean DigiPlaying;
boolean sqActive;
/* ------------------------------------------------------------------------ */
ALuint *sources;
ALuint *buffers;
void *cc;
void SD_Poll(void)
{
}
void SD_SetDigiDevice(SDSMode mode)
{
}
///////////////////////////////////////////////////////////////////////////
//
// SD_SetSoundMode() - Sets which sound hardware to use for sound effects
//
///////////////////////////////////////////////////////////////////////////
boolean SD_SetSoundMode(SDMode mode)
{
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_SetMusicMode() - sets the device to use for background music
//
///////////////////////////////////////////////////////////////////////////
boolean SD_SetMusicMode(SMMode mode)
{
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_Startup() - starts up the Sound Mgr
//
///////////////////////////////////////////////////////////////////////////
void SD_Startup(void)
{
int i;
if (SD_Started)
return;
for (i = 0; i < LASTSOUND; i++)
DigiMap[i] = -1;
cc = alcCreateContext(NULL);
if (cc == NULL)
printf("alcCreateContext failed..\n");
else {
word *SoundList = PM_GetPage(ChunksInFile - 1);
PageListStruct *page = &PMPages[ChunksInFile - 1];
int p = page->length;
int x = 0, w, y, z;
for (i = 0; i < p / 2; i += 2) {
w = *(SoundList + i);
y = *(SoundList + i+1);
page = &PMPages[w + PMSoundStart];
if (page->length == 0) {
x++; // count it?
continue;
}
for (z = 0; z < y; w++, z++) {
page = &PMPages[w + PMSoundStart];
z += page->length;
}
x++;
}
buffers = (ALuint *)malloc(sizeof(ALuint) * x);
//if (alGenBuffers(x, buffers) != x)
// printf("OpenAL buffer allocation problem\n");
alGenBuffers(x, buffers);
x = 0;
for (i = 0; i < p / 2; i += 2) {
byte *dat;
w = *(SoundList + i);
y = *(SoundList + i+1);
page = &PMPages[w + PMSoundStart];
if (page->length == 0) {
x++; // count it?
continue;
}
if (y == 0){
printf("wtf?\n");
continue;
}
dat = (byte *)malloc(y);
for (z = 0; z < y; w++) {
page = &PMPages[w + PMSoundStart];
memcpy(dat+z, PM_GetPage(w + PMSoundStart), page->length);
z += page->length;
}
alBufferData(buffers[x], AL_FORMAT_MONO8, dat, y, 6896);
if(alGetError() != AL_NO_ERROR) {
printf("AL error\n");
}
free(dat);
x++;
}
sources = (ALuint *)malloc(sizeof(ALuint) * 4);
alGenSources(4, sources);
}
SD_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_Shutdown() - shuts down the Sound Mgr
// Removes sound ISR and turns off whatever sound hardware was active
//
///////////////////////////////////////////////////////////////////////////
void SD_Shutdown(void)
{
if (!SD_Started)
return;
if (cc) {
alcDestroyContext(cc);
cc = NULL;
}
SD_MusicOff();
SD_StopSound();
SD_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_PlaySound() - plays the specified sound on the appropriate hardware
//
///////////////////////////////////////////////////////////////////////////
ALfloat gval[6], pval[6];
void SD_PlaySound(soundnames sound)
{
int i;
//printf("Playing sound %d, digimap %d\n", sound, DigiMap[sound]);
//fflush(stdout);
if (DigiMap[sound] != -1) {
/* TODO: openal bug? (need to stop before play) */
/* what is there to replayce SourceIsPlaying (was removed from AL)? */
for (i = 0; i < 4; i++) {
/* if (alSourceIsPlaying(sources[i]) == AL_FALSE) */ {
//alSourceStop(*sources);
alSourcefv(sources[i], AL_POSITION, gval);
alSource3f(sources[i], AL_DIRECTION, -pval[0], 0.0f, -pval[2]);
alSourcei(sources[i], AL_BUFFER, buffers[DigiMap[sound]]);
alSourcePlay(sources[i]);
break;
}
}
}
}
/* TODO: velocity ?! */
void UpdateSoundLoc(fixed x, fixed y, int angle)
{
pval[0] = gval[0] = x >> 15;
pval[1] = 0.0f;
pval[2] = gval[2] = y >> 15;
alListenerfv(AL_POSITION, pval);
pval[3] = 0.0f;
pval[4] = 1.0f;
pval[5] = 0.0f;
pval[0] *= sin(angle * PI / 180.0f);
pval[2] *= cos(angle * PI / 180.0f);
alListenerfv(AL_ORIENTATION, pval);
}
void PlaySoundLocGlobal(word sound, fixed x, fixed y)
{
ALfloat val[3];
int i;
//printf("Playing sound %d, digimap %d\n", sound, DigiMap[sound]);
//fflush(stdout);
if (DigiMap[sound] != -1) {
/* TODO: openal bug? (need to stop before play) */
for (i = 0; i < 4; i++) {
/* if (alSourceIsPlaying(sources[i]) == AL_FALSE) */ {
//alSourceStop(*sources);
val[0] = x >> 15;
val[1] = 0.0f;
val[2] = y >> 15;
alSourcefv(sources[i], AL_POSITION, val);
alSourcei(sources[i], AL_BUFFER, buffers[DigiMap[sound]]);
alSourcePlay(sources[i]);
break;
}
}
}
}
///////////////////////////////////////////////////////////////////////////
//
// SD_SoundPlaying() - returns the sound number that's playing, or 0 if
// no sound is playing
//
///////////////////////////////////////////////////////////////////////////
/* TODO: SD_IsSoundPlaying or something? */
word SD_SoundPlaying(void)
{
int i;
/* Watch out for any looped sounds */
for (i = 0; i < 4; i++) {
/* if (alSourceIsPlaying(sources[i]) == AL_TRUE) */ {
ALint ret;
alGetSourcei(sources[i], AL_SOURCE_LOOPING, &ret);
if (ret == AL_FALSE)
return true;
}
}
return false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_StopSound() - if a sound is playing, stops it
//
///////////////////////////////////////////////////////////////////////////
void SD_StopSound()
{
//int i;
/* TODO: this crashes for some reason... */
//for (i = 0; i < 4; i++)
// if (alSourceIsPlaying(sources[i]) == AL_TRUE)
// alSourceStop(sources[i]);
}
///////////////////////////////////////////////////////////////////////////
//
// SD_WaitSoundDone() - waits until the current sound is done playing
//
///////////////////////////////////////////////////////////////////////////
void SD_WaitSoundDone(void)
{
while (SD_SoundPlaying());
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicOn() - turns on the sequencer
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOn(void)
{
sqActive = true;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicOff() - turns off the sequencer and any playing notes
//
///////////////////////////////////////////////////////////////////////////
void SD_MusicOff(void)
{
sqActive = false;
}
///////////////////////////////////////////////////////////////////////////
//
// SD_StartMusic() - starts playing the music pointed to
//
///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music)
{
SD_MusicOff();
}
///////////////////////////////////////////////////////////////////////////
//
// SD_FadeOutMusic() - starts fading out the music. Call SD_MusicPlaying()
// to see if the fadeout is complete
//
///////////////////////////////////////////////////////////////////////////
void SD_FadeOutMusic(void)
{
}
///////////////////////////////////////////////////////////////////////////
//
// SD_MusicPlaying() - returns true if music is currently playing, false if
// not
//
///////////////////////////////////////////////////////////////////////////
boolean SD_MusicPlaying(void)
{
return false;
}
This diff is collapsed.
This diff is collapsed.
......@@ -47,7 +47,7 @@ void ClearMemory()
==========================
*/
void ScanInfoPlane (void)
void ScanInfoPlane()
{
unsigned x,y;
int tile;
......@@ -451,7 +451,7 @@ void ScanInfoPlane (void)
==================
*/
void SetupGameLevel (void)
void SetupGameLevel()
{
int x,y;
word *map,tile;
......@@ -579,7 +579,7 @@ void SetupGameLevel (void)
// have the caching manager load and purge stuff to make sure all marks
// are in memory
//
CA_LoadAllSounds ();
CA_LoadAllSounds();
}
......@@ -597,7 +597,7 @@ void SetupGameLevel (void)
===================
*/
void DrawPlayBorderSides (void)
void DrawPlayBorderSides()
{
int xl,yl;
......@@ -620,9 +620,9 @@ void DrawPlayBorderSides (void)
===================
*/
void DrawAllPlayBorderSides (void)
void DrawAllPlayBorderSides()
{
DrawPlayBorderSides ();
DrawPlayBorderSides();
}
/*
......@@ -632,9 +632,9 @@ void DrawAllPlayBorderSides (void)
=
===================
*/
void DrawAllPlayBorder (void)
void DrawAllPlayBorder()
{
DrawPlayBorder ();
DrawPlayBorder();
}
/*
......@@ -645,9 +645,9 @@ void DrawAllPlayBorder (void)
===================
*/
void DrawPlayBorder (void)
void DrawPlayBorder()
{
int xl,yl;
int xl, yl;
VW_Bar (0,0,320,200-STATUSLINES,127);
......@@ -662,8 +662,6 @@ void DrawPlayBorder (void)
VW_Plot (xl-1,yl+viewheight,124);
}
/*
===================
=
......@@ -674,7 +672,7 @@ void DrawPlayBorder (void)
void DrawPlayScreen()
{
VW_FadeOut ();
VW_FadeOut();
CA_CacheGrChunk(STATUSBARPIC);
......@@ -705,10 +703,10 @@ void DrawPlayScreen()
#define MAXDEMOSIZE 8192
void StartDemoRecord (int levelnumber)
void StartDemoRecord(int levelnumber)
{
MM_GetPtr (&demobuffer,MAXDEMOSIZE);
MM_SetLock (&demobuffer,true);
MM_GetPtr(&demobuffer,MAXDEMOSIZE);
MM_SetLock(&demobuffer,true);
demoptr = (char *)demobuffer;
lastdemoptr = demoptr+MAXDEMOSIZE;
......@@ -717,7 +715,6 @@ void StartDemoRecord (int levelnumber)
demorecord = true;
}
/*
==================
=
......@@ -728,9 +725,9 @@ void StartDemoRecord (int levelnumber)
char demoname[13] = "demo?.dem";
void FinishDemoRecord (void)
void FinishDemoRecord()
{
long length,level;
long length, level;
demorecord = false;
......@@ -770,7 +767,7 @@ void FinishDemoRecord (void)
==================
*/
void RecordDemo(void)
void RecordDemo()
{
int level,esc;
......@@ -902,29 +899,29 @@ int PlayDemoFromFile(char *demoname)
demoptr++;
lastdemoptr = demoptr-4+length;
VW_FadeOut ();
VW_FadeOut();
SETFONTCOLOR(0,15);
DrawPlayScreen ();
DrawPlayScreen();
VW_UpdateScreen(); /* force redraw */
VW_FadeIn ();
VW_FadeIn();
startgame = false;
demoplayback = true;
SetupGameLevel ();
StartMusic ();
SetupGameLevel();
StartMusic();
fizzlein = true;
PlayLoop ();
PlayLoop();
MM_FreePtr(&demobuffer);
demoplayback = false;
StopMusic ();
ClearMemory ();
StopMusic();
ClearMemory();
return 1;
}
......@@ -960,18 +957,15 @@ void Died()
}
fangle = atan2(dy,dx); // returns -pi to pi
if (fangle<0)
if (fangle < 0)
fangle = PI*2+fangle;
iangle = fangle/(PI*2)*ANGLES;
if (player->angle > iangle)
{
if (player->angle > iangle) {
counter = player->angle - iangle;
clockwise = ANGLES-player->angle + iangle;
}
else
{
} else {
clockwise = iangle - player->angle;
counter = player->angle + ANGLES-iangle;
}
......@@ -985,8 +979,7 @@ void Died()
//
if (curangle>iangle)
curangle -= ANGLES;
do
{
do {
change = tics*DEATHROTATE;
if (curangle + change > iangle)
change = iangle-curangle;
......@@ -996,8 +989,8 @@ void Died()
if (player->angle >= ANGLES)
player->angle -= ANGLES;
ThreeDRefresh ();
CalcTics ();
ThreeDRefresh();
CalcTics();
} while (curangle != iangle);
}
else
......
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