doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

commit 12fc819c1401de85bea91aa143c4259006e50fbf
parent 5791c4d6cf6bf639083cf29256f673054c4bb345
Author: ssnf <ssnf@ssnf.xyz>
Date:   Thu, 17 Jun 2021 01:39:16 +0000

delete the rest of the comments

Diffstat:
Msndserv/linux.c | 66+++++++++++++++++++++++++++++++++---------------------------------
Msndserv/sounds.c | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msndserv/sounds.h | 80++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msndserv/soundsrv.c | 216++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msndserv/soundsrv.h | 66+++++++++++++++++++++++++++++++++---------------------------------
Msndserv/soundst.h | 216++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msndserv/wadread.c | 94++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msndserv/wadread.h | 96++++++++++++++++++++++++++++++++++++++++----------------------------------------
8 files changed, 458 insertions(+), 458 deletions(-)

diff --git a/sndserv/linux.c b/sndserv/linux.c @@ -1,36 +1,36 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: linux.c,v 1.3 1997/01/26 07:45:01 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: linux.c,v $ -// Revision 1.3 1997/01/26 07:45:01 b1 -// 2nd formatting run, fixed a few warnings as well. -// -// Revision 1.2 1997/01/21 19:00:01 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:45 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// UNIX, soundserver for Linux i386. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static const char rcsid[] = "$Id: linux.c,v 1.3 1997/01/26 07:45:01 b1 Exp $"; diff --git a/sndserv/sounds.c b/sndserv/sounds.c @@ -1,51 +1,51 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: sounds.c,v 1.3 1997/01/29 22:40:44 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: sounds.c,v $ -// Revision 1.3 1997/01/29 22:40:44 b1 -// Reformatting, S (sound) module files. -// -// Revision 1.2 1997/01/21 19:00:07 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:50 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// Created by Dave Taylor's sound utility. -// Kept as a sample, DOOM sounds. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static const char rcsid[] = "$Id: sounds.c,v 1.3 1997/01/29 22:40:44 b1 Exp $"; -// Not exactly a good idea. + enum { false, true }; #include "sounds.h" -// -// Information about all the music -// + + + musicinfo_t S_music[] = { @@ -120,9 +120,9 @@ musicinfo_t S_music[] = }; -// -// Information about all the sfx -// + + + sfxinfo_t S_sfx[] = { diff --git a/sndserv/sounds.h b/sndserv/sounds.h @@ -1,46 +1,46 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: sounds.h,v 1.3 1997/01/29 22:40:44 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: sounds.h,v $ -// Revision 1.3 1997/01/29 22:40:44 b1 -// Reformatting, S (sound) module files. -// -// Revision 1.2 1997/01/21 19:00:07 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:50 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// Created by Dave Taylor's sound utility. -// Kept as a sample, DOOM sounds. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ifndef __SOUNDSH__ #define __SOUNDSH__ #include "soundst.h" -// -// Identifiers for all music in game. -// + + + typedef enum { @@ -116,9 +116,9 @@ typedef enum } musicenum_t; -// -// Identifiers for all sfx in game. -// + + + typedef enum { diff --git a/sndserv/soundsrv.c b/sndserv/soundsrv.c @@ -1,39 +1,39 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: soundsrv.c,v 1.3 1997/01/29 22:40:44 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: soundsrv.c,v $ -// Revision 1.3 1997/01/29 22:40:44 b1 -// Reformatting, S (sound) module files. -// -// Revision 1.2 1997/01/21 19:00:07 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:50 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// UNIX soundserver, run as a separate process, -// started by DOOM program. -// Originally conceived fopr SGI Irix, -// mostly used with Linux voxware. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static const char rcsid[] = "$Id: soundsrv.c,v 1.3 1997/01/29 22:40:44 b1 Exp $"; @@ -57,12 +57,12 @@ static const char rcsid[] = "$Id: soundsrv.c,v 1.3 1997/01/29 22:40:44 b1 Exp $" -// -// Department of Redundancy Department. -// + + + typedef struct wadinfo_struct { - // should be IWAD + char identification[4]; int numlumps; int infotableofs; @@ -79,52 +79,52 @@ typedef struct filelump_struct } filelump_t; -// an internal time keeper + static int mytime = 0; -// number of sound effects + int numsounds; -// longest sound effect + int longsound; -// lengths of all sound effects + int lengths[NUMSFX]; -// mixing buffer + signed short mixbuffer[MIXBUFFERSIZE]; -// file descriptor of sfx device + int sfxdevice; -// file descriptor of music device + int musdevice; -// the channel data pointers + unsigned char* channels[8]; -// the channel step amount + unsigned int channelstep[8]; -// 0.16 bit remainder of last step + unsigned int channelstepremainder[8]; -// the channel data end pointers + unsigned char* channelsend[8]; -// time that the channel started playing + int channelstart[8]; -// the channel handles + int channelhandles[8]; -// the channel left volume lookup + int* channelleftvol_lookup[8]; -// the channel right volume lookup + int* channelrightvol_lookup[8]; -// sfx id of the playing sound effect + int channelids[8]; int snd_verbose=1; @@ -158,7 +158,7 @@ int mix(void) leftend = mixbuffer + SAMPLECOUNT*step; - // mix into the mixing buffer + while (leftout != leftend) { @@ -268,14 +268,14 @@ int mix(void) channels[7] = 0; } - // Has been char instead of short. - // if (dl > 127) *leftout = 127; - // else if (dl < -128) *leftout = -128; - // else *leftout = dl; + + + + - // if (dr > 127) *rightout = 127; - // else if (dr < -128) *rightout = -128; - // else *rightout = dr; + + + if (dl > 0x7fff) *leftout = 0x7fff; @@ -310,9 +310,9 @@ grabdata(int argc, char** argv) char* doomuwad; char* doom2wad; char* doom2fwad; - // Now where are TNT and Plutonia. Yuck. - // char *home; + + char* doomwaddir; doomwaddir = getenv("DOOMWADDIR"); @@ -335,10 +335,10 @@ grabdata(int argc, char** argv) doomwad = malloc(strlen(doomwaddir)+1+8+1); sprintf(doomwad, "%s/doom.wad", doomwaddir); - // home = getenv("HOME"); - // if (!home) - // derror("Please set $HOME to your home directory"); - // sprintf(basedefault, "%s/.doomrc", home); + + + + for (i=1 ; i<argc ; i++) @@ -362,10 +362,10 @@ grabdata(int argc, char** argv) name = doomwad; else if (! access(doom1wad, R_OK) ) name = doom1wad; - // else if (! access(DEVDATA "doom2.wad", R_OK) ) - // name = DEVDATA "doom2.wad"; - // else if (! access(DEVDATA "doom.wad", R_OK) ) - // name = DEVDATA "doom.wad"; + + + + else { fprintf(stderr, "Could not find wadfile anywhere\n"); @@ -387,21 +387,21 @@ grabdata(int argc, char** argv) S_sfx[i].data = S_sfx[i].link->data; lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)]; } - // test only - // { - // int fd; - // char name[10]; - // sprintf(name, "sfx%d", i); - // fd = open(name, O_WRONLY|O_CREAT, 0644); - // write(fd, S_sfx[i].data, lengths[i]); - // close(fd); - // } + + + + + + + + + } } static struct timeval last={0,0}; -//static struct timeval now; + static struct timezone whocares; @@ -431,8 +431,8 @@ addsfx int rightvol; int leftvol; - // play these sound effects - // only one at a time + + if ( sfxid == sfx_sawup || sfxid == sfx_sawidl || sfxid == sfx_sawful @@ -475,28 +475,28 @@ addsfx channelstepremainder[slot] = 0; channelstart[slot] = mytime; - // (range: 1 - 256) + seperation += 1; - // (x^2 seperation) + leftvol = volume - (volume*seperation*seperation)/(256*256); seperation = seperation - 257; - // (x^2 seperation) + rightvol = volume - (volume*seperation*seperation)/(256*256); - // sanity check + if (rightvol < 0 || rightvol > 127) derror("rightvol out of bounds"); if (leftvol < 0 || leftvol > 127) derror("leftvol out of bounds"); - // get the proper lookup table piece - // for this volume level + + channelleftvol_lookup[slot] = &vol_lookup[leftvol*256]; channelrightvol_lookup[slot] = &vol_lookup[rightvol*256]; @@ -513,7 +513,7 @@ void outputushort(int num) static unsigned char buff[5] = { 0, 0, 0, 0, '\n' }; static char* badbuff = "xxxx\n"; - // outputs a 16-bit # in hex or "xxxx" if -1. + if (num < 0) { write(1, badbuff, 5); @@ -552,12 +552,12 @@ void initdata(void) for (i=-128 ; i<128 ; i++) steptablemid[i] = pow(2.0, (i/64.0))*65536.0; - // generates volume lookup tables - // which also turn the unsigned samples - // into signed samples - // for (i=0 ; i<128 ; i++) - // for (j=0 ; j<256 ; j++) - // vol_lookup[i*256+j] = (i*(j-128))/127; + + + + + + for (i=0 ; i<128 ; i++) for (j=0 ; j<256 ; j++) @@ -601,10 +601,10 @@ main(int argc, char** argv) int i; int waitingtofinish=0; - // get sound data + grabdata(argc, argv); - // init any data + initdata(); I_InitSound(11025, 16); @@ -614,7 +614,7 @@ main(int argc, char** argv) if (snd_verbose) fprintf(stderr, "ready\n"); - // parse commands and play sounds until done + FD_ZERO(&fdset); FD_SET(0, &fdset); @@ -630,8 +630,8 @@ main(int argc, char** argv) if (rc > 0) { - // fprintf(stderr, "select is true\n"); - // got a command + + nrc = read(0, commandbuf, 1); if (!nrc) @@ -647,7 +647,7 @@ main(int argc, char** argv) switch (commandbuf[0]) { case 'p': - // play a new sound effect + read(0, commandbuf, 9); if (snd_verbose) @@ -673,7 +673,7 @@ main(int argc, char** argv) commandbuf[7] -= commandbuf[7]>='a' ? 'a'-10 : '0'; - // p<snd#><step><vol><sep> + sndnum = (commandbuf[0]<<4) + commandbuf[1]; step = (commandbuf[2]<<4) + commandbuf[3]; step = steptable[step]; @@ -681,8 +681,8 @@ main(int argc, char** argv) sep = (commandbuf[6]<<4) + commandbuf[7]; handle = addsfx(sndnum, vol, step, sep); - // returns the handle - // outputushort(handle); + + break; case 'q': diff --git a/sndserv/soundsrv.h b/sndserv/soundsrv.h @@ -1,36 +1,36 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: soundsrv.h,v 1.3 1997/01/29 22:40:44 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: soundsrv.h,v $ -// Revision 1.3 1997/01/29 22:40:44 b1 -// Reformatting, S (sound) module files. -// -// Revision 1.2 1997/01/21 19:00:07 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:50 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// UNIX soundserver, separate process. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ifndef __SNDSERVER_H__ #define __SNDSERVER_H__ diff --git a/sndserv/soundst.h b/sndserv/soundst.h @@ -1,48 +1,48 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: soundst.h,v 1.3 1997/01/29 22:40:45 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: soundst.h,v $ -// Revision 1.3 1997/01/29 22:40:45 b1 -// Reformatting, S (sound) module files. -// -// Revision 1.2 1997/01/21 19:00:07 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:50 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// Sound (utility) related. Hang on. -// See gensounds.h and gensounds.c for what soundst.h is made of. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ifndef __SOUNDSTH__ #define __SOUNDSTH__ #define S_MAX_VOLUME 127 -// when to clip out sounds -// Doesn't fit the large outdoor areas. + + #define S_CLIPPING_DIST (1200*0x10000) -// when sounds should be max'd out + #define S_CLOSE_DIST (200*0x10000) @@ -56,7 +56,7 @@ #define NORM_SEP 128 #define S_STEREO_SWING (96*0x10000) -// % attenuation from front to back + #define S_IFRACVOL 30 #define NA 0 @@ -65,61 +65,61 @@ -// -// MusicInfo struct. -// + + + typedef struct { - // up to 6-character name + char* name; - // lump number of music + int lumpnum; - // music data + void* data; - // music handle once registered + int handle; } musicinfo_t; -// -// SoundFX struct. -// + + + typedef struct sfxinfo_struct sfxinfo_t; struct sfxinfo_struct { - // up to 6-character name + char* name; - // Sfx singularity (only one at a time) + int singularity; - // Sfx priority + int priority; - // referenced sound if a link + sfxinfo_t* link; - // pitch if a link + int pitch; - // volume if a link + int volume; - // sound data + void* data; - // this is checked every second to see if sound - // can be thrown out (if 0, then decrement, if -1, - // then throw out, if > 0, then it's in use) + + + int usefulness; - // lump number of sfx + int lumpnum; }; @@ -127,13 +127,13 @@ struct sfxinfo_struct typedef struct { - // sound information (if null, channel avail.) + sfxinfo_t* sfxinfo; - // origin of sound + void* origin; - // handle of the sound being played + int handle; } channel_t; @@ -153,7 +153,7 @@ enum Adlib=2, SB=4, Midi=8 -}; // cards available +}; enum { @@ -162,15 +162,15 @@ enum }; -// -// Initialize the sound code at start of level -// + + + void S_Start(void); -// -// Start sound for thing at <origin> -// using <sound_id> from sounds.h -// + + + + extern void S_StartSound ( void* origin, @@ -178,7 +178,7 @@ S_StartSound -// Will start a sound at a given volume. + extern void S_StartSoundAtVolume ( void* origin, @@ -186,38 +186,38 @@ S_StartSoundAtVolume int volume ); -// Stop sound for thing at <origin> + extern void S_StopSound(void* origin); -// Start music using <music_id> from sounds.h + extern void S_StartMusic(int music_id); -// Start music using <music_id> from sounds.h, -// and set whether looping + + extern void S_ChangeMusic ( int music_id, int looping ); -// Stops the music + extern void S_StopMusic(void); void S_PauseSound(void); void S_ResumeSound(void); -// -// Updates music & sounds -// + + + extern void S_UpdateSounds(void* listener); void S_SetMusicVolume(int volume); void S_SetSfxVolume(int volume); -// -// Initializes sound stuff, including volume -// + + + void S_Init ( int , @@ -225,9 +225,9 @@ S_Init -// -// SOUND IO -// + + + #define FREQ_LOW 0x40 #define FREQ_NORM 0x80 #define FREQ_HIGH 0xff @@ -236,45 +236,45 @@ S_Init void I_SetMusicVolume(int volume); void I_SetSfxVolume(int volume); -// -// MUSIC I/O -// + + + void I_PauseSong(int handle); void I_ResumeSong(int handle); -// -// Called by anything that wishes to start music. -// plays a song, and when the song is done, -// starts playing it again in an endless loop. -// Horrible thing to do, considering. + + + + + void I_PlaySong ( int handle, int looping ); -// stops a song over 3 seconds. + void I_StopSong(int handle); -// registers a song handle to song data + int I_RegisterSong(void *data); -// see above then think backwards + void I_UnRegisterSong(int handle); -// is the song playing? + int I_QrySongPlaying(int handle); -// -// SFX I/O -// + + + void I_SetChannels(int channels); int I_GetSfxLumpNum (sfxinfo_t*); -// Starts a sound in a particular sound channel. + int I_StartSound ( int id, @@ -285,8 +285,8 @@ I_StartSound int priority ); -// Updates the volume, separation, -// and pitch of a sound channel. + + void I_UpdateSoundParams ( int handle, @@ -295,18 +295,18 @@ I_UpdateSoundParams int pitch ); -// Stops a sound channel. + void I_StopSound(int handle); -// Called by S_*()'s to see if a channel is still playing. -// Returns 0 if no longer playing, 1 if playing. + + int I_SoundIsPlaying(int handle); -// the complete set of sound effects + extern sfxinfo_t S_sfx[]; -// the complete set of music + extern musicinfo_t S_music[]; #endif diff --git a/sndserv/wadread.c b/sndserv/wadread.c @@ -1,38 +1,38 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: wadread.c,v 1.3 1997/01/30 19:54:23 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: wadread.c,v $ -// Revision 1.3 1997/01/30 19:54:23 b1 -// Final reformatting run. All the remains (ST, W, WI, Z). -// -// Revision 1.2 1997/01/21 19:00:10 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:51 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// WAD and Lump I/O, the second. -// This time for soundserver only. -// Welcome to Department of Redundancy Department. Again :-). -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static const char rcsid[] = "$Id: wadread.c,v 1.3 1997/01/30 19:54:23 b1 Exp $"; @@ -90,10 +90,10 @@ void** lumpcache; #define strcmpi strcasecmp -// -// Something new. -// This version of w_wad.c does handle endianess. -// + + + + #ifndef __BIG_ENDIAN__ #define LONG(x) (x) @@ -123,7 +123,7 @@ unsigned short SwapSHORT(unsigned short x) -// Way too many of those... + static void derror(char* msg) { fprintf(stderr, "\nwadread error: %s\n", msg); @@ -160,7 +160,7 @@ void openwad(char* wadname) wadinfo_t header; filelump_t* filetable; - // open and read the wadfile header + wadfile = open(wadname, O_RDONLY); if (wadfile < 0) @@ -178,18 +178,18 @@ void openwad(char* wadname) lumpinfo = (lumpinfo_t *) malloc(tablelength); filetable = (filelump_t *) ((char*)lumpinfo + tablelength - tablefilelength); - // get the lumpinfo table + lseek(wadfile, tableoffset, SEEK_SET); read(wadfile, filetable, tablefilelength); - // process the table to make the endianness right and shift it down + for (i=0 ; i<numlumps ; i++) { strncpy(lumpinfo[i].name, filetable[i].name, 8); lumpinfo[i].handle = wadfile; lumpinfo[i].filepos = LONG(filetable[i].filepos); lumpinfo[i].size = LONG(filetable[i].size); - // fprintf(stderr, "lump [%.8s] exists\n", lumpinfo[i].name); + } } @@ -211,8 +211,8 @@ loadlump if (i == numlumps) { - // fprintf(stderr, - // "Could not find lumpname [%s]\n", lumpname); + + lump = 0; } else @@ -244,7 +244,7 @@ getsfx sfx = (unsigned char *) loadlump(name, &size); - // pad the sound effect out to the mixing buffer size + paddedsize = ((size-8 + (SAMPLECOUNT-1)) / SAMPLECOUNT) * SAMPLECOUNT; paddedsfx = (unsigned char *) realloc(sfx, paddedsize+8); for (i=size ; i<paddedsize+8 ; i++) diff --git a/sndserv/wadread.h b/sndserv/wadread.h @@ -1,58 +1,58 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id: wadread.h,v 1.3 1997/01/30 19:54:23 b1 Exp $ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// -// $Log: wadread.h,v $ -// Revision 1.3 1997/01/30 19:54:23 b1 -// Final reformatting run. All the remains (ST, W, WI, Z). -// -// Revision 1.2 1997/01/21 19:00:10 b1 -// First formatting run: -// using Emacs cc-mode.el indentation for C++ now. -// -// Revision 1.1 1997/01/19 17:22:52 b1 -// Initial check in DOOM sources as of Jan. 10th, 1997 -// -// -// DESCRIPTION: -// WAD and Lump I/O, the second. -// This time for soundserver only. -// Welcome to Department of Redundancy Department. -// (Yeah, I said that elsewhere already). -// Note: makes up for a nice w_wad.h. -// -//----------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ifndef __WADREAD_H__ #define __WADREAD_H__ -// -// Opens the wadfile specified. -// Must be called before any calls to loadlump() or getsfx(). -// + + + + void openwad(char* wadname); -// -// Gets a sound effect from the wad file. The pointer points to the -// start of the data. Returns a 0 if the sfx was not -// found. Sfx names should be no longer than 6 characters. All data is -// rounded up in size to the nearest MIXBUFFERSIZE and is padded out with -// 0x80's. Returns the data length in len. -// + + + + + + + void* getsfx