From 5dbcf7cdbc188a62be73c46d938ecfb53570bb9b Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 24 Oct 2007 06:48:13 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@581 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/editor.h | 2 +- polymer/build/src/build.c | 6 ++--- polymer/build/src/engine.c | 6 ++--- polymer/eduke32/Makefile | 24 ++--------------- polymer/eduke32/Makefile.deps | 1 - polymer/eduke32/Makefile.msvc | 15 +++-------- polymer/eduke32/Makefile.watcom | 6 ++--- polymer/eduke32/source/duke3d.h | 27 +++++++------------ polymer/eduke32/source/game.c | 7 ++++- polymer/eduke32/source/gamedef.c | 4 +-- polymer/eduke32/source/gameexec.c | 4 +-- polymer/eduke32/source/gamevars.c | 1 + polymer/eduke32/source/global.c | 4 +-- .../source/jaudiolib/audiolib_fx_fmod.c | 2 +- polymer/eduke32/source/mdump.cpp | 2 +- polymer/eduke32/source/premap.c | 4 +-- polymer/eduke32/source/sector.c | 4 +-- polymer/eduke32/source/sounds.c | 18 ++++++------- 18 files changed, 51 insertions(+), 86 deletions(-) diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index 1c1fc5824..bb5126228 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -61,7 +61,7 @@ void printmessage256(char name[82]); void printmessage16(char name[82]); void getpoint(long searchxe, long searchye, long *x, long *y); -short getpointhighlight(long xplc, long yplc); +long getpointhighlight(long xplc, long yplc); #ifdef __cplusplus } diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index fc1d7e124..fe7a9a9a1 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -181,7 +181,7 @@ void showwalldata(short wallnum); void showspritedata(short spritenum); long drawtilescreen(long pictopleft, long picbox); void overheadeditor(void); -short getlinehighlight(long xplc, long yplc); +long getlinehighlight(long xplc, long yplc); void fixspritesectors(void); long movewalls(long start, long offs); long loadnames(void); @@ -5941,7 +5941,7 @@ void getpoint(long searchxe, long searchye, long *x, long *y) if (*y >= editorgridextent) *y = editorgridextent; } -short getlinehighlight(long xplc, long yplc) +long getlinehighlight(long xplc, long yplc) { long i, dst, dist, closest, x1, y1, x2, y2, nx, ny; @@ -5973,7 +5973,7 @@ short getlinehighlight(long xplc, long yplc) return(closest); } -short getpointhighlight(long xplc, long yplc) +long getpointhighlight(long xplc, long yplc) { long i, dst, dist = 512, closest = -1; diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index deacb5175..e03116982 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -10842,7 +10842,7 @@ void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride) char pointsize; col = 6; pointsize=2; - if (i == pointhighlight || ((pointhighlight < MAXWALLS) && (wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y))) + if (i == pointhighlight || ((pointhighlight < MAXWALLS) && (pointhighlight >= 0) && (wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y))) { if (totalclock & 16) { @@ -10887,7 +10887,7 @@ void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride) } if (editstatus == 1) { - if (j+16384 == pointhighlight || ((pointhighlight-16384 < MAXSPRITES) && (sprite[j].x == sprite[pointhighlight-16384].x) && (sprite[j].y == sprite[pointhighlight-16384].y))) { + if ((pointhighlight-16384) > 0 && (j+16384 == pointhighlight || ((sprite[j].x == sprite[pointhighlight-16384].x) && (sprite[j].y == sprite[pointhighlight-16384].y)))) { if (totalclock & 32) col += (2<<2); } else if ((highlightcnt > 0) && (editstatus == 1)) @@ -11149,8 +11149,6 @@ void printext16(long xpos, long ypos, short col, short backcol, char *name, char long stx, i, x, y, charxsiz; char *fontptr, *letptr, *ptr; - if (!frameplace) return; - stx = xpos; if (fontsize) { fontptr = smalltextfont; charxsiz = 4; } diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 9d50ec43d..33e0e8e90 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -12,7 +12,6 @@ LINKED_GTK = 0 # Debugging options RELEASE?=1 -JFAUD?=0 NOSOUND?=0 # build locations @@ -38,13 +37,9 @@ CXX=g++ OURCFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration -Wno-unused \ -fno-pic -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -DNOCOPYPROTECT \ - -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib -I../jfaud/inc + -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(SRC)/jaudiolib OURCXXFLAGS=-fno-exceptions -fno-rtti LIBS=-lm -ifneq (0,$(JFAUD)) - JFAUDLIBS=../jfaud/libjfaud.a ../jfaud/mpadec/libmpadec.a - OURCFLAGS+=-DJFAUD -endif NASMFLAGS=-s #-g EXESUFFIX= @@ -86,8 +81,6 @@ AUDIOLIB_FX_SDL=$(OBJ)/mv_mix.$o \ $(OBJ)/multivoc.$o AUDIOLIB_MUSIC_SDL=$(OBJ)/sdlmusic.$o -AUDIOLIB_JFAUD=$(OBJ)/jfaud_sounds.$o - AUDIOLIB_FX=$(OBJ)/mv_mix.$o \ $(OBJ)/mv_mix16.$o \ $(OBJ)/mvreverb.$o \ @@ -134,16 +127,12 @@ endif ifeq ($(RENDERTYPE),SDL) OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell sdl-config --cflags)) - ifneq (0,$(JFAUD)) - AUDIOLIBOBJ=$(AUDIOLIB_JFAUD) - else ifneq ($(PLATFORM),WINDOWS) AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_SDL) $(AUDIOLIB_FX_SDL) $(OBJ)/sounds.$o LIBS+= -lSDL_mixer else AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_STUB) $(AUDIOLIB_FX_STUB) $(OBJ)/sounds.$o endif - endif ifeq (1,$(HAVE_GTK2)) OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) @@ -156,11 +145,7 @@ ifeq ($(RENDERTYPE),SDL) endif ifeq ($(RENDERTYPE),WIN) - ifneq (0,$(JFAUD)) - AUDIOLIBOBJ=$(AUDIOLIB_JFAUD) - else AUDIOLIBOBJ=$(AUDIOLIB_MUSIC) $(AUDIOLIB_FX) $(OBJ)/sounds.$o - endif endif ifeq ($(NOSOUND),1) @@ -194,7 +179,7 @@ all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) endif eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) - $(CC) -o $@ $^ $(JFAUDLIBS) $(LIBS) $(STDCPPLIB) # -Wl,-Map=$@.map + $(CC) -o $@ $^ $(LIBS) $(STDCPPLIB) # -Wl,-Map=$@.map -rm -f eduke32.sym$(EXESUFFIX) cp eduke32$(EXESUFFIX) eduke32.sym$(EXESUFFIX) strip eduke32$(EXESUFFIX) @@ -237,13 +222,8 @@ $(OBJ)/%.$o: $(SRC)/jmact/%.c $(OBJ)/%.$o: $(SRC)/jaudiolib/%.c $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 -ifeq (1,$(JFAUD)) -$(OBJ)/%.$o: $(SRC)/misc/%.rc - windres -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) -DJFAUD -else $(OBJ)/%.$o: $(SRC)/misc/%.rc windres -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) -endif $(OBJ)/%.$o: $(SRC)/util/%.c $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 diff --git a/polymer/eduke32/Makefile.deps b/polymer/eduke32/Makefile.deps index e1d99887a..91ad054a6 100644 --- a/polymer/eduke32/Makefile.deps +++ b/polymer/eduke32/Makefile.deps @@ -16,7 +16,6 @@ $(OBJ)/premap.$o: $(SRC)/premap.c $(duke3d_h) $(EINC)/osd.h $(OBJ)/savegame.$o: $(SRC)/savegame.c $(duke3d_h) $(OBJ)/sector.$o: $(SRC)/sector.c $(duke3d_h) $(OBJ)/sounds.$o: $(SRC)/sounds.c $(duke3d_h) -$(OBJ)/jfaud_sounds.$o: $(SRC)/jfaud_sounds.cpp $(duke3d_h) $(EINC)/osd.h $(OBJ)/rts.$o: $(SRC)/rts.c $(duke3d_h) $(OBJ)/config.$o: $(SRC)/config.c $(duke3d_h) $(SRC)/jmact/scriplib.h $(INC)/_functio.h $(OBJ)/testcd.$o: $(SRC)/testcd.c diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index d9f2be940..c470196da 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -1,10 +1,10 @@ # EDuke32 Makefile for Microsoft NMake SRC=source -OBJ=obj +OBJ=obj_win EROOT=..\build EINC=$(EROOT)\include -EOBJ=eobj +EOBJ=eobj_win INC=$(SRC) RSRC=rsrc o=obj @@ -34,16 +34,12 @@ AS=ml LINK=link /opt:nowin98 /nologo /opt:ref MT=mt CFLAGS= /MD /J /nologo $(flags_cl) \ - /I$(INC) /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\jaudiolib /I..\jfaud\inc /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \ + /I$(INC) /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\jaudiolib /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \ /DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W0 $(ENGINEOPTS) \ /I$(DXROOT)\include /DRENDERTYPEWIN=1 LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \ /NODEFAULTLIB:libFLAC.lib glu32.lib -!ifdef JFAUD -LIBS=$(LIBS) ../jfaud/jfaud.lib ../jfaud/mpadec/mpadec.lib -CFLAGS=$(CFLAGS) /DJFAUD -!endif ASFLAGS=/nologo /coff ASFLAGS=/nologo /coff @@ -60,7 +56,6 @@ JMACTOBJ=$(OBJ)\util_lib.$o \ AUDIOLIB_FX_STUB=$(OBJ)\jaudiolib_fxstub.$o AUDIOLIB_MUSIC_STUB=$(OBJ)\jaudiolib_musicstub.$o #AUDIOLIB_FX=$(OBJ)\jaudiolib_fx_fmod.$o -AUDIOLIB_JFAUD=$(OBJ)\jfaud_sounds.$o AUDIOLIB_FX=$(OBJ)\mv_mix.$o \ $(OBJ)\mv_mix16.$o \ $(OBJ)\mvreverb.$o \ @@ -73,11 +68,7 @@ AUDIOLIB_MUSIC=$(OBJ)\midi.$o \ $(OBJ)\mpu401.$o \ $(OBJ)\music.$o -!ifdef JFAUD -AUDIOLIBOBJ=$(AUDIOLIB_JFAUD) -!else AUDIOLIBOBJ=$(AUDIOLIB_MUSIC) $(AUDIOLIB_FX) $(OBJ)\sounds.$o -!endif GAMEOBJS=$(OBJ)\game.$o \ $(OBJ)\actors.$o \ diff --git a/polymer/eduke32/Makefile.watcom b/polymer/eduke32/Makefile.watcom index 683e83a82..a383a59e4 100644 --- a/polymer/eduke32/Makefile.watcom +++ b/polymer/eduke32/Makefile.watcom @@ -23,8 +23,8 @@ CC=wcc386 CXX=wpp386 CFLAGS= -zq -5r -s -orb -fp5 -d2 -db & -i=$(INC) -i=$(EINC) -i=$(SRC)\jmact -i=$(SRC)\jaudiolib -i=$(DXROOT)\include & - -dRENDERTYPEWIN=1 -dNOCOPYPROTECT $(ENGINEOPTS) -i=..\jfaud\inc -LIBS=wsock32.lib dxguid.lib ..\jfaud\jfaud.lib winmm.lib #opengl32.lib + -dRENDERTYPEWIN=1 -dNOCOPYPROTECT $(ENGINEOPTS) +LIBS=wsock32.lib dxguid.lib winmm.lib #opengl32.lib WASMFLAGS=-d1 EXESUFFIX=.exe @@ -38,7 +38,6 @@ JMACTOBJ=$(OBJ)\util_lib.$o & JAUDIOLIB_FX_STUB=$(OBJ)\jaudiolib_fxstub.$o JAUDIOLIB_MUSIC_STUB=$(OBJ)\jaudiolib_musicstub.$o -JAUDIOLIB_JFAUD=$(OBJ)\jfaud_sounds.$o JAUDIOLIB_FX=$(OBJ)\mv_mix.$o & $(OBJ)\mv_mix16.$o & $(OBJ)\mvreverb.$o & @@ -52,7 +51,6 @@ JAUDIOLIB_MUSIC=$(OBJ)\midi.$o & $(OBJ)\music.$o #JAUDIOLIBOBJ=$(JAUDIOLIB_MUSIC) $(JAUDIOLIB_FX) $(OBJ)\sounds.$o #JAUDIOLIBOBJ=$(JAUDIOLIB_MUSIC_STUB) $(JAUDIOLIB_FX_STUB) $(OBJ)\sounds.$o -JAUDIOLIBOBJ=$(JAUDIOLIB_JFAUD) GAMEOBJS=$(OBJ)\game.$o & $(OBJ)\actors.$o & diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 7142845e9..7fd7145d4 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -106,7 +106,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType; // #define GC (TICSPERFRAME*44) -#define NUM_SOUNDS 1536 +#define MAXSOUNDS 1536 /* #pragma aux sgn =\ @@ -123,10 +123,6 @@ extern int g_ScriptVersion, g_Shareware, g_GameType; #define PHEIGHT (38<<8) -// #define P(X) printf("%ld\n",X); - -#define WAIT(X) ototalclock=totalclock+(X);while(totalclock>8)>=(255-(X))) -typedef struct { - short i; - int voice; -} SOUNDOWNER; - #define __USRHOOKS_H enum USRHOOKS_Errors { @@ -309,6 +300,11 @@ extern input recsync[RECSYNCBUFSIZ]; extern long movefifosendplc; +typedef struct { + short i; + int voice; +} SOUNDOWNER; + typedef struct { char *ptr; volatile char lock; @@ -320,6 +316,8 @@ typedef struct { long soundsiz; } sound_t; +extern sound_t g_sounds[MAXSOUNDS]; + typedef struct { short wallnum; long tag; @@ -442,7 +440,7 @@ typedef struct { typedef struct { long ox,oy,oz; short oa,os; -} player_spawnpoint; +} playerspawn_t; extern char numplayersprites; @@ -525,11 +523,6 @@ extern char buf[1024]; //My own generic input buffer extern char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES]; extern char ready2send; -//extern fx_device device; -extern sound_t g_sounds[ NUM_SOUNDS ]; - -// extern char sounds[NUM_SOUNDS][BMAX_PATH]; - // JBF 20040531: adding 16 extra to the script so we have some leeway // to (hopefully) safely abort when hitting the limit extern long *script,*scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; @@ -986,7 +979,7 @@ typedef struct { } playerdata_t; extern input inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; -extern player_spawnpoint g_PlayerSpawnPoints[MAXPLAYERS]; +extern playerspawn_t g_PlayerSpawnPoints[MAXPLAYERS]; extern playerdata_t g_player[MAXPLAYERS]; #include "funct.h" diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 4d5e4c54d..55554345b 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9296,7 +9296,7 @@ static void freeconmem(void) Bfree(g_player[i].sync); } - for (i=NUM_SOUNDS-1;i>=0;i--) + for (i=MAXSOUNDS-1;i>=0;i--) { if (g_sounds[i].filename != NULL) Bfree(g_sounds[i].filename); @@ -10546,6 +10546,11 @@ static int opendemoread(int which_demo) // 0 = mine for (i=0;iaim_mode,sizeof(int32)) != sizeof(int32)) goto corrupt; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index b11ab10d1..3fcba10ae 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -4361,9 +4361,9 @@ repeatcase: scriptptr--; transnum(LABEL_DEFINE); k = *(scriptptr-1); - if (k >= NUM_SOUNDS) + if (k >= MAXSOUNDS) { - initprintf("%s:%ld: error: exceeded sound limit of %ld.\n",compilefile,line_number,NUM_SOUNDS); + initprintf("%s:%ld: error: exceeded sound limit of %ld.\n",compilefile,line_number,MAXSOUNDS); error++; } scriptptr--; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 0077dce4b..acced587b 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -6428,11 +6428,11 @@ static int parse(void) break; case CON_IFNOSOUNDS: - for (j=1;j LPCSTR MiniDumper::m_szAppName; -// MiniDumper g_dumper("EDuke32"); +MiniDumper g_dumper("eduke32"); MiniDumper::MiniDumper( LPCSTR szAppName ) { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 4d45c3866..c4a12f057 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -275,7 +275,7 @@ static int getsound(unsigned int num) short fp; long l; - if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0; + if (num >= MAXSOUNDS || ud.config.SoundToggle == 0) return 0; if (ud.config.FXDevice < 0) return 0; if (!g_sounds[num].filename) return 0; @@ -304,7 +304,7 @@ static void precachenecessarysounds(void) if (ud.config.FXDevice < 0) return; j = 0; - for (i=0;i= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0; + if (num >= MAXSOUNDS || ud.config.SoundToggle == 0) return 0; if (ud.config.FXDevice < 0) return 0; fp = kopen4load(g_sounds[num].filename,loadfromgrouponly); if (fp == -1) { -// Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num); +// Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num); // FTA(113,g_player[myconnectindex].ps); - initprintf("Sound %s(#%d) not found.\n",g_sounds[num].filename,num); + OSD_Printf("Sound %s(#%d) not found.\n",g_sounds[num].filename,num); return 0; } @@ -261,7 +261,7 @@ int xyzsound(int num,int i,long x,long y,long z) // if(num != 358) return 0; - if (num >= NUM_SOUNDS || + if (num >= MAXSOUNDS || ud.config.FXDevice < 0 || ((g_sounds[num].m&8) && ud.lockout) || ud.config.SoundToggle == 0 || @@ -282,7 +282,7 @@ int xyzsound(int num,int i,long x,long y,long z) return -1; else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && ud.config.VoiceToggle!=2) return -1; - for (j=0;j 0) && (g_sounds[j].m&4)) return -1; @@ -414,7 +414,7 @@ void sound(int num) if (ud.config.VoiceToggle==0 && (g_sounds[num].m&4)) return; if ((g_sounds[num].m&8) && ud.lockout) return; if (FX_VoiceAvailable(g_sounds[num].pr) == 0) return; - if (num > NUM_SOUNDS-1 || !g_sounds[num].filename) + if (num > MAXSOUNDS-1 || !g_sounds[num].filename) { OSD_Printf("WARNING: invalid sound #%d\n",num); return; @@ -472,7 +472,7 @@ void sound(int num) int spritesound(unsigned int num, int i) { - if (num >= NUM_SOUNDS) return -1; + if (num >= MAXSOUNDS) return -1; return xyzsound(num,i,SX,SY,SZ); } @@ -530,7 +530,7 @@ void pan3dsound(void) ca = sprite[ud.camerasprite].ang; } - for (j=0;j= 200) g_sounds[i].lock = 199;