Disassemble fully battle/area_kmr_part_1 (#307)

* generate c includes for img segments

* flatten battle/item/dusty_hammer.c

needs custom splat

* use .inc.c for c incbins

* fixy

* new stuff

* git subrepo pull (merge) --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "6120d18600"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "6120d18600"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* remove dumb

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "8a179e74ba"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "8a179e74ba"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* yaml cleaning

* Further yaml cleanup & battle item refactor

* remove rawptr

* disasm_script: handle = (const) NPC_ANIM

* disasm_script improvements

* wip

* it compiles!

* battles.c -> area.c

* squish warnings

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "fe30b60b75"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "fe30b60b75"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* all OK except rodata padding

* ok

* ACTOR_SELF

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
This commit is contained in:
alex 2021-07-12 13:06:00 +01:00 committed by GitHub
parent 6db3503055
commit 8decbeb3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 2047 additions and 491 deletions

View File

@ -279,6 +279,7 @@ ApiStatus func_8024CE9C(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802CABE8(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802CAE50(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_8024ECF8(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_8027D32C(ScriptInstance* script, s32 isInitialCall);
extern Script PlayerScriptDispatcher;
extern Script PeachScriptDispatcher;

View File

@ -1,13 +0,0 @@
#include "common.h"
#define NAMESPACE b_area_kmr_part_1
#include "common/BattleAreaAngleStuff.inc.c"
#define NAMESPACE dup_b_area_kmr_part_1
#include "common/BattleAreaAngleStuff.inc.c"
#define NAMESPACE b_area_kmr_part_1
#include "common/StartRumbleWithParams.inc.c"
#define NAMESPACE dup2_b_area_kmr_part_1
#include "common/BattleAreaAngleStuff.inc.c"

View File

@ -1,7 +0,0 @@
#include "common.h"
#define NAMESPACE b_area_kmr_part_1
#define NAMESPACE dup2_b_area_kmr_part_1
#include "common/UnkAngleFunc2.inc.c"
#define NAMESPACE b_area_kmr_part_1

View File

@ -1,5 +0,0 @@
#include "common.h"
#define NAMESPACE b_area_kmr_part_1
#include "common/UnkAngleFunc2.inc.c"

View File

@ -1,7 +0,0 @@
#include "common.h"
#define NAMESPACE b_area_kmr_part_1
#define NAMESPACE dup3_b_area_kmr_part_1
#include "common/UnkAngleFunc2.inc.c"
#define NAMESPACE b_area_kmr_part_1

View File

@ -1,9 +0,0 @@
#include "common.h"
#define NAMESPACE b_area_kmr_part_1
#define NAMESPACE dup_b_area_kmr_part_1
#include "common/UnkAngleFunc2.inc.c"
#define NAMESPACE b_area_kmr_part_1
#include "common/UnkFogFunc.inc.c"

View File

@ -0,0 +1,76 @@
#include "common.h"
// TODO: determine purpose and name accordingly
f32 N(angleTable)[] = {
0.000000f, 0.017452f, 0.034899f, 0.052336f, 0.069756f, 0.087156f, 0.104528f, 0.121869f,
0.139173f, 0.156434f, 0.173648f, 0.190809f, 0.207912f, 0.224951f, 0.241922f, 0.258819f,
0.275637f, 0.292372f, 0.309017f, 0.325568f, 0.342020f, 0.358368f, 0.374607f, 0.390731f,
0.406737f, 0.422618f, 0.438371f, 0.453990f, 0.469472f, 0.484810f, 0.500000f, 0.515038f,
0.529919f, 0.544639f, 0.559193f, 0.573576f, 0.587785f, 0.601815f, 0.615661f, 0.629320f,
0.642788f, 0.656059f, 0.669131f, 0.681998f, 0.694658f, 0.707107f, 0.719340f, 0.731354f,
0.743145f, 0.754710f, 0.766044f, 0.777146f, 0.788011f, 0.798636f, 0.809017f, 0.819152f,
0.829038f, 0.838671f, 0.848048f, 0.857167f, 0.866025f, 0.874620f, 0.882948f, 0.891007f,
0.898794f, 0.906308f, 0.913545f, 0.920505f, 0.927184f, 0.933580f, 0.939693f, 0.945519f,
0.951057f, 0.956305f, 0.961262f, 0.965926f, 0.970296f, 0.974370f, 0.978148f, 0.981627f,
0.984808f, 0.987688f, 0.990268f, 0.992546f, 0.994522f, 0.996195f, 0.997564f, 0.998630f,
0.999391f, 0.999848f, 1.000000f,
};
u32 N(angle_calculate)(f32 x, f32 y) {
f32 tempF = abs(y) / length2D(x, y);
u16 angle1 = 0;
u16 angle2 = 90;
u16 ret;
u16 i;
for (i = 0; i < 7; i++) {
u16 temp_v1 = angle1 + ((angle2 - angle1) / 2);
if (N(angleTable)[temp_v1] < tempF) {
angle1 = temp_v1;
} else {
angle2 = temp_v1;
}
}
if (fabsf(N(angleTable)[angle1] - tempF) < fabsf(N(angleTable)[angle2] - tempF)) {
ret = angle1;
} else {
ret = angle2;
}
if (x < 0.0f && y >= 0.0f) {
ret = 180 - ret;
}
if (x < 0.0f && y < 0.0f) {
ret += 180;
}
if (x >= 0.0f && y < 0.0f) {
ret = 360 - ret;
}
return ret;
}
ApiStatus N(AngleCalculate)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args++);
s32 var3 = get_variable(script, *args++);
s32 var4 = get_variable(script, *args++);
s32 var5 = get_variable(script, *args);
var3 -= var1;
var4 -= var2;
if (var3 == 0 && var4 == 0) {
set_variable(script, *args, var5);
return ApiStatus_DONE2;
} else {
set_variable(script, *args, N(angle_calculate)(var3, var4) - 90);
return ApiStatus_DONE2;
}
}

View File

@ -2,29 +2,15 @@
#include "battle/battle.h"
#include "script_api/battle.h"
#include "sprite/npc/goomba.h"
#include "goomba.h"
#define NAMESPACE b_area_kmr_part_1
#define NAMESPACE b_area_kmr_part_1_goomba
ApiStatus N(BattleAreaAngleStuff2)(ScriptInstance* script, s32 isInitialCall);
extern s32 goomba_anims_running[];
extern s32 goomba_anims[];
extern s32 goomba_defense_table[];
extern s32 goomba_status_table[];
extern s32 goomba_defense_table[];
extern ActorPartDesc goomba_parts[];
extern Script goomba_init;
extern Script goomba_turn;
extern Script goomba_idle;
extern Script goomba_dispatch;
s32 goomba_defense_table[] = {
s32 N(defenseTable_80219610)[] = {
ELEMENT_NORMAL, 0,
ELEMENT_END,
};
s32 goomba_status_table[] = {
s32 N(statusTable_8021961C)[] = {
STATUS_NORMAL, 0,
STATUS_DEFAULT, 0,
STATUS_SLEEP, 100,
@ -49,30 +35,33 @@ s32 goomba_status_table[] = {
STATUS_END,
};
ActorPartDesc goomba_parts[] = {
s32 N(idleAnimations_80219714)[];
Script N(init_802197AC);
ActorPartDesc N(partsTable_802196C8)[] = {
{
.flags = 0x00800000,
.flags = PART_FLAG_MULTI_TARGET,
.index = 1,
.posOffset = { 0, 0, 0 },
.targetOffset = { 0, 20 },
.opacity = 0xFF,
.idleAnimations = goomba_anims,
.defenseTable = goomba_defense_table,
.opacity = 255,
.idleAnimations = N(idleAnimations_80219714),
.defenseTable = N(defenseTable_80219610),
.eventFlags = 0,
.elementImmunityFlags = 0,
0x00, 0xF6,
.unk_1C = 246,
},
};
ActorDesc goomba = {
ActorDesc NAMESPACE = {
.flags = 0,
.type = ACTOR_TYPE_goomba,
.level = 5,
.maxHP = 2,
.partCount = 1,
.partsData = &goomba_parts,
.script = &goomba_init,
.statusTable = &goomba_status_table,
.partCount = ARRAY_COUNT(N(partsTable_802196C8)),
.partsData = N(partsTable_802196C8),
.script = N(init_802197AC),
.statusTable = N(statusTable_8021961C),
.escapeChance = 90,
.airLiftChance = 100,
.spookChance = 90,
@ -87,48 +76,50 @@ ActorDesc goomba = {
.statusMessageOffset = { 10, 20 },
};
s32 goomba_anims[] = {
STATUS_NORMAL, NPC_ANIM(goomba, normal, idle),
STATUS_STONE, NPC_ANIM(goomba, normal, still),
STATUS_SLEEP, NPC_ANIM(goomba, normal, asleep),
STATUS_POISON, NPC_ANIM(goomba, normal, idle),
STATUS_STOP, NPC_ANIM(goomba, normal, still),
STATUS_STATIC, NPC_ANIM(goomba, normal, idle),
STATUS_PARALYZE, NPC_ANIM(goomba, normal, still),
STATUS_DIZZY, NPC_ANIM(goomba, normal, dizzy),
STATUS_FEAR, NPC_ANIM(goomba, normal, dizzy),
s32 N(idleAnimations_80219714)[] = {
STATUS_NORMAL, NPC_ANIM(goomba, normal, idle),
STATUS_STONE, NPC_ANIM(goomba, normal, still),
STATUS_SLEEP, NPC_ANIM(goomba, normal, asleep),
STATUS_POISON, NPC_ANIM(goomba, normal, idle),
STATUS_STOP, NPC_ANIM(goomba, normal, still),
STATUS_STATIC, NPC_ANIM(goomba, normal, idle),
STATUS_PARALYZE, NPC_ANIM(goomba, normal, still),
STATUS_DIZZY, NPC_ANIM(goomba, normal, dizzy),
STATUS_FEAR, NPC_ANIM(goomba, normal, dizzy),
STATUS_END,
};
s32 goomba_anims_running[] = {
STATUS_NORMAL, NPC_ANIM(goomba, normal, run),
STATUS_STONE, NPC_ANIM(goomba, normal, still),
STATUS_SLEEP, NPC_ANIM(goomba, normal, asleep),
STATUS_POISON, NPC_ANIM(goomba, normal, idle),
STATUS_STOP, NPC_ANIM(goomba, normal, still),
STATUS_STATIC, NPC_ANIM(goomba, normal, run),
STATUS_PARALYZE, NPC_ANIM(goomba, normal, still),
STATUS_DIZZY, NPC_ANIM(goomba, normal, dizzy),
STATUS_FEAR, NPC_ANIM(goomba, normal, dizzy),
s32 N(idleAnimations_80219760)[] = {
STATUS_NORMAL, NPC_ANIM(goomba, normal, run),
STATUS_STONE, NPC_ANIM(goomba, normal, still),
STATUS_SLEEP, NPC_ANIM(goomba, normal, asleep),
STATUS_POISON, NPC_ANIM(goomba, normal, idle),
STATUS_STOP, NPC_ANIM(goomba, normal, still),
STATUS_STATIC, NPC_ANIM(goomba, normal, run),
STATUS_PARALYZE, NPC_ANIM(goomba, normal, still),
STATUS_DIZZY, NPC_ANIM(goomba, normal, dizzy),
STATUS_FEAR, NPC_ANIM(goomba, normal, dizzy),
STATUS_END,
};
Script goomba_init = SCRIPT({
BindTakeTurn(ACTOR_SELF, goomba_turn);
BindIdle(ACTOR_SELF, goomba_idle);
BindHandleEvent(ACTOR_SELF, goomba_dispatch);
Script N(takeTurn_8021A300);
Script N(idle_802197F8);
Script N(handleEvent_80219AD4);
Script N(init_802197AC) = SCRIPT({
BindTakeTurn(ACTOR_SELF, N(takeTurn_8021A300));
BindIdle(ACTOR_SELF, N(idle_802197F8));
BindHandleEvent(ACTOR_SELF, N(handleEvent_80219AD4));
});
Script goomba_idle = SCRIPT({
Script N(idle_802197F8) = SCRIPT({
10:
RandInt(80, SI_VAR(0));
SI_VAR(0) += 80;
loop SI_VAR(0) {
0:
0:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 0x35D000) {
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 0;
}
@ -137,14 +128,14 @@ Script goomba_idle = SCRIPT({
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 5;
SetActorIdleSpeed(ACTOR_SELF, 1.0);
SetIdleAnimations(ACTOR_SELF, 1, goomba_anims_running);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_80219760));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(ACTOR_SELF, 0);
SetIdleAnimations(ACTOR_SELF, 1, goomba_anims);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_80219714));
loop 20 {
1:
1:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 0x35D000) {
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 1;
}
@ -153,14 +144,14 @@ Script goomba_idle = SCRIPT({
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 5;
SetActorIdleSpeed(ACTOR_SELF, 1.0);
SetIdleAnimations(ACTOR_SELF, 1, goomba_anims_running);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_80219760));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(ACTOR_SELF, 0);
SetIdleAnimations(ACTOR_SELF, 1, goomba_anims);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_80219714));
loop 80 {
2:
2:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 0x35D000) {
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 2;
}
@ -169,9 +160,9 @@ Script goomba_idle = SCRIPT({
goto 10;
});
Script goomba_dispatch = SCRIPT({
UseIdleAnimation(ACTOR_SELF, 0);
EnableIdleScript(ACTOR_SELF, 0);
Script N(handleEvent_80219AD4) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, FALSE);
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
GetLastEvent(ACTOR_SELF, SI_VAR(0));
match SI_VAR(0) {
@ -217,17 +208,17 @@ Script goomba_dispatch = SCRIPT({
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoJumpBack;
JumpToGoal(ACTOR_SELF, 5, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, dizzy));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, 0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
sleep 5;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorJumpGravity(ACTOR_SELF, 1.6);
JumpToGoal(ACTOR_SELF, 5, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
}
== EVENT_SHOCK_DEATH {
SI_VAR(0) = (const) 1;
@ -258,7 +249,7 @@ Script goomba_dispatch = SCRIPT({
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, run));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 4.0);
RunToGoal(ACTOR_SELF, 0, 0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
HPBarToHome(ACTOR_SELF);
}
@ -284,33 +275,21 @@ Script goomba_dispatch = SCRIPT({
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoBlowAway;
return;
} else {
}
else {
}
}
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
EnableIdleScript(ACTOR_SELF, 1);
UseIdleAnimation(ACTOR_SELF, 1);
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
});
f32 N(floatTable)[] = {
0.000000f, 0.017452f, 0.034899f, 0.052336f, 0.069756f, 0.087156f, 0.104528f, 0.121869f,
0.139173f, 0.156434f, 0.173648f, 0.190809f, 0.207912f, 0.224951f, 0.241922f, 0.258819f,
0.275637f, 0.292372f, 0.309017f, 0.325568f, 0.342020f, 0.358368f, 0.374607f, 0.390731f,
0.406737f, 0.422618f, 0.438371f, 0.453990f, 0.469472f, 0.484810f, 0.500000f, 0.515038f,
0.529919f, 0.544639f, 0.559193f, 0.573576f, 0.587785f, 0.601815f, 0.615661f, 0.629320f,
0.642788f, 0.656059f, 0.669131f, 0.681998f, 0.694658f, 0.707107f, 0.719340f, 0.731354f,
0.743145f, 0.754710f, 0.766044f, 0.777146f, 0.788011f, 0.798636f, 0.809017f, 0.819152f,
0.829038f, 0.838671f, 0.848048f, 0.857167f, 0.866025f, 0.874620f, 0.882948f, 0.891007f,
0.898794f, 0.906308f, 0.913545f, 0.920505f, 0.927184f, 0.933580f, 0.939693f, 0.945519f,
0.951057f, 0.956305f, 0.961262f, 0.965926f, 0.970296f, 0.974370f, 0.978148f, 0.981627f,
0.984808f, 0.987688f, 0.990268f, 0.992546f, 0.994522f, 0.996195f, 0.997564f, 0.998630f,
0.999391f, 0.999848f, 1.000000f,
};
#include "anglestuff.inc.c"
Script goomba_turn = SCRIPT({
UseIdleAnimation(ACTOR_SELF, 0);
EnableIdleScript(ACTOR_SELF, 0);
SetTargetActor(ACTOR_SELF, 0);
Script N(takeTurn_8021A300) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, FALSE);
SetTargetActor(ACTOR_SELF, ACTOR_PLAYER);
UseBattleCamPreset(63);
BattleCamTargetActor(ACTOR_SELF);
func_8024ECF8(-1, 1, 0);
@ -318,7 +297,7 @@ Script goomba_turn = SCRIPT({
SetGoalToTarget(ACTOR_SELF);
AddGoalPos(ACTOR_SELF, 50, 0, 0);
SetActorSpeed(ACTOR_SELF, 6.0);
RunToGoal(ACTOR_SELF, 0, 0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorDispOffset(ACTOR_SELF, 0, -1, 0);
sleep 1;
@ -326,9 +305,9 @@ Script goomba_turn = SCRIPT({
sleep 5;
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), 0, 0, 1, 16);
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 1, 16);
match SI_VAR(0) {
6, 5 {
HIT_RESULT_MISS, HIT_RESULT_LUCKY {
SI_VAR(10) = SI_VAR(0);
SetGoalToTarget(ACTOR_SELF);
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
@ -342,7 +321,7 @@ Script goomba_turn = SCRIPT({
SI_VAR(0) = 0;
loop 16 {
GetActorPos(ACTOR_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
N(BattleAreaAngleStuff2)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
N(AngleCalculate)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5);
@ -354,7 +333,7 @@ Script goomba_turn = SCRIPT({
sleep 6;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
}
JumpToGoal(ACTOR_SELF, 16, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 16, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, asleep));
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, 5, 0);
@ -367,7 +346,7 @@ Script goomba_turn = SCRIPT({
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, pain));
sleep 5;
if (SI_VAR(10) == 5) {
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), 0x80000000, 0, 0, 0);
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0x80000000)), 0, 0, 0);
}
sleep 5;
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
@ -388,7 +367,7 @@ Script goomba_turn = SCRIPT({
}
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
}
JumpToGoal(ACTOR_SELF, 15, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 15, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, dizzy));
sleep 5;
UseBattleCamPreset(2);
@ -398,18 +377,19 @@ Script goomba_turn = SCRIPT({
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, 0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
SetActorYaw(ACTOR_SELF, 0);
sleep 5;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorJumpGravity(ACTOR_SELF, 1.6);
JumpToGoal(ACTOR_SELF, 5, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
RemoveActorDecoration(ACTOR_SELF, 1, 0);
EnableIdleScript(ACTOR_SELF, 1);
UseIdleAnimation(ACTOR_SELF, 1);
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
return;
} else {
}
else {
SetGoalToTarget(ACTOR_SELF);
SetActorJumpGravity(ACTOR_SELF, 1.2);
spawn {
@ -417,7 +397,7 @@ Script goomba_turn = SCRIPT({
SI_VAR(0) = 0;
loop 16 {
GetActorPos(ACTOR_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
N(BattleAreaAngleStuff2)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
N(AngleCalculate)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5);
@ -429,7 +409,7 @@ Script goomba_turn = SCRIPT({
sleep 6;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
}
JumpToGoal(ACTOR_SELF, 16, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 16, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, pre_headbonk));
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
sleep 1;
@ -437,9 +417,9 @@ Script goomba_turn = SCRIPT({
sleep 1;
}
}
EnemyDamageTarget(ACTOR_SELF, SI_VAR(0), 0, 0, 0, 1, 32);
EnemyDamageTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 0, 1, 32);
match SI_VAR(0) {
0, 2 {
HIT_RESULT_HIT, 2 {
UseBattleCamPreset(2);
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
sleep 1;
@ -453,13 +433,13 @@ Script goomba_turn = SCRIPT({
SI_VAR(1) = 0;
SetActorJumpGravity(ACTOR_SELF, 1.8);
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 10, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 10, FALSE, TRUE, FALSE);
SI_VAR(0) += 30;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 8, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 8, FALSE, TRUE, FALSE);
SI_VAR(0) += 20;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 6, 0, 1, 0);
JumpToGoal(ACTOR_SELF, 6, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
sleep 3;
YieldTurn();
@ -467,11 +447,10 @@ Script goomba_turn = SCRIPT({
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, run));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, 0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
}
}
EnableIdleScript(ACTOR_SELF, 1);
UseIdleAnimation(ACTOR_SELF, 1);
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
});

View File

@ -0,0 +1,931 @@
#include "common.h"
#include "battle/battle.h"
#include "script_api/battle.h"
#include "sprite/npc/goomba.h"
#include "sprite/npc/paragoomba.h"
#define NAMESPACE b_area_kmr_part_1_paragoomba
ApiStatus N(AngleCalculate)(ScriptInstance* script, s32 isInitialCall);
s32 N(defenseTable_8021CB00)[] = {
ELEMENT_NORMAL, 0,
ELEMENT_END,
};
s32 N(defenseTable_8021CB0C)[] = {
ELEMENT_NORMAL, 0,
ELEMENT_END,
};
s32 N(statusTable_8021CB18)[] = {
STATUS_NORMAL, 0,
STATUS_DEFAULT, 0,
STATUS_SLEEP, 100,
STATUS_POISON, 100,
STATUS_FROZEN, 100,
STATUS_DIZZY, 100,
STATUS_FEAR, 100,
STATUS_STATIC, 100,
STATUS_PARALYZE, 100,
STATUS_SHRINK, 100,
STATUS_STOP, 100,
STATUS_DEFAULT_TURN_MOD, 0,
STATUS_SLEEP_TURN_MOD, 0,
STATUS_POISON_TURN_MOD, 0,
STATUS_FROZEN_TURN_MOD, 0,
STATUS_DIZZY_TURN_MOD, 0,
STATUS_FEAR_TURN_MOD, 0,
STATUS_STATIC_TURN_MOD, 0,
STATUS_PARALYZE_TURN_MOD, 0,
STATUS_SHRINK_TURN_MOD, 0,
STATUS_STOP_TURN_MOD, 0,
STATUS_END,
};
s32 N(statusTable_8021CBC4)[] = {
STATUS_NORMAL, 0,
STATUS_DEFAULT, 0,
STATUS_SLEEP, 100,
STATUS_POISON, 80,
STATUS_FROZEN, 100,
STATUS_DIZZY, 100,
STATUS_FEAR, 80,
STATUS_STATIC, 80,
STATUS_PARALYZE, 100,
STATUS_SHRINK, 100,
STATUS_STOP, 100,
STATUS_DEFAULT_TURN_MOD, 0,
STATUS_SLEEP_TURN_MOD, 0,
STATUS_POISON_TURN_MOD, 0,
STATUS_FROZEN_TURN_MOD, 0,
STATUS_DIZZY_TURN_MOD, 1,
STATUS_FEAR_TURN_MOD, 0,
STATUS_STATIC_TURN_MOD, 0,
STATUS_PARALYZE_TURN_MOD, 0,
STATUS_SHRINK_TURN_MOD, 0,
STATUS_STOP_TURN_MOD, 0,
STATUS_END,
};
s32 N(idleAnimations_8021E4EC)[];
s32 N(idleAnimations_8021CD28)[];
s32 N(idleAnimations_8021CDC0)[];
s32 N(idleAnimations_8021CDCC)[];
Script N(init_8021CDD8);
ActorPartDesc N(partsTable_8021CC70)[] = {
{
.flags = PART_FLAG_INVISIBLE | PART_FLAG_NO_TARGET,
.index = 1,
.posOffset = { 0, 0, 0 },
.targetOffset = { 0, 20 },
.opacity = 255,
.idleAnimations = N(idleAnimations_8021E4EC),
.defenseTable = N(defenseTable_8021CB00),
.eventFlags = 0,
.elementImmunityFlags = 0,
.unk_1C = 246,
},
{
.flags = PART_FLAG_MULTI_TARGET,
.index = 2,
.posOffset = { 0, 0, 0 },
.targetOffset = { 0, 24 },
.opacity = 255,
.idleAnimations = N(idleAnimations_8021CD28),
.defenseTable = N(defenseTable_8021CB0C),
.eventFlags = EVENT_FLAG_GROUNDABLE,
.elementImmunityFlags = 0,
.unk_1C = 246,
},
{
.flags = PART_FLAG_INVISIBLE | PART_FLAG_NO_TARGET,
.index = 3,
.posOffset = { 0, 0, 0 },
.targetOffset = { -16, 24 },
.opacity = 255,
.idleAnimations = N(idleAnimations_8021CDC0),
.defenseTable = N(defenseTable_8021CB00),
.eventFlags = 0,
.elementImmunityFlags = 0,
.unk_1C = 246,
},
{
.flags = PART_FLAG_INVISIBLE | PART_FLAG_NO_TARGET,
.index = 4,
.posOffset = { 0, 0, 0 },
.targetOffset = { -16, 24 },
.opacity = 255,
.idleAnimations = N(idleAnimations_8021CDCC),
.defenseTable = N(defenseTable_8021CB00),
.eventFlags = 0,
.elementImmunityFlags = 0,
.unk_1C = 246,
},
};
ActorDesc NAMESPACE = {
.flags = ACTOR_FLAG_FLYING,
.type = ACTOR_TYPE_paragoomba,
.level = 6,
.maxHP = 2,
.partCount = ARRAY_COUNT(N(partsTable_8021CC70)),
.partsData = N(partsTable_8021CC70),
.script = N(init_8021CDD8),
.statusTable = N(statusTable_8021CBC4),
.escapeChance = 90,
.airLiftChance = 100,
.spookChance = 100,
.baseStatusChance = 100,
.upAndAwayChance = 95,
.spinSmashReq = 0,
.powerBounceChance = 100,
.coinReward = 1,
.size = { 36, 26 },
.hpBarOffset = { 0, 0 },
.statusIconOffset = { -10, 20 },
.statusMessageOffset = { 10, 20 },
};
s32 N(idleAnimations_8021CD28)[] = {
STATUS_NORMAL, NPC_ANIM(paragoomba, default, idle),
STATUS_STONE, NPC_ANIM(paragoomba, default, still),
STATUS_SLEEP, NPC_ANIM(paragoomba, default, sleep),
STATUS_POISON, NPC_ANIM(paragoomba, default, idle),
STATUS_STOP, NPC_ANIM(paragoomba, default, still),
STATUS_STATIC, NPC_ANIM(paragoomba, default, idle),
STATUS_PARALYZE, NPC_ANIM(paragoomba, default, still),
STATUS_DIZZY, NPC_ANIM(paragoomba, default, dizzy),
STATUS_FEAR, NPC_ANIM(paragoomba, default, dizzy),
STATUS_END,
};
s32 N(idleAnimations_8021CD74)[] = {
STATUS_NORMAL, NPC_ANIM(paragoomba, default, run),
STATUS_STONE, NPC_ANIM(paragoomba, default, still),
STATUS_SLEEP, NPC_ANIM(paragoomba, default, sleep),
STATUS_POISON, NPC_ANIM(paragoomba, default, idle),
STATUS_STOP, NPC_ANIM(paragoomba, default, still),
STATUS_STATIC, NPC_ANIM(paragoomba, default, run),
STATUS_PARALYZE, NPC_ANIM(paragoomba, default, still),
STATUS_DIZZY, NPC_ANIM(paragoomba, default, dizzy),
STATUS_FEAR, NPC_ANIM(paragoomba, default, dizzy),
STATUS_END,
};
s32 N(idleAnimations_8021CDC0)[] = {
STATUS_NORMAL, NPC_ANIM(paragoomba, default, left_wing_only),
STATUS_END,
};
s32 N(idleAnimations_8021CDCC)[] = {
STATUS_NORMAL, NPC_ANIM(paragoomba, default, right_wing_only),
STATUS_END,
};
Script N(takeTurn_8021D74C);
Script N(idle_8021CE24);
Script N(handleEvent_8021D158);
Script N(init_8021CDD8) = SCRIPT({
BindTakeTurn(ACTOR_SELF, N(takeTurn_8021D74C));
BindIdle(ACTOR_SELF, N(idle_8021CE24));
BindHandleEvent(ACTOR_SELF, N(handleEvent_8021D158));
});
Script N(idle_8021CE24) = SCRIPT({
10:
RandInt(80, SI_VAR(0));
SI_VAR(0) += 80;
loop SI_VAR(0) {
0:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 0;
}
sleep 1;
}
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 5;
SetActorIdleSpeed(ACTOR_SELF, 0.6);
SetIdleAnimations(ACTOR_SELF, 2, N(idleAnimations_8021CD74));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleFlyToGoal(ACTOR_SELF, 0, -5, 0);
loop 20 {
1:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 1;
}
sleep 1;
}
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 5;
SetActorIdleSpeed(ACTOR_SELF, 0.6);
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleFlyToGoal(ACTOR_SELF, 0, -5, 0);
SetIdleAnimations(ACTOR_SELF, 2, N(idleAnimations_8021CD28));
loop 40 {
2:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 2;
}
sleep 1;
}
goto 10;
});
Script N(8021D0E0) = SCRIPT({
ResetAllActorSounds(ACTOR_SELF);
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 7.0);
FlyToGoal(ACTOR_SELF, 0, 1, 11);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, idle));
});
Script N(8021DF64);
Script N(handleEvent_8021D158) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, 0);
GetLastEvent(ACTOR_SELF, SI_VAR(0));
match SI_VAR(0) {
EVENT_HIT_COMBO, EVENT_HIT {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, pain);
await DoNormalHit;
GetBattlePhase(SI_VAR(0));
if (SI_VAR(0) == 1) {
GetEncounterState(SI_VAR(0));
if (SI_VAR(0) == 4) {
await N(8021DF64);
}
}
}
== EVENT_BURN_HIT {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, burn_pain);
SI_VAR(2) = (const) NPC_ANIM(paragoomba, default, burn_dead);
await DoBurnHit;
}
== EVENT_BURN_DEATH {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, burn_pain);
SI_VAR(2) = (const) NPC_ANIM(paragoomba, default, burn_dead);
await DoBurnHit;
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, burn_dead);
await DoDeath;
return;
}
== EVENT_FALL_TRIGGER {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, pain);
await DoNormalHit;
await N(8021DF64);
}
== 15 {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, burn_pain);
SI_VAR(2) = (const) NPC_ANIM(paragoomba, default, burn_dead);
await DoBurnHit;
await N(8021DF64);
}
== EVENT_SHOCK_HIT {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, electrocute);
await DoShockHit;
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, pain);
await DoJumpBack;
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, dizzy));
await N(8021D0E0);
}
== EVENT_SHOCK_DEATH {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, electrocute);
await DoShockHit;
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, dead);
await DoDeath;
return;
}
== EVENT_STAR_BEAM, 23, EVENT_IMMUNE, EVENT_AIR_LIFT_FAILED {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, idle);
await DoImmune;
}
== EVENT_DEATH {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, pain);
await DoNormalHit;
sleep 10;
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, dead);
await DoDeath;
return;
}
== EVENT_BEGIN_FIRST_STRIKE {
SetActorPos(ACTOR_SELF, 20, 0, 0);
HPBarToCurrent(ACTOR_SELF);
}
== EVENT_END_FIRST_STRIKE {
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, run));
await N(8021D0E0);
HPBarToHome(ACTOR_SELF);
}
== EVENT_RECOVER_STATUS {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, idle);
await DoRecover;
}
== EVENT_SCARE_AWAY {
SetActorFlagBits(ACTOR_SELF, 512, 0);
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, run);
SI_VAR(2) = (const) NPC_ANIM(paragoomba, default, pain);
await DoScareAway;
return;
}
== EVENT_BEGIN_AIR_LIFT {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, run);
await DoAirLift;
}
== EVENT_BLOW_AWAY {
SI_VAR(0) = (const) 2;
SI_VAR(1) = (const) NPC_ANIM(paragoomba, default, pain);
await DoBlowAway;
return;
}
else {
}
}
EnableIdleScript(ACTOR_SELF, -1);
UseIdleAnimation(ACTOR_SELF, TRUE);
});
Script N(takeTurn_8021D74C) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, 0);
SetTargetActor(ACTOR_SELF, ACTOR_PLAYER);
SetGoalToTarget(ACTOR_SELF);
UseBattleCamPreset(63);
BattleCamTargetActor(ACTOR_SELF);
func_8024ECF8(-1, 1, 0);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, run));
SetGoalToTarget(ACTOR_SELF);
AddGoalPos(ACTOR_SELF, 50, 0, 0);
SetActorSpeed(ACTOR_SELF, 6.0);
FlyToGoal(ACTOR_SELF, 0, -4, 0);
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 1, 16);
match SI_VAR(0) {
HIT_RESULT_MISS, HIT_RESULT_LUCKY {
SI_VAR(10) = SI_VAR(0);
sleep 10;
UseBattleCamPreset(66);
SetBattleCamZoom(300);
BattleCamTargetActor(ACTOR_SELF);
func_8024ECF8(-1, 1, 0);
PlaySoundAtActor(ACTOR_SELF, 0x20E0);
SetActorSounds(ACTOR_SELF, 2, 0, 0);
SetActorSpeed(ACTOR_SELF, 5.0);
SetActorJumpGravity(ACTOR_SELF, 1.8);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, attack));
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 10, FALSE, FALSE, FALSE);
PlaySoundAtActor(ACTOR_SELF, SOUND_UNUSED_2C1);
SetActorSounds(ACTOR_SELF, 1, 0, 0);
SetGoalToTarget(ACTOR_SELF);
SI_VAR(0) -= 80;
SI_VAR(1) = 20;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorSpeed(ACTOR_SELF, 8.0);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, attack));
FlyToGoal(ACTOR_SELF, 0, -10, 4);
spawn {
loop 4 {
PlaySoundAtActor(ACTOR_SELF, 0x20DF);
sleep 4;
}
}
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, aim));
AddActorDecoration(ACTOR_SELF, 2, 0, 2);
SetAnimationRate(ACTOR_SELF, 2, 3.0);
sleep 10;
if (SI_VAR(10) == 5) {
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0x80000000)), 0, 0, 0);
}
sleep 10;
SetAnimationRate(ACTOR_SELF, 2, 1.0);
UseBattleCamPreset(2);
ResetAllActorSounds(ACTOR_SELF);
YieldTurn();
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, run));
SetActorYaw(ACTOR_SELF, 180);
await N(8021D0E0);
SetActorYaw(ACTOR_SELF, 0);
RemoveActorDecoration(ACTOR_SELF, 2, 0);
EnableIdleScript(ACTOR_SELF, -1);
UseIdleAnimation(ACTOR_SELF, TRUE);
return;
}
else {
sleep 10;
UseBattleCamPreset(66);
SetBattleCamZoom(300);
BattleCamTargetActor(ACTOR_SELF);
func_8024ECF8(-1, 1, 0);
PlaySoundAtActor(ACTOR_SELF, 0x20E0);
SetActorSounds(ACTOR_SELF, 2, 0, 0);
SetActorSpeed(ACTOR_SELF, 5.0);
SetActorJumpGravity(ACTOR_SELF, 1.8);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, attack));
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 10, FALSE, FALSE, FALSE);
PlaySoundAtActor(ACTOR_SELF, SOUND_UNUSED_2C1);
SetActorSounds(ACTOR_SELF, 1, 0, 0);
SetGoalToTarget(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, attack));
FlyToGoal(ACTOR_SELF, 0, -10, 0);
}
}
sleep 2;
EnemyDamageTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 0, 1, 32);
match SI_VAR(0) {
HIT_RESULT_HIT, 2 {
UseBattleCamPreset(2);
SetGoalToTarget(ACTOR_SELF);
AddGoalPos(ACTOR_SELF, 50, 10, 0);
SetActorSpeed(ACTOR_SELF, 6.0);
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, run));
FlyToGoal(ACTOR_SELF, 0, -10, 0);
ResetAllActorSounds(ACTOR_SELF);
sleep 5;
YieldTurn();
SetAnimation(ACTOR_SELF, 2, NPC_ANIM(paragoomba, default, run));
await N(8021D0E0);
}
}
EnableIdleScript(ACTOR_SELF, -1);
UseIdleAnimation(ACTOR_SELF, TRUE);
});
Script N(8021E584);
#include "common/StartRumbleWithParams.inc.c"
Script N(8021DF64) = SCRIPT({
func_8027D32C(-127);
SetPartFlags(ACTOR_SELF, 2, 131077);
SetPartFlags(ACTOR_SELF, 3, 1179652);
SetPartFlags(ACTOR_SELF, 4, 1179652);
SetPartFlags(ACTOR_SELF, 1, 8388612);
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPartPos(ACTOR_SELF, 3, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPartDispOffset(ACTOR_SELF, 3, -9, 7, -2);
SetPartPos(ACTOR_SELF, 4, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPartDispOffset(ACTOR_SELF, 4, 11, 7, -2);
GetLastEvent(ACTOR_SELF, SI_VAR(0));
if (SI_VAR(0) == 15) {
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, burn_dead));
} else {
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, pain));
}
SetActorSounds(ACTOR_SELF, 2, 769, 0);
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) = 0;
SetActorJumpGravity(ACTOR_SELF, 0.8);
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 15, FALSE, TRUE, FALSE);
N(StartRumbleWithParams)(100, 10);
spawn {
ShakeCam(1, 0, 5, 0.3);
}
ResetActorSounds(ACTOR_SELF, 2);
GetLastEvent(ACTOR_SELF, SI_VAR(3));
if (SI_VAR(3) == 15) {
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, pain));
GetActorPos(ACTOR_SELF, SI_VAR(3), SI_VAR(4), SI_VAR(5));
SI_VAR(4) += 10;
SI_VAR(5) += 5;
PlayEffect(0x27, 0, SI_VAR(3), SI_VAR(4), SI_VAR(5), 1.0, 10, 0, 0, 0, 0, 0, 0, 0);
}
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 10, FALSE, TRUE, FALSE);
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
loop 10 {
SetPartFlagBits(ACTOR_SELF, 3, 1, 1);
SetPartFlagBits(ACTOR_SELF, 4, 1, 1);
sleep 1;
SetPartFlagBits(ACTOR_SELF, 3, 1, 0);
SetPartFlagBits(ACTOR_SELF, 4, 1, 0);
sleep 1;
}
SetPartFlagBits(ACTOR_SELF, 3, 1, 1);
SetPartFlagBits(ACTOR_SELF, 4, 1, 1);
GetIndexFromHome(ACTOR_SELF, SI_VAR(0));
SI_VAR(0) %= 4;
SetGoalToIndex(ACTOR_SELF, SI_VAR(0));
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetHomePos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorFlagBits(ACTOR_SELF, 512, 0);
SetStatusTable(ACTOR_SELF, N(statusTable_8021CB18));
SetActorType(ACTOR_SELF, ACTOR_TYPE_goomba);
await N(8021E584);
SetActorFlagBits(ACTOR_SELF, 4096, 1);
HPBarToHome(ACTOR_SELF);
ResetAllActorSounds(-127);
});
// Copy of goomba.c follows..................
// TODO: deduplicate
s32 N(idleAnimations_8021E4EC)[] = {
STATUS_NORMAL, NPC_ANIM(goomba, normal, idle),
STATUS_STONE, NPC_ANIM(goomba, normal, still),
STATUS_SLEEP, NPC_ANIM(goomba, normal, asleep),
STATUS_POISON, NPC_ANIM(goomba, normal, idle),
STATUS_STOP, NPC_ANIM(goomba, normal, still),
STATUS_STATIC, NPC_ANIM(goomba, normal, idle),
STATUS_PARALYZE, NPC_ANIM(goomba, normal, still),
STATUS_DIZZY, NPC_ANIM(goomba, normal, dizzy),
STATUS_FEAR, NPC_ANIM(goomba, normal, dizzy),
STATUS_END,
};
s32 N(idleAnimations_8021E538)[] = {
STATUS_NORMAL, NPC_ANIM(goomba, normal, run),
STATUS_STONE, NPC_ANIM(goomba, normal, still),
STATUS_SLEEP, NPC_ANIM(goomba, normal, asleep),
STATUS_POISON, NPC_ANIM(goomba, normal, idle),
STATUS_STOP, NPC_ANIM(goomba, normal, still),
STATUS_STATIC, NPC_ANIM(goomba, normal, run),
STATUS_PARALYZE, NPC_ANIM(goomba, normal, still),
STATUS_DIZZY, NPC_ANIM(goomba, normal, dizzy),
STATUS_FEAR, NPC_ANIM(goomba, normal, dizzy),
STATUS_END,
};
Script N(takeTurn_8021F0D8);
Script N(idle_8021E5D0);
Script N(handleEvent_8021E8AC);
Script N(8021E584) = SCRIPT({
BindTakeTurn(ACTOR_SELF, N(takeTurn_8021F0D8));
BindIdle(ACTOR_SELF, N(idle_8021E5D0));
BindHandleEvent(ACTOR_SELF, N(handleEvent_8021E8AC));
});
Script N(idle_8021E5D0) = SCRIPT({
10:
RandInt(80, SI_VAR(0));
SI_VAR(0) += 80;
loop SI_VAR(0) {
0:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 0;
}
sleep 1;
}
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 5;
SetActorIdleSpeed(ACTOR_SELF, 1.0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021E538));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(ACTOR_SELF, 0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021E4EC));
loop 20 {
1:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 1;
}
sleep 1;
}
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 5;
SetActorIdleSpeed(ACTOR_SELF, 1.0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021E538));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(ACTOR_SELF, 0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021E4EC));
loop 80 {
2:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 2;
}
sleep 1;
}
goto 10;
});
Script N(handleEvent_8021E8AC) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, FALSE);
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
GetLastEvent(ACTOR_SELF, SI_VAR(0));
match SI_VAR(0) {
EVENT_HIT_COMBO, EVENT_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoNormalHit;
}
== EVENT_BURN_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, burn_pain);
SI_VAR(2) = (const) NPC_ANIM(goomba, normal, burn_dead);
await DoBurnHit;
}
== EVENT_BURN_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, burn_pain);
SI_VAR(2) = (const) NPC_ANIM(goomba, normal, burn_dead);
await DoBurnHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, burn_dead);
await DoDeath;
return;
}
== EVENT_SPIN_SMASH_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoSpinSmashHit;
}
== EVENT_SPIN_SMASH_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoSpinSmashHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, dead);
await DoDeath;
return;
}
== EVENT_SHOCK_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, electrocute);
await DoShockHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoJumpBack;
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, dizzy));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
sleep 5;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorJumpGravity(ACTOR_SELF, 1.6);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
}
== EVENT_SHOCK_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, electrocute);
await DoShockHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, dead);
await DoDeath;
return;
}
== EVENT_STAR_BEAM, 23, EVENT_IMMUNE, EVENT_AIR_LIFT_FAILED {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, idle);
await DoImmune;
}
== EVENT_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoNormalHit;
sleep 10;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, dead);
await DoDeath;
return;
}
== EVENT_END_FIRST_STRIKE {
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, run));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 4.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
HPBarToHome(ACTOR_SELF);
}
== EVENT_RECOVER_STATUS {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, idle);
await DoRecover;
}
== EVENT_SCARE_AWAY {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, run);
SI_VAR(2) = (const) NPC_ANIM(goomba, normal, pain);
await DoScareAway;
return;
}
== EVENT_BEGIN_AIR_LIFT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, run);
await DoAirLift;
}
== EVENT_BLOW_AWAY {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(goomba, normal, pain);
await DoBlowAway;
return;
}
else {
}
}
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
});
#include "anglestuff.inc.c"
Script N(takeTurn_8021F0D8) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, FALSE);
SetTargetActor(ACTOR_SELF, ACTOR_PLAYER);
UseBattleCamPreset(63);
BattleCamTargetActor(ACTOR_SELF);
func_8024ECF8(-1, 1, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, run));
SetGoalToTarget(ACTOR_SELF);
AddGoalPos(ACTOR_SELF, 50, 0, 0);
SetActorSpeed(ACTOR_SELF, 6.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorDispOffset(ACTOR_SELF, 0, -1, 0);
sleep 1;
SetActorDispOffset(ACTOR_SELF, 0, -2, 0);
sleep 5;
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 1, 16);
match SI_VAR(0) {
HIT_RESULT_MISS, HIT_RESULT_LUCKY {
SI_VAR(10) = SI_VAR(0);
SetGoalToTarget(ACTOR_SELF);
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 10;
SI_VAR(1) = 10;
SI_VAR(2) += 3;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorJumpGravity(ACTOR_SELF, 1.2);
spawn {
GetActorPos(ACTOR_SELF, SI_VAR(1), SI_VAR(2), SI_VAR(0));
SI_VAR(0) = 0;
loop 16 {
GetActorPos(ACTOR_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
N(AngleCalculate)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5);
SI_VAR(3) = SI_VAR(6);
sleep 1;
}
}
spawn {
sleep 6;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
}
JumpToGoal(ACTOR_SELF, 16, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, asleep));
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, 5, 0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.3, 0.5, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, -2, 0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, 7, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, pain));
sleep 5;
if (SI_VAR(10) == 5) {
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0x80000000)), 0, 0, 0);
}
sleep 5;
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
SetGoalToTarget(ACTOR_SELF);
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) = 0;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorJumpGravity(ACTOR_SELF, 2.0);
spawn {
sleep 4;
SI_VAR(0) = 180;
loop 4 {
SI_VAR(0) -= 45;
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
sleep 1;
}
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
}
JumpToGoal(ACTOR_SELF, 15, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, dizzy));
sleep 5;
UseBattleCamPreset(2);
YieldTurn();
SetActorYaw(ACTOR_SELF, 180);
AddActorDecoration(ACTOR_SELF, 1, 0, 2);
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
SetActorYaw(ACTOR_SELF, 0);
sleep 5;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
SetActorJumpGravity(ACTOR_SELF, 1.6);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
RemoveActorDecoration(ACTOR_SELF, 1, 0);
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
return;
}
else {
SetGoalToTarget(ACTOR_SELF);
SetActorJumpGravity(ACTOR_SELF, 1.2);
spawn {
GetActorPos(ACTOR_SELF, SI_VAR(1), SI_VAR(2), SI_VAR(0));
SI_VAR(0) = 0;
loop 16 {
GetActorPos(ACTOR_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
N(AngleCalculate)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5);
SI_VAR(3) = SI_VAR(6);
sleep 1;
}
}
spawn {
sleep 6;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, headbonk));
}
JumpToGoal(ACTOR_SELF, 16, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, pre_headbonk));
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.3, 0.5, 1.0);
sleep 1;
}
}
EnemyDamageTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 0, 1, 32);
match SI_VAR(0) {
HIT_RESULT_HIT, 2 {
UseBattleCamPreset(2);
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
sleep 1;
SetActorRotation(ACTOR_SELF, 0, 0, 0);
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 40;
SI_VAR(1) = 0;
SetActorJumpGravity(ACTOR_SELF, 1.8);
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 10, FALSE, TRUE, FALSE);
SI_VAR(0) += 30;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 8, FALSE, TRUE, FALSE);
SI_VAR(0) += 20;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 6, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, idle));
sleep 3;
YieldTurn();
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(goomba, normal, run));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
}
}
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
});

