Skip to content

Commit

Permalink
Moved some global constants
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed Apr 8, 2024
1 parent 5f74b22 commit 762858b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
11 changes: 7 additions & 4 deletions src/common/FileList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
#include <cstring>

extern const char * g_szMusicCategoryNames[MAXMUSICCATEGORY];
extern short g_iDefaultMusicCategory[MAXMUSICCATEGORY];

extern MusicList* musiclist;
extern WorldMusicList* worldmusiclist;

namespace {
const short g_iDefaultMusicCategory[MAXMUSICCATEGORY] {0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0};
}// namespace


struct MapMusicOverride {
Expand All @@ -26,9 +32,6 @@ struct WorldMusicOverride {
std::vector<MapMusicOverride> mapmusicoverrides;
std::vector<WorldMusicOverride> worldmusicoverrides;

extern MusicList* musiclist;
extern WorldMusicList* worldmusiclist;

void UpdateMusicWithOverrides()
{
enum class Category : unsigned char {
Expand Down
9 changes: 0 additions & 9 deletions src/common/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,10 @@ void _load_waitforkey()
}



short iScoreboardPlayerOffsetsX[3][3] = {{40, 0, 0}, {19, 59, 0}, {6, 40, 74}};
short iKingOfTheHillZoneLimits[4][4] = {{0, 0, 1, 2}, {0, 1, 2, 4}, {0, 2, 4, 7}, {0, 2, 5, 12}};

//Conversion from backgrounds to music categories created by NMcCoy
short g_iMusicCategoryConversion[26] = {0, 3, 8, 5, 1, 9, 3, 4, 10, 8, 1, 0, 9, 0, 0, 7, 4, 1, 1, 6, 4, 7, 6, 3, 0, 4};
const char * g_szMusicCategoryNames[MAXMUSICCATEGORY] = {"Land", "Underground", "Underwater", "Castle", "Platforms", "Ghost", "Bonus", "Battle", "Desert", "Clouds", "Snow"};
short g_iDefaultMusicCategory[MAXMUSICCATEGORY] = {0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0};

const char * g_szWorldMusicCategoryNames[MAXWORLDMUSICCATEGORY] = {"Grass", "Desert", "Water", "Giant", "Sky", "Ice", "Pipe", "Dark", "Space"};

const char * g_szAutoFilterNames[NUM_AUTO_FILTERS] = {"Death Tiles", "Warps", "Ice", "Item Boxes", "Breakable Blocks", "Throwable Blocks", "On/Off Blocks", "Platforms", "Hazards", "Item Destroyable Blocks", "Hidden Blocks", "Map Items"};
short g_iAutoFilterIcons[NUM_AUTO_FILTERS] = {37, 29, 33, 1, 0, 6, 40, 73, 19, 87, 17, 118};


void LoadCurrentMapBackground()
Expand Down
5 changes: 4 additions & 1 deletion src/common/map/MapReader15xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstring>

extern CTilesetManager* g_tilesetmanager;
extern short g_iMusicCategoryConversion[26];
extern short g_iTileTypeConversion[NUMTILETYPES];
extern short g_iDefaultPowerupPresets[NUM_POWERUP_PRESETS][NUM_POWERUPS];

Expand Down Expand Up @@ -40,6 +39,10 @@ const char * g_szBackgroundConversion[26] = {
"Platforms_BlueSpottedHills.png"
};

namespace {
const short g_iMusicCategoryConversion[26] {0, 3, 8, 5, 1, 9, 3, 4, 10, 8, 1, 0, 9, 0, 0, 7, 4, 1, 1, 6, 4, 7, 6, 3, 0, 4};
} // namespace

void MapReader1500::read_autofilters(CMap& map, BinaryFile& mapfile)
{
for (short iFilter = 0; iFilter < NUM_AUTO_FILTERS; iFilter++)
Expand Down
19 changes: 17 additions & 2 deletions src/smw/menu/GameSettingsMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,23 @@ extern CGameValues game_values;
extern CResourceManager* rm;
extern FiltersList* filterslist;

extern const char* g_szAutoFilterNames[NUM_AUTO_FILTERS];
extern short g_iAutoFilterIcons[NUM_AUTO_FILTERS];
namespace {
const char* g_szAutoFilterNames[NUM_AUTO_FILTERS] {
"Death Tiles",
"Warps",
"Ice",
"Item Boxes",
"Breakable Blocks",
"Throwable Blocks",
"On/Off Blocks",
"Platforms",
"Hazards",
"Item Destroyable Blocks",
"Hidden Blocks",
"Map Items",
};
const short g_iAutoFilterIcons[NUM_AUTO_FILTERS] {37, 29, 33, 1, 0, 6, 40, 73, 19, 87, 17, 118};
} // namespace


UI_GameSettingsMenu::UI_GameSettingsMenu()
Expand Down
5 changes: 4 additions & 1 deletion src/smw/ui/MI_TournamentScoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
extern CGameValues game_values;
extern CResourceManager* rm;
extern CScore* score[4];
extern short iScoreboardPlayerOffsetsX[3][3];

namespace {
const short iScoreboardPlayerOffsetsX[3][3] = {{40, 0, 0}, {19, 59, 0}, {6, 40, 74}};
} // namespace


//Call with x = 70 and y == 80
Expand Down
12 changes: 11 additions & 1 deletion src/worldeditor/worldeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,17 @@ bool ignoreclick = false;

char findstring[FILEBUFSIZE] = "";

extern const char * g_szWorldMusicCategoryNames[MAXWORLDMUSICCATEGORY];
const char* g_szWorldMusicCategoryNames[MAXWORLDMUSICCATEGORY] {
"Grass",
"Desert",
"Water",
"Giant",
"Sky",
"Ice",
"Pipe",
"Dark",
"Space",
};
short g_musiccategorydisplaytimer = 0;

short g_messagedisplaytimer = 0;
Expand Down

0 comments on commit 762858b

Please sign in to comment.