Sync clone object macro

This commit is contained in:
GriffinR 2023-02-08 13:11:10 -05:00
parent 118a9701c9
commit de56e400ff
5 changed files with 28 additions and 9 deletions

View File

@ -19,11 +19,11 @@
.4byte \script .4byte \script
.endm .endm
@ Defines an object event template for map data. Mirrors the struct layout of ObjectEventTemplate in include/global.fieldmap.h @ 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, 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 .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 \index
.byte \gfx .byte \gfx
.byte \inConnection .byte OBJ_KIND_NORMAL
.space 1 @ Padding .space 1 @ Padding
.2byte \x, \y .2byte \x, \y
.byte \elevation .byte \elevation
@ -38,6 +38,22 @@
inc _num_npcs inc _num_npcs
.endm .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 @ 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 .macro warp_def x:req, y:req, elevation:req, warpId:req, map_id:req
.2byte \x, \y .2byte \x, \y
@ -49,12 +65,12 @@
.endm .endm
@ Defines a coord event for map data. Mirrors the struct layout of CoordEvent in include/global.fieldmap.h @ 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 .2byte \x, \y
.byte \elevation .byte \elevation
.space 1 @ Padding .space 1 @ Padding
.2byte \trigger .2byte \var
.2byte \index .2byte \varValue
.space 2 @ Padding .space 2 @ Padding
.4byte \script .4byte \script
inc _num_traps inc _num_traps

View File

@ -288,6 +288,9 @@
#define FIRST_DECORATION_SPRITE_GFX OBJ_EVENT_GFX_PICHU_DOLL #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 // Special object event local ids
#define OBJ_EVENT_ID_PLAYER 0xFF #define OBJ_EVENT_ID_PLAYER 0xFF
#define OBJ_EVENT_ID_CAMERA 0x7F #define OBJ_EVENT_ID_CAMERA 0x7F

View File

@ -67,7 +67,7 @@ struct ObjectEventTemplate
{ {
/*0x00*/ u8 localId; /*0x00*/ u8 localId;
/*0x01*/ u8 graphicsId; /*0x01*/ u8 graphicsId;
/*0x02*/ u8 inConnection; // Leftover from FRLG /*0x02*/ u8 kind; // Always OBJ_KIND_NORMAL in Emerald.
/*0x03*/ //u8 padding1; /*0x03*/ //u8 padding1;
/*0x04*/ s16 x; /*0x04*/ s16 x;
/*0x06*/ s16 y; /*0x06*/ s16 y;

View File

@ -1498,7 +1498,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
y -= MAP_OFFSET; y -= MAP_OFFSET;
objectEventTemplate.localId = localId; objectEventTemplate.localId = localId;
objectEventTemplate.graphicsId = graphicsId; objectEventTemplate.graphicsId = graphicsId;
objectEventTemplate.inConnection = 0; objectEventTemplate.kind = OBJ_KIND_NORMAL;
objectEventTemplate.x = x; objectEventTemplate.x = x;
objectEventTemplate.y = y; objectEventTemplate.y = y;
objectEventTemplate.elevation = elevation; objectEventTemplate.elevation = elevation;

View File

@ -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 no type field is present, assume it's a regular object event.
if (type == "" || type == "object") { if (type == "" || type == "object") {
text << "\tobject_event " << i + 1 << ", " 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, "x") << ", "
<< json_to_string(obj_event, "y") << ", " << json_to_string(obj_event, "y") << ", "
<< json_to_string(obj_event, "elevation") << ", " << json_to_string(obj_event, "elevation") << ", "