View File

@ -0,0 +1,478 @@
#include "common.h"
#include "battle/battle.h"
#include "script_api/battle.h"
#include "sprite/npc/spiked_goomba.h"
#define NAMESPACE b_area_kmr_part_1_spiked_goomba
s32 N(defenseTable_8021AFD0)[] = {
ELEMENT_NORMAL, 0,
ELEMENT_END,
};
s32 N(statusTable_8021AFDC)[] = {
STATUS_NORMAL, 0,
STATUS_DEFAULT, 0,
STATUS_SLEEP, 100,
STATUS_POISON, 80,
STATUS_FROZEN, 100,
STATUS_DIZZY, 100,
STATUS_FEAR, 80,
STATUS_STATIC, 80,
STATUS_PARALYZE, 100,
STATUS_SHRINK, 100,
STATUS_STOP, 100,
STATUS_DEFAULT_TURN_MOD, 0,
STATUS_SLEEP_TURN_MOD, 0,
STATUS_POISON_TURN_MOD, 0,
STATUS_FROZEN_TURN_MOD, 0,
STATUS_DIZZY_TURN_MOD, 0,
STATUS_FEAR_TURN_MOD, 0,
STATUS_STATIC_TURN_MOD, 0,
STATUS_PARALYZE_TURN_MOD, 0,
STATUS_SHRINK_TURN_MOD, 0,
STATUS_STOP_TURN_MOD, 0,
STATUS_END,
};
s32 N(idleAnimations_8021B0D4)[];
Script N(init_8021B16C);
ActorPartDesc N(partsTable_8021B088)[] = {
{
.flags = PART_FLAG_MULTI_TARGET,
.index = 1,
.posOffset = { 0, 0, 0 },
.targetOffset = { 0, 24 },
.opacity = 255,
.idleAnimations = N(idleAnimations_8021B0D4),
.defenseTable = N(defenseTable_8021AFD0),
.eventFlags = EVENT_FLAG_SPIKY_TOP,
.elementImmunityFlags = 0,
.unk_1C = 244,
},
};
ActorDesc NAMESPACE = {
.flags = 0,
.type = ACTOR_TYPE_spiked_goomba,
.level = 6,
.maxHP = 2,
.partCount = ARRAY_COUNT(N(partsTable_8021B088)),
.partsData = N(partsTable_8021B088),
.script = N(init_8021B16C),
.statusTable = N(statusTable_8021AFDC),
.escapeChance = 90,
.airLiftChance = 95,
.spookChance = 90,
.baseStatusChance = 100,
.upAndAwayChance = 95,
.spinSmashReq = 0,
.powerBounceChance = 100,
.coinReward = 1,
.size = { 24, 28 },
.hpBarOffset = { 0, 0 },
.statusIconOffset = { -10, 20 },
.statusMessageOffset = { 10, 20 },
};
s32 N(idleAnimations_8021B0D4)[] = {
STATUS_NORMAL, NPC_ANIM(spiked_goomba, default, idle),
STATUS_STONE, NPC_ANIM(spiked_goomba, default, still),
STATUS_SLEEP, NPC_ANIM(spiked_goomba, default, sleep),
STATUS_POISON, NPC_ANIM(spiked_goomba, default, idle),
STATUS_STOP, NPC_ANIM(spiked_goomba, default, still),
STATUS_STATIC, NPC_ANIM(spiked_goomba, default, idle),
STATUS_PARALYZE, NPC_ANIM(spiked_goomba, default, still),
STATUS_DIZZY, NPC_ANIM(spiked_goomba, default, dizzy),
STATUS_FEAR, NPC_ANIM(spiked_goomba, default, dizzy),
STATUS_END,
};
s32 N(idleAnimations_8021B120)[] = {
STATUS_NORMAL, NPC_ANIM(spiked_goomba, default, run),
STATUS_STONE, NPC_ANIM(spiked_goomba, default, still),
STATUS_SLEEP, NPC_ANIM(spiked_goomba, default, sleep),
STATUS_POISON, NPC_ANIM(spiked_goomba, default, idle),
STATUS_STOP, NPC_ANIM(spiked_goomba, default, still),
STATUS_STATIC, NPC_ANIM(spiked_goomba, default, run),
STATUS_PARALYZE, NPC_ANIM(spiked_goomba, default, still),
STATUS_DIZZY, NPC_ANIM(spiked_goomba, default, dizzy),
STATUS_FEAR, NPC_ANIM(spiked_goomba, default, dizzy),
STATUS_END,
};
Script N(takeTurn_8021BDDC);
Script N(idle_8021B1B8);
Script N(handleEvent_8021B494);
Script N(init_8021B16C) = SCRIPT({
BindTakeTurn(ACTOR_SELF, N(takeTurn_8021BDDC));
BindIdle(ACTOR_SELF, N(idle_8021B1B8));
BindHandleEvent(ACTOR_SELF, N(handleEvent_8021B494));
});
Script N(idle_8021B1B8) = SCRIPT({
10:
RandInt(80, SI_VAR(0));
SI_VAR(0) += 80;
loop SI_VAR(0) {
0:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 0;
}
sleep 1;
}
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 5;
SetActorIdleSpeed(ACTOR_SELF, 1.0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021B120));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(ACTOR_SELF, 0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021B0D4));
loop 20 {
1:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 1;
}
sleep 1;
}
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 5;
SetActorIdleSpeed(ACTOR_SELF, 1.0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021B120));
SetIdleGoal(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
IdleRunToGoal(ACTOR_SELF, 0);
SetIdleAnimations(ACTOR_SELF, 1, N(idleAnimations_8021B0D4));
loop 80 {
2:
GetStatusFlags(ACTOR_SELF, SI_VAR(1));
if (SI_VAR(1) & 3526656) {
sleep 1;
goto 2;
}
sleep 1;
}
goto 10;
});
Script N(handleEvent_8021B494) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, FALSE);
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
GetLastEvent(ACTOR_SELF, SI_VAR(0));
match SI_VAR(0) {
EVENT_HIT_COMBO, EVENT_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoNormalHit;
}
== EVENT_BURN_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, burn_dead);
SI_VAR(2) = (const) NPC_ANIM(spiked_goomba, default, burn_pain);
await DoBurnHit;
}
== EVENT_BURN_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, burn_dead);
SI_VAR(2) = (const) NPC_ANIM(spiked_goomba, default, burn_pain);
await DoBurnHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, burn_pain);
await DoDeath;
return;
}
== EVENT_SPIN_SMASH_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoSpinSmashHit;
}
== EVENT_SPIN_SMASH_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoSpinSmashHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, dead);
await DoDeath;
return;
}
== EVENT_SHOCK_HIT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, electrocute);
await DoShockHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoJumpBack;
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, dizzy));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
sleep 5;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, idle));
SetActorJumpGravity(ACTOR_SELF, 1.6);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
}
== EVENT_SHOCK_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, electrocute);
await DoShockHit;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, dead);
await DoDeath;
return;
}
== EVENT_STAR_BEAM, 23, EVENT_IMMUNE, EVENT_AIR_LIFT_FAILED {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, idle);
await DoImmune;
}
== EVENT_DEATH {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoNormalHit;
sleep 10;
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, dead);
await DoDeath;
return;
}
== EVENT_END_FIRST_STRIKE {
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, run));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 4.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
HPBarToHome(ACTOR_SELF);
}
== EVENT_RECOVER_STATUS {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, idle);
await DoRecover;
}
== EVENT_SCARE_AWAY {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, run);
SI_VAR(2) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoScareAway;
return;
}
== EVENT_BEGIN_AIR_LIFT {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, run);
await DoAirLift;
}
== EVENT_BLOW_AWAY {
SI_VAR(0) = (const) 1;
SI_VAR(1) = (const) NPC_ANIM(spiked_goomba, default, pain);
await DoBlowAway;
return;
}
== EVENT_SPIKE_TAUNT {
GetStatusFlags(ACTOR_SELF, SI_VAR(0));
if (SI_VAR(0) !& 3526656) {
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, laugh));
}
sleep 10;
GetActorPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
GetStatusFlags(ACTOR_SELF, SI_VAR(3));
if (SI_VAR(3) & 524288) {
SI_VAR(1) += 10;
} else {
SI_VAR(1) += 26;
}
PlayEffect(0x1A, 0, SI_VAR(0), SI_VAR(1), SI_VAR(2), 20, 0, 0, 0, 0, 0, 0, 0, 0);
sleep 20;
}
else {
}
}
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, idle));
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
});
#include "anglestuff.inc.c"
Script N(takeTurn_8021BDDC) = SCRIPT({
UseIdleAnimation(ACTOR_SELF, FALSE);
EnableIdleScript(ACTOR_SELF, FALSE);
SetTargetActor(ACTOR_SELF, ACTOR_PLAYER);
UseBattleCamPreset(63);
BattleCamTargetActor(ACTOR_SELF);
func_8024ECF8(-1, 1, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, run));
SetGoalToTarget(ACTOR_SELF);
AddGoalPos(ACTOR_SELF, 50, 0, 0);
SetActorSpeed(ACTOR_SELF, 6.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, idle));
SetActorDispOffset(ACTOR_SELF, 0, -1, 0);
sleep 1;
SetActorDispOffset(ACTOR_SELF, 0, -2, 0);
sleep 5;
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, headbonk));
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 1, 16);
match SI_VAR(0) {
HIT_RESULT_MISS, HIT_RESULT_LUCKY {
SI_VAR(10) = SI_VAR(0);
SetGoalToTarget(ACTOR_SELF);
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 10;
SI_VAR(1) = 10;
SI_VAR(2) += 3;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorJumpGravity(ACTOR_SELF, 1.2);
spawn {
GetActorPos(ACTOR_SELF, SI_VAR(1), SI_VAR(2), SI_VAR(0));
SI_VAR(0) = 0;
loop 16 {
GetActorPos(ACTOR_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
N(AngleCalculate)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5);
SI_VAR(3) = SI_VAR(6);
sleep 1;
}
}
spawn {
sleep 6;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, headbonk));
}
JumpToGoal(ACTOR_SELF, 16, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, sleep));
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, 5, 0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.3, 0.5, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, -2, 0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
SetActorDispOffset(ACTOR_SELF, 0, 7, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, pain));
sleep 5;
if (SI_VAR(10) == 5) {
EnemyTestTarget(ACTOR_SELF, SI_VAR(0), ((0x80000000)), 0, 0, 0);
}
sleep 5;
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, headbonk));
SetGoalToTarget(ACTOR_SELF);
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) = 0;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetActorJumpGravity(ACTOR_SELF, 2.0);
spawn {
sleep 4;
SI_VAR(0) = 180;
loop 4 {
SI_VAR(0) -= 45;
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
sleep 1;
}
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, headbonk));
}
JumpToGoal(ACTOR_SELF, 15, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, dizzy));
sleep 5;
UseBattleCamPreset(2);
YieldTurn();
SetActorYaw(ACTOR_SELF, 180);
AddActorDecoration(ACTOR_SELF, 1, 0, 2);
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
SetActorYaw(ACTOR_SELF, 0);
sleep 5;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, idle));
SetActorJumpGravity(ACTOR_SELF, 1.6);
JumpToGoal(ACTOR_SELF, 5, FALSE, TRUE, FALSE);
RemoveActorDecoration(ACTOR_SELF, 1, 0);
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
return;
}
else {
SetGoalToTarget(ACTOR_SELF);
SetActorJumpGravity(ACTOR_SELF, 1.2);
spawn {
GetActorPos(ACTOR_SELF, SI_VAR(1), SI_VAR(2), SI_VAR(0));
SI_VAR(0) = 0;
loop 16 {
GetActorPos(ACTOR_SELF, SI_VAR(4), SI_VAR(5), SI_VAR(6));
N(AngleCalculate)(SI_VAR(1), SI_VAR(2), SI_VAR(4), SI_VAR(5), SI_VAR(0));
SetActorRotation(ACTOR_SELF, 0, 0, SI_VAR(0));
SI_VAR(1) = SI_VAR(4);
SI_VAR(2) = SI_VAR(5);
SI_VAR(3) = SI_VAR(6);
sleep 1;
}
}
spawn {
sleep 6;
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, headbonk));
}
JumpToGoal(ACTOR_SELF, 16, FALSE, TRUE, FALSE);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, headbonk));
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.3, 0.5, 1.0);
sleep 1;
}
}
EnemyDamageTarget(ACTOR_SELF, SI_VAR(0), ((0)), 0, 0, 2, 32);
match SI_VAR(0) {
HIT_RESULT_HIT, 2 {
UseBattleCamPreset(2);
SetActorScale(ACTOR_SELF, 1.1, 0.8, 1.0);
sleep 1;
SetActorScale(ACTOR_SELF, 1.0, 1.0, 1.0);
sleep 1;
SetActorRotation(ACTOR_SELF, 0, 0, 0);
SetActorDispOffset(ACTOR_SELF, 0, 0, 0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, idle));
GetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 40;
SI_VAR(1) = 0;
SetActorJumpGravity(ACTOR_SELF, 1.8);
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 10, FALSE, TRUE, FALSE);
SI_VAR(0) += 30;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 8, FALSE, TRUE, FALSE);
SI_VAR(0) += 20;
SetGoalPos(ACTOR_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
JumpToGoal(ACTOR_SELF, 6, FALSE, TRUE, FALSE);
GetLastDamage(0, SI_VAR(0));
if (SI_VAR(0) > 0) {
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, laugh));
sleep 15;
} else {
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, idle));
sleep 3;
}
YieldTurn();
SetAnimationRate(ACTOR_SELF, 1, 2.0);
SetAnimation(ACTOR_SELF, 1, NPC_ANIM(spiked_goomba, default, run));
SetGoalToHome(ACTOR_SELF);
SetActorSpeed(ACTOR_SELF, 8.0);
RunToGoal(ACTOR_SELF, 0, FALSE);
SetAnimationRate(ACTOR_SELF, 1, 1.0);
}
}
EnableIdleScript(ACTOR_SELF, TRUE);
UseIdleAnimation(ACTOR_SELF, TRUE);
});

