mapfs shape data (#1087)

* script

* fix prologue printing

* added type hints for return types

* model docs

* more models

* pretty print for sprite xmls on earlier python ver

* 1x oops

* sprite xml labels

* cod cleanup

* type cleanup

* fixes, script erroring

* script fixes

* objcopy

* link, objcopy, etc

* map_shape.ld

* discard

* kpa_117 match

* move stuff into /geom

* fix some shapes

* 253

* 221

* opaque lights

* 488

* all clear

* fixies

* RDP_MATRIX macro

* more explicit property 5F

---------

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
Ethan Roseman 2023-07-18 18:07:58 +09:00 committed by GitHub
parent 1118ee8110
commit 4ad11af535
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
96 changed files with 2116 additions and 1273 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ ctx.c.m2c
build.ninja build.ninja
.ninja* .ninja*
*.ld *.ld
!src/map_shape.ld
*.elf *.elf
*.z64 *.z64
*.v64 *.v64

View File

@ -264,7 +264,7 @@ typedef struct Npc {
/* 0x0AA */ s8 renderMode; /* 0x0AA */ s8 renderMode;
/* 0x0AB */ s8 verticalRenderOffset; /* 0x0AB */ s8 verticalRenderOffset;
/* 0x0AC */ u8 alpha; /* 0x0AC */ u8 alpha;
/* 0x0AD */ u8 alpha2; ///< Multiplied with Npc::alpha /* 0x0AD */ u8 hideAlpha; ///< Used when hiding NPCs; Multiplied with Npc::alpha
/* 0x0AE */ char unk_AE[2]; /* 0x0AE */ char unk_AE[2];
/* 0x0B0 */ AnimID* extraAnimList; /* 0x0B0 */ AnimID* extraAnimList;
/* 0x0B4 */ s8 palSwapType; // 0..4 inclusive /* 0x0B4 */ s8 palSwapType; // 0..4 inclusive

View File

@ -3538,6 +3538,71 @@ enum WindowPriority {
WINDOW_PRIORITY_64 = 64, WINDOW_PRIORITY_64 = 64,
}; };
enum RenderModeIndex {
RENDER_MODE_IDX_00 = 0x00,
RENDER_MODE_IDX_01 = 0x01,
RENDER_MODE_IDX_02 = 0x02,
RENDER_MODE_IDX_03 = 0x03,
RENDER_MODE_IDX_04 = 0x04,
RENDER_MODE_IDX_05 = 0x05,
RENDER_MODE_IDX_06 = 0x06,
RENDER_MODE_IDX_07 = 0x07,
RENDER_MODE_IDX_08 = 0x08,
RENDER_MODE_IDX_09 = 0x09,
RENDER_MODE_IDX_0A = 0x0A,
RENDER_MODE_IDX_0B = 0x0B,
RENDER_MODE_IDX_0C = 0x0C,
RENDER_MODE_IDX_0D = 0x0D,
RENDER_MODE_IDX_0E = 0x0E,
RENDER_MODE_IDX_0F = 0x0F,
RENDER_MODE_IDX_10 = 0x10,
RENDER_MODE_IDX_11 = 0x11,
RENDER_MODE_IDX_12 = 0x12,
RENDER_MODE_IDX_13 = 0x13,
RENDER_MODE_IDX_14 = 0x14,
RENDER_MODE_IDX_15 = 0x15,
RENDER_MODE_IDX_16 = 0x16,
RENDER_MODE_IDX_17 = 0x17,
RENDER_MODE_IDX_18 = 0x18,
RENDER_MODE_IDX_19 = 0x19,
RENDER_MODE_IDX_1A = 0x1A,
RENDER_MODE_IDX_1B = 0x1B,
RENDER_MODE_IDX_1C = 0x1C,
RENDER_MODE_IDX_1D = 0x1D,
RENDER_MODE_IDX_1E = 0x1E,
RENDER_MODE_IDX_1F = 0x1F,
RENDER_MODE_IDX_20 = 0x20,
RENDER_MODE_IDX_21 = 0x21,
RENDER_MODE_IDX_22 = 0x22,
RENDER_MODE_IDX_23 = 0x23,
RENDER_MODE_IDX_24 = 0x24,
RENDER_MODE_IDX_25 = 0x25,
RENDER_MODE_IDX_26 = 0x26,
RENDER_MODE_IDX_27 = 0x27,
RENDER_MODE_IDX_28 = 0x28,
RENDER_MODE_IDX_29 = 0x29,
RENDER_MODE_IDX_2A = 0x2A,
RENDER_MODE_IDX_2B = 0x2B,
RENDER_MODE_IDX_2C = 0x2C,
RENDER_MODE_IDX_2D = 0x2D,
RENDER_MODE_IDX_2E = 0x2E,
RENDER_MODE_IDX_2F = 0x2F,
RENDER_MODE_IDX_30 = 0x30,
RENDER_MODE_IDX_31 = 0x31,
RENDER_MODE_IDX_32 = 0x32,
RENDER_MODE_IDX_33 = 0x33,
RENDER_MODE_IDX_34 = 0x34,
RENDER_MODE_IDX_35 = 0x35,
RENDER_MODE_IDX_36 = 0x36,
RENDER_MODE_IDX_37 = 0x37,
RENDER_MODE_IDX_38 = 0x38,
RENDER_MODE_IDX_39 = 0x39,
RENDER_MODE_IDX_3A = 0x3A,
RENDER_MODE_IDX_3B = 0x3B,
RENDER_MODE_IDX_3C = 0x3C,
RENDER_MODE_IDX_3D = 0x3D,
};
/// not really /// not really
enum RenderMode { enum RenderMode {
RENDER_MODE_SURF_SOLID_AA_ZB_LAYER0 = 0x00000000, RENDER_MODE_SURF_SOLID_AA_ZB_LAYER0 = 0x00000000,
@ -4786,25 +4851,37 @@ enum GlobalOverrides {
GLOBAL_OVERRIDES_CANT_PICK_UP_ITEMS = 0x00200000, GLOBAL_OVERRIDES_CANT_PICK_UP_ITEMS = 0x00200000,
}; };
#define MODEL_FLAGS_MASK_FFF0 (MODEL_FLAG_USES_CUSTOM_GFX | MODEL_FLAG_FLAG_20 | MODEL_FLAG_FLAG_40 | MODEL_FLAG_HAS_LOCAL_VERTEX_COPY | MODEL_FLAG_USE_CAMERA_UNK_MATRIX | MODEL_FLAG_FLAG_200 | MODEL_FLAG_HAS_TRANSFORM_APPLIED | MODEL_FLAG_HAS_TEX_PANNER | MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_FLAG_2000 | MODEL_FLAG_FLAG_4000 | MODEL_FLAG_FLAG_8000) #define MODEL_FLAGS_MASK_FFF0 (\
MODEL_FLAG_USES_CUSTOM_GFX \
| MODEL_FLAG_20 \
| MODEL_FLAG_40 \
| MODEL_FLAG_HAS_LOCAL_VERTEX_COPY \
| MODEL_FLAG_USE_CAMERA_UNK_MATRIX \
| MODEL_FLAG_DO_BOUNDS_CULLING \
| MODEL_FLAG_HAS_TRANSFORM \
| MODEL_FLAG_HAS_TEX_PANNER \
| MODEL_FLAG_MATRIX_DIRTY \
| MODEL_FLAG_IGNORE_MATRIX \
| MODEL_FLAG_4000 \
| MODEL_FLAG_8000)
enum ModelFlags { enum ModelFlags {
MODEL_FLAG_FLAG_1 = 0x0001, MODEL_FLAG_VALID = 0x0001,
MODEL_FLAG_HIDDEN = 0x0002, MODEL_FLAG_HIDDEN = 0x0002,
MODEL_FLAG_FLAG_4 = 0x0004, MODEL_FLAG_INACTIVE = 0x0004,
MODEL_FLAG_TRANSFORM_GROUP_MEMBER = 0x0008, MODEL_FLAG_TRANSFORM_GROUP_MEMBER = 0x0008,
MODEL_FLAG_USES_CUSTOM_GFX = 0x0010, MODEL_FLAG_USES_CUSTOM_GFX = 0x0010,
MODEL_FLAG_FLAG_20 = 0x0020, MODEL_FLAG_20 = 0x0020,
MODEL_FLAG_FLAG_40 = 0x0040, MODEL_FLAG_40 = 0x0040,
MODEL_FLAG_HAS_LOCAL_VERTEX_COPY = 0x0080, MODEL_FLAG_HAS_LOCAL_VERTEX_COPY = 0x0080,
MODEL_FLAG_USE_CAMERA_UNK_MATRIX = 0x0100, MODEL_FLAG_USE_CAMERA_UNK_MATRIX = 0x0100,
MODEL_FLAG_FLAG_200 = 0x0200, MODEL_FLAG_DO_BOUNDS_CULLING = 0x0200,
MODEL_FLAG_HAS_TRANSFORM_APPLIED = 0x0400, MODEL_FLAG_HAS_TRANSFORM = 0x0400,
MODEL_FLAG_HAS_TEX_PANNER = 0x0800, MODEL_FLAG_HAS_TEX_PANNER = 0x0800,
MODEL_FLAG_USES_TRANSFORM_MATRIX = 0x1000, MODEL_FLAG_MATRIX_DIRTY = 0x1000, // transform matrix changed and combined matrix needs to be recalculated
MODEL_FLAG_FLAG_2000 = 0x2000, MODEL_FLAG_IGNORE_MATRIX = 0x2000, // set until dirty combined matrix has been recalculated
MODEL_FLAG_FLAG_4000 = 0x4000, MODEL_FLAG_4000 = 0x4000,
MODEL_FLAG_FLAG_8000 = 0x8000, MODEL_FLAG_8000 = 0x8000,
}; };
enum ModelGroupVisibility { enum ModelGroupVisibility {
@ -5081,10 +5158,9 @@ enum MusicSettingsFlags {
MUSIC_SETTINGS_FLAG_20 = 0x00000020, MUSIC_SETTINGS_FLAG_20 = 0x00000020,
}; };
// the lower byte of Collider::flags // the lower byte of ColliderFlags
enum SurfaceType { enum SurfaceType {
SURFACE_TYPE_DEFAULT = 0, SURFACE_TYPE_DEFAULT = 0,
/*
SURFACE_TYPE_WATER = 1, SURFACE_TYPE_WATER = 1,
SURFACE_TYPE_SPIKES = 2, SURFACE_TYPE_SPIKES = 2,
SURFACE_TYPE_LAVA = 3, SURFACE_TYPE_LAVA = 3,
@ -5094,7 +5170,7 @@ enum SurfaceType {
SURFACE_TYPE_CLOUD = 7, ///< used with clouds in flo_19 and flo_21 SURFACE_TYPE_CLOUD = 7, ///< used with clouds in flo_19 and flo_21
SURFACE_TYPE_SNOW = 8, SURFACE_TYPE_SNOW = 8,
SURFACE_TYPE_HEDGES = 9, ///< used within hedge maze in flo_11 SURFACE_TYPE_HEDGES = 9, ///< used within hedge maze in flo_11
*/ SURFACE_TYPE_INVALID = -1,
}; };
typedef enum SurfaceInteractMode { typedef enum SurfaceInteractMode {
@ -5103,31 +5179,16 @@ typedef enum SurfaceInteractMode {
SURFACE_INTERACT_LAND = 2, SURFACE_INTERACT_LAND = 2,
} SurfaceInteractMode; } SurfaceInteractMode;
//TODO -- temporarily combined with SurfaceType for map data dumper
enum ColliderFlags { enum ColliderFlags {
COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first
COLLIDER_FLAGS_SURFACE_TYPE_MASK = 0x000000FF, COLLIDER_FLAGS_SURFACE_TYPE_MASK = 0x000000FF,
COLLIDER_FLAG_SAFE_FLOOR = 0x00000100,
// SURFACE_TYPE_DEFAULT = 0, COLLIDER_FLAG_IGNORE_SHELL = 0x00008000,
SURFACE_TYPE_HEDGES = 9, ///< used within hedge maze in flo_11 COLLIDER_FLAG_IGNORE_PLAYER = 0x00010000,
SURFACE_TYPE_SNOW = 8, COLLIDER_FLAG_80000 = 0x00080000, // test version of DOCK walls?
SURFACE_TYPE_CLOUD = 7, ///< used with clouds in flo_19 and flo_21 COLLIDER_FLAG_HAS_MODEL_PARENT = 0x80000000
SURFACE_TYPE_FLOWERS = 6,
SURFACE_TYPE_SLIDE = 5,
SURFACE_TYPE_DOCK_WALL = 4,
SURFACE_TYPE_LAVA = 3,
SURFACE_TYPE_SPIKES = 2,
SURFACE_TYPE_WATER = 1,
SURFACE_TYPE_INVALID = -1,
COLLIDER_FLAG_SAFE_FLOOR = 0x00000100,
COLLIDER_FLAG_IGNORE_SHELL = 0x00008000,
COLLIDER_FLAG_IGNORE_PLAYER = 0x00010000,
COLLIDER_FLAG_80000 = 0x00080000, // test version of DOCK walls?
COLLIDER_FLAG_HAS_MODEL_PARENT = 0x80000000
}; };
//TODO reversed for map dumper with 0 separated //TODO reversed for map dumper with 0 separated
enum ColliderFlagsModifyMode { enum ColliderFlagsModifyMode {
MODIFY_COLLIDER_FLAGS_SET_SURFACE = 3, MODIFY_COLLIDER_FLAGS_SET_SURFACE = 3,
@ -5147,41 +5208,6 @@ enum CollisionChannels {
COLLISION_ONLY_ENTITIES = 0x00100000, COLLISION_ONLY_ENTITIES = 0x00100000,
}; };
enum CameraInitDataFlags {
CAMERA_INIT_DATA_FLAG_1 = 0x00000001,
CAMERA_INIT_DATA_FLAG_2 = 0x00000002,
CAMERA_INIT_DATA_FLAG_4 = 0x00000004,
CAMERA_INIT_DATA_FLAG_8 = 0x00000008,
CAMERA_INIT_DATA_FLAG_10 = 0x00000010,
CAMERA_INIT_DATA_FLAG_20 = 0x00000020,
CAMERA_INIT_DATA_FLAG_40 = 0x00000040,
CAMERA_INIT_DATA_FLAG_80 = 0x00000080,
CAMERA_INIT_DATA_FLAG_100 = 0x00000100,
CAMERA_INIT_DATA_FLAG_200 = 0x00000200,
CAMERA_INIT_DATA_FLAG_400 = 0x00000400,
CAMERA_INIT_DATA_FLAG_800 = 0x00000800,
CAMERA_INIT_DATA_FLAG_1000 = 0x00001000,
CAMERA_INIT_DATA_FLAG_2000 = 0x00002000,
CAMERA_INIT_DATA_FLAG_4000 = 0x00004000,
CAMERA_INIT_DATA_FLAG_8000 = 0x00008000,
CAMERA_INIT_DATA_FLAG_10000 = 0x00010000,
CAMERA_INIT_DATA_FLAG_20000 = 0x00020000,
CAMERA_INIT_DATA_FLAG_40000 = 0x00040000,
CAMERA_INIT_DATA_FLAG_80000 = 0x00080000,
CAMERA_INIT_DATA_FLAG_100000 = 0x00100000,
CAMERA_INIT_DATA_FLAG_200000 = 0x00200000,
CAMERA_INIT_DATA_FLAG_400000 = 0x00400000,
CAMERA_INIT_DATA_FLAG_800000 = 0x00800000,
CAMERA_INIT_DATA_FLAG_1000000 = 0x01000000,
CAMERA_INIT_DATA_FLAG_2000000 = 0x02000000,
CAMERA_INIT_DATA_FLAG_4000000 = 0x04000000,
CAMERA_INIT_DATA_FLAG_8000000 = 0x08000000,
CAMERA_INIT_DATA_FLAG_10000000 = 0x10000000,
CAMERA_INIT_DATA_FLAG_20000000 = 0x20000000,
CAMERA_INIT_DATA_FLAG_40000000 = 0x40000000,
CAMERA_INIT_DATA_FLAG_80000000 = 0x80000000,
};
enum CameraFlags { enum CameraFlags {
CAMERA_FLAG_1 = 0x00000001, CAMERA_FLAG_1 = 0x00000001,
CAMERA_FLAG_DISABLED = 0x00000002, CAMERA_FLAG_DISABLED = 0x00000002,
@ -5238,7 +5264,7 @@ enum CameraControlType {
// Uses: A/B as 2D points // Uses: A/B as 2D points
// Yaw is defined by the line segment AB // Yaw is defined by the line segment AB
// flag 0 = free forward movement (follow player) // flag 0 = free forward movement (follow player)
// flag 1 = lock forward movement (must intersect B) // flag 1 = lock forward movement (must intersect B)
CAM_CONTROL_FIXED_ORIENTATION = 0, CAM_CONTROL_FIXED_ORIENTATION = 0,
// Camera faces toward or away from a point with the player in the center of the frame. // Camera faces toward or away from a point with the player in the center of the frame.
@ -5420,39 +5446,8 @@ enum ModelAnimatorFlags {
}; };
enum ShopFlags { enum ShopFlags {
SHOP_FLAG_0 = 0x00000000,
SHOP_FLAG_1 = 0x00000001, SHOP_FLAG_1 = 0x00000001,
SHOP_FLAG_2 = 0x00000002,
SHOP_FLAG_4 = 0x00000004,
SHOP_FLAG_8 = 0x00000008, SHOP_FLAG_8 = 0x00000008,
SHOP_FLAG_10 = 0x00000010,
SHOP_FLAG_20 = 0x00000020,
SHOP_FLAG_40 = 0x00000040,
SHOP_FLAG_80 = 0x00000080,
SHOP_FLAG_100 = 0x00000100,
SHOP_FLAG_200 = 0x00000200,
SHOP_FLAG_400 = 0x00000400,
SHOP_FLAG_800 = 0x00000800,
SHOP_FLAG_1000 = 0x00001000,
SHOP_FLAG_2000 = 0x00002000,
SHOP_FLAG_4000 = 0x00004000,
SHOP_FLAG_8000 = 0x00008000,
SHOP_FLAG_10000 = 0x00010000,
SHOP_FLAG_20000 = 0x00020000,
SHOP_FLAG_40000 = 0x00040000,
SHOP_FLAG_80000 = 0x00080000,
SHOP_FLAG_100000 = 0x00100000,
SHOP_FLAG_200000 = 0x00200000,
SHOP_FLAG_400000 = 0x00400000,
SHOP_FLAG_800000 = 0x00800000,
SHOP_FLAG_1000000 = 0x01000000,
SHOP_FLAG_2000000 = 0x02000000,
SHOP_FLAG_4000000 = 0x04000000,
SHOP_FLAG_8000000 = 0x08000000,
SHOP_FLAG_10000000 = 0x10000000,
SHOP_FLAG_20000000 = 0x20000000,
SHOP_FLAG_40000000 = 0x40000000,
SHOP_FLAG_80000000 = 0x80000000,
}; };
enum { enum {
@ -5614,38 +5609,12 @@ enum TempSetZoneEnabledFlags {
}; };
enum ModelTransformGroupFlags { enum ModelTransformGroupFlags {
MODEL_TRANSFORM_GROUP_FLAG_1 = 0x00000001, TRANSFORM_GROUP_FLAG_VALID = 0x00000001,
MODEL_TRANSFORM_GROUP_FLAG_2 = 0x00000002, TRANSFORM_GROUP_FLAG_HIDDEN = 0x00000002, // update, but do not render
MODEL_TRANSFORM_GROUP_FLAG_4 = 0x00000004, TRANSFORM_GROUP_FLAG_INACTIVE = 0x00000004,
MODEL_TRANSFORM_GROUP_FLAG_8 = 0x00000008, TRANSFORM_GROUP_FLAG_HAS_TRANSFORM = 0x00000400,
MODEL_TRANSFORM_GROUP_FLAG_10 = 0x00000010, TRANSFORM_GROUP_FLAG_MATRIX_DIRTY = 0x00001000,
MODEL_TRANSFORM_GROUP_FLAG_20 = 0x00000020, TRANSFORM_GROUP_FLAG_IGNORE_MATRIX = 0x00002000, // set until dirty matrix has been recalculated
MODEL_TRANSFORM_GROUP_FLAG_40 = 0x00000040,
MODEL_TRANSFORM_GROUP_FLAG_80 = 0x00000080,
MODEL_TRANSFORM_GROUP_FLAG_100 = 0x00000100,
MODEL_TRANSFORM_GROUP_FLAG_200 = 0x00000200,
MODEL_TRANSFORM_GROUP_FLAG_400 = 0x00000400,
MODEL_TRANSFORM_GROUP_FLAG_800 = 0x00000800,
MODEL_TRANSFORM_GROUP_FLAG_1000 = 0x00001000,
MODEL_TRANSFORM_GROUP_FLAG_2000 = 0x00002000,
MODEL_TRANSFORM_GROUP_FLAG_4000 = 0x00004000,
MODEL_TRANSFORM_GROUP_FLAG_8000 = 0x00008000,
MODEL_TRANSFORM_GROUP_FLAG_10000 = 0x00010000,
MODEL_TRANSFORM_GROUP_FLAG_20000 = 0x00020000,
MODEL_TRANSFORM_GROUP_FLAG_40000 = 0x00040000,
MODEL_TRANSFORM_GROUP_FLAG_80000 = 0x00080000,
MODEL_TRANSFORM_GROUP_FLAG_100000 = 0x00100000,
MODEL_TRANSFORM_GROUP_FLAG_200000 = 0x00200000,
MODEL_TRANSFORM_GROUP_FLAG_400000 = 0x00400000,
MODEL_TRANSFORM_GROUP_FLAG_800000 = 0x00800000,
MODEL_TRANSFORM_GROUP_FLAG_1000000 = 0x01000000,
MODEL_TRANSFORM_GROUP_FLAG_2000000 = 0x02000000,
MODEL_TRANSFORM_GROUP_FLAG_4000000 = 0x04000000,
MODEL_TRANSFORM_GROUP_FLAG_8000000 = 0x08000000,
MODEL_TRANSFORM_GROUP_FLAG_10000000 = 0x10000000,
MODEL_TRANSFORM_GROUP_FLAG_20000000 = 0x20000000,
MODEL_TRANSFORM_GROUP_FLAG_40000000 = 0x40000000,
MODEL_TRANSFORM_GROUP_FLAG_80000000 = 0x80000000,
}; };
enum NpcDropFlags { enum NpcDropFlags {
@ -5660,7 +5629,7 @@ enum NpcDropFlags {
}; };
enum ImgFXStateFlags { enum ImgFXStateFlags {
IMGFX_FLAG_IN_USE = 0x00000001, IMGFX_FLAG_VALID = 0x00000001,
IMGFX_FLAG_G_CULL_BACK = 0x00000002, IMGFX_FLAG_G_CULL_BACK = 0x00000002,
IMGFX_FLAG_G_CULL_FRONT = 0x00000004, IMGFX_FLAG_G_CULL_FRONT = 0x00000004,
IMGFX_FLAG_8 = 0x00000008, IMGFX_FLAG_8 = 0x00000008,

View File

@ -479,7 +479,7 @@ void set_entity_fog_dist(s32 start, s32 end);
void set_entity_fog_color(s32 r, s32 g, s32 b, s32 a); void set_entity_fog_color(s32 r, s32 g, s32 b, s32 a);
struct ModelTransformGroup* get_transform_group(s32 index); struct ModelTransformGroup* get_transform_group(s32 index);
void make_transform_group(u16 modelID); void mdl_make_transform_group(u16 modelID);
void enable_transform_group(u16 modelID); void enable_transform_group(u16 modelID);
void disable_transform_group(u16 modelID); void disable_transform_group(u16 modelID);
void set_map_transition_effect(ScreenTransition); void set_map_transition_effect(ScreenTransition);
@ -579,7 +579,7 @@ void start_bounce_b(void);
void update_input(void); void update_input(void);
void update_max_rumble_duration(void); void update_max_rumble_duration(void);
void func_8011BAE8(void); void mdl_reset_transform_flags(void);
void update_workers(void); void update_workers(void);
void update_triggers(void); void update_triggers(void);
void update_scripts(void); void update_scripts(void);
@ -1086,7 +1086,7 @@ f32 get_player_normal_pitch(void);
void partner_kill_ability_script(void); void partner_kill_ability_script(void);
void func_800EF3D4(s32); void func_800EF3D4(s32);
void func_80116698(void); void mdl_update_transform_matrices(void);
void func_8011B950(u16, s32, s32, s32); void func_8011B950(u16, s32, s32, s32);
void backup_map_collision_data(void); void backup_map_collision_data(void);
@ -1098,6 +1098,6 @@ void update_item_entities(void);
void iterate_models(void); void iterate_models(void);
void restore_map_collision_data(void); void restore_map_collision_data(void);
void mdl_load_all_textures(struct ModelNode* model, s32 romOffset, s32 size); void mdl_load_all_textures(struct ModelNode* model, s32 romOffset, s32 size);
void calculate_model_sizes(void); void mdl_calculate_model_sizes(void);
#endif #endif

View File

@ -218,6 +218,45 @@
#define DMG_STATUS_ALWAYS(typeFlag, duration) (STATUS_FLAG_80000000 | STATUS_FLAG_RIGHT_ON | typeFlag | (duration << 8)) #define DMG_STATUS_ALWAYS(typeFlag, duration) (STATUS_FLAG_80000000 | STATUS_FLAG_RIGHT_ON | typeFlag | (duration << 8))
#define DMG_STATUS_IGNORE_RES(typeFlag, duration) (STATUS_KEY_IGNORE_RES | typeFlag | (duration << 8)) #define DMG_STATUS_IGNORE_RES(typeFlag, duration) (STATUS_KEY_IGNORE_RES | typeFlag | (duration << 8))
#define _RDP_WHOLE(x) (((s32)(x * 65536.0) >> 16) & 0xFFFF)
#define _RDP_FRAC(x) ((s32)(x * 65536.0) & 0xFFFF)
#define _RDP_PACK_WHOLE(a, b) (_RDP_WHOLE(a) << 16) | _RDP_WHOLE(b)
#define _RDP_PACK_FRAC(a, b) (_RDP_FRAC(a) << 16) | _RDP_FRAC(b)
#define RDP_MATRIX( \
Ax, Bx, Cx, Dx, \
Ay, By, Cy, Dy, \
Az, Bz, Cz, Dz, \
Aw, Bw, Cw, Dw ) \
{ \
.m = { \
{ \
_RDP_PACK_WHOLE(Ax, Ay), \
_RDP_PACK_WHOLE(Az, Aw), \
_RDP_PACK_WHOLE(Bx, By), \
_RDP_PACK_WHOLE(Bz, Bw), \
}, \
{ \
_RDP_PACK_WHOLE(Cx, Cy), \
_RDP_PACK_WHOLE(Cz, Cw), \
_RDP_PACK_WHOLE(Dx, Dy), \
_RDP_PACK_WHOLE(Dz, Dw), \
}, \
{ \
_RDP_PACK_FRAC(Ax, Ay), \
_RDP_PACK_FRAC(Az, Aw), \
_RDP_PACK_FRAC(Bx, By), \
_RDP_PACK_FRAC(Bz, Bw), \
}, \
{ \
_RDP_PACK_FRAC(Cx, Cy), \
_RDP_PACK_FRAC(Cz, Cw), \
_RDP_PACK_FRAC(Dx, Dy), \
_RDP_PACK_FRAC(Dz, Dw), \
} \
} \
};
#define PM_CC_01 0, 0, 0, TEXEL0, PRIMITIVE, 0, TEXEL0, 0 #define PM_CC_01 0, 0, 0, TEXEL0, PRIMITIVE, 0, TEXEL0, 0
#define PM_CC_02 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0 #define PM_CC_02 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0
#define PM_CC_03 TEXEL0, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0 #define PM_CC_03 TEXEL0, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0

View File

@ -46,18 +46,18 @@ typedef struct ModelNode {
typedef struct Model { typedef struct Model {
/* 0x00 */ u16 flags; /* 0x00 */ u16 flags;
/* 0x02 */ u16 modelID; /* 0x02 */ u16 modelID;
/* 0x04 */ Mtx* currentMatrix; /* 0x04 */ Mtx* bakedMtx; // pointer to stack-allocated copy of matrix supplied by the shape file for this model
/* 0x08 */ ModelNode* modelNode; /* 0x08 */ ModelNode* modelNode;
/* 0x0C */ ModelGroupData* groupData; /* 0x0C */ ModelGroupData* groupData;
/* 0x10 */ Mtx* currentSpecialMatrix; /* 0x10 */ Mtx* finalMtx; // the matrix actually used while building the display list
/* 0x14 */ char unk_14[4]; /* 0x14 */ char unk_14[4];
/* 0x18 */ Mtx specialMatrix; /* 0x18 */ Mtx savedMtx;
/* 0x58 */ Matrix4f transformMatrix; /* 0x58 */ Matrix4f userTransformMtx; // provided for user code to apply an additional multiplicative transformation
/* 0x98 */ Vec3f center; /* 0x98 */ Vec3f center;
/* 0xA4 */ u8 texPannerID; /* 0xA4 */ u8 texPannerID;
/* 0xA5 */ u8 customGfxIndex; /* 0xA5 */ u8 customGfxIndex;
/* 0xA6 */ s8 renderMode; /* 0xA6 */ s8 renderMode;
/* 0xA7 */ u8 matrixMode; /* 0xA7 */ u8 matrixFreshness;
/* 0xA8 */ u8 textureID; /* 0xA8 */ u8 textureID;
/* 0xA9 */ s8 textureVariation; /* 0xA9 */ s8 textureVariation;
/* 0xAA */ char unk_AA[6]; /* 0xAA */ char unk_AA[6];
@ -66,16 +66,16 @@ typedef struct Model {
typedef struct ModelTransformGroup { typedef struct ModelTransformGroup {
/* 0x00 */ u16 flags; /* 0x00 */ u16 flags;
/* 0x02 */ u16 groupModelID; /* 0x02 */ u16 groupModelID;
/* 0x04 */ Mtx* matrixRDP_N; /* 0x04 */ Mtx* bakedMtx; // would point to copy of matrix from shape file, but seems to always be NULL.
/* 0x08 */ ModelNode* modelNode; /* 0x08 */ ModelNode* baseModelNode;
/* 0x0C */ Mtx* transformMtx; /* 0x0C */ Mtx* finalMtx; // the matrix actually used while building the display list
/* 0x10 */ Mtx matrixA; /* 0x10 */ Mtx savedMtx;
/* 0x50 */ Matrix4f matrixB; /* 0x50 */ Matrix4f userTransformMtx; // provided for user code to apply an additional multiplicative transformation
/* 0x90 */ Vec3f center; /* 0x90 */ Vec3f center;
/* 0x9C */ u8 minChildModelIndex; /* 0x9C */ u8 minChildModelIndex;
/* 0x9D */ u8 maxChildModelIndex; /* 0x9D */ u8 maxChildModelIndex;
/* 0x9E */ u8 renderMode; /* 0x9E */ u8 renderMode;
/* 0x9F */ u8 matrixMode; /* 0x9F */ u8 matrixFreshness;
} ModelTransformGroup; // size = 0xA0 } ModelTransformGroup; // size = 0xA0
typedef Model* ModelList[MAX_MODELS]; typedef Model* ModelList[MAX_MODELS];
@ -126,28 +126,33 @@ typedef Gfx* ModelCustomGfxList[32];
typedef ModelCustomGfxBuilderFunc ModelCustomGfxBuilderList[32]; typedef ModelCustomGfxBuilderFunc ModelCustomGfxBuilderList[32];
typedef enum ModelPropertyKeys { typedef enum ModelPropertyKeys {
MODEL_PROP_KEY_RENDER_MODE = 0x5C, MODEL_PROP_KEY_RENDER_MODE = 0x5C,
MODEL_PROP_KEY_CAMERA_DATA = 0x5D, MODEL_PROP_KEY_CAMERA_DATA = 0x5D,
MODEL_PROP_KEY_TEXTURE_NAME = 0x5E, MODEL_PROP_KEY_TEXTURE_NAME = 0x5E,
MODEL_PROP_KEY_SPECIAL = 0x5F, MODEL_PROP_KEY_SPECIAL = 0x5F,
MODEL_PROP_KEY_GROUP_TYPE = 0x60, MODEL_PROP_KEY_GROUP_INFO = 0x60,
MODEL_PROP_KEY_BOUNDING_BOX = 0x61, MODEL_PROP_KEY_BOUNDING_BOX = 0x61,
MODEL_PROP_KEY_62 = 0x62, MODEL_PROP_KEY_62 = 0x62,
} ModelPropertyKeys; } ModelPropertyKeys;
typedef enum ShapeTypes { typedef enum ShapeTypes {
SHAPE_TYPE_MODEL = 2, SHAPE_TYPE_MODEL = 2,
SHAPE_TYPE_GROUP = 5, SHAPE_TYPE_GROUP = 5,
SHAPE_TYPE_ROOT = 7, SHAPE_TYPE_ROOT = 7,
SHAPE_TYPE_SPECIAL_GROUP = 10, SHAPE_TYPE_SPECIAL_GROUP = 10,
} ShapeTypes; } ShapeTypes;
typedef enum GroupTypes {
GROUP_TYPE_0 = 0,
GROUP_TYPE_1 = 1,
} GroupTypes;
typedef enum ExtraTileTypes { typedef enum ExtraTileTypes {
EXTRA_TILE_NONE = 0, EXTRA_TILE_NONE = 0,
EXTRA_TILE_MIPMAPS = 1, EXTRA_TILE_MIPMAPS = 1,
EXTRA_TILE_AUX_SAME_AS_MAIN = 2, EXTRA_TILE_AUX_SAME_AS_MAIN = 2,
EXTRA_TILE_AUX_INDEPENDENT = 3, EXTRA_TILE_AUX_INDEPENDENT = 3,
EXTRA_TILE_4 = 4, EXTRA_TILE_4 = 4,
} ExtraTileTypes; } ExtraTileTypes;
#define SHAPE_SIZE_LIMIT 0x8000 #define SHAPE_SIZE_LIMIT 0x8000

View File

@ -2899,7 +2899,7 @@ void btl_bonk_update(void* data) {
if (message->unk_24 != 0) { if (message->unk_24 != 0) {
message->unk_24--; message->unk_24--;
if (message->unk_24 == 0) { if (message->unk_24 == 0) {
clear_entity_model_flags(modelIdx, MODEL_FLAG_FLAG_20); clear_entity_model_flags(modelIdx, MODEL_FLAG_20);
} }
exec_entity_model_commandlist(modelIdx); exec_entity_model_commandlist(modelIdx);
break; break;

View File

@ -89,7 +89,7 @@ void render_frame(s32 isSecondPass) {
if (!isSecondPass) { if (!isSecondPass) {
gCurrentCamID = CAM_DEFAULT; gCurrentCamID = CAM_DEFAULT;
func_80116698(); mdl_update_transform_matrices();
} }
if (isSecondPass) { if (isSecondPass) {

View File

@ -683,10 +683,10 @@ void animator_node_update_model_transform(ModelAnimator* animator, f32 (*flipMtx
if (node->flags & MODEL_ANIMATOR_FLAG_HAS_MODEL) { if (node->flags & MODEL_ANIMATOR_FLAG_HAS_MODEL) {
Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(node->fcData.modelID)); Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(node->fcData.modelID));
copy_matrix(sp10, model->transformMatrix); copy_matrix(sp10, model->userTransformMtx);
guMtxL2F(sp10, rootTransform); guMtxL2F(sp10, rootTransform);
guMtxCatF(model->transformMatrix, sp10, model->transformMatrix); guMtxCatF(model->userTransformMtx, sp10, model->userTransformMtx);
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX; model->flags |= MODEL_FLAG_MATRIX_DIRTY;
} }
for (i = 0; i < ARRAY_COUNT(node->children); i++) { for (i = 0; i < ARRAY_COUNT(node->children); i++) {

View File

@ -121,7 +121,7 @@ void bgm_update_music_settings(void) {
case 2: case 2:
flags = music->flags; flags = music->flags;
music->flags &= ~flag4; music->flags &= ~flag4;
if (flags & 1) { if (flags & MUSIC_SETTINGS_FLAG_1) {
if (au_song_is_playing(music->songName) == AU_RESULT_OK) { if (au_song_is_playing(music->songName) == AU_RESULT_OK) {
music->flags &= ~MUSIC_SETTINGS_FLAG_1; music->flags &= ~MUSIC_SETTINGS_FLAG_1;
music->state = 3; music->state = 3;

View File

@ -1217,51 +1217,51 @@ EvtScript N(EVS_FakeBowser_Idle) = {
EVT_CALL(RotateGroup, MODEL_atama, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_atama, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_atama, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_atama, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_atama, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_atama, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_k1, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k1, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k2, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k2, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k3, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k3, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k4, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k4, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k5, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k5, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k6, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k6, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k7, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k7, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k8, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k8, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_k9, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_k9, MODEL_FLAG_40, TRUE)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_BODY, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_BODY, LVar0, LVar1, LVar2)
EVT_CALL(TranslateGroup, MODEL_dou, LVar0, LVar1, LVar2) EVT_CALL(TranslateGroup, MODEL_dou, LVar0, LVar1, LVar2)
EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_BODY, LVar0, LVar1, LVar2) EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_BODY, LVar0, LVar1, LVar2)
EVT_CALL(RotateGroup, MODEL_dou, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_dou, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_dou, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_dou, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_dou, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_dou, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_d1, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_d1, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_d2, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_d2, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_d3, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_d3, MODEL_FLAG_40, TRUE)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_SHELL, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_SHELL, LVar0, LVar1, LVar2)
EVT_CALL(TranslateGroup, MODEL_koura, LVar0, LVar1, LVar2) EVT_CALL(TranslateGroup, MODEL_koura, LVar0, LVar1, LVar2)
EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_SHELL, LVar0, LVar1, LVar2) EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_SHELL, LVar0, LVar1, LVar2)
EVT_CALL(RotateGroup, MODEL_koura, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_koura, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_koura, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_koura, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_koura, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_koura, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_s1, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_s1, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_s2, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_s2, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_s3, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_s3, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_s4, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_s4, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_s5, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_s5, MODEL_FLAG_40, TRUE)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_LEFT_ARM, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_LEFT_ARM, LVar0, LVar1, LVar2)
EVT_CALL(TranslateGroup, MODEL_left_arm, LVar0, LVar1, LVar2) EVT_CALL(TranslateGroup, MODEL_left_arm, LVar0, LVar1, LVar2)
EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_LEFT_ARM, LVar0, LVar1, LVar2) EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_LEFT_ARM, LVar0, LVar1, LVar2)
EVT_CALL(RotateGroup, MODEL_left_arm, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_left_arm, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_left_arm, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_left_arm, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_left_arm, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_left_arm, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_u1, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_u1, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_u2, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_u2, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_u3, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_u3, MODEL_FLAG_40, TRUE)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_TAIL, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_TAIL, LVar0, LVar1, LVar2)
EVT_CALL(TranslateGroup, MODEL_shippo, LVar0, LVar1, LVar2) EVT_CALL(TranslateGroup, MODEL_shippo, LVar0, LVar1, LVar2)
EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_TAIL, LVar0, LVar1, LVar2) EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_TAIL, LVar0, LVar1, LVar2)
EVT_CALL(RotateGroup, MODEL_shippo, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_shippo, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_shippo, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_shippo, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_shippo, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_shippo, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_p1, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_p1, MODEL_FLAG_40, TRUE)
EVT_SET(LVar0, ArrayVar(0)) EVT_SET(LVar0, ArrayVar(0))
EVT_IF_EQ(LVar0, ANIM_DOING_DEATH) EVT_IF_EQ(LVar0, ANIM_DOING_DEATH)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_FRONT_WHEELS, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_FRONT_WHEELS, LVar0, LVar1, LVar2)
@ -1275,7 +1275,7 @@ EvtScript N(EVS_FakeBowser_Idle) = {
EVT_CALL(RotateGroup, MODEL_koma1, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_koma1, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_koma1, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_koma1, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_koma1, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_koma1, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_km1, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_km1, MODEL_FLAG_40, TRUE)
EVT_SET(LVar0, ArrayVar(0)) EVT_SET(LVar0, ArrayVar(0))
EVT_IF_EQ(LVar0, ANIM_DOING_DEATH) EVT_IF_EQ(LVar0, ANIM_DOING_DEATH)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_BACK_WHEELS, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_BACK_WHEELS, LVar0, LVar1, LVar2)
@ -1289,25 +1289,25 @@ EvtScript N(EVS_FakeBowser_Idle) = {
EVT_CALL(RotateGroup, MODEL_koma2, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_koma2, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_koma2, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_koma2, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_koma2, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_koma2, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_km2, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_km2, MODEL_FLAG_40, TRUE)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_RIGHT_ARM, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_RIGHT_ARM, LVar0, LVar1, LVar2)
EVT_CALL(TranslateGroup, MODEL_right_arm, LVar0, LVar1, LVar2) EVT_CALL(TranslateGroup, MODEL_right_arm, LVar0, LVar1, LVar2)
EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_RIGHT_ARM, LVar0, LVar1, LVar2) EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_RIGHT_ARM, LVar0, LVar1, LVar2)
EVT_CALL(RotateGroup, MODEL_right_arm, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_right_arm, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_right_arm, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_right_arm, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_right_arm, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_right_arm, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_o171, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_o171, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_o172, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_o172, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_o183, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_o183, MODEL_FLAG_40, TRUE)
EVT_CALL(GetPartPos, ACTOR_SELF, PRT_FEET, LVar0, LVar1, LVar2) EVT_CALL(GetPartPos, ACTOR_SELF, PRT_FEET, LVar0, LVar1, LVar2)
EVT_CALL(TranslateGroup, MODEL_ashi, LVar0, LVar1, LVar2) EVT_CALL(TranslateGroup, MODEL_ashi, LVar0, LVar1, LVar2)
EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_FEET, LVar0, LVar1, LVar2) EVT_CALL(GetPartRotation, ACTOR_SELF, PRT_FEET, LVar0, LVar1, LVar2)
EVT_CALL(RotateGroup, MODEL_ashi, LVar0, 1, 0, 0) EVT_CALL(RotateGroup, MODEL_ashi, LVar0, 1, 0, 0)
EVT_CALL(RotateGroup, MODEL_ashi, LVar1, 0, 1, 0) EVT_CALL(RotateGroup, MODEL_ashi, LVar1, 0, 1, 0)
EVT_CALL(RotateGroup, MODEL_ashi, LVar2, 0, 0, 1) EVT_CALL(RotateGroup, MODEL_ashi, LVar2, 0, 0, 1)
EVT_CALL(SetModelFlags, MODEL_o118, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_o118, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_o120, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_o120, MODEL_FLAG_40, TRUE)
EVT_CALL(SetModelFlags, MODEL_o165, MODEL_FLAG_FLAG_40, TRUE) EVT_CALL(SetModelFlags, MODEL_o165, MODEL_FLAG_40, TRUE)
// spawn puffs of smoke if health is low enough // spawn puffs of smoke if health is low enough
// written to have different effects at every quintile, but every case in the final // written to have different effects at every quintile, but every case in the final
// version just executes the same script // version just executes the same script

View File

@ -53,12 +53,12 @@ API_CALLABLE(N(UpdateRockingHorse)) {
offsetY = SQ(rotZ) / 90.0f; offsetY = SQ(rotZ) / 90.0f;
model = get_model_from_list_index(get_model_list_index_from_tree_index(horse->modelID)); model = get_model_from_list_index(get_model_list_index_from_tree_index(horse->modelID));
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
guTranslateF(mtxPivot, -horse->offsetX, 0.0f, -horse->offsetZ); guTranslateF(mtxPivot, -horse->offsetX, 0.0f, -horse->offsetZ);
guRotateF(mtxRotate, rotZ, 0.0f, 0.0f, 1.0f); guRotateF(mtxRotate, rotZ, 0.0f, 0.0f, 1.0f);
guMtxCatF(mtxPivot, mtxRotate, model->transformMatrix); guMtxCatF(mtxPivot, mtxRotate, model->userTransformMtx);
guTranslateF(mtxPivot, horse->offsetX, offsetY, horse->offsetZ); guTranslateF(mtxPivot, horse->offsetX, offsetY, horse->offsetZ);
guMtxCatF(model->transformMatrix, mtxPivot, model->transformMatrix); guMtxCatF(model->userTransformMtx, mtxPivot, model->userTransformMtx);
} }
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }

View File

@ -9,18 +9,18 @@ typedef struct HitFile {
typedef struct ColliderBackupEntry { typedef struct ColliderBackupEntry {
/* 0x00 */ s32 flags; /* 0x00 */ s32 flags;
/* 0x04 */ s16 parentModelIndex; /* 0x04 */ s16 parentModelIndex;
/* 0x06 */ s16 unk_06; /* 0x06 */ char pad_06[2];
} ColliderBackupEntry; // size = 0x08 } ColliderBackupEntry; // size = 0x08
typedef struct HitFileHeader { typedef struct HitFileHeader {
/* 0x00 */ s16 numColliders; /* 0x00 */ s16 numColliders;
/* 0x02 */ s16 unk_02; /* 0x02 */ char pad_02[2];
/* 0x04 */ s32 collidersOffset; /* 0x04 */ s32 collidersOffset;
/* 0x08 */ s16 numVertices; /* 0x08 */ s16 numVertices;
/* 0x0A */ s16 unk_0a; /* 0x0A */ char pad_0A[2];
/* 0x0C */ s32 verticesOffset; /* 0x0C */ s32 verticesOffset;
/* 0x10 */ s16 boundingBoxesDataSize; /* 0x10 */ s16 boundingBoxesDataSize;
/* 0x12 */ s16 unk_12; /* 0x12 */ char pad_12[2];
/* 0x14 */ s32 boundingBoxesOffset; /* 0x14 */ s32 boundingBoxesOffset;
} HitFileHeader; // size = 0x18 } HitFileHeader; // size = 0x18
@ -382,11 +382,11 @@ void update_collider_transform(s16 colliderID) {
collider = &gCollisionData.colliderList[colliderID]; collider = &gCollisionData.colliderList[colliderID];
model = get_model_from_list_index(collider->parentModelIndex); model = get_model_from_list_index(collider->parentModelIndex);
if (!model->currentMatrix) { if (model->bakedMtx == NULL) {
copy_matrix(model->transformMatrix, matrix); copy_matrix(model->userTransformMtx, matrix);
} else { } else {
guMtxL2F(matrix, (Mtx*)model->currentMatrix); guMtxL2F(matrix, (Mtx*)model->bakedMtx);
guMtxCatF(model->transformMatrix, matrix, matrix); guMtxCatF(model->userTransformMtx, matrix, matrix);
} }
triangle = collider->triangleTable; triangle = collider->triangleTable;

View File

@ -60,20 +60,20 @@ API_CALLABLE(N(TransformFoliage)) {
Model* model = get_model_from_list_index(modelListIndex); Model* model = get_model_from_list_index(modelListIndex);
Matrix4f mtx; Matrix4f mtx;
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guTranslateF(model->transformMatrix, 0.0f, dy, 0.0f); guTranslateF(model->userTransformMtx, 0.0f, dy, 0.0f);
N(foliage_setup_shear_mtx)(mtx, scale, dx, dz); N(foliage_setup_shear_mtx)(mtx, scale, dx, dz);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
guTranslateF(mtx, 0.0f, -dy, 0.0f); guTranslateF(mtx, 0.0f, -dy, 0.0f);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
model->flags |= (MODEL_FLAG_HAS_TRANSFORM_APPLIED | MODEL_FLAG_USES_TRANSFORM_MATRIX); model->flags |= (MODEL_FLAG_HAS_TRANSFORM | MODEL_FLAG_MATRIX_DIRTY);
} else { } else {
guTranslateF(mtx, 0.0f, dy, 0.0f); guTranslateF(mtx, 0.0f, dy, 0.0f);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
N(foliage_setup_shear_mtx)(mtx, scale, dx, dz); N(foliage_setup_shear_mtx)(mtx, scale, dx, dz);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
guTranslateF(mtx, 0.0f, -dy, 0.0f); guTranslateF(mtx, 0.0f, -dy, 0.0f);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;

View File

@ -322,26 +322,12 @@ Vp gBoxViewport = {
#include "vtx/drawbox1.vtx.inc.c" #include "vtx/drawbox1.vtx.inc.c"
/* Mtx gBoxMatrix = RDP_MATRIX(
| 0.0 0.0 0.0 0.0| 0.000000, 0.000000, 0.000000, -6.000000,
| 0.0 0.0 0.0 0.0| 0.000000, 0.000000, 0.000000, 0.000000,
| 0.0 0.0 0.0 0.0| 0.000000, 0.000000, 0.000000, 0.000000,
|-6.0 0.0 0.0 0.0| 0.000000, 0.000000, 0.000000, 0.000000
*/ );
Mtx gBoxMatrix = {
.m = {
// integer portion
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0xFFFA0000, 0x00000000 },
// fractional portion
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s32 width, s32 height, u8 opacity, s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s32 width, s32 height, u8 opacity,
u8 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ, void (*fpDrawContents)(s32, s32, s32, s32, s32, s32, s32), u8 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ, void (*fpDrawContents)(s32, s32, s32, s32, s32, s32, s32),

View File

@ -8,7 +8,7 @@ extern EntityScript Entity_Chest_ScriptOpened;
extern Gfx Entity_Chest_RenderBox[]; extern Gfx Entity_Chest_RenderBox[];
extern Gfx Entity_Chest_RenderLid[]; extern Gfx Entity_Chest_RenderLid[];
extern Mtx Entity_Chest_lidMtx; extern Mtx Entity_Chest_LidMtx;
EvtScript Entity_Chest_AdjustCam_ISK = { EvtScript Entity_Chest_AdjustCam_ISK = {
EVT_THREAD EVT_THREAD
@ -98,7 +98,7 @@ void entity_Chest_setupGfx(s32 entityIndex) {
Gfx* gfx; Gfx* gfx;
guRotateF(sp58, data->lidAngle, 1.0f, 0.0f, 0.0f); guRotateF(sp58, data->lidAngle, 1.0f, 0.0f, 0.0f);
guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &Entity_Chest_lidMtx)); guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &Entity_Chest_LidMtx));
guMtxCatF(sp58, sp18, sp18); guMtxCatF(sp58, sp18, sp18);
guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);

View File

@ -28,18 +28,12 @@ Gfx Entity_ArrowSign_LoadTexture[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_ArrowSign_mtxSign = { Mtx Entity_ArrowSign_mtxSign = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, -0.180848,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 20.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 1.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0xFFFF0014, 0x00010001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0xD1B40000, 0x00000000 }
}
};
Gfx Entity_ArrowSign_RenderPole[] = { Gfx Entity_ArrowSign_RenderPole[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -33,31 +33,19 @@ Gfx Entity_BlueSwitch_LoadExclMark[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_BlueSwitch_mtxExclMark = { Mtx Entity_BlueSwitch_mtxExclMark = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 6.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000006, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Mtx Entity_BlueSwitch_mtxBlueBubble = { Mtx Entity_BlueSwitch_mtxBlueBubble = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, -0.026597,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 5.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.609116,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0xFFFF0005, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0xF9310000, 0x9BEF0000 }
}
};
Gfx Entity_BlueSwitch_RenderBlueBubble[] = { Gfx Entity_BlueSwitch_RenderBlueBubble[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -36,18 +36,12 @@ Gfx Entity_BlueWarpPipe_LoadTexturePipe[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_BlueWarpPipe_mtx = { Mtx Entity_BlueWarpPipe_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, -55.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x0000FFC9, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_BlueWarpPipe_RenderBase[] = { Gfx Entity_BlueWarpPipe_RenderBase[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -54,18 +54,12 @@ Gfx Entity_Chest_LoadTextureLock[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_Chest_lidMtx = { Mtx Entity_Chest_LidMtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 29.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, -23.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x0000001D, 0xFFE90001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_Chest_RenderLidLock[] = { Gfx Entity_Chest_RenderLidLock[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -24,35 +24,23 @@ Gfx Entity_CymbalPlant_LoadTexture[] = {
#include "entity/model/CymbalPlant_7.vtx.inc.c" #include "entity/model/CymbalPlant_7.vtx.inc.c"
#include "entity/model/CymbalPlant_8.vtx.inc.c" #include "entity/model/CymbalPlant_8.vtx.inc.c"
Mtx D_0A001078_E9A368 = { Mtx Entity_CymbalPlant_RightMtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 2.668290,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 26.668290,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x0002001A, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0xAB15AB15, 0x00000000 }
}
};
Mtx D_0A0010B8_E9A3A8 = { Mtx Entity_CymbalPlant_LeftMtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, -2.331711,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 26.668290,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0xFFFD001A, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0xAB15AB15, 0x00000000 }
}
};
Gfx Entity_CymbalPlant_RenderNode3[] = { Gfx Entity_CymbalPlant_RenderNode3[] = {
gsDPPipeSync(), gsDPPipeSync(),
gsSPMatrix(&D_0A0010B8_E9A3A8, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_LeftMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsSPDisplayList(Entity_CymbalPlant_LoadTexture), gsSPDisplayList(Entity_CymbalPlant_LoadTexture),
@ -80,7 +68,7 @@ Gfx Entity_CymbalPlant_RenderNode3[] = {
Gfx Entity_CymbalPlant_RenderNode4[] = { Gfx Entity_CymbalPlant_RenderNode4[] = {
gsDPPipeSync(), gsDPPipeSync(),
gsSPMatrix(&D_0A0010B8_E9A3A8, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_LeftMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsSPDisplayList(Entity_CymbalPlant_LoadTexture), gsSPDisplayList(Entity_CymbalPlant_LoadTexture),
@ -108,7 +96,7 @@ Gfx Entity_CymbalPlant_RenderNode4[] = {
Gfx Entity_CymbalPlant_RenderNode5[] = { Gfx Entity_CymbalPlant_RenderNode5[] = {
gsDPPipeSync(), gsDPPipeSync(),
gsSPMatrix(&D_0A0010B8_E9A3A8, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_LeftMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE), gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@ -126,7 +114,7 @@ Gfx Entity_CymbalPlant_RenderNode5[] = {
}; };
Gfx D_0A001308_E9A5F8[] = { Gfx D_0A001308_E9A5F8[] = {
gsSPMatrix(&D_0A0010B8_E9A3A8, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_LeftMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsSPDisplayList(Entity_CymbalPlant_RenderNode5), gsSPDisplayList(Entity_CymbalPlant_RenderNode5),
gsSPDisplayList(Entity_CymbalPlant_RenderNode4), gsSPDisplayList(Entity_CymbalPlant_RenderNode4),
gsSPDisplayList(Entity_CymbalPlant_RenderNode3), gsSPDisplayList(Entity_CymbalPlant_RenderNode3),
@ -136,7 +124,7 @@ Gfx D_0A001308_E9A5F8[] = {
Gfx Entity_CymbalPlant_RenderNode7[] = { Gfx Entity_CymbalPlant_RenderNode7[] = {
gsDPPipeSync(), gsDPPipeSync(),
gsSPMatrix(&D_0A001078_E9A368, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_RightMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsSPDisplayList(Entity_CymbalPlant_LoadTexture), gsSPDisplayList(Entity_CymbalPlant_LoadTexture),
@ -164,7 +152,7 @@ Gfx Entity_CymbalPlant_RenderNode7[] = {
Gfx Entity_CymbalPlant_RenderNode9[] = { Gfx Entity_CymbalPlant_RenderNode9[] = {
gsDPPipeSync(), gsDPPipeSync(),
gsSPMatrix(&D_0A001078_E9A368, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_RightMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsSPDisplayList(Entity_CymbalPlant_LoadTexture), gsSPDisplayList(Entity_CymbalPlant_LoadTexture),
@ -192,7 +180,7 @@ Gfx Entity_CymbalPlant_RenderNode9[] = {
Gfx Entity_CymbalPlant_RenderNode8[] = { Gfx Entity_CymbalPlant_RenderNode8[] = {
gsDPPipeSync(), gsDPPipeSync(),
gsSPMatrix(&D_0A001078_E9A368, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_RightMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE), gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@ -209,7 +197,7 @@ Gfx Entity_CymbalPlant_RenderNode8[] = {
}; };
Gfx D_0A001540_E9A830[] = { Gfx D_0A001540_E9A830[] = {
gsSPMatrix(&D_0A001078_E9A368, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW), gsSPMatrix(&Entity_CymbalPlant_RightMtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),
gsSPDisplayList(Entity_CymbalPlant_RenderNode8), gsSPDisplayList(Entity_CymbalPlant_RenderNode8),
gsSPDisplayList(Entity_CymbalPlant_RenderNode9), gsSPDisplayList(Entity_CymbalPlant_RenderNode9),
gsSPDisplayList(Entity_CymbalPlant_RenderNode7), gsSPDisplayList(Entity_CymbalPlant_RenderNode7),

View File

@ -37,18 +37,12 @@ Gfx Entity_GreenStompSwitch_LoadExclMark[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_GreenStompSwitch_mtx = { Mtx Entity_GreenStompSwitch_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_GreenStompSwitch_RenderBase[] = { Gfx Entity_GreenStompSwitch_RenderBase[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -50,18 +50,12 @@ Gfx Entity_Padlock_LoadTextureBody[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_Padlock_mtxShackle = { Mtx Entity_Padlock_mtxShackle = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 22.500000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000016, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00008000, 0x00000000 }
}
};
Gfx Entity_Padlock_RenderShackleMain[] = { Gfx Entity_Padlock_RenderShackleMain[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -48,18 +48,12 @@ Gfx Entity_PadlockBlueFace_LoadTextureBody[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_PadlockBlueFace_mtxShackle = { Mtx Entity_PadlockBlueFace_mtxShackle = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 22.500000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000016, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00008000, 0x00000000 }
}
};
Gfx Entity_PadlockBlueFace_RenderShackleMain[] = { Gfx Entity_PadlockBlueFace_RenderShackleMain[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -48,18 +48,12 @@ Gfx Entity_PadlockRedFace_LoadTextureBody[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_PadlockRedFace_mtxShackle = { Mtx Entity_PadlockRedFace_mtxShackle = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 22.500000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000016, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00008000, 0x00000000 }
}
};
Gfx Entity_PadlockRedFace_RenderShackleMain[] = { Gfx Entity_PadlockRedFace_RenderShackleMain[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -35,18 +35,12 @@ Gfx Entity_PadlockRedFrame_LoadTextureFace[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_PadlockRedFrame_mtxShackle = { Mtx Entity_PadlockRedFrame_mtxShackle = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_PadlockRedFrame_RenderShackleMain[] = { Gfx Entity_PadlockRedFrame_RenderShackleMain[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -31,18 +31,12 @@ Gfx D_0A001020_E9C520[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx D_0A001098_E9C598 = { Mtx D_0A001098_E9C598 = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, -10.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 25.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 13.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0xFFF60019, 0x000D0001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_PinkFlower_RenderNode3[] = { Gfx Entity_PinkFlower_RenderNode3[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -17,18 +17,12 @@ Gfx Entity_PowBlock_LoadTexture[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_PowBlock_mtx = { Mtx Entity_PowBlock_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_PowBlock_RenderTopBottom[] = { Gfx Entity_PowBlock_RenderTopBottom[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -17,18 +17,12 @@ Gfx Entity_PushBlock_LoadTexture[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_PushBlock_mtx = { Mtx Entity_PushBlock_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_PushBlock_RenderFaces[] = { Gfx Entity_PushBlock_RenderFaces[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -32,31 +32,20 @@ Gfx Entity_RedSwitch_LoadExclMark[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_RedSwitch_mtxExclMark = { Mtx Entity_RedSwitch_mtxExclMark = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 6.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000006, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }, Mtx Entity_RedSwitch_mtxRedBubble = RDP_MATRIX(
{ 0x00000000, 0x00000000, 1.000000, 0.000000, 0.000000, -0.026600,
0x00000000, 0x00000000 } 0.000000, 1.000000, 0.000000, 5.000000,
} 0.000000, 0.000000, 1.000000, 0.609116,
}; 0.000000, 0.000000, 0.000000, 1.000000
);
Mtx Entity_RedSwitch_mtxRedBubble = {
.m = {
{ 0x00010000, 0x00000000,
0x00000001, 0x00000000 },
{ 0x00000000, 0x00010000,
0xFFFF0005, 0x00000001 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0xF9310000, 0x9BEF0000 }
}
};
Gfx Entity_RedSwitch_RenderRedBubble[] = { Gfx Entity_RedSwitch_RenderRedBubble[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -42,18 +42,12 @@ Gfx Entity_SaveBlock_LoadTextureLetterS[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_SaveBlock_Mtx = { Mtx Entity_SaveBlock_Mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_SaveBlock_RenderLetterS[] = { Gfx Entity_SaveBlock_RenderLetterS[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -31,18 +31,12 @@ Gfx D_0A000AF8_E9D3F8[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx D_0A000B70_E9D470 = { Mtx D_0A000B70_E9D470 = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 20.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000014, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx D_0A000BB0_E9D4B0[] = { Gfx D_0A000BB0_E9D4B0[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -48,18 +48,12 @@ Gfx Entity_StarBoxLauncher_LoadTextureBox[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_StarBoxLauncher_mtx = { Mtx Entity_StarBoxLauncher_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_StarBoxLauncher_RenderChain[] = { Gfx Entity_StarBoxLauncher_RenderChain[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -17,18 +17,12 @@ Gfx Entity_SuperBlock_LoadTexture[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_SuperBlock_mtx = { Mtx Entity_SuperBlock_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_SuperBlock_RenderTop[] = { Gfx Entity_SuperBlock_RenderTop[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -47,31 +47,19 @@ Gfx Entity_Tweester_LoadTextureFace[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_Tweester_mtxInnerWhirl = { Mtx Entity_Tweester_mtxInnerWhirl = RDP_MATRIX(
.m = { 0.999848, 0.017457, 0.000000, 0.000000,
{ 0x0000FFFF, 0x00000000, -0.01746, 0.999848, 0.000000, 0.000000,
0x00000000, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0xFFF6FB88, 0x00000000,
0x0478FFF6, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Mtx Entity_Tweester_mtxOuterWhirl = { Mtx Entity_Tweester_mtxOuterWhirl = RDP_MATRIX(
.m = { 1.199997, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 0.899994, 0.000000, 0.000000,
0x00000000, 0x00000000 }, 0.000000, 0.000000, 1.199997, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x33330000, 0x00000000,
0x0000E666, 0x00000000 },
{ 0x00000000, 0x33330000,
0x00000000, 0x00000000 }
}
};
Gfx D_0A0019E8_E58848[] = { Gfx D_0A0019E8_E58848[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -17,18 +17,12 @@ Gfx Entity_UltraBlock_LoadTexture[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx Entity_UltraBlock_mtx = { Mtx Entity_UltraBlock_mtx = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx Entity_UltraBlock_RenderTop[] = { Gfx Entity_UltraBlock_RenderTop[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -34,18 +34,12 @@ Gfx D_0A000968_E3D738[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
Mtx D_0A000A20_E3D7F0 = { Mtx D_0A000A20_E3D7F0 = RDP_MATRIX(
.m = { 1.000000, 0.000000, 0.000000, 0.000000,
{ 0x00010000, 0x00000000, 0.000000, 1.000000, 0.000000, 0.000000,
0x00000001, 0x00000000 }, 0.000000, 0.000000, 1.000000, 0.000000,
{ 0x00000000, 0x00010000, 0.000000, 0.000000, 0.000000, 1.000000
0x00000000, 0x00000001 }, );
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 },
{ 0x00000000, 0x00000000,
0x00000000, 0x00000000 }
}
};
Gfx D_0A000A60_E3D830[] = { Gfx D_0A000A60_E3D830[] = {
gsDPPipeSync(), gsDPPipeSync(),

View File

@ -19,14 +19,14 @@ ApiStatus TranslateModel(Evt* script, s32 isInitialCall) {
z = evt_get_float_variable(script, *args++); z = evt_get_float_variable(script, *args++);
model = get_model_from_list_index(modelIndex); model = get_model_from_list_index(modelIndex);
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guTranslateF(model->transformMatrix, x, y, z); guTranslateF(model->userTransformMtx, x, y, z);
model->flags |= (MODEL_FLAG_HAS_TRANSFORM_APPLIED | MODEL_FLAG_USES_TRANSFORM_MATRIX); model->flags |= (MODEL_FLAG_HAS_TRANSFORM | MODEL_FLAG_MATRIX_DIRTY);
} else { } else {
Matrix4f mtx; Matrix4f mtx;
guTranslateF(mtx, x, y, z); guTranslateF(mtx, x, y, z);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -42,14 +42,14 @@ ApiStatus RotateModel(Evt* script, s32 isInitialCall) {
f32 z = evt_get_float_variable(script, *args++); f32 z = evt_get_float_variable(script, *args++);
Model* model = get_model_from_list_index(modelListIndex); Model* model = get_model_from_list_index(modelListIndex);
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guRotateF(model->transformMatrix, a, x, y, z); guRotateF(model->userTransformMtx, a, x, y, z);
model->flags |= (MODEL_FLAG_HAS_TRANSFORM_APPLIED | MODEL_FLAG_USES_TRANSFORM_MATRIX); model->flags |= (MODEL_FLAG_HAS_TRANSFORM | MODEL_FLAG_MATRIX_DIRTY);
} else { } else {
Matrix4f mtx; Matrix4f mtx;
guRotateF(mtx, a, x, y, z); guRotateF(mtx, a, x, y, z);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -69,14 +69,14 @@ ApiStatus ScaleModel(Evt* script, s32 isInitialCall) {
z = evt_get_float_variable(script, *args++); z = evt_get_float_variable(script, *args++);
model = get_model_from_list_index(modelIndex); model = get_model_from_list_index(modelIndex);
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guScaleF(model->transformMatrix, x, y, z); guScaleF(model->userTransformMtx, x, y, z);
model->flags |= (MODEL_FLAG_HAS_TRANSFORM_APPLIED | MODEL_FLAG_USES_TRANSFORM_MATRIX); model->flags |= (MODEL_FLAG_HAS_TRANSFORM | MODEL_FLAG_MATRIX_DIRTY);
} else { } else {
Matrix4f mtx; Matrix4f mtx;
guScaleF(mtx, x, y, z); guScaleF(mtx, x, y, z);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -96,7 +96,7 @@ ApiStatus InvalidateModelTransform(Evt* script, s32 isInitialCall) {
Bytecode modelID = evt_get_variable(script, *args++); Bytecode modelID = evt_get_variable(script, *args++);
Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(modelID)); Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(modelID));
model->flags &= ~MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags &= ~MODEL_FLAG_HAS_TRANSFORM;
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -338,7 +338,7 @@ void apply_transform_to_children(ApiStatus (*apiFunc)(Evt*, s32), Evt* script) {
} }
ApiStatus MakeTransformGroup(Evt* script, s32 isInitialCall) { ApiStatus MakeTransformGroup(Evt* script, s32 isInitialCall) {
make_transform_group((u16)evt_get_variable(script, *script->ptrReadPos)); mdl_make_transform_group((u16)evt_get_variable(script, *script->ptrReadPos));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -357,8 +357,8 @@ ApiStatus SetTransformGroupEnabled(Evt* script, s32 isInitialCall) {
ApiStatus TranslateGroup(Evt* script, s32 isInitialCall) { ApiStatus TranslateGroup(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 modelIndex = evt_get_variable(script, *args); s32 modelID = evt_get_variable(script, *args);
s32 index = get_transform_group_index(modelIndex); s32 index = get_transform_group_index(modelID);
ModelTransformGroup* transformGroup; ModelTransformGroup* transformGroup;
Matrix4f mtx; Matrix4f mtx;
f32 x, y, z; f32 x, y, z;
@ -376,13 +376,14 @@ ApiStatus TranslateGroup(Evt* script, s32 isInitialCall) {
transformGroup = get_transform_group(index); transformGroup = get_transform_group(index);
index = transformGroup->flags & MODEL_TRANSFORM_GROUP_FLAG_400; // TODO fix weird match index = transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM; // TODO fix weird match
if (!index) { if (!index) {
guTranslateF(transformGroup->matrixB, x, y, z); guTranslateF(transformGroup->userTransformMtx, x, y, z);
transformGroup->flags |= (MODEL_TRANSFORM_GROUP_FLAG_400 | MODEL_TRANSFORM_GROUP_FLAG_1000); transformGroup->flags |= TRANSFORM_GROUP_FLAG_HAS_TRANSFORM;
transformGroup->flags |= TRANSFORM_GROUP_FLAG_MATRIX_DIRTY;
} else { } else {
guTranslateF(mtx, x, y, z); guTranslateF(mtx, x, y, z);
guMtxCatF(mtx, transformGroup->matrixB, transformGroup->matrixB); guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -390,8 +391,10 @@ ApiStatus TranslateGroup(Evt* script, s32 isInitialCall) {
ApiStatus RotateGroup(Evt* script, s32 isInitialCall) { ApiStatus RotateGroup(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 index = get_transform_group_index(evt_get_variable(script, *args)); s32 modelID = evt_get_variable(script, *args);
s32 index = get_transform_group_index(modelID);
ModelTransformGroup* transformGroup; ModelTransformGroup* transformGroup;
Matrix4f mtx;
f32 a, x, y, z; f32 a, x, y, z;
if (index == -1) { if (index == -1) {
@ -408,14 +411,13 @@ ApiStatus RotateGroup(Evt* script, s32 isInitialCall) {
transformGroup = get_transform_group(index); transformGroup = get_transform_group(index);
if (!(transformGroup->flags & MODEL_TRANSFORM_GROUP_FLAG_400)) { if (!(transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM)) {
guRotateF(transformGroup->matrixB, a, x, y, z); guRotateF(transformGroup->userTransformMtx, a, x, y, z);
transformGroup->flags |= (MODEL_TRANSFORM_GROUP_FLAG_400 | MODEL_TRANSFORM_GROUP_FLAG_1000); transformGroup->flags |= TRANSFORM_GROUP_FLAG_HAS_TRANSFORM;
transformGroup->flags |= TRANSFORM_GROUP_FLAG_MATRIX_DIRTY;
} else { } else {
Matrix4f mtx;
guRotateF(mtx, a, x, y, z); guRotateF(mtx, a, x, y, z);
guMtxCatF(mtx, transformGroup->matrixB, transformGroup->matrixB); guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -426,6 +428,7 @@ ApiStatus ScaleGroup(Evt* script, s32 isInitialCall) {
s32 modelID = evt_get_variable(script, *args); s32 modelID = evt_get_variable(script, *args);
s32 transformIndex = get_transform_group_index(modelID); s32 transformIndex = get_transform_group_index(modelID);
ModelTransformGroup* transformGroup; ModelTransformGroup* transformGroup;
Matrix4f mtx;
f32 x, y, z; f32 x, y, z;
if (transformIndex == -1) { if (transformIndex == -1) {
@ -441,15 +444,14 @@ ApiStatus ScaleGroup(Evt* script, s32 isInitialCall) {
transformGroup = get_transform_group(transformIndex); transformGroup = get_transform_group(transformIndex);
transformIndex = transformGroup->flags & MODEL_TRANSFORM_GROUP_FLAG_400; // TODO fix weird match transformIndex = transformGroup->flags & TRANSFORM_GROUP_FLAG_HAS_TRANSFORM; // TODO fix weird match
if (!(transformIndex)) { if (!(transformIndex)) {
guScaleF(transformGroup->matrixB, x, y, z); guScaleF(transformGroup->userTransformMtx, x, y, z);
transformGroup->flags |= (MODEL_TRANSFORM_GROUP_FLAG_400 | MODEL_TRANSFORM_GROUP_FLAG_1000); transformGroup->flags |= TRANSFORM_GROUP_FLAG_HAS_TRANSFORM;
transformGroup->flags |= TRANSFORM_GROUP_FLAG_MATRIX_DIRTY;
} else { } else {
Matrix4f mtx;
guScaleF(mtx, x, y, z); guScaleF(mtx, x, y, z);
guMtxCatF(mtx, transformGroup->matrixB, transformGroup->matrixB); guMtxCatF(mtx, transformGroup->userTransformMtx, transformGroup->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -457,16 +459,17 @@ ApiStatus ScaleGroup(Evt* script, s32 isInitialCall) {
ApiStatus GetTransformGroup(Evt* script, s32 isInitialCall) { ApiStatus GetTransformGroup(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 var1 = evt_get_variable(script, *args++); s32 modelID = evt_get_variable(script, *args++);
Bytecode var2 = *args++; Bytecode var2 = *args++;
evt_set_variable(script, var2, get_transform_group_index(var1)); evt_set_variable(script, var2, get_transform_group_index(modelID));
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
ApiStatus EnableGroup(Evt* script, s32 isInitialCall) { ApiStatus EnableGroup(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 index = get_transform_group_index(evt_get_variable(script, *args)); s32 modelID = evt_get_variable(script, *args);
s32 index = get_transform_group_index(modelID);
s32 flagUnset; s32 flagUnset;
ModelTransformGroup* transformGroup; ModelTransformGroup* transformGroup;
@ -514,16 +517,16 @@ void modify_collider_family_flags(s32 index, s32 flags, s32 mode) {
} }
switch (mode) { switch (mode) {
case 0: case MODIFY_COLLIDER_FLAGS_SET_BITS:
collider->flags |= flags; collider->flags |= flags;
break; break;
case 1: case MODIFY_COLLIDER_FLAGS_CLEAR_BITS:
collider->flags &= ~flags; collider->flags &= ~flags;
break; break;
case 2: case MODIFY_COLLIDER_FLAGS_SET_VALUE:
collider->flags = flags; collider->flags = flags;
break; break;
case 3: case MODIFY_COLLIDER_FLAGS_SET_SURFACE:
collider->flags &= ~0xFF; collider->flags &= ~0xFF;
collider->flags |= flags & 0xFF; collider->flags |= flags & 0xFF;
break; break;

View File

@ -284,16 +284,16 @@ void func_8013A4D0(void) {
imgfx_vtxCount = 0; imgfx_vtxCount = 0;
imgfx_init_instance(&(*ImgFXInstances)[0]); imgfx_init_instance(&(*ImgFXInstances)[0]);
(*ImgFXInstances)[0].flags |= IMGFX_FLAG_IN_USE; (*ImgFXInstances)[0].flags |= IMGFX_FLAG_VALID;
for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) { for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) {
if (((*ImgFXInstances)[i].flags & IMGFX_FLAG_IN_USE) && (*ImgFXInstances)[i].lastAnimCmd != IMGFX_SET_ANIM) { if (((*ImgFXInstances)[i].flags & IMGFX_FLAG_VALID) && (*ImgFXInstances)[i].lastAnimCmd != IMGFX_SET_ANIM) {
imgfx_cache_instance_data(&(*ImgFXInstances)[i]); imgfx_cache_instance_data(&(*ImgFXInstances)[i]);
} }
} }
for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) { for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) {
if ((*ImgFXInstances)[i].flags & IMGFX_FLAG_IN_USE && (*ImgFXInstances)[i].colorBuf != NULL) { if ((*ImgFXInstances)[i].flags & IMGFX_FLAG_VALID && (*ImgFXInstances)[i].colorBuf != NULL) {
if ((*ImgFXInstances)[i].lastColorCmd == IMGFX_COLOR_BUF_SET_MULTIPLY) { if ((*ImgFXInstances)[i].lastColorCmd == IMGFX_COLOR_BUF_SET_MULTIPLY) {
continue; continue;
} }
@ -357,7 +357,7 @@ s32 imgfx_get_free_instances(s32 count) {
numAssigned = 0; numAssigned = 0;
for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) { for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) {
if (!((*ImgFXInstances)[i].flags & IMGFX_FLAG_IN_USE)) { if (!((*ImgFXInstances)[i].flags & IMGFX_FLAG_VALID)) {
numAssigned++; numAssigned++;
} }
} }
@ -371,7 +371,7 @@ s32 imgfx_get_free_instances(s32 count) {
numAssigned = 0; numAssigned = 0;
iPrev = -1; iPrev = -1;
for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) { for (i = 1; i < ARRAY_COUNT(*ImgFXInstances); i++) {
if ((*ImgFXInstances)[i].flags & IMGFX_FLAG_IN_USE) { if ((*ImgFXInstances)[i].flags & IMGFX_FLAG_VALID) {
continue; continue;
} }
@ -385,7 +385,7 @@ s32 imgfx_get_free_instances(s32 count) {
(*ImgFXInstances)[i].arrayIdx = i; (*ImgFXInstances)[i].arrayIdx = i;
imgfx_init_instance(&(*ImgFXInstances)[i]); imgfx_init_instance(&(*ImgFXInstances)[i]);
numAssigned++; numAssigned++;
(*ImgFXInstances)[i].flags |= IMGFX_FLAG_IN_USE; (*ImgFXInstances)[i].flags |= IMGFX_FLAG_VALID;
iPrev = i; iPrev = i;
if (numAssigned == count) { if (numAssigned == count) {
(*ImgFXInstances)[i].nextIdx = -1; (*ImgFXInstances)[i].nextIdx = -1;
@ -503,7 +503,7 @@ void imgfx_update(u32 idx, ImgFXType type, s32 imgfxArg1, s32 imgfxArg2, s32 img
s32 t1; s32 t1;
u8 r, g, b, a; u8 r, g, b, a;
if (!(state->flags & IMGFX_FLAG_IN_USE) || (idx >= MAX_IMGFX_INSTANCES)) { if (!(state->flags & IMGFX_FLAG_VALID) || (idx >= MAX_IMGFX_INSTANCES)) {
return; return;
} }
@ -521,7 +521,7 @@ void imgfx_update(u32 idx, ImgFXType type, s32 imgfxArg1, s32 imgfxArg2, s32 img
state->ints.raw[0][0] = -1; state->ints.raw[0][0] = -1;
state->ints.raw[1][0] = -1; state->ints.raw[1][0] = -1;
state->flags &= IMGFX_FLAG_IN_USE; state->flags &= IMGFX_FLAG_VALID;
if (flags != 0) { if (flags != 0) {
state->flags |= flags; state->flags |= flags;
} else { } else {
@ -592,7 +592,7 @@ void imgfx_update(u32 idx, ImgFXType type, s32 imgfxArg1, s32 imgfxArg2, s32 img
state->ints.args.color[3] = imgfxArg4; state->ints.args.color[3] = imgfxArg4;
} }
state->flags &= IMGFX_FLAG_IN_USE; state->flags &= IMGFX_FLAG_VALID;
if (flags != 0) { if (flags != 0) {
state->flags |= flags; state->flags |= flags;
} }
@ -704,7 +704,7 @@ void imgfx_update(u32 idx, ImgFXType type, s32 imgfxArg1, s32 imgfxArg2, s32 img
} }
void imgfx_set_state_flags(s32 idx, u16 flagBits, s32 mode) { void imgfx_set_state_flags(s32 idx, u16 flagBits, s32 mode) {
if ((*ImgFXInstances)[idx].flags & IMGFX_FLAG_IN_USE) { if ((*ImgFXInstances)[idx].flags & IMGFX_FLAG_VALID) {
if (mode) { if (mode) {
(*ImgFXInstances)[idx].flags |= flagBits; (*ImgFXInstances)[idx].flags |= flagBits;
} else { } else {
@ -762,7 +762,7 @@ s32 imgfx_appendGfx_component(s32 idx, ImgFXTexture* ifxImg, u32 flagBits, Matri
state->renderType = IMGFX_RENDER_DEFAULT; state->renderType = IMGFX_RENDER_DEFAULT;
state->ints.raw[0][0] = -1; state->ints.raw[0][0] = -1;
state->ints.raw[1][0] = -1; state->ints.raw[1][0] = -1;
state->flags &= IMGFX_FLAG_IN_USE; state->flags &= IMGFX_FLAG_VALID;
ret = 1; ret = 1;
} }
return ret; return ret;

View File

@ -24,20 +24,12 @@ s16 D_800741A0 = 0;
s16 D_800741A2 = 0; s16 D_800741A2 = 0;
s32 D_800741A4 = 0; s32 D_800741A4 = 0;
Matrix4s MasterIdentityMtx = { Mtx MasterIdentityMtx = RDP_MATRIX(
.whole = { 1.000000, 0.000000, 0.000000, 0.000000,
{1, 0, 0, 0}, 0.000000, 1.000000, 0.000000, 0.000000,
{0, 1, 0, 0}, 0.000000, 0.000000, 1.000000, 0.000000,
{0, 0, 1, 0}, 0.000000, 0.000000, 0.000000, 1.000000
{0, 0, 0, 1} );
},
.frac = {
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}
}
};
s32 D_800741E8[2] = {0, 0}; // padding? s32 D_800741E8[2] = {0, 0}; // padding?
u16 gMatrixListPos = 0; u16 gMatrixListPos = 0;
@ -81,7 +73,7 @@ void step_game_loop(void) {
} }
} }
func_8011BAE8(); mdl_reset_transform_flags();
npc_iter_no_op(); npc_iter_no_op();
update_workers(); update_workers();
update_triggers(); update_triggers();

14
src/map_shape.ld Normal file
View File

@ -0,0 +1,14 @@
SECTIONS
{
. = 0x80210000;
.data : { *(.data) }
.rodata : {
*(.rodata)
. = ALIGN(0x10);
}
/DISCARD/ :
{
*(*);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -131,7 +131,7 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) {
npc->unk_96 = 0; // TODO: fix npc->unk_96 = 0; // TODO: fix
npc->verticalRenderOffset = 0; npc->verticalRenderOffset = 0;
npc->alpha = 255; npc->alpha = 255;
npc->alpha2 = 255; npc->hideAlpha = 255;
npc->jumpScale = 1.0f; npc->jumpScale = 1.0f;
npc->moveSpeed = 4.0f; npc->moveSpeed = 4.0f;
npc->scale.x = 1.0f; npc->scale.x = 1.0f;
@ -964,12 +964,12 @@ void render_npcs(void) {
if (npc->flags & NPC_FLAG_HIDING) { if (npc->flags & NPC_FLAG_HIDING) {
u8 r, g, b, a; u8 r, g, b, a;
get_background_color_blend(&r, &g, &b, &a); get_background_color_blend(&r, &g, &b, &a);
npc->alpha2 = 255 - a; npc->hideAlpha = 255 - a;
} else { } else {
npc->alpha2 = 255; npc->hideAlpha = 255;
} }
if (npc->alpha2 != 0) { if (npc->hideAlpha != 0) {
queue_render_task(renderTaskPtr); queue_render_task(renderTaskPtr);
} }
@ -1323,7 +1323,7 @@ void npc_draw_palswap_mode_0(Npc* npc, s32 arg1, Matrix4f mtx) {
} }
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
s32 alpha = (npc->alpha * npc->alpha2 / 255); s32 alpha = (npc->alpha * npc->hideAlpha / 255);
u32 mask; u32 mask;
if (alpha < 255) { if (alpha < 255) {
mask = DRAW_SPRITE_OVERRIDE_ALPHA; mask = DRAW_SPRITE_OVERRIDE_ALPHA;
@ -1419,7 +1419,7 @@ s32 npc_draw_palswap_mode_1(Npc* npc, s32 arg1, Matrix4f mtx) {
} }
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
s32 alpha = npc->alpha * npc->alpha2 / 255; s32 alpha = npc->alpha * npc->hideAlpha / 255;
u32 mask; u32 mask;
if (alpha < 255) { if (alpha < 255) {
mask = DRAW_SPRITE_OVERRIDE_ALPHA; mask = DRAW_SPRITE_OVERRIDE_ALPHA;
@ -1557,7 +1557,7 @@ s32 npc_draw_palswap_mode_2(Npc* npc, s32 arg1, s32 arg2, Matrix4f mtx) {
if (npc->palSwapState >= 0) { if (npc->palSwapState >= 0) {
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
u32 mask; u32 mask;
blendAlpha = npc->alpha * npc->alpha2 / 255; blendAlpha = npc->alpha * npc->hideAlpha / 255;
if (blendAlpha < 255) { if (blendAlpha < 255) {
mask = DRAW_SPRITE_OVERRIDE_ALPHA; mask = DRAW_SPRITE_OVERRIDE_ALPHA;
} else { } else {
@ -1701,7 +1701,7 @@ s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
s32 temp; s32 temp;
u32 spriteInstanceMask; u32 spriteInstanceMask;
blendAlpha = npc->alpha * npc->alpha2 / 255; blendAlpha = npc->alpha * npc->hideAlpha / 255;
temp = blendAlpha < 255; temp = blendAlpha < 255;
spriteInstanceMask = ((temp) << 31) | DRAW_SPRITE_OVERRIDE_PALETTES; spriteInstanceMask = ((temp) << 31) | DRAW_SPRITE_OVERRIDE_PALETTES;
spr_draw_npc_sprite(npc->spriteInstanceID | spriteInstanceMask, arg1, blendAlpha, npc->localPalettes, mtx); spr_draw_npc_sprite(npc->spriteInstanceID | spriteInstanceMask, arg1, blendAlpha, npc->localPalettes, mtx);

View File

@ -196,7 +196,7 @@ void state_step_end_battle(void) {
} }
mdl_load_all_textures(mapSettings->modelTreeRoot, get_asset_offset(wMapTexName, &sizeTemp), sizeTemp); mdl_load_all_textures(mapSettings->modelTreeRoot, get_asset_offset(wMapTexName, &sizeTemp), sizeTemp);
calculate_model_sizes(); mdl_calculate_model_sizes();
npc_reload_all(); npc_reload_all();
playerStatus->animFlags = D_800A0904; playerStatus->animFlags = D_800A0904;

View File

@ -323,7 +323,7 @@ void state_step_exit_language_select(void) {
set_background_size(296, 200, 12, 20); set_background_size(296, 200, 12, 20);
} }
calculate_model_sizes(); mdl_calculate_model_sizes();
npc_reload_all(); npc_reload_all();
status_bar_respond_to_changes(); status_bar_respond_to_changes();
set_time_freeze_mode(TIME_FREEZE_PARTIAL); set_time_freeze_mode(TIME_FREEZE_PARTIAL);

View File

@ -200,7 +200,7 @@ void state_step_unpause(void) {
} }
gGameStatusPtr->backgroundDarkness = gGameStatusPtr->savedBackgroundDarkness; gGameStatusPtr->backgroundDarkness = gGameStatusPtr->savedBackgroundDarkness;
calculate_model_sizes(); mdl_calculate_model_sizes();
npc_reload_all(); npc_reload_all();
set_windows_visible(WINDOW_GROUP_ALL); set_windows_visible(WINDOW_GROUP_ALL);
status_bar_respond_to_changes(); status_bar_respond_to_changes();

View File

@ -5,7 +5,7 @@
extern s32 N(SpotlightsAlpha); extern s32 N(SpotlightsAlpha);
API_CALLABLE(N(SetWorldDark)) { API_CALLABLE(N(SetWorldDark)) {
func_8011B950(MODEL_Root, -1, 1, 0); func_8011B950(MODEL_Root, CUSTOM_GFX_NONE, FOG_MODE_1, 0);
set_background_color_blend(0, 0, 0, 255); set_background_color_blend(0, 0, 0, 255);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
@ -23,7 +23,7 @@ API_CALLABLE(N(FadeInWorld)) {
set_background_color_blend(0, 0, 0, script->functionTemp[1]); set_background_color_blend(0, 0, 0, script->functionTemp[1]);
if (script->functionTemp[1] == 0) { if (script->functionTemp[1] == 0) {
func_8011B950(MODEL_Root, -1, 0, 0); func_8011B950(MODEL_Root, CUSTOM_GFX_NONE, FOG_MODE_0, 0);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} else { } else {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
@ -265,7 +265,7 @@ EvtScript N(EVS_UpdateLightshow) = {
EVT_CALL(EnableModel, MODEL_kino8, TRUE) EVT_CALL(EnableModel, MODEL_kino8, TRUE)
EVT_CALL(EnableTexPanning, MODEL_kino8, TRUE) EVT_CALL(EnableTexPanning, MODEL_kino8, TRUE)
EVT_CALL(SetModelCustomGfx, MODEL_kino7, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_kino7, CUSTOM_GFX_1, -1)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_set_spotlight_alpha)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_set_spotlight_alpha)), NULL)
EVT_CHILD_THREAD EVT_CHILD_THREAD
EVT_CALL(MakeLerp, 0, 255, 90, EASING_LINEAR) EVT_CALL(MakeLerp, 0, 255, 90, EASING_LINEAR)
EVT_LOOP(0) EVT_LOOP(0)

View File

@ -387,7 +387,7 @@ EvtScript N(EVS_SetupBubbles) = {
EVT_SET(LVar0, CLONED_MODEL(5)) EVT_SET(LVar0, CLONED_MODEL(5))
EVT_EXEC(N(EVS_ManageBlownBubble)) EVT_EXEC(N(EVS_ManageBlownBubble))
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_o167, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_o167, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_big_bubble)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_big_bubble)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o167, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_o167, CUSTOM_GFX_1, -1)
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(1), 1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(1), 1, -1)
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(2), 1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(2), 1, -1)
@ -395,7 +395,7 @@ EvtScript N(EVS_SetupBubbles) = {
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(4), 1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(4), 1, -1)
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(5), 1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(5), 1, -1)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_o57, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_o57, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(gfx_build_bubble_flower)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(gfx_build_bubble_flower)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o57, CUSTOM_GFX_2, -1) EVT_CALL(SetModelCustomGfx, MODEL_o57, CUSTOM_GFX_2, -1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END

View File

@ -153,7 +153,7 @@ EvtScript N(EVS_SetupAurora) = {
EVT_END_THREAD EVT_END_THREAD
EVT_CALL(SetTexPanner, MODEL_o160, TEX_PANNER_7) EVT_CALL(SetTexPanner, MODEL_o160, TEX_PANNER_7)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_o76, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_o76, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(build_gfx_aurora)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(build_gfx_aurora)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o76, CUSTOM_GFX_1, FOG_MODE_UNCHANGED) EVT_CALL(SetModelCustomGfx, MODEL_o76, CUSTOM_GFX_1, FOG_MODE_UNCHANGED)
EVT_RETURN EVT_RETURN
EVT_END EVT_END

View File

@ -16,12 +16,12 @@ ApiStatus N(MoveBush_AnimateShearing)(Evt* script) {
Model* mdl = get_model_from_list_index(modelIndex); Model* mdl = get_model_from_list_index(modelIndex);
Matrix4f mtx; Matrix4f mtx;
if (!(mdl->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(mdl->flags & MODEL_FLAG_HAS_TRANSFORM)) {
N(MoveBush_apply_shear_mtx)(mdl->transformMatrix, f); N(MoveBush_apply_shear_mtx)(mdl->userTransformMtx, f);
mdl->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; mdl->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
} else { } else {
N(MoveBush_apply_shear_mtx)(mtx, f); N(MoveBush_apply_shear_mtx)(mtx, f);
guMtxCatF(mtx, mdl->transformMatrix, mdl->transformMatrix); guMtxCatF(mtx, mdl->userTransformMtx, mdl->userTransformMtx);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -218,10 +218,10 @@ EvtScript N(D_8024652C_B26A6C) = {
EvtScript N(EVS_802467AC) = { EvtScript N(EVS_802467AC) = {
EVT_SET_GROUP(EVT_GROUP_00) EVT_SET_GROUP(EVT_GROUP_00)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_karada, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_karada, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(unkAngleFunc002)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(unkAngleFunc002)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_karada, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_karada, CUSTOM_GFX_1, -1)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_2, MODEL_onaka, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_2, MODEL_onaka, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(unkAngleFunc003)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(unkAngleFunc003)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_onaka, CUSTOM_GFX_2, -1) EVT_CALL(SetModelCustomGfx, MODEL_onaka, CUSTOM_GFX_2, -1)
EVT_THREAD EVT_THREAD
EVT_LABEL(0) EVT_LABEL(0)

View File

@ -107,7 +107,7 @@ EvtScript N(EVS_StartTongueWiggle) = {
EVT_CALL(EnableModel, TONGUE_COPY_MODEL_ID, FALSE) EVT_CALL(EnableModel, TONGUE_COPY_MODEL_ID, FALSE)
EVT_EXEC(N(EVS_WiggleTongue)) EVT_EXEC(N(EVS_WiggleTongue))
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_sita, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_sita, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(make_tongue_gfx)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(make_tongue_gfx)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_sita, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_sita, CUSTOM_GFX_1, -1)
EVT_CALL(HidePlayerShadow, TRUE) EVT_CALL(HidePlayerShadow, TRUE)
EVT_RETURN EVT_RETURN

View File

@ -59,10 +59,10 @@ void N(set_spotlight_pos_scale)(s32 modelID, f32 x, f32 y, f32 z, f32 scale) {
Matrix4f mtxTemp; Matrix4f mtxTemp;
Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(modelID)); Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(modelID));
guTranslateF(model->transformMatrix, x, y, z); guTranslateF(model->userTransformMtx, x, y, z);
guScaleF(mtxTemp, scale, 1.0f, scale); guScaleF(mtxTemp, scale, 1.0f, scale);
guMtxCatF(mtxTemp, model->transformMatrix, model->transformMatrix); guMtxCatF(mtxTemp, model->userTransformMtx, model->userTransformMtx);
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
} }
API_CALLABLE(N(UpdateSearchlight)) { API_CALLABLE(N(UpdateSearchlight)) {

View File

@ -1411,7 +1411,7 @@ API_CALLABLE(N(func_80242F08_8B2F78)) {
} }
API_CALLABLE(N(func_80242F28_8B2F98)) { API_CALLABLE(N(func_80242F28_8B2F98)) {
func_8011B950(MODEL_kinopi, -1, 1, 1); func_8011B950(MODEL_kinopi, CUSTOM_GFX_NONE, FOG_MODE_1, 1);
set_background_color_blend(0, 0, 0, 255); set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0; gCameras[CAM_DEFAULT].bgColor[1] = 0;

View File

@ -8,7 +8,7 @@
#define NAME_SUFFIX #define NAME_SUFFIX
API_CALLABLE(N(func_80241C9C_8EDABC)) { API_CALLABLE(N(func_80241C9C_8EDABC)) {
func_8011B950(MODEL_g62, -1, 1, 1); func_8011B950(MODEL_g62, CUSTOM_GFX_NONE, FOG_MODE_1, 1);
set_background_color_blend(0, 0, 0, 255); set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[0] = 0;

View File

@ -7,7 +7,7 @@
#define NAME_SUFFIX #define NAME_SUFFIX
API_CALLABLE(N(func_80242030_8EDE50)) { API_CALLABLE(N(func_80242030_8EDE50)) {
func_8011B950(MODEL_g62, -1, 0, 1); func_8011B950(MODEL_g62, CUSTOM_GFX_NONE, FOG_MODE_0, 1);
set_background_color_blend(0, 0, 0, 0); set_background_color_blend(0, 0, 0, 0);
gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[0] = 0;

View File

@ -197,7 +197,7 @@ EvtScript N(EVS_Scene_TheEnd) = {
EVT_CALL(SetModelCustomGfx, MODEL_e, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_e, CUSTOM_GFX_1, -1)
EVT_CALL(SetModelCustomGfx, MODEL_d, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_d, CUSTOM_GFX_1, -1)
EVT_CALL(SetModelCustomGfx, MODEL_n, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_n, CUSTOM_GFX_1, -1)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_the_end)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_the_end)), NULL)
EVT_CALL(MakeLerp, 0, 255, 90, EASING_LINEAR) EVT_CALL(MakeLerp, 0, 255, 90, EASING_LINEAR)
EVT_LOOP(0) EVT_LOOP(0)
EVT_CALL(UpdateLerp) EVT_CALL(UpdateLerp)

View File

@ -27,7 +27,7 @@ void N(gfx_build_water)(void) {
EvtScript N(EVS_SetupWaterCustomGfx) = { EvtScript N(EVS_SetupWaterCustomGfx) = {
EVT_WAIT(1) EVT_WAIT(1)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_0, EVT_PTR(N(gfx_build_water)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_0, EVT_PTR(N(gfx_build_water)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_water, CUSTOM_GFX_0, -1) EVT_CALL(SetModelCustomGfx, MODEL_water, CUSTOM_GFX_0, -1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END

View File

@ -17,7 +17,7 @@ API_CALLABLE(N(SetDojoBattle)) {
} }
API_CALLABLE(N(ResetBackgroundPostBattle)) { API_CALLABLE(N(ResetBackgroundPostBattle)) {
func_8011B950(MODEL_minka_1, -1, FOG_MODE_1, 1); func_8011B950(MODEL_minka_1, CUSTOM_GFX_NONE, FOG_MODE_1, 1);
set_background_color_blend(0, 0, 0, 255); set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0; gCameras[CAM_DEFAULT].bgColor[1] = 0;

View File

@ -128,7 +128,7 @@ EvtScript N(EVS_SetupCrystalBallGfx) = {
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(gfx_build_crystal_ball_pre)), EVT_PTR(N(gfx_build_crystal_ball_post))) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(gfx_build_crystal_ball_pre)), EVT_PTR(N(gfx_build_crystal_ball_post)))
EVT_CALL(SetModelCustomGfx, MODEL_mirrorball, CUSTOM_GFX_2, -1) EVT_CALL(SetModelCustomGfx, MODEL_mirrorball, CUSTOM_GFX_2, -1)
EVT_CALL(EnableModel, MODEL_mirrorball, FALSE) EVT_CALL(EnableModel, MODEL_mirrorball, FALSE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_3, EVT_PTR(N(gfx_build_inside_crystal_ball)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_3, EVT_PTR(N(gfx_build_inside_crystal_ball)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_tama, CUSTOM_GFX_3, -1) EVT_CALL(SetModelCustomGfx, MODEL_tama, CUSTOM_GFX_3, -1)
EVT_CALL(SetModelFlags, MODEL_tama, MODEL_FLAG_USE_CAMERA_UNK_MATRIX, TRUE) EVT_CALL(SetModelFlags, MODEL_tama, MODEL_FLAG_USE_CAMERA_UNK_MATRIX, TRUE)
EVT_CALL(SetModelFlags, MODEL_ohosi, MODEL_FLAG_USE_CAMERA_UNK_MATRIX, TRUE) EVT_CALL(SetModelFlags, MODEL_ohosi, MODEL_FLAG_USE_CAMERA_UNK_MATRIX, TRUE)

View File

@ -256,7 +256,7 @@ API_CALLABLE(N(func_802448A0_805120)) {
if (isInitialCall) { if (isInitialCall) {
if (script->varTable[0] == 0) { if (script->varTable[0] == 0) {
func_8011B950(script->varTable[15], -1, FOG_MODE_1, 1); func_8011B950(script->varTable[15], CUSTOM_GFX_NONE, FOG_MODE_1, 1);
} }
script->functionTemp[0] = 0; script->functionTemp[0] = 0;
} }
@ -279,7 +279,7 @@ API_CALLABLE(N(func_802448A0_805120)) {
if (script->functionTemp[0] >= 255) { if (script->functionTemp[0] >= 255) {
if (script->varTable[0] == 3) { if (script->varTable[0] == 3) {
func_8011B950(script->varTable[15], -1, FOG_MODE_0, 1); func_8011B950(script->varTable[15], CUSTOM_GFX_NONE, FOG_MODE_0, 1);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -621,7 +621,7 @@ EvtScript N(EVS_NpcInit_Rowf) = {
EVT_END_IF EVT_END_IF
EVT_END_SWITCH EVT_END_SWITCH
EVT_SET(AF_MAC_41, FALSE) EVT_SET(AF_MAC_41, FALSE)
EVT_CALL(SetModelFlags, MODEL_ju_2, MODEL_FLAG_FLAG_200, FALSE) EVT_CALL(SetModelFlags, MODEL_ju_2, MODEL_FLAG_DO_BOUNDS_CULLING, FALSE)
EVT_CALL(EnableGroup, MODEL_jutan1, FALSE) EVT_CALL(EnableGroup, MODEL_jutan1, FALSE)
EVT_CALL(ModifyColliderFlags, MODIFY_COLLIDER_FLAGS_SET_BITS, COLLIDER_b1, COLLIDER_FLAGS_UPPER_MASK) EVT_CALL(ModifyColliderFlags, MODIFY_COLLIDER_FLAGS_SET_BITS, COLLIDER_b1, COLLIDER_FLAGS_UPPER_MASK)
EVT_CALL(ModifyColliderFlags, MODIFY_COLLIDER_FLAGS_SET_BITS, COLLIDER_b2, COLLIDER_FLAGS_UPPER_MASK) EVT_CALL(ModifyColliderFlags, MODIFY_COLLIDER_FLAGS_SET_BITS, COLLIDER_b2, COLLIDER_FLAGS_UPPER_MASK)
@ -631,7 +631,7 @@ EvtScript N(EVS_NpcInit_Rowf) = {
EVT_CALL(ScaleGroup, MODEL_jutan2, EVT_FLOAT(1.3), 1, EVT_FLOAT(1.3)) EVT_CALL(ScaleGroup, MODEL_jutan2, EVT_FLOAT(1.3), 1, EVT_FLOAT(1.3))
EVT_SET(MV_RowfRugRotateAngle, 60) EVT_SET(MV_RowfRugRotateAngle, 60)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_ju_1, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_ju_1, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_0, EVT_PTR(N(gfx_build_rowf_rug_with_ripples)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_0, EVT_PTR(N(gfx_build_rowf_rug_with_ripples)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_ju_1, CUSTOM_GFX_0, -1) EVT_CALL(SetModelCustomGfx, MODEL_ju_1, CUSTOM_GFX_0, -1)
EVT_IF_EQ(AF_MAC_40, TRUE) EVT_IF_EQ(AF_MAC_40, TRUE)
EVT_BIND_TRIGGER(EVT_PTR(N(EVS_EnterBadgeShop)), TRIGGER_FLOOR_TOUCH, COLLIDER_roten, 1, 0) EVT_BIND_TRIGGER(EVT_PTR(N(EVS_EnterBadgeShop)), TRIGGER_FLOOR_TOUCH, COLLIDER_roten, 1, 0)
@ -640,9 +640,9 @@ EvtScript N(EVS_NpcInit_Rowf) = {
EVT_END_IF EVT_END_IF
EVT_THREAD EVT_THREAD
EVT_WAIT(5) EVT_WAIT(5)
EVT_CALL(SetModelFlags, MODEL_b1, MODEL_FLAG_FLAG_4, FALSE) EVT_CALL(SetModelFlags, MODEL_b1, MODEL_FLAG_INACTIVE, FALSE)
EVT_CALL(SetModelFlags, MODEL_b2, MODEL_FLAG_FLAG_4, FALSE) EVT_CALL(SetModelFlags, MODEL_b2, MODEL_FLAG_INACTIVE, FALSE)
EVT_CALL(SetModelFlags, MODEL_b3, MODEL_FLAG_FLAG_4, FALSE) EVT_CALL(SetModelFlags, MODEL_b3, MODEL_FLAG_INACTIVE, FALSE)
EVT_CALL(N(HideRowfBadges)) EVT_CALL(N(HideRowfBadges))
EVT_LABEL(0) EVT_LABEL(0)
EVT_IF_EQ(GF_MAC01_RowfBadgeAvailableA, FALSE) EVT_IF_EQ(GF_MAC01_RowfBadgeAvailableA, FALSE)

View File

@ -5,7 +5,7 @@ API_CALLABLE(N(InitEntryFromTunnels)) {
Npc* npc; Npc* npc;
s32 i; s32 i;
func_8011B950(MODEL_souko, -1, FOG_MODE_1, 1); func_8011B950(MODEL_souko, CUSTOM_GFX_NONE, FOG_MODE_1, 1);
set_background_color_blend(0, 0, 0, 255); set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0; gCameras[CAM_DEFAULT].bgColor[1] = 0;

View File

@ -3,7 +3,7 @@
s32 set_background_color_blend(s32, s32, s32, s32); s32 set_background_color_blend(s32, s32, s32, s32);
API_CALLABLE(N(InitEntryFromToybox)) { API_CALLABLE(N(InitEntryFromToybox)) {
func_8011B950(MODEL_heiho_house, -1, FOG_MODE_1, 1); func_8011B950(MODEL_heiho_house, CUSTOM_GFX_NONE, FOG_MODE_1, 1);
set_background_color_blend(0, 0, 0, 255); set_background_color_blend(0, 0, 0, 255);
gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[0] = 0;
gCameras[CAM_DEFAULT].bgColor[1] = 0; gCameras[CAM_DEFAULT].bgColor[1] = 0;

View File

@ -229,10 +229,10 @@ EvtScript N(D_802516CC_86383C) = {
EvtScript N(EVS_8025194C) = { EvtScript N(EVS_8025194C) = {
EVT_SET_GROUP(EVT_GROUP_00) EVT_SET_GROUP(EVT_GROUP_00)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_karada, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_karada, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(unkAngleFunc002)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(unkAngleFunc002)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_karada, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_karada, CUSTOM_GFX_1, -1)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_2, MODEL_onaka, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_2, MODEL_onaka, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(unkAngleFunc003)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(unkAngleFunc003)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_onaka, CUSTOM_GFX_2, -1) EVT_CALL(SetModelCustomGfx, MODEL_onaka, CUSTOM_GFX_2, -1)
EVT_THREAD EVT_THREAD
EVT_LABEL(0) EVT_LABEL(0)

View File

@ -94,7 +94,7 @@ void N(gfx_build_club_64)(s32 index) {
EvtScript N(EVS_AnimateClub64Sign) = { EvtScript N(EVS_AnimateClub64Sign) = {
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_3, MODEL_o187, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_3, MODEL_o187, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_3, EVT_PTR(N(gfx_build_club_64)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_3, EVT_PTR(N(gfx_build_club_64)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o187, CUSTOM_GFX_3, -1) EVT_CALL(SetModelCustomGfx, MODEL_o187, CUSTOM_GFX_3, -1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END

View File

@ -225,10 +225,10 @@ EvtScript N(EVS_WhaleState_Walk) = {
EvtScript N(EVS_WhaleMain) = { EvtScript N(EVS_WhaleMain) = {
EVT_SET_GROUP(EVT_GROUP_00) EVT_SET_GROUP(EVT_GROUP_00)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_karada, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_karada, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(unkAngleFunc002)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(unkAngleFunc002)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_karada, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_karada, CUSTOM_GFX_1, -1)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_2, MODEL_onaka, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_2, MODEL_onaka, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(unkAngleFunc003)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(unkAngleFunc003)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_onaka, CUSTOM_GFX_2, -1) EVT_CALL(SetModelCustomGfx, MODEL_onaka, CUSTOM_GFX_2, -1)
EVT_CALL(SetNpcVar, NPC_Whale, 0, 0) EVT_CALL(SetNpcVar, NPC_Whale, 0, 0)
EVT_THREAD EVT_THREAD

View File

@ -164,11 +164,11 @@ API_CALLABLE(N(func_802412AC_865DEC)) {
Model* model = get_model_from_list_index(modelIndex); Model* model = get_model_from_list_index(modelIndex);
f32 x, y, z; f32 x, y, z;
if (model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED) { if (model->flags & MODEL_FLAG_HAS_TRANSFORM) {
// get model translation from transform matrix // get model translation from transform matrix
x = model->transformMatrix[3][0]; x = model->userTransformMtx[3][0];
y = model->transformMatrix[3][1]; y = model->userTransformMtx[3][1];
z = model->transformMatrix[3][2]; z = model->userTransformMtx[3][2];
} else { } else {
z = 0.0f; z = 0.0f;
y = 0.0f; y = 0.0f;

View File

@ -696,13 +696,13 @@ API_CALLABLE(N(RunMinigame)) {
data->box[i].stateTimer = 0; data->box[i].stateTimer = 0;
model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID)); model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID));
model->flags &= ~MODEL_FLAG_HIDDEN; model->flags &= ~MODEL_FLAG_HIDDEN;
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guTranslateF(model->transformMatrix, npc->pos.x, npc->pos.y, npc->pos.z); guTranslateF(model->userTransformMtx, npc->pos.x, npc->pos.y, npc->pos.z);
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
} }
else { else {
guTranslateF(mtx, npc->pos.x, npc->pos.y, npc->pos.z); guTranslateF(mtx, npc->pos.x, npc->pos.y, npc->pos.z);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
} }
break; break;
@ -711,12 +711,12 @@ API_CALLABLE(N(RunMinigame)) {
npc->pos.y += npc->jumpVelocity; npc->pos.y += npc->jumpVelocity;
npc->jumpVelocity -= npc->jumpScale; npc->jumpVelocity -= npc->jumpScale;
model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID)); model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID));
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guTranslateF(model->transformMatrix, npc->pos.x, npc->pos.y, npc->pos.z); guTranslateF(model->userTransformMtx, npc->pos.x, npc->pos.y, npc->pos.z);
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
} else { } else {
guTranslateF(mtx, npc->pos.x, npc->pos.y, npc->pos.z); guTranslateF(mtx, npc->pos.x, npc->pos.y, npc->pos.z);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
if ((npc->moveToPos.y + 20.0f) < npc->pos.y) { if ((npc->moveToPos.y + 20.0f) < npc->pos.y) {
enable_npc_shadow(npc); enable_npc_shadow(npc);
@ -742,12 +742,12 @@ API_CALLABLE(N(RunMinigame)) {
hittingPeachBlock = TRUE; hittingPeachBlock = TRUE;
model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID)); model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID));
centerY = update_lerp(EASING_QUADRATIC_OUT, npc->moveToPos.y, npc->moveToPos.y + 30.0, npc->duration, 30); centerY = update_lerp(EASING_QUADRATIC_OUT, npc->moveToPos.y, npc->moveToPos.y + 30.0, npc->duration, 30);
if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM_APPLIED)) { if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) {
guTranslateF(model->transformMatrix, npc->pos.x, centerY, npc->pos.z); guTranslateF(model->userTransformMtx, npc->pos.x, centerY, npc->pos.z);
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
} else { } else {
guTranslateF(mtx, npc->pos.x, centerY, npc->pos.z); guTranslateF(mtx, npc->pos.x, centerY, npc->pos.z);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix); guMtxCatF(mtx, model->userTransformMtx, model->userTransformMtx);
} }
npc->duration++; npc->duration++;
if (npc->duration >= 30) { if (npc->duration >= 30) {

View File

@ -67,7 +67,7 @@ EvtScript N(EVS_ManageEvilTree) = {
}; };
EvtScript N(EVS_SetupExitHint) = { EvtScript N(EVS_SetupExitHint) = {
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_evil_tree_face)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_evil_tree_face)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_kao, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_kao, CUSTOM_GFX_1, -1)
EVT_CALL(SetModelFlags, MODEL_kao, MODEL_FLAG_USES_CUSTOM_GFX, TRUE) EVT_CALL(SetModelFlags, MODEL_kao, MODEL_FLAG_USES_CUSTOM_GFX, TRUE)
EVT_WAIT(20) EVT_WAIT(20)

View File

@ -111,7 +111,7 @@ EvtScript N(EVS_OnInspectEvilRock) = {
}; };
EvtScript N(EVS_SetupExitHint) = { EvtScript N(EVS_SetupExitHint) = {
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_evil_rock_face)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_evil_rock_face)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o440, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_o440, CUSTOM_GFX_1, -1)
EVT_CALL(SetModelFlags, MODEL_o440, MODEL_FLAG_USES_CUSTOM_GFX, TRUE) EVT_CALL(SetModelFlags, MODEL_o440, MODEL_FLAG_USES_CUSTOM_GFX, TRUE)
EVT_BIND_TRIGGER(EVT_PTR(N(EVS_OnInspectEvilRock)), TRIGGER_WALL_PRESS_A, COLLIDER_o491, 1, 0) EVT_BIND_TRIGGER(EVT_PTR(N(EVS_OnInspectEvilRock)), TRIGGER_WALL_PRESS_A, COLLIDER_o491, 1, 0)

View File

@ -1478,7 +1478,7 @@ EvtScript N(EVS_SetupMinigame) = {
EVT_CALL(EnableNpcShadow, NPC_Fuzzy_01, FALSE) EVT_CALL(EnableNpcShadow, NPC_Fuzzy_01, FALSE)
EVT_CALL(EnableNpcShadow, NPC_Fuzzy_02, FALSE) EVT_CALL(EnableNpcShadow, NPC_Fuzzy_02, FALSE)
EVT_CALL(EnableNpcShadow, NPC_Fuzzy_03, FALSE) EVT_CALL(EnableNpcShadow, NPC_Fuzzy_03, FALSE)
EVT_CALL(SetModelFlags, MODEL_o177, MODEL_FLAG_FLAG_200, FALSE) EVT_CALL(SetModelFlags, MODEL_o177, MODEL_FLAG_DO_BOUNDS_CULLING, FALSE)
EVT_IF_GE(GB_StoryProgress, STORY_CH1_FUZZY_THIEF_HID_IN_TREE) EVT_IF_GE(GB_StoryProgress, STORY_CH1_FUZZY_THIEF_HID_IN_TREE)
EVT_CALL(N(GetTreeHidingSpotPos), LVar4, LVar0, LVar1, LVar2) EVT_CALL(N(GetTreeHidingSpotPos), LVar4, LVar0, LVar1, LVar2)
EVT_CALL(SetNpcPos, NPC_BossFuzzy, LVar0, LVar1, LVar2) EVT_CALL(SetNpcPos, NPC_BossFuzzy, LVar0, LVar1, LVar2)

View File

@ -171,24 +171,24 @@ API_CALLABLE(N(UpdateRockingChair)) {
physics->verticalOffset = SQ(physics->rotationAngle) / 90.0f; physics->verticalOffset = SQ(physics->rotationAngle) / 90.0f;
model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i3)); model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i3));
model->flags |= (MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED); model->flags |= (MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM);
guTranslateF(model->transformMatrix, 0.0f, physics->verticalOffset, 0.0f); guTranslateF(model->userTransformMtx, 0.0f, physics->verticalOffset, 0.0f);
guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f); guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f);
guMtxCatF(model->transformMatrix, tempMtx, model->transformMatrix); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx);
update_collider_transform(COLLIDER_i3); update_collider_transform(COLLIDER_i3);
update_collider_transform(COLLIDER_i2); update_collider_transform(COLLIDER_i2);
model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i2)); model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i2));
model->flags |= (MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED); model->flags |= (MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM);
guTranslateF(model->transformMatrix, 0.0f, physics->verticalOffset, 0.0f); guTranslateF(model->userTransformMtx, 0.0f, physics->verticalOffset, 0.0f);
guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f); guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f);
guMtxCatF(model->transformMatrix, tempMtx, model->transformMatrix); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx);
model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i1)); model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i1));
model->flags |= (MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED); model->flags |= (MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM);
guTranslateF(model->transformMatrix, 0.0f, physics->verticalOffset, 0.0f); guTranslateF(model->userTransformMtx, 0.0f, physics->verticalOffset, 0.0f);
guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f); guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f);
guMtxCatF(model->transformMatrix, tempMtx, model->transformMatrix); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx);
update_collider_transform(COLLIDER_i1); update_collider_transform(COLLIDER_i1);
return ApiStatus_BLOCK; return ApiStatus_BLOCK;

View File

@ -111,7 +111,7 @@ API_CALLABLE(N(UpdateChandelier)) {
} }
model = chandelier->models[0]; model = chandelier->models[0];
copy_matrix(model->transformMatrix, chandelier->transformMtx); copy_matrix(model->userTransformMtx, chandelier->transformMtx);
lastDropDistance = 0.0f; lastDropDistance = 0.0f;
chandelier->dropDistance = 0.0f; chandelier->dropDistance = 0.0f;
@ -247,17 +247,17 @@ API_CALLABLE(N(UpdateChandelier)) {
} }
script->varTable[1] = cabinetPos; script->varTable[1] = cabinetPos;
guTranslateF(model->transformMatrix, 0.0f, chandelier->dropDistance - 300.0f, 0.0f); guTranslateF(model->userTransformMtx, 0.0f, chandelier->dropDistance - 300.0f, 0.0f);
guRotateF(tempMtx, chandelier->swingAngle, 0.0f, 0.0f, 1.0f); guRotateF(tempMtx, chandelier->swingAngle, 0.0f, 0.0f, 1.0f);
guMtxCatF(model->transformMatrix, tempMtx, model->transformMatrix); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx);
guTranslateF(tempMtx, 0.0f, 300.0f, 0.0f); guTranslateF(tempMtx, 0.0f, 300.0f, 0.0f);
guMtxCatF(model->transformMatrix, tempMtx, model->transformMatrix); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx);
guMtxCatF(chandelier->transformMtx, model->transformMatrix, model->transformMatrix); guMtxCatF(chandelier->transformMtx, model->userTransformMtx, model->userTransformMtx);
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
for (i = 1; i < ARRAY_COUNT(chandelier->models); i++) { for (i = 1; i < ARRAY_COUNT(chandelier->models); i++) {
copy_matrix(model->transformMatrix, chandelier->models[i]->transformMatrix); copy_matrix(model->userTransformMtx, chandelier->models[i]->userTransformMtx);
chandelier->models[i]->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; chandelier->models[i]->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
} }
if (chandelier->flags & CHANDELIER_FLAG_TETHER_PLAYER) { if (chandelier->flags & CHANDELIER_FLAG_TETHER_PLAYER) {

View File

@ -52,12 +52,12 @@ API_CALLABLE(N(UpdateRockingHorses)) {
horse->lastRockAngle = rockAngle; horse->lastRockAngle = rockAngle;
} }
model = get_model_from_list_index(get_model_list_index_from_tree_index(horse->modelID)); model = get_model_from_list_index(get_model_list_index_from_tree_index(horse->modelID));
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
guTranslateF(mtxPivot, -horse->posX, 0.0f, -horse->posZ); guTranslateF(mtxPivot, -horse->posX, 0.0f, -horse->posZ);
guRotateF(mtxRotate, rockAngle, 0.0f, 0.0f, 1.0f); guRotateF(mtxRotate, rockAngle, 0.0f, 0.0f, 1.0f);
guMtxCatF(mtxPivot, mtxRotate, model->transformMatrix); guMtxCatF(mtxPivot, mtxRotate, model->userTransformMtx);
guTranslateF(mtxPivot, horse->posX, offsetY, horse->posZ); guTranslateF(mtxPivot, horse->posX, offsetY, horse->posZ);
guMtxCatF(model->transformMatrix, mtxPivot, model->transformMatrix); guMtxCatF(model->userTransformMtx, mtxPivot, model->userTransformMtx);
} }
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }

View File

@ -111,7 +111,7 @@ API_CALLABLE(N(AnimateBarricadeParts)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
part->transformMatrix[j][k] = model->transformMatrix[j][k]; part->transformMatrix[j][k] = model->userTransformMtx[j][k];
} }
} }
} }
@ -150,11 +150,11 @@ API_CALLABLE(N(AnimateBarricadeParts)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
model->transformMatrix[j][k] = part->transformMatrix[j][k]; model->userTransformMtx[j][k] = part->transformMatrix[j][k];
} }
} }
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
guTranslateF(mtxTransform, part->pos.x - part->origin.x, part->pos.y - part->origin.y, part->pos.z - part->origin.z); guTranslateF(mtxTransform, part->pos.x - part->origin.x, part->pos.y - part->origin.y, part->pos.z - part->origin.z);
part->rot.x += part->angularVelocity.x; part->rot.x += part->angularVelocity.x;
part->rot.y += part->angularVelocity.y; part->rot.y += part->angularVelocity.y;
@ -168,7 +168,7 @@ API_CALLABLE(N(AnimateBarricadeParts)) {
guMtxCatF(mtxRotZ, mtxRotX, mtxRotX); guMtxCatF(mtxRotZ, mtxRotX, mtxRotX);
guMtxCatF(mtxRotX, mtxRotY, mtxRotY); guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
guMtxCatF(mtxRotY, mtxTransform, mtxTransform); guMtxCatF(mtxRotY, mtxTransform, mtxTransform);
guMtxCatF(model->transformMatrix, mtxTransform, model->transformMatrix); guMtxCatF(model->userTransformMtx, mtxTransform, model->userTransformMtx);
} }
if ((u32) script->functionTemp[1] >= ARRAY_COUNT(N(BarricadeModels))) { if ((u32) script->functionTemp[1] >= ARRAY_COUNT(N(BarricadeModels))) {

View File

@ -142,7 +142,7 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
it->transformMatrix[j][k] = loopModel->transformMatrix[j][k]; it->transformMatrix[j][k] = loopModel->userTransformMtx[j][k];
} }
} }
@ -155,7 +155,7 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
it->transformMatrix[j][k] = loopModel->transformMatrix[j][k]; it->transformMatrix[j][k] = loopModel->userTransformMtx[j][k];
} }
} }
} }
@ -167,11 +167,11 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
loopModel->transformMatrix[j][k] = it->transformMatrix[j][k]; loopModel->userTransformMtx[j][k] = it->transformMatrix[j][k];
} }
} }
loopModel->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; loopModel->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
guTranslateF(sp20, it->relativePos.x, it->relativePos.y, it->relativePos.z); guTranslateF(sp20, it->relativePos.x, it->relativePos.y, it->relativePos.z);
guRotateF(spA0, script->functionTemp[1], 0.0f, 0.0f, 1.0f); guRotateF(spA0, script->functionTemp[1], 0.0f, 0.0f, 1.0f);
guTranslateF(sp60, -it->relativePos.x, -it->relativePos.y, -it->relativePos.z); guTranslateF(sp60, -it->relativePos.x, -it->relativePos.y, -it->relativePos.z);
@ -179,9 +179,9 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) {
guMtxCatF(sp20, spA0, spA0); guMtxCatF(sp20, spA0, spA0);
guMtxCatF(spA0, sp60, sp60); guMtxCatF(spA0, sp60, sp60);
guMtxCatF(spE0, sp60, sp60); guMtxCatF(spE0, sp60, sp60);
guMtxCatF(loopModel->transformMatrix, sp60, loopModel->transformMatrix); guMtxCatF(loopModel->userTransformMtx, sp60, loopModel->userTransformMtx);
update_collider_transform(N(RotatingPlatformColliders)[i]); update_collider_transform(N(RotatingPlatformColliders)[i]);
guMtxXFMF(loopModel->transformMatrix, 0.0f, 0.0f, 0.0f, &ox, &oy, &oz); guMtxXFMF(loopModel->userTransformMtx, 0.0f, 0.0f, 0.0f, &ox, &oy, &oz);
if (gCollisionStatus.currentFloor == N(RotatingPlatformColliders)[i] || if (gCollisionStatus.currentFloor == N(RotatingPlatformColliders)[i] ||
gCollisionStatus.lastTouchedFloor == N(RotatingPlatformColliders)[i]) gCollisionStatus.lastTouchedFloor == N(RotatingPlatformColliders)[i])
{ {
@ -199,12 +199,12 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) {
it->lastRelativePos.z = oz; it->lastRelativePos.z = oz;
} }
guRotateF(axisModel->transformMatrix, script->functionTemp[1], 0.0f, 0.0f, 1.0f); guRotateF(axisModel->userTransformMtx, script->functionTemp[1], 0.0f, 0.0f, 1.0f);
axisModel->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; axisModel->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
update_collider_transform(COLLIDER_fl); update_collider_transform(COLLIDER_fl);
guRotateF(ringModel->transformMatrix, script->functionTemp[1], 0.0f, 0.0f, 1.0f); guRotateF(ringModel->userTransformMtx, script->functionTemp[1], 0.0f, 0.0f, 1.0f);
ringModel->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; ringModel->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
update_collider_transform(COLLIDER_1_0); update_collider_transform(COLLIDER_1_0);
isPounding = FALSE; isPounding = FALSE;

View File

@ -286,7 +286,7 @@ API_CALLABLE(N(func_80242538_D223C8)) {
if (isInitialCall) { if (isInitialCall) {
if (script->varTable[0] == 0) { if (script->varTable[0] == 0) {
func_8011B950(script->varTable[15], -1, FOG_MODE_1, 1); func_8011B950(script->varTable[15], CUSTOM_GFX_NONE, FOG_MODE_1, 1);
} }
script->functionTemp[0] = 0; script->functionTemp[0] = 0;
} }
@ -309,7 +309,7 @@ API_CALLABLE(N(func_80242538_D223C8)) {
if (script->functionTemp[0] >= 255) { if (script->functionTemp[0] >= 255) {
if (script->varTable[0] == 3) { if (script->varTable[0] == 3) {
func_8011B950(script->varTable[15], -1, FOG_MODE_0, 1); func_8011B950(script->varTable[15], CUSTOM_GFX_NONE, FOG_MODE_0, 1);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }

View File

@ -63,7 +63,7 @@ API_CALLABLE(N(AnimateIceShattering)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
it->transformMatrix[j][k] = model->transformMatrix[j][k]; it->transformMatrix[j][k] = model->userTransformMtx[j][k];
} }
} }
} }
@ -87,11 +87,11 @@ API_CALLABLE(N(AnimateIceShattering)) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
model->transformMatrix[j][k] = it->transformMatrix[j][k]; model->userTransformMtx[j][k] = it->transformMatrix[j][k];
} }
} }
model->flags |= MODEL_FLAG_USES_TRANSFORM_MATRIX | MODEL_FLAG_HAS_TRANSFORM_APPLIED; model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM;
guTranslateF(mtxTransform, it->pos.x - it->initialPos.x, it->pos.y - it->initialPos.y, it->pos.z - it->initialPos.z); guTranslateF(mtxTransform, it->pos.x - it->initialPos.x, it->pos.y - it->initialPos.y, it->pos.z - it->initialPos.z);
it->rot.x += it->rotVel.x; it->rot.x += it->rotVel.x;
it->rot.y += it->rotVel.y; it->rot.y += it->rotVel.y;
@ -105,7 +105,7 @@ API_CALLABLE(N(AnimateIceShattering)) {
guMtxCatF(mtxRotZ, mtxRotX, mtxRotX); guMtxCatF(mtxRotZ, mtxRotX, mtxRotX);
guMtxCatF(mtxRotX, mtxRotY, mtxRotY); guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
guMtxCatF(mtxRotY, mtxTransform, mtxTransform); guMtxCatF(mtxRotY, mtxTransform, mtxTransform);
guMtxCatF(mtxTransform, model->transformMatrix, model->transformMatrix); guMtxCatF(mtxTransform, model->userTransformMtx, model->userTransformMtx);
} }
if ((u32) script->functionTemp[1] >= ARRAY_COUNT(N(IceShardModels))) { if ((u32) script->functionTemp[1] >= ARRAY_COUNT(N(IceShardModels))) {

View File

@ -25,7 +25,7 @@ void N(worker_render_player_reflection)(void) {
if (playerStatus->flags & PS_FLAG_HAS_REFLECTION) { if (playerStatus->flags & PS_FLAG_HAS_REFLECTION) {
entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID);
entityModel->flags |= MODEL_FLAG_FLAG_200; entityModel->flags |= ENTITY_MODEL_FLAG_REFLECT;
get_screen_coords(gCurrentCamID, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z, get_screen_coords(gCurrentCamID, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z,
&screenX, &screenY, &screenZ); &screenX, &screenY, &screenZ);

View File

@ -296,7 +296,7 @@ void N(build_gfx_floor)(void) {
guScaleF(sp50, x, y, z); guScaleF(sp50, x, y, z);
guMtxCatF(sp50, sp10, sp10); guMtxCatF(sp50, sp10, sp10);
guMtxF2L(sp10, &gDisplayContext->matrixStack[gMatrixListPos]); guMtxF2L(sp10, &gDisplayContext->matrixStack[gMatrixListPos]);
mdl_project_tex_coords(1, N(shockwave_gfx), sp10, NULL); mdl_project_tex_coords(MODEL_o152, N(shockwave_gfx), sp10, NULL);
gDPPipeSync(gMainGfxPos++); gDPPipeSync(gMainGfxPos++);
gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE); gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);

View File

@ -34,7 +34,7 @@ API_CALLABLE(N(UnkFunc27)) {
if (*modelIDList == 0xFFFF) { if (*modelIDList == 0xFFFF) {
break; break;
} }
func_8011B950(*modelIDList, -1, fogType, 0); func_8011B950(*modelIDList, CUSTOM_GFX_NONE, fogType, 0);
modelIDList++; modelIDList++;
}; };
break; break;

View File

@ -387,7 +387,7 @@ EvtScript N(EVS_SetupBubbles) = {
EVT_SET(LVar0, CLONED_MODEL(5)) EVT_SET(LVar0, CLONED_MODEL(5))
EVT_EXEC(N(EVS_ManageBlownBubble)) EVT_EXEC(N(EVS_ManageBlownBubble))
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_o167, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_0, MODEL_o167, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_big_bubble)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_1, EVT_PTR(N(gfx_build_big_bubble)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o167, CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, MODEL_o167, CUSTOM_GFX_1, -1)
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(1), CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(1), CUSTOM_GFX_1, -1)
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(2), CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(2), CUSTOM_GFX_1, -1)
@ -395,7 +395,7 @@ EvtScript N(EVS_SetupBubbles) = {
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(4), CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(4), CUSTOM_GFX_1, -1)
EVT_CALL(SetModelCustomGfx, CLONED_MODEL(5), CUSTOM_GFX_1, -1) EVT_CALL(SetModelCustomGfx, CLONED_MODEL(5), CUSTOM_GFX_1, -1)
EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_o57, TRUE) EVT_CALL(MakeLocalVertexCopy, VTX_COPY_1, MODEL_o57, TRUE)
EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(gfx_build_bubble_flower)), 0) EVT_CALL(SetCustomGfxBuilders, CUSTOM_GFX_2, EVT_PTR(N(gfx_build_bubble_flower)), NULL)
EVT_CALL(SetModelCustomGfx, MODEL_o57, CUSTOM_GFX_2, -1) EVT_CALL(SetModelCustomGfx, MODEL_o57, CUSTOM_GFX_2, -1)
EVT_RETURN EVT_RETURN
EVT_END EVT_END

View File

@ -257,7 +257,7 @@ API_CALLABLE(RoomVisibilityToggleImpl) {
if (isInitialCall) { if (isInitialCall) {
if (script->varTable[0] == ROOM_VISIBILITY_SHOW) { if (script->varTable[0] == ROOM_VISIBILITY_SHOW) {
func_8011B950(script->varTable[15], -1, FOG_MODE_1, 1); func_8011B950(script->varTable[15], CUSTOM_GFX_NONE, FOG_MODE_1, 1);
} }
script->functionTemp[1] = 0; script->functionTemp[1] = 0;
} }
@ -281,7 +281,7 @@ API_CALLABLE(RoomVisibilityToggleImpl) {
if (script->functionTemp[1] >= 255) { if (script->functionTemp[1] >= 255) {
if (script->varTable[0] == ROOM_VISIBILITY_HIDE) { if (script->varTable[0] == ROOM_VISIBILITY_HIDE) {
// ROOM_DATA_MODEL_ID // ROOM_DATA_MODEL_ID
func_8011B950(script->varTable[15], -1, FOG_MODE_0, 1); func_8011B950(script->varTable[15], CUSTOM_GFX_NONE, FOG_MODE_0, 1);
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
} else { } else {

View File

@ -197,8 +197,8 @@ API_CALLABLE(func_802803C8) {
} }
API_CALLABLE(func_80280410) { API_CALLABLE(func_80280410) {
static Evt* D_80286520; static Evt* ShopInteractScript;
static s32 D_80286524; static s32 ShopInteractScriptID;
Shop* shop = gGameStatusPtr->mapShop; Shop* shop = gGameStatusPtr->mapShop;
s32 currentItemSlot = evt_get_variable(script, *script->ptrReadPos); s32 currentItemSlot = evt_get_variable(script, *script->ptrReadPos);
@ -210,7 +210,6 @@ API_CALLABLE(func_80280410) {
shop->unk_358 = 5; shop->unk_358 = 5;
if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) { if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) {
Evt* childScript; Evt* childScript;
disable_player_input(); disable_player_input();
@ -218,14 +217,14 @@ API_CALLABLE(func_80280410) {
childScript = start_script(&BadgeShopInteract, EVT_PRIORITY_1, 0); childScript = start_script(&BadgeShopInteract, EVT_PRIORITY_1, 0);
childScript->varTable[0] = currentItemSlot; childScript->varTable[0] = currentItemSlot;
D_80286520 = childScript; ShopInteractScript = childScript;
D_80286524 = childScript->id; ShopInteractScriptID = childScript->id;
shop->flags |= SHOP_FLAG_8; shop->flags |= SHOP_FLAG_8;
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} else { } else {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
} else if (does_script_exist(D_80286524)) { } else if (does_script_exist(ShopInteractScriptID)) {
return ApiStatus_BLOCK; return ApiStatus_BLOCK;
} }
@ -930,7 +929,7 @@ API_CALLABLE(MakeShop) {
gGameStatusPtr->shopItemEntities[numShopItems].pos.y = centerY; gGameStatusPtr->shopItemEntities[numShopItems].pos.y = centerY;
gGameStatusPtr->shopItemEntities[numShopItems].pos.z = centerZ; gGameStatusPtr->shopItemEntities[numShopItems].pos.z = centerZ;
model = get_model_from_list_index(get_model_list_index_from_tree_index(itemDataPositions->posModelID)); model = get_model_from_list_index(get_model_list_index_from_tree_index(itemDataPositions->posModelID));
model->flags |= MODEL_FLAG_FLAG_4; model->flags |= MODEL_FLAG_INACTIVE;
gGameStatusPtr->shopItemEntities[numShopItems].index = gGameStatusPtr->shopItemEntities[numShopItems].index =
make_item_entity_nodelay(inventory->itemID | shop->inventoryItemFlags, centerX, centerY, centerZ, 1, 0); make_item_entity_nodelay(inventory->itemID | shop->inventoryItemFlags, centerX, centerY, centerZ, 1, 0);
set_item_entity_flags(gGameStatusPtr->shopItemEntities[numShopItems].index, ITEM_ENTITY_RESIZABLE); set_item_entity_flags(gGameStatusPtr->shopItemEntities[numShopItems].index, ITEM_ENTITY_RESIZABLE);
@ -951,7 +950,7 @@ API_CALLABLE(MakeShop) {
gWindowStyles[11].defaultStyleID = WINDOW_STYLE_3; gWindowStyles[11].defaultStyleID = WINDOW_STYLE_3;
shop->currentItemSlot = 0; shop->currentItemSlot = 0;
shop->selectedStoreItemSlot = 0; shop->selectedStoreItemSlot = 0;
shop->flags = SHOP_FLAG_0; shop->flags = 0;
shop->owner = NULL; shop->owner = NULL;
return ApiStatus_DONE2; return ApiStatus_DONE2;

View File

@ -101,19 +101,31 @@ def write_ninja_rules(
command=f"{cross}ld {ld_args}", command=f"{cross}ld {ld_args}",
) )
ninja.rule(
"shape_ld",
description="link($version) shape $out",
command=f"{cross}ld -T src/map_shape.ld $in -o $out",
)
ninja.rule(
"shape_objcopy",
description="objcopy($version) shape $out",
command=f"{cross}objcopy $in $out -O binary",
)
Z64_DEBUG = "" Z64_DEBUG = ""
if debug: if debug:
Z64_DEBUG = "-gS -R .data -R .note -R .eh_frame -R .gnu.attributes -R .comment -R .options" Z64_DEBUG = " -gS -R .data -R .note -R .eh_frame -R .gnu.attributes -R .comment -R .options"
ninja.rule( ninja.rule(
"z64", "z64",
description="rom $out", description="rom $out",
command=f"{cross}objcopy $in $out -O binary {Z64_DEBUG} && {BUILD_TOOLS}/rom/n64crc $out", command=f"{cross}objcopy $in $out -O binary{Z64_DEBUG} && {BUILD_TOOLS}/rom/n64crc $out",
) )
ninja.rule( ninja.rule(
"z64_ique", "z64_ique",
description="rom $out", description="rom $out",
command=f"{cross}objcopy $in $out -O binary {Z64_DEBUG}", command=f"{cross}objcopy $in $out -O binary{Z64_DEBUG}",
) )
ninja.rule( ninja.rule(
@ -174,6 +186,12 @@ def write_ninja_rules(
command=f"{cross}ld -r -b binary $in -o $out", command=f"{cross}ld -r -b binary $in -o $out",
) )
ninja.rule(
"cp",
description="cp $in $out",
command=f"cp $in $out",
)
ninja.rule( ninja.rule(
"as", "as",
description="as $in", description="as $in",
@ -268,22 +286,24 @@ def write_ninja_rules(
"map_header", command=f"$python {BUILD_TOOLS}/mapfs/map_header.py $in > $out" "map_header", command=f"$python {BUILD_TOOLS}/mapfs/map_header.py $in > $out"
) )
ninja.rule("pm_charset", command=f"$python {BUILD_TOOLS}/pm_charset.py $out $in") ninja.rule("charset", command=f"$python {BUILD_TOOLS}/pm_charset.py $out $in")
ninja.rule( ninja.rule(
"pm_charset_palettes", "charset_palettes",
command=f"$python {BUILD_TOOLS}/pm_charset_palettes.py $out $in", command=f"$python {BUILD_TOOLS}/pm_charset_palettes.py $out $in",
) )
ninja.rule( ninja.rule(
"pm_sprite_shading_profiles", "sprite_shading_profiles",
command=f"$python {BUILD_TOOLS}/sprite/sprite_shading_profiles.py $in $out $header_path", command=f"$python {BUILD_TOOLS}/sprite/sprite_shading_profiles.py $in $out $header_path",
) )
ninja.rule( ninja.rule(
"pm_imgfx_data", command=f"$python {BUILD_TOOLS}/imgfx/imgfx_data.py $in $out" "imgfx_data", command=f"$python {BUILD_TOOLS}/imgfx/imgfx_data.py $in $out"
) )
ninja.rule("shape", command=f"$python {BUILD_TOOLS}/mapfs/shape.py $in $out")
with Path("tools/permuter_settings.toml").open("w") as f: with Path("tools/permuter_settings.toml").open("w") as f:
f.write( f.write(
f"compiler_command = \"{cc} {CPPFLAGS.replace('$version', 'pal')} {cflags} -DPERMUTER -fforce-addr\"\n" f"compiler_command = \"{cc} {CPPFLAGS.replace('$version', 'pal')} {cflags} -DPERMUTER -fforce-addr\"\n"
@ -444,6 +464,7 @@ class Configure:
skip_outputs: Set[str], skip_outputs: Set[str],
non_matching: bool, non_matching: bool,
modern_gcc: bool, modern_gcc: bool,
c_maps: bool = False,
): ):
import segtypes import segtypes
import segtypes.common.c import segtypes.common.c
@ -906,7 +927,6 @@ class Configure:
build(bin_path, imgs, "pack_title_data") build(bin_path, imgs, "pack_title_data")
elif name.endswith("_bg"): elif name.endswith("_bg"):
compress = True compress = True
bin_path = self.build_path() / bin_path
build( build(
bin_path, bin_path,
[path], [path],
@ -929,34 +949,39 @@ class Configure:
}, },
asset_deps=[f"mapfs/tex/{name}"], asset_deps=[f"mapfs/tex/{name}"],
) )
elif name.endswith("_shape"): elif name.endswith("_shape_built"):
map_name = "_".join(name.split("_")[:-1]) base_name = name[:-6]
raw_bin_path = self.resolve_asset_path(
# Handle map XML files, if they exist (TODO: have splat output these) f"assets/x/mapfs/geom/{base_name}.bin"
map_xml = self.resolve_asset_path(
Path(f"assets/{self.version}")
/ seg.dir
/ seg.name
/ (map_name + ".xml")
) )
if map_xml.exists(): bin_path = bin_path.parent / "geom" / (base_name + ".bin")
# Build a header file for this map
build(
self.build_path()
/ "include"
/ seg.dir
/ seg.name
/ (map_name + ".h"),
[map_xml],
"map_header",
)
# NOTE: we don't build the map xml into a _shape or _hit file (yet); the Star Rod Map Editor if c_maps:
# is able to build the xml nonmatchingly into assets/star_rod_build/mapfs/*.bin for people # raw bin -> c -> o -> elf -> objcopy -> final bin file
# who want that (i.e. modders). 'star_rod_build' should be added to asset_stack also. c_file_path = (
bin_path.parent / "geom" / base_name
).with_suffix(".c")
o_path = bin_path.parent / "geom" / (base_name + ".o")
elf_path = bin_path.parent / "geom" / (base_name + ".elf")
build(c_file_path, [raw_bin_path], "shape")
build(
o_path,
[c_file_path],
"cc" if not modern_gcc else "cc_modern",
variables={
"cflags": "",
"cppflags": f"-DVERSION_{self.version.upper()}",
"encoding": "CP932", # similar to SHIFT-JIS, but includes backslash and tilde
},
)
build(elf_path, [o_path], "shape_ld")
build(bin_path, [elf_path], "shape_objcopy")
else:
build(bin_path, [raw_bin_path], "cp")
compress = True compress = True
bin_path = path out_dir = out_dir / "geom"
else: else:
compress = True compress = True
bin_path = path bin_path = path
@ -994,7 +1019,7 @@ class Configure:
) )
rasters.append(out_path) rasters.append(out_path)
build(entry.object_path.with_suffix(""), rasters, "pm_charset") build(entry.object_path.with_suffix(""), rasters, "charset")
build(entry.object_path, [entry.object_path.with_suffix("")], "bin") build(entry.object_path, [entry.object_path.with_suffix("")], "bin")
elif seg.type == "pm_charset_palettes": elif seg.type == "pm_charset_palettes":
palettes = [] palettes = []
@ -1018,9 +1043,7 @@ class Configure:
) )
palettes.append(out_path) palettes.append(out_path)
build( build(entry.object_path.with_suffix(""), palettes, "charset_palettes")
entry.object_path.with_suffix(""), palettes, "pm_charset_palettes"
)
build(entry.object_path, [entry.object_path.with_suffix("")], "bin") build(entry.object_path, [entry.object_path.with_suffix("")], "bin")
elif seg.type == "pm_sprite_shading_profiles": elif seg.type == "pm_sprite_shading_profiles":
header_path = str( header_path = str(
@ -1029,7 +1052,7 @@ class Configure:
build( build(
entry.object_path.with_suffix(""), entry.object_path.with_suffix(""),
entry.src_paths, entry.src_paths,
"pm_sprite_shading_profiles", "sprite_shading_profiles",
implicit_outputs=[header_path], implicit_outputs=[header_path],
variables={ variables={
"header_path": header_path, "header_path": header_path,
@ -1040,7 +1063,7 @@ class Configure:
c_file_path = ( c_file_path = (
Path(f"assets/{self.version}") / "imgfx" / (seg.name + ".c") Path(f"assets/{self.version}") / "imgfx" / (seg.name + ".c")
) )
build(c_file_path, entry.src_paths, "pm_imgfx_data") build(c_file_path, entry.src_paths, "imgfx_data")
build( build(
entry.object_path, entry.object_path,
@ -1163,6 +1186,11 @@ if __name__ == "__main__":
help="Use modern GCC instead of the original compiler", help="Use modern GCC instead of the original compiler",
) )
parser.add_argument("--ccache", action="store_true", help="Use ccache") parser.add_argument("--ccache", action="store_true", help="Use ccache")
parser.add_argument(
"--c-maps",
action="store_true",
help="Convert map binaries to C as part of the build process",
)
args = parser.parse_args() args = parser.parse_args()
exec_shell(["make", "-C", str(ROOT / args.splat)]) exec_shell(["make", "-C", str(ROOT / args.splat)])
@ -1296,7 +1324,9 @@ if __name__ == "__main__":
configure.split( configure.split(
not args.no_split_assets, args.split_code, args.shift, args.debug not args.no_split_assets, args.split_code, args.shift, args.debug
) )
configure.write_ninja(ninja, skip_files, non_matching, args.modern_gcc) configure.write_ninja(
ninja, skip_files, non_matching, args.modern_gcc, args.c_maps
)
all_rom_oks.append(str(configure.rom_ok_path())) all_rom_oks.append(str(configure.rom_ok_path()))

715
tools/build/mapfs/shape.py Executable file
View File

@ -0,0 +1,715 @@
import argparse
from pathlib import Path
import struct
from abc import ABC
from collections import deque
from io import TextIOWrapper
from typing import List, Dict, Optional
BASE_ADDR = 0x80210000
NODE_TYPE_ROOT = 7
NODE_TYPE_MODEL = 2
NODE_TYPE_GROUP = 5
NODE_TYPE_SPECIAL_GROUP = 10
GFX_LOAD_VTX = 0x01
GFX_DRAW_TRI = 0x05
GFX_DRAW_TRIS = 0x06
GFX_RDP_PIPE_SYNC = 0xE7
GFX_POP_MATRIX = 0xD8
GFX_GEOMETRYMODE = 0xD9
GFX_LOAD_MATRIX = 0xDA
GFX_START_DL = 0xDE
GFX_END_DL = 0xDF
ALIGN_16 = "__attribute__ ((aligned (16))) "
def read_ascii_string(bytes: bytearray, addr: int) -> str:
start = addr - BASE_ADDR
length = 0
for char in bytes[start:]:
if char == 0:
break
length += 1
return bytes[start : start + length].decode("ascii")
def get_shape_type_name(id: int) -> str:
if id == NODE_TYPE_ROOT:
return "SHAPE_TYPE_ROOT"
elif id == NODE_TYPE_MODEL:
return "SHAPE_TYPE_MODEL"
elif id == NODE_TYPE_GROUP:
return "SHAPE_TYPE_GROUP"
elif id == NODE_TYPE_SPECIAL_GROUP:
return "SHAPE_TYPE_SPECIAL_GROUP"
raise Exception(f"Unknown shape type {id}")
class Segment(ABC):
def __init__(self, addr: int, name: str):
self.addr = addr
self.name = name
self.count = 0
self.model_name = ""
def get_sym(self) -> str:
if self.model_name != "":
return f"N({self.name}_{self.model_name})"
else:
return f"N({self.name})"
def __str__(self):
return str(self.__class__.__name__[:-7]) + " " + self.get_sym()
def scan(self, shape):
pass
def print(self, shape):
shape.print(hex(self.addr) + " : " + str(self))
class HeaderSegment(Segment):
def __init__(self, addr: int, name: str):
super().__init__(addr, name)
def scan(self, shape):
start = self.addr - BASE_ADDR
(
self.ptr_root_node,
self.ptr_vtx_table,
self.ptr_model_names,
self.ptr_collider_names,
self.ptr_zone_names,
) = struct.unpack(">IIIII", shape.file_bytes[start : start + 20])
# note: do not push model root yet
shape.root_node = NodeSegment(self.ptr_root_node, "Node")
shape.vtx_table = shape.push(
VertexTableSegment(self.ptr_vtx_table, "VertexTable")
)
shape.model_names = shape.push(
StringListSegment(self.ptr_model_names, "ModelNames")
)
shape.collider_names = shape.push(
StringListSegment(self.ptr_collider_names, "ColliderNames")
)
shape.zone_names = shape.push(
StringListSegment(self.ptr_zone_names, "ZoneNames")
)
def print(self, shape):
shape.print(f"ShapeFileHeader {self.get_sym()} = {{")
shape.print(f" .root = &{shape.get_symbol(self.ptr_root_node)},")
shape.print(f" .vertexTable = {shape.get_symbol(self.ptr_vtx_table)},")
shape.print(f" .modelNames = {shape.get_symbol(self.ptr_model_names)},")
shape.print(
f" .colliderNames = {shape.get_symbol(self.ptr_collider_names)},"
)
if self.ptr_zone_names != 0:
shape.print(f" .zoneNames = {shape.get_symbol(self.ptr_zone_names)},")
shape.print("};")
class VertexTableSegment(Segment):
def __init__(self, addr: int, name: str):
super().__init__(addr, name)
def print(self, shape):
pos = self.addr - BASE_ADDR
shape.print(f"Vtx_t {self.get_sym()}[] = {{")
for idx in range(self.count):
(
x,
y,
z,
flag,
u,
v,
r,
g,
b,
a,
) = struct.unpack(">hhhhhhBBBB", shape.file_bytes[pos : pos + 16])
pos += 16
shape.print(
f" {{{{ {x:4}, {y:4}, {z:4} }}, {flag}, {{ {u:6}, {v:6} }}, {{ {r:3}, {g:3}, {b:3}, {a:3} }}}},"
)
shape.print("};")
class VectorListSegment(Segment):
def __init__(self, addr: int, name: str):
super().__init__(addr, name)
def print(self, shape):
next = shape.get_segment_after(self)
pos = self.addr - BASE_ADDR
end = next.addr - BASE_ADDR
count = (end - pos) // 12
shape.print(f"Vec3f {self.get_sym()}[] = {{")
for _ in range(count):
(x, y, z) = struct.unpack(">fff", shape.file_bytes[pos : pos + 12])
pos += 12
shape.print(f" {{ {x}, {y}, {z} }},")
shape.print("};")
class StringListSegment(Segment):
def __init__(self, addr: int, name: str):
super().__init__(addr, name)
self.list: deque
def scan(self, shape):
self.list = deque()
pos = self.addr - BASE_ADDR
while True:
(ptr_str,) = struct.unpack(">I", shape.file_bytes[pos : pos + 4])
pos += 4
string = read_ascii_string(shape.file_bytes, ptr_str)
if string == "db":
break
self.list.append(string)
def print(self, shape):
align_attribute = ""
if self.name == "ModelNames":
align_attribute = ALIGN_16
shape.print(f"{align_attribute}char* {self.get_sym()}[] = {{")
for name in self.list:
shape.print(f' "{name}",')
shape.print(' "db",')
shape.print("};")
class NodeSegment(Segment):
def __init__(self, addr: int, name: str):
super().__init__(addr, name)
def scan(self, shape):
pos = self.addr - BASE_ADDR
(
self.node_type,
self.ptr_display_data,
self.num_properties,
self.ptr_property_list,
self.ptr_group_data,
) = struct.unpack(">IIIII", shape.file_bytes[pos : pos + 20])
self.model_name = shape.model_name_map[self.addr]
shape.push(GroupDataSegment(self.ptr_group_data, "GroupData", self.model_name))
shape.push(
DisplayDataSegment(self.ptr_display_data, "DisplayData", self.model_name)
)
shape.push(
PropertyListSegment(
self.ptr_property_list,
"Properties",
self.model_name,
self.num_properties,
)
)
def print(self, shape):
shape.print(f"ModelNode {self.get_sym()} = {{")
shape.print(f" .type = {get_shape_type_name(self.node_type)},")
if self.ptr_group_data != 0:
shape.print(f" .groupData = &{shape.get_symbol(self.ptr_group_data)},")
shape.print(f" .displayData = &{shape.get_symbol(self.ptr_display_data)},")
shape.print(f" .propertyList = {shape.get_symbol(self.ptr_property_list)},")
shape.print(f" .numProperties = {self.num_properties},")
shape.print("};")
class NodeListSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str, num_children: int):
super().__init__(addr, name)
self.model_name = model_name
self.count = num_children
self.children: List[NodeSegment] = []
def scan(self, shape):
pos = self.addr - BASE_ADDR
for _ in range(self.count):
(ptr_child,) = struct.unpack(">I", shape.file_bytes[pos : pos + 4])
pos += 4
self.children.append(ptr_child)
shape.push(NodeSegment(ptr_child, "Node"))
def print(self, shape):
shape.print(f"ModelNode* {self.get_sym()}[] = {{")
for addr in self.children:
shape.print(f" &{shape.get_symbol(addr)},")
shape.print("};")
class PropertyListSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str, count: int):
super().__init__(addr, name)
self.model_name = model_name
self.count = count
def print(self, shape):
pos = self.addr - BASE_ADDR
shape.print(f"ModelNodeProperty {self.get_sym()}[] = {{")
for _ in range(self.count):
(
key,
fmt,
value,
) = struct.unpack(">III", shape.file_bytes[pos : pos + 12])
pos += 12
if key == 0x5E:
if value == 0:
shape.print(
f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = NULL }}}},"
)
else:
tex_name = read_ascii_string(shape.file_bytes, value)
shape.print(
f' {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = "{tex_name}" }}}},'
)
elif key == 0x5F:
shape.print(
f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .s = {hex(value)} }}}},"
)
else:
if fmt == 0: # int
shape.print(
f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .s = {hex(value)} }}}},"
)
elif fmt == 1: # float
temp = struct.pack(">I", value)
(f,) = struct.unpack(">f", temp)
shape.print(
f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .f = {f} }}}},"
)
elif fmt == 2: # pointer
shape.print(
f' {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = "{shape.get_symbol(value)}" }}}},'
)
else:
raise Exception(
f"Invalid property: 0x{key:08X} 0x{fmt:08X} 0x{value:08X}"
)
shape.print("};")
class GroupDataSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str):
super().__init__(addr, name)
self.model_name = model_name
def scan(self, shape):
start = self.addr - BASE_ADDR
(
self.ptr_transform_mtx,
self.ptr_lights,
self.num_lights,
self.num_children,
self.ptr_children,
) = struct.unpack(">IIIII", shape.file_bytes[start : start + 20])
shape.push(
NodeListSegment(
self.ptr_children, "Children", self.model_name, self.num_children
)
)
shape.push(
LightSetSegment(self.ptr_lights, "Lights", self.model_name, self.num_lights)
)
shape.push(MatrixSegment(self.ptr_transform_mtx, "Mtx", self.model_name))
def print(self, shape):
shape.print(f"ModelGroupData {self.get_sym()} = {{")
if self.ptr_transform_mtx != 0:
shape.print(
f" .transformMatrix = (Mtx*) &{shape.get_symbol(self.ptr_transform_mtx)},"
)
shape.print(
f" .lightingGroup = (Lightsn*) &{shape.get_symbol(self.ptr_lights)},"
)
shape.print(f" .numLights = {self.num_lights},")
shape.print(f" .childList = {shape.get_symbol(self.ptr_children)},")
shape.print(f" .numChildren = {self.num_children},")
shape.print("};")
class LightSetSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str, count: int):
super().__init__(addr, name)
self.model_name = model_name
self.count = count
def print(self, shape):
next = shape.get_segment_after(self)
pos = self.addr - BASE_ADDR
end = next.addr - BASE_ADDR
shape.print(f"// num: {self.count}")
shape.print(f"s32 {self.get_sym()}[] = {{")
while pos < end:
(v,) = struct.unpack(">I", shape.file_bytes[pos : pos + 4])
pos += 4
shape.print(f" 0x{v:08X},")
shape.print("};")
class MatrixSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str):
super().__init__(addr, name)
self.model_name = model_name
def print(self, shape):
pos = self.addr - BASE_ADDR
shape.print(f"Matrix4s {self.get_sym()} = {{")
shape.print(" .whole = {")
for i in range(4):
(a, b, c, d) = struct.unpack(">hhhh", shape.file_bytes[pos : pos + 8])
pos += 8
shape.print(
f" {{ {hex(a):4}, {hex(b):4}, {hex(c):4}, {hex(d):4} }},"
)
shape.print(" },")
shape.print(" .frac = {")
for i in range(4):
(a, b, c, d) = struct.unpack(">hhhh", shape.file_bytes[pos : pos + 8])
pos += 8
shape.print(
f" {{ {hex(a):4}, {hex(b):4}, {hex(c):4}, {hex(d):4} }},"
)
shape.print(" },")
shape.print("};")
class DisplayDataSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str):
super().__init__(addr, name)
self.model_name = model_name
def scan(self, shape):
start = self.addr - BASE_ADDR
(self.ptr_display_list,) = struct.unpack(
">I", shape.file_bytes[start : start + 4]
)
gfx_segment = shape.push(
DisplayListSegment(self.ptr_display_list, "Gfx", self.model_name)
)
# Gfx segments may have been already visited during root Gfx traversal
# so we will now force the associated model name to be the current model
gfx_segment.model_name = self.model_name
def print(self, shape):
start = self.addr - BASE_ADDR
shape.print(f"ModelDisplayData {self.get_sym()} = {{")
shape.print(f" .displayList = {shape.get_symbol(self.ptr_display_list)},")
shape.print("};")
class DisplayListSegment(Segment):
def __init__(self, addr: int, name: str, model_name: str):
super().__init__(addr, name)
self.model_name = model_name
def scan(self, shape):
pos = self.addr - BASE_ADDR
while True:
(w1, w2) = struct.unpack(">II", shape.file_bytes[pos : pos + 8])
pos += 8
op = w1 >> 24
if op == GFX_END_DL:
break
elif op == GFX_START_DL:
shape.push(
DisplayListSegment(
w2, f"Gfx_{hex(w2)[2:].upper()}", self.model_name
)
)
elif op == GFX_LOAD_MATRIX:
shape.push(
MatrixSegment(w2, f"Mtx_{hex(w2)[2:]}", model_name=self.model_name)
)
elif op == GFX_LOAD_VTX:
num = (w1 >> 12) & 0xFFF
idx = (w2 - shape.vtx_table.addr) // 0x10
if shape.vtx_table.count < idx + num:
shape.vtx_table.count = idx + num
def get_geometry_flags(self, bits: int) -> str:
flags = []
if (bits & 0x00000400) != 0:
flags.append("G_CULL_BACK")
if (bits & 0x00020000) != 0:
flags.append("G_LIGHTING")
if (bits & 0x00200000) != 0:
flags.append("G_SHADING_SMOOTH")
return " | ".join(flags)
def print(self, shape):
pos = self.addr - BASE_ADDR
shape.print(f"Gfx {self.get_sym()}[] = {{")
while True:
(w1, w2) = struct.unpack(">II", shape.file_bytes[pos : pos + 8])
pos += 8
op = w1 >> 24
if op == GFX_LOAD_VTX:
num = (w1 >> 12) & 0x00000FFF
end = (w1 & 0x00000FFF) // 2
buf_pos = end - num
index = (w2 - shape.vtx_table.addr) // 0x10
shape.print(
f" gsSPVertex(&{shape.vtx_table.get_sym()}[{index}], {num}, {buf_pos}),"
)
elif op == GFX_DRAW_TRI:
i = (w1 & 0x00FF0000) >> 16
j = (w1 & 0x0000FF00) >> 8
k = w1 & 0x000000FF
shape.print(f" gsSP1Triangle({i // 2}, {j // 2}, {k // 2}, 0),")
elif op == GFX_DRAW_TRIS:
a = (w1 & 0x00FF0000) >> 16
b = (w1 & 0x0000FF00) >> 8
c = w1 & 0x000000FF
d = (w2 & 0x00FF0000) >> 16
e = (w2 & 0x0000FF00) >> 8
f = w2 & 0x000000FF
shape.print(
f" gsSP2Triangles({a // 2}, {b // 2}, {c // 2}, 0, {d // 2}, {e // 2}, {f // 2}, 0),"
)
elif op == GFX_RDP_PIPE_SYNC:
shape.print(" gsDPPipeSync(),")
elif op == GFX_POP_MATRIX:
shape.print(" gsSPPopMatrix(G_MTX_MODELVIEW),")
elif op == GFX_GEOMETRYMODE:
if w1 == 0xD9FFFFFF:
flags = self.get_geometry_flags(w2)
shape.print(f" gsSPSetGeometryMode({flags}),")
else:
flags = self.get_geometry_flags(~(w1 | 0xFF000000))
shape.print(f" gsSPClearGeometryMode({flags}),")
elif op == GFX_LOAD_MATRIX:
shape.print(
f" gsSPMatrix(&{shape.get_symbol(w2)}, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),"
)
elif op == GFX_START_DL:
shape.print(f" gsSPDisplayList({shape.get_symbol(w2)}),")
elif op == GFX_END_DL:
shape.print(" gsSPEndDisplayList(),")
break
shape.print("};")
if self.model_name == "root":
next = shape.get_segment_after(self)
end = next.addr - BASE_ADDR
shape.print(f"\ns32 N(PostGfxPad)[] = {{")
while pos < end:
(v,) = struct.unpack(">I", shape.file_bytes[pos : pos + 4])
pos += 4
shape.print(f" 0x{v:08X},")
shape.print("};")
class ShapeFile:
def __init__(self, map_name: str, file_bytes: bytes):
self.map_name = map_name
self.file_bytes = file_bytes
self.out_file: TextIOWrapper
self.pending: List[Segment] = []
self.visited: Dict[int, Segment] = {}
self.model_name_map: Dict[int, str] = {}
self.root_node: Optional[Segment] = None
self.vtx_table: Optional[Segment] = None
self.model_names: Optional[StringListSegment] = None
self.collider_names: Optional[Segment] = None
self.zone_names: Optional[Segment] = None
def push(self, segment: Segment):
if segment.addr == 0:
return None
if segment.addr in self.visited:
return self.visited[segment.addr]
self.pending.append(segment)
self.visited[segment.addr] = segment
return segment
def get_symbol(self, addr) -> str:
if not addr in self.visited:
raise Exception(f"Encountered unknown pointer: {hex(addr)}")
return self.visited[addr].get_sym()
def print(self, string: str):
if self.out_file != None:
self.out_file.write(string + "\n")
else:
print(string)
# traverse the model tree and create a mapping from addr -> name which we will use during the second scan pass
def build_model_name_map(self, node_addr: int, names: deque):
node_start = node_addr - BASE_ADDR
(
node_type,
ptr_display_list,
num_properties,
ptr_property_list,
ptr_group_data,
) = struct.unpack(">IIIII", self.file_bytes[node_start : node_start + 20])
if node_type == NODE_TYPE_MODEL:
# set name for this model node
self.model_name_map[node_addr] = names.pop()
return
group_start = ptr_group_data - BASE_ADDR
(
ptr_transform_mtx,
ptr_lights,
num_lights,
num_children,
ptr_children,
) = struct.unpack(">IIIII", self.file_bytes[group_start : group_start + 20])
child_start = ptr_children - BASE_ADDR
for i in range(num_children):
(ptr_child,) = struct.unpack(
">I", self.file_bytes[child_start : child_start + 4]
)
self.build_model_name_map(ptr_child, names)
child_start += 4
# set name for this group node
if node_type == NODE_TYPE_ROOT:
self.model_name_map[node_addr] = "root"
else:
self.model_name_map[node_addr] = names.pop()
def print_prologue(self, segments):
assert self.root_node is not None
assert self.vtx_table is not None
assert self.model_names is not None
assert self.collider_names is not None
self.print('#include "common.h"')
self.print('#include "model.h"')
self.print("")
self.print(f"#define NAMESPACE {self.map_name}_shape")
self.print("")
self.print(f"extern ModelNode {self.root_node.get_sym()};")
self.print(f"extern Vtx_t {self.vtx_table.get_sym()}[];")
self.print(f"extern char* {self.model_names.get_sym()}[];")
self.print(f"extern char* {self.collider_names.get_sym()}[];")
if self.zone_names is not None:
self.print(f"extern char* {self.zone_names.get_sym()}[];")
for segment in segments:
if isinstance(segment, MatrixSegment):
self.print(f"extern Matrix4s {segment.get_sym()};")
self.print("")
def digest(self):
# first pass just scans the header and string lists
self.push(HeaderSegment(BASE_ADDR, "Header"))
while len(self.pending) > 0:
segment = self.pending.pop()
segment.scan(self)
assert self.model_names is not None
assert self.root_node is not None
# traverse the model tree to create initial name map
model_names = deque(self.model_names.list)
model_names.reverse()
self.build_model_name_map(self.root_node.addr, model_names)
# second pass scans the model tree and subordinate data structures
self.push(self.root_node)
self.push(VectorListSegment(self.root_node.addr + 0x14, "UnknownVectors"))
while len(self.pending) > 0:
segment = self.pending.pop()
segment.scan(self)
# create a sorted segment map
segment_addrs = list(self.visited.keys())
segment_addrs.sort()
self.sorted_segments = {i: self.visited[i] for i in segment_addrs}
def get_segment_after(self, seg: Segment) -> Optional[Segment]:
keys = list(self.sorted_segments.keys())
idx = keys.index(seg.addr)
if idx + 1 < len(keys):
next_addr = keys[idx + 1]
ret = self.sorted_segments[next_addr]
else:
ret = None
return ret
def write_to_c(self, out_file):
self.out_file = out_file
self.print_prologue(self.sorted_segments.values())
for addr, seg in self.sorted_segments.items():
self.print(f"// {hex(seg.addr - BASE_ADDR)}")
seg.print(self)
self.print("")
def run(in_bin: Path, out: Path) -> None:
map_name = "_".join(in_bin.stem.split("_")[:-1])
with open(in_bin, "rb") as f:
file_bytes = f.read()
shape = ShapeFile(map_name, file_bytes)
shape.digest()
with open(out, "w") as out_file:
shape.write_to_c(out_file)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("in_bin", type=Path, help="input binary file")
parser.add_argument("out_c", type=Path, help="output text file")
args = parser.parse_args()
run(args.in_bin, args.out_c)

28
tools/compare_shapes.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import filecmp
import os
from pathlib import Path
total = 0
matching = 0
for root, dirs, files in os.walk("assets/us/mapfs/geom"):
for file in files:
if file.endswith("_shape.bin"):
total += 1
shape_file = os.path.join(root, file)
built_data_file = Path("ver/us/build") / shape_file.replace(
"_shape.bin", "_shape_data.bin"
)
if filecmp.cmp(shape_file, built_data_file, shallow=False):
matching += 1
else:
if total - matching == 10:
print("...")
if total - matching < 10:
print(file, "X")
print()
print(f"{matching} of {total} files match")

View File

@ -50,13 +50,17 @@ def parse_palette(data):
return palette return palette
def add_file_ext(name: str) -> str: def add_file_ext(name: str, linker: bool = False) -> str:
if name.startswith("party_"): if name.startswith("party_"):
return "party/" + name + ".png" return "party/" + name + ".png"
elif name.endswith("_hit") or name.endswith("_shape"): elif name.endswith("_hit"):
return "geom/" + name + ".bin" # TODO: xml return "geom/" + name + ".bin"
elif name.endswith("_shape"):
if linker:
name += "_built"
return "geom/" + name + ".bin"
elif name.endswith("_tex"): elif name.endswith("_tex"):
return "tex/" + name + ".bin" # TODO: texture archive return "tex/" + name + ".bin"
elif name.endswith("_bg"): elif name.endswith("_bg"):
return "bg/" + name + ".png" return "bg/" + name + ".png"
else: else:
@ -228,7 +232,7 @@ class N64SegPm_map_data(N64Segment):
return [ return [
LinkerEntry( LinkerEntry(
self, self,
[fs_dir / add_file_ext(name) for name in self.files], [fs_dir / add_file_ext(name, linker=True) for name in self.files],
fs_dir.with_suffix(".dat"), fs_dir.with_suffix(".dat"),
".data", ".data",
), ),

View File

@ -2,6 +2,7 @@
import struct import struct
import sys import sys
import re
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from dataclasses import dataclass, field from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
@ -99,6 +100,31 @@ SPECIAL_RASTER = 0x1F880
LIST_END_BYTES = b"\xFF\xFF\xFF\xFF" LIST_END_BYTES = b"\xFF\xFF\xFF\xFF"
def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i
def pretty_print_xml(tree : ET.ElementTree, path : Path):
root = tree.getroot()
indent(root)
xml_str = ET.tostring(root, encoding="unicode")
xml_str = re.sub(" />", "/>", xml_str)
with open(path, "w") as f:
f.write(xml_str)
@dataclass @dataclass
class RasterTableEntry: class RasterTableEntry:
offset: int offset: int
@ -319,12 +345,7 @@ def write_player_metadata(
) )
xml = ET.ElementTree(Names) xml = ET.ElementTree(Names)
pretty_print_xml(xml, out_path / PLAYER_SPRITE_MEDADATA_XML_FILENAME)
# pretty print (Python 3.9+)
if hasattr(ET, "indent"):
ET.indent(xml, " ")
xml.write(str(out_path / PLAYER_SPRITE_MEDADATA_XML_FILENAME), encoding="unicode")
def write_npc_metadata( def write_npc_metadata(
@ -342,12 +363,7 @@ def write_npc_metadata(
) )
xml = ET.ElementTree(Names) xml = ET.ElementTree(Names)
pretty_print_xml(xml, out_path / NPC_SPRITE_MEDADATA_XML_FILENAME)
# pretty print (Python 3.9+)
if hasattr(ET, "indent"):
ET.indent(xml, " ")
xml.write(str(out_path / NPC_SPRITE_MEDADATA_XML_FILENAME), encoding="unicode")
def write_player_xmls( def write_player_xmls(
@ -472,12 +488,7 @@ def write_player_xmls(
) )
xml = ET.ElementTree(SpriteSheet) xml = ET.ElementTree(SpriteSheet)
pretty_print_xml(xml, out_path / f"{cur_sprite_name}.xml")
# pretty print (Python 3.9+)
if hasattr(ET, "indent"):
ET.indent(xml, " ")
xml.write(str(out_path / f"{cur_sprite_name}.xml"), encoding="unicode")
if has_back: if has_back:
sprite_idx += 2 sprite_idx += 2
@ -721,12 +732,7 @@ class NpcSprite:
) )
xml = ET.ElementTree(SpriteSheet) xml = ET.ElementTree(SpriteSheet)
pretty_print_xml(xml, path / "SpriteSheet.xml")
# pretty print (Python 3.9+)
if hasattr(ET, "indent"):
ET.indent(xml, " ")
xml.write(str(path / "SpriteSheet.xml"), encoding="unicode")
class N64SegPm_sprites(N64Segment): class N64SegPm_sprites(N64Segment):

View File

@ -3,6 +3,19 @@ from itertools import zip_longest
import struct import struct
from typing import Dict, List from typing import Dict, List
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from enum import IntEnum
class CMD(IntEnum):
WAIT = 0
SET_IMG = 1
GOTO = 2
SET_POS = 3
SET_ROT = 4
SET_SCALE = 5
SET_PAL = 6
LOOP = 7
SET_META = 8
def iter_in_groups(iterable, n, fillvalue=None): def iter_in_groups(iterable, n, fillvalue=None):
@ -30,6 +43,16 @@ class Animation:
raise NotImplementedError() raise NotImplementedError()
@dataclass
class Label(Animation):
lbl_name: str
def get_attributes(self):
return {
"name": str(self.lbl_name),
}
@dataclass @dataclass
class Wait(Animation): class Wait(Animation):
duration: int duration: int
@ -62,24 +85,37 @@ class SetPalette(Animation):
@dataclass @dataclass
class Goto(Animation): class Goto(Animation):
dest: str
pos: int pos: int
def get_attributes(self): def get_attributes(self):
return { if self.pos != 0:
"pos": str(self.pos), return {
} "pos": str(self.pos),
}
else:
return {
"dest": str(self.dest),
}
@dataclass @dataclass
class Loop(Animation): class Loop(Animation):
count: int count: int
dest: str
pos: int pos: int
def get_attributes(self): def get_attributes(self):
return { if self.pos != 0:
"count": str(self.count), return {
"pos": str(self.pos), "count": str(self.count),
} "pos": str(self.pos),
}
else:
return {
"count": str(self.count),
"dest": str(self.dest),
}
@dataclass @dataclass
@ -181,62 +217,105 @@ class AnimComponent:
def size(self): def size(self):
return len(self.commands) return len(self.commands)
@staticmethod @staticmethod
def parse_commands(command_list: List[int]) -> List[Animation]: def parse_commands(command_list: List[int]) -> List[Animation]:
ret: List[Animation] = [] ret: List[Animation] = []
labels = {}
boundaries = []
labels[0] = "Start"
i = 0
while i < len(command_list):
boundaries.append(i)
cmd_start = command_list[i]
cmd_op = cmd_start >> 12
cmd_arg = cmd_start & 0xFFF
if cmd_op == CMD.GOTO:
dest = cmd_arg
if dest in boundaries and dest not in labels:
labels[dest] = f"Pos_{dest}"
elif cmd_op == CMD.SET_POS:
i += 3
elif cmd_op == CMD.SET_ROT:
i += 2
elif cmd_op == CMD.SET_SCALE:
i += 1
elif cmd_op == CMD.LOOP:
dest = command_list[i + 1]
if dest in boundaries and dest not in labels:
labels[dest] = f"Pos_{dest}"
i += 1
i += 1
def to_signed(value): def to_signed(value):
return -(value & 0x8000) | (value & 0x7FFF) return -(value & 0x8000) | (value & 0x7FFF)
i = 0 i = 0
while i < len(command_list): while i < len(command_list):
cmd_start = command_list[i] cmd_start = command_list[i]
cmd_op = cmd_start >> 12
cmd_arg = cmd_start & 0xFFF
if cmd_start <= 0xFFF: if i in labels:
ret.append(Label(labels[i]))
if cmd_op == CMD.WAIT:
ret.append(Wait(cmd_start)) ret.append(Wait(cmd_start))
elif cmd_start <= 0x1FFF: elif cmd_op == CMD.SET_IMG:
raster = cmd_start % 0x1000 raster = cmd_arg
if raster == 0xFFF: if raster == 0xFFF:
raster = -1 raster = -1
ret.append(SetRaster(raster)) ret.append(SetRaster(raster))
elif cmd_start <= 0x2FFF: elif cmd_op == CMD.GOTO:
ret.append(Goto(cmd_start % 0x2000)) dest = cmd_arg
elif cmd_start <= 0x3FFF: if dest in labels:
flag = cmd_start % 0x3000 lbl_name = labels[dest]
ret.append(Goto(lbl_name, 0))
else:
ret.append(Goto(None, dest))
elif cmd_op == CMD.SET_POS:
flag = cmd_arg
x, y, z = command_list[i + 1 : i + 4] x, y, z = command_list[i + 1 : i + 4]
x = to_signed(x) x = to_signed(x)
y = to_signed(y) y = to_signed(y)
z = to_signed(z) z = to_signed(z)
i += 3 i += 3
ret.append(SetPos(flag, x, y, z)) ret.append(SetPos(flag, x, y, z))
elif cmd_start <= 0x4FFF: elif cmd_op == CMD.SET_ROT:
x, y, z = command_list[i : i + 3] x, y, z = command_list[i : i + 3]
x = ((x % 0x4000) << 20) >> 20 x = (cmd_arg << 20) >> 20
y = to_signed(y) y = to_signed(y)
z = to_signed(z) z = to_signed(z)
i += 2 i += 2
ret.append(SetRot(x, y, z)) ret.append(SetRot(x, y, z))
elif cmd_start <= 0x5FFF: elif cmd_op == CMD.SET_SCALE:
mode = cmd_start % 0x5000 mode = cmd_arg
percent = command_list[i + 1] percent = command_list[i + 1]
i += 1 i += 1
ret.append(SetScale(mode, percent)) ret.append(SetScale(mode, percent))
elif cmd_start <= 0x6FFF: elif cmd_op == CMD.SET_PAL:
palette = cmd_start % 0x6000 palette = cmd_arg
if palette == 0xFFF: if palette == 0xFFF:
palette = -1 palette = -1
ret.append(SetPalette(palette)) ret.append(SetPalette(palette))
elif cmd_start <= 0x7FFF: elif cmd_op == CMD.LOOP:
count = cmd_start % 0x7000 count = cmd_arg
pos = command_list[i + 1] dest = command_list[i + 1]
if dest in labels:
lbl_name = labels[dest]
ret.append(Loop(count, lbl_name, 0))
else:
ret.append(Loop(count, None, dest))
i += 1 i += 1
ret.append(Loop(count, pos)) elif cmd_op == CMD.SET_META:
elif cmd_start <= 0x80FF: if cmd_start <= 0x80FF:
ret.append(Unknown(cmd_start % 0x8000)) ret.append(Unknown(cmd_arg & 0xFF))
elif cmd_start <= 0x81FF: elif cmd_start <= 0x81FF:
ret.append(SetParent(cmd_start % 0x8100)) ret.append(SetParent(cmd_arg & 0xFF))
elif cmd_start <= 0x82FF: elif cmd_start <= 0x82FF:
ret.append(SetNotify(cmd_start % 0x8200)) ret.append(SetNotify(cmd_arg & 0xFF))
else: else:
raise Exception("Unknown command") raise Exception("Unknown command")
i += 1 i += 1
@ -263,8 +342,12 @@ class AnimComponent:
@staticmethod @staticmethod
def from_xml(xml: ET.Element): def from_xml(xml: ET.Element):
commands: List[int] = [] commands: List[int] = []
labels = {}
for cmd in xml: for cmd in xml:
if cmd.tag == "Wait": if cmd.tag == "Label":
idx = len(commands)
labels[cmd.attrib["name"]] = idx
elif cmd.tag == "Wait":
duration = int(cmd.attrib["duration"]) duration = int(cmd.attrib["duration"])
commands.append(duration) commands.append(duration)
elif cmd.tag == "SetRaster": elif cmd.tag == "SetRaster":
@ -273,7 +356,16 @@ class AnimComponent:
raster = 0xFFF raster = 0xFFF
commands.append(0x1000 + raster) commands.append(0x1000 + raster)
elif cmd.tag == "Goto": elif cmd.tag == "Goto":
commands.append(0x2000 + int(cmd.attrib["pos"])) if "pos" in cmd.attrib:
# support hardcoded positions for glitched animations
pos = int(cmd.attrib["pos"])
else:
# properly formatted animations will have labels
lbl_name = cmd.attrib["dest"]
if not lbl_name in labels:
raise Exception("Label missing for Goto dest: " + lbl_name)
pos = labels[lbl_name]
commands.append(0x2000 + pos)
elif cmd.tag == "SetPos": elif cmd.tag == "SetPos":
flag = int(cmd.attrib["flag"]) flag = int(cmd.attrib["flag"])
x, y, z = cmd.attrib["xyz"].split(",") x, y, z = cmd.attrib["xyz"].split(",")
@ -298,7 +390,15 @@ class AnimComponent:
commands.append(0x6000 + palette) commands.append(0x6000 + palette)
elif cmd.tag == "Loop": elif cmd.tag == "Loop":
count = int(cmd.attrib["count"]) count = int(cmd.attrib["count"])
pos = int(cmd.attrib["pos"]) if "pos" in cmd.attrib:
# support hardcoded positions for glitched animations
pos = int(cmd.attrib["pos"])
else:
# properly formatted animations will have labels
lbl_name = cmd.attrib["dest"]
if not lbl_name in labels:
raise Exception("Label missing for Loop dest: " + lbl_name)
pos = labels[lbl_name]
commands.append(0x7000 + count) commands.append(0x7000 + count)
commands.append(pos) commands.append(pos)
elif cmd.tag == "Unknown": elif cmd.tag == "Unknown":

View File

@ -193,10 +193,10 @@ dlabel wTransformGroups
dlabel bTransformGroups dlabel bTransformGroups
.space 0x00000010 .space 0x00000010
dlabel wModelSpecialDls dlabel wCustomModelGfx
.space 0x00000080 .space 0x00000080
dlabel bModelSpecialDls dlabel bCustomModelGfx
.space 0x00000080 .space 0x00000080
dlabel wCustomModelGfxBuilders dlabel wCustomModelGfxBuilders
@ -214,10 +214,10 @@ dlabel bModelLocalVtxBuffers
dlabel gCurrentModelLocalVtxBuffers dlabel gCurrentModelLocalVtxBuffers
.space 4 .space 4
dlabel D_80152214 dlabel wModelTreeRoot
.space 4 .space 4
dlabel D_80152218 dlabel bModelTreeRoot
.space 4 .space 4
dlabel D_8015221C dlabel D_8015221C
@ -271,19 +271,19 @@ dlabel texPannerAuxV
dlabel TextureHeapPos dlabel TextureHeapPos
.space 4 .space 4
dlabel mdl_currentTransformGroupChildIndex dlabel mtg_IterIdx
.space 2 .space 2
dlabel D_8015336E dlabel mtg_SearchModelID
.space 2 .space 2
dlabel D_80153370 dlabel mtg_FoundModelNode
.space 4 .space 4
dlabel D_80153374 dlabel mtg_MinChild
.space 2 .space 2
dlabel D_80153376 dlabel mtg_MaxChild
.space 2 .space 2
dlabel D_80153378 dlabel D_80153378

View File

@ -266,9 +266,9 @@ step_current_game_mode = 0x80118088;
state_render_backUI = 0x80118168; state_render_backUI = 0x80118168;
state_render_frontUI = 0x801181D4; state_render_frontUI = 0x801181D4;
clear_model_data = 0x8011AF54; clear_model_data = 0x8011AF54;
func_80116698 = 0x8011B8A8; mdl_update_transform_matrices = 0x8011B8A8;
render_models = 0x8011BDA0; render_models = 0x8011BDA0;
func_8011BAE8 = 0x80120CF8; mdl_reset_transform_flags = 0x80120CF8;
clear_render_tasks = 0x80122AA0; clear_render_tasks = 0x80122AA0;
execute_render_tasks = 0x80122BC8; execute_render_tasks = 0x80122BC8;
clear_animator_list = 0x80123434; clear_animator_list = 0x80123434;

View File

@ -59,16 +59,16 @@ npc_test_move_taller_with_slipping = 0x800DDAC4;
npc_test_move_simple_with_slipping = 0x800DDC24; npc_test_move_simple_with_slipping = 0x800DDC24;
npc_test_move_complex_with_slipping = 0x800DDD74; npc_test_move_complex_with_slipping = 0x800DDD74;
update_player = 0x800DF720; update_player = 0x800DF720;
clear_player_status = 0x800DFC30; clear_player_status = 0x800DFC30;
player_reset_data = 0x800DFC54; player_reset_data = 0x800DFC54;
suggest_player_anim_allow_backward = 0x800DFEDC; suggest_player_anim_allow_backward = 0x800DFEDC;
disable_player_input = 0x800E0158; disable_player_input = 0x800E0158;
enable_player_input = 0x800E0184; enable_player_input = 0x800E0184;
player_render_interact_prompts = 0x800E0240; player_render_interact_prompts = 0x800E0240;
render_player = 0x800E1118; render_player = 0x800E1118;
set_action_state = 0x800E5D84; set_action_state = 0x800E5D84;
start_bounce_a = 0x800E6014; start_bounce_a = 0x800E6014;
clear_player_data = 0x800E7340; clear_player_data = 0x800E7340;
initialize_status_bar = 0x800E78D4; initialize_status_bar = 0x800E78D4;
draw_status_ui = 0x800E96DC; draw_status_ui = 0x800E96DC;
close_status_bar = 0x800E9758; close_status_bar = 0x800E9758;
@ -147,7 +147,7 @@ NpcHitQueryColliderID = 0x8010CB38;
gPartnerStatus = 0x08010ED70; gPartnerStatus = 0x08010ED70;
gPlayerStatus = 0x8010F188; gPlayerStatus = 0x8010F188;
gPlayerData = 0x8010F450; gPlayerData = 0x8010F450;
spr_init_sprites = 0x80111448; spr_init_sprites = 0x80111448;
spr_render_init = 0x801115B0; spr_render_init = 0x801115B0;
spr_update_player_sprite = 0x801115DC; spr_update_player_sprite = 0x801115DC;
spr_draw_player_sprite = 0x80111790; spr_draw_player_sprite = 0x80111790;
@ -160,57 +160,57 @@ spr_free_sprite = 0x80112138;
set_npc_imgfx_all = 0x801123E4; set_npc_imgfx_all = 0x801123E4;
spr_get_npc_palettes = 0x80112590; spr_get_npc_palettes = 0x80112590;
spr_get_npc_color_variations = 0x801125BC; spr_get_npc_color_variations = 0x801125BC;
update_entities = 0x801148E0; update_entities = 0x801148E0;
render_entities = 0x801150C4; render_entities = 0x801150C4;
get_entity_by_index = 0x801157F8; get_entity_by_index = 0x801157F8;
get_shadow_by_index = 0x80115814; get_shadow_by_index = 0x80115814;
clear_entity_data = 0x80115EC8; clear_entity_data = 0x80115EC8;
init_entity_data = 0x80116068; init_entity_data = 0x80116068;
create_shadow_type = 0x80117470; create_shadow_type = 0x80117470;
delete_shadow = 0x80117538; delete_shadow = 0x80117538;
entity_raycast_down = 0x801177F8; entity_raycast_down = 0x801177F8;
set_npc_shadow_scale = 0x80117B10; set_npc_shadow_scale = 0x80117B10;
clear_game_modes = 0x80117DA8; clear_game_modes = 0x80117DA8;
set_game_mode_slot = 0x080117EB8; set_game_mode_slot = 0x080117EB8;
game_mode_set_fpDrawAuxUI = 0x80117F94; game_mode_set_fpDrawAuxUI = 0x80117F94;
step_current_game_mode = 0x80118088; step_current_game_mode = 0x80118088;
state_render_backUI = 0x80118168; state_render_backUI = 0x80118168;
state_render_frontUI = 0x801181D4; state_render_frontUI = 0x801181D4;
mdl_load_all_textures = 0x8011AE34; mdl_load_all_textures = 0x8011AE34;
clear_model_data = 0x8011AF54; clear_model_data = 0x8011AF54;
init_model_data = 0x8011B1F8; init_model_data = 0x8011B1F8;
calculate_model_sizes = 0x8011B33C; mdl_calculate_model_sizes = 0x8011B33C;
iterate_models = 0x8011B884; iterate_models = 0x8011B884;
func_80116698 = 0x8011B8A8; mdl_update_transform_matrices = 0x8011B8A8;
render_models = 0x8011BDA0; render_models = 0x8011BDA0;
get_model_from_list_index = 0x8011FF40; get_model_from_list_index = 0x8011FF40;
load_data_for_models = 0x8011FF58; load_data_for_models = 0x8011FF58;
func_8011BAE8 = 0x80120CF8; mdl_reset_transform_flags = 0x80120CF8;
set_background_color_blend = 0x8012106C; set_background_color_blend = 0x8012106C;
get_background_color_blend = 0x80121090; get_background_color_blend = 0x80121090;
mdl_set_all_fog_mode = 0x80122A3C; mdl_set_all_fog_mode = 0x80122A3C;
clear_render_tasks = 0x80122AA0; clear_render_tasks = 0x80122AA0;
queue_render_task = 0x80122B20; queue_render_task = 0x80122B20;
execute_render_tasks = 0x80122BC8; execute_render_tasks = 0x80122BC8;
clear_animator_list = 0x80123434; clear_animator_list = 0x80123434;
reset_animator_list = 0x80123520; reset_animator_list = 0x80123520;
clear_entity_models = 0x80125DC0; clear_entity_models = 0x80125DC0;
init_entity_models = 0x80125E68; init_entity_models = 0x80125E68;
get_entity_model = 0x80127FEC; get_entity_model = 0x80127FEC;
clear_worker_list = 0x801282C8; clear_worker_list = 0x801282C8;
init_worker_list = 0x80128324; init_worker_list = 0x80128324;
create_worker_world = 0x80128368; create_worker_world = 0x80128368;
update_workers = 0x80128614; update_workers = 0x80128614;
render_workers_world = 0x80128680; render_workers_world = 0x80128680;
render_workers_frontUI = 0x801286F0; render_workers_frontUI = 0x801286F0;
render_workers_backUI = 0x80128760; render_workers_backUI = 0x80128760;
clear_character_set = 0x80128870; clear_character_set = 0x80128870;
clear_printers = 0x80128884; clear_printers = 0x80128884;
update_messages = 0x80128A60; update_messages = 0x80128A60;
render_messages = 0x8012948C; render_messages = 0x8012948C;
get_msg_width = 0x8012B6D4; get_msg_width = 0x8012B6D4;
draw_msg = 0x8012B710; draw_msg = 0x8012B710;
clear_item_entity_data = 0x80136170; clear_item_entity_data = 0x80136170;
init_item_entity_list = 0x80136244; init_item_entity_list = 0x80136244;
make_item_entity = 0x80136564; make_item_entity = 0x80136564;
make_item_entity_delayed = 0x80136C38; make_item_entity_delayed = 0x80136C38;
@ -223,19 +223,19 @@ set_screen_overlay_params_back = 0x8013CE54;
set_screen_overlay_color = 0x8013CEC0; set_screen_overlay_color = 0x8013CEC0;
set_screen_overlay_center = 0x8013CEFC; set_screen_overlay_center = 0x8013CEFC;
set_screen_overlay_alpha = 0x8013D184; set_screen_overlay_alpha = 0x8013D184;
clear_screen_overlays = 0x8013D1B8; clear_screen_overlays = 0x8013D1B8;
func_80138188 = 0x8013D238; func_80138188 = 0x8013D238;
func_80138198 = 0x8013D248; func_80138198 = 0x8013D248;
render_screen_overlay_frontUI = 0x8013D250; render_screen_overlay_frontUI = 0x8013D250;
render_screen_overlay_backUI = 0x8013D2D0; render_screen_overlay_backUI = 0x8013D2D0;
set_map_transition_effect = 0x8013D350; set_map_transition_effect = 0x8013D350;
update_exit_map_screen_overlay = 0x8013D35C; update_exit_map_screen_overlay = 0x8013D35C;
update_enter_map_screen_overlay = 0x8013D684; update_enter_map_screen_overlay = 0x8013D684;
imgfx_update_cache = 0x8013F798; imgfx_update_cache = 0x8013F798;
hud_element_clear_cache = 0x801461B0; hud_element_clear_cache = 0x801461B0;
init_hud_element_list = 0x801463B0; init_hud_element_list = 0x801463B0;
hud_element_create = 0x80146554; hud_element_create = 0x80146554;
update_hud_elements = 0x801466C0; update_hud_elements = 0x801466C0;
render_hud_elements_backUI = 0x801472C0; render_hud_elements_backUI = 0x801472C0;
render_hud_elements_frontUI = 0x801477CC; render_hud_elements_frontUI = 0x801477CC;
render_hud_elements_world = 0x80148764; render_hud_elements_world = 0x80148764;
@ -247,30 +247,30 @@ hud_element_set_render_pos = 0x80149A34;
hud_element_set_flags = 0x80149AB0; hud_element_set_flags = 0x80149AB0;
hud_element_clear_flags = 0x80149ADC; hud_element_clear_flags = 0x80149ADC;
hud_element_set_aux_cache = 0x8014A398; hud_element_set_aux_cache = 0x8014A398;
clear_saved_variables = 0x8014A3D0; clear_saved_variables = 0x8014A3D0;
clear_area_flags = 0x8014A440; clear_area_flags = 0x8014A440;
set_global_flag = 0x8014A500; set_global_flag = 0x8014A500;
get_global_flag = 0x8014A56C; get_global_flag = 0x8014A56C;
clear_trigger_data = 0x8014A730; clear_trigger_data = 0x8014A730;
init_trigger_list = 0x8014A7D8; init_trigger_list = 0x8014A7D8;
update_triggers = 0x8014A910; update_triggers = 0x8014A910;
load_map_bg = 0x8014AE20; load_map_bg = 0x8014AE20;
reset_background_settings = 0x8014AEA8; reset_background_settings = 0x8014AEA8;
read_background_size = 0x8014AED8; read_background_size = 0x8014AED8;
set_background_size = 0x8014AF20; set_background_size = 0x8014AF20;
appendGfx_background_texture = 0x8014AF70; appendGfx_background_texture = 0x8014AF70;
reset_ambient_sounds = 0x8014C2E0; reset_ambient_sounds = 0x8014C2E0;
update_ambient_sounds = 0x8014C314; update_ambient_sounds = 0x8014C314;
clear_windows = 0x8014C4A0; clear_windows = 0x8014C4A0;
update_windows = 0x8014C4C4; update_windows = 0x8014C4C4;
render_window_root = 0x8014CB74; render_window_root = 0x8014CB74;
set_window_properties = 0x8014CD78; set_window_properties = 0x8014CD78;
set_window_update = 0x8014CF2C; set_window_update = 0x8014CF2C;
set_windows_visible = 0x8014CF74; set_windows_visible = 0x8014CF74;
clear_sprite_shading_data = 0x8014D0F0; clear_sprite_shading_data = 0x8014D0F0;
init_sprite_shading_data = 0x8014D1A0; init_sprite_shading_data = 0x8014D1A0;
sfx_reset_door_sounds = 0x8014E6B0; sfx_reset_door_sounds = 0x8014E6B0;
sfx_clear_sounds = 0x8014E6C8; sfx_clear_sounds = 0x8014E6C8;
sfx_clear_env_sounds = 0x8014E720; sfx_clear_env_sounds = 0x8014E720;
sfx_update_env_sound_params = 0x8014E7E4; sfx_update_env_sound_params = 0x8014E7E4;
sfx_set_reverb_mode = 0x8014E8AC; sfx_set_reverb_mode = 0x8014E8AC;
@ -279,9 +279,9 @@ sfx_stop_env_sounds = 0x8014E8E8;
sfx_stop_sound = 0x8014ED1C; sfx_stop_sound = 0x8014ED1C;
sfx_play_sound = 0x8014ED64; sfx_play_sound = 0x8014ED64;
sfx_play_sound_at_position = 0x8014EE0C; sfx_play_sound_at_position = 0x8014EE0C;
bgm_reset_sequence_players = 0x8014F548; bgm_reset_sequence_players = 0x8014F548;
bgm_reset_volume = 0x8014F5DC; bgm_reset_volume = 0x8014F5DC;
bgm_update_music_settings = 0x8014F5F8; bgm_update_music_settings = 0x8014F5F8;
bgm_set_song = 0x8014F9C8; bgm_set_song = 0x8014F9C8;
bgm_init_music_players = 0x8014FCB8; bgm_init_music_players = 0x8014FCB8;
bgm_quiet_max_volume = 0x8014FD0C; bgm_quiet_max_volume = 0x8014FD0C;
@ -318,11 +318,11 @@ shim_create_audio_system_obfuscated = 0x802B2000;
shim_load_engine_data_obfuscated = 0x802B203C; shim_load_engine_data_obfuscated = 0x802B203C;
shim_general_heap_create_obfuscated = 0x802B2078; shim_general_heap_create_obfuscated = 0x802B2078;
shim_battle_heap_create_obfuscated = 0x802B20B4; shim_battle_heap_create_obfuscated = 0x802B20B4;
clear_script_list = 0x802C31DC; clear_script_list = 0x802C31DC;
init_script_list = 0x802C32EC; init_script_list = 0x802C32EC;
start_script = 0x802C33E0; start_script = 0x802C33E0;
start_script_in_group = 0x802C35D0; start_script_in_group = 0x802C35D0;
update_scripts = 0x802C3D74; update_scripts = 0x802C3D74;
func_802C3EE4 = 0x802C3EE4; func_802C3EE4 = 0x802C3EE4;
kill_script = 0x802C3F3C; kill_script = 0x802C3F3C;
kill_script_by_ID = 0x802C40AC; kill_script_by_ID = 0x802C40AC;

View File

@ -193,10 +193,10 @@ dlabel wTransformGroups
dlabel bTransformGroups dlabel bTransformGroups
.space 0x00000010 .space 0x00000010
dlabel wModelSpecialDls dlabel wCustomModelGfx
.space 0x00000080 .space 0x00000080
dlabel bModelSpecialDls dlabel bCustomModelGfx
.space 0x00000080 .space 0x00000080
dlabel wCustomModelGfxBuilders dlabel wCustomModelGfxBuilders
@ -214,10 +214,10 @@ dlabel bModelLocalVtxBuffers
dlabel gCurrentModelLocalVtxBuffers dlabel gCurrentModelLocalVtxBuffers
.space 4 .space 4
dlabel D_80152214 dlabel wModelTreeRoot
.space 4 .space 4
dlabel D_80152218 dlabel bModelTreeRoot
.space 4 .space 4
dlabel D_8015221C dlabel D_8015221C
@ -271,19 +271,19 @@ dlabel texPannerAuxV
dlabel TextureHeapPos dlabel TextureHeapPos
.space 4 .space 4
dlabel mdl_currentTransformGroupChildIndex dlabel mtg_IterIdx
.space 2 .space 2
dlabel D_8015336E dlabel mtg_SearchModelID
.space 2 .space 2
dlabel D_80153370 dlabel mtg_FoundModelNode
.space 4 .space 4
dlabel D_80153374 dlabel mtg_MinChild
.space 2 .space 2
dlabel D_80153376 dlabel mtg_MaxChild
.space 2 .space 2
dlabel D_80153378 dlabel D_80153378

View File

@ -4007,10 +4007,10 @@ mdl_load_all_textures = 0x80115C24; // type:func rom:0xAC324
mdl_get_child_count = 0x80115CA8; // type:func rom:0xAC3A8 mdl_get_child_count = 0x80115CA8; // type:func rom:0xAC3A8
clear_model_data = 0x80115D44; // type:func rom:0xAC444 clear_model_data = 0x80115D44; // type:func rom:0xAC444
init_model_data = 0x80115FE8; // type:func rom:0xAC6E8 init_model_data = 0x80115FE8; // type:func rom:0xAC6E8
calculate_model_sizes = 0x8011612C; // type:func rom:0xAC82C mdl_calculate_model_sizes = 0x8011612C; // type:func rom:0xAC82C
mdl_create_model = 0x8011620C; // type:func rom:0xAC90C mdl_create_model = 0x8011620C; // type:func rom:0xAC90C
iterate_models = 0x80116674; // type:func rom:0xACD74 iterate_models = 0x80116674; // type:func rom:0xACD74
func_80116698 = 0x80116698; // type:func rom:0xACD98 mdl_update_transform_matrices = 0x80116698; // type:func rom:0xACD98
render_models = 0x80116B90; // type:func rom:0xAD290 render_models = 0x80116B90; // type:func rom:0xAD290
appendGfx_model_group = 0x80117C94; // type:func rom:0xAE394 appendGfx_model_group = 0x80117C94; // type:func rom:0xAE394
func_80117D00 = 0x80117D00; // type:func rom:0xAE400 func_80117D00 = 0x80117D00; // type:func rom:0xAE400
@ -4025,13 +4025,13 @@ get_transform_group_index = 0x8011B090; // type:func rom:0xB1790
get_model_center_and_size = 0x8011B0EC; // type:func rom:0xB17EC get_model_center_and_size = 0x8011B0EC; // type:func rom:0xB17EC
get_transform_group = 0x8011B1C0; // type:func rom:0xB18C0 get_transform_group = 0x8011B1C0; // type:func rom:0xB18C0
func_8011B1D8 = 0x8011B1D8; // type:func rom:0xB18D8 func_8011B1D8 = 0x8011B1D8; // type:func rom:0xB18D8
make_transform_group = 0x8011B37C; // type:func rom:0xB1A7C mdl_make_transform_group = 0x8011B37C; // type:func rom:0xB1A7C
enable_transform_group = 0x8011B5D0; // type:func rom:0xB1CD0 enable_transform_group = 0x8011B5D0; // type:func rom:0xB1CD0
disable_transform_group = 0x8011B660; // type:func rom:0xB1D60 disable_transform_group = 0x8011B660; // type:func rom:0xB1D60
clone_model = 0x8011B6F0; // type:func rom:0xB1DF0 clone_model = 0x8011B6F0; // type:func rom:0xB1DF0
set_model_group_visibility = 0x8011B7C0; // type:func rom:0xB1EC0 set_model_group_visibility = 0x8011B7C0; // type:func rom:0xB1EC0
func_8011B950 = 0x8011B950; // type:func rom:0xB2050 func_8011B950 = 0x8011B950; // type:func rom:0xB2050
func_8011BAE8 = 0x8011BAE8; // type:func rom:0xB21E8 mdl_reset_transform_flags = 0x8011BAE8; // type:func rom:0xB21E8
enable_world_fog = 0x8011BB50; // type:func rom:0xB2250 enable_world_fog = 0x8011BB50; // type:func rom:0xB2250
disable_world_fog = 0x8011BB64; // type:func rom:0xB2264 disable_world_fog = 0x8011BB64; // type:func rom:0xB2264
set_world_fog_dist = 0x8011BB74; // type:func rom:0xB2274 set_world_fog_dist = 0x8011BB74; // type:func rom:0xB2274
@ -4488,10 +4488,10 @@ bgm_set_battle_song = 0x8014AF8C; // type:func rom:0xE168C
func_8014AFA0 = 0x8014AFA0; // type:func rom:0xE16A0 func_8014AFA0 = 0x8014AFA0; // type:func rom:0xE16A0
D_8014AFB0 = 0x8014AFB0; // rom:0xE16B0 D_8014AFB0 = 0x8014AFB0; // rom:0xE16B0
D_8014AFB4 = 0x8014AFB4; // rom:0xE16B4 D_8014AFB4 = 0x8014AFB4; // rom:0xE16B4
D_8014AFC0 = 0x8014AFC0; // rom:0xE16C0 ModelRenderModes = 0x8014AFC0; // rom:0xE16C0
D_8014B0B8 = 0x8014B0B8; // rom:0xE17B8 ModelCombineModesA = 0x8014B0B8; // rom:0xE17B8
D_8014B0BC = 0x8014B0BC; // rom:0xE17BC D_8014B0BC = 0x8014B0BC; // rom:0xE17BC
D_8014B400 = 0x8014B400; // rom:0xE1B00 ModelCombineModesB = 0x8014B400; // rom:0xE1B00
D_8014B404 = 0x8014B404; // rom:0xE1B04 D_8014B404 = 0x8014B404; // rom:0xE1B04
TextureHeapBase = 0x8014B748; // rom:0xE1E48 TextureHeapBase = 0x8014B748; // rom:0xE1E48
mdl_bgMultiplyColorA = 0x8014B74C; // rom:0xE1E4C mdl_bgMultiplyColorA = 0x8014B74C; // rom:0xE1E4C
@ -4870,9 +4870,9 @@ func_802C39F8 = 0x802C39F8; // type:func rom:0xE83A8
func_802C3C10 = 0x802C3C10; // type:func rom:0xE85C0 func_802C3C10 = 0x802C3C10; // type:func rom:0xE85C0
wTransformGroups = 0x80151F70; // rom:0xE8670 wTransformGroups = 0x80151F70; // rom:0xE8670
bTransformGroups = 0x80151F80; // rom:0xE8680 bTransformGroups = 0x80151F80; // rom:0xE8680
wModelSpecialDls = 0x80151F90; // rom:0xE8690 wCustomModelGfx = 0x80151F90; // rom:0xE8690
restart_script = 0x802C3D04; // type:func rom:0xE86B4 restart_script = 0x802C3D04; // type:func rom:0xE86B4
bModelSpecialDls = 0x80152010; // rom:0xE8710 bCustomModelGfx = 0x80152010; // rom:0xE8710
update_scripts = 0x802C3D74; // type:func rom:0xE8724 update_scripts = 0x802C3D74; // type:func rom:0xE8724
wCustomModelGfxBuilders = 0x80152090; // rom:0xE8790 wCustomModelGfxBuilders = 0x80152090; // rom:0xE8790
bCustomModelGfxBuilders = 0x80152110; // rom:0xE8810 bCustomModelGfxBuilders = 0x80152110; // rom:0xE8810
@ -4881,8 +4881,8 @@ func_802C3EE4 = 0x802C3EE4; // type:func rom:0xE8894
bModelLocalVtxBuffers = 0x801521D0; // rom:0xE88D0 bModelLocalVtxBuffers = 0x801521D0; // rom:0xE88D0
kill_script = 0x802C3F3C; // type:func rom:0xE88EC kill_script = 0x802C3F3C; // type:func rom:0xE88EC
gCurrentModelLocalVtxBuffers = 0x80152210; // rom:0xE8910 gCurrentModelLocalVtxBuffers = 0x80152210; // rom:0xE8910
D_80152214 = 0x80152214; // rom:0xE8914 wModelTreeRoot = 0x80152214; // rom:0xE8914
D_80152218 = 0x80152218; // rom:0xE8918 bModelTreeRoot = 0x80152218; // rom:0xE8918
D_8015221C = 0x8015221C; // rom:0xE891C D_8015221C = 0x8015221C; // rom:0xE891C
D_80152220 = 0x80152220; // rom:0xE8920 D_80152220 = 0x80152220; // rom:0xE8920
kill_script_by_ID = 0x802C40AC; // type:func rom:0xE8A5C kill_script_by_ID = 0x802C40AC; // type:func rom:0xE8A5C
@ -4948,10 +4948,10 @@ texPannerAuxU = 0x801532E8; // rom:0xE99E8
texPannerAuxV = 0x80153328; // rom:0xE9A28 texPannerAuxV = 0x80153328; // rom:0xE9A28
mdl_nextTextureAddress = 0x80153368; // rom:0xE9A68 mdl_nextTextureAddress = 0x80153368; // rom:0xE9A68
evt_handle_case_not_equal = 0x802C50BC; // type:func rom:0xE9A6C evt_handle_case_not_equal = 0x802C50BC; // type:func rom:0xE9A6C
D_8015336E = 0x8015336E; // rom:0xE9A6E mtg_SearchModelID = 0x8015336E; // rom:0xE9A6E
D_80153370 = 0x80153370; // rom:0xE9A70 mtg_FoundModelNode = 0x80153370; // rom:0xE9A70
D_80153374 = 0x80153374; // rom:0xE9A74 mtg_MinChild = 0x80153374; // rom:0xE9A74
D_80153376 = 0x80153376; // rom:0xE9A76 mtg_MaxChild = 0x80153376; // rom:0xE9A76
D_80153378 = 0x80153378; // rom:0xE9A78 D_80153378 = 0x80153378; // rom:0xE9A78
depthCopyBuffer = 0x80153380; // rom:0xE9A80 depthCopyBuffer = 0x80153380; // rom:0xE9A80
mdl_renderTaskLists = 0x801533A0; // rom:0xE9AA0 mdl_renderTaskLists = 0x801533A0; // rom:0xE9AA0
@ -26031,7 +26031,7 @@ D_801512E8 = 0x801512E8; //
B_801512F0 = 0x801512F0; // B_801512F0 = 0x801512F0; //
gBattleEntityList = 0x801513F8; // gBattleEntityList = 0x801513F8; //
mdl_treeIterPos = 0x80153224; // mdl_treeIterPos = 0x80153224; //
mdl_currentTransformGroupChildIndex = 0x8015336C; // mtg_IterIdx = 0x8015336C; //
gCurrentAnimMeshListPtr = 0x80153A40; // gCurrentAnimMeshListPtr = 0x80153A40; //
gAnimRotMtx = 0x80153A68; // gAnimRotMtx = 0x80153A68; //
gMessageDrawStatePtr = 0x80155D74; // gMessageDrawStatePtr = 0x80155D74; //
@ -26770,8 +26770,8 @@ ExitSingleDoor = 0x80285DAC; //
EnterSingleDoor = 0x80285DD4; // EnterSingleDoor = 0x80285DD4; //
ExitDoubleDoor = 0x80285E4C; // ExitDoubleDoor = 0x80285E4C; //
EnterDoubleDoor = 0x80285E74; // EnterDoubleDoor = 0x80285E74; //
D_80286520 = 0x80286520; // ShopInteractScript = 0x80286520; //
D_80286524 = 0x80286524; // ShopInteractScriptID = 0x80286524; //
D_80286528 = 0x80286528; // D_80286528 = 0x80286528; //
wShopBuyCallbackScript = 0x8028652C; // wShopBuyCallbackScript = 0x8028652C; //
wShopSelectedItem = 0x80286530; // wShopSelectedItem = 0x80286530; //