B4580 and d0a70_len_4fe0 (#502)

* func_80133A94

* animator stuff

* add_anim_node and animator_node_update_model_transform

* a bunch more

* more

* .

* temp

* create_mesh_animator

* 2 mo

* d0a70 funcs

* more d0a70

* 2 mo

* 1 + cleanup

* 2 mo

* cleanup

* revert change to verbosity for splat

* PR comments
This commit is contained in:
Ethan Roseman 2021-10-29 13:57:15 -04:00 committed by GitHub
parent af880293a3
commit 068b8a5b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
292 changed files with 2373 additions and 3947 deletions

View File

@ -392,7 +392,7 @@ typedef struct Entity {
/* 0x74 */ char unk_74[60];
/* 0xB0 */ float effectiveSize;
/* 0xB4 */ char unk_B4[4];
/* 0xB8 */ Matrix4s transformMatrix;
/* 0xB8 */ Mtx transformMatrix;
} Entity; // size = 0xF8
typedef Entity* EntityList[MAX_ENTITIES];
@ -715,7 +715,7 @@ typedef struct BattleStatus {
/* 0x0A4 */ s8 cloudNineTurnsLeft;
/* 0x0A5 */ s8 cloudNineDodgeChance; /* = 50% */
/* 0x0A6 */ char unk_A6[2];
/* 0x0A8 */ s32 cloudNineEffect;
/* 0x0A8 */ struct EffectInstance* cloudNineEffect;
/* 0x0AC */ char unk_AC;
/* 0x0AD */ s8 unk_AD;
/* 0x0AE */ s8 hammerLossTurns;
@ -838,23 +838,70 @@ typedef struct ModelDisplayData {
/* 0x4 */ char unk_00[0x4];
} ModelDisplayData; // size = 0x8
typedef struct AnimatedMesh {
/* 0x000 */ s32 flags;
/* 0x004 */ u8 renderMode;
/* 0x005 */ char unk_05[3];
/* 0x008 */ u32* animation1;
/* 0x00C */ u32* animation2;
/* 0x010 */ char unk_10[136];
/* 0x098 */ Matrix4s mtx;
/* 0x0D8 */ char unk_D8[500];
/* 0x2CC */ s32 time;
/* 0x2D0 */ char unk_2D0[4];
/* 0x2D4 */ s32 unk_2D4;
/* 0x2D8 */ s32 unk_2D8;
/* 0x2DC */ char unk_2DC[4];
} AnimatedMesh; // size = 0x2E0
typedef struct AnimatorNode {
/* 0x00 */ Gfx* displayList;
/* 0x04 */ struct AnimatorNode* children[0x20];
/* 0x84 */ Vec3f basePos; // ?
/* 0x90 */ Vec3f pos;
/* 0x9C */ Vec3f rotation;
/* 0xA8 */ Vec3f scale;
/* 0xB4 */ Matrix4f mtx;
/* 0xF4 */ s16 flags;
/* 0xF6 */ s16 uniqueIndex;
/* 0xF8 */ s16 vertexStartOffset;
/* 0xFA */ char unk_FA[2];
/* 0xFC */ union {
/* */ s32 modelID;
/* */ Vtx* vtxList;
/* */ } fcData;
} AnimatorNode; // size = 0x100
typedef AnimatedMesh* AnimatedMeshList[MAX_ANIMATED_MESHES];
typedef struct AnimatorNodeBlueprint {
/* 0x00 */ Gfx* displayList;
/* 0x04 */ Vec3f basePos;
/* 0x10 */ Vec3f rotation;
/* 0x1C */ char unk_1C[0x4];
} AnimatorNodeBlueprint; // size = 0x20
typedef struct StaticAnimatorNode {
/* 0x00 */ Gfx* displayList; // can sometime point to a node???
/* 0x04 */ Vec3s rot; /* range = -180,180 */
/* 0x0A */ char unk_0A[0x2];
/* 0x0C */ Vec3f pos;
/* 0x18 */ struct StaticAnimatorNode* sibling;
/* 0x1C */ struct StaticAnimatorNode* child;
/* 0x20 */ s16 vertexStartOffset;
/* 0x22 */ char unk_22[0x2];
/* 0x24 */ Vtx* vtxList;
/* 0x28 */ s16 modelID;
/* 0x2A */ char unk_2A[0x2];
} StaticAnimatorNode; // size = 0x2C
typedef struct ModelAnimator {
/* 0x000 */ u32 flags;
/* 0x004 */ s8 renderMode;
/* 0x005 */ char unk_05[3];
/* 0x008 */ s8* animReadPos;
/* 0x00C */ s8* savedReadPos;
/* 0x010 */ AnimatorNode* rootNode;
/* 0x014 */ u8 nextUniqueID;
/* 0x015 */ u8 staticNodeIDs[0x7A]; // ?
/* 0x08F */ char unk_08F[0x1];
/* 0x090 */ f32 nextUpdateTime;
/* 0x094 */ f32 timeScale;
/* 0x098 */ Mtx mtx;
/* 0x0D8 */ Vtx** vertexArray;
/* 0x0DC */ s8* animationBuffer;
/* 0x0E0 */ StaticAnimatorNode* staticNodes[0x7A];
/* 0x2C8 */ StaticAnimatorNode** staticRoot;
/* 0x2CC */ s32 treeIndexPos;
/* 0x2D0 */ s32 savedTreePos;
/* 0x2D4 */ void (*fpRenderCallback)(void);
/* 0x2D8 */ s32 renderCallbackArg;
/* 0x2DC */ char unk_2DC[4];
} ModelAnimator; // size = 0x2E0
typedef ModelAnimator* AnimatedMeshList[MAX_ANIMATED_MESHES];
typedef struct PrintHandle {
/* 0x000 */ char unk_00[16];
@ -926,20 +973,6 @@ typedef struct ItemEntity {
/* 0x58 */ s32 unk_58;
} ItemEntity; // size = 0x5C
typedef struct StaticAnimatorNode {
/* 0x00 */ u32* displayList; // can sometime point to a node???
/* 0x04 */ Vec3s rot; /* range = -180,180 */
/* 0x0A */ char unk_0A[0x2];
/* 0x0C */ Vec3f pos;
/* 0x18 */ struct StaticAnimatorNode* sibling;
/* 0x1C */ struct StaticAnimatorNode* child;
/* 0x20 */ s16 vertexStartOffset;
/* 0x22 */ char unk_22[0x2];
/* 0x24 */ Vtx* vtxList;
/* 0x28 */ s16 modelID;
/* 0x2A */ char unk_2A[0x2];
} StaticAnimatorNode; // size = 0x2C
typedef struct MessagePrintState {
/* 0x000 */ s8* srcBuffer;
/* 0x004 */ s16 printBufferPos;
@ -1220,7 +1253,7 @@ typedef struct Shadow {
/* 0x1C */ Vec3f scale;
/* 0x28 */ Vec3f rotation;
/* 0x34 */ char unk_34[0x4];
/* 0x38 */ Matrix4s transformMatrix;
/* 0x38 */ Mtx transformMatrix;
} Shadow; // size = 0x78
typedef Shadow* ShadowList[MAX_SHADOWS];
@ -1521,8 +1554,7 @@ typedef struct AnimatedModel {
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f rot;
/* 0x1C */ Vec3f scale;
/* 0x28 */ Matrix4s* mtx;
/* 0x2C */ char unk_2C[60];
/* 0x28 */ Mtx mtx;
/* 0x68 */ u32 currentAnimData;
/* 0x6C */ char unk_6C[4];
} AnimatedModel; // size = 0x70
@ -1656,7 +1688,7 @@ typedef struct Actor {
/* 0x207 */ s8 extraCoinBonus;
/* 0x208 */ s8 unk_208;
/* 0x209 */ char unk_209[3];
/* 0x20C */ u32* statusTable;
/* 0x20C */ struct DictionaryEntry* statusTable;
/* 0x210 */ s8 debuff;
/* 0x211 */ s8 debuffDuration;
/* 0x212 */ s8 staticStatus; /* 0B = yes */
@ -2089,7 +2121,8 @@ typedef struct PartnerActionStatus {
/* 0x00C */ s32 pressedButtons;
/* 0x010 */ s32 heldButtons;
/* 0x014 */ s8 inputDisabled;
/* 0x015 */ char unk_15[0x343];
/* 0x015 */ char unk_15[0x3];
/* 0x018 */ Npc unk_18;
/* 0x358 */ s32 unk_358;
/* 0x35C */ char unk_35C[0x4];
} PartnerActionStatus; // size = 0x360

View File

@ -22,8 +22,10 @@ OSThread* osGetActiveQueue(void);
f32 signF(f32 val);
void* heap_malloc(s32 size);
s32* _heap_malloc(HeapNode* head, s32 size);
HeapNode* _heap_create(s32* addr, u32 size);
s32 dma_copy(Addr romStart, Addr romEnd, void* vramDest);
void copy_matrix(Matrix4f src, Matrix4f dest);
s32 _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap);
@ -88,7 +90,7 @@ s32 can_trigger_loading_zone(void);
void func_802667F0(s32, Actor*, f32, f32, f32);
void* general_heap_malloc(s32 size);
s32 general_heap_free(s32* size);
s32 general_heap_free(s32* data);
void entity_Shadow_init(Shadow* entity);
void entity_SaveBlock_idle(Entity* entity);
@ -128,7 +130,7 @@ void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32* screenX, s32* screen
void parent_collider_to_model(s32 colliderID, s16 modelIndex);
void clone_model(u16 srcModelID, u16 newModelID);
Model* get_model_from_list_index(s32 listIndex);
struct Model* get_model_from_list_index(s32 listIndex);
s32 get_model_list_index_from_tree_index(s32 treeIndex);
s32 get_transform_group_index(s32);
void get_model_center_and_size(u16 modelID, f32* centerX, f32* centerY, f32* centerZ, f32* sizeX, f32* sizeY,
@ -229,6 +231,7 @@ void init_virtual_entity_list(void);
void init_model_animators(void);
s32 heap_free(void* ptr);
void btl_state_update_switch_to_partner(void);
void btl_set_popup_duration(s32 duration);
void switch_to_partner(s32 arg0);
void delete_trigger(Trigger* toDelete);
@ -258,8 +261,6 @@ s32 npc_test_move_taller_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32
s32 npc_test_move_simple_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
s32 npc_test_move_complex_with_slipping(s32, f32*, f32*, f32*, f32, f32, f32, f32);
Npc* get_npc_by_index(s32 listIndex);
// Partner
void partner_walking_update_player_tracking(Npc* partner);
void partner_walking_update_motion(Npc* partner);
@ -283,7 +284,7 @@ void set_standard_shadow_scale(Shadow* shadow, f32 scale);
void set_peach_shadow_scale(Shadow* shadow, f32 scale);
void set_animation_rate(s32 actorID, s32 partIndex, f32 rate);
void func_8011B7C0(u16, s32, s32);
AnimatedMesh* get_animator_by_index(s32 arg0);
ModelAnimator* get_animator_by_index(s32 arg0);
void set_screen_overlay_params_front(u8, f32);
void set_screen_overlay_params_back(s32, f32);
void set_screen_overlay_alpha(s32, f32);
@ -309,7 +310,7 @@ void enable_entity_fog(void);
void set_entity_fog_dist(s32 start, s32 end);
void set_entity_fog_color(s32 r, s32 g, s32 b, s32 a);
ModelTransformGroup* get_transform_group(s32 index);
struct ModelTransformGroup* get_transform_group(s32 index);
s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 facingAngleSign,
s32 pickupVar);
@ -331,11 +332,7 @@ s32 enable_player_static_collisions(void);
s32 check_input_jump(void);
s32 check_input_hammer(void);
Npc* get_npc_safe(s32 npcId);
Npc* get_npc_unsafe(s32 npcId);
Npc* resolve_npc(Evt* script, s32 npcIdOrPtr);
void set_npc_yaw(Npc* npcPtr, f32 angle);
void npc_move_heading(Npc* npc, f32 speed, f32 yaw);
void enable_npc_blur(Npc* npc);
void disable_npc_blur(Npc* npc);
@ -453,6 +450,7 @@ void state_drawUI_intro(void);
void state_init_demo(void);
void state_step_demo(void);
void state_drawUI_demo(void);
void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void));
void func_802B2078(void);

View File

@ -4,7 +4,7 @@
#include "common_structs.h"
#include "enums.h"
#include "script_api/map.h"
#include "model.h"
#include "npc.h"
// TODO: consider moving Npc here
@ -13,7 +13,7 @@ typedef Vec4f EntryList[];
/// Fields other than main, entryList, entryCount, background, and tattle are initialised when the map loads.
typedef struct MapConfig {
/* 0x00 */ ModelNode* modelTreeRoot;
/* 0x00 */ struct ModelNode* modelTreeRoot;
/* 0x04 */ UNK_PTR collision;
/* 0x08 */ UNK_PTR unk_08;
/* 0x0C */ char unk_0C[4];
@ -60,285 +60,8 @@ typedef struct Area {
/* 0x0C */ char* name; ///< JP debug name.
} Area; // size = 0x10
typedef struct NpcBlueprint {
/* 0x00 */ s32 flags;
/* 0x04 */ s32 initialAnim;
/* 0x08 */ void (*onUpdate)(struct Npc*);
/* 0x0C */ void (*onRender)(struct Npc*);
} NpcBlueprint; // size = 0x10
typedef struct NpcAISettings {
/* 0x00 */ f32 moveSpeed;
/* 0x04 */ s32 moveTime;
/* 0x08 */ s32 waitTime;
/* 0x0C */ f32 alertRadius;
/* 0x10 */ X32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ f32 chaseSpeed;
/* 0x1C */ X32 unk_1C; // chase turn step?
/* 0x20 */ s32 unk_20;
/* 0x24 */ f32 chaseRadius;
/* 0x28 */ X32 unk_28;
/* 0x2C */ s32 unk_2C; // bool
} NpcAISettings; // size = 0x30
typedef struct NpcSettings {
/* 0x00 */ char unk_00[4];
/* 0x04 */ s16 height;
/* 0x06 */ s16 radius;
/* 0x08 */ UNK_PTR otherAI;
/* 0x0C */ EvtSource* onInteract;
/* 0x10 */ EvtSource* ai;
/* 0x14 */ EvtSource* onHit;
/* 0x18 */ EvtSource* aux;
/* 0x1C */ EvtSource* onDefeat;
/* 0x20 */ s32 flags;
/* 0x24 */ char unk_24[4];
/* 0x28 */ s16 level;
/* 0x2A */ s16 unk_2A;
} NpcSettings; // size = 0x2C
typedef struct ItemDrop {
/* 0x00 */ s16 item;
/* 0x02 */ s16 weight;
/* 0x04 */ s16 unk_08;
} ItemDrop; // size = 0x06
/// @brief Describes heart/flower drop chances after defeating an Npc in the overworld.
///
/// The algorithm for calculating the number of hearts/flowers from a StatDrop is:
/// - If current HP/FP > cutoff, drop 0.
/// - Roll generalChance. If it fails, drop 0.
/// - Roll chancePerAttempt attempts times. For each success, drop a heart/flower.
///
/// StaticNpc holds a table of StatDrops for each stat (hearts, flowers). All are checked together
/// and the number of hearts/flowers to drop is the total number of successful attempts for each stat.
///
/// Each heart/flower is worth 1 HP and 1 FP respectively, if picked up.
///
/// cutoff, generalChance, and chancePerAttempt are short fixed-point percentage values.
/// That is, `F16(0)` is a 0% chance and `F16(100)` is a 100% chance.
typedef struct StatDrop {
/* 0x00 */ s16 cutoff; ///< % of max HP/FP. If current HP/FP > cutoff, no hearts/flowers can be dropped.
/* 0x02 */ s16 generalChance; ///< % chance for any hearts/flowers to be dropped at all from this StatDrop.
/* 0x04 */ s16 attempts; ///< Maximum number of hearts/flowers that can be dropped from this StatDrop.
/* 0x06 */ s16 chancePerAttempt; ///< % chance for a single heart/flower to be dropped from each attempt.
} StatDrop; // size = 0x08
#define NO_DROPS { { F16(100), F16(0), 0, F16(0) }, }
#define STANDARD_HEART_DROPS(attempts) { \
{ F16(20), F16(70), attempts, F16(50) }, \
{ F16(30), F16(60), attempts, F16(50) }, \
{ F16(50), F16(50), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(30) }, \
}
#define GENEROUS_HEART_DROPS(attempts) { \
{ F16(20), F16(80), attempts, F16(50) } \
{ F16(30), F16(70), attempts, F16(50) } \
{ F16(50), F16(60), attempts, F16(40) } \
{ F16(80), F16(50), attempts, F16(40) } \
{ F16(100), F16(40), attempts, F16(30) }, \
}
#define GENEROUS_WHEN_LOW_HEART_DROPS(attempts) { \
{ F16(20), F16(80), attempts, F16(60) }, \
{ F16(30), F16(70), attempts, F16(50) }, \
{ F16(50), F16(60), attempts, F16(50) }, \
{ F16(80), F16(50), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(30) }, \
}
#define STANDARD_FLOWER_DROPS(attempts) { \
{ F16(20), F16(50), attempts, F16(40) }, \
{ F16(30), F16(40), attempts, F16(40) }, \
{ F16(50), F16(40), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(40) }, \
}
#define GENEROUS_WHEN_LOW_FLOWER_DROPS(attempts) { \
{ F16(20), F16(70), attempts, F16(50) }, \
{ F16(30), F16(60), attempts, F16(50) }, \
{ F16(50), F16(50), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(40) }, \
}
#define REDUCED_FLOWER_DROPS(attempts) { \
{ F16(20), F16(40), attempts, F16(40) }, \
{ F16(30), F16(40), attempts, F16(40) }, \
{ F16(50), F16(40), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(40) }, \
}
#define OVERRIDE_MOVEMENT_SPEED(speed) (speed * 32767)
#define NO_OVERRIDE_MOVEMENT_SPEED OVERRIDE_MOVEMENT_SPEED(-1)
typedef struct EnemyDrops {
/* 0x00 */ s8 dropFlags;
/* 0x01 */ s8 itemDropChance; // %
/* 0x02 */ ItemDrop itemDrops[8];
/* 0x32 */ StatDrop heartDrops[8];
/* 0x72 */ StatDrop flowerDrops[8];
/* 0xB2 */ s16 minCoinBonus;
/* 0xB4 */ s16 maxCoinBonus;
/* 0xB6 */ char unk_DE[2];
} EnemyDrops; // size = 0xB8
typedef struct StaticNpc {
/* 0x000 */ s32 id;
/* 0x004 */ NpcSettings* settings;
/* 0x008 */ Vec3f pos;
/* 0x014 */ s32 flags;
/* 0x018 */ EvtSource* init;
/* 0x01C */ char unk_1C[8];
/* 0x024 */ s32 yaw;
/* 0x028 */ s8 dropFlags; // TODO: use EnemyDrops (requires tons of map edits)
/* 0x029 */ s8 itemDropChance; // %
/* 0x02A */ ItemDrop itemDrops[8];
/* 0x05A */ StatDrop heartDrops[8];
/* 0x09A */ StatDrop flowerDrops[8];
/* 0x0DA */ s16 minCoinBonus;
/* 0x0DC */ s16 maxCoinBonus;
/* 0x0E0 */ s32 movement[48]; // TODO: type
/* 0x1A0 */ struct {
/* 0x00 */ s32 idle;
/* 0x04 */ s32 walk;
/* 0x08 */ s32 run;
/* 0x0C */ s32 chase;
/* 0x10 */ s32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ s32 death;
/* 0x1C */ s32 hit;
/* 0x20 */ s32 unk_20;
/* 0x24 */ s32 unk_24;
/* 0x28 */ s32 unk_28;
/* 0x2C */ s32 unk_2C;
/* 0x30 */ s32 unk_30;
/* 0x34 */ s32 unk_34;
/* 0x38 */ s32 unk_38;
/* 0x3C */ s32 unk_3C;
} animations;
/* 0x1E0 */ char unk_1E0[8];
/* 0x1E8 */ s32* extraAnimations;
/* 0x1EC */ s32 tattle;
} StaticNpc; // size = 0x1F0
enum TerritoryShape { SHAPE_CYLINDER, SHAPE_RECT };
typedef struct {
/* 0x00 */ s32 unk_00;
/* 0x04 */ enum TerritoryShape shape;
/* 0x08 */ s32 pointX;
/* 0x0C */ s32 pointZ;
/* 0x10 */ s32 sizeX;
/* 0x14 */ s32 sizeZ;
/* 0x18 */ f32 unk_18;
/* 0x1C */ s16 unk_1C;
} EnemyTerritoryThing; // size = 0x20
typedef struct {
/* 0x00 */ Vec3i point;
/* 0x0C */ s32 wanderSizeX;
/* 0x10 */ s32 wanderSizeZ;
/* 0x14 */ s32 moveSpeedOverride;
/* 0x18 */ enum TerritoryShape wanderShape;
/* 0x1C */ Vec3i detect;
/* 0x28 */ s32 detectSizeX;
/* 0x2C */ s32 detectSizeZ;
/* 0x30 */ enum TerritoryShape detectShape;
/* 0x34 */ s32 isFlying;
} EnemyTerritoryWander; // size = 0x38
typedef struct {
/* 0x00 */ s32 numPoints;
/* 0x04 */ Vec3i points[10];
/* 0x7C */ s32 moveSpeedOverride;
/* 0x80 */ Vec3i detect;
/* 0x8C */ s32 detectSizeX;
/* 0x90 */ s32 detectSizeZ;
/* 0x94 */ enum TerritoryShape detectShape;
/* 0x98 */ s32 isFlying;
} EnemyTerritoryPatrol; // size = 0x9C
typedef union {
EnemyTerritoryWander wander;
EnemyTerritoryPatrol patrol;
char PADDING[0xC0];
} EnemyTerritory; // size = 0xC0
typedef struct Enemy {
/* 0x00 */ s32 flags;
/* 0x04 */ s8 encounterIndex;
/* 0x05 */ s8 encountered;
/* 0x06 */ u8 scriptGroup; /* scripts launched for this npc controller will be assigned this group */
/* 0x07 */ s8 unk_07;
/* 0x08 */ s16 npcID;
/* 0x0A */ s16 spawnPos[3];
/* 0x10 */ Vec3s unk_10;
/* 0x16 */ char unk_16[2];
/* 0x18 */ struct NpcSettings* npcSettings;
/* 0x1C */ EvtSource* initBytecode;
/* 0x20 */ EvtSource* interactBytecode;
/* 0x24 */ EvtSource* aiBytecode;
/* 0x28 */ EvtSource* hitBytecode;
/* 0x2C */ EvtSource* auxBytecode;
/* 0x30 */ EvtSource* defeatBytecode;
/* 0x34 */ struct Evt* initScript;
/* 0x38 */ struct Evt* interactScript;
/* 0x3C */ struct Evt* aiScript;
/* 0x40 */ struct Evt* hitScript;
/* 0x44 */ struct Evt* auxScript;
/* 0x48 */ struct Evt* defeatScript;
/* 0x4C */ s32 initScriptID;
/* 0x50 */ s32 interactScriptID;
/* 0x54 */ s32 aiScriptID;
/* 0x58 */ s32 hitScriptID;
/* 0x5C */ s32 auxScriptID;
/* 0x60 */ s32 defeatScriptID;
/* 0x64 */ UNK_PTR unk_64;
/* 0x68 */ char unk_68[4];
/* 0x6C */ s32 varTable[16];
/* 0xAC */ char unk_AC[4];
/* 0xB0 */ s32 unk_B0;
/* 0xB4 */ s8 unk_B4;
/* 0xB5 */ s8 unk_B5;
/* 0xB6 */ char unk_B6[2];
/* 0xB8 */ EvtSource* unk_B8; // some bytecode
/* 0xBC */ struct Evt* unk_BC; // some script
/* 0xC0 */ s32 unk_C0; // some script ID
/* 0xC4 */ s32 unk_C4;
/* 0xC8 */ s32 unk_C8;
/* 0xCC */ s32* animList;
/* 0xD0 */ EnemyTerritory* territory;
/* 0xD4 */ EnemyDrops* drops;
/* 0xD8 */ u32 tattleMsg;
/* 0xDC */ char unk_DC[20];
} Enemy; // size = 0xF0
/// Zero-terminated.
typedef struct {
/* 0x00 */ s32 npcCount;
/* 0x04 */ StaticNpc* npcs;
/* 0x08 */ s32 battle;
} NpcGroupList[]; // size = 0x0C
typedef struct QuizRequirements {
s32 unk_00;
s32 unk_04;
} QuizRequirements; // size = 0x8
#define NPC_GROUP(npcs, battle) { sizeof(npcs) / sizeof(StaticNpc), (StaticNpc*) &npcs, battle }
Enemy* get_enemy(s32 npcId);
MapConfig* get_current_map_header(void);
s32 func_800490B4(EnemyTerritoryThing* arg0, Enemy* arg1, f32 arg2, f32 arg3, s32 arg4);
/// Zero-terminated.
extern Area gAreas[29];

