Improve undefined map assembler messages (#2196)

This commit is contained in:
Martin Griffin
2025-10-30 01:34:03 +00:00
committed by GitHub
parent 1de27646d2
commit d1d5435487
9 changed files with 46 additions and 19 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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<string> 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);