From 57e9ff2fbcb6fc122bcaa8045374eb4982b60be8 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Fri, 28 Jun 2019 21:45:39 +0900 Subject: [PATCH] Move stuff around # Conflicts: # platform/Windows/nmapedit.vcxproj # platform/Windows/nmapedit.vcxproj.filters # source/blood/src/config.cpp # source/blood/src/config.h # source/blood/src/mapedit.cpp # source/blood/src/screen.cpp # source/blood/src/screen.h --- source/blood/src/blood.cpp | 28 ++++++++++++++++++++++++---- source/blood/src/blood.h | 4 +++- source/blood/src/config.cpp | 21 ++++----------------- source/blood/src/config.h | 17 ----------------- source/blood/src/screen.cpp | 1 + source/blood/src/screen.h | 2 ++ source/blood/src/sound.cpp | 36 +++++++++++++----------------------- source/blood/src/sound.h | 15 +++++++++++++-- source/blood/src/tile.cpp | 6 ++++-- source/blood/src/tile.h | 5 +++++ 10 files changed, 69 insertions(+), 66 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index d1c424d94..cb6b934be 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -199,8 +199,6 @@ void QuitGame(void) exit(0); } -int nPrecacheCount; - void PrecacheDude(spritetype *pSprite) { DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase]; @@ -379,7 +377,6 @@ void PreloadTiles(void) G_HandleAsync(); } -char precachehightile[2][(MAXTILES+7)>>3]; #ifdef USE_OPENGL void PrecacheExtraTextureMaps(int nTile) { @@ -2398,4 +2395,27 @@ bool VanillaMode() { bool fileExistsRFF(int id, const char *ext) { return gSysRes.Lookup(id, ext); -} \ No newline at end of file +} + +int sndTryPlaySpecialMusic(int nMusic) +{ + int nEpisode = nMusic/kMaxLevels; + int nLevel = nMusic%kMaxLevels; + if (!sndPlaySong(gEpisodeInfo[nEpisode].at28[nLevel].atd0, true)) + { + strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH); + return 0; + } + return 1; +} + +void sndPlaySpecialMusicOrNothing(int nMusic) +{ + int nEpisode = nMusic/kMaxLevels; + int nLevel = nMusic%kMaxLevels; + if (sndTryPlaySpecialMusic(nMusic)) + { + sndStopSong(); + strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH); + } +} diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 5a835f017..f557a96d0 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -78,4 +78,6 @@ bool LoadArtFile(const char *pzFile); void LoadExtraArts(void); bool DemoRecordStatus(void); bool VanillaMode(void); -bool fileExistsRFF(int id, const char* ext); \ No newline at end of file +bool fileExistsRFF(int id, const char* ext); +int sndTryPlaySpecialMusic(int nMusic); +void sndPlaySpecialMusicOrNothing(int nMusic); \ No newline at end of file diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 264dd8d05..ffa84b16f 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -30,9 +30,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "renderlayer.h" #include "function.h" #include "blood.h" +#include "config.h" #include "gamedefs.h" #include "globals.h" -#include "config.h" +#include "screen.h" +#include "sound.h" +#include "tile.h" #include "view.h" #ifdef __ANDROID__ @@ -51,8 +54,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL }; -int32_t MAXCACHE1DSIZE = (96*1024*1024); - int32_t MouseDeadZone, MouseBias; int32_t SmoothInput; int32_t MouseFunctions[MAXMOUSEBUTTONS][2]; @@ -68,19 +69,6 @@ int32_t JoystickAnalogueSaturate[MAXJOYAXES]; uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2]; int32_t scripthandle; int32_t setupread; -int32_t SoundToggle; -int32_t MusicToggle; -int32_t MusicRestartsOnLoadToggle; -int32_t CDAudioToggle; -int32_t FXVolume; -int32_t MusicVolume; -int32_t CDVolume; -int32_t NumVoices; -int32_t NumChannels; -int32_t NumBits; -int32_t MixRate; -int32_t ReverseStereo; -int32_t MusicDevice; int32_t configversion; int32_t CheckForUpdates; int32_t LastUpdateCheck; @@ -117,7 +105,6 @@ bool gNoClip; bool gInfiniteAmmo; bool gFullMap; int32_t gUpscaleFactor; -int32_t gBrightness; int32_t gLevelStats; int32_t gPowerupDuration; int32_t gShowMapTitle; diff --git a/source/blood/src/config.h b/source/blood/src/config.h index e372cdc0d..083fc092c 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -50,19 +50,6 @@ extern int32_t JoystickAnalogueSaturate[MAXJOYAXES]; extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2]; extern int32_t scripthandle; extern int32_t setupread; -extern int32_t SoundToggle; -extern int32_t MusicToggle; -extern int32_t MusicRestartsOnLoadToggle; -extern int32_t CDAudioToggle; -extern int32_t FXVolume; -extern int32_t MusicVolume; -extern int32_t CDVolume; -extern int32_t NumVoices; -extern int32_t NumChannels; -extern int32_t NumBits; -extern int32_t MixRate; -extern int32_t ReverseStereo; -extern int32_t MusicDevice; extern int32_t configversion; extern int32_t CheckForUpdates; extern int32_t LastUpdateCheck; @@ -99,11 +86,7 @@ extern bool gInfiniteAmmo; extern bool gFullMap; extern hashtable_t h_gamefuncs; extern int32_t gUpscaleFactor; -extern int32_t gBrightness; extern int32_t gLevelStats; -extern int32_t gPowerupDuration; -extern int32_t gShowMapTitle; -extern int32_t MAXCACHE1DSIZE; extern int32_t gFov; extern int32_t gCenterHoriz; extern int32_t gDeliriumBlur; diff --git a/source/blood/src/screen.cpp b/source/blood/src/screen.cpp index 87b33d485..f6d9f0643 100644 --- a/source/blood/src/screen.cpp +++ b/source/blood/src/screen.cpp @@ -69,6 +69,7 @@ static int curPalette; static int curGamma; int gGammaLevels; bool gFogMode = false; +int32_t gBrightness; void scrResetPalette(void) { diff --git a/source/blood/src/screen.h b/source/blood/src/screen.h index 84ab93ff3..6c04da6b2 100644 --- a/source/blood/src/screen.h +++ b/source/blood/src/screen.h @@ -39,6 +39,8 @@ extern RGB curDAC[256]; extern RGB baseDAC[256]; extern int gGammaLevels; extern bool gFogMode; +extern int32_t gBrightness; +void scrCreateStdColors(void); void scrResetPalette(void); void gSetDacRange(int start, int end, RGB *pPal); void scrLoadPLUs(void); diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index e94448de4..4d8e56323 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -31,6 +31,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sound.h" #include "renderlayer.h" +int32_t SoundToggle; +int32_t MusicToggle; +int32_t CDAudioToggle; +int32_t FXVolume; +int32_t MusicVolume; +int32_t CDVolume; +int32_t NumVoices; +int32_t NumChannels; +int32_t NumBits; +int32_t MixRate; +int32_t ReverseStereo; +int32_t MusicDevice; + Resource gSoundRes; int soundRates[13] = { @@ -185,29 +198,6 @@ int sndPlaySong(const char *songName, bool bLoop) return 0; } -int sndTryPlaySpecialMusic(int nMusic) -{ - int nEpisode = nMusic/kMaxLevels; - int nLevel = nMusic%kMaxLevels; - if (!sndPlaySong(gEpisodeInfo[nEpisode].at28[nLevel].atd0, true)) - { - strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH); - return 0; - } - return 1; -} - -void sndPlaySpecialMusicOrNothing(int nMusic) -{ - int nEpisode = nMusic/kMaxLevels; - int nLevel = nMusic%kMaxLevels; - if (sndTryPlaySpecialMusic(nMusic)) - { - sndStopSong(); - strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH); - } -} - bool sndIsSongPlaying(void) { //return MUSIC_SongPlaying(); diff --git a/source/blood/src/sound.h b/source/blood/src/sound.h index 931b29fdc..a98ace6b8 100644 --- a/source/blood/src/sound.h +++ b/source/blood/src/sound.h @@ -40,10 +40,21 @@ struct SFX char rawName[9]; }; +extern int32_t SoundToggle; +extern int32_t MusicToggle; +extern int32_t CDAudioToggle; +extern int32_t FXVolume; +extern int32_t MusicVolume; +extern int32_t CDVolume; +extern int32_t NumVoices; +extern int32_t NumChannels; +extern int32_t NumBits; +extern int32_t MixRate; +extern int32_t ReverseStereo; +extern int32_t MusicDevice; + int sndGetRate(int format); int sndPlaySong(const char *songName, bool bLoop); -int sndTryPlaySpecialMusic(int nMusic); -void sndPlaySpecialMusicOrNothing(int nMusic); bool sndIsSongPlaying(void); void sndFadeSong(int nTime); void sndSetMusicVolume(int nVolume); diff --git a/source/blood/src/tile.cpp b/source/blood/src/tile.cpp index aef8037b1..3a208597c 100644 --- a/source/blood/src/tile.cpp +++ b/source/blood/src/tile.cpp @@ -82,6 +82,8 @@ short voxelIndex[kMaxTiles]; const char *pzBaseFileName = "TILES%03i.ART"; //"TILES%03i.ART"; +int32_t MAXCACHE1DSIZE = (96*1024*1024); + int tileInit(char a1, const char *a2) { UNREFERENCED_PARAMETER(a1); @@ -208,8 +210,8 @@ void tilePreloadTile(int nTile) } } -extern int nPrecacheCount; -extern char precachehightile[2][(MAXTILES+7)>>3]; +int nPrecacheCount; +char precachehightile[2][(MAXTILES+7)>>3]; void tilePrecacheTile(int nTile, int nType) { diff --git a/source/blood/src/tile.h b/source/blood/src/tile.h index 3a9261ca4..da5bec069 100644 --- a/source/blood/src/tile.h +++ b/source/blood/src/tile.h @@ -48,6 +48,11 @@ extern char surfType[kMaxTiles]; extern signed char tileShade[kMaxTiles]; extern short voxelIndex[kMaxTiles]; +extern int nPrecacheCount; +extern char precachehightile[2][(MAXTILES+7)>>3]; + +extern int32_t MAXCACHE1DSIZE; + void qloadvoxel(int32_t nVoxel); void CalcPicsiz(int a1, int a2, int a3); int tileInit(char a1, const char *a2);