View File

@ -0,0 +1,107 @@
#include "common.h"
#include "battle/battle.h"
#include "script_api/battle.h"
#include "message_ids.h"
#include "sprite/npc/goomba.h"
#include "sprite/npc/paragoomba.h"
#include "sprite/npc/spiked_goomba.h"
#define NAMESPACE b_area_kmr_part_1
extern ActorDesc N(goomba);
extern ActorDesc N(paragoomba);
extern ActorDesc N(spiked_goomba);
extern Stage N(kmr_02);
extern Stage N(kmr_03);
extern Stage N(kmr_04);
extern Stage N(kmr_05);
extern Stage N(kmr_06);
Formation N(formation_00) = {
{ &N(goomba), .position = 1, .priority = 10 },
};
Formation N(formation_01) = {
{ &N(goomba), .position = 1, .priority = 10 },
{ &N(goomba), .position = 2, .priority = 9 },
};
Formation N(formation_02) = {
{ &N(goomba), .position = 0, .priority = 10 },
{ &N(goomba), .position = 1, .priority = 9 },
{ &N(goomba), .position = 2, .priority = 8 },
};
Formation N(formation_03) = {
{ &N(goomba), .position = 1, .priority = 10 },
{ &N(paragoomba), .position = 6, .priority = 9 },
};
Formation N(formation_04) = {
{ &N(goomba), .position = 0, .priority = 10 },
{ &N(goomba), .position = 1, .priority = 9 },
{ &N(goomba), .position = 2, .priority = 8 },
{ &N(goomba), .position = 3, .priority = 7 },
};
Formation N(formation_05) = {
{ &N(goomba), .position = 1, .priority = 10 },
{ &N(spiked_goomba), .position = 2, .priority = 9 },
};
Formation N(formation_06) = {
{ &N(goomba), .position = 0, .priority = 10 },
{ &N(paragoomba), .position = 5, .priority = 9 },
{ &N(goomba), .position = 2, .priority = 8 },
{ &N(paragoomba), .position = 7, .priority = 7 },
};
Formation N(formation_07) = {
{ &N(paragoomba), .position = 5, .priority = 10 },
};
Formation N(formation_08) = {
{ &N(paragoomba), .position = 5, .priority = 10 },
{ &N(paragoomba), .position = 6, .priority = 9 },
};
Formation N(formation_09) = {
{ &N(paragoomba), .position = 4, .priority = 10 },
{ &N(paragoomba), .position = 5, .priority = 9 },
{ &N(paragoomba), .position = 6, .priority = 8 },
};
Formation N(formation_0A) = {
{ &N(spiked_goomba), .position = 1, .priority = 10 },
};
Formation N(formation_0B) = {
{ &N(spiked_goomba), .position = 1, .priority = 10 },
{ &N(goomba), .position = 2, .priority = 9 },
};
BattleList N(formationTable) = {
BATTLE("クリボー", N(formation_00), &N(kmr_04)),
BATTLE("クリボーx", N(formation_01), &N(kmr_04)),
BATTLE("クリボーx", N(formation_02), &N(kmr_04)),
BATTLE("クリボー、パタクリボー", N(formation_03), &N(kmr_04)),
BATTLE("クリボーx", N(formation_04), &N(kmr_04)),
BATTLE("クリボー,トゲクリボー", N(formation_05), &N(kmr_04)),
BATTLE("クリボー,パタクリボー,クリボー,パタクリボー", N(formation_06), &N(kmr_04)),
BATTLE("パタクリボー", N(formation_07), &N(kmr_04)),
BATTLE("パタクリボーx", N(formation_08), &N(kmr_04)),
BATTLE("パタクリボーx", N(formation_09), &N(kmr_04)),
BATTLE("トゲクリボー", N(formation_0A), &N(kmr_04)),
BATTLE("トゲクリボー、クリボー", N(formation_0B), &N(kmr_04)),
{},
};
StageList N(stageTable) = {
{ "kmr_02", &N(kmr_02) },
{ "kmr_03", &N(kmr_03) },
{ "kmr_04", &N(kmr_04) },
{ "kmr_05", &N(kmr_05) },
{ "kmr_06", &N(kmr_06) },
{},
};

