Skip to content

Commit

Permalink
Refactor the game title (#315)
Browse files Browse the repository at this point in the history
The game title is now defined in one place. Also removed VERSIONNUMBER in favor of the git revision.
  • Loading branch information
AzureBerylBlue authored May 5, 2024
1 parent 79f8d01 commit 1e94352
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/common/GameValues.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef GAMEVALUES_H
#define GAMEVALUES_H

#define TITLESTRING "Super Mario War"

#include "EyecandyStyles.h"
#include "GameModeSettings.h"
#include "GameplayStyles.h"
Expand Down
12 changes: 8 additions & 4 deletions src/leveleditor/leveleditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void removeifprojectile(IO_MovingObject * object, bool playsound, bool forcedead
#endif


#define MAPTITLESTRING "SMW 2.0 Level Editor"
#define MAPTITLESTRING "Level Editor"


extern CMap* g_map;
Expand Down Expand Up @@ -403,7 +403,9 @@ int main(int argc, char *argv[])
return 1;
}
if (cmd.show_help) {
cmd::print_help(MAPTITLESTRING, "");
char title[128];
sprintf(title, "%s %s", TITLESTRING, MAPTITLESTRING);
cmd::print_help(title, "");
return 0;
}
if (cmd.debug) {
Expand All @@ -428,7 +430,7 @@ int main(int argc, char *argv[])
bool done;

printf("-------------------------------------------------------------------------------\n");
printf(" %s\n", MAPTITLESTRING);
printf(" %s %s\n", TITLESTRING, MAPTITLESTRING);
printf("-------------------------------------------------------------------------------\n");
printf("\n---------------- startup ----------------\n");

Expand All @@ -447,7 +449,9 @@ int main(int argc, char *argv[])

//Add all of the maps that are world only so we can edit them
maplist->addWorldMaps();
gfx_settitle(MAPTITLESTRING);
char title[128];
sprintf(title, "%s %s", TITLESTRING, MAPTITLESTRING);
gfx_settitle(title);

printf("\n---------------- loading graphics ----------------\n");

Expand Down
9 changes: 3 additions & 6 deletions src/smw/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
along with SMW. If not, see <http://www.gnu.org/licenses/>. */


#define TITLESTRING "Super Mario War"
#define VERSIONNUMBER "2.0"

#include "CmdArgs.h"
#include "FileList.h"
#include "GameMode.h"
Expand Down Expand Up @@ -314,7 +311,7 @@ int main(int argc, char *argv[])
return 1;
}
if (cmd.show_help) {
cmd::print_help(TITLESTRING, VERSIONNUMBER);
cmd::print_help(TITLESTRING, GIT_REVISION);
return 0;
}
if (cmd.debug) {
Expand Down Expand Up @@ -349,7 +346,7 @@ void main_game()
create_globals();

printf("-------------------------------------------------------------------------------\n");
printf(" %s %s\n", TITLESTRING, VERSIONNUMBER);
printf(" %s %s %s\n", TITLESTRING, GIT_REVISION, GIT_DATE);
printf("-------------------------------------------------------------------------------\n");
printf("\n---------------- startup ----------------\n");

Expand Down Expand Up @@ -377,7 +374,7 @@ void main_game()
//currently this only sets the title, not the icon.
//setting the icon isn't implemented in sdl -> i'll ask on the mailing list
char title[128];
sprintf(title, "%s %s %s %s", TITLESTRING, VERSIONNUMBER, GIT_REVISION, GIT_DATE);
sprintf(title, "%s %s %s", TITLESTRING, GIT_REVISION, GIT_DATE);
gfx_settitle(title);
SDL_ShowCursor(SDL_DISABLE);

Expand Down
12 changes: 8 additions & 4 deletions src/worldeditor/worldeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#define SDL_Delay(n) ;
#endif

#define MAPTITLESTRING "SMW 2.0 World Editor"
#define MAPTITLESTRING "World Editor"

enum {EDITOR_EDIT, EDITOR_WATER, EDITOR_BACKGROUND, EDITOR_STAGEFOREGROUND, EDITOR_STRUCTUREFOREGROUND, EDITOR_BRIDGES, EDITOR_PATHSPRITE, EDITOR_VEHICLES, EDITOR_QUIT, SAVE_AS, FIND, CLEAR_WORLD, NEW_WORLD, RESIZE_WORLD, SAVE, EDITOR_WARP, DISPLAY_HELP, EDITOR_PATH, EDITOR_TYPE, EDITOR_BOUNDARY, EDITOR_START_ITEMS, EDITOR_STAGE};

Expand Down Expand Up @@ -457,7 +457,9 @@ int main(int argc, char *argv[])
return 1;
}
if (cmd.show_help) {
cmd::print_help(MAPTITLESTRING, "");
char title[128];
sprintf(title, "%s %s", TITLESTRING, MAPTITLESTRING);
cmd::print_help(title, "");
return 0;
}
if (cmd.debug) {
Expand Down Expand Up @@ -487,7 +489,7 @@ int main(int argc, char *argv[])
bool done;

printf("-------------------------------------------------------------------------------\n");
printf(" %s\n", MAPTITLESTRING);
printf(" %s %s\n", TITLESTRING, MAPTITLESTRING);
printf("-------------------------------------------------------------------------------\n");
printf("\n---------------- startup ----------------\n");

Expand All @@ -507,7 +509,9 @@ int main(int argc, char *argv[])
blitdest = screen;
g_tilesetmanager->init(convertPath("gfx/Classic/tilesets").c_str());

gfx_settitle(MAPTITLESTRING);
char title[128];
sprintf(title, "%s %s", TITLESTRING, MAPTITLESTRING);
gfx_settitle(title);

game_values.toplayer = true;

Expand Down

0 comments on commit 1e94352

Please sign in to comment.