View File

@ -138,4 +138,14 @@ typedef enum ShapeTypes {
typedef ModelTreeInfo ModelTreeInfoList[0x200];
extern ModelTreeInfoList* mdl_currentModelTreeNodeInfo;
void update_model_animator_with_transform(s32 animatorID, Mtx* mtx);
s32 step_model_animator(ModelAnimator* animator);
void animator_update_model_transforms(ModelAnimator* animator, Mtx* rootTransform);
void render_animated_model(s32 animatorID, Mtx* rootTransform);
void animator_node_update_model_transform(ModelAnimator* animator, f32 (*flipMtx)[4], AnimatorNode* node,
Mtx* rootTransform);
void appendGfx_animator(ModelAnimator* animator);
void reload_mesh_animator_tree(ModelAnimator* animator);
s32 step_mesh_animator(ModelAnimator* animator);
#endif

543
include/npc.h Normal file
View File

@ -0,0 +1,543 @@
#ifndef _NPC_H_
#define _NPC_H_
#include "common_structs.h"
#include "enums.h"
#include "script_api/map.h"
#define NO_DROPS { { F16(100), F16(0), 0, F16(0) }, }
#define STANDARD_HEART_DROPS(attempts) { \
{ F16(20), F16(70), attempts, F16(50) }, \
{ F16(30), F16(60), attempts, F16(50) }, \
{ F16(50), F16(50), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(30) }, \
}
#define GENEROUS_HEART_DROPS(attempts) { \
{ F16(20), F16(80), attempts, F16(50) } \
{ F16(30), F16(70), attempts, F16(50) } \
{ F16(50), F16(60), attempts, F16(40) } \
{ F16(80), F16(50), attempts, F16(40) } \
{ F16(100), F16(40), attempts, F16(30) }, \
}
#define GENEROUS_WHEN_LOW_HEART_DROPS(attempts) { \
{ F16(20), F16(80), attempts, F16(60) }, \
{ F16(30), F16(70), attempts, F16(50) }, \
{ F16(50), F16(60), attempts, F16(50) }, \
{ F16(80), F16(50), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(30) }, \
}
#define STANDARD_FLOWER_DROPS(attempts) { \
{ F16(20), F16(50), attempts, F16(40) }, \
{ F16(30), F16(40), attempts, F16(40) }, \
{ F16(50), F16(40), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(40) }, \
}
#define GENEROUS_WHEN_LOW_FLOWER_DROPS(attempts) { \
{ F16(20), F16(70), attempts, F16(50) }, \
{ F16(30), F16(60), attempts, F16(50) }, \
{ F16(50), F16(50), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(40) }, \
}
#define REDUCED_FLOWER_DROPS(attempts) { \
{ F16(20), F16(40), attempts, F16(40) }, \
{ F16(30), F16(40), attempts, F16(40) }, \
{ F16(50), F16(40), attempts, F16(40) }, \
{ F16(80), F16(40), attempts, F16(40) }, \
{ F16(100), F16(30), attempts, F16(40) }, \
}
#define OVERRIDE_MOVEMENT_SPEED(speed) (speed * 32767)
#define NO_OVERRIDE_MOVEMENT_SPEED OVERRIDE_MOVEMENT_SPEED(-1)
typedef struct QuizRequirements {
s32 unk_00;
s32 unk_04;
} QuizRequirements; // size = 0x8
typedef struct NpcBlueprint {
/* 0x00 */ s32 flags;
/* 0x04 */ s32 initialAnim;
/* 0x08 */ void (*onUpdate)(struct Npc*);
/* 0x0C */ void (*onRender)(struct Npc*);
} NpcBlueprint; // size = 0x10
typedef struct NpcAISettings {
/* 0x00 */ f32 moveSpeed;
/* 0x04 */ s32 moveTime;
/* 0x08 */ s32 waitTime;
/* 0x0C */ f32 alertRadius;
/* 0x10 */ X32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ f32 chaseSpeed;
/* 0x1C */ X32 unk_1C; // chase turn step?
/* 0x20 */ s32 unk_20;
/* 0x24 */ f32 chaseRadius;
/* 0x28 */ X32 unk_28;
/* 0x2C */ s32 unk_2C; // bool
} NpcAISettings; // size = 0x30
typedef struct NpcSettings {
/* 0x00 */ char unk_00[4];
/* 0x04 */ s16 height;
/* 0x06 */ s16 radius;
/* 0x08 */ UNK_PTR otherAI;
/* 0x0C */ EvtSource* onInteract;
/* 0x10 */ EvtSource* ai;
/* 0x14 */ EvtSource* onHit;
/* 0x18 */ EvtSource* aux;
/* 0x1C */ EvtSource* onDefeat;
/* 0x20 */ s32 flags;
/* 0x24 */ char unk_24[4];
/* 0x28 */ s16 level;
/* 0x2A */ s16 unk_2A;
} NpcSettings; // size = 0x2C
typedef struct ItemDrop {
/* 0x00 */ s16 item;
/* 0x02 */ s16 weight;
/* 0x04 */ s16 unk_08;
} ItemDrop; // size = 0x06
/// @brief Describes heart/flower drop chances after defeating an Npc in the overworld.
///
/// The algorithm for calculating the number of hearts/flowers from a StatDrop is:
/// - If current HP/FP > cutoff, drop 0.
/// - Roll generalChance. If it fails, drop 0.
/// - Roll chancePerAttempt attempts times. For each success, drop a heart/flower.
///
/// StaticNpc holds a table of StatDrops for each stat (hearts, flowers). All are checked together
/// and the number of hearts/flowers to drop is the total number of successful attempts for each stat.
///
/// Each heart/flower is worth 1 HP and 1 FP respectively, if picked up.
///
/// cutoff, generalChance, and chancePerAttempt are short fixed-point percentage values.
/// That is, `F16(0)` is a 0% chance and `F16(100)` is a 100% chance.
typedef struct StatDrop {
/* 0x00 */ s16 cutoff; ///< % of max HP/FP. If current HP/FP > cutoff, no hearts/flowers can be dropped.
/* 0x02 */ s16 generalChance; ///< % chance for any hearts/flowers to be dropped at all from this StatDrop.
/* 0x04 */ s16 attempts; ///< Maximum number of hearts/flowers that can be dropped from this StatDrop.
/* 0x06 */ s16 chancePerAttempt; ///< % chance for a single heart/flower to be dropped from each attempt.
} StatDrop; // size = 0x08
typedef struct StaticNpc {
/* 0x000 */ s32 id;
/* 0x004 */ NpcSettings* settings;
/* 0x008 */ Vec3f pos;
/* 0x014 */ s32 flags;
/* 0x018 */ EvtSource* init;
/* 0x01C */ char unk_1C[8];
/* 0x024 */ s32 yaw;
/* 0x028 */ s8 dropFlags; // TODO: use EnemyDrops (requires tons of map edits)
/* 0x029 */ s8 itemDropChance; // %
/* 0x02A */ ItemDrop itemDrops[8];
/* 0x05A */ StatDrop heartDrops[8];
/* 0x09A */ StatDrop flowerDrops[8];
/* 0x0DA */ s16 minCoinBonus;
/* 0x0DC */ s16 maxCoinBonus;
/* 0x0E0 */ s32 movement[48]; // TODO: type
/* 0x1A0 */ struct {
/* 0x00 */ s32 idle;
/* 0x04 */ s32 walk;
/* 0x08 */ s32 run;
/* 0x0C */ s32 chase;
/* 0x10 */ s32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ s32 death;
/* 0x1C */ s32 hit;
/* 0x20 */ s32 unk_20;
/* 0x24 */ s32 unk_24;
/* 0x28 */ s32 unk_28;
/* 0x2C */ s32 unk_2C;
/* 0x30 */ s32 unk_30;
/* 0x34 */ s32 unk_34;
/* 0x38 */ s32 unk_38;
/* 0x3C */ s32 unk_3C;
} animations;
/* 0x1E0 */ char unk_1E0[8];
/* 0x1E8 */ s32* extraAnimations;
/* 0x1EC */ s32 tattle;
} StaticNpc; // size = 0x1F0
/// Zero-terminated.
typedef struct {
/* 0x00 */ s32 npcCount;
/* 0x04 */ StaticNpc* npcs;
/* 0x08 */ s32 battle;
} NpcGroupList[]; // size = 0x0C
#define NPC_GROUP(npcs, battle) { sizeof(npcs) / sizeof(StaticNpc), (StaticNpc*) &npcs, battle }
typedef struct EnemyDrops {
/* 0x00 */ s8 dropFlags;
/* 0x01 */ s8 itemDropChance; // %
/* 0x02 */ ItemDrop itemDrops[8];
/* 0x32 */ StatDrop heartDrops[8];
/* 0x72 */ StatDrop flowerDrops[8];
/* 0xB2 */ s16 minCoinBonus;
/* 0xB4 */ s16 maxCoinBonus;
/* 0xB6 */ char unk_DE[2];
} EnemyDrops; // size = 0xB8
enum TerritoryShape { SHAPE_CYLINDER, SHAPE_RECT };
typedef struct {
/* 0x00 */ s32 unk_00;
/* 0x04 */ enum TerritoryShape shape;
/* 0x08 */ s32 pointX;
/* 0x0C */ s32 pointZ;
/* 0x10 */ s32 sizeX;
/* 0x14 */ s32 sizeZ;
/* 0x18 */ f32 unk_18;
/* 0x1C */ s16 unk_1C;
} EnemyTerritoryThing; // size = 0x20
typedef struct {
/* 0x00 */ Vec3i point;
/* 0x0C */ s32 wanderSizeX;
/* 0x10 */ s32 wanderSizeZ;
/* 0x14 */ s32 moveSpeedOverride;
/* 0x18 */ enum TerritoryShape wanderShape;
/* 0x1C */ Vec3i detect;
/* 0x28 */ s32 detectSizeX;
/* 0x2C */ s32 detectSizeZ;
/* 0x30 */ enum TerritoryShape detectShape;
/* 0x34 */ s32 isFlying;
} EnemyTerritoryWander; // size = 0x38
typedef struct {
/* 0x00 */ s32 numPoints;
/* 0x04 */ Vec3i points[10];
/* 0x7C */ s32 moveSpeedOverride;
/* 0x80 */ Vec3i detect;
/* 0x8C */ s32 detectSizeX;
/* 0x90 */ s32 detectSizeZ;
/* 0x94 */ enum TerritoryShape detectShape;
/* 0x98 */ s32 isFlying;
} EnemyTerritoryPatrol; // size = 0x9C
typedef union {
EnemyTerritoryWander wander;
EnemyTerritoryPatrol patrol;
char PADDING[0xC0];
} EnemyTerritory; // size = 0xC0
typedef struct Enemy {
/* 0x00 */ s32 flags;
/* 0x04 */ s8 encounterIndex;
/* 0x05 */ s8 encountered;
/* 0x06 */ u8 scriptGroup; /* scripts launched for this npc controller will be assigned this group */
/* 0x07 */ s8 unk_07;
/* 0x08 */ s16 npcID;
/* 0x0A */ s16 spawnPos[3];
/* 0x10 */ Vec3s unk_10;
/* 0x16 */ char unk_16[2];
/* 0x18 */ struct NpcSettings* npcSettings;
/* 0x1C */ EvtSource* initBytecode;
/* 0x20 */ EvtSource* interactBytecode;
/* 0x24 */ EvtSource* aiBytecode;
/* 0x28 */ EvtSource* hitBytecode;
/* 0x2C */ EvtSource* auxBytecode;
/* 0x30 */ EvtSource* defeatBytecode;
/* 0x34 */ struct Evt* initScript;
/* 0x38 */ struct Evt* interactScript;
/* 0x3C */ struct Evt* aiScript;
/* 0x40 */ struct Evt* hitScript;
/* 0x44 */ struct Evt* auxScript;
/* 0x48 */ struct Evt* defeatScript;
/* 0x4C */ s32 initScriptID;
/* 0x50 */ s32 interactScriptID;
/* 0x54 */ s32 aiScriptID;
/* 0x58 */ s32 hitScriptID;
/* 0x5C */ s32 auxScriptID;
/* 0x60 */ s32 defeatScriptID;
/* 0x64 */ UNK_PTR unk_64;
/* 0x68 */ char unk_68[4];
/* 0x6C */ s32 varTable[16];
/* 0xAC */ char unk_AC[4];
/* 0xB0 */ s32 unk_B0;
/* 0xB4 */ s8 unk_B4;
/* 0xB5 */ s8 unk_B5;
/* 0xB6 */ char unk_B6[2];
/* 0xB8 */ EvtSource* unk_B8; // some bytecode
/* 0xBC */ struct Evt* unk_BC; // some script
/* 0xC0 */ s32 unk_C0; // some script ID
/* 0xC4 */ s32 unk_C4;
/* 0xC8 */ s32 unk_C8;
/* 0xCC */ s32* animList;
/* 0xD0 */ EnemyTerritory* territory;
/* 0xD4 */ EnemyDrops* drops;
/* 0xD8 */ u32 tattleMsg;
/* 0xDC */ char unk_DC[20];
} Enemy; // size = 0xF0
s32 func_800490B4(EnemyTerritoryThing* arg0, Enemy* arg1, f32 arg2, f32 arg3, s32 arg4);
/// The default Npc::onUpdate and Npc::onRender callback.
void STUB_npc_callback(void);
void mtx_ident_mirror_y(Matrix4f mtx);
void clear_npcs(void);
/// Points the current NPC list to the world or battle lists depending on game state.
void init_npc_list(void);
/// Iterates over the NPC list, doing absolutely nothing.
/// Presumably did something once upon a time but got commented out.
void npc_iter_no_op(void);
s32 _create_npc(NpcBlueprint* blueprint, s32** animList, s32 skipLoadingAnims);
s32 _create_npc_basic(NpcBlueprint* blueprint);
s32 _create_npc_standard(NpcBlueprint* blueprint, s32** animList);
void _create_npc_partner(NpcBlueprint* blueprint);
void free_npc_by_index(s32 listIndex);
void free_npc(Npc* npc);
Npc* get_npc_by_index(s32 listIndex);
void npc_do_world_collision(Npc* npc);
void npc_do_other_npc_collision(Npc* npc);
/// @returns TRUE if a collision occurred
s32 npc_do_player_collision(Npc* npc);
void npc_do_gravity(Npc* npc);
s32 func_800397E8(Npc* npc, f32 arg1);
/// Updates all NPCs.
void update_npcs(void);
f32 npc_get_render_yaw(void);
void appendGfx_npc(Npc* npc);
/// Renders all NPCs.
void render_npcs(void);
void npc_move_heading(Npc* npc, f32 speed, f32 yaw);
Npc* get_npc_unsafe(s32 npcID);
/// @returns NULL if not found
Npc* get_npc_safe(s32 npcID);
void enable_npc_shadow(Npc* npc);
void disable_npc_shadow(Npc* npc);
void update_npc_blur(Npc* npc);
void appendGfx_npc_blur(Npc* npc);
void npc_enable_collisions(void);
void npc_disable_collisions(void);
void func_8003B1A8(void);
void npc_reload_all(void);
void set_npc_yaw(Npc* npc, f32 yaw);
void npc_set_palswap_mode_A(Npc* npc, s32 arg1);
void npc_set_palswap_mode_B(Npc* npc, s32 arg1);
void func_8003B420(Npc* npc);
void npc_set_palswap_1(Npc* npc, s32 palIndexA, s32 palIndexB, s32 timeHoldA, s32 timeAB);
void npc_set_palswap_2(Npc* npc, s32 timeHoldB, s32 timeBA, s32 palIndexC, s32 palIndexD);
void npc_draw_with_palswap(Npc* npc, s32 arg1, s32 arg2);
void npc_draw_palswap_mode_0(Npc* npc, s32 arg1, s32 arg2);
s32 npc_draw_palswap_mode_1(Npc*, s32, s32);
s32 npc_blend_palette_colors(void);
s32 npc_draw_palswap_mode_2(Npc*, s32, s32, s32);
s32 npc_draw_palswap_mode_4(Npc*, s32, s32);
void npc_set_decoration(Npc* npc, s32 idx, s32 decorationType);
void npc_remove_decoration(Npc* npc, s32 idx);
s32 npc_update_decorations(Npc* npc);
void npc__remove_decoration(Npc* npc, s32 idx);
void npc_reset_current_decoration(Npc* npc, s32 idx);
void npc_update_decoration_none(Npc* npc, s32 idx);
void npc_remove_decoration_none(Npc* npc, s32 idx);
void npc_update_decoration_bowser_aura(Npc* npc, s32 idx);
void npc_remove_decoration_bowser_aura(Npc* npc, s32 idx);
void npc_update_decoration_sweat(Npc* npc, s32 idx);
void npc_remove_decoration_sweat(Npc* npc, s32 idx);
void npc_update_decoration_seeing_stars(Npc* npc, s32 idx);
void npc_remove_decoration_seeing_stars(Npc* npc, s32 idx);
void npc_update_decoration_glow_in_front(Npc* npc, s32 idx);
void npc_remove_decoration_glow_in_front(Npc* npc, s32 idx);
void npc_update_decoration_glow_behind(Npc* npc, s32 idx);
void npc_remove_decoration_glow_behind(Npc* npc, s32 idx);
void npc_update_decoration_charged(Npc* npc, s32 idx);
void npc_remove_decoration_charged(Npc* npc, s32 idx);
void npc__reset_current_decoration(Npc* npc, s32 idx);
/// Finds the closest NPC to a given point within a radius. Ignores Y position.
///
/// NPCs with NPC_FLAG_PARTICLE set are ignored.
/// See also npc_find_closest_simple(), which requires that NPC_FLAG_PARTICLE be set.
///
/// @param x X position
/// @param y Y position (unused)
/// @param z Z position
/// @param radius No NPCs further than this distance will be considered
///
/// @returns NULL if there are no NPCs within radius
Npc* npc_find_closest(f32 x, f32 y, f32 z, f32 radius);
/// Finds the closest simple-hitbox NPC to a given point within a radius. Ignores Y position.
///
/// Only NPCs with NPC_FLAG_PARTICLE set are considered.
/// See also npc_find_closest(), which requires that NPC_FLAG_PARTICLE be unset.
///
/// @param x X position
/// @param y Y position (unused)
/// @param z Z position
/// @param radius No NPCs further than this distance will be considered
///
/// @returns NULL if there are no NPCs within radius
Npc* npc_find_closest_simple(f32 x, f32 y, f32 z, f32 radius);
//s32 npc_find_standing_on_entity();
s32 npc_get_collider_below(Npc* npc);
void func_8003D3BC(Npc* npc);
void func_8003D624(Npc* npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6);
void func_8003D660(Npc* npc, s32 arg1);
void func_8003D788(Npc* npc, s32 arg1);
void func_8003DA38(Npc* npc, s32 arg1);
s32 func_8003DC38(void);
void func_8003DFA0(Npc* npc);
void func_8003E0D4(Npc* npc);
void func_8003E1D0(Npc* npc);
/// Duplicate of set_defeated().
void COPY_set_defeated(s32 mapID, s32 encounterID);
void init_encounter_status(void);
void clear_encounter_status(void);
void func_8003E50C(void);
void func_8003E514(s8 arg0);
void update_encounters(void);
void draw_encounter_ui(void);
void draw_first_strike_ui(void);
void npc_dyn_entity_draw_no_op(void);
void make_npcs(s32 flags, s32 mapID, s32* npcGroupList);
s32 kill_encounter(Enemy* enemy);
void kill_enemy(Enemy* enemy);
/// Binds the specified ai script to the specified enemy
///
/// @param enemy pointer to the enemy to bind the script to
/// @param aiScriptBytecode pointer to the script to be bound.
s32 bind_enemy_ai(Enemy* enemy, EvtSource* aiScriptBytecode);
/// Binds the specified auxillary script to the specified enemy
///
/// @param enemy pointer to the enemy to bind the script to
/// @param auxScriptBytecode pointer to the script to be bound.
s32 bind_enemy_aux(Enemy* enemy, EvtSource* auxScriptBytecode);
/// Binds the specified interact script to the specified enemy
///
/// @param enemy pointer to the enemy to bind the script to
/// @param interactScriptBytecode pointer to the script to be bound.
s32 bind_enemy_interact(Enemy* enemy, EvtSource* interactScriptBytecode);
/// Binds the specified ai script to the npc matching the specified npcId
///
/// @param npcID ID of the desired npc
/// @param npcAiBytecode pointer to the script to be bound.
void bind_npc_ai(s32 npcID, EvtSource* npcAiBytecode);
/// Binds the specified auxillary script to the npc matching the specified npcId
///
/// @param npcID ID of the desired npc
/// @param npcAuxBytecode pointer to the script to be bound.
void bind_npc_aux(s32 npcID, EvtSource* npcAuxBytecode);
/// Binds the specified interact script to the npc matching the specified npcId
///
/// @param npcID ID of the desired npc
/// @param npcInteractBytecode pointer to the script to be bound.
void bind_npc_interact(s32 npcID, EvtSource* npcInteractBytecode);
/// Looks for an enemy matching the specified npcID.
///
/// @param npcID ID of the npc bound to the desired enemy.
///
/// @returns pointer to Enemy struct, if one is found. If one is not found, a panic occurs.
Enemy* get_enemy(s32 npcID);
/// Same as get_enemy(), with the exception of always returning a value if an enemy is not found.
///
/// @param npcID ID of the npc bound to the desired enemy.
///
/// @returns pointer to Enemy struct, if one is found. Otherwise, NULL.
Enemy* get_enemy_safe(s32 npcID);
#endif

