This commit is contained in:
Ethan Roseman 2020-10-29 16:16:39 -04:00
parent 977fa7117d
commit d0d833cd1d
3 changed files with 67 additions and 102 deletions

View File

@ -1,65 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel LoadPath
/* F9DE0 802D5430 27BDFFD0 */ addiu $sp, $sp, -0x30
/* F9DE4 802D5434 AFB20018 */ sw $s2, 0x18($sp)
/* F9DE8 802D5438 0080902D */ daddu $s2, $a0, $zero
/* F9DEC 802D543C AFBF0028 */ sw $ra, 0x28($sp)
/* F9DF0 802D5440 AFB50024 */ sw $s5, 0x24($sp)
/* F9DF4 802D5444 AFB40020 */ sw $s4, 0x20($sp)
/* F9DF8 802D5448 AFB3001C */ sw $s3, 0x1c($sp)
/* F9DFC 802D544C AFB10014 */ sw $s1, 0x14($sp)
/* F9E00 802D5450 AFB00010 */ sw $s0, 0x10($sp)
/* F9E04 802D5454 8E50000C */ lw $s0, 0xc($s2)
/* F9E08 802D5458 8E050000 */ lw $a1, ($s0)
/* F9E0C 802D545C 0C0B1EAF */ jal get_variable
/* F9E10 802D5460 26100004 */ addiu $s0, $s0, 4
/* F9E14 802D5464 8E050000 */ lw $a1, ($s0)
/* F9E18 802D5468 26100004 */ addiu $s0, $s0, 4
/* F9E1C 802D546C 0240202D */ daddu $a0, $s2, $zero
/* F9E20 802D5470 0C0B1EAF */ jal get_variable
/* F9E24 802D5474 0040982D */ daddu $s3, $v0, $zero
/* F9E28 802D5478 8E050000 */ lw $a1, ($s0)
/* F9E2C 802D547C 26100004 */ addiu $s0, $s0, 4
/* F9E30 802D5480 0240202D */ daddu $a0, $s2, $zero
/* F9E34 802D5484 0C0B1EAF */ jal get_variable
/* F9E38 802D5488 0040A02D */ daddu $s4, $v0, $zero
/* F9E3C 802D548C 0240202D */ daddu $a0, $s2, $zero
/* F9E40 802D5490 8E050000 */ lw $a1, ($s0)
/* F9E44 802D5494 0C0B1EAF */ jal get_variable
/* F9E48 802D5498 0040882D */ daddu $s1, $v0, $zero
/* F9E4C 802D549C 2404001C */ addiu $a0, $zero, 0x1c
/* F9E50 802D54A0 0C00AB39 */ jal heap_malloc
/* F9E54 802D54A4 0040A82D */ daddu $s5, $v0, $zero
/* F9E58 802D54A8 00112080 */ sll $a0, $s1, 2
/* F9E5C 802D54AC 0040802D */ daddu $s0, $v0, $zero
/* F9E60 802D54B0 AE5000C0 */ sw $s0, 0xc0($s2)
/* F9E64 802D54B4 0C00AB39 */ jal heap_malloc
/* F9E68 802D54B8 AE110000 */ sw $s1, ($s0)
/* F9E6C 802D54BC 00112040 */ sll $a0, $s1, 1
/* F9E70 802D54C0 00912021 */ addu $a0, $a0, $s1
/* F9E74 802D54C4 00042080 */ sll $a0, $a0, 2
/* F9E78 802D54C8 AE020004 */ sw $v0, 4($s0)
/* F9E7C 802D54CC 0C00AB39 */ jal heap_malloc
/* F9E80 802D54D0 AE140008 */ sw $s4, 8($s0)
/* F9E84 802D54D4 8E040000 */ lw $a0, ($s0)
/* F9E88 802D54D8 8E050004 */ lw $a1, 4($s0)
/* F9E8C 802D54DC 8E060008 */ lw $a2, 8($s0)
/* F9E90 802D54E0 0040382D */ daddu $a3, $v0, $zero
/* F9E94 802D54E4 0C0B536B */ jal setup_path_data
/* F9E98 802D54E8 AE02000C */ sw $v0, 0xc($s0)
/* F9E9C 802D54EC 2673FFFF */ addiu $s3, $s3, -1
/* F9EA0 802D54F0 AE000010 */ sw $zero, 0x10($s0)
/* F9EA4 802D54F4 AE130014 */ sw $s3, 0x14($s0)
/* F9EA8 802D54F8 AE150018 */ sw $s5, 0x18($s0)
/* F9EAC 802D54FC 8FBF0028 */ lw $ra, 0x28($sp)
/* F9EB0 802D5500 8FB50024 */ lw $s5, 0x24($sp)
/* F9EB4 802D5504 8FB40020 */ lw $s4, 0x20($sp)
/* F9EB8 802D5508 8FB3001C */ lw $s3, 0x1c($sp)
/* F9EBC 802D550C 8FB20018 */ lw $s2, 0x18($sp)
/* F9EC0 802D5510 8FB10014 */ lw $s1, 0x14($sp)
/* F9EC4 802D5514 8FB00010 */ lw $s0, 0x10($sp)
/* F9EC8 802D5518 24020002 */ addiu $v0, $zero, 2
/* F9ECC 802D551C 03E00008 */ jr $ra
/* F9ED0 802D5520 27BD0030 */ addiu $sp, $sp, 0x30

