Skip to content

Commit

Permalink
[hellfire] jogging menu options
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed Jan 9, 2020
1 parent 2f6801b commit 3777219
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Source/appfat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ void __cdecl DrawDlg(char *pszFmt, ...)
va_start(arglist, pszFmt);
wvsprintf(text, pszFmt, arglist);
va_end(arglist);
SDrawMessageBox(text, "Diablo", MB_TASKMODAL | MB_ICONEXCLAMATION);
SDrawMessageBox(text, APP_NAME, MB_TASKMODAL | MB_ICONEXCLAMATION);
}

#ifdef _DEBUG
Expand Down
4 changes: 2 additions & 2 deletions Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
#ifndef SPAWN
{
char szValueName[] = "Intro";
if (!SRegLoadValue("Diablo", szValueName, 0, &nData))
if (!SRegLoadValue(APP_NAME, szValueName, 0, &nData))
nData = 1;
if (nData)
play_movie("gendata\\diablo1.smk", TRUE);
SRegSaveValue("Diablo", szValueName, 0, 0);
SRegSaveValue(APP_NAME, szValueName, 0, 0);
}
#endif

Expand Down
38 changes: 38 additions & 0 deletions Source/gamemenu.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "diablo.h"
#include "../3rdParty/Storm/Source/storm.h"

#ifdef HELLFIRE
BOOL jogging_opt = TRUE;
Expand Down Expand Up @@ -31,13 +32,20 @@ TMenuItem sgOptionsMenu[6] = {
{ GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_music_volume },
{ GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_sound_volume },
{ GMENU_ENABLED | GMENU_SLIDER, "Gamma", &gamemenu_gamma },
#ifndef HELLFIRE
{ GMENU_ENABLED , NULL, &gamemenu_color_cycling },
#else
{ GMENU_ENABLED , NULL, &gamemenu_loadjog },
#endif
{ GMENU_ENABLED , "Previous Menu", &j_gamemenu_previous },
{ GMENU_ENABLED , NULL, NULL }
// clang-format on
};
char *music_toggle_names[] = { "Music", "Music Disabled" };
char *sound_toggle_names[] = { "Sound", "Sound Disabled" };
#ifdef HELLFIRE
char *jogging_toggle_names[] = { "Jog", "Walk", "Fast Walk" };
#endif
char *color_cycling_toggle_names[] = { "Color Cycling Off", "Color Cycling On" };

void gamemenu_previous()
Expand Down Expand Up @@ -179,8 +187,13 @@ void gamemenu_options(BOOL bActivate)
{
gamemenu_get_music();
gamemenu_get_sound();
#ifdef HELLFIRE
gamemenu_jogging();
#endif
gamemenu_get_gamma();
#ifndef HELLFIRE
gamemenu_get_color_cycling();
#endif
gmenu_call_proc(sgOptionsMenu, NULL);
}

Expand Down Expand Up @@ -208,10 +221,21 @@ void gamemenu_get_sound()
gamemenu_sound_music_toggle(sound_toggle_names, &sgOptionsMenu[1], sound_get_or_set_sound_volume(1));
}

#ifdef HELLFIRE
void gamemenu_jogging()
{
gmenu_slider_steps(&sgOptionsMenu[3], 2);
gmenu_slider_set(&sgOptionsMenu[3], 0, 1, jogging_opt);
sgOptionsMenu[3].pszStr = jogging_toggle_names[!jogging_opt ? 1 : 0];
}
#endif

#ifndef HELLFIRE
void gamemenu_get_color_cycling()
{
sgOptionsMenu[3].pszStr = color_cycling_toggle_names[palette_get_colour_cycling() & 1];
}
#endif

void gamemenu_get_gamma()
{
Expand Down Expand Up @@ -306,6 +330,18 @@ void gamemenu_sound_volume(BOOL bActivate)
gamemenu_get_sound();
}

#ifdef HELLFIRE
void gamemenu_loadjog(BOOL bActivate)
{
if (gbMaxPlayers == 1) {
jogging_opt = !jogging_opt;
SRegSaveValue(APP_NAME, jogging_toggle_names[3], FALSE, jogging_opt);
PlaySFX(IS_TITLEMOV);
gamemenu_jogging();
}
}
#endif

void gamemenu_gamma(BOOL bActivate)
{
int gamma;
Expand All @@ -328,10 +364,12 @@ int gamemenu_slider_gamma()
return gmenu_slider_get(&sgOptionsMenu[2], 30, 100);
}

