From fa5ca10b17ee602f8f078e6ff597e990125aef66 Mon Sep 17 00:00:00 2001 From: Josh <32826900+ShinyDragonHunter@users.noreply.github.com> Date: Sun, 19 Oct 2025 18:32:19 +0100 Subject: [PATCH 1/3] Add spritesheet rules for healthbox graphics (#2180) --- .../healthbox_doubles_opponent.png | Bin 284 -> 277 bytes .../healthbox_doubles_player.png | Bin 293 -> 282 bytes graphics/battle_interface/healthbox_safari.png | Bin 297 -> 284 bytes .../healthbox_singles_opponent.png | Bin 296 -> 278 bytes .../healthbox_singles_player.png | Bin 336 -> 328 bytes spritesheet_rules.mk | 16 ++++++++++++++++ 6 files changed, 16 insertions(+) diff --git a/graphics/battle_interface/healthbox_doubles_opponent.png b/graphics/battle_interface/healthbox_doubles_opponent.png index def9d07af0000520355bbd783c6ba2f27ff1fc67..28fdbbbeb984bf600c0053c14c26901ac57248fc 100644 GIT binary patch delta 224 zcmbQkG?huQGr-TCmrII^fq{Y7)59eQNH+kn0t+*c)Zob#o2Y1C&spFRSBnm?xchdFtB#ul~-b5Dr#)J|zFja@)%@%3Y$azBnpm;hJivpBjYYV_sfE?~79SN8UP@>MAkOK2j1$0ti zWR4}ikrgzXr(wo7vH}frEJ+4UJprZ>C|0;*Np&cW>`22j0$G7d8J2{LoFv=Z(lCu6 hl&Dei1vdF10RWZr=~ntpgyR4J002ovPDHLkV1oFvRq6l$ diff --git a/graphics/battle_interface/healthbox_doubles_player.png b/graphics/battle_interface/healthbox_doubles_player.png index f843c664b19abef8d15df4fe13f3ef0fc88ac5d2..c3587ec3fd14505ac511b1fb72f3bd07c097846c 100644 GIT binary patch delta 229 zcmZ3=G>b{GGr-TCmrII^fq{Y7)59eQNH+kn0t+*c)Zob#o2Y1C&spFRS_uuxI87O=k1ZL)y*l7|L=$f*q$3TvBxC~e#;YAhKLr_sFEQRTp@dXWG& Zh7(yY-**0X*aLJNgQu&X%Q~loCIF&;Mk)XR delta 240 zcmbQmw3JD)Gr-TCmrII^fq{Y7)59eQNIQTq3p0?6aL;)=QPIABgQtsQh(~8~!UCZL z-@~j6K1n{^!QkTP(z@A@k0EfvyCp5$4mmFlXz~Xh2y^mq{J4T?kw}YRz=2tA4vrFx ztOu^N#DnMsPddUGFEp6cykwj+&$>X(Guf$AYSya51!>(Tt5S9=G8ov*>srR3{Nff< zfarquy`Jt&tC)IT6uYS}IZzYAI9EhMFzAAhM1vCGr-TCmrII^fq{Y7)59eQNH+kn0}C^dRQQqPGf~mLp0mIsvY3H^?+6Gp zPSxg<21-uyba4!cXnlLlkk7$Epf&NVRmTp-&UsF&HwI?$*dFA(kvv%=y=!L9;)?qH z@yjOIcz&8JvvT&4@23~Od&QDqG21Cp(v5M(YoAzc2E7;e)2A{liPqV`#K3TXPk@m@ zfPV|q16_v)4a$f0p4eKm+pzvMxhH=6dHF5f$7k5@z5dU;&#kOsqu!?m%})*UYFRlH dTQ2lhG5isYTU9F^(*blIgQu&X%Q~loCIHg@Q~Lk_ delta 244 zcmVf3!(N zK~z|U?Uk_(f=~=a-+~`P`~ytfVPIvEII>vXCBhfr`)m`-LTg_c)PdZy_N1NeZ3tf? zBa3-{8!T8jk5ys7!nMpT_(C-2EbMwuxI=)jHKBEcjGSDw6wPQB9DO_7!+SxBRCmlm zdI5P0XjOv&0RE3k>qQ8vQl@4pO2|$+#BM35TB|+b2w_WtcmWU$q4tF62>XW+WHg_X u$hQi&EPxOHyz_*{5k$qP`6&PZe$ES1FkY(iS^ePv0000u8IGr-TCmrII^fq{Y7)59eQNH+kn0t+*c)Zob#o2Y1C&spFRS>UlAce97O%YE`{*Y6b z47gpl@jdE3^36=g{Hc*=tI>v(<0VcKAFndKTh%BcydjiVWhc{WVF@SA(nAbP3|x9L V;bJ$}r2!qr;OXk;vd$@?2>_8wMX&$> delta 243 zcmbQnw1P>oGr-TCmrII^fq{Y7)59eQNIQTq3p0?6aL;)=QPIABv!{z=h(~8~!UCoQ z-^1(;pCq6DU|@E3Y29onci_N;cS~CM4K|cLm>Qmxpsl!MK}E#V;{oSG654UZOu=x_xzt<_}+W-Qtsw*u6{1-oD!M<%Bxr+ diff --git a/graphics/battle_interface/healthbox_singles_player.png b/graphics/battle_interface/healthbox_singles_player.png index 0862ca399d54ce6f77b94432f6189a8eed4e386a..cf65e676129334422cf47eccbc013ed8ec6c8967 100644 GIT binary patch delta 275 zcmcb>bb?8-Gr-TCmrII^fq{Y7)59eQNH+kn0}C^dRQQqPGf~mLp0mIsvY3H^?+6Gp zPSxg<21@Spba4!cXnlKaBiA7Vfny)_J~}ov7e^OdpR_KPr!ThZ)tVK%FFfOH*_Yeg zSN@=t`DDTWoj)f!J0-$f_WKBLCrhuw9*%x54LQ66UAiESbr~%Gof@c zQ#h;0590u@#_1wAPGmANJk;iB4C0DlEnprNrPHsZeF1H})^3#BgF9nbWa zOt<;)Z};!s;&p{{>|5kwA6(`UpK(9nzlPn-iQ*mY$p;wNelfk_d!c>7#P{-+o+yT` XY{3tXHZyMldWFH$)z4*}Q$iB}uRCsd delta 283 zcmV+$0p$M30?+~>iBL{Q4GJ0x0000DNk~Le0000$0001h1Oos707f7?k! zK~z|U?Uu0)f+sci6e_uXN|a<;5~r}Z|j9qBP~rAHHP$C`{g?Q ze=i6=Lh!uq^S7`(7uL>zvDW#?X)93|nPf(m03N Date: Tue, 28 Oct 2025 06:19:12 -0300 Subject: [PATCH 2/3] Remove magic numbers in slot_machine.c (#2195) --- src/slot_machine.c | 59 +++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/src/slot_machine.c b/src/slot_machine.c index 217767fc9e..da8b3613b3 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -314,6 +314,11 @@ enum { DIG_DISPLAY_BONUS_BIG }; +// IDs for the text windows +enum { + WIN_MSG, + WIN_INFO, +}; // How ReelTime works // ================== @@ -1249,7 +1254,7 @@ static void SlotMachineSetup_LoadGfxAndTilemaps(void) LoadSlotMachineGfx(); LoadMessageBoxGfx(0, 0x200, BG_PLTT_ID(15)); LoadUserWindowBorderGfx(0, 0x214, BG_PLTT_ID(14)); - PutWindowTilemap(0); + PutWindowTilemap(WIN_MSG); } static void CreateSlotMachineSprites(void) @@ -1390,9 +1395,9 @@ static bool8 SlotTask_HandleBetInput(struct Task *task) // SLOTTASK_MSG_NEED_3_COINS static bool8 SlotTask_PrintMsg_Need3Coins(struct Task *task) { - DrawDialogueFrame(0, FALSE); - AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); - CopyWindowToVram(0, COPYWIN_FULL); + DrawDialogueFrame(WIN_MSG, FALSE); + AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); + CopyWindowToVram(WIN_MSG, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_NEED_3_COINS; return FALSE; } @@ -1402,7 +1407,7 @@ static bool8 SlotTask_WaitMsg_Need3Coins(struct Task *task) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - ClearDialogWindowAndFrame(0, TRUE); + ClearDialogWindowAndFrame(WIN_MSG, TRUE); sSlotMachine->state = SLOTTASK_BET_INPUT; } return FALSE; @@ -1655,9 +1660,9 @@ static bool8 SlotTask_NoMatches(struct Task *task) // SLOTTASK_ASK_QUIT static bool8 SlotTask_AskQuit(struct Task *task) { - DrawDialogueFrame(0, FALSE); - AddTextPrinterParameterized(0, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0); - CopyWindowToVram(0, COPYWIN_FULL); + DrawDialogueFrame(WIN_MSG, FALSE); + AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0); + CopyWindowToVram(WIN_MSG, COPYWIN_FULL); CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF); sSlotMachine->state = SLOTTASK_HANDLE_QUIT_INPUT; return FALSE; @@ -1669,16 +1674,16 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task) s8 input = Menu_ProcessInputNoWrapClearOnChoose(); if (input == 0) // Chose to quit { - ClearDialogWindowAndFrame(0, TRUE); + ClearDialogWindowAndFrame(WIN_MSG, TRUE); DarkenBetTiles(0); DarkenBetTiles(1); DarkenBetTiles(2); sSlotMachine->coins += sSlotMachine->bet; sSlotMachine->state = SLOTTASK_END; } - else if (input == 1 || input == -1) // Chose not to quit + else if (input == 1 || input == MENU_B_PRESSED) // Chose not to quit { - ClearDialogWindowAndFrame(0, TRUE); + ClearDialogWindowAndFrame(WIN_MSG, TRUE); sSlotMachine->state = SLOTTASK_BET_INPUT; } return FALSE; @@ -1687,9 +1692,9 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task) // SLOTTASK_MSG_MAX_COINS static bool8 SlotTask_PrintMsg_MaxCoins(struct Task *task) { - DrawDialogueFrame(0, FALSE); - AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0); - CopyWindowToVram(0, COPYWIN_FULL); + DrawDialogueFrame(WIN_MSG, FALSE); + AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0); + CopyWindowToVram(WIN_MSG, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_MAX_COINS; return FALSE; } @@ -1699,7 +1704,7 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - ClearDialogWindowAndFrame(0, TRUE); + ClearDialogWindowAndFrame(WIN_MSG, TRUE); sSlotMachine->state = SLOTTASK_BET_INPUT; } return FALSE; @@ -1708,9 +1713,9 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task) // SLOTTASK_MSG_NO_MORE_COINS static bool8 SlotTask_PrintMsg_NoMoreCoins(struct Task *task) { - DrawDialogueFrame(0, FALSE); - AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0); - CopyWindowToVram(0, COPYWIN_FULL); + DrawDialogueFrame(WIN_MSG, FALSE); + AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0); + CopyWindowToVram(WIN_MSG, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_NO_MORE_COINS; return FALSE; } @@ -1720,7 +1725,7 @@ static bool8 SlotTask_WaitMsg_NoMoreCoins(struct Task *task) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - ClearDialogWindowAndFrame(0, TRUE); + ClearDialogWindowAndFrame(WIN_MSG, TRUE); sSlotMachine->state = SLOTTASK_END; } return FALSE; @@ -3922,15 +3927,15 @@ static void InfoBox_DrawWindow(struct Task *task) DestroyDigitalDisplayScene(); LoadInfoBoxTilemap(); AddWindow(&sWindowTemplate_InfoBox); - PutWindowTilemap(1); - FillWindowPixelBuffer(1, PIXEL_FILL(0)); + PutWindowTilemap(WIN_INFO); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); task->tState++; } static void InfoBox_AddText(struct Task *task) { - AddTextPrinterParameterized3(1, FONT_NORMAL, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp); - CopyWindowToVram(1, COPYWIN_FULL); + AddTextPrinterParameterized3(WIN_INFO, FONT_NORMAL, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp); + CopyWindowToVram(WIN_INFO, COPYWIN_FULL); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); task->tState++; } @@ -3939,10 +3944,10 @@ static void InfoBox_WaitInput(struct Task *task) { if (JOY_NEW(B_BUTTON | SELECT_BUTTON)) { - FillWindowPixelBuffer(1, PIXEL_FILL(0)); - ClearWindowTilemap(1); - CopyWindowToVram(1, COPYWIN_MAP); - RemoveWindow(1); + FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); + ClearWindowTilemap(WIN_INFO); + CopyWindowToVram(WIN_INFO, COPYWIN_MAP); + RemoveWindow(WIN_INFO); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); task->tState++; } From d1d543548772cbdf087c5ccc1e0b19980aa9ad87 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Thu, 30 Oct 2025 01:34:03 +0000 Subject: [PATCH 3/3] Improve undefined map assembler messages (#2196) --- asm/macros/event.inc | 16 ++++++++++++++++ asm/macros/map.inc | 4 ++++ data/event_scripts.s | 4 ++-- data/maps/LilycoveCity_Harbor/scripts.inc | 4 ++-- data/maps/LittlerootTown/scripts.inc | 2 +- data/maps/SlateportCity_Harbor/scripts.inc | 2 +- data/scripts/cable_club.inc | 12 ++++++------ include/constants/maps.h | 11 +++++++---- tools/mapjson/mapjson.cpp | 10 +++++++--- 9 files changed, 46 insertions(+), 19 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 797d549dc9..7075481750 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -667,6 +667,14 @@ map \map .endm + @ Set the player object's invisibility to FALSE. + .macro showplayer + .byte SCR_OP_SHOWOBJECTAT + .2byte LOCALID_PLAYER + .byte 0 @ map group + .byte 0 @ map num + .endm + @ Sets the specified object's invisibility to TRUE. .macro hideobjectat localId:req, map:req .byte SCR_OP_HIDEOBJECTAT @@ -674,6 +682,14 @@ map \map .endm + @ Set the player object's invisibility to TRUE. + .macro hideplayer + .byte SCR_OP_HIDEOBJECTAT + .2byte LOCALID_PLAYER + .byte 0 @ map group + .byte 0 @ map num + .endm + @ Turns the currently selected object (if there is one) to face the player. .macro faceplayer .byte SCR_OP_FACEPLAYER diff --git a/asm/macros/map.inc b/asm/macros/map.inc index 21445138de..acbcd532dd 100644 --- a/asm/macros/map.inc +++ b/asm/macros/map.inc @@ -2,8 +2,12 @@ @ Takes a MAP constant and outputs the map group and map number as separate bytes .macro map map_id:req + .ifdef \map_id .byte \map_id >> 8 @ map group .byte \map_id & 0xFF @ map num + .else + .error "undefined map (check for typos)" + .endif .endm @ Defines a map script. 'type' is any MAP_SCRIPT_* constant (see include/constants/map_scripts.h) diff --git a/data/event_scripts.s b/data/event_scripts.s index 0cc95940f8..33fc318957 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -787,7 +787,7 @@ EventScript_UnusedBoardFerry:: delay 30 applymovement LOCALID_PLAYER, Common_Movement_WalkInPlaceFasterUp waitmovement 0 - showobjectat LOCALID_PLAYER, 0 + showplayer delay 30 applymovement LOCALID_PLAYER, Movement_UnusedBoardFerry waitmovement 0 @@ -802,7 +802,7 @@ Common_EventScript_FerryDepartIsland:: call_if_eq VAR_FACING, DIR_SOUTH, Ferry_EventScript_DepartIslandSouth call_if_eq VAR_FACING, DIR_WEST, Ferry_EventScript_DepartIslandWest delay 30 - hideobjectat LOCALID_PLAYER, 0 + hideplayer call Common_EventScript_FerryDepart return diff --git a/data/maps/LilycoveCity_Harbor/scripts.inc b/data/maps/LilycoveCity_Harbor/scripts.inc index 9388609ab5..89bbb0714c 100644 --- a/data/maps/LilycoveCity_Harbor/scripts.inc +++ b/data/maps/LilycoveCity_Harbor/scripts.inc @@ -333,7 +333,7 @@ LilycoveCity_Harbor_EventScript_BoardFerryWithSailor:: call_if_eq VAR_FACING, DIR_NORTH, LilycoveCity_Harbor_EventScript_PlayerBoardFerryNorth call_if_eq VAR_FACING, DIR_EAST, LilycoveCity_Harbor_EventScript_PlayerBoardFerryEast delay 30 - hideobjectat LOCALID_PLAYER, 0 + hideplayer setvar VAR_0x8004, LOCALID_LILYCOVE_HARBOR_SS_TIDAL call Common_EventScript_FerryDepart return @@ -393,7 +393,7 @@ LilycoveCity_Harbor_EventScript_BoardFerry:: call_if_eq VAR_FACING, DIR_NORTH, LilycoveCity_Harbor_EventScript_PlayerBoardFerryNorth call_if_eq VAR_FACING, DIR_EAST, LilycoveCity_Harbor_EventScript_PlayerBoardFerryEast delay 30 - hideobjectat LOCALID_PLAYER, 0 + hideplayer setvar VAR_0x8004, LOCALID_LILYCOVE_HARBOR_SS_TIDAL call Common_EventScript_FerryDepart return diff --git a/data/maps/LittlerootTown/scripts.inc b/data/maps/LittlerootTown/scripts.inc index fd1d970b13..6a2c6af41b 100644 --- a/data/maps/LittlerootTown/scripts.inc +++ b/data/maps/LittlerootTown/scripts.inc @@ -156,7 +156,7 @@ LittlerootTown_EventScript_GoInsideWithMom:: waitmovement 0 setflag FLAG_HIDE_LITTLEROOT_TOWN_MOM_OUTSIDE setvar VAR_LITTLEROOT_INTRO_STATE, 3 - hideobjectat LOCALID_PLAYER, 0 + hideplayer closedoor VAR_0x8004, VAR_0x8005 waitdooranim clearflag FLAG_HIDE_LITTLEROOT_TOWN_FAT_MAN diff --git a/data/maps/SlateportCity_Harbor/scripts.inc b/data/maps/SlateportCity_Harbor/scripts.inc index ebcd40ab0c..52fd04ec65 100644 --- a/data/maps/SlateportCity_Harbor/scripts.inc +++ b/data/maps/SlateportCity_Harbor/scripts.inc @@ -228,7 +228,7 @@ SlateportCity_Harbor_EventScript_BoardFerry:: call_if_eq VAR_FACING, DIR_NORTH, SlateportCity_Harbor_EventScript_BoardFerryNorth call_if_eq VAR_FACING, DIR_EAST, SlateportCity_Harbor_EventScript_BoardFerryEast delay 30 - hideobjectat LOCALID_PLAYER, 0 + hideplayer setvar VAR_0x8004, LOCALID_SLATEPORT_HARBOR_SS_TIDAL call Common_EventScript_FerryDepart return diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 68d619097f..a6a13fe940 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -356,7 +356,7 @@ CableClub_EventScript_EnterColosseum:: waitdooranim applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobjectat LOCALID_PLAYER, 0 + hideplayer closedoor 9, 1 waitdooranim release @@ -450,7 +450,7 @@ CableClub_EventScript_EnterTradeCenter:: waitdooranim applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobjectat LOCALID_PLAYER, 0 + hideplayer closedoor 9, 1 waitdooranim release @@ -515,7 +515,7 @@ CableClub_EventScript_EnterRecordCorner:: waitdooranim applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobjectat LOCALID_PLAYER, 0 + hideplayer closedoor 9, 1 waitdooranim release @@ -902,7 +902,7 @@ CableClub_EventScript_EnterUnionRoom:: waitdooranim applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobjectat LOCALID_PLAYER, 0 + hideplayer closedoor 5, 1 waitdooranim special Script_ResetUnionRoomTrade @@ -1202,7 +1202,7 @@ CableClub_EventScript_EnterWirelessLinkRoom:: waitdooranim applymovement LOCALID_PLAYER, Movement_PlayerEnterLinkRoom waitmovement 0 - hideobjectat LOCALID_PLAYER, 0 + hideplayer closedoor 9, 1 waitdooranim release @@ -1380,7 +1380,7 @@ MossdeepCity_GameCorner_1F_EventScript_EnterMinigameRoom:: closemessage applymovement LOCALID_PLAYER, Movement_PlayerEnterMinigameRoom waitmovement 0 - hideobjectat LOCALID_PLAYER, 0 + hideplayer release waitstate end diff --git a/include/constants/maps.h b/include/constants/maps.h index d41f03c683..36e27d78b7 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -3,11 +3,14 @@ #include "map_groups.h" -// Warps using this map will instead use the warp data stored in gSaveBlock1Ptr->dynamicWarp. -// Used for warps that need to change destinations, e.g. when stepping off an elevator. -#define MAP_DYNAMIC (0x7F | (0x7F << 8)) +enum +{ + // Warps using this map will instead use the warp data stored in gSaveBlock1Ptr->dynamicWarp. + // Used for warps that need to change destinations, e.g. when stepping off an elevator. + MAP_DYNAMIC = (0x7F | (0x7F << 8)), -#define MAP_UNDEFINED (0xFF | (0xFF << 8)) + MAP_UNDEFINED = (0xFF | (0xFF << 8)), +}; #define MAP_GROUP(map) (map >> 8) #define MAP_NUM(map) (map & 0xFF) diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 8d8ec4e4e6..5ceac10393 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -526,11 +526,13 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { ostringstream text; text << get_include_guard_start(guard_name) << get_generated_warning("data/maps/map_groups.json", false); + text << "enum\n{\n"; + int group_num = 0; for (auto &group : groups_data["group_order"].array_items()) { string groupName = json_to_string(group); - text << "// " << groupName << "\n"; + text << " // " << groupName << "\n"; vector map_ids; size_t max_length = 0; @@ -548,14 +550,16 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { int map_id_num = 0; for (string map_id : map_ids) { - text << "#define " << map_id << string((max_length - map_id.length() + 1), ' ') - << "(" << map_id_num++ << " | (" << group_num << " << 8))\n"; + text << " " << map_id << string(max_length - map_id.length(), ' ') + << " = (" << map_id_num++ << " | (" << group_num << " << 8)),\n"; } text << "\n"; group_num++; } + text << "};\n\n"; + text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n"; text << get_include_guard_end(guard_name);