Skip to content

Commit

Permalink
add a macro for checking if default theme is set
Browse files Browse the repository at this point in the history
  • Loading branch information
KrahJohlito committed Nov 25, 2024
1 parent 1430917 commit 9d4fcf4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/themes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define THM_MAX_FILES 64
#define THM_MAX_FONTS 16

#define IS_DEFAULT_THEME(themeID) ((themeID) == 0)

typedef struct
{
// optional, only for overlays
Expand Down
2 changes: 1 addition & 1 deletion src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ void guiShowUIConfig(void)
if (ret) {
diaGetInt(diaUIConfig, UICFG_LANG, &langID);
diaGetInt(diaUIConfig, UICFG_THEME, &themeID);
if (themeID == 0) {
if (IS_DEFAULT_THEME(themeID)) {
diaGetColor(diaUIConfig, UICFG_BGCOL, gDefaultBgColor);
diaGetColor(diaUIConfig, UICFG_UICOL, gDefaultUITextColor);
diaGetColor(diaUIConfig, UICFG_TXTCOL, gDefaultTextColor);
Expand Down
4 changes: 2 additions & 2 deletions src/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ int sfxInit(int bootSnd)

// Check default theme is not current theme
int themeID = thmGetGuiValue();
if (themeID != 0) {
if (!IS_DEFAULT_THEME(themeID)) {
// Get theme path for sfx
char *thmPath = thmGetFilePath(themeID);
snprintf(sound_path, sizeof(sound_path), "%ssound", thmPath);
Expand Down Expand Up @@ -334,7 +334,7 @@ static int bgmLoad(void)
memset(vorbisFile, 0, sizeof(OggVorbis_File));

int themeID = thmGetGuiValue();
if (themeID != 0) {
if (!IS_DEFAULT_THEME(themeID)) {
char *thmPath = thmGetFilePath(themeID);
snprintf(bgmPath, sizeof(bgmPath), "%ssound/bgm.ogg", thmPath);
} else
Expand Down

0 comments on commit 9d4fcf4

Please sign in to comment.