#ifndef HELLFIRE
void gamemenu_color_cycling(BOOL bActivate)
{
BOOL color_cycling;

color_cycling = palette_set_color_cycling(palette_get_colour_cycling() == 0);
sgOptionsMenu[3].pszStr = color_cycling_toggle_names[color_cycling & 1];
}
#endif
6 changes: 6 additions & 0 deletions Source/gamemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ void gamemenu_options(BOOL bActivate);
void gamemenu_get_music();
void gamemenu_sound_music_toggle(char **names, TMenuItem *menu_item, int gamma);
void gamemenu_get_sound();
#ifdef HELLFIRE
void gamemenu_jogging();
#endif
void gamemenu_get_color_cycling();
void gamemenu_get_gamma();
void gamemenu_music_volume(BOOL bActivate);
int gamemenu_slider_music_sound(TMenuItem *menu_item);
void gamemenu_sound_volume(BOOL bActivate);
#ifdef HELLFIRE
void gamemenu_loadjog(BOOL bActivate);
#endif
void gamemenu_gamma(BOOL bActivate);
int gamemenu_slider_gamma();
void gamemenu_color_cycling(BOOL bActivate);
Expand Down
6 changes: 3 additions & 3 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2812,9 +2812,9 @@ void items_427A72()
if (dword_691CB0) {
if (CornerItemMaybe.IDidx >= 0) {
PackItem(&id, &CornerItemMaybe);
SRegSaveData("Hellfire", off_4A5AC4, 0, (BYTE *)&id, 19);
SRegSaveData(APP_NAME, off_4A5AC4, 0, (BYTE *)&id, 19);
} else {
SRegSaveData("Hellfire", off_4A5AC4, 0, (BYTE *)"", 1);
SRegSaveData(APP_NAME, off_4A5AC4, 0, (BYTE *)"", 1);
}
}
}
Expand Down Expand Up @@ -2842,7 +2842,7 @@ void items_427ABA(int x, int y)
dItem[x][y] = 0;
}
dwSize = 0;
if (SRegLoadData("Hellfire", off_4A5AC4, 0, (BYTE *)&PkSItem, sizeof(PkSItem), &dwSize)) {
if (SRegLoadData(APP_NAME, off_4A5AC4, 0, (BYTE *)&PkSItem, sizeof(PkSItem), &dwSize)) {
if (dwSize == sizeof(PkSItem)) {
ii = itemavail[0];
dItem[x][y] = ii + 1;
Expand Down
8 changes: 4 additions & 4 deletions Source/mpqapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ BOOL mpqapi_reg_load_modification_time(char *dst, int size)
pszDst = dst;
memset(dst, 0, size);
#ifdef SPAWN
if (!SRegLoadData("Diablo", "Audio Playback ", 0, (BYTE *)pszDst, size, &nbytes_read)) {
if (!SRegLoadData(APP_NAME, "Audio Playback ", 0, (BYTE *)pszDst, size, &nbytes_read)) {
#else
if (!SRegLoadData("Diablo", "Video Player ", 0, (BYTE *)pszDst, size, &nbytes_read)) {
if (!SRegLoadData(APP_NAME, "Video Player ", 0, (BYTE *)pszDst, size, &nbytes_read)) {
#endif
return FALSE;
}
Expand Down Expand Up @@ -125,9 +125,9 @@ BOOLEAN mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen)
}

#ifdef SPAWN
return SRegSaveData("Diablo", "Audio Playback ", 0, (BYTE *)pbData, dwLen);
return SRegSaveData(APP_NAME, "Audio Playback ", 0, (BYTE *)pbData, dwLen);
#else
return SRegSaveData("Diablo", "Video Player ", 0, (BYTE *)pbData, dwLen);
return SRegSaveData(APP_NAME, "Video Player ", 0, (BYTE *)pbData, dwLen);
#endif
}

Expand Down
10 changes: 5 additions & 5 deletions Source/palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ static void ApplyGamma(PALETTEENTRY *dst, PALETTEENTRY *src, int n)

void SaveGamma()
{
SRegSaveValue("Diablo", "Gamma Correction", 0, gamma_correction);
SRegSaveValue(APP_NAME, "Gamma Correction", 0, gamma_correction);
#ifndef HELLFIRE
SRegSaveValue("Diablo", "Color Cycling", FALSE, color_cycling_enabled);
SRegSaveValue(APP_NAME, "Color Cycling", FALSE, color_cycling_enabled);
#endif
}

Expand All @@ -58,7 +58,7 @@ static void LoadGamma()
int value;

value = gamma_correction;
if (!SRegLoadValue("Diablo", "Gamma Correction", 0, &value))
if (!SRegLoadValue(APP_NAME, "Gamma Correction", 0, &value))
value = 100;
gamma_value = value;
if (value < 30) {
Expand All @@ -68,7 +68,7 @@ static void LoadGamma()
}
gamma_correction = gamma_value - gamma_value % 5;
#ifndef HELLFIRE
if (!SRegLoadValue("Diablo", "Color Cycling", 0, &value))
if (!SRegLoadValue(APP_NAME, "Color Cycling", 0, &value))
value = 1;
color_cycling_enabled = value;
#endif
Expand Down Expand Up @@ -302,7 +302,7 @@ void palette_update_crypt()
int i;
PALETTEENTRY col;

if (dword_6E2D58 > 1) {
if (dword_6E2D58 > 1) {
col = system_palette[15];
for (i = 15; i > 0; i--) {
system_palette[i].peRed = system_palette[i - 1].peRed;
Expand Down
4 changes: 2 additions & 2 deletions Source/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void snd_init(HWND hWnd)
void sound_load_volume(char *value_name, int *value)
{
int v = *value;
if (!SRegLoadValue("Diablo", value_name, 0, &v)) {
if (!SRegLoadValue(APP_NAME, value_name, 0, &v)) {
v = VOLUME_MAX;
}
*value = v;
Expand Down Expand Up @@ -444,7 +444,7 @@ void sound_cleanup()

void sound_store_volume(char *key, int value)
{
SRegSaveValue("Diablo", key, 0, value);
SRegSaveValue(APP_NAME, key, 0, value);
}

void music_stop()
Expand Down
2 changes: 2 additions & 0 deletions defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
#ifdef HELLFIRE
#define DIABOOL BOOLEAN
#define GAME_NAME "HELLFIRE"
#define APP_NAME "Hellfire"
#else
#define DIABOOL BOOL
#define GAME_NAME "DIABLO"
#define APP_NAME "Diablo"
#endif


Expand Down

0 comments on commit 3777219

Please sign in to comment.