Browse Source

Merge pull request #2021 from galaxyhaxz/namefixes

Fix function/var names (effects/sound)
pull/681/head
Robin Eklind 6 years ago committed by GitHub
parent
commit
cf19c4f019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      Source/diablo.cpp
  2. 52
      Source/effects.cpp
  3. 16
      Source/effects.h
  4. 4
      Source/gamemenu.cpp
  5. 2
      Source/interfac.cpp
  6. 2
      Source/movie.cpp
  7. 2
      Source/player.cpp
  8. 34
      Source/sound.cpp
  9. 4
      Source/sound.h
  10. 10
      Source/stores.cpp
  11. 2
      Source/stores.h
  12. 2
      Source/towners.cpp
  13. 20
      comparer-config/diablo.toml
  14. 20
      comparer-config/spawn.toml

16
Source/diablo.cpp

@ -86,7 +86,7 @@ void FreeGameMem()
FreeMissiles();
FreeMonsters();
FreeObjectGFX();
FreeEffects();
FreeMonsterSnd();
FreeTownerGFX();
}
@ -286,7 +286,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
diablo_init_screen();
diablo_parse_flags(lpCmdLine);
init_create_window(nCmdShow);
sound_init();
ui_sound_init();
UiInitialize();
#ifdef SPAWN
UiSetSpawned(TRUE);
@ -619,7 +619,7 @@ BOOL PressEscKey()
if (qtextflag) {
qtextflag = FALSE;
sfx_stop();
stream_stop();
rv = TRUE;
} else if (stextflag) {
STextESC();
@ -772,7 +772,7 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
pfile_write_hero();
nthread_ignore_mutex(TRUE);
PaletteFadeOut(8);
FreeMonsterSnd();
sound_stop();
music_stop();
track_repeat_walk(FALSE);
sgbMouseDown = 0;
@ -808,7 +808,7 @@ BOOL LeftMouseDown(int wParam)
QuestlogESC();
} else if (qtextflag) {
qtextflag = FALSE;
sfx_stop();
stream_stop();
} else if (chrflag && MouseX < 320) {
CheckChrBtns();
} else if (invflag && MouseX > RIGHT_PANEL) {
@ -1092,7 +1092,7 @@ void PressKey(int vkey)
spselflag = FALSE;
if (qtextflag && leveltype == DTYPE_TOWN) {
qtextflag = FALSE;
sfx_stop();
stream_stop();
}
questlog = FALSE;
automapflag = FALSE;
@ -1214,7 +1214,7 @@ void PressKey(int vkey)
spselflag = FALSE;
if (qtextflag && leveltype == DTYPE_TOWN) {
qtextflag = FALSE;
sfx_stop();
stream_stop();
}
questlog = FALSE;
automapflag = FALSE;
@ -1231,7 +1231,7 @@ void diablo_pause_game()
PauseMode = 0;
} else {
PauseMode = 2;
FreeMonsterSnd();
sound_stop();
track_repeat_walk(FALSE);
}
force_redraw = 255;

52
Source/effects.cpp

