diff --git a/asm/macros/event.inc b/asm/macros/event.inc index f8578a4a9c..56b5d1d9a0 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -684,6 +684,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 @@ -691,6 +699,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 74d2b5ff42..56d7387238 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 9cedbb04d7..23ce59545b 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -835,7 +835,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 @@ -850,7 +850,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 227981578f..1c547f8980 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 @@ -1384,7 +1384,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/graphics/battle_interface/healthbox_doubles_opponent.png b/graphics/battle_interface/healthbox_doubles_opponent.png index def9d07af0..28fdbbbeb9 100644 Binary files a/graphics/battle_interface/healthbox_doubles_opponent.png and b/graphics/battle_interface/healthbox_doubles_opponent.png differ diff --git a/graphics/battle_interface/healthbox_doubles_player.png b/graphics/battle_interface/healthbox_doubles_player.png index f843c664b1..c3587ec3fd 100644 Binary files a/graphics/battle_interface/healthbox_doubles_player.png and b/graphics/battle_interface/healthbox_doubles_player.png differ diff --git a/graphics/battle_interface/healthbox_safari.png b/graphics/battle_interface/healthbox_safari.png index e48f380a4b..b2a9255c5a 100644 Binary files a/graphics/battle_interface/healthbox_safari.png and b/graphics/battle_interface/healthbox_safari.png differ diff --git a/graphics/battle_interface/healthbox_singles_opponent.png b/graphics/battle_interface/healthbox_singles_opponent.png index 52f70e8580..3047ed62d0 100644 Binary files a/graphics/battle_interface/healthbox_singles_opponent.png and b/graphics/battle_interface/healthbox_singles_opponent.png differ diff --git a/graphics/battle_interface/healthbox_singles_player.png b/graphics/battle_interface/healthbox_singles_player.png index 0862ca399d..cf65e67612 100644 Binary files a/graphics/battle_interface/healthbox_singles_player.png and b/graphics/battle_interface/healthbox_singles_player.png differ 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/spritesheet_rules.mk b/spritesheet_rules.mk index ef5da9c091..7c05219f8a 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -1,6 +1,7 @@ POKEMONGFXDIR := graphics/pokemon OBJEVENTGFXDIR := graphics/object_events/pics FLDEFFGFXDIR := graphics/field_effects/pics +BATINTGFXDIR := graphics/battle_interface MISCGFXDIR := graphics/misc $(OBJEVENTGFXDIR)/people/brendan/walking.4bpp: %.4bpp: %.png @@ -4934,3 +4935,18 @@ $(OBJEVENTGFXDIR)/misc/ball_%.4bpp: $(OBJEVENTGFXDIR)/misc/ball_%.png ; $(GFX) $ graphics/door_anims/battle_tower_multi_corridor.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 4 + +$(BATINTGFXDIR)/healthbox_doubles_opponent.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 8 -mheight 4 + +$(BATINTGFXDIR)/healthbox_doubles_player.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 8 -mheight 4 + +$(BATINTGFXDIR)/healthbox_safari.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 8 -mheight 8 + +$(BATINTGFXDIR)/healthbox_singles_opponent.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 8 -mheight 4 + +$(BATINTGFXDIR)/healthbox_singles_player.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 8 -mheight 8 diff --git a/src/slot_machine.c b/src/slot_machine.c index 5e6406f0a8..e35087e513 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++; } diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 4dd036dc19..936c2a5286 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -530,12 +530,14 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n"; + text << "enum\n{\n"; + int group_num = 0; vector map_count_vec; //DEBUG 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; @@ -556,8 +558,8 @@ 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"; @@ -565,6 +567,8 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) { map_count_vec.push_back(map_count); //DEBUG } + text << "};\n\n"; + text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n"; text << get_include_guard_end(guard_name);