View File

@ -1,96 +0,0 @@
#include "common.h"
#include "battle/battle.h"
#include "goomba.h"
#include "paragoomba.h"
#include "spiked_goomba.h"
#define NAMESPACE b_area_kmr_part_1
Formation formation0 = {
{ &goomba, .position = 1, .priority = 10 },
};
Formation formation1 = {
{ &goomba, .position = 1, .priority = 10 },
{ &goomba, .position = 2, .priority = 9 },
};
Formation formation2 = {
{ &goomba, .position = 0, .priority = 10 },
{ &goomba, .position = 1, .priority = 9 },
{ &goomba, .position = 2, .priority = 8 },
};
Formation formation3 = {
{ &goomba, .position = 1, .priority = 10 },
{ &paragoomba, .position = 6, .priority = 9 },
};
Formation formation4 = {
{ &goomba, .position = 0, .priority = 10 },
{ &goomba, .position = 1, .priority = 9 },
{ &goomba, .position = 2, .priority = 8 },
{ &goomba, .position = 3, .priority = 7 },
};
Formation formation5 = {
{ &goomba, .position = 1, .priority = 10 },
{ &spiked_goomba, .position = 2, .priority = 9 },
};
Formation formation6 = {
{ &goomba, .position = 0, .priority = 10 },
{ &paragoomba, .position = 5, .priority = 9 },
{ &goomba, .position = 2, .priority = 8 },
{ &paragoomba, .position = 7, .priority = 7 },
};
Formation formation7 = {
{ &paragoomba, .position = 5, .priority = 10 },
};
Formation formation8 = {
{ &paragoomba, .position = 5, .priority = 10 },
{ &paragoomba, .position = 6, .priority = 9 },
};
Formation formation9 = {
{ &paragoomba, .position = 4, .priority = 10 },
{ &paragoomba, .position = 5, .priority = 9 },
{ &paragoomba, .position = 6, .priority = 8 },
};
Formation formation10 = {
{ &spiked_goomba, .position = 1, .priority = 10 },
};
Formation formation11 = {
{ &spiked_goomba, .position = 1, .priority = 10 },
{ &goomba, .position = 2, .priority = 9 },
};
BattleList area_kmr_part_1_battles = {
BATTLE("クリボー", formation0, 0x8022066C),
BATTLE("クリボーx", formation1, 0x8022066C),
BATTLE("クリボーx", formation2, 0x8022066C),
BATTLE("クリボー、パタクリボー", formation3, 0x8022066C),
BATTLE("クリボーx", formation4, 0x8022066C),
BATTLE("クリボー,トゲクリボー", formation5, 0x8022066C),
BATTLE("クリボー,パタクリボー,クリボー,パタクリボー", formation6, 0x8022066C),
BATTLE("パタクリボー", formation7, 0x8022066C),
BATTLE("パタクリボーx", formation8, 0x8022066C),
BATTLE("パタクリボーx", formation9, 0x8022066C),
BATTLE("トゲクリボー", formation10, 0x8022066C),
BATTLE("トゲクリボー、クリボー", formation11, 0x8022066C),
{},
};
StageList area_kmr_part_1_stages = {
{ "kmr_02", 0x8021FDD0 },
{ "kmr_03", 0x8022021C },
{ "kmr_04", 0x8022066C },
{ "kmr_05", 0x80220A78 },
{ "kmr_06", 0x80220ECC },
{},
};