@ -8,8 +8,8 @@
int sfxdelay;
int sfxdnum;
HANDLE sfx_stream;
TSFX *sfx_data_cur;
HANDLE sghStream;
TSFX *sgpStreamSFX;
/**
* Monster sound type prefix
@ -919,18 +919,18 @@ BOOL effect_is_playing(int nSFX)
return snd_playing(sfx->pSnd);
if (sfx->bFlags & SFX_STREAM)
return sfx == sfx_data_cur;
return sfx == sgpStreamSFX;
return FALSE;
}
void sfx_stop()
void stream_stop()
{
if (sfx_stream) {
SFileDdaEnd(sfx_stream);
SFileCloseFile(sfx_stream);
sfx_stream = NULL;
sfx_data_cur = NULL;
if (sghStream) {
SFileDdaEnd(sghStream);
SFileCloseFile(sghStream);
sghStream = NULL;
sgpStreamSFX = NULL;
}
}
@ -961,7 +961,7 @@ void InitMonsterSND(int monst)
}
}
void FreeEffects()
void FreeMonsterSnd()
{
int mtype, i, j, k;
char *file;
@ -1080,7 +1080,7 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan)
/// ASSERT: assert(pSFX);
/// ASSERT: assert(pSFX->bFlags & sfx_STREAM);
sfx_stop();
stream_stop();
lVolume += sound_get_or_set_sound_volume(1);
if (lVolume >= VOLUME_MIN) {
if (lVolume > VOLUME_MAX)
@ -1088,17 +1088,17 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan)
#ifdef _DEBUG
SFileEnableDirectAccess(FALSE);
#endif
success = SFileOpenFile(pSFX->pszName, &sfx_stream);
success = SFileOpenFile(pSFX->pszName, &sghStream);
#ifdef _DEBUG
SFileEnableDirectAccess(TRUE);
#endif
if (!success) {
sfx_stream = 0;
sghStream = 0;
} else {
if (!SFileDdaBeginEx(sfx_stream, 0x40000, 0, 0, lVolume, lPan, 0))
sfx_stop();
if (!SFileDdaBeginEx(sghStream, 0x40000, 0, 0, lVolume, lPan, 0))
stream_stop();
else
sfx_data_cur = pSFX;
sgpStreamSFX = pSFX;
}
}
}
@ -1155,13 +1155,13 @@ void PlaySfxLoc(int psfx, int x, int y)
PlaySFX_priv(&sgSFX[psfx], TRUE, x, y);
}
void FreeMonsterSnd()
void sound_stop()
{
int i, j, k;
snd_update(TRUE);
stream_stop();
sfx_stop();
sound_stop();
for (i = 0; i < nummtypes; i++) {
for (j = 0; j < 4; j++) {
@ -1172,7 +1172,7 @@ void FreeMonsterSnd()
}
}
void sound_stop()
void sfx_stop()
{
int i;
TSFX *snd;
@ -1192,15 +1192,15 @@ void sound_update()
}
snd_update(FALSE);
effects_update();
stream_update();
}
void effects_update()
void stream_update()
{
DWORD current, end;
if (sfx_stream != NULL && SFileDdaGetPos(sfx_stream, &current, &end) && current >= end) {
sfx_stop();
if (sghStream != NULL && SFileDdaGetPos(sghStream, &current, &end) && current >= end) {
stream_stop();
}
}
@ -1208,7 +1208,7 @@ void effects_cleanup_sfx()
{
DWORD i;
FreeMonsterSnd();
sound_stop();
for (i = 0; i < sizeof(sgSFX) / sizeof(TSFX); i++) {
if (sgSFX[i].pSnd) {
@ -1218,7 +1218,7 @@ void effects_cleanup_sfx()
}
}
void stream_update()
void sound_init()
{
BYTE mask = 0;
if (gbMaxPlayers > 1) {
@ -1269,7 +1269,7 @@ void priv_sound_init(BYTE bLoadMask)
}
}
void sound_init()
void ui_sound_init()
{
priv_sound_init(SFX_UI);
}

16
Source/effects.h

@ -8,13 +8,13 @@
extern int sfxdelay;
extern int sfxdnum;
extern HANDLE sfx_stream;
extern TSFX *sfx_data_cur;
extern HANDLE sghStream;
extern TSFX *sgpStreamSFX;
BOOL effect_is_playing(int nSFX);
void sfx_stop();
void stream_stop();
void InitMonsterSND(int monst);
void FreeEffects();
void FreeMonsterSnd();
void PlayEffect(int i, int mode);
BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan);
void PlaySFX(int psfx);
@ -22,14 +22,14 @@ void PlaySFX_priv(TSFX *pSFX, BOOL loc, int x, int y);
void stream_play(TSFX *pSFX, int lVolume, int lPan);
int RndSFX(int psfx);
void PlaySfxLoc(int psfx, int x, int y);
void FreeMonsterSnd();
void sound_stop();
void sfx_stop();
void sound_update();
void effects_update();
void effects_cleanup_sfx();
void stream_update();
void priv_sound_init(BYTE bLoadMask);
void effects_cleanup_sfx();
void sound_init();
void priv_sound_init(BYTE bLoadMask);
void ui_sound_init();
void __stdcall effects_play_sound(char *snd_file);
/* rdata */