View File

@ -49,7 +49,7 @@ typedef struct CamPosSettings {
/* 0x04 */ f32 boomLength;
/* 0x08 */ f32 boomPitch;
/* 0x0C */ f32 viewPitch;
/* 0x10 */ struct Vec3f position;
/* 0x10 */ Vec3f position;
} CamPosSettings; // size = 0x1C
typedef struct PartnerData {
@ -90,12 +90,12 @@ typedef struct Npc {
/* 0x02C */ char unk_2C[4];
/* 0x030 */ f32 animationSpeed;
/* 0x034 */ char unk_34[4];
/* 0x038 */ struct Vec3f pos;
/* 0x044 */ struct Vec3f rotation;
/* 0x038 */ Vec3f pos;
/* 0x044 */ Vec3f rotation;
/* 0x050 */ f32 unk_50;
/* 0x054 */ struct Vec3f scale;
/* 0x060 */ struct Vec3f moveToPos;
/* 0x06C */ struct Vec3f colliderPos; /* used during collision with player */
/* 0x054 */ Vec3f scale;
/* 0x060 */ Vec3f moveToPos;
/* 0x06C */ Vec3f colliderPos; /* used during collision with player */
/* 0x078 */ s32 shadowIndex;
/* 0x07C */ f32 shadowScale;
/* 0x080 */ s32 unk_80;
@ -431,7 +431,7 @@ typedef struct Camera {
/* 0x054 */ f32 unk_54;
/* 0x058 */ f32 unk_58;
/* 0x05C */ f32 unk_5C;
/* 0x060 */ struct Vec3f targetPos;
/* 0x060 */ Vec3f targetPos;
/* 0x06C */ f32 currentYaw;
/* 0x070 */ char unk_70[4];
/* 0x074 */ f32 currentBoomYaw;
@ -458,13 +458,13 @@ typedef struct Camera {
/* 0x48C */ f32 linearInterpScale; /* 3.0? */
/* 0x490 */ f32 moveSpeed;
/* 0x494 */ char unk_494[28];
/* 0x4B0 */ struct Vec3f movePos;
/* 0x4B0 */ Vec3f movePos;
/* 0x4BC */ char unk_4BC[28];
/* 0x4D8 */ s32 controllerType;
/* 0x4DC */ f32 controllerBoomLen;
/* 0x4E0 */ f32 controllerBoomPitch;
/* 0x4E4 */ struct Vec3f posA;
/* 0x4F0 */ struct Vec3f posB;
/* 0x4E4 */ Vec3f posA;
/* 0x4F0 */ Vec3f posB;
/* 0x4FC */ f32 controllerViewPitch;
/* 0x500 */ s32 unk_500;
/* 0x504 */ s16 boolTargetPlayer;
@ -767,7 +767,7 @@ typedef struct ItemEntity {
/* 0x00 */ s32 flags;
/* 0x04 */ s16 boundVar; /* see make_item_entity */
/* 0x06 */ char unk_06[2];
/* 0x08 */ struct Vec3f position;
/* 0x08 */ Vec3f position;
/* 0x14 */ struct ItemEntityPhysicsData* physicsData;
/* 0x18 */ s16 itemID; /* into item table, also worldIconID */
/* 0x1A */ u8 state;
@ -806,10 +806,10 @@ typedef struct SpriteComponent {
/* 0x10 */ s32 loopCounter;
/* 0x14 */ s32 currentRaster;
/* 0x18 */ s32 currentPalette;
/* 0x1C */ struct Vec3f posOffset;
/* 0x28 */ struct Vec3f compPos;
/* 0x34 */ struct Vec3f rotation;
/* 0x40 */ struct Vec3f scale;
/* 0x1C */ Vec3f posOffset;
/* 0x28 */ Vec3f compPos;
/* 0x34 */ Vec3f rotation;
/* 0x40 */ Vec3f scale;
/* 0x4C */ char unk_4C[4];
} SpriteComponent; // size = 0x50
@ -897,7 +897,7 @@ typedef struct GameStatus {
/* 0x08E */ s16 entryID;
/* 0x090 */ char unk_90[4];
/* 0x094 */ f32 exitAngle;
/* 0x098 */ struct Vec3f playerPos;
/* 0x098 */ Vec3f playerPos;
/* 0x0A4 */ f32 playerYaw;
/* 0x0A8 */ s8 unk_A8;
/* 0x0A9 */ s8 unk_A9;
@ -942,8 +942,8 @@ typedef struct PartnerAnimations {
typedef struct Shadow {
/* 0x00 */ s32 flags;
/* 0x04 */ char unk_04[12];
/* 0x10 */ struct Vec3f position;
/* 0x1C */ struct Vec3f scale;
/* 0x10 */ Vec3f position;
/* 0x1C */ Vec3f scale;
/* 0x28 */ char unk_28[80];
} Shadow; // size = 0x78
@ -1005,13 +1005,13 @@ typedef struct ActorPart {
/* 0x10 */ struct ActorPartMovement* movement;
/* 0x14 */ s16 partOffset[3];
/* 0x1A */ s16 visualOffset[3];
/* 0x20 */ struct Vec3f partOffsetFloat;
/* 0x2C */ struct Vec3f absolutePosition;
/* 0x38 */ struct Vec3f rotation;
/* 0x20 */ Vec3f partOffsetFloat;
/* 0x2C */ Vec3f absolutePosition;
/* 0x38 */ Vec3f rotation;
/* 0x44 */ s16 rotationPivotOffset[3];
/* 0x4A */ char unk_4A[2];
/* 0x4C */ f32 scale[3];
/* 0x58 */ struct Vec3f currentPos;
/* 0x58 */ Vec3f currentPos;
/* 0x64 */ f32 yaw;
/* 0x68 */ s16 unkOffset[2];
/* 0x6C */ s16 targetOffset[2];
@ -1142,14 +1142,14 @@ typedef struct Encounter {
typedef struct PlayerPathElement {
/* 0x00 */ char unk_00[4];
/* 0x04 */ struct Vec3f pos;
/* 0x04 */ Vec3f pos;
} PlayerPathElement; // size = 0x10
typedef struct AnimatedModel {
/* 0x00 */ s32 animModelID;
/* 0x04 */ struct Vec3f pos; /* Created by retype action */
/* 0x10 */ struct Vec3f rot;
/* 0x1C */ struct Vec3f scale;
/* 0x04 */ Vec3f pos; /* Created by retype action */
/* 0x10 */ Vec3f rot;
/* 0x1C */ Vec3f scale;
/* 0x28 */ struct Matrix4s* mtx;
/* 0x2C */ char unk_2C[60];
/* 0x68 */ u32 currentAnimData;
@ -1182,9 +1182,9 @@ typedef struct Actor {
/* 0x000 */ s32 flags;
/* 0x004 */ char unk_04[4];
/* 0x008 */ struct StaticActorData* staticActorData;
/* 0x00C */ struct Vec3f moveCurrentPos;
/* 0x018 */ struct Vec3f moveGoalPos;
/* 0x024 */ struct Vec3f moveEndPos; /* where other actors should target this one at. saved before partner switching */
/* 0x00C */ Vec3f moveCurrentPos;
/* 0x018 */ Vec3f moveGoalPos;
/* 0x024 */ Vec3f moveEndPos; /* where other actors should target this one at. saved before partner switching */
/* 0x030 */ char unk_30[24];
/* 0x048 */ f32 jumpAccel;
/* 0x04C */ f32 moveSpeed;
@ -1202,9 +1202,9 @@ typedef struct Actor {
/* 0x077 */ u8 jumpPartIndex;
/* 0x078 */ char unk_78[16];
/* 0x088 */ s32 varTable[16];
/* 0x0C8 */ struct Vec3f flyCurrentPos;
/* 0x0D4 */ struct Vec3f flyGoalPos;
/* 0x0E0 */ struct Vec3f flyTempPos; /* used for start in fly functions, end in flyrun functions */
/* 0x0C8 */ Vec3f flyCurrentPos;
/* 0x0D4 */ Vec3f flyGoalPos;
/* 0x0E0 */ Vec3f flyTempPos; /* used for start in fly functions, end in flyrun functions */
/* 0x0EC */ char unk_EC[24];
/* 0x104 */ f32 flyJumpAccel;
/* 0x108 */ f32 flySpeed;
@ -1219,8 +1219,8 @@ typedef struct Actor {
/* 0x135 */ u8 footStepCounter;
/* 0x136 */ u8 actorType;
/* 0x137 */ char unk_137;
/* 0x138 */ struct Vec3f homePos;
/* 0x144 */ struct Vec3f currentPos;
/* 0x138 */ Vec3f homePos;
/* 0x144 */ Vec3f currentPos;
/* 0x150 */ Vec3s headOffset;
/* 0x156 */ s16 healthBarPosition[3];
/* 0x15C */ f32 rotation[3];
@ -1382,8 +1382,8 @@ typedef struct PlayerStatus {
/* 0x014 */ s8 enableCollisionOverlapsCheck;
/* 0x015 */ s8 statusMenuCounterinputEnabledCounter; /* whether the C-up menu can appear */
/* 0x016 */ Vec3s lastGoodPosition;
/* 0x01C */ struct Vec3f extraVelocity;
/* 0x028 */ struct Vec3f position;
/* 0x01C */ Vec3f extraVelocity;
/* 0x028 */ Vec3f position;
/* 0x034 */ char unk_34[16];
/* 0x044 */ f32 decorationPos[2];
/* 0x04C */ char unk_4C[4];
@ -1501,4 +1501,14 @@ typedef struct SaveData {
/* 0x1304 */ char unk_1304[0x7C];
} SaveData; // size = 0x1380
typedef struct {
/* 0x00 */ s32 numVectors;
/* 0x04 */ s32 unk_04;
/* 0x08 */ Vec3f* staticVectorList;
/* 0x0C */ Vec3f* vectors;
/* 0x10 */ s32 timeElapsed;
/* 0x14 */ s32 timeLeft;
/* 0x18 */ s32 easingType;
} Path; // size = 0x1C
#endif

View File

@ -351,7 +351,27 @@ INCLUDE_ASM(s32, "code_f8f60_len_1560", setup_path_data);
INCLUDE_ASM(s32, "code_f8f60_len_1560", func_802D5270);
INCLUDE_ASM(s32, "code_f8f60_len_1560", LoadPath, ScriptInstance* script, s32 isInitialCall);
s32 LoadPath(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 time = get_variable(script, *args++);
s32 vectorList = get_variable(script, *args++);
s32 numVectors = get_variable(script, *args++);
s32 easingType = get_variable(script, *args++);
Path* path = heap_malloc(sizeof(Path));
script->varTable[15] = path;
path->numVectors = numVectors;
path->unk_04 = heap_malloc(numVectors * sizeof(f32));
path->staticVectorList = vectorList;
path->vectors = heap_malloc(numVectors * sizeof(Vec3f));
setup_path_data(path->numVectors, path->unk_04, path->staticVectorList, path->vectors);
path->timeElapsed = 0;
path->timeLeft = time - 1;
path->easingType = easingType;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_f8f60_len_1560", GetNextPathPos, ScriptInstance* script, s32 isInitialCall);