View File

@ -1,9 +0,0 @@
#ifndef _BATTLE_ACTOR_GOOMBA_
#define _BATTLE_ACTOR_GOOMBA_
#include "common.h"
#include "battle/battle.h"
extern ActorDesc goomba;
#endif

View File

@ -1,9 +0,0 @@
#ifndef _BATTLE_ACTOR_PARAGOOMBA_
#define _BATTLE_ACTOR_PARAGOOMBA_
#include "battle/battle.h"
// TODO: disasm
extern ActorDesc paragoomba;
#endif

View File

@ -1,9 +0,0 @@
#ifndef _BATTLE_ACTOR_SPIKED_GOOMBA_
#define _BATTLE_ACTOR_SPIKED_GOOMBA_
#include "battle/battle.h"
// TODO: disasm
extern ActorDesc spiked_goomba;
#endif

View File

@ -0,0 +1,59 @@
#include "common/UnkAngleFunc2.inc.c"
Script N(clouds1) = SCRIPT({
SI_VAR(10) = SI_VAR(0);
SI_VAR(7) = SI_VAR(2);
SI_VAR(7) *= 10;
0:
SI_VAR(7) += 4;
if (SI_VAR(7) > 3599) {
SI_VAR(7) -= 3600;
}
N(UnkAngleFunc2)(SI_VAR(7), SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
TranslateModel(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
RotateModel(SI_VAR(10), SI_VAR(3), 0, 1, 0);
sleep 1;
goto 0;
});
Script N(clouds2) = SCRIPT({
SI_VAR(10) = SI_VAR(0);
SI_VAR(11) = SI_VAR(3);
SI_VAR(12) = SI_VAR(4);
SI_VAR(7) = SI_VAR(2);
SI_VAR(7) *= 10;
0:
SI_VAR(7) += 4;
if (SI_VAR(7) > 3599) {
SI_VAR(7) -= 3600;
}
N(UnkAngleFunc2)(SI_VAR(7), SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
SI_VAR(1) += (float) SI_VAR(11);
SI_VAR(2) += (float) SI_VAR(12);
TranslateModel(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
RotateModel(SI_VAR(10), SI_VAR(3), 0, 1, 0);
sleep 1;
goto 0;
});
Script N(clouds3) = SCRIPT({
SI_VAR(10) = SI_VAR(0);
SI_VAR(11) = SI_VAR(3);
SI_VAR(12) = SI_VAR(4);
SI_VAR(13) = SI_VAR(5);
SI_VAR(7) = SI_VAR(2);
SI_VAR(7) *= 10;
0:
SI_VAR(7) += 4;
if (SI_VAR(7) > 3599) {
SI_VAR(7) -= 3600;
}
N(UnkAngleFunc2)(SI_VAR(7), SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
SI_VAR(0) += (float) SI_VAR(11);
SI_VAR(1) += (float) SI_VAR(12);
SI_VAR(2) += (float) SI_VAR(13);
TranslateModel(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
RotateModel(SI_VAR(10), SI_VAR(3), 0, 1, 0);
sleep 1;
goto 0;
});

View File

@ -0,0 +1,19 @@
#include "common.h"
#include "battle/battle.h"
#define NAMESPACE b_area_kmr_part_1_kmr_02
Script N(beforeBattle_8021FDA0) = SCRIPT({
SetSpriteShading(-1);
});
Script N(afterBattle_8021FDC0) = SCRIPT({
});
Stage NAMESPACE = {
.texture = "kmr_tex",
.shape = "kmr_bt02_shape",
.bg = "kmr_bg",
.preBattle = N(beforeBattle_8021FDA0),
.postBattle = N(afterBattle_8021FDC0),
};

View File

@ -0,0 +1,35 @@
#include "common.h"
#include "battle/battle.h"
#define NAMESPACE b_area_kmr_part_1_kmr_03
#include "clouds.inc.c"
Script N(beforeBattle_80220188) = SCRIPT({
SetSpriteShading(-1);
SI_VAR(0) = 1; // model
SI_VAR(2) = 0; // speed
spawn N(clouds1);
SI_VAR(0) = 4;
SI_VAR(2) = 70;
spawn N(clouds1);
});
Script N(afterBattle_80220200) = SCRIPT({
});
s32 N(foregroundModelList_80220210)[] = {
0x00000027, 0x0000002B, 0x00000000,
};
Stage NAMESPACE = {
.texture = "kmr_tex",
.shape = "kmr_bt03_shape",
.hit = "kmr_bt03_hit",
.bg = "kmr_bg",
.preBattle = N(beforeBattle_80220188),
.postBattle = N(afterBattle_80220200),
.foregroundModelList = N(foregroundModelList_80220210),
};

View File

@ -0,0 +1,36 @@
#include "common.h"
#include "battle/battle.h"
#define NAMESPACE b_area_kmr_part_1_kmr_04
#include "clouds.inc.c"
Script N(beforeBattle_802205D8) = SCRIPT({
SetSpriteShading(-1);
SI_VAR(0) = 1;
SI_VAR(2) = 0;
spawn N(clouds1);
SI_VAR(0) = 4;
SI_VAR(2) = 70;
spawn N(clouds1);
});
Script N(afterBattle_80220650) = SCRIPT({
});
s32 N(foregroundModelList_80220660)[] = {
0x00000024, 0x00000020, 0x00000000,
};
Stage NAMESPACE = {
.texture = "kmr_tex",
.shape = "kmr_bt04_shape",
.hit = "kmr_bt04_hit",
.bg = "kmr_bg",
.preBattle = N(beforeBattle_802205D8),
.postBattle = N(afterBattle_80220650),
.foregroundModelList = N(foregroundModelList_80220660),
};

View File

@ -0,0 +1,29 @@
#include "common.h"
#include "battle/battle.h"
#define NAMESPACE b_area_kmr_part_1_kmr_05
#include "clouds.inc.c"
Script N(beforeBattle_80220A28) = SCRIPT({
SetSpriteShading(-1);
EnableModel(27, 0);
});
Script N(afterBattle_80220A5C) = SCRIPT({
});
s32 N(foregroundModelList_80220A6C)[] = {
0x00000020, 0x00000024, 0x00000000,
};
Stage NAMESPACE = {
.texture = "kmr_tex",
.shape = "kmr_bt05_shape",
.hit = "kmr_bt05_hit",
.bg = "kmr_bg",
.preBattle = N(beforeBattle_80220A28),
.postBattle = N(afterBattle_80220A5C),
.foregroundModelList = N(foregroundModelList_80220A6C),
};

View File

@ -0,0 +1,39 @@
#include "common.h"
#include "battle/battle.h"
#define NAMESPACE b_area_kmr_part_1_kmr_06
#include "clouds.inc.c"
#include "common/UnkFogFunc.inc.c"
Script N(beforeBattle_80220E28) = SCRIPT({
SetSpriteShading(-1);
N(UnkFogFunc)();
SI_VAR(0) = 1;
SI_VAR(2) = 0;
spawn N(clouds1);
SI_VAR(0) = 4;
SI_VAR(2) = 70;
spawn N(clouds1);
});
Script N(afterBattle_80220EAC) = SCRIPT({
});
s32 N(foregroundModelList_80220EBC)[] = {
0x0000001D, 0x00000022, 0x00000021, 0x00000000,
};
Stage NAMESPACE = {
.texture = "kmr_tex",
.shape = "kmr_bt06_shape",
.hit = "kmr_bt06_hit",
.bg = "kmr_bg",
.preBattle = N(beforeBattle_80220E28),
.postBattle = N(afterBattle_80220EAC),
.foregroundModelList = N(foregroundModelList_80220EBC),
};

View File

@ -2,15 +2,15 @@
#include "ld_addrs.h"
#include "battle.h"
extern BattleList area_kmr_part_1_battles;
extern StageList area_kmr_part_1_stages;
extern BattleList b_area_kmr_part_1_formationTable;
extern StageList b_area_kmr_part_1_stageTable;
BattleArea gBattleAreas[0x30] = {
{
AREA(area_kmr_part_1),
.name = "エリア その1",
.battles = area_kmr_part_1_battles,
.stages = area_kmr_part_1_stages,
.battles = b_area_kmr_part_1_formationTable,
.stages = b_area_kmr_part_1_stageTable,
},
{
AREA(area_kmr_part_2),

View File

@ -212,7 +212,8 @@ typedef struct ActorPartDesc {
/* 0x10 */ s32* defenseTable;
/* 0x14 */ s32 eventFlags;
/* 0x18 */ s32 elementImmunityFlags;
/* 0x1C */ char unk_1C[8];
/* 0x1C */ s16 unk_1C;
/* 0x1E */ char unk_1E[6];
} ActorPartDesc; // size = 0x24
typedef struct ActorDesc {
@ -223,7 +224,7 @@ typedef struct ActorDesc {
/* 0x07 */ u8 maxHP;
/* 0x08 */ s16 partCount;
/* 0x0A */ char unk_0A[2];
/* 0x0C */ struct ActorPartDesc** partsData;
/* 0x0C */ struct ActorPartDesc* partsData;
/* 0x10 */ Bytecode* script;
/* 0x14 */ s32* statusTable;
/* 0x18 */ u8 escapeChance;
@ -291,7 +292,7 @@ typedef struct BattleArea {
extern BattleArea gBattleAreas[0x30];
#define BATTLE(name, formation, stage) { name, ARRAY_COUNT(formation), formation, stage }
#define BATTLE(name, formation, stage) { name, ARRAY_COUNT(formation), (Formation*) formation, stage }
// TODO: enum for home position (0..3 are floor, 4..7 are air, etc.)

View File

@ -1,5 +1,7 @@
#include "common.h"
// TODO: this include should have some scripts; see area_kmr_part_1/stage/kmr_03.c
ApiStatus N(UnkAngleFunc2)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
f32 var0 = get_variable(script, *args++) / 10.0;

View File

@ -67,6 +67,13 @@ def script_lib(offset):
_script_lib[k] = sorted(_script_lib[k], key=lambda x: x[0])
return _script_lib
def round_fixed(f: float) -> float:
g = f * 100.0
whole = round(g)
if abs(g - whole) <= 100.0/1024.0:
f = whole / 100.0
return f
# Grab CONSTANTS from the include/ folder to save manual work
CONSTANTS = {}
SAVE_VARS = set()
@ -77,7 +84,7 @@ def get_constants():
valid_enums = { "StoryProgress", "ItemIDs", "PlayerAnims",
"ActorIDs", "Events", "SoundIDs", "SongIDs", "Locations",
"AmbientSounds", "NpcIDs", "Emotes", "NpcFlags",
"Events", "Statuses", "Elements",
"Events", "Statuses", "Elements", "DamageTypes", "HitResults",
"ActorFlags", "ActorPartFlags", "ActorEventFlags", "ElementFlags" }
for enum in valid_enums:
CONSTANTS[enum] = {}
@ -227,7 +234,7 @@ def fix_args(self, func, args, info):
#if argNum not in CONSTANTS["MAP_NPCS"]:
# new_args.append(f"0x{argNum:X}")
# continue
if func == "SetAnimation" and int(new_args[1], 10) == 0:
call = f"{CONSTANTS['PlayerAnims'][argNum]}"
elif "SI_" not in args[0] and int(args[0]) >= 0 and CONSTANTS["MAP_NPCS"].get(int(args[0])) == "NPC_PLAYER":
@ -268,6 +275,18 @@ def fix_args(self, func, args, info):
new_args.append(CONSTANTS["MAP_NPCS"][argNum])
else:
new_args.append(CONSTANTS["NpcIDs"][argNum])
elif info[i] == "DamageTypes":
enabled = []
for x in range(32):
flag = argNum & (1 << x)
if flag:
if flag in CONSTANTS["DamageTypes"]:
enabled.append(CONSTANTS["DamageTypes"][flag])
else:
enabled.append(f"0x{flag:08X}")
if not enabled:
enabled.append(f"0")
new_args.append("((" + " | ".join(enabled) + "))")
elif argNum in CONSTANTS[info[i]]:
new_args.append(f"{CONSTANTS[info[i]][argNum]}")
else:
@ -305,8 +324,8 @@ replace_funcs = {
"EnableIdleScript" :{0:"ActorIDs"},
"EnableNpcShadow" :{0:"NpcIDs", 1:"Bool"},
"EndSpeech" :{1:"CustomAnim", 2:"CustomAnim"},
"EnemyDamageTarget" :{0:"ActorIDs"},
"EnemyTestTarget" :{0:"ActorIDs"},
"EnemyDamageTarget" :{0:"ActorIDs", 2:"DamageTypes"},
"EnemyTestTarget" :{0:"ActorIDs", 2:"DamageTypes"},
"FindKeyItem" :{0:"ItemIDs"},
"ForceHomePos" :{0:"ActorIDs"},
@ -346,7 +365,8 @@ replace_funcs = {
"RemoveActorDecoration" :{0:"ActorIDs"},
"RemoveNpc" :{0:"NpcIDs"},
"RunToGoal" :{0:"ActorIDs"},
"RunToGoal" :{0:"ActorIDs", 2:"Bool"},
"JumpToGoal" :{0:"ActorIDs", 2:"Bool", 3:"Bool", 4:"Bool"},
"SetActorDispOffset" :{0:"ActorIDs"},
"SetActorJumpGravity" :{0:"ActorIDs"},
@ -374,7 +394,7 @@ replace_funcs = {
"SetPlayerAnimation" :{0:"PlayerAnims"},
"SetSelfEnemyFlagBits" :{0:"NpcFlags", 1:"Bool"},
#"SetSelfVar" :{1:"Bool"}, # apparently this was a bool in some scripts but it passes non-0/1 values, including negatives
"SetTargetActor" :{0:"ActorIDs"},
"SetTargetActor" :{0:"ActorIDs", 1:"ActorIDs"},
"ShowChoice" :{0:"CustomMsg"},
"ShowEmote" :{1:"Emotes"},
"ShowMessageAtScreenPos" :{0:"CustomMsg"},
@ -382,7 +402,23 @@ replace_funcs = {
"SpeakToPlayer" :{0:"NpcIDs", 1:"CustomAnim", 2:"CustomAnim", -1:"CustomMsg"},
"SwitchMessage" :{0:"CustomMsg"},
"UseIdleAnimation" :{0:"ActorIDs"},
"UseIdleAnimation" :{0:"ActorIDs", 1:"Bool"},
"BindTakeTurn" :{0:"ActorIDs"},
"BindIdle" :{0:"ActorIDs"},
"BindHandleEvent" :{0:"ActorIDs"},
"SetActorIdleSpeed" :{0:"ActorIDs"},
"SetIdleAnimations" :{0:"ActorIDs"},
"SetIdleGoal" :{0:"ActorIDs"},
"IdleFlyToGoal" :{0:"ActorIDs"},
"GetStatusFlags" :{0:"ActorIDs"},
"ResetAllActorSounds" :{0:"ActorIDs"},
"FlyToGoal" :{0:"ActorIDs"},
"SetActorPos" :{0:"ActorIDs"},
"HPBarToCurrent" :{0:"ActorIDs"},
"SetActorFlagBits" :{0:"ActorIDs"}, # TODO: 1:"ActorFlags"
"SetPartFlags" :{0:"ActorIDs"},
"SetPartPos" :{0:"ActorIDs"},
"SetPartDispOffset" :{0:"ActorIDs"},
}
def replace_constants(self, func, args):
@ -794,7 +830,7 @@ class ScriptDSLDisassembler(ScriptDisassembler):
v = arg - 2**32 # convert to s32
if v > -250000000:
if v <= -220000000: return str((v + 230000000) / 1024)
if v <= -220000000: return str(round_fixed((v + 230000000) / 1024))
elif v <= -200000000: return f"SI_ARRAY_FLAG({v + 210000000})"
elif v <= -180000000: return f"SI_ARRAY({v + 190000000})"
elif v <= -160000000:
@ -844,7 +880,11 @@ class ScriptDSLDisassembler(ScriptDisassembler):
var -= 0x100000000
# put cases for replacing vars here
if (( case and self.case_variable == "STORY_PROGRESS") or
if case and "handleEvent" in self.script_name and var in CONSTANTS["Events"]:
return CONSTANTS["Events"][var]
elif case and "takeTurn" in self.script_name and var in CONSTANTS["HitResults"]:
return CONSTANTS["HitResults"][var]
elif (( case and self.case_variable == "STORY_PROGRESS") or
(not case and self.save_variable == "STORY_PROGRESS")):
if var in CONSTANTS["StoryProgress"]:
return CONSTANTS["StoryProgress"][var]
@ -993,45 +1033,45 @@ class ScriptDSLDisassembler(ScriptDisassembler):
self.case_stack.append("MATCH")
elif opcode == 0x16:
self.case_stack.append("CASE")
self.write(f"== {self.var(argv[0])}")
self.write(f"== {self.replace_enum(argv[0], True)}")
elif opcode == 0x17:
self.case_stack.append("CASE")
self.write(f"!= {self.var(argv[0])}")
self.write(f"!= {self.replace_enum(argv[0], True)}")
elif opcode == 0x18:
self.case_stack.append("CASE")
self.write(f"< {self.var(argv[0])}")
self.write(f"< {self.replace_enum(argv[0], True)}")
elif opcode == 0x19:
self.case_stack.append("CASE")
self.write(f"> {self.var(argv[0])}")
self.write(f"> {self.replace_enum(argv[0], True)}")
elif opcode == 0x1A:
self.case_stack.append("CASE")
self.write(f"<= {self.var(argv[0])}")
self.write(f"<= {self.replace_enum(argv[0], True)}")
elif opcode == 0x1B:
self.case_stack.append("CASE")
self.write(f">= {self.var(argv[0])}")
self.write(f">= {self.replace_enum(argv[0], True)}")
elif opcode == 0x1C:
self.case_stack.append("CASE")
self.write(f"else")
elif opcode == 0x1D:
if self.in_case == "CASE" or self.in_case == "MULTI":
self.out += f", {self.var(argv[0])}"
self.out += f", {self.replace_enum(argv[0], True)}"
# replace(!) CASE with MULTI
self.case_stack.pop()
self.case_stack.append("MULTI")
else:
self.write(f"{self.var(argv[0])}")
self.write(f"{self.replace_enum(argv[0], True)}")
self.case_stack.append("MULTI")
# opcode 0x1E?
elif opcode == 0x1F:
self.case_stack.append("CASE")
self.write_line(f"? {self.var(argv[0])}")
self.write_line(f"? {self.replace_enum(argv[0], True)}")
elif opcode == 0x20:
if not self.was_multi_case:
raise UnsupportedScript("unexpected SI_END_MULTI_CASE")
elif opcode == 0x21:
self.indent -= 1
self.write_line(f"{self.var(argv[0])}..{self.var(argv[1])}")
self.write_line(f"{self.replace_enum(argv[0], True)}..{self.replace_enum(argv[1], True)}")
self.indent += 1
elif opcode == 0x22: self.write_line("break match;")
elif opcode == 0x23:
@ -1054,13 +1094,26 @@ class ScriptDSLDisassembler(ScriptDisassembler):
if varB.startswith("script_"):
varB = "N(" + varB + ")"
self.write_line(f"{varA} = {varB};")
elif opcode == 0x25: self.write_line(f"{self.var(argv[0])} =c 0x{argv[1]:X};")
elif opcode == 0x25:
varA = self.replace_enum(argv[0])
argNum = argv[1]
sprite = (argNum & 0xFF0000) >> 16
palette = (argNum & 0xFF00) >> 8
anim = (argNum & 0xFF) >> 0
call = make_anim_macro(self, sprite, palette, anim)
if "0x" in call:
call = self.var(argNum)
self.write_line(f"{varA} = (const) {call};")
elif opcode == 0x26:
lhs = self.var(argv[1])
if self.is_float(lhs):
self.write_line(f"{self.var(argv[0])} = {lhs};")
else:
self.write_line(f"{self.var(argv[0])} =f {lhs};")
self.write_line(f"{self.var(argv[0])} = (float) {lhs};")
elif opcode == 0x27: self.write_line(f"{self.var(argv[0])} += {self.var(argv[1])};")
elif opcode == 0x28: self.write_line(f"{self.var(argv[0])} -= {self.var(argv[1])};")
elif opcode == 0x29: self.write_line(f"{self.var(argv[0])} *= {self.var(argv[1])};")
@ -1181,7 +1234,6 @@ if __name__ == "__main__":
with open(args.file, "rb") as f:
gap = False
first_print = False
while args.offset < args.end:
f.seek(args.offset)

View File

@ -490,7 +490,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
elif struct["type"] == "TreeDropList":
new_name = "N(" + name.split('_',1)[1][:-1].lower() + "_Drops)"
symbol_map[struct["vaddr"]][0][1] = new_name
out += f"FoliageDropList {new_name} = {{\n"
data = bytes.read(struct["length"])
@ -552,7 +552,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
if isModelList:
if count > 0:
out += f"{INDENT}.models = {{ "
pos = 4
for _ in range(count):
entry = unpack_from(">I", data, pos)[0]
@ -567,7 +567,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
else:
if count > 0:
out += f"{INDENT}.vectors = {{\n"
pos = 4
for _ in range(count):
entry = list(unpack_from(">3I", data, pos))
@ -575,7 +575,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
entry[0] = entry[0] - 0x100000000 if entry[0] >= 0x80000000 else entry[0]
entry[1] = entry[1] - 0x100000000 if entry[1] >= 0x80000000 else entry[1]
entry[2] = entry[2] - 0x100000000 if entry[2] >= 0x80000000 else entry[2]
pos += 3*4
out += f"{INDENT * 2}{{ {entry[0]}, {entry[1]}, {entry[2]} }},\n"
@ -609,7 +609,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
elif struct["type"] == "ShakeTreeEvent":
new_name = "N(" + name.split('_',1)[1].lower()
symbol_map[struct["vaddr"]][0][1] = new_name
num = int(new_name.split("tree",1)[1][:-1])
out += f"ShakeTreeConfig {new_name} = {{\n"
@ -700,7 +700,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
actor, position, priority, var0, var1, var2, var3 = unpack(">IIIIIII", bytes.read(0x1C))
num_bytes_remaining -= 0x1C
out += " "
out += " { "
if actor in symbol_map:
out += f"&{symbol_map[actor][0][1]}, "
@ -712,14 +712,16 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
out += f"{actor}, "
if priority in symbol_map:
out += f"&{symbol_map[priority][0][1]}"
if position in symbol_map:
out += f".position = &{symbol_map[position][0][1]}"
s = f"Vec3f {symbol_map[priority][0][1]};"
s = f"Vec3f {symbol_map[position][0][1]};"
if s not in INCLUDES_NEEDED["forward"]:
INCLUDES_NEEDED["forward"].append(s)
else:
out += f"{priority}"
out += f".position = {position}"
out += f", .priority = {priority}"
if var0 == 0 and var1 == 0 and var2 == 0 and var3 == 0:
pass
@ -728,6 +730,24 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
out += " },\n"
out += f"}};\n"
elif struct["type"] == "FormationTable":
out += f"BattleList {struct['name']} = {{\n"
num_bytes_remaining = struct["length"]
while num_bytes_remaining > 0:
name, formation_length, ptr, stage_ptr, zero = unpack(">IIIII", bytes.read(4 * 5))
num_bytes_remaining -= 4 * 5
if name == 0:
out += " {},\n"
else:
out += " BATTLE("
out += f"{symbol_map[name][0][1]}, "
out += f"&{symbol_map[ptr][0][1]}, "
out += f"&{symbol_map[stage_ptr][0][1]}"
out += "),\n"
out += f"}};\n"
elif struct["type"] == "StageTable":
out += f"StageList {struct['name']} = {{\n"
@ -879,13 +899,13 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0):
out += f" .bg = {symbol_map[bg][0][1]},\n"
if preBattle != 0:
out += f" .preBattle = &{symbol_map[preBattle][0][1]},\n"
out += f" .preBattle = {symbol_map[preBattle][0][1]},\n"
if postBattle != 0:
out += f" .postBattle = &{symbol_map[preBattle][0][1]},\n"
out += f" .postBattle = {symbol_map[postBattle][0][1]},\n"
if unk_18 != 0:
out += f" .foregroundModelList = &{symbol_map[unk_18][0][1]},\n"
out += f" .foregroundModelList = {symbol_map[unk_18][0][1]},\n"
if unk_1C != 0:
out += f" .unk_1C = {unk_1C:X},\n"

File diff suppressed because one or more lines are too long

View File

@ -1,6 +0,0 @@
.include "macro.inc"
.section .rodata
glabel D_80220FE4_439984
.word 0x6B6D725F, 0x30360000, 0x6B6D725F, 0x30350000, 0x6B6D725F, 0x30340000, 0x6B6D725F, 0x30330000, 0x6B6D725F, 0x30320000, 0x6B6D725F, 0x62670000, 0x6B6D725F, 0x62743032, 0x5F736861, 0x70650000, 0x6B6D725F, 0x74657800, 0x6B6D725F, 0x62670000, 0x6B6D725F, 0x62743033, 0x5F686974, 0x00000000, 0x6B6D725F, 0x62743033, 0x5F736861, 0x70650000, 0x6B6D725F, 0x74657800, 0x6B6D725F, 0x62670000, 0x6B6D725F, 0x62743034, 0x5F686974, 0x00000000, 0x6B6D725F, 0x62743034, 0x5F736861, 0x70650000, 0x6B6D725F, 0x74657800, 0x6B6D725F, 0x62670000, 0x6B6D725F, 0x62743035, 0x5F686974, 0x00000000, 0x6B6D725F, 0x62743035, 0x5F736861, 0x70650000, 0x6B6D725F, 0x74657800, 0x6B6D725F, 0x62670000, 0x6B6D725F, 0x62743036, 0x5F686974, 0x00000000, 0x6B6D725F, 0x62743036, 0x5F736861, 0x70650000, 0x6B6D725F, 0x74657800, 0x00000000

View File

@ -2841,21 +2841,33 @@ segments:
type: code
start: 0x4309A0
vram: 0x80218000
overlay: True
subalign: 4
overlay: True
subsegments:
- [0x4309A0, c, battles] # DUMMY ROM
- [0x4309A0, c, goomba] # DUMMY ROM
- [0x4309A0, c]
- [0x431180, c]
- [0x4313F0, c]
- [0x431660, c]
- [0x4318D0, c]
- [0x431B80, .data, battles]
- [0x431FB0, .data, goomba]
- [0x433970, data]
- [0x4398A0, .rodata, battles]
- [0x439984, rodata] # TODO change
- [0x4309A0, c, area]
- [0x4309A0, c, actor/goomba]
- [0x430C20, c, actor/spiked_goomba]
- [0x430EA0, c, actor/paragoomba]
- [0x431180, c, stage/kmr_02]
- [0x431180, c, stage/kmr_03]
- [0x4313F0, c, stage/kmr_04]
- [0x431660, c, stage/kmr_05]
- [0x4318D0, c, stage/kmr_06]
- [0x431B80, .data, area]
- [0x431FB0, .data, actor/goomba]
- [0x433970, .data, actor/spiked_goomba]
- [0x4354A0, .data, actor/paragoomba]
- [0x438740, .data, stage/kmr_02]
- [0x4387A0, .data, stage/kmr_03]
- [0x438BF0, .data, stage/kmr_04]
- [0x439040, .data, stage/kmr_05]
- [0x439440, .data, stage/kmr_06]
- [0x4398A0, .rodata, area]
- [0x4399AC, .rodata, stage/kmr_02] # FIXME: fucky rodata alignment
- [0x4399CC, .rodata, stage/kmr_03]
- [0x4399FC, .rodata, stage/kmr_04]
- [0x439A2C, .rodata, stage/kmr_05]
- [0x439A5C, .rodata, stage/kmr_06]
- dir: battle/area_kmr_part_2
type: code
start: 0x439A90