4
Source/gamemenu.cpp

@ -262,7 +262,7 @@ void gamemenu_sound_volume(BOOL bActivate)
if (bActivate) {
if (gbSoundOn) {
gbSoundOn = FALSE;
FreeMonsterSnd();
sound_stop();
sound_get_or_set_sound_volume(VOLUME_MIN);
} else {
gbSoundOn = TRUE;
@ -274,7 +274,7 @@ void gamemenu_sound_volume(BOOL bActivate)
if (volume == VOLUME_MIN) {
if (gbSoundOn) {
gbSoundOn = FALSE;
FreeMonsterSnd();
sound_stop();
}
} else if (!gbSoundOn) {
gbSoundOn = TRUE;

2
Source/interfac.cpp

@ -87,7 +87,7 @@ void ShowProgress(unsigned int uMsg)
DrawCutscene();
PaletteFadeIn(8);
IncProgress();
stream_update();
sound_init();
IncProgress();
switch (uMsg) {

2
Source/movie.cpp

@ -25,7 +25,7 @@ void play_movie(char *pszMovie, BOOL user_can_close)
UpdateWindow(ghMainWnd);
movie_playing = TRUE;
sound_disable_music(TRUE);
sfx_stop();
stream_stop();
effects_play_sound("Sfx\\Misc\\blank.wav");
SVidPlayBegin(pszMovie, 0, 0, 0, 0, loop_movie ? 0x100C0808 : 0x10280808, &video_stream);

2
Source/player.cpp

@ -1988,7 +1988,7 @@ void InitLevelChange(int pnum)
RemovePlrMissiles(pnum);
if (pnum == myplr && qtextflag) {
qtextflag = FALSE;
sfx_stop();
stream_stop();
}
RemovePlrFromMap(pnum);

34
Source/sound.cpp

@ -7,7 +7,7 @@ BOOLEAN gbSndInited;
int sglMusicVolume;
int sglSoundVolume;
HMODULE hDsound_dll;
HANDLE sgpMusicTrack;
HANDLE sghMusic;
LPDIRECTSOUNDBUFFER sglpDSB;
/* data */
@ -306,10 +306,10 @@ void sound_file_cleanup(TSnd *sound_file)
void snd_init(HWND hWnd)
{
int error_code;
sound_load_volume("Sound Volume", &sglSoundVolume);
snd_get_volume("Sound Volume", &sglSoundVolume);
gbSoundOn = sglSoundVolume > VOLUME_MIN;
sound_load_volume("Music Volume", &sglMusicVolume);
snd_get_volume("Music Volume", &sglMusicVolume);
gbMusicOn = sglMusicVolume > VOLUME_MIN;
error_code = sound_DirectSoundCreate(NULL, &sglpDS, NULL);
@ -329,7 +329,7 @@ void snd_init(HWND hWnd)
gbSndInited = sglpDS != NULL;
}
void sound_load_volume(char *value_name, int *value)
void snd_get_volume(char *value_name, int *value)
{
int v = *value;
if (!SRegLoadValue("Diablo", value_name, 0, &v)) {
@ -433,22 +433,22 @@ void sound_cleanup()
if (gbSndInited) {
gbSndInited = FALSE;
sound_store_volume("Sound Volume", sglSoundVolume);
sound_store_volume("Music Volume", sglMusicVolume);
snd_set_volume("Sound Volume", sglSoundVolume);
snd_set_volume("Music Volume", sglMusicVolume);
}
}
void sound_store_volume(char *key, int value)
void snd_set_volume(char *key, int value)
{
SRegSaveValue("Diablo", key, 0, value);
}
void music_stop()
{
if (sgpMusicTrack) {
SFileDdaEnd(sgpMusicTrack);
SFileCloseFile(sgpMusicTrack);
sgpMusicTrack = NULL;
if (sghMusic) {
SFileDdaEnd(sghMusic);
SFileCloseFile(sghMusic);
sghMusic = NULL;
sgnMusicTrack = NUM_MUSIC;
}
}
@ -463,15 +463,15 @@ void music_start(int nTrack)
#ifdef _DEBUG
SFileEnableDirectAccess(FALSE);
#endif
success = SFileOpenFile(sgszMusicTracks[nTrack], &sgpMusicTrack);
success = SFileOpenFile(sgszMusicTracks[nTrack], &sghMusic);
#ifdef _DEBUG
SFileEnableDirectAccess(TRUE);
#endif
sound_create_primary_buffer(sgpMusicTrack);
sound_create_primary_buffer(sghMusic);
if (!success) {
sgpMusicTrack = NULL;
sghMusic = NULL;
} else {
SFileDdaBeginEx(sgpMusicTrack, 0x40000, 0x40000, 0, sglMusicVolume, 0, 0);
SFileDdaBeginEx(sghMusic, 0x40000, 0x40000, 0, sglMusicVolume, 0, 0);
sgnMusicTrack = nTrack;
}
}
@ -493,8 +493,8 @@ int sound_get_or_set_music_volume(int volume)
sglMusicVolume = volume;
if (sgpMusicTrack)
SFileDdaSetVolume(sgpMusicTrack, volume, 0);
if (sghMusic)
SFileDdaSetVolume(sghMusic, volume, 0);
return sglMusicVolume;
}

4
Source/sound.h

@ -16,11 +16,11 @@ TSnd *sound_file_load(char *path);
void sound_CreateSoundBuffer(TSnd *sound_file);
void sound_file_cleanup(TSnd *sound_file);
void snd_init(HWND hWnd);
void sound_load_volume(char *value_name, int *value);
void snd_get_volume(char *value_name, int *value);
void sound_create_primary_buffer(HANDLE music_track);
HRESULT sound_DirectSoundCreate(LPGUID lpGuid, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter);
void sound_cleanup();
void sound_store_volume(char *key, int value);
void snd_set_volume(char *key, int value);
void music_stop();
void music_start(int nTrack);
void sound_disable_music(BOOL disable);

10
Source/stores.cpp

@ -242,7 +242,7 @@ void DrawSLine(int y)
#endif
}
void DrawSArrows(int y1, int y2)
void DrawSSlider(int y1, int y2)
{
int yd1, yd2, yd3;
@ -1583,7 +1583,7 @@ void DrawSText()
}
if (stextscrl)
DrawSArrows(4, 20);
DrawSSlider(4, 20);
InStoreFlag = (InStoreFlag & 7) + 1;
}
@ -1593,7 +1593,7 @@ void STextESC()
if (qtextflag) {
qtextflag = FALSE;
if (leveltype == DTYPE_TOWN)
sfx_stop();
stream_stop();
} else {
switch (stextflag) {
case STORE_SMITH:
@ -2679,7 +2679,7 @@ void STextEnter()
if (qtextflag) {
qtextflag = FALSE;
if (leveltype == DTYPE_TOWN)
sfx_stop();
stream_stop();
} else {
PlaySFX(IS_TITLSLCT);
switch (stextflag) {
@ -2763,7 +2763,7 @@ void CheckStoreBtn()
if (qtextflag) {
qtextflag = FALSE;
if (leveltype == DTYPE_TOWN)
sfx_stop();
stream_stop();
} else if (stextsel != -1 && MouseY >= 32 && MouseY <= 320) {
if (!stextsize) {
if (MouseX < 344 + PANEL_LEFT || MouseX > 616 + PANEL_LEFT)

2
Source/stores.h

@ -42,7 +42,7 @@ void FreeStoreMem();
void DrawSTextBack();
void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val);
void DrawSLine(int y);
void DrawSArrows(int y1, int y2);
void DrawSSlider(int y1, int y2);
void DrawSTextHelp();
void ClearSText(int s, int e);
void AddSLine(int y);

2
Source/towners.cpp

@ -418,7 +418,7 @@ void TownCtrlMsg(int i)
towner[i]._tbtcnt = 0;
if (!towner[i]._tbtcnt) {
qtextflag = FALSE;
sfx_stop();
stream_stop();
}
}
}

20
comparer-config/diablo.toml

@ -1628,7 +1628,7 @@ addr = 0x4158B9
size = 0x29
[[func]]
name = "sfx_stop"
name = "stream_stop"
addr = 0x4158E2
size = 0x29
@ -1638,7 +1638,7 @@ addr = 0x41590B
size = 0xD0
[[func]]
name = "FreeEffects"
name = "FreeMonsterSnd"
addr = 0x4159DB
size = 0x6A
@ -1678,12 +1678,12 @@ addr = 0x415D01
size = 0x38
[[func]]
name = "FreeMonsterSnd"
name = "sound_stop"
addr = 0x415D39
size = 0x61
[[func]]
name = "sound_stop"
name = "sfx_stop"
addr = 0x415D9A
size = 0x20
@ -1693,7 +1693,7 @@ addr = 0x415DBA
size = 0x16
[[func]]
name = "effects_update"
name = "stream_update"
addr = 0x415DD0
size = 0x2F
@ -1703,7 +1703,7 @@ addr = 0x415DFF
size = 0x2B
[[func]]
name = "stream_update"
name = "sound_init"
addr = 0x415E2A
size = 0x4D
@ -1713,7 +1713,7 @@ addr = 0x415E77
size = 0x61
[[func]]
name = "sound_init"
name = "ui_sound_init"
addr = 0x415ED8
size = 0x7
@ -8153,7 +8153,7 @@ addr = 0x45708B
size = 0xA0
[[func]]
name = "sound_load_volume"
name = "snd_get_volume"
addr = 0x45712B
size = 0x51
@ -8173,7 +8173,7 @@ addr = 0x4572FF
size = 0x59
[[func]]
name = "sound_store_volume"
name = "snd_set_volume"
addr = 0x457358
size = 0xF
@ -8268,7 +8268,7 @@ addr = 0x457DE2
size = 0x80
[[func]]
name = "DrawSArrows"
name = "DrawSSlider"
addr = 0x457E62
size = 0xF0

20
comparer-config/spawn.toml

@ -1098,7 +1098,7 @@ addr = 0x40D741
size = 0x29
[[func]]
name = "sfx_stop"
name = "stream_stop"
addr = 0x40D76A
size = 0x29
@ -1108,7 +1108,7 @@ addr = 0x40D793
size = 0xD0
[[func]]
name = "FreeEffects"
name = "FreeMonsterSnd"
addr = 0x40D863
size = 0x6A
@ -1148,12 +1148,12 @@ addr = 0x40DB71
size = 0x38
[[func]]
name = "FreeMonsterSnd"
name = "sound_stop"
addr = 0x40DBA9
size = 0x61
[[func]]
name = "sound_stop"
name = "sfx_stop"
addr = 0x40DC0A
size = 0x20
@ -1163,7 +1163,7 @@ addr = 0x40DC2A
size = 0x16
[[func]]
name = "effects_update"
name = "stream_update"
addr = 0x40DC40
size = 0x2F
@ -1173,7 +1173,7 @@ addr = 0x40DC6F
size = 0x2B
[[func]]
name = "stream_update"
name = "sound_init"
addr = 0x40DC9A
size = 0x4D
@ -1183,7 +1183,7 @@ addr = 0x40DCE7
size = 0x61
[[func]]
name = "sound_init"
name = "ui_sound_init"
addr = 0x40DD48
size = 0x7
@ -7528,7 +7528,7 @@ addr = 0x44C454
size = 0xA0
[[func]]
name = "sound_load_volume"
name = "snd_get_volume"
addr = 0x44C4F4
size = 0x51
@ -7548,7 +7548,7 @@ addr = 0x44C6C8
size = 0x59
[[func]]
name = "sound_store_volume"
name = "snd_set_volume"
addr = 0x44C721
size = 0xF
@ -7643,7 +7643,7 @@ addr = 0x44D1AB
size = 0x80
[[func]]
name = "DrawSArrows"
name = "DrawSSlider"
addr = 0x44D22B
size = 0xF0

Loading…
Cancel
Save