diff --git a/asm/macros/map.inc b/asm/macros/map.inc index 662257e41..21445138d 100644 --- a/asm/macros/map.inc +++ b/asm/macros/map.inc @@ -19,11 +19,11 @@ .4byte \script .endm - @ Defines an object event template for map data. Mirrors the struct layout of ObjectEventTemplate in include/global.fieldmap.h - .macro object_event index:req, gfx:req, inConnection:req, x:req, y:req, elevation:req, movement_type:req, x_radius:req, y_radius:req, trainer_type:req, sight_radius_tree_etc:req, script:req, event_flag:req + @ Defines an object event template for map data, to be used by a normal object. Mirrors the struct layout of ObjectEventTemplate in include/global.fieldmap.h + .macro object_event index:req, gfx:req, x:req, y:req, elevation:req, movement_type:req, x_radius:req, y_radius:req, trainer_type:req, sight_radius_tree_etc:req, script:req, event_flag:req .byte \index .byte \gfx - .byte \inConnection + .byte OBJ_KIND_NORMAL .space 1 @ Padding .2byte \x, \y .byte \elevation @@ -38,6 +38,22 @@ inc _num_npcs .endm + @ Defines an object event template for map data, to be used by a clone object. Mirrors the struct layout of ObjectEventTemplate in include/global.fieldmap.h + @ NOTE: The handling for this type of event does not exist in Emerald by default; it is exclusive to FRLG. + .macro clone_event index:req, gfx:req, x:req, y:req, target_local_id:req, target_map_id:req + .byte \index + .byte \gfx + .byte OBJ_KIND_CLONE + .space 1 @ Padding + .2byte \x, \y + .byte \target_local_id + .space 3 @ Padding + .2byte \target_map_id & 0xFF @ map num + .2byte \target_map_id >> 8 @ map group + .space 8 @ Padding + inc _num_npcs + .endm + @ Defines a warp event for map data. Mirrors the struct layout of WarpEvent in include/global.fieldmap.h .macro warp_def x:req, y:req, elevation:req, warpId:req, map_id:req .2byte \x, \y @@ -49,12 +65,12 @@ .endm @ Defines a coord event for map data. Mirrors the struct layout of CoordEvent in include/global.fieldmap.h - .macro coord_event x:req, y:req, elevation:req, trigger:req, index:req, script:req + .macro coord_event x:req, y:req, elevation:req, var:req, varValue:req, script:req .2byte \x, \y .byte \elevation .space 1 @ Padding - .2byte \trigger - .2byte \index + .2byte \var + .2byte \varValue .space 2 @ Padding .4byte \script inc _num_traps diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index 8278c6a66..c8fa94265 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -288,6 +288,9 @@ #define FIRST_DECORATION_SPRITE_GFX OBJ_EVENT_GFX_PICHU_DOLL +#define OBJ_KIND_NORMAL 0 +#define OBJ_KIND_CLONE 255 // Exclusive to FRLG + // Special object event local ids #define OBJ_EVENT_ID_PLAYER 0xFF #define OBJ_EVENT_ID_CAMERA 0x7F diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 26e5c44bf..d8fea5b23 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -67,7 +67,7 @@ struct ObjectEventTemplate { /*0x00*/ u8 localId; /*0x01*/ u8 graphicsId; - /*0x02*/ u8 inConnection; // Leftover from FRLG + /*0x02*/ u8 kind; // Always OBJ_KIND_NORMAL in Emerald. /*0x03*/ //u8 padding1; /*0x04*/ s16 x; /*0x06*/ s16 y; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 870f55081..be0c4ce26 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1498,7 +1498,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l y -= MAP_OFFSET; objectEventTemplate.localId = localId; objectEventTemplate.graphicsId = graphicsId; - objectEventTemplate.inConnection = 0; + objectEventTemplate.kind = OBJ_KIND_NORMAL; objectEventTemplate.x = x; objectEventTemplate.y = y; objectEventTemplate.elevation = elevation; diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 10283eb08..460e5e8af 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -206,7 +206,7 @@ string generate_map_events_text(Json map_data) { // If no type field is present, assume it's a regular object event. if (type == "" || type == "object") { text << "\tobject_event " << i + 1 << ", " - << json_to_string(obj_event, "graphics_id") << ", 0, " + << json_to_string(obj_event, "graphics_id") << ", " << json_to_string(obj_event, "x") << ", " << json_to_string(obj_event, "y") << ", " << json_to_string(obj_event, "elevation") << ", "