From cf4473c4d770aba4e9ee7d891763c683096b0285 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 28 Jul 2014 06:45:18 +0000 Subject: [PATCH] Move implementation details of Mapster32's sound system from m32exec.c into sounds_mapster32.c, and set up a sound system stub in KenBuild Editor. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4563 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/m32exec.c | 17 +++++------------ polymer/eduke32/source/sounds_mapster32.c | 20 ++++++++++++++++++++ polymer/eduke32/source/sounds_mapster32.h | 3 +++ polymer/eduke32/source/testgame/src/bstub.c | 11 +++++++++++ 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index d15240727..c628994fa 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -2943,7 +2943,7 @@ dodefault: insptr++; { int32_t j=Gv_GetVarX(*insptr); - if (j<0 || j>=MAXSOUNDS) + if (S_InvalidSound(j)) { M32_ERROR("Invalid sound %d", j); insptr++; @@ -2954,14 +2954,7 @@ dodefault: continue; case CON_IFNOSOUNDS: - { - int32_t j = MAXSOUNDS-1; - for (; j>=0; j--) - if (g_sounds[j].SoundOwner[0].ow == vm.g_i) - break; - - VM_DoConditional(j < 0); - } + VM_DoConditional(S_SoundsPlaying(vm.g_i) < 0); continue; case CON_IFIN3DMODE: @@ -2986,14 +2979,14 @@ dodefault: insptr++; { int32_t j=Gv_GetVarX(*insptr++), var=*insptr++; - if (j<0 || j>=MAXSOUNDS) + if (S_InvalidSound(j)) { M32_ERROR("Invalid sound %d", j); insptr++; continue; } - Gv_SetVarX(var, g_sounds[j].m); + Gv_SetVarX(var, S_SoundFlags(j)); } continue; @@ -3005,7 +2998,7 @@ dodefault: { int32_t j=Gv_GetVarX(*insptr++); - if (j<0 || j>=MAXSOUNDS) + if (S_InvalidSound(j)) { M32_ERROR("Invalid sound %d", j); continue; diff --git a/polymer/eduke32/source/sounds_mapster32.c b/polymer/eduke32/source/sounds_mapster32.c index b8e8348b2..0ea9675db 100644 --- a/polymer/eduke32/source/sounds_mapster32.c +++ b/polymer/eduke32/source/sounds_mapster32.c @@ -505,3 +505,23 @@ int32_t S_CheckSoundPlaying(int32_t i, int32_t num) } return(g_sounds[num].num); } + +int32_t S_SoundsPlaying(int32_t i) +{ + int32_t j = MAXSOUNDS-1; + for (; j>=0; j--) + if (g_sounds[j].SoundOwner[0].ow == i) + break; + + return j; +} + +int32_t S_InvalidSound(int32_t num) +{ + return (unsigned) num >= MAXSOUNDS; +} + +int32_t S_SoundFlags(int32_t num) +{ + return g_sounds[num].m; +} diff --git a/polymer/eduke32/source/sounds_mapster32.h b/polymer/eduke32/source/sounds_mapster32.h index 278183daf..21f05d044 100644 --- a/polymer/eduke32/source/sounds_mapster32.h +++ b/polymer/eduke32/source/sounds_mapster32.h @@ -61,6 +61,9 @@ void S_Update(void); int32_t A_CheckSoundPlaying(int32_t i, int32_t num); int32_t S_CheckSoundPlaying(int32_t i, int32_t num); void S_ClearSoundLocks(void); +int32_t S_SoundsPlaying(int32_t i); +int32_t S_InvalidSound(int32_t num); +int32_t S_SoundFlags(int32_t num); #pragma pack(pop) diff --git a/polymer/eduke32/source/testgame/src/bstub.c b/polymer/eduke32/source/testgame/src/bstub.c index 44c170b72..2cf2cca1b 100644 --- a/polymer/eduke32/source/testgame/src/bstub.c +++ b/polymer/eduke32/source/testgame/src/bstub.c @@ -642,6 +642,17 @@ int32_t taglab_getnextfreetag(int32_t *duetoptr) return 0; } +int32_t S_InvalidSound(int32_t num) { UNREFERENCED_PARAMETER(num); return 1; }; +int32_t S_CheckSoundPlaying(int32_t i, int32_t num) { UNREFERENCED_PARAMETER(i); UNREFERENCED_PARAMETER(num); return 0; }; +int32_t S_SoundsPlaying(int32_t i) { UNREFERENCED_PARAMETER(i); return -1; } +int32_t S_SoundFlags(int32_t num) { UNREFERENCED_PARAMETER(num); return 0; }; +int32_t A_PlaySound(uint32_t num, int32_t i) { UNREFERENCED_PARAMETER(num); UNREFERENCED_PARAMETER(i); return 0; }; +void S_StopSound(int32_t num) { UNREFERENCED_PARAMETER(num); }; +#ifdef __cplusplus +extern "C" +#endif +int32_t FX_StopAllSounds(void) { return 0; }; + //Just thought you might want my getnumber16 code /* getnumber16(char namestart[80], short num, int maxnumber)