View File

@ -176,7 +176,6 @@ void btl_set_popup_duration(s32 duration) {
}
}
#else
void btl_set_popup_duration(s32 duration);
INCLUDE_ASM(void, "17D6A0", btl_set_popup_duration);
#endif

View File

@ -3,6 +3,7 @@
#include "battle/battle.h"
#include "hud_element.h"
#include "message_ids.h"
#include "model.h"
s32 D_80280FC0[] = {
0x000A005A, 0x00000032, 0x0003000B, 0x00000032, 0x0001002D, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000032, 0x00010031, 0x00000032, 0x00010031, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000032, 0x00010032, 0x00000032, 0x00010032, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000032, 0x0003000A, 0x00000032, 0x0003000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000050, 0x0003000A, 0x00000014, 0x0003000B, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@ -1008,8 +1009,8 @@ ActorPartDesc bMarioParts[] = {
Vec3s D_80283524[] = {
{ 0x0005, 0x0000, 0xFFEC },
{ 0x002D, 0x0000, 0xFFFB },
{ 0x0055, 0x0000, 0x000A },
{ 0x007D, 0x0000, 0x0019 },
{ 0x0055, 0x0000, 0x000A },
{ 0x007D, 0x0000, 0x0019 },
{ 0x000A, 0x0032, 0xFFEC },
{ 0x0032, 0x002D, 0xFFFB },
{ 0x005A, 0x0032, 0x000A },
@ -1068,6 +1069,7 @@ s32 bActorMessages[] = {
s32 D_802838F8 = 0;
void create_target_list(Actor* actor, s32 arg1);
INCLUDE_ASM(s32, "190B20", create_target_list);
void player_create_target_list(Actor* actor) {
@ -1407,7 +1409,7 @@ s32 inflict_partner_ko(Actor* target, s32 statusTypeKey, s32 duration) {
return TRUE;
}
s32 get_defense(Actor* actor, s32* defenseTable, s32 elementFlags) {
s32 get_defense(Actor* actor, DictionaryEntry* defenseTable, s32 elementFlags) {
s32 defense;
s32 minDefense = 0xFF;
@ -1712,7 +1714,7 @@ void remove_player_buffs(s32 buffs) {
battleStatus->cloudNineTurnsLeft = 0;
battleStatus->unk_43C->unk_0C->unk_1A = 0;
remove_effect(battleStatus->cloudNineEffect);
battleStatus->cloudNineEffect = 0;
battleStatus->cloudNineEffect = NULL;
}
if (partner != NULL && (buffs & 0x10000)) {

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
#include "effects.h"
extern s16 D_8009A668;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
extern s32 D_800A0F40;
extern PopupMessage D_800A0BC0[32];

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
INCLUDE_ASM(s32, "23680", spawn_drops);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
void func_8004A6F0(Evt* script) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);

View File

@ -9,9 +9,19 @@ extern s32 D_8010C958;
extern s32 D_802BDF60;
void func_802B72C0_E22870();
void func_802B72C0_E22870(void);
s32 func_800E0208(void);
void func_800E0330(void);
void func_800E0374(void);
void func_800E04D0(void);
void func_800E0514(void);
void func_800E0658(void);
void func_800E069C(void);
void func_800E0AD0(void);
void func_800E0B14(void);
void update_partner_timers(void);
void update_player_shadow(void);
s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, f32* outLength, f32* hitRx, f32* hitRz,
f32* hitDirX, f32* hitDirZ) {

View File

@ -72,7 +72,7 @@ INCLUDE_ASM(s32, "7bb60_len_41b0", phys_peach_update);
void set_action_state(s32 actionState) {
PlayerStatus* playerStatus = &gPlayerStatus;
PlayerData* playerData = &gPlayerData;
UNK_TYPE* unknownStruct = &D_8010F250;
Temp8010F250* unknownStruct = &D_8010F250;
if (playerStatus->flags & 0x200) {
playerStatus->flags &= ~0x200;
@ -144,8 +144,8 @@ void set_action_state(s32 actionState) {
playerStatus->flags &= ~0x20000;
playerStatus->animFlags &= ~0x10000;
if (unknownStruct[0xC]) {
sfx_stop_sound(unknownStruct[0xC]);
if (unknownStruct->unk_30 != 0) {
sfx_stop_sound(unknownStruct->unk_30);
}
if (playerStatus->unk_D8) {

View File

@ -1,107 +1,880 @@
#include "common.h"
#include "model.h"
s32 D_8014C250[] = {0x0001003C, 0x00000000, 0x00000000, 0x00000000};
s8 D_8014C250[] = {0x00, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
extern s32 gAnimCount;
typedef struct DisplayListBufferHandle {
/* 0x0 */ s32 mode;
/* 0x4 */ Gfx* addr;
} DisplayListBufferHandle; // size = 0x8
typedef DisplayListBufferHandle AnimatedMeshVertexCopyList[0x60];
extern AnimatedMeshVertexCopyList D_801533C0;
extern AnimatedMeshVertexCopyList D_801536C0;
extern AnimatedMeshList D_801539C0;
extern AnimatedMeshList D_80153A00;
extern s32 gAnimModelFogEnabled;
extern s32 gAnimModelFogR;
extern s32 gAnimModelFogG;
extern s32 gAnimModelFogB;
extern s32 gAnimModelFogA;
extern s32 gAnimModelFogStart;
extern s32 gAnimModelFogEnd;
extern s32 D_80153A60;
extern Matrix4f gAnimRotMtx;
extern Matrix4f gAnimScaleMtx;
extern Matrix4f gAnimTranslateMtx;
extern Matrix4f gAnimRotScaleMtx;
extern StaticAnimatorNode** gAnimTreeRoot;
// reg swap
#ifdef NON_MATCHING
Vtx* animator_copy_vertices_to_buffer(ModelAnimator* animator, AnimatorNode* node, Vec3s* buffer, s32 vtxCount,
s32 overhead, s32 startIdx) {
DisplayListBufferHandle* handle;
Vtx* bufferMem;
Vtx* phi_v1;
s32 i;
for (i = 0; i < ARRAY_COUNT(D_801533C0); i++) {
handle = &D_801533C0[i];
if (handle->mode < 0) {
break;
}
}
ASSERT(i < ARRAY_COUNT(D_801533C0));
bufferMem = general_heap_malloc((vtxCount + overhead) * sizeof(*bufferMem));
handle->addr = bufferMem;
ASSERT(bufferMem != NULL);
handle->mode = 3;
phi_v1 = &node->fcData.vtxList[startIdx];
if (animator->vertexArray != NULL) {
buffer = ((s32)buffer & 0xFFFFFF) + (s32)animator->vertexArray;
}
for (i = 0; i < vtxCount; i++) {
*bufferMem = *phi_v1;
bufferMem->v.ob[0] = buffer->x;
bufferMem->v.ob[1] = buffer->y;
bufferMem->v.ob[2] = buffer->z;
bufferMem++;
buffer++;
phi_v1++;
}
return handle->addr;
}
#else
INCLUDE_ASM(s32, "B4580", animator_copy_vertices_to_buffer);
#endif
INCLUDE_ASM(s32, "B4580", animator_make_mirrorZ);
void animator_make_mirrorZ(Matrix4f mtx) {
guMtxIdentF(mtx);
mtx[0][0] = 1.0f;
mtx[1][1] = 1.0f;
mtx[2][2] = -1.0f;
mtx[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "B4580", animator_make_mirrorY);
void animator_make_mirrorY(Matrix4f mtx) {
guMtxIdentF(mtx);
mtx[0][0] = 1.0f;
mtx[1][1] = -1.0f;
mtx[2][2] = 1.0f;
mtx[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "B4580", animator_make_mirrorX);
void animator_make_mirrorX(Matrix4f mtx) {
guMtxIdentF(mtx);
mtx[0][0] = -1.0f;
mtx[1][1] = 1.0f;
mtx[2][2] = 1.0f;
mtx[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "B4580", animator_make_identity);
void animator_make_identity(Matrix4f mtx) {
guMtxIdentF(mtx);
mtx[0][0] = 1.0f;
mtx[1][1] = 1.0f;
mtx[2][2] = 1.0f;
mtx[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "B4580", get_animator_child_with_id);
AnimatorNode* get_animator_child_with_id(AnimatorNode* node, s32 id) {
s32 i;
INCLUDE_ASM(s32, "B4580", get_animator_child_for_model);
if (node->uniqueIndex == id) {
return node;
}
INCLUDE_ASM(s32, "B4580", free_animator_nodes);
for (i = 0; i < ARRAY_COUNT(node->children); i++) {
if (node->children[i] != NULL) {
AnimatorNode* child = get_animator_child_with_id(node->children[i], id);
INCLUDE_ASM(s32, "B4580", clear_animator_list);
if (child != NULL) {
return child;
}
INCLUDE_ASM(s32, "B4580", reset_animator_list);
}
}
INCLUDE_ASM(s32, "B4580", delete_model_animator_node);
return NULL;
}
INCLUDE_ASM(s32, "B4580", delete_model_animator_nodes);
AnimatorNode* get_animator_child_for_model(AnimatorNode* node, s32 id) {
s32 i;
INCLUDE_ASM(s32, "B4580", delete_model_animator);
if (node->fcData.modelID == id) {
return node;
}
INCLUDE_ASM(s32, "B4580", create_model_animator);
for (i = 0; i < ARRAY_COUNT(node->children); i++) {
if (node->children[i] != NULL) {
AnimatorNode* child = get_animator_child_for_model(node->children[i], id);
INCLUDE_ASM(s32, "B4580", create_mesh_animator);
if (child != NULL) {
return child;
}
INCLUDE_ASM(s32, "B4580", add_anim_node);
}
}
INCLUDE_ASM(s32, "B4580", update_model_animator);
return NULL;
}
INCLUDE_ASM(s32, "B4580", func_8011EA54);
void free_animator_nodes(AnimatorNode* root) {
s32 i;
for (i = 0; i < ARRAY_COUNT(root->children); i++) {
if (root->children[i] != NULL) {
free_animator_nodes(root->children[i]);
}
}
heap_free(root);
}
void clear_animator_list(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
gCurrentAnimMeshListPtr = &D_801539C0;
for (i = 0; i < ARRAY_COUNT(D_801533C0); i++) {
D_801533C0[i].mode = -1;
}
for (i = 0; i < ARRAY_COUNT(D_801536C0); i++) {
D_801536C0[i].mode = -1;
}
} else {
gCurrentAnimMeshListPtr = &D_80153A00;
}
for (i = 0; i < ARRAY_COUNT(*gCurrentAnimMeshListPtr); i++) {
(*gCurrentAnimMeshListPtr)[i] = NULL;
}
gAnimModelFogR = 10;
gAnimModelFogG = 10;
gAnimModelFogB = 10;
gAnimModelFogA = 10;
gAnimModelFogStart = 800;
gAnimCount = 0;
gAnimModelFogEnabled = 0;
gAnimModelFogEnd = 1000;
}
void reset_animator_list(void) {
if (!gGameStatusPtr->isBattle) {
gCurrentAnimMeshListPtr = &D_801539C0;
} else {
gCurrentAnimMeshListPtr = &D_80153A00;
}
gAnimModelFogR = 10;
gAnimModelFogG = 10;
gAnimModelFogB = 10;
gAnimModelFogA = 10;
gAnimModelFogStart = 800;
gAnimCount = 0;
gAnimModelFogEnabled = 0;
gAnimModelFogEnd = 1000;
}
void delete_model_animator_node(AnimatorNode* node) {
s32 i;
node->flags = 0;
for (i = 0; i < ARRAY_COUNT(node->children); i++) {
if (node->children[i] != NULL) {
delete_model_animator_node(node->children[i]);
node->children[i] = NULL;
}
}
heap_free(node);
}
void delete_model_animator_nodes(ModelAnimator* animator) {
animator->nextUniqueID = 0;
if (animator->rootNode != NULL) {
delete_model_animator_node(animator->rootNode);
animator->rootNode = NULL;
}
}
void delete_model_animator(ModelAnimator* animator) {
s32 i;
animator->nextUniqueID = 0;
if (animator->rootNode != NULL) {
delete_model_animator_node(animator->rootNode);
animator->rootNode = NULL;
for (i = 0; i < ARRAY_COUNT(*gCurrentAnimMeshListPtr); i++) {
if ((*gCurrentAnimMeshListPtr)[i] == animator) {
(*gCurrentAnimMeshListPtr)[i] = NULL;
break;
}
}
heap_free(animator);
gAnimCount--;
}
}
s32 create_model_animator(s8* animPos) {
ModelAnimator* animator;
s32 i, j;
for (i = 0; i < ARRAY_COUNT(*gCurrentAnimMeshListPtr); i++) {
if ((*gCurrentAnimMeshListPtr)[i] == NULL) {
break;
}
}
ASSERT(i < ARRAY_COUNT(*gCurrentAnimMeshListPtr));
(*gCurrentAnimMeshListPtr)[i] = animator = heap_malloc(sizeof(*animator));
gAnimCount += 1;
ASSERT(animator != NULL);
animator->flags = 0x40 | 0x10 | 0x4 | 0x2 | 0x1;
animator->renderMode = RENDER_MODE_ALPHATEST;
animator->nextUpdateTime = 1.0f;
animator->timeScale = 1.0f;
animator->animReadPos = animPos;
if (animPos == NULL) {
animator->animReadPos = D_8014C250;
}
animator->savedReadPos = animPos;
animator->animationBuffer = NULL;
animator->vertexArray = NULL;
animator->fpRenderCallback = NULL;
animator->rootNode = NULL;
animator->nextUniqueID = 0;
for (j = 0; j < ARRAY_COUNT(animator->staticNodeIDs); j++) {
animator->staticNodeIDs[j] = j + 1;
}
if (gGameStatusPtr->isBattle) {
i |= 0x800;
}
return i;
}
s32 create_mesh_animator(s32 animPos, s8* animBuffer) {
ModelAnimator* animator;
s32 i, j;
for (i = 0; i < ARRAY_COUNT(*gCurrentAnimMeshListPtr); i++) {
if ((*gCurrentAnimMeshListPtr)[i] == NULL) {
break;
}
}
ASSERT(i < ARRAY_COUNT(*gCurrentAnimMeshListPtr));
(*gCurrentAnimMeshListPtr)[i] = animator = heap_malloc(sizeof(*animator));
gAnimCount += 1;
ASSERT(animator != NULL);
animator->flags = 0x40 | 0x10 | 0x4 | 0x2 | 0x1;
animator->renderMode = RENDER_MODE_ALPHATEST;
animator->vertexArray = NULL;
animator->fpRenderCallback = NULL;
animator->rootNode = NULL;
animator->nextUniqueID = 0;
animator->animationBuffer = animBuffer;
animator->nextUpdateTime = 1.0f;
animator->timeScale = 1.0f;
animPos = (animPos & 0xFFFFFF) + (s32)animator->animationBuffer;
animator->animReadPos = (s8*)animPos;
animator->savedReadPos = (s8*)animPos;
for (j = 0; j < ARRAY_COUNT(animator->staticNodeIDs); j++) {
animator->staticNodeIDs[j] = j + 1;
}
if (gGameStatusPtr->isBattle) {
i |= 0x800;
}
return i;
}
AnimatorNode* add_anim_node(ModelAnimator* animator, s32 parentNodeID, AnimatorNodeBlueprint* nodeBP) {
AnimatorNode* ret;
AnimatorNode* child;
s32 nextUniqueID;
s32 nullRootNode;
s32 i;
ret = heap_malloc(sizeof(*ret));
ASSERT(ret != NULL);
ret->flags = 0x10;
ret->displayList = nodeBP->displayList;
ret->basePos.x = nodeBP->basePos.x;
ret->basePos.y = nodeBP->basePos.y;
ret->basePos.z = nodeBP->basePos.z;
ret->pos.x = 0.0f;
ret->pos.y = 0.0f;
ret->pos.z = 0.0f;
ret->rotation.x = nodeBP->rotation.x;
ret->rotation.y = nodeBP->rotation.y;
ret->rotation.z = nodeBP->rotation.z;
ret->scale.x = 1.0f;
ret->scale.y = 1.0f;
ret->scale.z = 1.0f;
ret->vertexStartOffset = -1;
for (i = 0; i < ARRAY_COUNT(ret->children); i++) {
ret->children[i] = NULL;
}
nextUniqueID = animator->nextUniqueID;
nextUniqueID = nextUniqueID + 1;
if (parentNodeID == 0) {
s32 nullRootNode = animator->rootNode == NULL; // todo ???
ret->uniqueIndex = nextUniqueID;
if (nullRootNode) {
animator->rootNode = ret;
} else {
child = get_animator_child_with_id(animator->rootNode, 1);
ASSERT(child != NULL);
for (i = 0; i < ARRAY_COUNT(child->children); i++) {
if (child->children[i] == NULL) {
child->children[i] = ret;
break;
}
}
ASSERT(i < ARRAY_COUNT(child->children));
}
} else {
ret->uniqueIndex = nextUniqueID;
child = get_animator_child_with_id(animator->rootNode, parentNodeID);
ASSERT(child != NULL);
for (i = 0; i < ARRAY_COUNT(child->children); i++) {
if (child->children[i] == NULL) {
child->children[i] = ret;
break;
}
}
ASSERT(i < ARRAY_COUNT(child->children));
}
animator->nextUniqueID = nextUniqueID;
return ret;
}
void update_model_animator(s32 animatorID) {
if (!gGameStatusPtr->isBattle || animatorID & 0x800) {
ModelAnimator* animator;
animatorID &= ~0x800;
animator = (*gCurrentAnimMeshListPtr)[animatorID];
if (animator != NULL && animator->flags != 0) {
s32 temp = 0;
if (!(animator->flags & 0x40000)) {
animator->flags &= ~0x40;
animator->nextUpdateTime -= animator->timeScale;
if (animator->nextUpdateTime <= 0.0f) {
if (!(animator->flags & 0x8000)) {
do {
temp = step_model_animator(animator);
} while (temp > 0);
} else {
animator->nextUpdateTime = 1.0f;
reload_mesh_animator_tree(animator);
do {
temp = step_mesh_animator(animator);
} while (temp > 0);
}
}
if (temp != -1) {
s32 i;
animator_update_model_transforms(animator, NULL);
for (i = 0; i < ARRAY_COUNT(D_801533C0); i++) {
if (D_801533C0[i].mode >= 0) {
D_801533C0[i].mode--;
if (D_801533C0[i].mode == 0) {
D_801533C0[i].mode = -1;
general_heap_free(D_801533C0[i].addr);
}
}
}
for (i = 0; i < ARRAY_COUNT(D_801536C0); i++) {
if (D_801536C0[i].mode >= 0) {
D_801536C0[i].mode--;
if (D_801536C0[i].mode == 0) {
D_801536C0[i].mode = -1;
general_heap_free(D_801536C0[i].addr);
}
}
}
}
}
}
}
}
void update_model_animator_with_transform(s32 animatorID, Mtx* mtx) {
if (!gGameStatusPtr->isBattle || animatorID & 0x800) {
ModelAnimator* animator;
animatorID &= ~0x800;
animator = (*gCurrentAnimMeshListPtr)[animatorID];
if (animator != NULL && animator->flags != 0) {
s32 temp = 0;
if (!(animator->flags & 0x40000)) {
animator->flags &= ~0x40;
animator->nextUpdateTime -= animator->timeScale;
if (animator->nextUpdateTime <= 0.0f) {
if (!(animator->flags & 0x8000)) {
do {
temp = step_model_animator(animator);
} while (temp > 0);
} else {
animator->nextUpdateTime = 1.0f;
reload_mesh_animator_tree(animator);
do {
temp = step_mesh_animator(animator);
} while (temp > 0);
}
}
if (temp != -1) {
s32 i;
animator_update_model_transforms(animator, mtx);
for (i = 0; i < ARRAY_COUNT(D_801533C0); i++) {
if (D_801533C0[i].mode >= 0) {
D_801533C0[i].mode--;
if (D_801533C0[i].mode == 0) {
D_801533C0[i].mode = -1;
general_heap_free(D_801533C0[i].addr);
}
}
}
for (i = 0; i < ARRAY_COUNT(D_801536C0); i++) {
if (D_801536C0[i].mode >= 0) {
D_801536C0[i].mode--;
if (D_801536C0[i].mode == 0) {
D_801536C0[i].mode = -1;
general_heap_free(D_801536C0[i].addr);
}
}
}
}
}
}
}
}
INCLUDE_ASM(s32, "B4580", step_model_animator);
INCLUDE_ASM(s32, "B4580", animator_update_model_transforms);
void animator_update_model_transforms(ModelAnimator* animator, Mtx* rootTransform) {
Matrix4f flipMtx;
INCLUDE_ASM(s32, "B4580", animator_node_update_model_transform);
if (animator->rootNode != NULL) {
switch (animator->flags & 0x700) {
case 0x100:
animator_make_mirrorZ(flipMtx);
break;
case 0x200:
animator_make_mirrorY(flipMtx);
break;
case 0x400:
animator_make_mirrorX(flipMtx);
break;
default:
animator_make_identity(flipMtx);
break;
}
animator_node_update_model_transform(animator, flipMtx, animator->rootNode, rootTransform);
}
}
INCLUDE_ASM(s32, "B4580", render_animated_model);
void animator_node_update_model_transform(ModelAnimator* animator, f32 (*flipMtx)[4], AnimatorNode* node,
Mtx* rootTransform) {
Matrix4f sp10;
s32 i;
INCLUDE_ASM(s32, "B4580", render_animated_model_with_vertices);
guRotateRPYF(gAnimRotMtx, clamp_angle(node->rotation.x), clamp_angle(node->rotation.y), clamp_angle(node->rotation.z));
guScaleF(gAnimScaleMtx, node->scale.x, node->scale.y, node->scale.z);
guTranslateF(gAnimTranslateMtx, node->basePos.x + node->pos.x, node->basePos.y + node->pos.y, node->basePos.z + node->pos.z);
guMtxCatF(gAnimScaleMtx, gAnimRotMtx, gAnimRotScaleMtx);
guMtxCatF(gAnimRotScaleMtx, gAnimTranslateMtx, sp10);
if (!(animator->flags & 0x20000)) {
guMtxCatF(sp10, flipMtx, sp10);
}
copy_matrix(sp10, node->mtx);
if (node->flags & 0x1000) {
Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(node->fcData.modelID));
copy_matrix(sp10, model->transformMatrix);
guMtxL2F(sp10, rootTransform);
guMtxCatF(model->transformMatrix, sp10, model->transformMatrix);
model->flags |= 0x1000;
}
for (i = 0; i < ARRAY_COUNT(node->children); i++) {
if (node->children[i] != NULL) {
animator_node_update_model_transform(animator, sp10, node->children[i], rootTransform);
}
}
}
void render_animated_model(s32 animatorID, Mtx* rootTransform) {
RenderTask rt;
RenderTask* rtPtr = &rt;
if (!gGameStatusPtr->isBattle || animatorID & 0x800) {
ModelAnimator* animator;
animatorID &= ~0x800;
animator = (*gCurrentAnimMeshListPtr)[animatorID];
if (animator != NULL && animator->flags != 0 && !(animator->flags & 0x40) &&
animator->flags & (1 << gCurrentCamID) && !(animator->flags & 0x80))
{
animator->mtx = *rootTransform;
animator->vertexArray = NULL;
rtPtr->appendGfxArg = animator;
rtPtr->appendGfx = &appendGfx_animator;
rtPtr->distance = 0;
rtPtr->renderMode = animator->renderMode;
queue_render_task(rtPtr);
}
}
}
void render_animated_model_with_vertices(s32 animatorID, Mtx* rootTransform, s32 vtxSegment, Vtx* vertexArray) {
RenderTask rt;
RenderTask* rtPtr = &rt;
if (!gGameStatusPtr->isBattle || animatorID & 0x800) {
ModelAnimator* animator;
animatorID &= ~0x800;
animator = (*gCurrentAnimMeshListPtr)[animatorID];
if (animator != NULL && animator->flags != 0 && !(animator->flags & 0x40) &&
animator->flags & (1 << gCurrentCamID) && !(animator->flags & 0x80))
{
animator->mtx = *rootTransform;
D_80153A60 = vtxSegment;
animator->vertexArray = vertexArray;
rtPtr->appendGfxArg = animator;
rtPtr->appendGfx = &appendGfx_animator;
rtPtr->distance = 0;
rtPtr->renderMode = animator->renderMode;
queue_render_task(rtPtr);
}
}
}
INCLUDE_ASM(s32, "B4580", appendGfx_animator);
INCLUDE_ASM(s32, "B4580", appendGfx_animator_node);
AnimatorNode* get_animator_node_for_tree_index(ModelAnimator* animator, s32 treeIndex);
INCLUDE_ASM(s32, "B4580", get_animator_node_for_tree_index);
// AnimatorNode* get_animator_node_for_tree_index(ModelAnimator* animator, s32 arg1) {
// return get_animator_child_with_id(animator->rootNode, animator->unk_14[arg1]);
// }
INCLUDE_ASM(s32, "B4580", get_animator_node_with_id);
AnimatorNode* get_animator_node_with_id(ModelAnimator* animator, s32 id) {
return get_animator_child_for_model(animator->rootNode, id);
}
INCLUDE_ASM(s32, "B4580", set_animator_tree_to_node_map);
void set_animator_tree_to_node_map(ModelAnimator* animator, s32* nodeIDs, s32 count) {
s32 i;
AnimatedMesh* get_animator_by_index(s32 animModelID) {
for (i = 0; i < count; i++) {
animator->staticNodeIDs[i] = *nodeIDs;
nodeIDs++;
}
}
ModelAnimator* get_animator_by_index(s32 animModelID) {
return (*gCurrentAnimMeshListPtr)[animModelID & ~0x800];
}
AnimatedMesh* set_animator_render_callback(s32 animModelID, s32 arg1, s32 arg2) {
AnimatedMesh* ret = (*gCurrentAnimMeshListPtr)[animModelID & ~0x800];
ModelAnimator* set_animator_render_callback(s32 animModelID, s32 callbackArg, s32 callbackFunc) {
ModelAnimator* ret = (*gCurrentAnimMeshListPtr)[animModelID & ~0x800];
ret->unk_2D4 = arg2;
ret->unk_2D8 = arg1;
ret->fpRenderCallback = callbackFunc;
ret->renderCallbackArg = callbackArg;
return ret;
}
INCLUDE_ASM(s32, "B4580", enable_anim_model_fog);
void enable_anim_model_fog(void) {
gAnimModelFogEnabled = TRUE;
}
INCLUDE_ASM(s32, "B4580", disable_anim_model_fog);
void disable_anim_model_fog(void) {
gAnimModelFogEnabled = FALSE;
}
INCLUDE_ASM(s32, "B4580", set_anim_model_fog_dist);
void set_anim_model_fog_dist(s32 start, s32 end) {
gAnimModelFogStart = start;
gAnimModelFogEnd = end;
}
INCLUDE_ASM(s32, "B4580", set_anim_model_fog_color);
void set_anim_model_fog_color(s32 r, s32 g, s32 b, s32 a) {
gAnimModelFogR = r;
gAnimModelFogG = g;
gAnimModelFogB = b;
gAnimModelFogA = a;
}
INCLUDE_ASM(s32, "B4580", is_anim_model_fog_enabled);
s32 is_anim_model_fog_enabled(void) {
return gAnimModelFogEnabled;
}
INCLUDE_ASM(s32, "B4580", get_anim_model_fog_distance);
void get_anim_model_fog_distance(s32* start, s32* end) {
*start = gAnimModelFogStart;
*end = gAnimModelFogEnd;
}
INCLUDE_ASM(s32, "B4580", get_anim_model_fog_color);
void get_anim_model_fog_color(s32* r, s32* g, s32* b, s32* a) {
*r = gAnimModelFogR;
*g = gAnimModelFogG;
*b = gAnimModelFogB;
*a = gAnimModelFogA;
}
INCLUDE_ASM(s32, "B4580", set_animator_flags);
void set_animator_flags(s32 index, s32 bits) {
ModelAnimator* animator = (*gCurrentAnimMeshListPtr)[index & ~0x800];
INCLUDE_ASM(s32, "B4580", clear_animator_flags);
animator->flags |= bits;
}
INCLUDE_ASM(s32, "B4580", play_model_animation);
void clear_animator_flags(s32 index, s32 bits) {
ModelAnimator* animator = (*gCurrentAnimMeshListPtr)[index & ~0x800];
INCLUDE_ASM(s32, "B4580", play_model_animation_starting_from);
animator->flags &= ~bits;
}
INCLUDE_ASM(s32, "B4580", load_model_animator_node);
void play_model_animation(s32 index, s32 animPos) {
ModelAnimator* animator = (*gCurrentAnimMeshListPtr)[index & ~0x800];
INCLUDE_ASM(s32, "B4580", load_model_animator_tree);
if (animator->animationBuffer != NULL) {
animPos = (animPos & 0xFFFFFF) + (s32)animator->animationBuffer; // TODO: array access?
}
animator->animReadPos = (s8*)animPos;
animator->savedReadPos = (s8*)animPos;
animator->treeIndexPos = 0;
animator->nextUpdateTime = 1.0f;
}
INCLUDE_ASM(s32, "B4580", load_mesh_animator_node);
void play_model_animation_starting_from(s32 index, s32 animPos, s32 framesToSkip) {
s32 indexMasked = index & ~0x800;
ModelAnimator* animator = (*gCurrentAnimMeshListPtr)[indexMasked];
s32 i;
INCLUDE_ASM(s32, "B4580", load_mesh_animator_tree);
if (animator->animationBuffer != NULL) {
animPos = (animPos & 0xFFFFFF) + (s32)animator->animationBuffer; // TODO: array access?
}
INCLUDE_ASM(s32, "B4580", reload_mesh_animator_node);
animator->animReadPos = (s8*)animPos;
animator->savedReadPos = (s8*)animPos;
animator->treeIndexPos = 0;
animator->nextUpdateTime = 1.0f;
INCLUDE_ASM(s32, "B4580", reload_mesh_animator_tree);
for (i = 0; i < framesToSkip; i++) {
update_model_animator(indexMasked);
}
}
void load_model_animator_node(StaticAnimatorNode* node, ModelAnimator* animator, s32 parentNodeID, s32* treeIndexToNodeIDs) {
AnimatorNodeBlueprint bp;
AnimatorNodeBlueprint* bpPtr = &bp;
AnimatorNode* newNode;
s32 i;
if (node != NULL) {
bpPtr->displayList = node->displayList;
bpPtr->basePos.x = 0.0f;
bpPtr->basePos.y = 0.0f;
bpPtr->basePos.z = 0.0f;
bpPtr->rotation.x = ((f32) node->rot.x * 180.0) / 32767.0;
bpPtr->rotation.y = ((f32) node->rot.y * 180.0) / 32767.0;
bpPtr->rotation.z = ((f32) node->rot.z * 180.0) / 32767.0;
newNode = add_anim_node(animator, parentNodeID, bpPtr);
if (node->modelID != 0) {
newNode->fcData.modelID = node->modelID - 1;
newNode->flags |= 0x1000;
}
i = 0;
while (gAnimTreeRoot[i] != node) {
i++;
}
treeIndexToNodeIDs[i] = newNode->uniqueIndex;
if (node->child != NULL) {
load_model_animator_node(node->child, animator, newNode->uniqueIndex, treeIndexToNodeIDs);
}
if (node->sibling != NULL) {
load_model_animator_node(node->sibling, animator, parentNodeID, treeIndexToNodeIDs);
}
}
}
void load_model_animator_tree(s32 index, StaticAnimatorNode** tree) {
ModelAnimator* animator = (*gCurrentAnimMeshListPtr)[index & ~0x800];
s32 nodeIDs[ARRAY_COUNT(animator->staticNodeIDs)];
if (animator != NULL && animator->flags != 0) {
gAnimTreeRoot = tree;
load_model_animator_node(*tree, animator, 0, nodeIDs);
set_animator_tree_to_node_map(animator, nodeIDs, ARRAY_COUNT(animator->staticNodeIDs));
}
}
void load_mesh_animator_node(StaticAnimatorNode* node, ModelAnimator* animator, s32 parentNodeID, s32* treeIndexToNodeIDs) {
if (node != NULL) {
if (node->child != NULL && parentNodeID == 0) {
load_mesh_animator_node(node->child, animator, 0, treeIndexToNodeIDs);
} else {
do {
animator->staticNodes[parentNodeID] = node;
node = node->sibling;
parentNodeID++;
} while (node != NULL);
}
}
}
void load_mesh_animator_tree(s32 index, StaticAnimatorNode** tree) {
s32 indexMasked = index & ~0x800;
ModelAnimator* animator = (*gCurrentAnimMeshListPtr)[indexMasked];
s32 nodeIDs[ARRAY_COUNT(animator->staticNodeIDs)];
s32 i;
if (animator != NULL && animator->flags != 0) {
if ((*tree)->vertexStartOffset == 0) {
load_model_animator_tree(indexMasked, tree);
return;
}
gAnimTreeRoot = tree;
animator->staticRoot = tree;
animator->treeIndexPos = 0;
animator->savedTreePos = 0;
for (i = 0; i < ARRAY_COUNT(animator->staticNodes); i++) {
animator->staticNodes[i] = NULL;
}
load_mesh_animator_node(*gAnimTreeRoot, animator, 0, nodeIDs);
animator->flags |= 0x8000;
}
}
void reload_mesh_animator_node(StaticAnimatorNode* node, ModelAnimator* animator, s32 parentNodeID, s32* treeIndexToNodeIDs) {
AnimatorNodeBlueprint bp;
AnimatorNodeBlueprint* bpPtr = &bp;
AnimatorNode* newNode;
s32 i;
if (node != NULL) {
bpPtr->displayList = node->displayList;
bpPtr->basePos.x = 0.0f;
bpPtr->basePos.y = 0.0f;
bpPtr->basePos.z = 0.0f;
bpPtr->rotation.x = ((f32) node->rot.x * 180.0) / 32767.0;
bpPtr->rotation.y = ((f32) node->rot.y * 180.0) / 32767.0;
bpPtr->rotation.z = ((f32) node->rot.z * 180.0) / 32767.0;
newNode = add_anim_node(animator, parentNodeID, bpPtr);
newNode->vertexStartOffset = node->vertexStartOffset;
newNode->fcData.vtxList = node->vtxList;
i = 0;
while (gAnimTreeRoot[i] != node) {
i++;
}
treeIndexToNodeIDs[i] = newNode->uniqueIndex;
if (node->child != NULL) {
reload_mesh_animator_node(node->child, animator, newNode->uniqueIndex, treeIndexToNodeIDs);
}
}
}
void reload_mesh_animator_tree(ModelAnimator* animator) {
s32 nodeIDs[ARRAY_COUNT(animator->staticNodeIDs)];
s32 i;
delete_model_animator_nodes(animator);
gAnimTreeRoot = animator->staticRoot;
for (i = 0; i < ARRAY_COUNT(animator->staticNodes); i++) {
nodeIDs[i] = 0;
}
reload_mesh_animator_node(animator->staticNodes[animator->treeIndexPos], animator, 0, nodeIDs);
nodeIDs[0] = -1;
set_animator_tree_to_node_map(animator, nodeIDs, ARRAY_COUNT(nodeIDs));
}
INCLUDE_ASM(s32, "B4580", step_mesh_animator);

View File

@ -187,6 +187,7 @@ INCLUDE_ASM(s32, "C50A0", item_entity_update);
INCLUDE_ASM(s32, "C50A0", update_item_entities);
INCLUDE_ASM(s32, "C50A0", appendGfx_item_entity);
void appendGfx_item_entity(ItemEntity* itemEntity);
INCLUDE_ASM(s32, "C50A0", draw_item_entities);
@ -244,7 +245,21 @@ void remove_item_entity_by_index(s32 index) {
D_801565A4 = 0;
}
INCLUDE_ASM(s32, "C50A0", func_80133A94);
void func_80133A94(s32 idx, s32 itemID) {
ItemEntity* item = D_801565A0[idx];
item->itemID = itemID;
item->flags |= 0x4000;
item->flags &= ~0x40000;
if (gItemTable[itemID].typeFlags & 0x1000) {
item->flags |= 0x40000;
item->flags &= ~0x4000;
}
item_entity_load(item);
}
s32 test_item_player_collision(ItemEntity* itemEntity);
INCLUDE_ASM(s32, "C50A0", test_item_player_collision);

View File

@ -37,11 +37,11 @@ ApiStatus func_80238A6C_70C77C(Evt* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "battle/partner/lakilester", func_80238B50_70C860);
ApiStatus func_80238C14_70C924(Evt* script, s32 isInitialCall) {
s32 effect = gBattleStatus.cloudNineEffect;
EffectInstance* effect = gBattleStatus.cloudNineEffect;
if (effect != NULL) {
remove_effect(effect);
gBattleStatus.cloudNineEffect = 0;
gBattleStatus.cloudNineEffect = NULL;
gBattleStatus.cloudNineTurnsLeft = 0;
return ApiStatus_DONE2;
}

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(Dist3D)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(FadeBackgroundToBlack)(Evt* script, s32 isInitialCall) {
if (isInitialCall) {

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(FreeIcon)(Evt* script, s32 isInitialCall) {
free_hud_element(evt_get_variable(script, *script->ptrReadPos));

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetItemEntityPosition)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "model.h"
ApiStatus N(GetModelPos)(Evt* script, s32 isInitialCall) {
Model* model = get_model_from_list_index(get_model_list_index_from_tree_index(script->varTable[10]));

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetSelectedMoveID)(Evt* script, s32 isInitialCall) {
evt_set_variable(script, *script->ptrReadPos, gBattleStatus.selectedMoveID);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(IsGameStatusUnkAA_1)(Evt* script, s32 isInitialCall) {
script->varTable[0] = 0;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(IsSaveVar123)(Evt* script, s32 isInitialCall) {
script->varTable[0] = 0;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
extern s16 D_802809F8;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetBackgroundAlpha)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(StartRumbleWithParams)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(UnkBattleFunc2)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(UnkFloatFunc)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(UnkFloatFunc2)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,8 +1,49 @@
#include "common.h"
typedef struct {
/* 0x00 */ s8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ s8 unk_02;
/* 0x03 */ s8 unk_03;
/* 0x04 */ s8 unk_04;
/* 0x05 */ s8 unk_05;
/* 0x06 */ s8 unk_06;
/* 0x07 */ char unk_07[0x1];
/* 0x08 */ s16 unk_08;
/* 0x0A */ s16 unk_0A;
/* 0x0C */ s16 unk_0C;
/* 0x0E */ s16 unk_0E;
/* 0x10 */ s16 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ char unk_18[0x4];
/* 0x1C */ s32 unk_1C[2][4];
/* 0x3C */ f32 unk_3C[2][4];
/* 0x5C */ s32* unk_5C;
/* 0x60 */ s16 unk_60;
/* 0x62 */ char unk_62[0x2];
/* 0x64 */ s32* unk_64;
/* 0x68 */ s32* unk_68;
/* 0x6C */ s32* unk_6C;
/* 0x70 */ s32* unk_70;
/* 0x74 */ s32* unk_74;
/* 0x78 */ char unk_78[0x4];
} UnkD0A70Struct; // size = 0x7C
typedef struct Unk8Struct {
/* 0x00 */ s32* unk_00;
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 unk_05;
/* 0x06 */ char unk_06[0x2];
} Unk8Struct; // size = 0x8
typedef UnkD0A70Struct UnkD0A70StructList[90];
s32 D_8014EE10[] = { 0x80156920, };
s32 D_8014EE14[] = { 0x00000000, };
s16 D_8014EE14 = 0;
// padding
s16 D_8014EE16 = { 0x0000 };
s32 D_8014EE18[] = { 0x90909000, 0x90909000, 0xFFFFFF00, 0xFFFFFF00, 0x00007800, 0x00000000, 0xFFFFFF00, 0xFFFFFF00,
0x00008800, 0x00000000,
@ -12,7 +53,10 @@ s32 D_8014EE40[] = { 0x028001E0, 0x01FF0000, 0x028001E0, 0x01FF0000, };
s32 D_8014EE50[] = { 0x028001E0, 0x01FF0000, 0x028001E0, 0x02000000, };
s32 D_8014EE60[] = { 0x012C0000, 0x00000000, };
u16 D_8014EE60 = 300;
// padding
s16 D_8014EE62[] = {0};
s32 D_8014EE68[] = { 0xD9FDF9FF, 0x00000000, 0xD9FFFFFF, 0x00200005, 0xD7000002, 0xFFFFFFFF, 0xE2001E01, 0x00000000,
0xE3000A11, 0x00082CF0, 0xDF000000, 0x00000000,
@ -32,62 +76,328 @@ s32 D_8014EF64[] = { 0x00014358, 0x00018200, 0x0001A858, 0x0001E830, 0x00029458,
0x000C0490, 0x000C49B8, 0x000C6150, 0x000CA380, 0x00000000, 0x00000000, 0x00000000,
};
extern s32* D_80156948[2];
extern s32* D_80156950;
extern UnkD0A70StructList* D_80156954;
extern s8 D_80156958[2];
extern s32 D_80156960[2];
extern s32 D_80156968[2];
extern s8 D_80156970;
#define UNKSTRUCT8013A854_SIZE 90
extern Unk8Struct D_80156F20[8];
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A370);
void func_8013A93C(UnkD0A70Struct*);
void func_8013A9C8(UnkD0A70Struct*);
void func_8013A9E8(UnkD0A70Struct*);
void func_8013BC88(UnkD0A70Struct*);
void func_8013C048(UnkD0A70Struct*);
void func_8013C220(UnkD0A70Struct*);
void func_8013C3F0(UnkD0A70Struct*);
void func_8013EE68(UnkD0A70Struct*);
void func_8013F1F8(UnkD0A70Struct*);
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A37C);
void func_8013A370(s16 arg0) {
D_8014EE60 = arg0;
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A4D0);
void func_8013A37C(void) {
s32 i;
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A610);
for (i = 0; i < ARRAY_COUNT(D_80156948); i++) {
D_80156948[i] = _heap_malloc(&gSpriteHeapPtr, D_8014EE60 * 0x10);
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A650);
D_80156954 = (UnkD0A70StructList*)_heap_malloc(&gSpriteHeapPtr, ARRAY_COUNT(*D_80156954) * sizeof((*D_80156954)[0]));
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A6E8);
for (i = 0; i < ARRAY_COUNT(*D_80156954); i++) {
func_8013A9E8(&(*D_80156954)[i]);
func_8013A9C8(&(*D_80156954)[i]);
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A704);
for (i = 0; i < ARRAY_COUNT(D_80156958); i++) {
D_80156958[i] = -1;
D_80156960[i] = 0;
D_80156968[i] = 0;
D_80156970 = 0;
}
typedef struct {
/* 0x00 */ char unk_0[0x10];
/* 0x10 */ s16 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ char unk_18[0x64];
} UnkStruct8013A854 ; // size = 0x7C
for (i = 0; i < ARRAY_COUNT(D_80156F20); i++) {
D_80156F20[i].unk_00 = 0;
D_80156F20[i].unk_04 = 0;
D_80156F20[i].unk_05 = 0;
}
typedef UnkStruct8013A854 UnkStruct8013A854List[UNKSTRUCT8013A854_SIZE];
D_8014EE14 = 0;
D_80156950 = D_80156948[gCurrentDisplayContextIndex];
}
extern UnkStruct8013A854List* D_80156954[UNKSTRUCT8013A854_SIZE];
void func_8013A4D0(void) {
s32 i;
void func_8013A854(u32 i) {
D_80156950 = D_80156948[gCurrentDisplayContextIndex];
D_8014EE14 = 0;
func_8013A9E8(&(*D_80156954)[0]);
if (i < 90) {
UnkStruct8013A854* unkStruct80156954ListPtr = *D_80156954;
unkStruct80156954ListPtr[i].unk_14 = 0;
unkStruct80156954ListPtr[i].unk_10 = -1;
(*D_80156954)[0].unk_14 |= 1;
for (i = 1; i < ARRAY_COUNT(*D_80156954); i++) {
if (((*D_80156954)[i].unk_14 & 1) && ((*D_80156954)[i].unk_05 != 5)) {
func_8013A93C(&(*D_80156954)[i]);
}
}
for (i = 1; i < ARRAY_COUNT(*D_80156954); i++) {
if ((*D_80156954)[i].unk_14 & 1 && (*D_80156954)[i].unk_5C != NULL) {
s32 temp = (*D_80156954)[i].unk_06; // TODO find a better way to match
if (temp == 11 || (*D_80156954)[i].unk_06 == 12) {
continue;
}
general_heap_free((*D_80156954)[i].unk_5C);
(*D_80156954)[i].unk_5C = 0;
(*D_80156954)[i].unk_60 = 0;
}
}
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A888);
void func_8013A610(s32* arg0, s8 arg1) {
s32 i;
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A8E0);
for (i = 0; i < ARRAY_COUNT(D_80156F20); i++) {
if (D_80156F20[i].unk_00 == NULL) {
D_80156F20[i].unk_00 = arg0;
D_80156F20[i].unk_04 = 4;
D_80156F20[i].unk_05 = arg1;
return;
}
}
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A920);
void func_8013A650(void) {
s32 i;
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A93C);
for (i = 0; i < ARRAY_COUNT(D_80156F20); i++) {
if (D_80156F20[i].unk_00 != 0) {
D_80156F20[i].unk_04--;
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A9C8);
if (D_80156F20[i].unk_04 == 0) {
if (D_80156F20[i].unk_05 != 0) {
heap_free(D_80156F20[i].unk_00);
D_80156F20[i].unk_00 = NULL;
} else {
general_heap_free(D_80156F20[i].unk_00);
D_80156F20[i].unk_00 = NULL;
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013A9E8);
D_80156F20[i].unk_04 = 0;
D_80156F20[i].unk_05 = 0;
}
}
}
}
void func_8013A6E8(void) {
func_8013A650();
}
s32 func_8013A704(s32 arg0) {
s32 count;
s32 cond;
s32 iPrev;
s32 ret;
s32 i;
count = 0;
for (i = 1; i < ARRAY_COUNT(*D_80156954); i++) {
if (!((*D_80156954)[i].unk_14 & 1)) {
count++;
}
}
if (count < arg0) {
return -1;
}
ret = 0;
cond = FALSE;
count = 0;
iPrev = -1;
for (i = 1; i < ARRAY_COUNT(*D_80156954); i++) {
if (!((*D_80156954)[i].unk_14 & 1)) {
if (!cond) {
ret = i;
cond = TRUE;
} else {
(*D_80156954)[iPrev].unk_10 = i;
}
(*D_80156954)[i].unk_00 = i;
func_8013A9E8(&(*D_80156954)[i]);
count++;
(*D_80156954)[i].unk_14 |= 1;
iPrev = i;
if (count == arg0) {
(*D_80156954)[i].unk_10 = -1;
break;
}
}
}
return ret;
}
void func_8013A854(u32 idx) {
if (idx < 90) {
(*D_80156954)[idx].unk_14 = 0;
(*D_80156954)[idx].unk_10 = -1;
}
}
void func_8013A888(u32 idx) {
if (idx < 90) {
s32 temp_s0;
do {
temp_s0 = (*D_80156954)[idx].unk_10;
func_8013A854(idx);
idx = temp_s0;
} while (temp_s0 != -1);
}
}
s16 func_8013A8E0(s32 idx) {
// TODO find better match
if ((u32)idx >= 90) {
return -1;
}
if (idx >= 90) {
return 0xFF;
} else {
return (*D_80156954)[idx].unk_10;
}
}
UnkD0A70Struct* func_8013A920(s32 idx) {
return &(*D_80156954)[idx];
}
void func_8013A93C(UnkD0A70Struct* arg0) {
if (arg0->unk_64 != 0) {
arg0->unk_64 = 0;
}
if (arg0->unk_68 != 0) {
func_8013A610(arg0->unk_68, 1);
arg0->unk_68 = 0;
}
if (arg0->unk_6C != 0) {
func_8013A610(arg0->unk_6C, 1);
arg0->unk_6C = 0;
}
if (arg0->unk_70 != 0) {
func_8013A610(arg0->unk_70, 1);
arg0->unk_70 = 0;
}
if (arg0->unk_74 != 0) {
func_8013A610(arg0->unk_74, 1);
arg0->unk_74 = 0;
}
}
void func_8013A9C8(UnkD0A70Struct* arg0) {
arg0->unk_64 = 0;
arg0->unk_68 = 0;
arg0->unk_6C = 0;
arg0->unk_70 = 0;
arg0->unk_74 = 0;
arg0->unk_5C = 0;
arg0->unk_60 = 0;
}
void func_8013A9E8(UnkD0A70Struct* arg0) {
s32 i;
s32 j;
arg0->unk_10 = -1;
arg0->unk_05 = 0;
arg0->unk_06 = 0;
arg0->unk_14 = 0;
arg0->unk_01 = 0;
arg0->unk_02 = 0;
arg0->unk_08 = 0;
arg0->unk_0A = 0;
arg0->unk_0C = 0;
arg0->unk_0E = 0;
arg0->unk_1C[0][3] = 255;
arg0->unk_1C[1][3] = 255;
arg0->unk_03 = 0;
arg0->unk_04 = 0;
arg0->unk_08 = 0;
arg0->unk_0A = 0;
for (i = 0; i < ARRAY_COUNT(arg0->unk_1C); i++) {
for (j = 0; j < ARRAY_COUNT(arg0->unk_1C[0]); j++) {
arg0->unk_1C[i][j] = 0;
}
}
for (i = 0; i < ARRAY_COUNT(arg0->unk_3C); i++) {
for (j = 0; j < ARRAY_COUNT(arg0->unk_3C[0]); j++) {
arg0->unk_3C[i][j] = 0;
}
}
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013AA9C);
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013AF20);
void func_8013AF20(s32 idx, u16 arg1, s32 arg2) {
if ((*D_80156954)[idx].unk_14 & 1) {
if (arg2 != 0) {
(*D_80156954)[idx].unk_14 |= arg1;
} else {
(*D_80156954)[idx].unk_14 &= ~arg1;
}
}
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013AF70);
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013B0EC);
void func_8013B0EC(UnkD0A70Struct* arg0) {
switch (arg0->unk_01) {
case 3:
if (arg0->unk_1C[1][2] == 0) {
arg0->unk_03 = 1;
arg0->unk_04 = 16;
} else {
arg0->unk_03 = 1;
arg0->unk_04 = 1;
}
case 1:
func_8013C048(arg0);
break;
case 2:
func_8013C3F0(arg0);
break;
case 0:
case 4:
func_8013BC88(arg0);
break;
default:
return;
}
if (arg0->unk_05 == 4) {
func_8013EE68(arg0);
}
switch (arg0->unk_06) {
case 11:
case 12:
func_8013F1F8(arg0);
break;
}
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013B1B0);
@ -107,7 +417,11 @@ INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013E2F0);
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013E904);
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013EE48);
void func_8013EE48(UnkD0A70Struct* arg0) {
arg0->unk_3C[0][0] = 0.0f;
arg0->unk_3C[0][1] = 50.0f;
arg0->unk_3C[0][2] = 30.0f;
}
INCLUDE_ASM(s32, "d0a70_len_4fe0", func_8013EE68);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
MusicSettings D_8014F6F0 = {
.flags = 0,

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
#include "effects.h"
ApiStatus SetEncounterStatusFlags(Evt* script, s32 isInitialCall) {

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
#include "sprite.h"
typedef struct struct802E89B0 {

View File

@ -210,7 +210,7 @@ void entity_HiddenItemBlock_init(Entity* entity) {
}
void entity_ItemlessBlock_init(Entity* entity) {
AnimatedMesh* animMesh;
ModelAnimator* animMesh;
entity_base_block_init(entity);
entity->renderSetupFunc = entity_ItemBlock_setupGfx;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
typedef struct struct802E7DE0 {
/* 0x000 */ s32 unk_000;

View File

@ -48,8 +48,7 @@ ApiStatus SetCamPerspective(Evt* script, s32 isInitialCall) {
f32 vfov = evt_get_float_variable(script, *args++);
s16 nearClip = evt_get_variable(script, *args++);
s16 farClip = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->farClip = farClip;
camera->updateMode = mode;
@ -64,8 +63,7 @@ ApiStatus func_802CA90C(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
s16 mode = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->updateMode = mode;
camera->unk_06 = 0;
@ -122,8 +120,7 @@ ApiStatus func_802CABE8(Evt* script, s32 isInitialCall) {
s32 value2 = evt_get_variable(script, *args++);
s32 value3 = evt_get_variable(script, *args++);
s16 value4 = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->unk_22 = value4;
camera->unk_1C = value1;
@ -139,8 +136,7 @@ ApiStatus func_802CACC0(Evt* script, s32 isInitialCall) {
s32 value2 = evt_get_variable(script, *args++);
s32 value3 = evt_get_variable(script, *args++);
s16 zoomPercent = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->zoomPercent = zoomPercent;
camera->unk_24 = value1;
@ -155,8 +151,7 @@ ApiStatus SetCamBGColor(Evt* script, s32 isInitialCall) {
s16 r = evt_get_variable(script, *args++);
s16 g = evt_get_variable(script, *args++);
s16 b = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->bgColor[0] = r;
camera->bgColor[1] = g;
@ -170,8 +165,7 @@ ApiStatus func_802CAE50(Evt* script, s32 isInitialCall) {
s32 value1 = evt_get_variable(script, *args++);
s32 value2 = evt_get_variable(script, *args++);
s32 value3 = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->unk_54 = value1;
camera->unk_58 = value2;
@ -185,8 +179,7 @@ ApiStatus SetCamTarget(Evt* script, s32 isInitialCall) {
s32 x = evt_get_variable(script, *args++);
s32 y = evt_get_variable(script, *args++);
s32 z = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->targetPos.x = x;
camera->targetPos.y = y;
@ -221,8 +214,7 @@ ApiStatus SetCamLeadPlayer(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
s32 enabled = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
if (enabled) {
camera->flags |= CAM_FLAG_LEAD_PLAYER;
@ -236,8 +228,7 @@ ApiStatus func_802CB710(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
f32 value = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->unk_520 = (value / 100.0f);
return ApiStatus_DONE2;
@ -248,8 +239,7 @@ ApiStatus PanToTarget(Evt* script, s32 isInitialCall) {
s32 id = evt_get_variable(script, *args++);
f32 panPhase = evt_get_float_variable(script, *args++);
s32 targetType = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->unk_506 = 1;
if (targetType != 0) {
@ -270,8 +260,7 @@ INCLUDE_ASM(s32, "evt/cam_api", LoadSettings, Evt* script, s32 isInitialCall);
ApiStatus SetCamType(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
s32 controllerType = evt_get_variable(script, *args++);
s32 enabled = evt_get_variable(script, *args++);
@ -283,8 +272,7 @@ ApiStatus SetCamType(Evt* script, s32 isInitialCall) {
ApiStatus SetCamPitch(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
f32 boomPitch = evt_get_float_variable(script, *args++);
f32 viewPitch = evt_get_float_variable(script, *args++);
@ -296,8 +284,7 @@ ApiStatus SetCamPitch(Evt* script, s32 isInitialCall) {
ApiStatus SetCamDistance(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
f32 boomLength = evt_get_float_variable(script, *args++);
camera->controlSettings.boomLength = boomLength;
@ -307,8 +294,7 @@ ApiStatus SetCamDistance(Evt* script, s32 isInitialCall) {
ApiStatus SetCamPosA(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
f32 x = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
@ -320,8 +306,7 @@ ApiStatus SetCamPosA(Evt* script, s32 isInitialCall) {
ApiStatus SetCamPosB(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
f32 x = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
@ -333,8 +318,7 @@ ApiStatus SetCamPosB(Evt* script, s32 isInitialCall) {
ApiStatus SetCamPosC(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
f32 y1 = evt_get_float_variable(script, *args++);
f32 y2 = evt_get_float_variable(script, *args++);
@ -346,8 +330,7 @@ ApiStatus SetCamPosC(Evt* script, s32 isInitialCall) {
ApiStatus SetPanTarget(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
@ -363,8 +346,7 @@ ApiStatus SetCamSpeed(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
f32 speed = evt_get_float_variable(script, *args++);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
camera->moveSpeed = speed;
return ApiStatus_DONE2;
@ -375,8 +357,7 @@ ApiStatus GetCamType(Evt* script, s32 isInitialCall) {
s32 id = evt_get_variable(script, *args++);
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_variable(script, outVar1, camera->controlSettings.type);
evt_set_variable(script, outVar2, camera->controlSettings.flag);
@ -388,8 +369,7 @@ ApiStatus GetCamPitch(Evt* script, s32 isInitialCall) {
s32 id = evt_get_variable(script, *args++);
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_float_variable(script, outVar1, camera->controlSettings.boomPitch);
evt_set_float_variable(script, outVar2, camera->controlSettings.viewPitch);
@ -400,8 +380,7 @@ ApiStatus GetCamDistance(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, *args++);
Bytecode outVar1 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_float_variable(script, outVar1, camera->controlSettings.boomLength);
return ApiStatus_DONE2;
@ -412,8 +391,7 @@ ApiStatus GetCamPosA(Evt* script, s32 isInitialCall) {
s32 id = evt_get_variable(script, *args++);
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_float_variable(script, outVar1, camera->controlSettings.posA.x);
evt_set_float_variable(script, outVar2, camera->controlSettings.posA.z);
@ -425,8 +403,7 @@ ApiStatus GetCamPosB(Evt* script, s32 isInitialCall) {
s32 id = evt_get_variable(script, *args++);
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_float_variable(script, outVar1, camera->controlSettings.posB.x);
evt_set_float_variable(script, outVar2, camera->controlSettings.posB.z);
@ -438,8 +415,7 @@ ApiStatus GetCamPosC(Evt* script, s32 isInitialCall) {
s32 id = evt_get_variable(script, *args++);
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_float_variable(script, outVar1, camera->controlSettings.posA.y);
evt_set_float_variable(script, outVar2, camera->controlSettings.posB.y);
@ -452,8 +428,7 @@ ApiStatus GetCamPosition(Evt* script, s32 isInitialCall) {
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Bytecode outVar3 = *args++;
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
evt_set_float_variable(script, outVar1, camera->movePos.x);
evt_set_float_variable(script, outVar2, camera->movePos.y);
@ -465,8 +440,7 @@ ApiStatus WaitForCam(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = evt_get_variable(script, args[0]);
f32 endInterpValue = evt_get_float_variable(script, args[1]);
Camera* cameras = gCameras;
Camera* camera = &cameras[id];
Camera* camera = &gCameras[id];
if (isInitialCall || !(endInterpValue <= camera->interpAlpha)) {
return ApiStatus_BLOCK;
@ -479,243 +453,3 @@ INCLUDE_ASM(s32, "evt/cam_api", SetCamProperties, Evt* script, s32 isInitialCall
INCLUDE_ASM(s32, "evt/cam_api", AdjustCam, Evt* script, s32 isInitialCall);
INCLUDE_ASM(s32, "evt/cam_api", ResetCam, Evt* script, s32 isInitialCall);
void update_animated_models(void) {
s32 i;
for (i = 0; i < MAX_ANIMATED_MODELS; i++) {
AnimatedModel* anim = (*gCurrentMeshAnimationListPtr)[i];
if (anim->animModelID >= 0) {
func_8011EA54(anim->animModelID, &anim->mtx);
}
}
}
INCLUDE_ASM(s32, "evt/cam_api", render_animated_models);
ApiStatus InitAnimatedModels(Evt* script, s32 isInitialCall) {
if (!gGameStatusPtr->isBattle) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
}
return ApiStatus_DONE2;
}
ApiStatus LoadAnimatedModel(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var1 = evt_get_variable(script, *args++);
AnimatedModel* animModel = (*gCurrentMeshAnimationListPtr)[index];
s32 animModelID = create_model_animator(0);
load_model_animator_tree(animModelID, var1);
animModel->animModelID = animModelID;
animModel->pos.x = 0;
animModel->pos.y = 0;
animModel->pos.z = 0;
animModel->rot.x = 0;
animModel->rot.y = 0;
animModel->rot.z = 0;
animModel->scale.x = 1.0f;
animModel->scale.y = 1.0f;
animModel->scale.z = 1.0f;
animModel->currentAnimData = NULL;
guMtxIdent(&animModel->mtx);
return ApiStatus_DONE2;
}
ApiStatus LoadAnimatedMesh(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var1 = evt_get_variable(script, *args++);
AnimatedModel* animModel = (*gCurrentMeshAnimationListPtr)[index];
s32 animModelID = create_model_animator(0);
load_mesh_animator_tree(animModelID, var1);
animModel->animModelID = animModelID;
animModel->pos.x = 0;
animModel->pos.y = 0;
animModel->pos.z = 0;
animModel->rot.x = 0;
animModel->rot.y = 0;
animModel->rot.z = 0;
animModel->scale.x = 1.0f;
animModel->scale.y = 1.0f;
animModel->scale.z = 1.0f;
animModel->currentAnimData = NULL;
guMtxIdent(&animModel->mtx);
return ApiStatus_DONE2;
}
ApiStatus PlayModelAnimation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->currentAnimData = var2;
play_model_animation(model->animModelID, var2);
return ApiStatus_DONE2;
}
ApiStatus PlayModelAnimationStartingFrom(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
s32 var3 = evt_get_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->currentAnimData = var2;
play_model_animation_starting_from(model->animModelID, var2, var3);
return ApiStatus_DONE2;
}
ApiStatus ChangeModelAnimation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
if (model->currentAnimData == var2) {
return ApiStatus_DONE2;
}
model->currentAnimData = var2;
play_model_animation(model->animModelID, var2);
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRootPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->pos.x = x;
model->pos.y = y;
model->pos.z = z;
return ApiStatus_DONE2;
}
ApiStatus GetAnimatedModelRootPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 outX = *args++;
s32 outY = *args++;
s32 outZ = *args++;
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
evt_set_float_variable(script, outX, model->pos.x);
evt_set_float_variable(script, outY, model->pos.y);
evt_set_float_variable(script, outZ, model->pos.z);
return ApiStatus_DONE2;
}
ApiStatus AddAnimatedModelRootPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->pos.x += x;
model->pos.y += y;
model->pos.z += z;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRootRotation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->rot.x = x;
model->rot.y = y;
model->rot.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRootScale(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->scale.x = x;
model->scale.y = y;
model->scale.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRenderMode(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 renderMode = evt_get_float_variable(script, *args++);
get_animator_by_index((*gCurrentMeshAnimationListPtr)[index]->animModelID)->renderMode = renderMode;
return ApiStatus_DONE2;
}
ApiStatus DeleteAnimatedModel(Evt* script, s32 isInitialCall) {
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[evt_get_variable(script, *script->ptrReadPos)];
delete_model_animator(get_animator_by_index(model->animModelID));
model->animModelID = -1;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatorFlags(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 a1 = *args++;
s32 enable = evt_get_variable(script, *args++);
AnimatedMesh* animMesh = get_animator_by_index((*gCurrentMeshAnimationListPtr)[index]->animModelID);
if (enable) {
animMesh->flags |= a1;
} else {
animMesh->flags &= ~a1;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "evt/cam_api", reset_model_animators);
void init_model_animators(void) {
if (!gGameStatusPtr->isBattle) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
}
}
INCLUDE_ASM(s32, "evt/cam_api", GetAnimatedNodePosition);
INCLUDE_ASM(s32, "evt/cam_api", GetAnimatedNodeRotation);
INCLUDE_ASM(s32, "evt/cam_api", GetAnimatedPositionByTreeIndex);
INCLUDE_ASM(s32, "evt/cam_api", GetAnimatedRotationByTreeIndex);
INCLUDE_ASM(s32, "evt/cam_api", SetAnimatedNodeFlags);

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "model.h"
typedef struct LavaReset {
/* 0x00 */ s32 colliderID;

243
src/evt/model_api.c Normal file
View File

@ -0,0 +1,243 @@
#include "model.h"
void update_animated_models(void) {
s32 i;
for (i = 0; i < MAX_ANIMATED_MODELS; i++) {
AnimatedModel* anim = (*gCurrentMeshAnimationListPtr)[i];
if (anim->animModelID >= 0) {
update_model_animator_with_transform(anim->animModelID, &anim->mtx);
}
}
}
INCLUDE_ASM(s32, "evt/model_api", render_animated_models);
// split here?
ApiStatus InitAnimatedModels(Evt* script, s32 isInitialCall) {
if (!gGameStatusPtr->isBattle) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
}
return ApiStatus_DONE2;
}
ApiStatus LoadAnimatedModel(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var1 = evt_get_variable(script, *args++);
AnimatedModel* animModel = (*gCurrentMeshAnimationListPtr)[index];
s32 animModelID = create_model_animator(0);
load_model_animator_tree(animModelID, var1);
animModel->animModelID = animModelID;
animModel->pos.x = 0;
animModel->pos.y = 0;
animModel->pos.z = 0;
animModel->rot.x = 0;
animModel->rot.y = 0;
animModel->rot.z = 0;
animModel->scale.x = 1.0f;
animModel->scale.y = 1.0f;
animModel->scale.z = 1.0f;
animModel->currentAnimData = NULL;
guMtxIdent(&animModel->mtx);
return ApiStatus_DONE2;
}
ApiStatus LoadAnimatedMesh(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var1 = evt_get_variable(script, *args++);
AnimatedModel* animModel = (*gCurrentMeshAnimationListPtr)[index];
s32 animModelID = create_model_animator(0);
load_mesh_animator_tree(animModelID, var1);
animModel->animModelID = animModelID;
animModel->pos.x = 0;
animModel->pos.y = 0;
animModel->pos.z = 0;
animModel->rot.x = 0;
animModel->rot.y = 0;
animModel->rot.z = 0;
animModel->scale.x = 1.0f;
animModel->scale.y = 1.0f;
animModel->scale.z = 1.0f;
animModel->currentAnimData = NULL;
guMtxIdent(&animModel->mtx);
return ApiStatus_DONE2;
}
ApiStatus PlayModelAnimation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->currentAnimData = var2;
play_model_animation(model->animModelID, var2);
return ApiStatus_DONE2;
}
ApiStatus PlayModelAnimationStartingFrom(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
s32 var3 = evt_get_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->currentAnimData = var2;
play_model_animation_starting_from(model->animModelID, var2, var3);
return ApiStatus_DONE2;
}
ApiStatus ChangeModelAnimation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 var2 = evt_get_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
if (model->currentAnimData == var2) {
return ApiStatus_DONE2;
}
model->currentAnimData = var2;
play_model_animation(model->animModelID, var2);
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRootPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->pos.x = x;
model->pos.y = y;
model->pos.z = z;
return ApiStatus_DONE2;
}
ApiStatus GetAnimatedModelRootPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 outX = *args++;
s32 outY = *args++;
s32 outZ = *args++;
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
evt_set_float_variable(script, outX, model->pos.x);
evt_set_float_variable(script, outY, model->pos.y);
evt_set_float_variable(script, outZ, model->pos.z);
return ApiStatus_DONE2;
}
ApiStatus AddAnimatedModelRootPosition(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->pos.x += x;
model->pos.y += y;
model->pos.z += z;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRootRotation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->rot.x = x;
model->rot.y = y;
model->rot.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRootScale(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
f32 x = evt_get_float_variable(script, *args++);
f32 y = evt_get_float_variable(script, *args++);
f32 z = evt_get_float_variable(script, *args++);
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index];
model->scale.x = x;
model->scale.y = y;
model->scale.z = z;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatedModelRenderMode(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 renderMode = evt_get_float_variable(script, *args++);
get_animator_by_index((*gCurrentMeshAnimationListPtr)[index]->animModelID)->renderMode = renderMode;
return ApiStatus_DONE2;
}
ApiStatus DeleteAnimatedModel(Evt* script, s32 isInitialCall) {
AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[evt_get_variable(script, *script->ptrReadPos)];
delete_model_animator(get_animator_by_index(model->animModelID));
model->animModelID = -1;
return ApiStatus_DONE2;
}
ApiStatus SetAnimatorFlags(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = evt_get_variable(script, *args++);
s32 a1 = *args++;
s32 enable = evt_get_variable(script, *args++);
ModelAnimator* animMesh = get_animator_by_index((*gCurrentMeshAnimationListPtr)[index]->animModelID);
if (enable) {
animMesh->flags |= a1;
} else {
animMesh->flags &= ~a1;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "evt/model_api", reset_model_animators);
void init_model_animators(void) {
if (!gGameStatusPtr->isBattle) {
gCurrentMeshAnimationListPtr = &gWorldMeshAnimationList;
} else {
gCurrentMeshAnimationListPtr = &gBattleMeshAnimationList;
}
}
INCLUDE_ASM(s32, "evt/model_api", GetAnimatedNodePosition);
INCLUDE_ASM(s32, "evt/model_api", GetAnimatedNodeRotation);
INCLUDE_ASM(s32, "evt/model_api", GetAnimatedPositionByTreeIndex);
INCLUDE_ASM(s32, "evt/model_api", GetAnimatedRotationByTreeIndex);
INCLUDE_ASM(s32, "evt/model_api", SetAnimatedNodeFlags);

View File

@ -1,5 +1,4 @@
#include "common.h"
#include "map.h"
#include "npc.h"
extern s32 D_802DAE40;

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "npc.h"
#include "sprite.h"
Npc* playerNpc = (Npc*) 0x802DB270; // XXX: raw ptr

View File

@ -1,5 +1,4 @@
#include "common.h"
#include "map.h"
#include "npc.h"
#include "effects.h"
#include "sprite.h"
@ -1625,7 +1624,7 @@ void draw_first_strike_ui(void) {
void npc_dyn_entity_draw_no_op(void) {
}
void make_npcs(s8 flags, s8 mapID, s32* npcGroupList) {
void make_npcs(s32 flags, s32 mapID, s32* npcGroupList) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 i;
s32 j;

268
src/npc.h
View File

@ -1,268 +0,0 @@
#ifndef _NPC_H_
#define _NPC_H_
#include "common.h"
#include "map.h" // TODO move npc-related structs here
/// The default Npc::onUpdate and Npc::onRender callback.
void STUB_npc_callback(void);
void npc_dyn_entity_draw_no_op(void);
void mtx_ident_mirror_y(Matrix4f mtx);
void clear_npcs(void);
/// Points the current NPC list to the world or battle lists depending on game state.
void init_npc_list(void);
/// Iterates over the NPC list, doing absolutely nothing.
/// Presumably did something once upon a time but got commented out.
void npc_iter_no_op(void);
s32 _create_npc(NpcBlueprint* blueprint, s32** animList, s32 skipLoadingAnims);
s32 _create_npc_basic(NpcBlueprint* blueprint);
s32 _create_npc_standard(NpcBlueprint* blueprint, s32** animList);
void _create_npc_partner(NpcBlueprint* blueprint);
void free_npc_by_index(s32 listIndex);
void free_npc(Npc* npc);
Npc* get_npc_by_index(s32 listIndex);
void npc_do_world_collision(Npc* npc);
void npc_do_other_npc_collision(Npc* npc);
/// @returns TRUE if a collision occurred
s32 npc_do_player_collision(Npc* npc);
void npc_do_gravity(Npc* npc);
s32 func_800397E8(Npc* npc, f32 arg1);
/// Updates all NPCs.
void update_npcs(void);
f32 npc_get_render_yaw();
void appendGfx_npc(Npc* npc);
/// Renders all NPCs.
void render_npcs(void);
void npc_move_heading(Npc* npc, f32 speed, f32 yaw);
Npc* get_npc_unsafe(s32 npcID);
/// @returns NULL if not found
Npc* get_npc_safe(s32 npcID);
void enable_npc_shadow(Npc* npc);
void disable_npc_shadow(Npc* npc);
void update_npc_blur(Npc* npc);
void appendGfx_npc_blur(Npc* npc);
void npc_enable_collisions(void);
void npc_disable_collisions(void);
void func_8003B1A8(void);
void npc_reload_all(void);
void set_npc_yaw(Npc* npc, f32 yaw);
void npc_set_palswap_mode_A(Npc* npc, s32 arg1);
void npc_set_palswap_mode_B(Npc* npc, s32 arg1);
void func_8003B420(Npc* npc);
void npc_set_palswap_1(Npc* npc, s32 palIndexA, s32 palIndexB, s32 timeHoldA, s32 timeAB);
void npc_set_palswap_2(Npc* npc, s32 timeHoldB, s32 timeBA, s32 palIndexC, s32 palIndexD);
void npc_draw_with_palswap(Npc* npc, s32 arg1, s32 arg2);
void npc_draw_palswap_mode_0(Npc* npc, s32 arg1, s32 arg2);
s32 npc_draw_palswap_mode_1(Npc*, s32, s32);
s32 npc_blend_palette_colors(void);
s32 npc_draw_palswap_mode_2(Npc*, s32, s32, s32);
s32 npc_draw_palswap_mode_4(Npc*, s32, s32);
void npc_set_decoration(Npc* npc, s32 idx, s32 decorationType);
void npc_remove_decoration(Npc* npc, s32 idx);
s32 npc_update_decorations(Npc* npc);
void npc__remove_decoration(Npc* npc, s32 idx);
void npc_reset_current_decoration(Npc* npc, s32 idx);
void npc_update_decoration_none(Npc* npc, s32 idx);
void npc_remove_decoration_none(Npc* npc, s32 idx);
void npc_update_decoration_bowser_aura(Npc* npc, s32 idx);
void npc_remove_decoration_bowser_aura(Npc* npc, s32 idx);
void npc_update_decoration_sweat(Npc* npc, s32 idx);
void npc_remove_decoration_sweat(Npc* npc, s32 idx);
void npc_update_decoration_seeing_stars(Npc* npc, s32 idx);
void npc_remove_decoration_seeing_stars(Npc* npc, s32 idx);
void npc_update_decoration_glow_in_front(Npc* npc, s32 idx);
void npc_remove_decoration_glow_in_front(Npc* npc, s32 idx);
void npc_update_decoration_glow_behind(Npc* npc, s32 idx);
void npc_remove_decoration_glow_behind(Npc* npc, s32 idx);
void npc_update_decoration_charged(Npc* npc, s32 idx);
void npc_remove_decoration_charged(Npc* npc, s32 idx);
void npc__reset_current_decoration(Npc* npc, s32 idx);
/// Finds the closest NPC to a given point within a radius. Ignores Y position.
///
/// NPCs with NPC_FLAG_PARTICLE set are ignored.
/// See also npc_find_closest_simple(), which requires that NPC_FLAG_PARTICLE be set.
///
/// @param x X position
/// @param y Y position (unused)
/// @param z Z position
/// @param radius No NPCs further than this distance will be considered
///
/// @returns NULL if there are no NPCs within radius
Npc* npc_find_closest(f32 x, f32 y, f32 z, f32 radius);
/// Finds the closest simple-hitbox NPC to a given point within a radius. Ignores Y position.
///
/// Only NPCs with NPC_FLAG_PARTICLE set are considered.
/// See also npc_find_closest(), which requires that NPC_FLAG_PARTICLE be unset.
///
/// @param x X position
/// @param y Y position (unused)
/// @param z Z position
/// @param radius No NPCs further than this distance will be considered
///
/// @returns NULL if there are no NPCs within radius
Npc* npc_find_closest_simple(f32 x, f32 y, f32 z, f32 radius);
//s32 npc_find_standing_on_entity();
s32 npc_get_collider_below(Npc* npc);
void func_8003D3BC(Npc* npc);
void func_8003D624(Npc* npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6);
void func_8003D660(Npc* npc, s32 arg1);
void func_8003D788(Npc* npc, s32 arg1);
void func_8003DA38(Npc* npc, s32 arg1);
s32 func_8003DC38();
void func_8003DFA0(Npc* npc);
void func_8003E0D4();
void func_8003E1D0(Npc* npc);
/// Duplicate of set_defeated().
void COPY_set_defeated(s32 mapID, s32 encounterID);
void init_encounter_status(void);
void clear_encounter_status(void);
void func_8003E50C(void);
void func_8003E514(s8 arg0);
void update_encounters(void);
void draw_encounter_ui(void);
void draw_first_strike_ui(void);
void npc_dyn_entity_draw_no_op(void);
void make_npcs(s8 flags, s8 mapID, s32* npcGroupList);
s32 kill_encounter(Enemy* enemy);
void kill_enemy(Enemy* enemy);
/// Binds the specified ai script to the specified enemy
///
/// @param enemy pointer to the enemy to bind the script to
/// @param aiScriptBytecode pointer to the script to be bound.
s32 bind_enemy_ai(Enemy* enemy, EvtSource* aiScriptBytecode);
/// Binds the specified auxillary script to the specified enemy
///
/// @param enemy pointer to the enemy to bind the script to
/// @param auxScriptBytecode pointer to the script to be bound.
s32 bind_enemy_aux(Enemy* enemy, EvtSource* auxScriptBytecode);
/// Binds the specified interact script to the specified enemy
///
/// @param enemy pointer to the enemy to bind the script to
/// @param interactScriptBytecode pointer to the script to be bound.
s32 bind_enemy_interact(Enemy* enemy, EvtSource* interactScriptBytecode);
/// Binds the specified ai script to the npc matching the specified npcId
///
/// @param npcID ID of the desired npc
/// @param npcAiBytecode pointer to the script to be bound.
void bind_npc_ai(s32 npcID, EvtSource* npcAiBytecode);
/// Binds the specified auxillary script to the npc matching the specified npcId
///
/// @param npcID ID of the desired npc
/// @param npcAuxBytecode pointer to the script to be bound.
void bind_npc_aux(s32 npcID, EvtSource* npcAuxBytecode);
/// Binds the specified interact script to the npc matching the specified npcId
///
/// @param npcID ID of the desired npc
/// @param npcInteractBytecode pointer to the script to be bound.
void bind_npc_interact(s32 npcID, EvtSource* npcInteractBytecode);
/// Looks for an enemy matching the specified npcID.
///
/// @param npcID ID of the npc bound to the desired enemy.
///
/// @returns pointer to Enemy struct, if one is found. If one is not found, a panic occurs.
Enemy* get_enemy(s32 npcID);
/// Same as get_enemy(), with the exception of always returning a value if an enemy is not found.
///
/// @param npcID ID of the npc bound to the desired enemy.
///
/// @returns pointer to Enemy struct, if one is found. Otherwise, NULL.
Enemy* get_enemy_safe(s32 npcID);
#endif

View File

@ -218,15 +218,15 @@ void spr_init_component_anim_state(SpriteComponent* comp, s16*** anim) {
comp->loopCounter = 0;
comp->currentRaster = -1;
comp->currentPalette = -1;
comp->posOffset.x = 0;
comp->posOffset.y = 0;
comp->posOffset.z = 0;
comp->compPos.x = 0;
comp->compPos.y = 0;
comp->compPos.z = 0;
comp->rotation.x = 0;
comp->rotation.y = 0;
comp->rotation.z = 0;
comp->posOffset.x = 0.0f;
comp->posOffset.y = 0.0f;
comp->posOffset.z = 0.0f;
comp->compPos.x = 0.0f;
comp->compPos.y = 0.0f;
comp->compPos.z = 0.0f;
comp->rotation.x = 0.0f;
comp->rotation.y = 0.0f;
comp->rotation.z = 0.0f;
comp->scale.x = 1.0f;
comp->scale.y = 1.0f;
comp->scale.z = 1.0f;

View File

@ -1,6 +1,6 @@
#include "common.h"
#include "ld_addrs.h"
#include "map.h"
#include "npc.h"
#include "nu/nusys.h"
#include "hud_element.h"
#include "sprite.h"

View File

@ -1,3 +1,6 @@
#include "functions.h"
#include "npc.h"
void state_world_draw_aux_ui(void);
void state_init_world(void) {

View File

@ -1,6 +1,6 @@
#include "common.h"
#include "../partners.h"
#include "../../npc.h"
#include "npc.h"
typedef struct unkTweesterStruct{
/* 0x000 */ s32 unk_00;

View File

@ -2,7 +2,6 @@
#include "sprite/npc/world_clubba.h"
#include "message_ids.h"
extern s16 gCurrentCamID;
extern Npc* wPartnerNpc;
enum {

View File

@ -2,7 +2,6 @@
#include "sprite/npc/world_clubba.h"
#include "message_ids.h"
extern s16 gCurrentCamID;
extern Npc* wPartnerNpc;
enum {

View File

@ -2,7 +2,6 @@
#include "sprite/npc/world_clubba.h"
#include "message_ids.h"
extern s16 gCurrentCamID;
extern Npc* wPartnerNpc;
enum {

View File

@ -2,7 +2,6 @@
#include "message_ids.h"
#include "sprite/npc/world_clubba.h"
extern s16 gCurrentCamID;
extern Npc* wPartnerNpc;
enum {

View File

@ -4,8 +4,6 @@
#include "sprite/npc/world_clubba.h"
#include "sprite/npc/world_tubba.h"
extern s16 gCurrentCamID;
enum {
NPC_WORLD_CLUBBA7,
NPC_WORLD_CLUBBA0,

View File

@ -3,7 +3,6 @@
#include "sprite/npc/sentinel.h"
#include "sprite/npc/world_clubba.h"
extern s16 gCurrentCamID;
extern Npc* wPartnerNpc;
enum {

View File

@ -2,8 +2,6 @@
#include "message_ids.h"
#include "sprite/npc/world_tubba.h"
extern s16 gCurrentCamID;
enum {
NPC_WORLD_TUBBA,
};

View File

@ -2,7 +2,6 @@
#include "message_ids.h"
#include "sprite/npc/world_clubba.h"
extern s16 gCurrentCamID;
extern Npc* wPartnerNpc;
enum {

View File

@ -11,7 +11,6 @@
#define UNK_ALPHA_FUNC_NPC 10
extern s16 gCurrentCamID;
extern s16 MessagePlural;
extern s16 MessageSingular;

View File

@ -1,5 +1,6 @@
#include "flo_10.h"
#include "nu/nusys.h"
#include "model.h"
void N(func_802404B0_CB96B0)(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
INCLUDE_ASM(void, "world/area_flo/flo_10/CB96B0", flo_10_func_802404B0_CB96B0);

View File

@ -2,11 +2,15 @@
#include "world/common/UnkNpcAIFunc24.inc.c"
#include "world/common/UnkFunc13_copy.inc.c"
#define NAMESPACE dup_mac_01
#include "world/common/UnkFunc13.inc.c"
#define NAMESPACE mac_01
#include "world/common/UnkNpcAIFunc1.inc.c"
#include "world/common/UnkFunc14_copy.inc.c"
#define NAMESPACE dup_mac_01
#include "world/common/UnkFunc14.inc.c"
#define NAMESPACE mac_01
#include "world/common/UnkNpcAIFunc25.inc.c"
@ -16,98 +20,17 @@
#include "world/common/UnkNpcAIFunc13.inc.c"
#include "world/common/UnkFunc15_copy.inc.c"
#define NAMESPACE dup_mac_01
#include "world/common/UnkFunc15.inc.c"
#define NAMESPACE mac_01
#include "world/common/UnkNpcDurationFlagFunc.inc.c"
#include "world/common/UnkFunc16_copy.inc.c"
#define NAMESPACE dup_mac_01
#include "world/common/UnkFunc16.inc.c"
#define NAMESPACE mac_01
INCLUDE_ASM(s32, "world/area_mac/mac_01/805DD0", func_802460E4_806964);
/*
ApiStatus N(func_802460E4_806964)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;
Npc* npc = get_npc_unsafe(enemy->npcID);
Bytecode* args = script->ptrReadPos;
EnemyTerritoryThing territory;
EnemyTerritoryThing* territoryPtr = &territory;
NpcAISettings* npcAISettings = (NpcAISettings*)evt_get_variable(script, *args++);
f32 posX, posY, posZ, posW;
territory.unk_00 = 0;
territory.shape = enemy->territory->patrol.detectShape;
territory.pointX = enemy->territory->patrol.detect.x;
territory.pointZ = enemy->territory->patrol.detect.z;
territory.sizeX = enemy->territory->patrol.detectSizeX;
territory.sizeZ = enemy->territory->patrol.detectSizeZ;
territory.unk_18 = 65.0f;
territory.unk_1C = 0;
if (isInitialCall || enemy->unk_B0 & 4) {
script->functionTemp[0] = 0;
npc->duration = 0;
npc->currentAnim = enemy->animList[0];
npc->flags &= ~0x800;
if (!enemy->territory->patrol.isFlying) {
npc->flags = (npc->flags | 0x200) & ~8;
} else {
npc->flags = (npc->flags & ~0x200) | 8;
}
if (enemy->unk_B0 & 4) {
script->functionTemp[0] = 99;
script->functionTemp[1] = 0;
enemy->unk_B0 &= ~4;
} else if (enemy->flags & 0x40000000) {
script->functionTemp[0] = 12;
enemy->flags &= ~0x40000000;
}
posX = npc->pos.x;
posY = npc->pos.y + npc->collisionHeight;
posZ = npc->pos.z;
posW = 100.0f;
if (npc_raycast_down_sides(npc->unk_80, &posX, &posY, &posZ, &posW)) {
npc->pos.y = posY;
}
}
switch (script->functionTemp[0]) {
case 0:
#include "world/common/UnkNpcAIFunc24.inc.c"
case 1:
N(func_802456A8_805F28)(script, npcAISettings, territoryPtr);
break;
case 2:
N(UnkNpcAIFunc1)(script, npcAISettings, territoryPtr);
case 3:
N(func_80245A10_806290)(script, npcAISettings, territoryPtr);
break;
case 4:
#include "world/common/UnkNpcAIFunc25.inc.c"
break;
case 10:
N(NpcJumpFunc2)(script, npcAISettings, territoryPtr);
case 11:
N(NpcJumpFunc)(script, npcAISettings, territoryPtr);
break;
case 12:
N(UnkNpcAIFunc13)(script, npcAISettings, territoryPtr);
case 13:
N(func_80245E9C_80671C)(script, npcAISettings, territoryPtr);
break;
case 14:
N(UnkNpcDurationFlagFunc)(script, npcAISettings, territoryPtr);
break;
case 15:
N(func_80246024_8068A4)(script, npcAISettings, territoryPtr);
break;
case 99:
func_8004A73C(script);
}
return ApiStatus_BLOCK;
}
*/
static char* N(exit_str_0) = "osr_00";

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(AddPlayerHandsOffset)(Evt* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(func_80240814_97BE44)(Evt* script, s32 isInitialCall) {
Npc* npc = get_npc_safe(script->owner2.npcID);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(AwaitScriptComplete)(Evt* script, s32 isInitialCall) {
return (!does_script_exist(evt_get_variable(script, *script->ptrReadPos))) * ApiStatus_DONE2;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(Bandit_DropCoin)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(Call800E9894)(Evt* script, s32 isInitialCall) {
func_800E9894();

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(Call800E98C4SyncStatusMenu)(Evt* script, s32 isInitialCall) {
func_800E98C4();

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(CamSetFOV)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(CheckItemFlags40)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(CheckPartnerFlags1000)(Evt* script, s32 isInitialCall) {
return ((get_npc_unsafe(NPC_PARTNER)->flags & 0x1000) != 0) * ApiStatus_DONE2;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(DoesPlayerNeedSleep)(Evt* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetCamVfov)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetCurrentCameraYawClamped180)(Evt* script, s32 isInitialCall) {
script->varTable[0] = clamp_angle(gCameras[gCurrentCameraID].currentYaw + 180.0f);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetCurrentFloor)(Evt* script, s32 isInitialCall) {
script->varTable[0] = gCollisionStatus.currentFloor;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetEncounterEnemyIsOwner)(Evt* script, s32 isInitialCall) {
Enemy* enemy = script->owner1.enemy;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetEntityPosition)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetEntryPos)(Evt* script, s32 isInitialCall) {
MapConfig* mapConfig = get_current_map_header();

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetFloorCollider)(Evt* script, s32 isInitialCall) {
CollisionStatus* collisionStatus = &gCollisionStatus;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetGameStatus75)(Evt* script, s32 isInitialCall) {
evt_set_variable(script, EVT_VAR(0), gGameStatusPtr->debugQuizmo);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetItemName)(Evt* script, s32 isInitialCall) {
Bytecode a0 = *script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetNpcCollisionHeight)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetPartnerCall800EB168)(Evt* script, s32 isInitialCall) {
evt_set_variable(script, *script->ptrReadPos, gPlayerData.currentPartner);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(GetPlayerCoins)(Evt* script, s32 isInitialCall) {
script->varTable[0] = gPlayerData.coins;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(IsBerserkerEquipped)(Evt* script, s32 isInitialCall) {
script->varTable[0] = gBattleStatus.unk_83;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(IsHammerMaxCharged)(Evt* script, s32 isInitialCall) {
script->varTable[0] = FALSE;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(IsJumpMaxCharged)(Evt* script, s32 isInitialCall) {
script->varTable[0] = FALSE;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(IsRightOnEquipped)(Evt* script, s32 isInitialCall) {
script->varTable[0] = FALSE;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
#ifndef PARTY_IMAGE
#error "Define PARTY_IMAGE to the asset name to use LoadPartyImage."

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
void N(NpcJumpFunc)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
void N(NpcJumpFunc2)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) {
Enemy* enemy = script->owner1.enemy;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
void N(NpcJumpFunc3)(Evt* script) {
Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);

View File

@ -1,6 +1,6 @@
#include "common.h"
#include "../partners.h"
#include "map.h"
#include "npc.h"
ApiStatus N(PartnerSuspendAbilityScript)(Evt* script, s32 isInitialCall) {
if (gPlayerData.currentPartner == PARTNER_NONE) {

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(Set80151310_1)(Evt* script, s32 isInitialCall) {
D_80151310 = 1;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(Set80151310_0)(Evt* script, s32 isInitialCall) {
D_80151310 = 0;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetCamVfov)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
#include "camera.h"
ApiStatus N(SetCamera0Flag1000)(Evt* script, s32 isInitialCall) {

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetCamera0MoveFlag1)(Evt* script, s32 isInitialCall) {
Camera* camera = &gCameras[0];

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetEntityFlags100000)(Evt* script, s32 isInitialCall) {
Entity* entity = get_entity_by_index(script->varTable[0]);

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetEntityPosition)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetForeverForestFog)(Evt* script, s32 isInitialCall) {
enable_world_fog();

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetGameStatusUnk84_1)(Evt* script, s32 isInitialCall) {
gGameStatusPtr->playerSpriteSet = 1;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetManyVars)(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "map.h"
#include "npc.h"
ApiStatus N(SetNpcB5_3)(Evt* script, s32 isInitialCall) {
script->owner1.enemy->unk_B5 = 3;

Some files were not shown because too many files have changed in this diff Show More