This commit is contained in:
Alex Bates 2020-12-29 11:35:59 +00:00
parent c1e7d3310c
commit 77a3238a3b
3 changed files with 209 additions and 164 deletions

View File

@ -21,6 +21,12 @@ typedef struct Vec2bu {
/* 0x01 */ u8 y; /* 0x01 */ u8 y;
} Vec2bu; // size = 0x02 } Vec2bu; // size = 0x02
typedef struct Vec3b {
/* 0x00 */ s8 x;
/* 0x01 */ s8 y;
/* 0x02 */ s8 z;
} Vec3b; // size = 0x03
typedef struct Vec3f { typedef struct Vec3f {
/* 0x00 */ f32 x; /* 0x00 */ f32 x;
/* 0x04 */ f32 y; /* 0x04 */ f32 y;
@ -1017,7 +1023,7 @@ typedef struct ActorPartMovement {
typedef struct ActorPart { typedef struct ActorPart {
/* 0x00 */ s32 flags; /* 0x00 */ s32 flags;
/* 0x04 */ s32 targetFlags; /* initialized to 0 */ /* 0x04 */ s32 targetFlags; /* initialized to 0 */
/* 0x08 */ struct StaticActorPart* staticData; /* 0x08 */ struct ActorPartDesc* staticData;
/* 0x0C */ struct ActorPart* nextPart; /* 0x0C */ struct ActorPart* nextPart;
/* 0x10 */ struct ActorPartMovement* movement; /* 0x10 */ struct ActorPartMovement* movement;
/* 0x14 */ Vec3s partOffset; /* 0x14 */ Vec3s partOffset;
@ -1333,19 +1339,6 @@ typedef struct Actor {
/* 0x440 */ struct MenuIcon* ptrDefuffIcon; /* 0x440 */ struct MenuIcon* ptrDefuffIcon;
} Actor; // size = 0x444 } Actor; // size = 0x444
typedef struct StaticActorPart {
/* 0x00 */ s32 flags;
/* 0x04 */ s8 index;
/* 0x05 */ u8 posOffset[3];
/* 0x08 */ u8 targetOffset[2];
/* 0x0A */ s16 opacity;
/* 0x0C */ u32* idleAnimations;
/* 0x10 */ u32* defenseTable;
/* 0x14 */ s32 eventFlags;
/* 0x18 */ s32 flags3;
/* 0x1C */ char unk_1C[8];
} StaticActorPart; // size = 0x24
typedef struct TileDescriptor { typedef struct TileDescriptor {
/* 0x00 */ s8 name[32]; /* 0x00 */ s8 name[32];
/* 0x20 */ s16 auxW; /* 0x20 */ s16 auxW;

View File

@ -1,6 +1,7 @@
#include "common.h" #include "common.h"
#include "battle/battle.h" #include "battle/battle.h"
#include "script_api/battle.h" #include "script_api/battle.h"
#include "sprite/npc/goomba.h"
#include "goomba.h" #include "goomba.h"
ApiStatus func_8021818C_430B2C(ScriptInstance* script, s32 isInitialCall); ApiStatus func_8021818C_430B2C(ScriptInstance* script, s32 isInitialCall);
@ -9,7 +10,7 @@ s32 idleAnimations_80219714[];
s32 defenseTable_80219610[]; s32 defenseTable_80219610[];
s32 statusTable_8021961C[]; s32 statusTable_8021961C[];
s32 defenseTable_80219610[]; s32 defenseTable_80219610[];
s32 partsTable_802196C8[]; ActorPartDesc partsTable_802196C8[];
Script script_Init_802197AC; Script script_Init_802197AC;
Script script_TakeTurn_8021A300; Script script_TakeTurn_8021A300;
Script script_Idle_802197F8; Script script_Idle_802197F8;
@ -17,23 +18,53 @@ Script script_HandleEvent_80219AD4;
// 431FB0-431FBC (VRAM: 80219610) // 431FB0-431FBC (VRAM: 80219610)
s32 defenseTable_80219610[] = { s32 defenseTable_80219610[] = {
0x00000001, 0x00000000, 0x00000000, Element_NORMAL, 0,
Element_END,
}; };
// 431FBC-432068 (VRAM: 8021961C) // 431FBC-432068 (VRAM: 8021961C)
s32 statusTable_8021961C[] = { s32 statusTable_8021961C[] = {
0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000006, 0x00000064, 0x00000009, 0x00000064, Debuff_NORMAL, 0,
0x00000007, 0x00000064, 0x00000004, 0x00000064, 0x00000003, 0x00000064, 0x0000000B, 0x00000064, Debuff_DEFAULT, 0,
0x00000005, 0x00000064, 0x0000000A, 0x00000064, 0x00000008, 0x00000064, 0x0000001F, 0x00000000, Debuff_SLEEP, 100,
0x00000020, 0x00000000, 0x00000025, 0x00000000, 0x00000022, 0x00000000, 0x00000024, 0x00000000, Debuff_POISON, 100,
0x00000023, 0x00000000, 0x00000021, 0x00000000, 0x00000026, 0x00000000, 0x00000027, 0x00000000, Debuff_FROZEN, 100,
0x00000029, 0x00000000, 0x00000000, Debuff_DIZZY, 100,
Debuff_FEAR, 100,
Debuff_STATIC, 100,
Debuff_PARALYZE, 100,
Debuff_SHRINK, 100,
Debuff_STOP, 100,
Debuff_DEFAULT_TURN_MOD, 0,
Debuff_SLEEP_TURN_MOD, 0,
Debuff_POISON_TURN_MOD, 0,
Debuff_FROZEN_TURN_MOD, 0,
Debuff_DIZZY_TURN_MOD, 0,
Debuff_FEAR_TURN_MOD, 0,
Debuff_STATIC_TURN_MOD, 0,
Debuff_PARALYZE_TURN_MOD, 0,
Debuff_SHRINK_TURN_MOD, 0,
Debuff_STOP_TURN_MOD, 0,
Debuff_END,
}; };
// 432068-43208C (VRAM: 802196C8) // 432068-43208C (VRAM: 802196C8)
s32 partsTable_802196C8[] = { ActorPartDesc partsTable_802196C8[] = {
0x00800000, 0x01000000, 0x001400FF, idleAnimations_80219714, defenseTable_80219610, 0x00000000, 0x00000000, 0x00F60000, {
0x00000000, .flags = 0x00800000,
.index = 1,
.posOffset = { 0, 0, 0 },
.targetOffset = { 0, 0x14 },
.opacity = 0xFF,
.idleAnimations = idleAnimations_80219714,
.defenseTable = defenseTable_80219610,
.eventFlags = 0,
.elementImmunityFlags = 0,
0x00, 0xF6,
},
}; };
// 43208C-4320B4 (VRAM: 802196EC) // 43208C-4320B4 (VRAM: 802196EC)
@ -62,9 +93,17 @@ ActorDesc goomba = {
// 4320B4-432100 (VRAM: 80219714) // 4320B4-432100 (VRAM: 80219714)
s32 idleAnimations_80219714[] = { s32 idleAnimations_80219714[] = {
0x00000001, 0x00260001, 0x0000000C, 0x00260000, 0x00000006, 0x00260008, 0x00000009, 0x00260001, Debuff_NORMAL, NPC_ANIM(goomba, normal, idle),
0x00000008, 0x00260000, 0x0000000B, 0x00260001, 0x00000005, 0x00260000, 0x00000004, 0x00260007, Debuff_STONE, NPC_ANIM(goomba, normal, still),
0x00000003, 0x00260007, 0x00000000, Debuff_SLEEP, NPC_ANIM(goomba, normal, asleep),
Debuff_POISON, NPC_ANIM(goomba, normal, idle),
Debuff_STOP, NPC_ANIM(goomba, normal, still),
Debuff_STATIC, NPC_ANIM(goomba, normal, idle),
Debuff_PARALYZE, NPC_ANIM(goomba, normal, still),
Debuff_DIZZY, NPC_ANIM(goomba, normal, dizzy),
Debuff_FEAR, NPC_ANIM(goomba, normal, dizzy),
Debuff_END,
}; };
// 432100-43214C (VRAM: 80219760) // 432100-43214C (VRAM: 80219760)
@ -76,9 +115,9 @@ s32 idleAnimations_80219760[] = {
// 43214C-432198 (VRAM: 802197AC) // 43214C-432198 (VRAM: 802197AC)
Script script_Init_802197AC = SCRIPT({ Script script_Init_802197AC = SCRIPT({
BindTakeTurn(0xFFFFFF81, script_TakeTurn_8021A300); BindTakeTurn(ActorID_SELF, script_TakeTurn_8021A300);
BindIdle(0xFFFFFF81, script_Idle_802197F8); BindIdle(ActorID_SELF, script_Idle_802197F8);
BindHandleEvent(0xFFFFFF81, script_HandleEvent_80219AD4); BindHandleEvent(ActorID_SELF, script_HandleEvent_80219AD4);
}); });
// 432198-432474 (VRAM: 802197F8) // 432198-432474 (VRAM: 802197F8)
@ -88,39 +127,39 @@ Script script_Idle_802197F8 = SCRIPT({
SI_VAR(0) += 80; SI_VAR(0) += 80;
loop SI_VAR(0) { loop SI_VAR(0) {
0: 0:
GetStatusFlags(0xFFFFFF81, SI_VAR(1)); GetStatusFlags(ActorID_SELF, SI_VAR(1));
if (SI_VAR(1) ? 0x35D000) { if (SI_VAR(1) ? 0x35D000) {
sleep 1; sleep 1;
goto 0; goto 0;
} }
sleep 1; sleep 1;
} }
GetActorPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); GetActorPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 5; SI_VAR(0) += 5;
SetActorIdleSpeed(0xFFFFFF81, 1.0); SetActorIdleSpeed(ActorID_SELF, 1.0);
SetIdleAnimations(0xFFFFFF81, 1, idleAnimations_80219760); SetIdleAnimations(ActorID_SELF, 1, idleAnimations_80219760);
SetIdleGoal(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetIdleGoal(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(0xFFFFFF81, 0); IdleRunToGoal(ActorID_SELF, 0);
SetIdleAnimations(0xFFFFFF81, 1, idleAnimations_80219714); SetIdleAnimations(ActorID_SELF, 1, idleAnimations_80219714);
loop 20 { loop 20 {
1: 1:
GetStatusFlags(0xFFFFFF81, SI_VAR(1)); GetStatusFlags(ActorID_SELF, SI_VAR(1));
if (SI_VAR(1) ? 0x35D000) { if (SI_VAR(1) ? 0x35D000) {
sleep 1; sleep 1;
goto 1; goto 1;
} }
sleep 1; sleep 1;
} }
GetActorPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); GetActorPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 5; SI_VAR(0) -= 5;
SetActorIdleSpeed(0xFFFFFF81, 1.0); SetActorIdleSpeed(ActorID_SELF, 1.0);
SetIdleAnimations(0xFFFFFF81, 1, idleAnimations_80219760); SetIdleAnimations(ActorID_SELF, 1, idleAnimations_80219760);
SetIdleGoal(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetIdleGoal(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(0xFFFFFF81, 0); IdleRunToGoal(ActorID_SELF, 0);
SetIdleAnimations(0xFFFFFF81, 1, idleAnimations_80219714); SetIdleAnimations(ActorID_SELF, 1, idleAnimations_80219714);
loop 80 { loop 80 {
2: 2:
GetStatusFlags(0xFFFFFF81, SI_VAR(1)); GetStatusFlags(ActorID_SELF, SI_VAR(1));
if (SI_VAR(1) ? 0x35D000) { if (SI_VAR(1) ? 0x35D000) {
sleep 1; sleep 1;
goto 2; goto 2;
@ -132,10 +171,10 @@ Script script_Idle_802197F8 = SCRIPT({
// 432474-432B34 (VRAM: 80219AD4) // 432474-432B34 (VRAM: 80219AD4)
Script script_HandleEvent_80219AD4 = SCRIPT({ Script script_HandleEvent_80219AD4 = SCRIPT({
UseIdleAnimation(0xFFFFFF81, 0); UseIdleAnimation(ActorID_SELF, 0);
EnableIdleScript(0xFFFFFF81, 0); EnableIdleScript(ActorID_SELF, 0);
SetActorScale(0xFFFFFF81, 1.0, 1.0, 1.0); SetActorScale(ActorID_SELF, 1.0, 1.0, 1.0);
GetLastEvent(0xFFFFFF81, SI_VAR(0)); GetLastEvent(ActorID_SELF, SI_VAR(0));
match SI_VAR(0) { match SI_VAR(0) {
9, 10 { 9, 10 {
SI_VAR(0) = c 0x1; SI_VAR(0) = c 0x1;
@ -179,17 +218,17 @@ Script script_HandleEvent_80219AD4 = SCRIPT({
SI_VAR(0) = c 0x1; SI_VAR(0) = c 0x1;
SI_VAR(1) = c 0x260005; SI_VAR(1) = c 0x260005;
await DoJumpBack; await DoJumpBack;
JumpToGoal(0xFFFFFF81, 5, 0, 1, 0); JumpToGoal(ActorID_SELF, 5, 0, 1, 0);
SetAnimationRate(0xFFFFFF81, 1, 2.0); SetAnimationRate(ActorID_SELF, 1, 2.0);
SetAnimation(0xFFFFFF81, 1, 0x260007); SetAnimation(ActorID_SELF, 1, 0x260007);
SetGoalToHome(0xFFFFFF81); SetGoalToHome(ActorID_SELF);
SetActorSpeed(0xFFFFFF81, 8.0); SetActorSpeed(ActorID_SELF, 8.0);
RunToGoal(0xFFFFFF81, 0, 0); RunToGoal(ActorID_SELF, 0, 0);
SetAnimationRate(0xFFFFFF81, 1, 1.0); SetAnimationRate(ActorID_SELF, 1, 1.0);
sleep 5; sleep 5;
SetAnimation(0xFFFFFF81, 1, 0x260001); SetAnimation(ActorID_SELF, 1, 0x260001);
SetActorJumpGravity(0xFFFFFF81, 1.6005859375); SetActorJumpGravity(ActorID_SELF, 1.6005859375);
JumpToGoal(0xFFFFFF81, 5, 0, 1, 0); JumpToGoal(ActorID_SELF, 5, 0, 1, 0);
} }
== 38 { == 38 {
SI_VAR(0) = c 0x1; SI_VAR(0) = c 0x1;
@ -216,13 +255,13 @@ Script script_HandleEvent_80219AD4 = SCRIPT({
return; return;
} }
== 53 { == 53 {
SetAnimationRate(0xFFFFFF81, 1, 2.0); SetAnimationRate(ActorID_SELF, 1, 2.0);
SetAnimation(0xFFFFFF81, 1, 0x260003); SetAnimation(ActorID_SELF, 1, 0x260003);
SetGoalToHome(0xFFFFFF81); SetGoalToHome(ActorID_SELF);
SetActorSpeed(0xFFFFFF81, 4.0); SetActorSpeed(ActorID_SELF, 4.0);
RunToGoal(0xFFFFFF81, 0, 0); RunToGoal(ActorID_SELF, 0, 0);
SetAnimationRate(0xFFFFFF81, 1, 1.0); SetAnimationRate(ActorID_SELF, 1, 1.0);
HPBarToHome(0xFFFFFF81); HPBarToHome(ActorID_SELF);
} }
== 49 { == 49 {
SI_VAR(0) = c 0x1; SI_VAR(0) = c 0x1;
@ -249,9 +288,9 @@ Script script_HandleEvent_80219AD4 = SCRIPT({
} else { } else {
} }
} }
SetAnimation(0xFFFFFF81, 1, 0x260001); SetAnimation(ActorID_SELF, 1, 0x260001);
EnableIdleScript(0xFFFFFF81, 1); EnableIdleScript(ActorID_SELF, 1);
UseIdleAnimation(0xFFFFFF81, 1); UseIdleAnimation(ActorID_SELF, 1);
}); });
// 432B34-432CA0 (VRAM: 8021A194) // 432B34-432CA0 (VRAM: 8021A194)
@ -272,42 +311,42 @@ f32 floatTable_8021A194[] = {
// 432CA0-433968 (VRAM: 8021A300) // 432CA0-433968 (VRAM: 8021A300)
Script script_TakeTurn_8021A300 = SCRIPT({ Script script_TakeTurn_8021A300 = SCRIPT({
UseIdleAnimation(0xFFFFFF81, 0); UseIdleAnimation(ActorID_SELF, 0);
EnableIdleScript(0xFFFFFF81, 0); EnableIdleScript(ActorID_SELF, 0);
SetTargetActor(0xFFFFFF81, 0); SetTargetActor(ActorID_SELF, 0);
UseCamPreset(63); UseCamPreset(63);
BattleCamTargetActor(0xFFFFFF81); BattleCamTargetActor(ActorID_SELF);
0x8024ECF8(-1, 1, 0); 0x8024ECF8(-1, 1, 0);
SetAnimation(0xFFFFFF81, 1, 0x260003); SetAnimation(ActorID_SELF, 1, 0x260003);
SetGoalToTarget(0xFFFFFF81); SetGoalToTarget(ActorID_SELF);
AddGoalPos(0xFFFFFF81, 50, 0, 0); AddGoalPos(ActorID_SELF, 50, 0, 0);
SetActorSpeed(0xFFFFFF81, 6.0); SetActorSpeed(ActorID_SELF, 6.0);
RunToGoal(0xFFFFFF81, 0, 0); RunToGoal(ActorID_SELF, 0, 0);
SetAnimation(0xFFFFFF81, 1, 0x260001); SetAnimation(ActorID_SELF, 1, 0x260001);
SetActorDispOffset(0xFFFFFF81, 0, -1, 0); SetActorDispOffset(ActorID_SELF, 0, -1, 0);
sleep 1; sleep 1;
SetActorDispOffset(0xFFFFFF81, 0, 0xFFFFFFFE, 0); SetActorDispOffset(ActorID_SELF, 0, 0xFFFFFFFE, 0);
sleep 5; sleep 5;
SetActorDispOffset(0xFFFFFF81, 0, 0, 0); SetActorDispOffset(ActorID_SELF, 0, 0, 0);
SetAnimation(0xFFFFFF81, 1, 0x260004); SetAnimation(ActorID_SELF, 1, 0x260004);
EnemyTestTarget(0xFFFFFF81, SI_VAR(0), 0, 0, 1, 16); EnemyTestTarget(ActorID_SELF, SI_VAR(0), 0, 0, 1, 16);
match SI_VAR(0) { match SI_VAR(0) {
6, 5 { 6, 5 {
SI_VAR(10) = SI_VAR(0); SI_VAR(10) = SI_VAR(0);
SetGoalToTarget(0xFFFFFF81); SetGoalToTarget(ActorID_SELF);
GetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 10; SI_VAR(0) -= 10;
SI_VAR(1) = 10; SI_VAR(1) = 10;
SI_VAR(2) += 3; SI_VAR(2) += 3;
SetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorJumpGravity(0xFFFFFF81, 1.2001953125); SetActorJumpGravity(ActorID_SELF, 1.2001953125);
spawn { spawn {
GetActorPos(0xFFFFFF81, SI_VAR(1), SI_VAR(2), SI_VAR(0)); GetActorPos(ActorID_SELF, SI_VAR(1), SI_VAR(2), SI_VAR(0));
SI_VAR(0) = 0; SI_VAR(0) = 0;
loop 16 { loop 16 {
GetActorPos(0xFFFFFF81, SI_VAR(4), SI_VAR(5), SI_VAR(6)); GetActorPos(ActorID_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
func_8021818C_430B2C(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0)); func_8021818C_430B2C(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(0xFFFFFF81, 0, 0, SI_VAR(0)); SetActorRotation(ActorID_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4); SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5); SI_VAR(2) = SI_VAR(5);
SI_VAR(3) = SI_VAR(6); SI_VAR(3) = SI_VAR(6);
@ -316,73 +355,73 @@ Script script_TakeTurn_8021A300 = SCRIPT({
} }
spawn { spawn {
sleep 6; sleep 6;
SetAnimation(0xFFFFFF81, 1, 0x260004); SetAnimation(ActorID_SELF, 1, 0x260004);
} }
JumpToGoal(0xFFFFFF81, 16, 0, 1, 0); JumpToGoal(ActorID_SELF, 16, 0, 1, 0);
SetAnimation(0xFFFFFF81, 1, 0x260008); SetAnimation(ActorID_SELF, 1, 0x260008);
SetActorScale(0xFFFFFF81, 1.1005859375, 0.80078125, 1.0); SetActorScale(ActorID_SELF, 1.1005859375, 0.80078125, 1.0);
SetActorDispOffset(0xFFFFFF81, 0, 5, 0); SetActorDispOffset(ActorID_SELF, 0, 5, 0);
sleep 1; sleep 1;
SetActorScale(0xFFFFFF81, 1.30078125, 0.5, 1.0); SetActorScale(ActorID_SELF, 1.30078125, 0.5, 1.0);
SetActorDispOffset(0xFFFFFF81, 0, 0xFFFFFFFE, 0); SetActorDispOffset(ActorID_SELF, 0, 0xFFFFFFFE, 0);
sleep 1; sleep 1;
SetActorScale(0xFFFFFF81, 1.0, 1.0, 1.0); SetActorScale(ActorID_SELF, 1.0, 1.0, 1.0);
SetActorDispOffset(0xFFFFFF81, 0, 7, 0); SetActorDispOffset(ActorID_SELF, 0, 7, 0);
SetAnimation(0xFFFFFF81, 1, 0x260005); SetAnimation(ActorID_SELF, 1, 0x260005);
sleep 5; sleep 5;
if (SI_VAR(10) == 5) { if (SI_VAR(10) == 5) {
EnemyTestTarget(0xFFFFFF81, SI_VAR(0), 0x80000000, 0, 0, 0); EnemyTestTarget(ActorID_SELF, SI_VAR(0), 0x80000000, 0, 0, 0);
} }
sleep 5; sleep 5;
SetActorDispOffset(0xFFFFFF81, 0, 0, 0); SetActorDispOffset(ActorID_SELF, 0, 0, 0);
SetAnimation(0xFFFFFF81, 1, 0x260004); SetAnimation(ActorID_SELF, 1, 0x260004);
SetGoalToTarget(0xFFFFFF81); SetGoalToTarget(ActorID_SELF);
GetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20; SI_VAR(0) += 20;
SI_VAR(1) = 0; SI_VAR(1) = 0;
SetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorJumpGravity(0xFFFFFF81, 2.0); SetActorJumpGravity(ActorID_SELF, 2.0);
spawn { spawn {
sleep 4; sleep 4;
SI_VAR(0) = 180; SI_VAR(0) = 180;
loop 4 { loop 4 {
SI_VAR(0) -= 45; SI_VAR(0) -= 45;
SetActorRotation(0xFFFFFF81, 0, 0, SI_VAR(0)); SetActorRotation(ActorID_SELF, 0, 0, SI_VAR(0));
sleep 1; sleep 1;
} }
SetAnimation(0xFFFFFF81, 1, 0x260004); SetAnimation(ActorID_SELF, 1, 0x260004);
} }
JumpToGoal(0xFFFFFF81, 15, 0, 1, 0); JumpToGoal(ActorID_SELF, 15, 0, 1, 0);
SetAnimation(0xFFFFFF81, 1, 0x260007); SetAnimation(ActorID_SELF, 1, 0x260007);
sleep 5; sleep 5;
UseCamPreset(2); UseCamPreset(2);
YieldTurn(); YieldTurn();
SetActorYaw(0xFFFFFF81, 180); SetActorYaw(ActorID_SELF, 180);
AddActorDecoration(0xFFFFFF81, 1, 0, 2); AddActorDecoration(ActorID_SELF, 1, 0, 2);
SetAnimationRate(0xFFFFFF81, 1, 2.0); SetAnimationRate(ActorID_SELF, 1, 2.0);
SetGoalToHome(0xFFFFFF81); SetGoalToHome(ActorID_SELF);
SetActorSpeed(0xFFFFFF81, 8.0); SetActorSpeed(ActorID_SELF, 8.0);
RunToGoal(0xFFFFFF81, 0, 0); RunToGoal(ActorID_SELF, 0, 0);
SetAnimationRate(0xFFFFFF81, 1, 1.0); SetAnimationRate(ActorID_SELF, 1, 1.0);
SetActorYaw(0xFFFFFF81, 0); SetActorYaw(ActorID_SELF, 0);
sleep 5; sleep 5;
SetAnimation(0xFFFFFF81, 1, 0x260001); SetAnimation(ActorID_SELF, 1, 0x260001);
SetActorJumpGravity(0xFFFFFF81, 1.6005859375); SetActorJumpGravity(ActorID_SELF, 1.6005859375);
JumpToGoal(0xFFFFFF81, 5, 0, 1, 0); JumpToGoal(ActorID_SELF, 5, 0, 1, 0);
RemoveActorDecoration(0xFFFFFF81, 1, 0); RemoveActorDecoration(ActorID_SELF, 1, 0);
EnableIdleScript(0xFFFFFF81, 1); EnableIdleScript(ActorID_SELF, 1);
UseIdleAnimation(0xFFFFFF81, 1); UseIdleAnimation(ActorID_SELF, 1);
return; return;
} else { } else {
SetGoalToTarget(0xFFFFFF81); SetGoalToTarget(ActorID_SELF);
SetActorJumpGravity(0xFFFFFF81, 1.2001953125); SetActorJumpGravity(ActorID_SELF, 1.2001953125);
spawn { spawn {
GetActorPos(0xFFFFFF81, SI_VAR(1), SI_VAR(2), SI_VAR(0)); GetActorPos(ActorID_SELF, SI_VAR(1), SI_VAR(2), SI_VAR(0));
SI_VAR(0) = 0; SI_VAR(0) = 0;
loop 16 { loop 16 {
GetActorPos(0xFFFFFF81, SI_VAR(4), SI_VAR(5), SI_VAR(6)); GetActorPos(ActorID_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
func_8021818C_430B2C(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0)); func_8021818C_430B2C(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(0xFFFFFF81, 0, 0, SI_VAR(0)); SetActorRotation(ActorID_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4); SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5); SI_VAR(2) = SI_VAR(5);
SI_VAR(3) = SI_VAR(6); SI_VAR(3) = SI_VAR(6);
@ -391,51 +430,51 @@ Script script_TakeTurn_8021A300 = SCRIPT({
} }
spawn { spawn {
sleep 6; sleep 6;
SetAnimation(0xFFFFFF81, 1, 0x260004); SetAnimation(ActorID_SELF, 1, 0x260004);
} }
JumpToGoal(0xFFFFFF81, 16, 0, 1, 0); JumpToGoal(ActorID_SELF, 16, 0, 1, 0);
SetAnimation(0xFFFFFF81, 1, 0x26000B); SetAnimation(ActorID_SELF, 1, 0x26000B);
SetActorScale(0xFFFFFF81, 1.1005859375, 0.80078125, 1.0); SetActorScale(ActorID_SELF, 1.1005859375, 0.80078125, 1.0);
sleep 1; sleep 1;
SetActorScale(0xFFFFFF81, 1.30078125, 0.5, 1.0); SetActorScale(ActorID_SELF, 1.30078125, 0.5, 1.0);
sleep 1; sleep 1;
} }
} }
EnemyDamageTarget(0xFFFFFF81, SI_VAR(0), 0, 0, 0, 1, 32); EnemyDamageTarget(ActorID_SELF, SI_VAR(0), 0, 0, 0, 1, 32);
match SI_VAR(0) { match SI_VAR(0) {
0, 2 { 0, 2 {
UseCamPreset(2); UseCamPreset(2);
SetActorScale(0xFFFFFF81, 1.1005859375, 0.80078125, 1.0); SetActorScale(ActorID_SELF, 1.1005859375, 0.80078125, 1.0);
sleep 1; sleep 1;
SetActorScale(0xFFFFFF81, 1.0, 1.0, 1.0); SetActorScale(ActorID_SELF, 1.0, 1.0, 1.0);
sleep 1; sleep 1;
SetActorRotation(0xFFFFFF81, 0, 0, 0); SetActorRotation(ActorID_SELF, 0, 0, 0);
SetActorDispOffset(0xFFFFFF81, 0, 0, 0); SetActorDispOffset(ActorID_SELF, 0, 0, 0);
SetAnimation(0xFFFFFF81, 1, 0x260001); SetAnimation(ActorID_SELF, 1, 0x260001);
GetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 40; SI_VAR(0) += 40;
SI_VAR(1) = 0; SI_VAR(1) = 0;
SetActorJumpGravity(0xFFFFFF81, 1.80078125); SetActorJumpGravity(ActorID_SELF, 1.80078125);
SetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(0xFFFFFF81, 10, 0, 1, 0); JumpToGoal(ActorID_SELF, 10, 0, 1, 0);
SI_VAR(0) += 30; SI_VAR(0) += 30;
SetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(0xFFFFFF81, 8, 0, 1, 0); JumpToGoal(ActorID_SELF, 8, 0, 1, 0);
SI_VAR(0) += 20; SI_VAR(0) += 20;
SetGoalPos(0xFFFFFF81, SI_VAR(0), SI_VAR(1), SI_VAR(2)); SetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(0xFFFFFF81, 6, 0, 1, 0); JumpToGoal(ActorID_SELF, 6, 0, 1, 0);
SetAnimation(0xFFFFFF81, 1, 0x260001); SetAnimation(ActorID_SELF, 1, 0x260001);
sleep 3; sleep 3;
YieldTurn(); YieldTurn();
SetAnimationRate(0xFFFFFF81, 1, 2.0); SetAnimationRate(ActorID_SELF, 1, 2.0);
SetAnimation(0xFFFFFF81, 1, 0x260003); SetAnimation(ActorID_SELF, 1, 0x260003);
SetGoalToHome(0xFFFFFF81); SetGoalToHome(ActorID_SELF);
SetActorSpeed(0xFFFFFF81, 8.0); SetActorSpeed(ActorID_SELF, 8.0);
RunToGoal(0xFFFFFF81, 0, 0); RunToGoal(ActorID_SELF, 0, 0);
SetAnimationRate(0xFFFFFF81, 1, 1.0); SetAnimationRate(ActorID_SELF, 1, 1.0);
} }
} }
EnableIdleScript(0xFFFFFF81, 1); EnableIdleScript(ActorID_SELF, 1);
UseIdleAnimation(0xFFFFFF81, 1); UseIdleAnimation(ActorID_SELF, 1);
}); });

View File

@ -11,7 +11,7 @@ typedef struct ActorDesc {
/* 0x07 */ u8 maxHP; /* 0x07 */ u8 maxHP;
/* 0x08 */ s16 partCount; /* 0x08 */ s16 partCount;
/* 0x0A */ char unk_0A[2]; /* 0x0A */ char unk_0A[2];
/* 0x0C */ struct StaticActorPart** partsData; /* 0x0C */ struct ActorPartDesc** partsData;
/* 0x10 */ Bytecode* script; /* 0x10 */ Bytecode* script;
/* 0x14 */ s32* statusTable; /* 0x14 */ s32* statusTable;
/* 0x18 */ u8 escapeChance; /* 0x18 */ u8 escapeChance;
@ -66,6 +66,10 @@ typedef struct Battle {
/* 0x10 */ s32 unk_10; /* 0x10 */ s32 unk_10;
} BattleList[]; // size = 0x14 * n } BattleList[]; // size = 0x14 * n
#define BATTLE(name, formation, stage) { name, ARRAY_COUNT(formation), formation, stage }
// TODO: enum for home position (0..3 are floor, 4..7 are air, etc.)
typedef struct { typedef struct {
Element element; Element element;
s32 defense; s32 defense;
@ -73,8 +77,17 @@ typedef struct {
typedef DefenseTableEntry DefenseTable[]; typedef DefenseTableEntry DefenseTable[];
#define BATTLE(name, formation, stage) { name, ARRAY_COUNT(formation), formation, stage } typedef struct ActorPartDesc {
/* 0x00 */ s32 flags;
// TODO: enum for home position (0..3 are floor, 4..7 are air, etc.) /* 0x04 */ s8 index;
/* 0x05 */ Vec3b posOffset;
/* 0x08 */ Vec2b targetOffset;
/* 0x0A */ s16 opacity;
/* 0x0C */ s32* idleAnimations;
/* 0x10 */ s32* defenseTable;
/* 0x14 */ s32 eventFlags;
/* 0x18 */ s32 elementImmunityFlags;
/* 0x1C */ char unk_1C[8];
} ActorPartDesc; // size = 0x24
#endif #endif