summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenny022p <info@henny022.de>2021-03-15 22:56:23 +0100
committerHenny022p <info@henny022.de>2021-03-15 22:56:23 +0100
commita2cdfd6d8dd910aa402b7e6bdf32278ac9b80c50 (patch)
treedd9524198ad151c49eb01e92f46743e6e306673e /src
parentaac7eb743646634c1476141ba5d07da53ab56193 (diff)
parente09678c6ab4d6c1070495cf8b49b8b3dffefc4af (diff)
Merge branch 'master' into cleanup_declarations
Diffstat (limited to 'src')
-rw-r--r--src/code_0805436C.c2
-rw-r--r--src/code_0805EC04.c2
-rw-r--r--src/code_080A29BC.c2
-rw-r--r--src/enemy/acroBandits.c2
-rw-r--r--src/enemy/beetle.c10
-rw-r--r--src/enemy/bobomb.c10
-rw-r--r--src/enemy/bombPeahat.c6
-rw-r--r--src/enemy/chaser.c8
-rw-r--r--src/enemy/chuchu.c14
-rw-r--r--src/enemy/cuccoChickAggr.c4
-rw-r--r--src/enemy/darkNut.c8
-rw-r--r--src/enemy/fallingBoulder.c8
-rw-r--r--src/enemy/fireballGuy.c2
-rw-r--r--src/enemy/gibdo.c6
-rw-r--r--src/enemy/gyorgMale.c70
-rw-r--r--src/enemy/helmasaur.c12
-rw-r--r--src/enemy/keaton.c6
-rw-r--r--src/enemy/leever.c4
-rw-r--r--src/enemy/madderpillar.c6
-rw-r--r--src/enemy/miniFireballGuy.c2
-rw-r--r--src/enemy/miniSlime.c6
-rw-r--r--src/enemy/peahat.c18
-rw-r--r--src/enemy/pesto.c50
-rw-r--r--src/enemy/rollobite.c4
-rw-r--r--src/enemy/rope.c8
-rw-r--r--src/enemy/ropeGolden.c4
-rw-r--r--src/enemy/rupeeLike.c2
-rw-r--r--src/enemy/sensorBladeTrap.c4
-rw-r--r--src/enemy/slime.c6
-rw-r--r--src/enemy/smallPesto.c2
-rw-r--r--src/enemy/spearMoblin.c18
-rw-r--r--src/enemy/spikedBeetle.c8
-rw-r--r--src/enemy/spinyChuchu.c6
-rw-r--r--src/enemy/vaatiBall.c28
-rw-r--r--src/enemy/wallMaster2.c4
-rw-r--r--src/enemy/waterDrop.c2
-rw-r--r--src/entity.c2
-rw-r--r--src/game.c2
-rw-r--r--src/item11.c2
-rw-r--r--src/item14.c2
-rw-r--r--src/npc/anju.c1
-rw-r--r--src/npc/beedle.c12
-rw-r--r--src/npc/bigGoron.c4
-rw-r--r--src/npc/bladeBrothers.c42
-rw-r--r--src/npc/carlov.c2
-rw-r--r--src/npc/carpenter.c10
-rw-r--r--src/npc/cow.c2
-rw-r--r--src/npc/dampe.c27
-rw-r--r--src/npc/emma.c16
-rw-r--r--src/npc/ezloCap.c65
-rw-r--r--src/npc/festari.c2
-rw-r--r--src/npc/forestMinish.c8
-rw-r--r--src/npc/goron.c6
-rw-r--r--src/npc/guard.c20
-rw-r--r--src/npc/librari.c12
-rw-r--r--src/npc/mayorHagen.c4
-rw-r--r--src/npc/melari.c4
-rw-r--r--src/npc/postman.c4
-rw-r--r--src/npc/rem.c8
-rw-r--r--src/npc/simon.c4
-rw-r--r--src/npc/smith.c12
-rw-r--r--src/npc/stamp.c8
-rw-r--r--src/npc/syrup.c4
-rw-r--r--src/npc/talon.c8
-rw-r--r--src/npc/townMinish.c32
-rw-r--r--src/npc/townsperson.c18
-rw-r--r--src/npc/windTribespeople.c14
-rw-r--r--src/npc/zelda.c154
-rw-r--r--src/object/backgroundCloud.c2
-rw-r--r--src/object/bird.c2
-rw-r--r--src/object/cloud.c2
-rw-r--r--src/object/fileScreenObjects.c4
-rw-r--r--src/object/greatFairy.c29
-rw-r--r--src/object/houseDoorExterior.c15
-rw-r--r--src/object/itemOnGround.c6
-rw-r--r--src/object/metalDoor.c2
-rw-r--r--src/object/minecart.c8
-rw-r--r--src/object/object1A.c2
-rw-r--r--src/object/objectA2.c2
-rw-r--r--src/object/objectB2.c4
-rw-r--r--src/object/pot.c6
-rw-r--r--src/object/smoke.c2
-rw-r--r--src/object/windcrest.c5
-rw-r--r--src/player.c6
-rw-r--r--src/room.c71
-rw-r--r--src/script.c1563
86 files changed, 1342 insertions, 1254 deletions
diff --git a/src/code_0805436C.c b/src/code_0805436C.c
index 76a9b18c..be879f99 100644
--- a/src/code_0805436C.c
+++ b/src/code_0805436C.c
@@ -255,7 +255,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
arg0->attachedEntity = itemEntity;
} else if (arg0->id == 0x1e) {
itemEntity->direction = arg0->animationState << 3 | 0x80;
- itemEntity->nonPlanarMovement = 0xc0;
+ itemEntity->speed = 0xc0;
itemEntity->field_0x20 = 0x18000;
}
}
diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c
index 1981f507..6c847707 100644
--- a/src/code_0805EC04.c
+++ b/src/code_0805EC04.c
@@ -104,4 +104,4 @@ void sub_0805ED14(u32 param_1) {
gPlayerState.field_0x9c = param_1;
gPlayerState.field_0x98 = 0;
gPlayerState.field_0x9a = 0;
-} \ No newline at end of file
+}
diff --git a/src/code_080A29BC.c b/src/code_080A29BC.c
index d33d3b94..c8476217 100644
--- a/src/code_080A29BC.c
+++ b/src/code_080A29BC.c
@@ -2,7 +2,7 @@
#include "entity.h"
#include "room.h"
-void sub_080A29BC(Entity* parent) {
+void sub_080A29BC(Entity* parent) { // TODO this is CreateDust, why is it here again? Fogot to delete file?
CreateFx(parent, 2, 0);
}
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index 142b4010..2c910bc4 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -449,7 +449,7 @@ void sub_08032160(Entity* this) {
} else {
this->spriteSettings.b.flipX = 0;
}
- this->nonPlanarMovement = 0xf0;
+ this->speed = 0xf0;
this->field_0x20 = 0x12000;
this->spritePriority.b1 = 1;
InitializeAnimation(this, 12);
diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c
index a55b0f7f..66bf33e9 100644
--- a/src/enemy/beetle.c
+++ b/src/enemy/beetle.c
@@ -104,7 +104,7 @@ void sub_080218CC(Entity* this) {
this->previousActionFlag = 1;
this->spriteSettings.b.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->field_0x20 = 0x12000;
}
@@ -120,7 +120,7 @@ void sub_080218CC(Entity* this) {
this->actionDelay = (Random() & 0x38) + 8;
this->field_0xf = 1;
this->flags |= 0x80;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
InitializeAnimation(this, 0);
}
}
@@ -141,7 +141,7 @@ void sub_08021984(Entity* this) {
this->actionDelay = 16;
this->field_0xf = 1;
this->spriteSettings.b.draw = 1;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
((u8*)&this->field_0x86)[0] = 60;
InitializeAnimation(this, 0);
UpdateSpriteForCollisionLayer(this);
@@ -311,9 +311,9 @@ void sub_08021D44(Entity* this, u32 direction) {
direction = DirectionRoundUp(direction);
this->direction = direction;
if (DirectionIsHorizontal(direction)) {
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
} else {
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
}
}
diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c
index e5716276..43b1a2c2 100644
--- a/src/enemy/bobomb.c
+++ b/src/enemy/bobomb.c
@@ -54,7 +54,7 @@ void sub_0802C688(Entity* this) {
this->damageType = 0x6e;
this->field_0xf = 1;
this->field_0x20 = 0x18000;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->field_0x80.HALF.HI = 1;
InitializeAnimation(this, this->direction >> 4 | 6);
break;
@@ -69,7 +69,7 @@ void sub_0802C7AC(Entity* this) {
this->field_0xf = 1;
this->height.HALF.HI = 0;
if (this->field_0x82.HALF.LO != 2) {
- this->nonPlanarMovement = this->field_0x82.HALF.LO ? 0x200 : 0x80;
+ this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80;
}
this->field_0x20 = 0x18000;
this->field_0x82.HALF.HI = 0;
@@ -225,7 +225,7 @@ void sub_0802CA94(Entity* this) {
this->field_0xf = 1;
this->spritePriority.b1 = 1;
this->field_0x20 = 0x18000;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
this->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c;
@@ -262,11 +262,11 @@ void sub_0802CB68(Entity* this) {
this->flags |= 0x80;
if (this->field_0x82.HALF.LO) {
this->actionDelay = 200;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
InitializeAnimation(this, (this->direction >> 4) | 2);
} else {
this->actionDelay = 0x3c;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
InitializeAnimation(this, this->direction >> 4);
}
}
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index caaf98b0..93c7dcf1 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -172,7 +172,7 @@ void sub_0802AA40(Entity* this) {
}
if (this->direction == direction) {
this->action = 3;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
this->field_0x7a.HALF.HI = 0;
ent->field_0x80.HALF.LO = 1;
ent->actionDelay = 0x96;
@@ -242,7 +242,7 @@ void sub_0802AB40(Entity* this) {
}
} else {
this->action = 5;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
InitializeAnimation(this, this->type + 1);
}
break;
@@ -254,7 +254,7 @@ void sub_0802AC08(Entity* this) {
this->action = 2;
this->previousActionFlag = 0;
this->actionDelay = 0x40;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
sub_0802ACDC(this, 8);
sub_0802ADDC(this);
}
diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c
index 00d99937..7e0ac960 100644
--- a/src/enemy/chaser.c
+++ b/src/enemy/chaser.c
@@ -36,7 +36,7 @@ void sub_0802B540(Entity* this) {
u32 direction = sub_0804A024(this, 1, 0xc);
if (direction != 0xff) {
this->action = 2;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
this->direction = direction;
}
}
@@ -45,15 +45,15 @@ void sub_0802B540(Entity* this) {
void sub_0802B56C(Entity* this) {
GetNextFrame(this);
if (this->bitfield & 0x80) {
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
}
if (sub_080AF038(this)) {
if (this->animIndex != 1) {
InitializeAnimation(this, 1);
}
- if (this->nonPlanarMovement < 0x220) {
- this->nonPlanarMovement += 4;
+ if (this->speed < 0x220) {
+ this->speed += 4;
}
} else {
this->action = 3;
diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c
index 625fab9b..4f8d86d0 100644
--- a/src/enemy/chuchu.c
+++ b/src/enemy/chuchu.c
@@ -55,7 +55,7 @@ void Chuchu(Entity* this) {
if (this->flags & 0x80) {
this->action = 6;
this->flags &= ~0x80;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
this->damageType = 0x5c;
InitializeAnimation(this, 5);
}
@@ -294,7 +294,7 @@ void sub_0801F328(Entity* this) {
void sub_0801F340(Entity* this) {
this->action = 5;
this->actionDelay = 60;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
this->damageType = 92;
InitializeAnimation(this, 2);
}
@@ -418,7 +418,7 @@ void sub_0801F584(Entity* this) {
} else {
this->action = 6;
this->field_0xf = 60;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
this->damageType = 92;
InitializeAnimation(this, 2);
}
@@ -470,7 +470,7 @@ void sub_0801F6F8(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 4;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
sub_0804AA1C(this);
InitializeAnimation(this, 2);
}
@@ -593,7 +593,7 @@ void sub_0801F940(Entity* this) {
} else {
this->action = 6;
this->field_0xf = 60;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
InitializeAnimation(this, 2);
}
}
@@ -645,7 +645,7 @@ void sub_0801FAAC(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
sub_0801FB14(this);
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
sub_0804AA1C(this);
}
}
@@ -706,7 +706,7 @@ u32 sub_0801FBD0(Entity* this) {
}
void Chuchu_JumpAtPlayer(Entity* this) {
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
this->field_0x20 = 0x20000;
this->direction = sub_08049F84(this, 1);
InitializeAnimation(this, 3);
diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c
index 0b894e09..683ba4b8 100644
--- a/src/enemy/cuccoChickAggr.c
+++ b/src/enemy/cuccoChickAggr.c
@@ -72,7 +72,7 @@ void sub_080229F8(Entity* this) {
this->actionDelay = 6;
this->field_0xf = 8;
this->frameIndex = 0;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
sub_08022B44(this);
} else {
this->field_0x20 = 0x10000;
@@ -111,7 +111,7 @@ void sub_08022AA4(Entity* this) {
this->action = 2;
this->actionDelay = (rand & 3) + 1;
this->field_0xf = 1;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
if (!sub_08049FA0(this) && (rand >> 8) & 3) {
this->direction = sub_08049EE4(this);
diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c
index 82f1d53a..95516741 100644
--- a/src/enemy/darkNut.c
+++ b/src/enemy/darkNut.c
@@ -430,7 +430,7 @@ void sub_08021328(Entity* this) {
void sub_0802134C(Entity* this) {
this->action = 15;
this->direction = DirectionFromAnimationState(this->animationState);
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->field_0x76.HWORD = 0x78;
sub_08021218(this, 0xe, this->animationState);
}
@@ -447,7 +447,7 @@ void sub_08021380(Entity* this) {
void sub_08021390(Entity* this) {
this->action = 7;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->damageType = 0x56;
sub_08021218(this, 6, this->animationState);
}
@@ -455,7 +455,7 @@ void sub_08021390(Entity* this) {
void sub_080213B0(Entity* this) {
this->action = 3;
this->actionDelay = 1;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
this->field_0x76.HWORD = 0xf0;
sub_08021218(this, 3, this->animationState);
}
@@ -474,7 +474,7 @@ void sub_080213F0(Entity* this) {
void sub_08021400(Entity* this) {
this->action = 9;
- this->nonPlanarMovement = 0x60;
+ this->speed = 0x60;
sub_08021218(this, 10, this->animationState);
}
diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c
index 570c3715..29076b1c 100644
--- a/src/enemy/fallingBoulder.c
+++ b/src/enemy/fallingBoulder.c
@@ -157,15 +157,15 @@ void sub_0802C4B0(Entity* this) {
rand = Random() & 7;
if (rand & 4) {
if (rand & 3) {
- this->nonPlanarMovement = gUnk_080CD568[offset | 2];
+ this->speed = gUnk_080CD568[offset | 2];
} else {
- this->nonPlanarMovement = gUnk_080CD568[offset | 0];
+ this->speed = gUnk_080CD568[offset | 0];
}
} else {
if (rand & 3) {
- this->nonPlanarMovement = gUnk_080CD568[offset | 1];
+ this->speed = gUnk_080CD568[offset | 1];
} else {
- this->nonPlanarMovement = gUnk_080CD568[offset | 3];
+ this->speed = gUnk_080CD568[offset | 3];
}
}
diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c
index c77281a7..19e4d9fd 100644
--- a/src/enemy/fireballGuy.c
+++ b/src/enemy/fireballGuy.c
@@ -41,7 +41,7 @@ void sub_080453E8(Entity* this) {
this->action = 1;
this->actionDelay = 0;
this->spriteSettings.b.draw = 1;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->cutsceneBeh.HALF.LO = this->currentHealth;
this->field_0x3c |= 0x10;
sub_0804A720(this);
diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c
index 02b7f327..7b44f754 100644
--- a/src/enemy/gibdo.c
+++ b/src/enemy/gibdo.c
@@ -212,7 +212,7 @@ void sub_080377B0(Entity* this) {
this->field_0xf = 8;
r1 = Random();
this->field_0x74.HWORD = (r1 & 0x38) + 0x78;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
r2 = Random();
if (!sub_08049FA0(this) && (r2 & 3)) {
this->direction = DirectionRoundUp(sub_08049EE4(this));
@@ -234,7 +234,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037810.inc", u32 sub_08037810(Entity* thi
this->action = 3;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
y = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0));
this->direction = y;
this->animationState = y / 8;
@@ -259,7 +259,7 @@ u32 sub_080378B0(Entity* this) {
if (sub_0804A044(this, gUnk_020000B0, 0xa) == this->direction)
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
this->action = 5;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
InitAnimationForceUpdate(this, this->animationState + 8);
return 1;
}
diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c
index 86939a3c..66752186 100644
--- a/src/enemy/gyorgMale.c
+++ b/src/enemy/gyorgMale.c
@@ -144,7 +144,7 @@ void sub_08046930(Entity* this) {
if (this->type) {
this->previousActionFlag = 5;
this->direction = 0x20;
- this->nonPlanarMovement = 0x280;
+ this->speed = 0x280;
}
sub_08047D88(this);
if (this->field_0x7c.BYTES.byte0 == 0)
@@ -153,7 +153,7 @@ void sub_08046930(Entity* this) {
this->actionDelay = 1;
this->animationState = 0;
this->direction = 0;
- this->nonPlanarMovement = 0x280;
+ this->speed = 0x280;
}
void sub_0804696C(Entity* this) {
@@ -161,7 +161,7 @@ void sub_0804696C(Entity* this) {
if (gRoomControls.roomOriginY + 0x130 > this->y.HALF.HI) {
this->previousActionFlag = 2;
this->direction = 0x80;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->spriteOrientation.flipY = 3;
this->spriteRendering.b3 = 3;
SoundReq(0x2e);
@@ -232,7 +232,7 @@ void sub_08046A9C(Entity* this) {
void sub_08046AE8(Entity* this) {
this->previousActionFlag = 1;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
sub_08048178(this, ((Entity*)this->myHeap)->next->animationState >> 5);
this->field_0x76.HWORD = this->direction << 8;
sub_08047D88(this);
@@ -310,7 +310,7 @@ void sub_08046CEC(Entity* this) {
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 2) {
this->action = 2;
this->previousActionFlag = 0;
- this->animationState = this->nonPlanarMovement;
+ this->animationState = this->speed;
}
}
@@ -319,7 +319,7 @@ const u16 gUnk_080D1B60[8] = { 0x200, 0x184, 0x28C, 0x210, 0x200, 0x29C, 0x174,
void sub_08046D44(Entity* this) {
const u16* tmp;
this->previousActionFlag = 1;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
tmp = gUnk_080D1B60 + (((Entity*)this->myHeap)->next->animationState >> 5);
this->field_0x80.HWORD = tmp[0] + gRoomControls.roomOriginX;
this->field_0x82.HWORD = tmp[1] + gRoomControls.roomOriginY;
@@ -385,7 +385,7 @@ void sub_08046EF4(Entity* this) {
this->actionDelay = 0x7F;
this->direction ^= 0x80;
}
- this->nonPlanarMovement = gUnk_080D1B74[(this->actionDelay >> 3) & 0xF];
+ this->speed = gUnk_080D1B74[(this->actionDelay >> 3) & 0xF];
if ((--this->field_0xf & 0xFF) == 0) {
Entity* tmp;
this->field_0xf = (Random() & 0x38) + 0x78;
@@ -428,7 +428,7 @@ void sub_08046F64(Entity* this) {
void sub_08046FE8(Entity* this) {
this->previousActionFlag = 1;
- this->nonPlanarMovement = 0x1c0;
+ this->speed = 0x1c0;
this->field_0x7c.HALF.HI = 0x1e;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x290;
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x190;
@@ -445,10 +445,10 @@ void sub_0804702C(Entity* this) {
}
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
- if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, (this->nonPlanarMovement >> 0x10) + 0x10)) {
+ if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, (this->speed >> 0x10) + 0x10)) {
this->previousActionFlag = 2;
this->field_0x76.HWORD = this->direction << 8;
- this->nonPlanarMovement = 0x280;
+ this->speed = 0x280;
}
}
@@ -467,7 +467,7 @@ void sub_080470B4(Entity* this) {
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->field_0x76.HWORD = this->direction << 8;
this->field_0x74.HWORD = gUnk_080D1BBC[Random() & 1];
sub_08047D88(this);
@@ -485,8 +485,8 @@ void sub_08047140(Entity* this) {
}
void sub_0804717C(Entity* this) {
- if (this->nonPlanarMovement < 0x280) {
- this->nonPlanarMovement += 8;
+ if (this->speed < 0x280) {
+ this->speed += 8;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI) {
@@ -495,8 +495,8 @@ void sub_0804717C(Entity* this) {
}
void sub_080471C8(Entity* this) {
- if (this->nonPlanarMovement > 0x180) {
- this->nonPlanarMovement -= 0x10;
+ if (this->speed > 0x180) {
+ this->speed -= 0x10;
}
if (this->direction < 0xe0) {
this->direction++;
@@ -519,7 +519,7 @@ void sub_0804723C(Entity* this) {
this->direction -= 2;
if (this->direction < 0xc0) {
this->previousActionFlag = 7;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->direction = 0xc0;
this->field_0x76.HWORD = 0xc000;
}
@@ -538,8 +538,8 @@ void sub_08047284(Entity* this) {
}
void sub_080472BC(Entity* this) {
- if (this->nonPlanarMovement < 0x300) {
- this->nonPlanarMovement += 8;
+ if (this->speed < 0x300) {
+ this->speed += 8;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI)
@@ -549,8 +549,8 @@ void sub_080472BC(Entity* this) {
}
void sub_08047310(Entity* this) {
- if (this->nonPlanarMovement < 0x180) {
- this->nonPlanarMovement -= 0x10;
+ if (this->speed < 0x180) {
+ this->speed -= 0x10;
}
this->field_0x76.HWORD -= 0x1D0;
this->direction = this->field_0x76.HWORD >> 8;
@@ -580,7 +580,7 @@ void sub_0804736C(Entity* this) {
void sub_080473B8(Entity* this) {
this->previousActionFlag = 1;
- this->nonPlanarMovement = 0x120;
+ this->speed = 0x120;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x200;
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x1D0;
sub_08047D88(this);
@@ -608,7 +608,7 @@ void sub_080473F0(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 8)) {
this->previousActionFlag = 2;
this->field_0x76.HWORD = this->direction << 8;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
}
}
@@ -625,7 +625,7 @@ void sub_08047484(Entity* this) {
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->direction = 0x40;
this->field_0x76.HWORD = 0x4000;
this->field_0x74.HWORD = 0x180;
@@ -665,7 +665,7 @@ void sub_08047508(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x280 < this->x.HALF.HI) {
this->previousActionFlag = 4;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->animationState = this->direction;
this->field_0x76.HWORD = this->direction << 8;
}
@@ -683,7 +683,7 @@ void sub_080475F4(Entity* this) {
if (this->direction >= 0xc0) {
this->direction = 0xc0;
this->previousActionFlag = 5;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->field_0x7c.HALF.HI = 0x3c;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
@@ -720,7 +720,7 @@ void sub_0804763C(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x180 > this->x.HALF.HI) {
this->previousActionFlag = 6;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->animationState = this->direction;
this->field_0x76.HWORD = this->direction << 8;
}
@@ -738,7 +738,7 @@ void sub_0804772C(Entity* this) {
if (this->direction <= 0x40) {
this->direction = 0x40;
this->previousActionFlag = 3;
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
this->field_0x7c.HALF.HI = 0x1e;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
@@ -753,7 +753,7 @@ void sub_08047778(Entity* this) {
void sub_08047798(Entity* this) {
this->previousActionFlag = 1;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
if (this->x.HALF.HI - gRoomControls.roomOriginX < 0x1F8) {
this->field_0x80.HWORD = 0xa8;
} else {
@@ -767,8 +767,8 @@ void sub_08047798(Entity* this) {
const s16 gUnk_080D1BF0[2] = { 0x80, -0x80 };
void sub_080477F0(Entity* this) {
- if (this->nonPlanarMovement < 0x300) {
- this->nonPlanarMovement += 8;
+ if (this->speed < 0x300) {
+ this->speed += 8;
}
this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
sub_08047E48(this);
@@ -876,7 +876,7 @@ void sub_08047978(Entity* this) {
void sub_08047B08(Entity* this) {
sub_08047D88(this);
this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
- this->nonPlanarMovement = 0x200;
+ this->speed = 0x200;
sub_08047E58(this);
if (!sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4))
return;
@@ -918,7 +918,7 @@ const s8 gUnk_080D1C00[4] = { 0x40, -0x40, -0x40, 0x40 };
void sub_08047BF0(Entity* this) {
Entity* tmp;
this->direction = gUnk_080D1C00[this->actionDelay & 3];
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
sub_08047E48(this);
if (this->actionDelay == 0) {
if ((this->field_0xf++ & 0xF) == 0) {
@@ -934,7 +934,7 @@ void sub_08047BF0(Entity* this) {
}
}
this->direction = this->field_0x76.HWORD;
- this->nonPlanarMovement = 0x140;
+ this->speed = 0x140;
sub_08047E48(this);
if (this->y.HALF.HI > gRoomControls.roomOriginY + 0x270) {
this->previousActionFlag = 2;
@@ -1009,7 +1009,7 @@ void sub_08047DF0(Entity* this, u32 unk1) {
sub_08047EA4(this, unk1);
oldX = this->x.HALF.HI;
oldY = this->y.HALF.HI;
- sub_0806F62C(this, this->nonPlanarMovement, this->direction);
+ sub_0806F62C(this, this->speed, this->direction);
if (this->field_0x7c.BYTES.byte0 & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += this->x.HALF.HI - oldX;
@@ -1027,7 +1027,7 @@ void sub_08047E58(Entity* this) {
u32 oldX, oldY;
oldX = this->x.HALF.HI;
oldY = this->y.HALF.HI;
- sub_0806F62C(this, this->nonPlanarMovement, this->direction);
+ sub_0806F62C(this, this->speed, this->direction);
if (this->field_0x7c.BYTES.byte0 & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += this->x.HALF.HI - oldX;
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index c36db42b..7a75bd29 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -177,7 +177,7 @@ void sub_0802BE18(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 4;
this->actionDelay = 0x1e;
- this->nonPlanarMovement = 0x300;
+ this->speed = 0x300;
} else {
sub_0802C18C(this);
}
@@ -197,12 +197,12 @@ void sub_0802BE48(Entity* this) {
}
void sub_0802BE80(Entity* this) {
- this->nonPlanarMovement -= 0x20;
- if (0xff < this->nonPlanarMovement) {
+ this->speed -= 0x20;
+ if (0xff < this->speed) {
sub_0802C1CC(this);
}
- if (this->nonPlanarMovement > 0) {
+ if (this->speed > 0) {
sub_080AEFE0(this);
sub_0802C18C(this);
} else {
@@ -230,7 +230,7 @@ void sub_0802BEEC(Entity* this) {
} else if (!sub_08003FC4(this, 0x1c00)) {
this->action = 8;
this->actionDelay = 30;
- this->nonPlanarMovement = 0x120;
+ this->speed = 0x120;
}
}
@@ -367,7 +367,7 @@ void sub_0802C1CC(Entity* this) {
void sub_0802C218(Entity* this) {
this->action = 6;
- this->nonPlanarMovement = 0xe0;
+ this->speed = 0xe0;
this->field_0x20 = 0x18000;
}
diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c
index 0da3cb57..79e98065 100644
--- a/src/enemy/keaton.c
+++ b/src/enemy/keaton.c
@@ -104,7 +104,7 @@ void sub_080324FC(Entity* this) {
this->field_0xf--;
if (this->field_0xf == 0) {
this->action = 4;
- this->nonPlanarMovement = 0x1E0;
+ this->speed = 0x1E0;
this->field_0x76.HWORD = 0x46;
this->field_0x78.HWORD = 0;
*(((u8*)&this->field_0x7a) + 1) = 0;
@@ -199,7 +199,7 @@ u32 sub_0803271C(Entity* this) {
void sub_08032740(Entity* this) {
this->action = 1;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
InitializeAnimation(this, this->animationState);
sub_08032650(this);
}
@@ -207,7 +207,7 @@ void sub_08032740(Entity* this) {
void sub_0803275C(Entity* this) {
this->action = 5;
this->actionDelay = 0x2D;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
InitAnimationForceUpdate(this, this->animationState);
sub_0803269C(this, this->direction);
sub_080327E0(this);
diff --git a/src/enemy/leever.c b/src/enemy/leever.c
index 4e6fb823..a4d5ffa9 100644
--- a/src/enemy/leever.c
+++ b/src/enemy/leever.c
@@ -167,13 +167,13 @@ void Leever_Move(Entity* this) {
this->field_0x74.HWORD = 1;
}
- this->nonPlanarMovement = (this->frames.all & 0xf) * 0x20;
+ this->speed = (this->frames.all & 0xf) * 0x20;
if (this->type == LeeverForm_Red) {
if ((this->field_0xf++ & 0xf) == 0) {
sub_08004596(this, sub_0800132C(this, gUnk_020000B0));
}
} else {
- this->nonPlanarMovement += 0x40;
+ this->speed += 0x40;
if ((this->field_0xf++ & 0x7) == 0) {
sub_08004596(this, sub_0800132C(this, gUnk_020000B0));
}
diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c
index bca381f6..31789784 100644
--- a/src/enemy/madderpillar.c
+++ b/src/enemy/madderpillar.c
@@ -116,7 +116,7 @@ void sub_0802999C(Entity* this) {
this->action = 1;
this->flags |= 0x80;
this->direction = DirectionRound(Random());
- this->nonPlanarMovement = 0xa0;
+ this->speed = 0xa0;
this->animationState = 0xff;
this->y.WORD += 6;
this->parent = this;
@@ -136,7 +136,7 @@ void sub_08029A94(Entity* this) {
void sub_08029AA4(Entity* this) {
if (this->field_0x76.HALF.HI != 0) {
this->action = 3;
- this->nonPlanarMovement = 0x108;
+ this->speed = 0x108;
this->damageType = 0x6a;
this->field_0x7a.HWORD = 0x168;
this->field_0x74.HALF.HI = 4;
@@ -151,7 +151,7 @@ void sub_08029AE0(Entity* this) {
sub_0802A098(this);
if (--this->field_0x7a.HWORD == 0) {
this->action = 1;
- this->nonPlanarMovement = 0xa0;
+ this->speed = 0xa0;
this->field_0x74.HALF.HI = 0;
sub_08029EEC(this);
sub_0801D2B4(this, 0x77);
diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c
index 50a10eec..3210aeeb 100644
--- a/src/enemy/miniFireballGuy.c
+++ b/src/enemy/miniFireballGuy.c
@@ -36,7 +36,7 @@ void nullsub_23(Entity* this) {
void sub_08045618(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->field_0x3c = this->field_0x3c | 0x10;
sub_0804A720(this);
InitializeAnimation(this, 1);
diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c
index ad880319..6df8075a 100644
--- a/src/enemy/miniSlime.c
+++ b/src/enemy/miniSlime.c
@@ -48,7 +48,7 @@ void nullsub_22(void) {
void sub_080452A4(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
sub_0804A720(this);
InitializeAnimation(this, 6);
if (this->type2) {
@@ -70,8 +70,8 @@ void sub_080452FC(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 1;
- if (0 < this->nonPlanarMovement)
- this->actionDelay = sub_0806FA04(0x1000, this->nonPlanarMovement) >> 0x8;
+ if (0 < this->speed)
+ this->actionDelay = sub_0806FA04(0x1000, this->speed) >> 0x8;
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
cVar2 = sub_08049EE4(this);
diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c
index b2d27d02..1739b44b 100644
--- a/src/enemy/peahat.c
+++ b/src/enemy/peahat.c
@@ -59,14 +59,14 @@ void sub_0801FFDC(Entity* this) {
this->field_0x82.HALF.LO = 0;
this->animationState = PeahatAnimation_SlicedPropeller;
this->action = 5;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->hurtBlinkTime = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x9b) {
this->animationState = PeahatAnimation_BrokenPropeller;
this->action = 5;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->hurtBlinkTime = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
@@ -74,7 +74,7 @@ void sub_0801FFDC(Entity* this) {
if (this->animationState == PeahatAnimation_Flying) {
this->action = 1;
this->actionDelay = 30;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->direction = -1;
this->field_0x82.HALF.HI = 0x78;
GetNextFrame(this);
@@ -154,7 +154,7 @@ void Peahat_Fly(Entity* this) {
this->action = 2;
this->previousActionFlag = Random() & 3;
this->actionDelay = 60;
- this->nonPlanarMovement = 160;
+ this->speed = 160;
}
}
@@ -178,7 +178,7 @@ void Peahat_ChargeStart(Entity* this) {
} else {
this->action = 3;
this->actionDelay = 120;
- this->nonPlanarMovement = 192;
+ this->speed = 192;
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f;
}
} else {
@@ -195,7 +195,7 @@ void Peahat_ChargeTarget(Entity* this) {
}
if (60 < this->actionDelay) {
if (this->actionDelay & 1)
- this->nonPlanarMovement += 4;
+ this->speed += 4;
if ((gScreenTransition.frameCount & 3) == 0)
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
@@ -211,12 +211,12 @@ void Peahat_ChargeEnd(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 1;
this->actionDelay = 1;
- this->nonPlanarMovement = 128;
+ this->speed = 128;
this->field_0x82.HALF.HI = 120;
GetNextFrame(this);
} else {
if (this->actionDelay & 1)
- this->nonPlanarMovement -= 8;
+ this->speed -= 8;
sub_080AEFE0(this);
UpdateAnimationVariableFrames(this, 4);
@@ -331,7 +331,7 @@ void PeahatPropeller_Initialize(Entity* this) {
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
this->spriteSettings.b.shadow = 0;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
this->direction = (Random() & 0x10) + 8;
InitializeAnimation(this, PeahatAnimation_Propeller);
}
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index 8d8e39fa..50826bc9 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -83,7 +83,7 @@ void sub_08023FF0(Entity* this) {
this->flags |= 0x80;
this->damageType = 0x77;
this->actionDelay = 1;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
} else {
gUnk_080CBEF8[this->previousActionFlag](this);
}
@@ -183,7 +183,7 @@ void sub_080241C0(Entity* this) {
if (PlayerInRange(this, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(this, 3) &&
gPlayerEntity.action != 0x1e) {
this->field_0x80.HALF.LO++;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
sub_08024A14(this, 3, 10);
} else if (--this->field_0xf == 0) {
sub_08024A14(this, 0, 0x20);
@@ -222,8 +222,8 @@ void sub_080242A0(Entity* this) {
if (--this->actionDelay == 0) {
this->direction = GetFacingDirection(this, gUnk_020000B0);
sub_08024E00(this, 1);
- if (this->nonPlanarMovement != 0) {
- this->nonPlanarMovement = 0;
+ if (this->speed != 0) {
+ this->speed = 0;
} else {
sub_08024E1C(this);
}
@@ -235,7 +235,7 @@ void sub_080242A0(Entity* this) {
this->action = 4;
this->field_0x80.HALF.LO = 0;
this->actionDelay = 0x10;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
}
}
}
@@ -246,7 +246,7 @@ void sub_0802433C(Entity* this) {
case 0:
if (--this->actionDelay == 0) {
this->field_0x80.HALF.LO++;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->field_0xf = 8;
sub_08024E00(this, 1);
}
@@ -255,7 +255,7 @@ void sub_0802433C(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 5;
this->field_0x80.HALF.LO = 0;
- this->nonPlanarMovement = 0x140;
+ this->speed = 0x140;
this->actionDelay = 0xc0;
this->field_0xf = 8;
} else {
@@ -274,12 +274,12 @@ void sub_080243B8(Entity* this) {
if (this->attachedEntity == NULL || this->attachedEntity->next == NULL) {
this->field_0x80.HALF.LO = 2;
this->actionDelay = 0x20;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->field_0x82.HALF.HI = 0x80;
} else if (sub_08049F1C(this, gUnk_020000B0, 0xe)) {
this->field_0x80.HALF.LO++;
this->actionDelay = 0x1e;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->field_0x82.HALF.HI = 0x80;
this->attachedEntity->action = 2;
} else if (--this->actionDelay) {
@@ -297,14 +297,14 @@ void sub_080243B8(Entity* this) {
if (--this->actionDelay == 0) {
this->field_0x80.HALF.LO++;
this->actionDelay = 0x20;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
}
break;
case 2:
if (--this->actionDelay == 0) {
this->action = 6;
this->field_0x80.HALF.LO = 0;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
sub_08024B38(this);
if ((this->field_0x82.HALF.HI & 0x40) == 0) {
@@ -338,7 +338,7 @@ void sub_080244E8(Entity* this) {
this->field_0x80.HALF.LO += 1;
this->field_0x82.HALF.LO += 1;
this->field_0xf = 0;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
} else {
this->actionDelay = 0x30;
this->field_0xf = 4;
@@ -367,8 +367,8 @@ void sub_080244E8(Entity* this) {
u32 tmp;
if (--this->actionDelay == 0) {
- if (this->nonPlanarMovement) {
- this->nonPlanarMovement = 0;
+ if (this->speed) {
+ this->speed = 0;
} else {
sub_08024E1C(this);
}
@@ -386,7 +386,7 @@ void sub_080244E8(Entity* this) {
this->field_0x80.HALF.LO++;
this->actionDelay = 0xc;
this->direction = 0x10;
- this->nonPlanarMovement = tmp;
+ this->speed = tmp;
this->cutsceneBeh.HALF.LO = 0;
this->flags2 &= 0xfc;
sub_080249DC(this);
@@ -452,7 +452,7 @@ void sub_080244E8(Entity* this) {
if (--this->actionDelay == 0) {
this->field_0x80.HALF.LO++;
this->field_0xf = 0;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->field_0x82.HALF.LO++;
}
break;
@@ -481,7 +481,7 @@ void sub_080244E8(Entity* this) {
this->field_0x80.HALF.LO += 1;
this->actionDelay = 0xc0;
this->field_0xf = 8;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
sub_080249DC(this);
break;
default:
@@ -495,7 +495,7 @@ void sub_080244E8(Entity* this) {
if (this->field_0x82.HALF.HI & 0x80) {
this->field_0x82.HALF.HI = 0xc0;
this->field_0x80.HALF.LO = 0;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
this->actionDelay = 0x40;
this->field_0xf = 8;
sub_08024A14(this, 0, 8);
@@ -510,7 +510,7 @@ void sub_080244E8(Entity* this) {
case 7:
if (gPlayerEntity.height.HALF.HI == 0) {
this->field_0x80.HALF.LO = 0;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
sub_08024B38(this);
}
}
@@ -708,7 +708,7 @@ bool32 sub_08024C48(Entity* this, bool32 unk) {
void sub_08024C7C(Entity* this) {
this->action = 1;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
this->actionDelay = 0;
sub_08024A14(this, 0, 0x20);
}
@@ -718,7 +718,7 @@ void sub_08024C94(Entity* this) {
this->field_0x80.HALF.LO = 0;
this->actionDelay = 0x40;
this->field_0xf = 0;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
this->field_0x82.HALF.HI = 0x80;
sub_08024A14(this, 3, this->field_0xf);
}
@@ -784,7 +784,7 @@ void sub_08024E00(Entity* this, u32 unk) {
}
void sub_08024E1C(Entity* this) {
- this->nonPlanarMovement = gUnk_080CBF18[sub_08024E34()];
+ this->speed = gUnk_080CBF18[sub_08024E34()];
}
u32 sub_08024E34(void) {
@@ -808,7 +808,7 @@ void sub_08024E4C(Entity* this) {
this->field_0x86.HALF.HI = 0;
sub_08024F50(this);
this->field_0x80.HALF.LO = 0;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
this->actionDelay = 0x40;
this->field_0xf = 8;
sub_08024A14(this, 0, 8);
@@ -850,7 +850,7 @@ void sub_08024F50(Entity* this) {
gPlayerEntity.flags |= 0x80;
gPlayerEntity.hurtBlinkTime = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
- gPlayerEntity.nonPlanarMovement = 0;
+ gPlayerEntity.speed = 0;
gPlayerEntity.spritePriority.b1 = this->cutsceneBeh.HALF.HI;
gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY;
gPlayerEntity.spriteOffsetY = 0;
@@ -858,7 +858,7 @@ void sub_08024F50(Entity* this) {
this->field_0x82.HALF.HI = 0xc0;
this->field_0x80.HALF.LO += 2;
this->cutsceneBeh.HALF.LO = 0;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
}
// clang-format off
diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c
index 474f3849..622babaf 100644
--- a/src/enemy/rollobite.c
+++ b/src/enemy/rollobite.c
@@ -103,7 +103,7 @@ void sub_080207A8(Entity* this) {
this->field_0x3a &= 0xfb;
this->direction ^= 0x10;
this->field_0x20 = 0x18000;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
InitializeAnimation(this, this->animationState + 0x10);
}
@@ -196,7 +196,7 @@ void Rollobite_Unroll(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->flags |= 0x80;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->damageType = 34;
sub_08020A30(this);
this->direction = DirectionFromAnimationState(this->animationState);
diff --git a/src/enemy/rope.c b/src/enemy/rope.c
index 44a955b1..d270c688 100644
--- a/src/enemy/rope.c
+++ b/src/enemy/rope.c
@@ -61,7 +61,7 @@ void sub_08031434(Entity* this) {
sub_0804A720(this);
this->animationState = 0xff;
this->field_0x1c = 1;
- this->field_0x7a.HWORD = this->nonPlanarMovement;
+ this->field_0x7a.HWORD = this->speed;
if (!(this->type)) {
sub_08031600(this);
} else {
@@ -113,7 +113,7 @@ void sub_080314FC(Entity* this) {
if (u != 0xff) {
this->action = 3;
this->actionDelay = 0x1e;
- this->field_0x7a.HWORD = this->nonPlanarMovement = 0x1a0;
+ this->field_0x7a.HWORD = this->speed = 0x1a0;
this->direction = u;
this->animationState = this->direction >> 3;
InitializeAnimation(this, this->animationState + 4);
@@ -158,7 +158,7 @@ void sub_08031600(Entity* this) {
u32 r;
this->action = 2;
this->actionDelay = (Random() & 0x30) + 0x3c;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->field_0x7a.HWORD = 0x80;
r = Random() & 0x18;
this->direction = r;
@@ -176,6 +176,6 @@ u32 sub_0803163C(Entity* this) {
} else {
h = this->field_0x7a.HWORD;
}
- this->nonPlanarMovement = h;
+ this->speed = h;
return ProcessMovement(this);
}
diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c
index b36b9635..606e2c9f 100644
--- a/src/enemy/ropeGolden.c
+++ b/src/enemy/ropeGolden.c
@@ -88,7 +88,7 @@ void sub_080383AC(Entity* this) {
u32 v;
this->action = 1;
this->actionDelay = 0x8;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->direction = DirectionRoundUp(GetFacingDirection(this, &gPlayerEntity));
v = this->direction >> 3;
if (v != this->animationState) {
@@ -101,7 +101,7 @@ void sub_080383E4(Entity* this) {
u32 v;
this->action = 2;
this->actionDelay = 0x8;
- this->nonPlanarMovement = 0x280;
+ this->speed = 0x280;
v = DirectionRoundUp(GetFacingDirection(this, &gPlayerEntity));
this->direction = v;
this->field_0x78.HALF.LO = v;
diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c
index 74775cab..64584892 100644
--- a/src/enemy/rupeeLike.c
+++ b/src/enemy/rupeeLike.c
@@ -239,7 +239,7 @@ void sub_080296D8(Entity* this) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO;
gPlayerEntity.spriteOffsetY = 0;
- gPlayerEntity.nonPlanarMovement = 0x140;
+ gPlayerEntity.speed = 0x140;
this->action = 5;
this->field_0xf = 0x3c;
this->flags2 |= 3;
diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c
index d1bfd125..0aae18f1 100644
--- a/src/enemy/sensorBladeTrap.c
+++ b/src/enemy/sensorBladeTrap.c
@@ -35,7 +35,7 @@ void sub_0802BA18(Entity* this) {
return;
this->action = 2;
- this->nonPlanarMovement = this->field_0x78.HWORD;
+ this->speed = this->field_0x78.HWORD;
this->direction = direction;
switch (direction >> 3) {
@@ -87,7 +87,7 @@ void sub_0802BAFC(Entity* this) {
void sub_0802BB10(Entity* this) {
this->action = 3;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
this->direction = this->direction ^ 0x10;
EnqueueSFX(0x74);
}
diff --git a/src/enemy/slime.c b/src/enemy/slime.c
index 2235bcf9..c1b0185b 100644
--- a/src/enemy/slime.c
+++ b/src/enemy/slime.c
@@ -57,7 +57,7 @@ void nullsub_171() {
void sub_08044FC8(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
- this->nonPlanarMovement = 128;
+ this->speed = 128;
sub_0804A720(this);
InitializeAnimation(this, 0);
sub_08044FF8(this);
@@ -74,8 +74,8 @@ void sub_08045018(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 1;
- if (0 < this->nonPlanarMovement) {
- this->actionDelay = sub_0806FA04(4096, this->nonPlanarMovement) >> 8;
+ if (0 < this->speed) {
+ this->actionDelay = sub_0806FA04(4096, this->speed) >> 8;
}
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
this->direction = (sub_08049EE4(this) + 0xfc + (Random() & 8)) & 24;
diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c
index 8eb16b63..810bc731 100644
--- a/src/enemy/smallPesto.c
+++ b/src/enemy/smallPesto.c
@@ -37,7 +37,7 @@ void sub_0803169C(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->flags = this->flags | 0x80;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
this->field_0xf = 1;
} else {
gUnk_080CE554[this->previousActionFlag](this);
diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c
index d15068a6..e76d44a3 100644
--- a/src/enemy/spearMoblin.c
+++ b/src/enemy/spearMoblin.c
@@ -58,7 +58,7 @@ void sub_08028284(Entity* this) {
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
if (this->currentHealth == 0) {
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->field_0x82.HALF.LO = 0;
sub_080287E0(this);
DeleteEntity(this->attachedEntity);
@@ -86,7 +86,7 @@ void sub_08028314(Entity* this) {
if (this->actionDelay) {
this->animationState = this->type2 << 1;
this->actionDelay = 0x1e;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->direction = this->animationState << 2;
sub_080287E0(this);
} else {
@@ -164,13 +164,13 @@ void sub_08028488(Entity* this) {
switch (this->field_0x82.HALF.LO) {
case 3:
this->action = 4;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
this->direction = sub_08049F84(this, 1);
EnqueueSFX(0x11e);
break;
case 2:
this->action = 2;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->actionDelay = (Random() & 7) * 3 + 0x40;
break;
case 4:
@@ -180,7 +180,7 @@ void sub_08028488(Entity* this) {
default:
this->action = 1;
this->field_0x82.HALF.LO = 1;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->actionDelay = (Random() & 7) * 3 + 0x22;
break;
}
@@ -245,7 +245,7 @@ void sub_08028604(Entity* this) {
this->field_0xf = 0;
if (this->field_0x82.HALF.LO == 1) {
this->actionDelay = gUnk_080CC7BC[Random() & 3];
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
if (sub_08049FA0(this) != 0) {
this->direction = gUnk_080CC7D0[Random() & 7] + 0x18 + this->direction & 0x18;
} else {
@@ -262,7 +262,7 @@ void sub_08028604(Entity* this) {
}
} else {
this->actionDelay = 0xc;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
}
if (this->direction >> 2 != this->animationState) {
@@ -324,7 +324,7 @@ void sub_080287B4(Entity* this) {
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
this->field_0x7a.HALF.HI = 0;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->field_0x82.HALF.LO = 0;
sub_080287E0(this);
}
@@ -371,7 +371,7 @@ void sub_08028858(Entity* this) {
this->hitbox->height = box->height;
if (this->field_0x82.HALF.LO == 0) {
- this->nonPlanarMovement = 0;
+ this->speed = 0;
}
ProcessMovement(this);
diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c
index 57d11579..6075879b 100644
--- a/src/enemy/spikedBeetle.c
+++ b/src/enemy/spikedBeetle.c
@@ -50,7 +50,7 @@ void sub_0802B628(Entity* this) {
if (this->action < 6) {
this->action = 6;
this->field_0x20 = 0x18000;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
this->direction = this->field_0x3e;
this->field_0x42 = 0;
this->hurtBlinkTime = -8;
@@ -100,7 +100,7 @@ void sub_0802B7A4(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 1;
this->actionDelay = gUnk_080CD314[Random() & 3];
- this->nonPlanarMovement = 0x60;
+ this->speed = 0x60;
sub_0802B960(this);
if (this->direction != 0xff) {
u32 animation = this->direction >> 3;
@@ -117,7 +117,7 @@ void sub_0802B7FC(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 4;
this->actionDelay = 0x78;
- this->nonPlanarMovement = 0x1c0;
+ this->speed = 0x1c0;
}
}
@@ -167,7 +167,7 @@ void sub_0802B8E0(Entity* this) {
} else {
this->action = 8;
this->field_0x20 = 0x10000;
- this->nonPlanarMovement = 0x60;
+ this->speed = 0x60;
this->damageType = 99;
InitializeAnimation(this, this->animationState);
EnqueueSFX(299);
diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c
index 7a2f50fa..f6960d45 100644
--- a/src/enemy/spinyChuchu.c
+++ b/src/enemy/spinyChuchu.c
@@ -159,7 +159,7 @@ void sub_080226EC(Entity* this) {
if (sub_080228F0(this)) {
this->action = 6;
this->field_0x20 = 0x12000;
- this->nonPlanarMovement = 0x140;
+ this->speed = 0x140;
this->direction = GetFacingDirection(this, gUnk_020000B0);
this->damageType = 0x5a;
InitializeAnimation(this, 4);
@@ -210,7 +210,7 @@ void sub_0802281C(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 2;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
InitializeAnimation(this, 0);
sub_0804AA1C(this);
}
@@ -233,7 +233,7 @@ void sub_0802289C(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 2;
- this->nonPlanarMovement = 0x20;
+ this->speed = 0x20;
this->field_0x80.HALF.HI = 0x78;
InitializeAnimation(this, 0);
}
diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c
index ded83908..e2223166 100644
--- a/src/enemy/vaatiBall.c
+++ b/src/enemy/vaatiBall.c
@@ -153,7 +153,7 @@ void sub_08044868(Entity* this) {
if (this->frames.all & 0x80) {
this->field_0x74.HALF.LO = 1;
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
}
break;
case 1:
@@ -228,7 +228,7 @@ void sub_080449F8(Entity* this) {
if (this->field_0x78.HALF.LO == 0) {
this->field_0x78.HALF.LO++;
- this->nonPlanarMovement = 640;
+ this->speed = 640;
}
this->actionDelay = 4;
@@ -319,7 +319,7 @@ void sub_08044B04(Entity* this) {
this->field_0xf = 32;
}
- this->nonPlanarMovement = this->field_0x78.HALF.LO ? 640 : 1280;
+ this->speed = this->field_0x78.HALF.LO ? 640 : 1280;
}
}
break;
@@ -329,7 +329,7 @@ void sub_08044B04(Entity* this) {
this->direction = (this->direction + 1) & 0x1f;
if (++this->field_0xf == 0x30) {
u32 direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->direction = (direction + 16) & 0x1f;
this->actionDelay = 16;
this->field_0xf = 16;
@@ -341,32 +341,32 @@ void sub_08044B04(Entity* this) {
if (this->field_0xf == 0) {
switch (--this->actionDelay) {
case 12:
- this->nonPlanarMovement = 1280;
+ this->speed = 1280;
break;
case 0:
this->field_0x74.HALF.LO++;
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->actionDelay = 4;
this->field_0xf = 16;
break;
case 4:
- this->nonPlanarMovement = 640;
+ this->speed = 640;
break;
}
} else {
if (--this->field_0xf == 0)
- this->nonPlanarMovement = 640;
+ this->speed = 640;
}
break;
case 3:
if (this->field_0xf) {
if (--this->field_0xf == 0)
- this->nonPlanarMovement = 640;
+ this->speed = 640;
} else {
if (this->actionDelay) {
if (--this->actionDelay == 0) {
- this->nonPlanarMovement = 1280;
+ this->speed = 1280;
SoundReq(0x14f);
}
}
@@ -448,7 +448,7 @@ void sub_08044DEC(Entity* this) {
}
this->flags &= 0x7f;
this->field_0x78.HALF.LO = 0;
- this->nonPlanarMovement = 0x300;
+ this->speed = 0x300;
off = this->parent->field_0x80.HALF.LO - 1;
this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI];
PositionRelative(this->parent, this, 0, -0x100000);
@@ -464,11 +464,11 @@ void sub_08044E74(Entity* this, u32 state) {
this->direction += 0x18;
this->direction &= 0x1f;
PositionRelative(this->parent, this, 0, -0x100000);
- this->nonPlanarMovement = 12288;
+ this->speed = 12288;
sub_0806F69C(this);
this->direction += 0x8;
this->direction &= 0x1f;
- this->nonPlanarMovement = 1280;
+ this->speed = 1280;
sub_0806F69C(this);
break;
case 1:
@@ -497,5 +497,5 @@ void sub_08044E74(Entity* this, u32 state) {
}
this->actionDelay = 1;
this->field_0x78.HALF.LO = 0;
- this->nonPlanarMovement = 1280;
+ this->speed = 1280;
}
diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c
index 7023c024..f6d32479 100644
--- a/src/enemy/wallMaster2.c
+++ b/src/enemy/wallMaster2.c
@@ -83,7 +83,7 @@ void sub_0802CD54(Entity* this) {
this->action = 2;
tmp = Random() >> 0x10;
this->actionDelay = tmp;
- this->nonPlanarMovement = 0xc0;
+ this->speed = 0xc0;
this->field_0x78.HWORD = gUnk_080CD728[Random() & 3];
this->field_0x7a.HALF.HI = (tmp >> 8) & 0x60;
return;
@@ -107,7 +107,7 @@ void sub_0802CDE8(Entity* this) {
} else {
this->action = 1;
this->actionDelay = 60;
- this->nonPlanarMovement = 0x60;
+ this->speed = 0x60;
this->field_0x7c.HALF.LO = (Random() & 0x38) + 0x96;
}
GetNextFrame(this);
diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c
index 017eb2b9..f994b564 100644
--- a/src/enemy/waterDrop.c
+++ b/src/enemy/waterDrop.c
@@ -23,7 +23,7 @@ void sub_0802A250(Entity* this) {
this->action = 1;
this->actionDelay = 0;
this->field_0x20 = -0x30000;
- this->nonPlanarMovement = gUnk_080CD03C[Random() & 3];
+ this->speed = gUnk_080CD03C[Random() & 3];
this->direction = gUnk_080CD040[Random() & 3] + 0x18;
this->collisionLayer = 2;
InitializeAnimation(this, 0);
diff --git a/src/entity.c b/src/entity.c
index cef327b6..67620fb5 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "dma.h"
+#include "script.h"
typedef struct OtherEntity {
struct OtherEntity* prev;
@@ -76,7 +77,6 @@ extern void sub_08078954();
extern void sub_0805EC60();
extern void sub_08017744();
extern void sub_0805E92C();
-extern void UnloadCutsceneData();
extern void UnloadHitbox();
extern void sub_0801DA0C();
extern void sub_0804AA1C();
diff --git a/src/game.c b/src/game.c
index 4ae96174..3db89d90 100644
--- a/src/game.c
+++ b/src/game.c
@@ -259,7 +259,7 @@ void InitializePlayer(void) {
gPlayerState.field_0x34[4] = 0x10;
pl->direction = gScreenTransition.playerState << 2;
case 0x3:
- pl->nonPlanarMovement = 0xe0;
+ pl->speed = 0xe0;
break;
case 0x7:
case 0x8:
diff --git a/src/item11.c b/src/item11.c
index 5365582e..af176c44 100644
--- a/src/item11.c
+++ b/src/item11.c
@@ -31,7 +31,7 @@ void sub_08018CBC(Entity* this) {
*(u32*)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD;
uVar2 = this->animationState = gPlayerEntity.animationState & 0xe;
this->direction = (u8)(uVar2 << 2);
- this->nonPlanarMovement = 0x400;
+ this->speed = 0x400;
this->damageType = 0x96;
this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x80;
this->flags2 = gPlayerEntity.flags2;
diff --git a/src/item14.c b/src/item14.c
index 7ca56f53..d9537b8b 100644
--- a/src/item14.c
+++ b/src/item14.c
@@ -19,7 +19,7 @@ void sub_0805FBE8(Entity* this) {
this->spriteSettings.b.draw = TRUE;
this->field_0x3c = gPlayerEntity.field_0x3c + 1;
this->hitbox = &gUnk_08109AD0;
- this->nonPlanarMovement = 0x380;
+ this->speed = 0x380;
this->animationState = this->animationState & 0x7f;
if (this->collisionLayer == 2) {
this->type2 = 1;
diff --git a/src/npc/anju.c b/src/npc/anju.c
index 3e52d5a0..e21afba1 100644
--- a/src/npc/anju.c
+++ b/src/npc/anju.c
@@ -32,7 +32,6 @@ void Anju(Entity* this) {
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
- default:
}
}
diff --git a/src/npc/beedle.c b/src/npc/beedle.c
index 9e7a5755..3e09302f 100644
--- a/src/npc/beedle.c
+++ b/src/npc/beedle.c
@@ -109,8 +109,8 @@ void sub_08063410(Entity* this) {
if (this->type != 0) {
sub_0806346C(this);
}
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
GetNextFrame(this);
}
@@ -148,17 +148,17 @@ void sub_0806346C(Entity* this) {
}
}
-void sub_080634E4(Entity* this, u32* param_1) {
- param_1[1] = this->type2;
+void sub_080634E4(Entity* this, ScriptExecutionContext* context) {
+ context->intVariable = this->type2;
}
void sub_080634EC(Entity* this) {
gRoomVars.itemForSaleIndex = gUnk_0810C88C[this->type2];
}
-void sub_08063504(Entity* this, u32* param_2) {
+void sub_08063504(Entity* this, ScriptExecutionContext* context) {
u32 uVar1;
uVar1 = sub_080544DC(gUnk_0810C88C[this->type2]);
- param_2[5] = BOOLCAST(uVar1);
+ context->condition = BOOLCAST(uVar1);
}
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index f7251ac0..8ea83e1d 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -23,8 +23,8 @@ void sub_0806CF30(Entity* this) {
sub_0806D0B0(this);
sub_0807DD64(this);
} else {
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
}
switch (this->previousActionFlag) {
diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c
index 4e2e47fb..49a86dfc 100644
--- a/src/npc/bladeBrothers.c
+++ b/src/npc/bladeBrothers.c
@@ -196,53 +196,50 @@ void sub_08068C6C(Entity* this) {
sub_080A7C18(gUnk_0811162B[this->actionDelay] & 0xffffff7f, 0, 0);
}
-void sub_08068C8C(Entity* param_1, Entity* param_2) {
+void sub_08068C8C(Entity* this, ScriptExecutionContext* context) {
u8* arr = gUnk_0811162B + 0xd;
-
- *(u32*)&param_2->animationState = *(u32*)(arr + param_1->actionDelay * 4);
+ context->condition = *(u32*)(arr + this->actionDelay * 4);
}
-void sub_08068CA0(Entity* param_1, Entity* param_2) {
+void sub_08068CA0(Entity* this, ScriptExecutionContext* context) {
u8 bVar1;
u32 uVar2;
- bVar1 = param_1->type;
+ bVar1 = this->type;
if (bVar1 == 1) {
- *(u32*)&param_2->animationState = bVar1;
+ context->condition = bVar1;
uVar2 = GetInventoryValue(0x48); // spin attack
if (uVar2 == 0) {
- *(u32*)&param_2->animationState = 0;
+ context->condition = 0;
}
uVar2 = GetInventoryValue(0x4b); // rock breaker
if (uVar2 == 0) {
- *(u32*)&param_2->animationState = 0;
+ context->condition = 0;
}
uVar2 = GetInventoryValue(0x4a); // dash attack
if (uVar2 == 0) {
- *(u32*)&param_2->animationState = 0;
+ context->condition = 0;
}
uVar2 = GetInventoryValue(0x4e); // down thrust
if (uVar2 != 0) {
return;
}
} else {
- uVar2 = GetInventoryValue(gUnk_0811162B[param_1->actionDelay] & -0x81);
+ uVar2 = GetInventoryValue(gUnk_0811162B[this->actionDelay] & -0x81);
if (uVar2 != 0) {
uVar2 = 1;
}
}
- *(u32*)&param_2->animationState = uVar2;
+ context->condition = uVar2;
}
-void sub_08068CFC(Entity* param_1, Entity* param_2, u32 param_3, u32 param_4)
-
-{
+void sub_08068CFC(Entity* this, ScriptExecutionContext* context) {
u8 bVar1;
u8 itemID;
u32 uVar2;
- *(u32*)&param_2->animationState = 0;
- bVar1 = param_1->actionDelay;
+ context->condition = 0;
+ bVar1 = this->actionDelay;
if (bVar1 > 10)
return;
@@ -303,7 +300,7 @@ LABEL1:
return;
}
switchD_08068d12_caseD_0:
- *(u32*)&param_2->animationState = 1;
+ context->condition = 1;
}
// Introduction dialoague
@@ -355,12 +352,12 @@ void sub_08068EB4(void) {
gPlayerState.field_0xab = 0;
}
-void sub_08068EC4(Entity* param_1, Entity* param_2) {
- if (gUnk_08111740[param_1->actionDelay] == gPlayerState.field_0xab) {
- *(u16*)&param_2->flags = gUnk_0811172A[param_1->actionDelay];
- *(u32*)&param_2->animationState = 1;
+void sub_08068EC4(Entity* this, ScriptExecutionContext* context) {
+ if (gUnk_08111740[this->actionDelay] == gPlayerState.field_0xab) {
+ context->wait = gUnk_0811172A[this->actionDelay];
+ context->condition = 1;
} else {
- *(u32*)&param_2->animationState = 0;
+ context->condition = 0;
}
}
@@ -387,7 +384,6 @@ void sub_08068F3C(Entity* this) {
}
void BladeBrothers_Fusion(Entity* this) {
-
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 0;
diff --git a/src/npc/carlov.c b/src/npc/carlov.c
index 305e48e3..a96b916e 100644
--- a/src/npc/carlov.c
+++ b/src/npc/carlov.c
@@ -8,8 +8,8 @@
#include "npc.h"
#include "structures.h"
#include "functions.h"
+#include "script.h"
-extern void sub_0807DD94(Entity*, u32);
void Carlov(Entity* this) {
if (this->action == 0) {
diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c
index 83ac3bfc..21f8db14 100644
--- a/src/npc/carpenter.c
+++ b/src/npc/carpenter.c
@@ -4,9 +4,9 @@
#include "player.h"
#include "npc.h"
#include "functions.h"
+#include "script.h"
extern SpriteLoadData gUnk_08110CA8[];
-extern void sub_0807DDAC(Entity*, u32);
void Carpenter(Entity* this) {
if (*(u32*)&this->cutsceneBeh == 0) {
@@ -30,8 +30,8 @@ void Carpenter(Entity* this) {
sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->type * 8));
sub_0806F118(this);
} else {
- sub_0807DDAC(this, 0);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, 0);
+ HandleEntity0x82Actions(this);
GetNextFrame(this);
}
break;
@@ -60,6 +60,6 @@ void Carpenter_Head(Entity* this) {
}
}
-void sub_080672b0(Entity* this, u32 param_2) {
- InitializeAnimation(this, *(u32*)(param_2 + 4) + (this->animationState >> 1) + this->type * 8);
+void sub_080672B0(Entity* this, ScriptExecutionContext* context) {
+ InitializeAnimation(this, context->intVariable + (this->animationState >> 1) + this->type * 8);
}
diff --git a/src/npc/cow.c b/src/npc/cow.c
index f942b424..aed9ff0a 100644
--- a/src/npc/cow.c
+++ b/src/npc/cow.c
@@ -20,7 +20,7 @@ void sub_08068FC0(Entity* ent) {
ent->action = 1;
ent->animationState = ent->type2;
- ent->nonPlanarMovement = 0x40;
+ ent->speed = 0x40;
ent->field_0x6c.HALF.HI = 0xFF;
diff --git a/src/npc/dampe.c b/src/npc/dampe.c
index 447fd069..ab2fa586 100644
--- a/src/npc/dampe.c
+++ b/src/npc/dampe.c
@@ -7,19 +7,13 @@
#include "textbox.h"
#include "npc.h"
#include "functions.h"
+#include "script.h"
-extern void sub_0807DD94(Entity*, u32);
extern u16 gUnk_08113344[];
extern u16 gUnk_0811334A[];
-typedef struct {
- u8 filler[18];
- u32 unk;
-} struct_0806BE84;
-
void Dampe(Entity* this) {
-
switch (this->action) {
case 0:
this->action = 1;
@@ -42,7 +36,6 @@ void Dampe(Entity* this) {
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
- default:
}
}
@@ -61,15 +54,15 @@ void Dampe_Fusion(Entity* this) {
}
}
-void sub_0806BE84(Entity* this, struct_0806BE84* r1) {
+void sub_0806BE84(Entity* this, ScriptExecutionContext* context) {
u32 msgIndex;
- r1->unk = 0;
+ context->condition = 0;
msgIndex = 1;
if (!CheckLocalFlag(0x69)) {
msgIndex = 0;
SetLocalFlag(0x69);
- r1->unk = 1;
+ context->condition = 1;
}
// Graveyard key
if (GetInventoryValue(0x3C) >= 2) {
@@ -78,16 +71,16 @@ void sub_0806BE84(Entity* this, struct_0806BE84* r1) {
TextboxNoOverlap(gUnk_08113344[msgIndex], this);
}
-void sub_0806BEC8(Entity* this, struct_0806BE84* r1) {
+void sub_0806BEC8(Entity* this, ScriptExecutionContext* context) {
u32 hasGraveyardKey;
u32 msgIndex;
msgIndex = 0;
- r1->unk = 0;
+ context->condition = 0;
hasGraveyardKey = GetInventoryValue(0x3C);
if (hasGraveyardKey == 1) {
msgIndex = 1;
- r1->unk = 1;
+ context->condition = 1;
} else if (hasGraveyardKey >= 2) {
msgIndex = 2;
}
@@ -102,10 +95,10 @@ void sub_0806BEFC() {
SetTileType(0x181, 0x5CF, 1);
}
-void sub_0806BF44(Entity* this, struct_0806BE84* r1) {
- r1->unk = 0;
+void sub_0806BF44(Entity* this, ScriptExecutionContext* context) {
+ context->condition = 0;
if (((this->x.HALF.HI - gRoomControls.roomScrollX) + 0x10U < 0x110) &&
((this->y.HALF.HI - gRoomControls.roomScrollY) + 0x18U < 0xD0)) {
- r1->unk = 1;
+ context->condition = 1;
}
}
diff --git a/src/npc/emma.c b/src/npc/emma.c
index cee0b683..f7a8577a 100644
--- a/src/npc/emma.c
+++ b/src/npc/emma.c
@@ -1,21 +1,21 @@
#include "global.h"
#include "entity.h"
+#include "script.h"
#include "functions.h"
extern u32 gUnk_0813AD10;
extern u32 gUnk_0813AD24;
extern u32 gUnk_0813AD38;
-extern void sub_0807DD94(Entity*, u32);
extern void DoExitTransition(u32*);
-void Emma(Entity* param_1) {
- if (param_1->action == 0) {
- param_1->action += 1;
- sub_0805E3A0(param_1, 2);
- sub_0807DD50(param_1);
+void Emma(Entity* this) {
+ if (this->action == 0) {
+ this->action += 1;
+ sub_0805E3A0(this, 2);
+ sub_0807DD50(this);
} else {
- sub_0807DD94(param_1, 0);
+ sub_0807DD94(this, 0);
}
}
@@ -27,6 +27,6 @@ void sub_0806C588(void) {
DoExitTransition(&gUnk_0813AD24);
}
-void FUN_0806c598(void) {
+void sub_0806C598(void) {
DoExitTransition(&gUnk_0813AD38);
}
diff --git a/src/npc/ezloCap.c b/src/npc/ezloCap.c
index 715dcf2f..a7b5593e 100644
--- a/src/npc/ezloCap.c
+++ b/src/npc/ezloCap.c
@@ -6,8 +6,8 @@
#include "script.h"
extern Hitbox gUnk_080FD170;
-extern void gUnk_08016030; // Cutscene data type?
-extern void gUnk_0801606C; // Cutscene data type?
+extern void script_08016030; // Cutscene data type?
+extern void script_0801606C; // Cutscene data type?
extern void sub_0809623C(Entity*);
extern void sub_08096260(Entity*);
@@ -34,40 +34,26 @@ void EzloCap(Entity* this) {
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
}
-typedef struct {
- u8 unk_00[4];
- u32 field_04;
- u32 field_08;
- u8 unk_0c[8];
- u32 field_14;
- u8 unk_18;
- u8 field_19;
- u8 unk_1a[3];
- u16 field_1e;
- u8 unk_20[2];
- u16 field_22;
-} paramStruct;
-
-void sub_0806D8A0(Entity* this, paramStruct* param_2) {
+void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) {
s32 xOffset;
s32 yOffset;
- param_2->field_19 = 8;
- param_2->field_08 |= 2;
- param_2->field_14 = 0;
+ context->unk_19 = 8;
+ context->postScriptActions |= 2;
+ context->condition = 0;
xOffset = 16;
if (this->spriteSettings.b.flipX) {
xOffset = -xOffset;
}
xOffset += gPlayerEntity.x.HALF.HI;
yOffset = gPlayerEntity.y.HALF.HI + 2;
- param_2->field_1e = xOffset;
- param_2->field_22 = yOffset;
+ context->x.HALF.HI = xOffset;
+ context->y.HALF.HI = yOffset;
xOffset -= this->x.HALF.HI;
this->direction = sub_080045DA(xOffset, yOffset - this->y.HALF.HI);
@@ -119,15 +105,16 @@ void NPC4E(Entity* this) {
}
}
-void sub_0806DA04(Entity* this, u32* param_2) {
+void sub_0806DA04(Entity* this, ScriptExecutionContext* context) {
// TODO gUnk_0811415C should be a gUnk_0810C89C_struct[], but then a lot of bytes everywhere are wrong?
gUnk_0810C89C_struct* a = (gUnk_0810C89C_struct*)&(
- (gUnk_0810C89C_struct*)gUnk_0811415C)[param_2[1]]; // cast necessary to no longer make it a const* ?
+ (gUnk_0810C89C_struct*)gUnk_0811415C)[context->intVariable]; // cast necessary to no longer make it a const* ?
sub_08078850(this, 1, a->unk_04, a);
}
-void sub_0806DA1C(Entity* this, u32* param_2) {
- sub_0808091C((ScreenTransitionData*)(gUnk_081141A4)[param_2[1]], (u32)(gUnk_081141E4[param_2[1]]));
+void sub_0806DA1C(Entity* this, ScriptExecutionContext* context) {
+ sub_0808091C((ScreenTransitionData*)(gUnk_081141A4)[context->intVariable],
+ (u32)(gUnk_081141E4[context->intVariable]));
}
// Returns the kinstone id?
@@ -168,11 +155,9 @@ u8 sub_0806DA3C(Entity* this) {
}
// Check whether a kinstone fusion is possible and store the result somewhere in param_2?
-void sub_0806DAAC(Entity* this, u32* param_2) {
- u32 uVar1;
- uVar1 = CheckKinstoneFused(sub_0806DA3C(this));
- param_2[5] = uVar1;
- gUnk_02033280.unk_07 |= 1;
+void sub_0806DAAC(Entity* this, ScriptExecutionContext* context) {
+ context->condition = CheckKinstoneFused(sub_0806DA3C(this));
+ gActiveScriptInfo.flags |= 1;
}
// maybe actually execute the kinstone fusion?
@@ -202,29 +187,27 @@ void sub_0806DAE8(Entity* this) {
SoundReq(0xcd);
}
-// Unknown param_2 struct
-void sub_0806DB44(Entity* this, u32* param_2) {
- param_2[5] = 0;
+void sub_0806DB44(Entity* this, ScriptExecutionContext* context) {
+ context->condition = 0;
if (CheckLocalFlag(0xee) != 0 && CheckLocalFlag(0xef) != 0 && CheckLocalFlag(0xf0) != 0 &&
CheckLocalFlag(0xf1) != 0 && CheckLocalFlag(0xf2) != 0) {
- param_2[5] = 1;
+ context->condition = 1;
}
}
-// The unused param just had to be added, so that a mov r1, #0 in NPC4E_Fusion is matching correctly
-void sub_0806DB84(Entity* this, u8 unused) {
+void sub_0806DB84(Entity* this, ScriptExecutionContext* context) {
Entity* ent;
this->hitbox = (Hitbox*)&gUnk_08114154;
ent = CreateObject(0x3e, 4, 0);
if (ent != NULL) {
PositionRelative(this, ent, -0x80000, 0);
- *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &gUnk_08016030);
+ *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_08016030);
}
ent = CreateObject(0x3e, 5, 0);
if (ent != NULL) {
PositionRelative(this, ent, 0x80000, 0);
- *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &gUnk_0801606C);
+ *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_0801606C);
}
}
diff --git a/src/npc/festari.c b/src/npc/festari.c
index 2cbe44c6..e7bb336d 100644
--- a/src/npc/festari.c
+++ b/src/npc/festari.c
@@ -34,7 +34,7 @@ void sub_0805FE48(Entity* this) {
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
} else {
- ExecuteScriptCommandSet(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
+ ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
sub_0805FF2C(this, *(void**)&this->cutsceneBeh);
uVar4 = this->field_0x80.HWORD;
if (uVar4 < 8) {
diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c
index 73044b47..0f997c34 100644
--- a/src/npc/forestMinish.c
+++ b/src/npc/forestMinish.c
@@ -42,8 +42,8 @@ void ForestMinish(Entity* this) {
this->interactType = 0;
sub_0806F118(this);
} else {
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
if (this->frameDuration != 0xf0) {
sub_080600F0(this);
}
@@ -215,8 +215,8 @@ void sub_080602BC(Entity* this) {
TextboxNoOverlap(gUnk_0810A362[index], this);
}
-void sub_0806030C(Entity* this, u32* arg1) {
- ModBombs(*(arg1 + 1));
+void sub_0806030C(Entity* this, ScriptExecutionContext* context) {
+ ModBombs(context->intVariable);
}
void sub_08060318(void) {
diff --git a/src/npc/goron.c b/src/npc/goron.c
index 0203969c..46a6e940 100644
--- a/src/npc/goron.c
+++ b/src/npc/goron.c
@@ -97,9 +97,9 @@ u32 sub_08069480(Entity* this) {
return (sub_0801E99C(this) << 24) >> 24;
}
-void sub_0806948C(Entity* this, u32* param_1) {
- param_1[5] = CheckKinstoneFused((sub_08069480(this) << 24) >> 24);
- gUnk_02033280.unk_07 |= 1;
+void sub_0806948C(Entity* this, ScriptExecutionContext* context) {
+ context->condition = CheckKinstoneFused((sub_08069480(this) << 24) >> 24);
+ gActiveScriptInfo.flags |= 1;
}
void sub_080694B0(Entity* this) {
diff --git a/src/npc/guard.c b/src/npc/guard.c
index 052fa98f..d94827c4 100644
--- a/src/npc/guard.c
+++ b/src/npc/guard.c
@@ -4,6 +4,7 @@
#include "flags.h"
#include "textbox.h"
#include "room.h"
+#include "script.h"
#include "structures.h"
#include "functions.h"
@@ -20,7 +21,6 @@ typedef struct {
extern void sub_08063D24(Entity*);
extern void sub_0806EE20(Entity*);
extern void sub_08064428(Entity*);
-extern void sub_0807DDAC(Entity*, u32);
extern void sub_0806EE04(Entity*, void*, u32);
void sub_08063DC8(Entity*);
void sub_08063F20(Entity*);
@@ -148,8 +148,8 @@ void sub_08063E90(Entity* this) {
}
void sub_08063F20(Entity* this) {
- sub_0807DDAC(this, 0);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, 0);
+ HandleEntity0x82Actions(this);
GetNextFrame(this);
if (this->interactType != 0) {
this->action++;
@@ -211,18 +211,16 @@ void sub_08064044(void) {
gScreenTransition.transitioningOut = 1;
}
-void sub_08064050(Entity* arg0, struct_08064050* arg1) {
- u32 unk;
-
- arg1->unk2 = 0;
- switch (arg0->type2) {
+void sub_08064050(Entity* this, ScriptExecutionContext* context) {
+ context->intVariable = 0;
+ switch (this->type2) {
case 0x11:
- arg1->unk2 = 1;
+ context->intVariable = 1;
break;
case 0x12:
- arg1->unk2 = 2;
+ context->intVariable = 2;
break;
case 0x13:
- arg1->unk2 = 3;
+ context->intVariable = 3;
}
}
diff --git a/src/npc/librari.c b/src/npc/librari.c
index 9db202b7..ce6fbefc 100644
--- a/src/npc/librari.c
+++ b/src/npc/librari.c
@@ -25,8 +25,8 @@ void Librari(Entity* this) {
this->interactType = 0;
sub_0806F118(this);
} else {
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
}
break;
@@ -37,15 +37,15 @@ void Librari(Entity* this) {
}
}
-void sub_0806B260(Entity* this, u32 arg1) {
+void sub_0806B260(Entity* this, ScriptExecutionContext* context) {
u32 index;
- *(u32*)(arg1 + 0x14) = 0;
+ context->condition = 0;
// flippers
if (!GetInventoryValue(0x46)) {
if (CheckGlobalFlag(0x29)) {
index = 2;
- *(u32*)(arg1 + 0x14) = 1;
+ context->condition = 1;
} else if (!CheckLocalFlag(0x7a)) {
index = 0;
SetLocalFlag(0x7a);
@@ -60,7 +60,7 @@ void sub_0806B260(Entity* this, u32 arg1) {
extern u16 gUnk_08112D50[];
-void sub_0806b2b4(Entity* this) {
+void sub_0806B2B4(Entity* this) {
u32 index;
if (CheckLocalFlag(0xb3)) {
diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c
index 0af6cdf9..1f5d36af 100644
--- a/src/npc/mayorHagen.c
+++ b/src/npc/mayorHagen.c
@@ -35,8 +35,8 @@ void MayorHagen(Entity* this) {
sub_0806F118(this);
break;
}
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
break;
case 2:
diff --git a/src/npc/melari.c b/src/npc/melari.c
index 8e9077e3..a62b837b 100644
--- a/src/npc/melari.c
+++ b/src/npc/melari.c
@@ -72,8 +72,8 @@ void sub_08068780(Entity* this) {
this->interactType = 0;
sub_0806F118(this);
} else {
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
GetNextFrame(this);
}
break;
diff --git a/src/npc/postman.c b/src/npc/postman.c
index 6331461f..34694306 100644
--- a/src/npc/postman.c
+++ b/src/npc/postman.c
@@ -40,7 +40,7 @@ void sub_08060428(Entity* this) {
void* data;
this->actionDelay = 0x5a;
- this->nonPlanarMovement = 0x180;
+ this->speed = 0x180;
if (this->type2 != 0) {
data = GetCurrentRoomProperty(this->type2);
} else {
@@ -195,7 +195,7 @@ void sub_08060700(Entity* entity, ScriptExecutionContext* context) {
u32 x = coords->x + gRoomControls.roomOriginX;
u32 y = coords->y + gRoomControls.roomOriginY;
sub_0807DEDC(entity, context, x, y);
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.flags |= 1;
}
void sub_0806075C(Entity* this) {
diff --git a/src/npc/rem.c b/src/npc/rem.c
index a2ba4598..a6059865 100644
--- a/src/npc/rem.c
+++ b/src/npc/rem.c
@@ -8,7 +8,7 @@ extern void sub_0806A8C8(Entity*);
extern void (*gUnk_08112260[])(Entity*);
extern void (*gUnk_08112278[])(Entity*);
-extern void gUnk_08012F0C;
+extern void script_08012F0C;
void Rem(Entity* this) {
gUnk_08112260[this->type](this);
@@ -18,8 +18,8 @@ void sub_0806a370(Entity* this) {
u8* pbVar1;
gUnk_08112278[this->action](this);
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
sub_0806ED78(this);
if (this->animIndex == 0xf) {
@@ -42,7 +42,7 @@ void sub_0806A3D8(Entity* this) {
this->actionDelay = 0xb4;
sub_0805E3A0(this, 2);
sub_0806A8C8(this);
- uVar1 = StartCutscene(this, &gUnk_08012F0C);
+ uVar1 = StartCutscene(this, &script_08012F0C);
*(ScriptExecutionContext**)&this->cutsceneBeh = uVar1;
sub_0807DD94(this, NULL);
}
diff --git a/src/npc/simon.c b/src/npc/simon.c
index bfcb19af..f1a683ed 100644
--- a/src/npc/simon.c
+++ b/src/npc/simon.c
@@ -41,8 +41,8 @@ void sub_0806C280(void) {
gScreenTransition.transitionType = 6;
}
-void sub_0806C2A0(u32* param_1, struct_0806C2A0* param_2) {
- switch (param_2->unk) {
+void sub_0806C2A0(Entity* this, ScriptExecutionContext* context) {
+ switch (context->intVariable) {
case 0:
DoFade(0xd, 4);
break;
diff --git a/src/npc/smith.c b/src/npc/smith.c
index c7e4b1e8..477e7383 100644
--- a/src/npc/smith.c
+++ b/src/npc/smith.c
@@ -125,8 +125,8 @@ void sub_080661BC(Entity* this) {
}
void sub_08066200(Entity* this) {
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
UpdateAnimationSingleFrame(this);
}
@@ -154,12 +154,12 @@ void sub_08066258(void) {
SoundReq(gUnk_081103D0[Random() & 7]);
}
-void sub_08066274(u32 arg0) {
- sub_08078850(arg0, 1, 0, &gUnk_081103E0);
+void sub_08066274(Entity* this) {
+ sub_08078850(this, 1, 0, &gUnk_081103E0);
}
-void sub_08066288(Entity* arg0) {
- sub_08078784(arg0, arg0->field_0x68.HALF.LO);
+void sub_08066288(Entity* this) {
+ sub_08078784(this, this->field_0x68.HALF.LO);
}
void Smith_Fusion(Entity* this) {
diff --git a/src/npc/stamp.c b/src/npc/stamp.c
index 92deb07b..51b209b3 100644
--- a/src/npc/stamp.c
+++ b/src/npc/stamp.c
@@ -62,15 +62,13 @@ void sub_08062C7C(Entity* ent) {
}
void sub_08062CA4(Entity* ent) {
- sub_0807DDAC(ent, NULL);
- sub_0807DDE4(ent);
+ ExecuteScriptForEntity(ent, NULL);
+ HandleEntity0x82Actions(ent);
GetNextFrame(ent);
}
void sub_08062CBC(Entity* ent) {
- u32 uVar1;
-
- uVar1 = CheckKinstoneFused(44);
+ u32 uVar1 = CheckKinstoneFused(44);
ShowNPCDialogue(ent, &gUnk_0810C2E4[(-uVar1 | uVar1) >> 31]);
}
diff --git a/src/npc/syrup.c b/src/npc/syrup.c
index 54e28b30..f3a1b5dc 100644
--- a/src/npc/syrup.c
+++ b/src/npc/syrup.c
@@ -52,8 +52,8 @@ void sub_0806A26C(Entity* this) {
if (uVar2 = Random(), uVar2) {
unk = -unk; // wtf?!
}
- pEVar1->spriteOffsetX = gUnk_081121DC[uVar2 & 7];
- pEVar1->spriteOffsetY = gUnk_081121DC[(uVar2 / 256) & 7] - 8;
+ pEVar1->spriteOffsetX = gUnk_081121D4[uVar2 & 7];
+ pEVar1->spriteOffsetY = gUnk_081121D4[(uVar2 / 256) & 7] - 8;
}
}
#else
diff --git a/src/npc/talon.c b/src/npc/talon.c
index d7d6f857..f9c7d66f 100644
--- a/src/npc/talon.c
+++ b/src/npc/talon.c
@@ -10,7 +10,7 @@
extern void (*gUnk_0810FEC4[])(Entity* this);
extern void (*gUnk_0810FEBC[])(Entity* this);
extern SpriteLoadData gUnk_0810FEB0;
-extern u8 gUnk_0800B41C;
+extern u8 script_0800B41C;
extern u8 gUnk_0810FED8[];
void sub_0806574C(Entity* this);
@@ -109,7 +109,7 @@ void sub_080656D4(Entity* this) {
} else {
if (this->interactType != 0) {
if (GetInventoryValue(0x37) != 0) { // keyLonLon
- StartCutscene(this, (u16*)&gUnk_0800B41C);
+ StartCutscene(this, (u16*)&script_0800B41C);
goto label2;
} else {
this->field_0x68.HALF.HI = this->action;
@@ -136,12 +136,12 @@ void sub_0806574C(Entity* this) {
this->field_0x6a.HALF.LO = this->animIndex;
}
-void sub_08065780(Entity* this, u16* param_2) {
+void sub_08065780(Entity* this, ScriptExecutionContext* context) {
u32 rand;
rand = Random();
this->animationState = rand & 6;
- param_2[8] = gUnk_0810FED8[rand >> 8 & 7];
+ context->wait = gUnk_0810FED8[rand >> 8 & 7];
}
void Talon_Head(Entity* this) {
diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c
index bcc3c6fc..df2d8fe3 100644
--- a/src/npc/townMinish.c
+++ b/src/npc/townMinish.c
@@ -11,7 +11,7 @@ extern u32 sub_080002C0();
extern void sub_0806ACC4(Entity*);
extern void sub_0806AEA8();
extern void sub_0806AEE4(Entity*);
-extern void sub_0806AFE8(Entity*, s32*);
+extern void sub_0806AFE8(Entity*, ScriptExecutionContext*);
extern s32 sub_0806EDD8(Entity*, u32, u32);
extern void sub_08078850(Entity*, u32, u32, u32*);
@@ -21,7 +21,7 @@ extern u32 gUnk_081126D4[4];
extern u8 gUnk_081126E4[4];
extern void (*gUnk_081126E8[])();
extern Dialog gUnk_081126F0[0x10];
-extern void (*gUnk_08112BF0[])(Entity*, s32*);
+extern void (*gUnk_08112BF0[])(Entity*, ScriptExecutionContext*);
extern u16 gUnk_08112C40[5];
extern u16 gUnk_08112C4A[3];
extern u16 gUnk_08112C50[6];
@@ -107,13 +107,13 @@ void sub_0806ACC4(Entity* this) {
this->interactType = 0;
sub_0806F118(this);
} else {
- sub_0807DDAC(this, NULL);
+ ExecuteScriptForEntity(this, NULL);
sub_0806AEA8(this);
if (this->type2 == 10 && this->interactType) {
this->action = 2;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8);
- sub_0806AFE8(this, *(s32**)&this->cutsceneBeh);
+ sub_0806AFE8(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
}
if (this->type == 1) {
u8 idx = gPlayerEntity.animationState >> 1;
@@ -177,7 +177,7 @@ void sub_0806AEA8(Entity* this) {
if (old & 0x20) {
sub_08003FC4(this, 0x4000);
}
- sub_0807DDE4(this);
+ HandleEntity0x82Actions(this);
this->field_0x82.HWORD = old;
}
@@ -218,25 +218,25 @@ void sub_0806AEE4(Entity* this) {
}
}
-void sub_0806AF60(Entity* this, int* idx) {
- InitializeAnimation(this, idx[1] + (this->animationState / 2));
+void sub_0806AF60(Entity* this, ScriptExecutionContext* context) {
+ InitializeAnimation(this, context->intVariable + (this->animationState / 2));
}
-void sub_0806AF70(Entity* this, u32 arg1) {
+void sub_0806AF70(Entity* this, ScriptExecutionContext* context) {
this->field_0x20 = 0x24000;
}
-void sub_0806AF78(Entity* this, u32 arg1) {
+void sub_0806AF78(Entity* this, ScriptExecutionContext* context) {
sub_08003FC4(this, 0x1800);
if (0 <= this->height.WORD && this->field_0x20 < 1) {
this->height.WORD = 0;
- sub_0806AF70(this, arg1);
+ sub_0806AF70(this, context);
}
}
void sub_0806AFA0(Entity* this) {
if (sub_0806ED78(this)) {
- sub_0806F62C(this, -this->nonPlanarMovement, this->direction);
+ sub_0806F62C(this, -this->speed, this->direction);
}
}
@@ -248,12 +248,12 @@ void sub_0806AFBC(Entity* this) {
ShowNPCDialogue(this, gUnk_081126F0 + this->type2 * 8 + idx);
}
-void sub_0806AFE8(Entity* this, s32* unk) {
- unk[5] = 0;
- gUnk_08112BF0[this->type2](this, unk);
+void sub_0806AFE8(Entity* this, ScriptExecutionContext* context) {
+ context->condition = 0;
+ gUnk_08112BF0[this->type2](this, context);
}
-void sub_0806B004(Entity* this, int* unk) {
+void sub_0806B004(Entity* this, ScriptExecutionContext* context) {
int idx = 0;
if (CheckGlobalFlag(0x29)) {
@@ -262,7 +262,7 @@ void sub_0806B004(Entity* this, int* unk) {
idx = 3;
if (CheckLocalFlag(0x78) == 0) {
idx = 2;
- unk[5] = 1;
+ context->condition = 1;
SetLocalFlag(0x78);
}
} else {
diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c
index fcea0ff4..fc99bac6 100644
--- a/src/npc/townsperson.c
+++ b/src/npc/townsperson.c
@@ -17,11 +17,6 @@ typedef struct {
u8 unk3;
} struct_0810B680;
-typedef struct {
- u32 unk;
- u32 unk2;
-} struct_08061FB8;
-
extern void (*const gUnk_0810B774[])(Entity*);
extern void (*const gUnk_0810B77C[])(Entity*);
extern void sub_08061CB4(Entity*, u32);
@@ -133,8 +128,8 @@ void sub_08061D64(Entity* this) {
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
if (this->frameDuration == 0xff) {
this->frameDuration = gUnk_0810B680[this->type].unk2;
}
@@ -173,6 +168,7 @@ void sub_08061E70(Entity* this) {
}
}
+// FIXME this is actually (Entity* this, ScriptExecutionContext* context)
void sub_08061E90(Entity* this, Entity* arg1) {
u32 animIndex;
s32 iVar4;
@@ -204,7 +200,7 @@ void sub_08061E90(Entity* this, Entity* arg1) {
}
this->direction = (u8)animIndex;
this->animationState = sub_0806F5B0(animIndex);
- this->nonPlanarMovement = gUnk_0810B74A[this->type];
+ this->speed = gUnk_0810B74A[this->type];
}
animIndex = (this->animationState >> 1) + 4;
if (animIndex != this->animIndex) {
@@ -231,7 +227,7 @@ void sub_08061E90(Entity* this, Entity* arg1) {
arg1->spriteIndex = 1;
}
if (--arg1->spriteIndex != 0) {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
@@ -248,10 +244,10 @@ void sub_08061FB0(Entity* this) {
this->hitbox = NULL;
}
-void sub_08061FB8(Entity* this, struct_08061FB8* arg1) {
+void sub_08061FB8(Entity* this, ScriptExecutionContext* context) {
u8* temp = gUnk_0810B748;
- sub_08078850(this, 1, temp[arg1->unk2], &gUnk_0810B740[arg1->unk2]);
+ sub_08078850(this, 1, temp[context->intVariable], &gUnk_0810B740[context->intVariable]);
}
void sub_08061FD8(Entity* this) {
diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c
index 312e09de..65968f30 100644
--- a/src/npc/windTribespeople.c
+++ b/src/npc/windTribespeople.c
@@ -9,13 +9,12 @@
#include "script.h"
extern void sub_0806C7D4(Entity*);
-extern void sub_0807DD80(Entity*, u32*);
extern void (*const gUnk_08113A7C[])(Entity*);
-extern void (*const gUnk_08113A8C[])(Entity*, Entity*);
+extern void (*const gUnk_08113A8C[])(Entity*, ScriptExecutionContext*);
extern SpriteLoadData gUnk_08113A1C[];
-extern u32 gUnk_08014A80;
+extern u16 script_08014A80;
extern Dialog gUnk_08113ABC[];
extern u16 gUnk_08113B0C[];
@@ -48,7 +47,7 @@ void sub_0806C7D4(Entity* this) {
sub_0807DD94(this, NULL);
if ((this->type2 == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(0x63)) && (CheckRoomFlag(0))) {
this->type2 = 7;
- sub_0807DD80(this, &gUnk_08014A80);
+ sub_0807DD80(this, &script_08014A80);
}
}
}
@@ -102,10 +101,9 @@ void WindTribespeople_Head(Entity* this) {
}
}
-// body and head entities?
-void sub_0806C90C(Entity* param_1, Entity* param_2) {
- *(u32*)&param_2->animationState = 0;
- gUnk_08113A8C[param_1->type2](param_1, param_2);
+void sub_0806C90C(Entity* this, ScriptExecutionContext* context) {
+ context->condition = 0;
+ gUnk_08113A8C[this->type2](this, context);
}
void sub_0806C928(Entity* this) {
diff --git a/src/npc/zelda.c b/src/npc/zelda.c
index 4704b5bb..88fb53c3 100644
--- a/src/npc/zelda.c
+++ b/src/npc/zelda.c
@@ -14,59 +14,59 @@ extern void sub_080686C4(Entity*, Entity*);
extern void (*gUnk_08110BD8[])(Entity* ent);
extern u16 gUnk_08110BE0[];
-void Zelda(Entity* ent) {
- gUnk_08110BD8[ent->action](ent);
+void Zelda(Entity* this) {
+ gUnk_08110BD8[this->action](this);
}
-void sub_08066CCC(Entity* ent) {
- ent->action = 1;
- ent->spriteSettings.b.draw = 1;
- PrependEntityToList(ent, 7);
- sub_0805E3A0(ent, 2);
- sub_0807DD50(ent);
+void sub_08066CCC(Entity* this) {
+ this->action = 1;
+ this->spriteSettings.b.draw = 1;
+ PrependEntityToList(this, 7);
+ sub_0805E3A0(this, 2);
+ sub_0807DD50(this);
}
-void sub_08066CF8(Entity* ent) {
- sub_0807DD94(ent, NULL);
+void sub_08066CF8(Entity* this) {
+ sub_0807DD94(this, NULL);
}
-void sub_08066D04(Entity* ent) {
- ent->parent = FindEntityBySubtype(7, 0x2E);
+void sub_08066D04(Entity* this) {
+ this->parent = FindEntityBySubtype(7, 0x2E);
}
-void sub_08066D14(Entity* ent, u32* param_2) {
+void sub_08066D14(Entity* this, ScriptExecutionContext* context) {
Entity* parent;
- parent = ent->parent;
+ parent = this->parent;
if (parent != NULL) {
- ent->animationState = parent->animationState;
- ent->spriteSettings.b.draw = 1;
- CopyPosition(parent, ent);
- sub_08068680(ent, ent->parent);
- param_2[5] = 1;
+ this->animationState = parent->animationState;
+ this->spriteSettings.b.draw = 1;
+ CopyPosition(parent, this);
+ sub_08068680(this, this->parent);
+ context->condition = 1;
} else {
- param_2[5] = 0;
+ context->condition = 0;
}
}
-void sub_08066D4C(Entity* ent, u32* param_2) {
+void sub_08066D4C(Entity* this, ScriptExecutionContext* context) {
Entity* parent;
- parent = ent->parent;
- if (ent->parent != NULL) {
- CopyPosition(ent, parent);
- ent->parent->spriteSettings.b.draw = 1;
- ent->parent->animationState = ent->animationState;
- ent->spriteSettings.b.draw = 0;
- ent->field_0x17 &= 0xFE;
- sub_08068694(ent, ent->parent);
- param_2[5] = 1;
+ parent = this->parent;
+ if (this->parent != NULL) {
+ CopyPosition(this, parent);
+ this->parent->spriteSettings.b.draw = 1;
+ this->parent->animationState = this->animationState;
+ this->spriteSettings.b.draw = 0;
+ this->field_0x17 &= 0xFE;
+ sub_08068694(this, this->parent);
+ context->condition = 1;
} else {
- param_2[5] = 0;
+ context->condition = 0;
}
}
-void sub_08066D94(Entity* ent) {
+void sub_08066D94(Entity* this) {
u32 roomID;
Entity* npc;
@@ -75,91 +75,91 @@ void sub_08066D94(Entity* ent) {
if (npc != NULL) {
npc->animationState = gPlayerEntity.animationState;
npc->flags |= 0x20;
- npc->animationState = GetAnimationState(ent);
+ npc->animationState = GetAnimationState(this);
roomID = gRoomControls.roomID;
npc->field_0x74.HWORD = roomID;
- CopyPosition(ent, npc);
+ CopyPosition(this, npc);
}
DeleteThisEntity();
}
-void sub_08066DE4(Entity* ent) {
+void sub_08066DE4(Entity* this) {
Entity* pEVar1;
pEVar1 = FindEntityBySubtype(7, 0x2E);
if (pEVar1 != NULL) {
- CopyPosition(ent, pEVar1);
- sub_080686C4(ent, pEVar1);
+ CopyPosition(this, pEVar1);
+ sub_080686C4(this, pEVar1);
}
}
-void sub_08066E08(Entity* ent) {
- InitAnimationForceUpdate(ent, 0x50);
- ent->field_0x80.HWORD = ent->animIndex;
+void sub_08066E08(Entity* this) {
+ InitAnimationForceUpdate(this, 0x50);
+ this->field_0x80.HWORD = this->animIndex;
}
-void sub_08066E20(Entity* ent) {
- InitAnimationForceUpdate(ent, 0x44);
- ent->field_0x80.HWORD = ent->animIndex;
+void sub_08066E20(Entity* this) {
+ InitAnimationForceUpdate(this, 0x44);
+ this->field_0x80.HWORD = this->animIndex;
}
-void sub_08066E38(Entity* ent) {
- InitAnimationForceUpdate(ent, 0x48);
- ent->field_0x80.HWORD = ent->animIndex;
+void sub_08066E38(Entity* this) {
+ InitAnimationForceUpdate(this, 0x48);
+ this->field_0x80.HWORD = this->animIndex;
}
-void sub_08066E50(Entity* ent) {
- InitAnimationForceUpdate(ent, 0x4C);
- ent->field_0x80.HWORD = ent->animIndex;
+void sub_08066E50(Entity* this) {
+ InitAnimationForceUpdate(this, 0x4C);
+ this->field_0x80.HWORD = this->animIndex;
}
-void sub_08066E68(Entity* ent) {
- InitAnimationForceUpdate(ent, 0x54);
- ent->field_0x80.HWORD = ent->animIndex;
+void sub_08066E68(Entity* this) {
+ InitAnimationForceUpdate(this, 0x54);
+ this->field_0x80.HWORD = this->animIndex;
}
-void sub_08066E80(Entity* ent, u8* param_2) {
- switch (param_2[0x18]) {
+void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
+ switch (context->unk_18) {
case 0:
- param_2[0x18]++;
- InitAnimationForceUpdate(ent, 0x16);
+ context->unk_18++;
+ InitAnimationForceUpdate(this, 0x16);
break;
case 1:
- UpdateAnimationSingleFrame(ent);
- if (ent->frames.all & 1) {
- param_2[0x18]++;
- ent->field_0x20 = 0x20000;
- ent->frames.all &= 0xFE;
+ UpdateAnimationSingleFrame(this);
+ if (this->frames.all & 1) {
+ context->unk_18++;
+ this->field_0x20 = 0x20000;
+ this->frames.all &= 0xFE;
SoundReq(0x7C);
}
break;
case 2:
- sub_0806F62C(ent, 0x100, 0x80);
- sub_08003FC4(ent, 0x2000);
- if (!(ent->frames.all & 1)) {
- UpdateAnimationSingleFrame(ent);
+ sub_0806F62C(this, 0x100, 0x80);
+ sub_08003FC4(this, 0x2000);
+ if (!(this->frames.all & 1)) {
+ UpdateAnimationSingleFrame(this);
}
- if (ent->field_0x20 < 0) {
- param_2[0x18]++;
+ if (this->field_0x20 < 0) {
+ context->unk_18++;
}
break;
case 3:
- sub_0806F62C(ent, 0x100, 0x80);
- UpdateAnimationSingleFrame(ent);
- if (sub_08003FC4(ent, 0x2000) == 0) {
- param_2[0x18]++;
- InitAnimationForceUpdate(ent, 0x1E);
+ sub_0806F62C(this, 0x100, 0x80);
+ UpdateAnimationSingleFrame(this);
+ if (sub_08003FC4(this, 0x2000) == 0) {
+ context->unk_18++;
+ InitAnimationForceUpdate(this, 0x1E);
}
break;
case 4:
- UpdateAnimationSingleFrame(ent);
- if (ent->frames.b.f3) {
- gUnk_02033280.unk_07 |= 1;
+ UpdateAnimationSingleFrame(this);
+ if (this->frames.b.f3) {
+ gActiveScriptInfo.flags |= 1;
return;
}
}
- ent->field_0x80.HWORD = ent->animIndex;
- gUnk_02033280.unk_06 = 0;
+ this->field_0x80.HWORD = this->animIndex;
+ gActiveScriptInfo.commandSize = 0;
}
void sub_08066F94(void) {
diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c
index 1ee11b67..e4c9268d 100644
--- a/src/object/backgroundCloud.c
+++ b/src/object/backgroundCloud.c
@@ -19,7 +19,7 @@ void sub_0808F658(Entity* this) {
this->spritePriority.b0 = this->type;
this->frameIndex = this->type;
this->direction = 8;
- this->nonPlanarMovement = gUnk_08121EB0[this->type];
+ this->speed = gUnk_08121EB0[this->type];
this->field_0x78.HWORD = gRoomControls.roomOriginX - 0x60;
this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.width + 0x60;
this->animationState = 0;
diff --git a/src/object/bird.c b/src/object/bird.c
index 9d21f708..749fdf3d 100644
--- a/src/object/bird.c
+++ b/src/object/bird.c
@@ -29,7 +29,7 @@ void sub_0809CF54(Entity* this) {
this->field_0x20 = -0x18000;
this->height.WORD = -0x38C000;
this->field_0x68.HWORD = -0x800;
- this->nonPlanarMovement = 0x280;
+ this->speed = 0x280;
this->direction = 8;
this->collisionLayer = 2;
this->x.HALF.HI = gRoomControls.roomScrollX;
diff --git a/src/object/cloud.c b/src/object/cloud.c
index 674c1d73..45616754 100644
--- a/src/object/cloud.c
+++ b/src/object/cloud.c
@@ -168,7 +168,7 @@ void sub_0809F7BC(Entity* this) {
cloud = sub_0809F770(this);
if (cloud != NULL) {
uVar1 = Random();
- cloud->nonPlanarMovement = gUnk_081247C8[uVar1 & 3];
+ cloud->speed = gUnk_081247C8[uVar1 & 3];
cloud->direction = (u8)(uVar1 >> 8) & 31;
}
}
diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c
index 4424032d..97cbfd5e 100644
--- a/src/object/fileScreenObjects.c
+++ b/src/object/fileScreenObjects.c
@@ -504,7 +504,7 @@ static u32 sub_0808EF6C(Entity* this) {
if (this->field_0x6c.HWORD < var7) {
var7 = this->field_0x6c.HWORD;
}
- this->nonPlanarMovement = var7;
+ this->speed = var7;
this->direction = sub_080045DA(var0, var2) >> 3;
sub_0806F69C(this);
return 1;
@@ -515,7 +515,7 @@ static void sub_0808EFF0(Entity* this) {
u8 var1;
this->spriteSettings.b.draw = 2;
- this->nonPlanarMovement = 0x400;
+ this->speed = 0x400;
this->currentHealth = 1;
this->frameIndex = 0xFF;
this->animIndex = 0xFF;
diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c
index 886fdf43..3ad4a0bd 100644
--- a/src/object/greatFairy.c
+++ b/src/object/greatFairy.c
@@ -6,6 +6,7 @@
#include "flags.h"
#include "save.h"
#include "random.h"
+#include "script.h"
#include "structures.h"
#include "functions.h"
@@ -160,21 +161,21 @@ void GreatFairy_WingsInit(Entity* this) {
this->spriteRendering.alphaBlend = 1;
gScreen.controls.layerFXControl = 0xF40;
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 8);
- this->nonPlanarMovement = 1024;
+ this->speed = 1024;
sub_0805EC9C(this, 1024, 256, 0);
}
void GreatFairy_WingsUpdate(Entity* this) {
s32 iVar1;
- iVar1 = this->nonPlanarMovement -= 32;
+ iVar1 = this->speed -= 32;
if (iVar1 * 65536 >> 16 == 256) {
this->action = 2;
sub_0805EC60(this);
gRoomVars.greatFairyState |= 32;
- gUnk_02033280.unk_00 |= 4;
+ gActiveScriptInfo.unk_00 |= 4;
} else {
- sub_0805EC9C(this, this->nonPlanarMovement, 256, 0);
+ sub_0805EC9C(this, this->speed, 256, 0);
}
}
@@ -261,7 +262,7 @@ void GreatFairy_MiniAffineInit2(Entity* this) {
if (this->height.HALF.HI == -20) {
this->action = 2;
this->actionDelay = 90;
- this->nonPlanarMovement = 4096;
+ this->speed = 4096;
this->spriteRendering.b0 = 3;
sub_0805EC9C(this, 256, 256, 0);
}
@@ -276,7 +277,7 @@ void GreatFairy_MiniAffineUpdate(Entity* this) {
this->action = 3;
sub_0805EC60(this);
} else {
- iVar2 = this->nonPlanarMovement -= 24;
+ iVar2 = this->speed -= 24;
sub_0805EC9C(this, 256, iVar2 * 0x10000 >> 20, 0);
}
}
@@ -387,7 +388,7 @@ void sub_08087150(Entity* this) {
this->spriteOrientation.flipY = 0;
this->spriteRendering.b0 = 0;
this->spritePriority.b0 = 3;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->direction = 0x10;
temp = gUnk_0812079C;
this->palette.raw = ((temp & 0xf) << 4) | 0xf;
@@ -464,7 +465,7 @@ void sub_080872AC(Entity* this) {
this->field_0x68.HWORD = this->x.HALF.HI;
this->field_0x6a.HWORD = this->y.HALF.HI;
this->direction = (u8)Random() & 0x1F;
- this->nonPlanarMovement = 32;
+ this->speed = 32;
GreatFairy_InitializeAnimation(this);
}
@@ -530,7 +531,7 @@ void sub_080873FC(void) {
}
}
-void sub_08087424(Entity* arg0, struct_08087424* arg1) {
+void sub_08087424(Entity* this, ScriptExecutionContext* context) {
Entity* ent;
sub_080791D0();
@@ -541,9 +542,9 @@ void sub_08087424(Entity* arg0, struct_08087424* arg1) {
sub_0805E3A0(ent, 2);
}
- switch (arg1->unk4) {
+ switch (context->intVariable) {
case 0:
- gSave.stats.arrowCount = arg1->unk4;
+ gSave.stats.arrowCount = 0;
break;
case 1:
gSave.stats.bombCount = 0;
@@ -551,14 +552,14 @@ void sub_08087424(Entity* arg0, struct_08087424* arg1) {
}
}
-void sub_0808747C(u32 arg0, u32 arg1) {
- u32 iVar1;
+void sub_0808747C(Entity* this, ScriptExecutionContext* context) {
+ u32 iVar1 = 0;
iVar1 = (u32)FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
if (iVar1 != 0) {
iVar1 = 1;
}
- *(u32*)(arg1 + 0x14) = iVar1;
+ context->condition = iVar1;
}
// clang-format off
diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c
index d500686c..0d9b6e81 100644
--- a/src/object/houseDoorExterior.c
+++ b/src/object/houseDoorExterior.c
@@ -117,7 +117,7 @@ static void sub_0808681C(Entity* this) {
}
if (this->flags & 0x2) {
- ExecuteScriptCommandSet(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
+ ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
sub_080868EC(this, *(void**)&this->cutsceneBeh);
}
}
@@ -129,7 +129,7 @@ void sub_080868B0(Entity* this) {
this->hitbox = &gUnk_081206AC;
this->actionDelay = 8;
}
- ExecuteScriptCommandSet(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
+ ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
sub_080868EC(this, *(void**)&this->cutsceneBeh);
}
@@ -174,11 +174,10 @@ static u8 sub_08086954(Entity* this) {
return this->actionDelay;
}
-// TODO: Second arg is some unknown struct.
-void sub_080869A4(Entity* entityA, u32* entityB) {
- entityB[5] = 0;
- if (!sub_08086954(entityA)) {
- entityA->actionDelay = 8;
- entityB[5] = 1;
+void sub_080869A4(Entity* this, ScriptExecutionContext* context) {
+ context->condition = 0;
+ if (!sub_08086954(this)) {
+ this->actionDelay = 8;
+ context->condition = 1;
}
}
diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c
index 409c1d04..b794b546 100644
--- a/src/object/itemOnGround.c
+++ b/src/object/itemOnGround.c
@@ -141,8 +141,8 @@ static void sub_080810A8(Entity* this) {
sub_080814A4(this);
if (this->direction & 0x80) {
this->direction &= 0x1F;
- if (this->nonPlanarMovement == 0) {
- this->nonPlanarMovement = 0x100;
+ if (this->speed == 0) {
+ this->speed = 0x100;
}
} else {
this->direction |= 0xFF;
@@ -259,7 +259,7 @@ void sub_080812A0(Entity* this) {
void sub_080812A8(Entity* this) {
if (sub_080002D0(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) {
this->direction = 0;
- this->nonPlanarMovement = 0;
+ this->speed = 0;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.HI = 0;
sub_080810A8(this);
diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c
index 0fc2c3ac..a2a18bff 100644
--- a/src/object/metalDoor.c
+++ b/src/object/metalDoor.c
@@ -22,7 +22,7 @@ void sub_080A0684(Entity* this) {
DeleteThisEntity();
}
this->action = 1;
- this->nonPlanarMovement = 0x300;
+ this->speed = 0x300;
this->spriteSettings.b.draw = 0;
this->frameIndex = 0;
this->spriteSettings.b.flipY = 1;
diff --git a/src/object/minecart.c b/src/object/minecart.c
index 311ea368..5b347736 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -50,7 +50,7 @@ void sub_080916EC(Entity* this) {
this->field_0x40 = 0x44;
this->flags2 = 0x80;
this->direction = DirectionFromAnimationState(this->animationState);
- this->nonPlanarMovement = 0x700;
+ this->speed = 0x700;
this->spritePriority.b1 = 3;
InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState);
SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer);
@@ -80,7 +80,7 @@ void sub_080917DC(Entity* this) {
gPlayerState.jumpStatus = 0x81;
gPlayerState.flags.all |= 0x4000000;
gPlayerEntity.field_0x20 = 0x20000;
- gPlayerEntity.nonPlanarMovement = 0x100;
+ gPlayerEntity.speed = 0x100;
gPlayerEntity.flags &= 0x7f;
ResetPlayer();
sub_0807A108();
@@ -142,7 +142,7 @@ void sub_080919AC(Entity* this) {
}
} else {
this->flags = this->flags | 0x80;
- gPlayerEntity.nonPlanarMovement = 0;
+ gPlayerEntity.speed = 0;
sub_0806F69C(this);
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
@@ -175,7 +175,7 @@ void sub_080919AC(Entity* this) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x1000) | 0x4000000;
gPlayerEntity.field_0x20 = 0x20000;
- gPlayerEntity.nonPlanarMovement = 0x200;
+ gPlayerEntity.speed = 0x200;
gPlayerEntity.animationState = this->animationState << 1;
gPlayerEntity.direction = this->direction;
gPlayerEntity.flags |= 0x80;
diff --git a/src/object/object1A.c b/src/object/object1A.c
index 7b8fbcb2..f028481d 100644
--- a/src/object/object1A.c
+++ b/src/object/object1A.c
@@ -55,5 +55,5 @@ void sub_08086A6C(Entity* ent) {
uVar1 = Random();
ent->field_0x20 = 163840;
ent->direction = (uVar1 >> 16) & 31;
- ent->nonPlanarMovement = uVar1 & 480;
+ ent->speed = uVar1 & 480;
}
diff --git a/src/object/objectA2.c b/src/object/objectA2.c
index 89a2041c..0c3307d3 100644
--- a/src/object/objectA2.c
+++ b/src/object/objectA2.c
@@ -106,6 +106,6 @@ void sub_0809F448(Entity* this) {
tmp += -0x80000 + (rand & 0xFFFFF);
break;
}
- this->nonPlanarMovement = (tmp > 0 ? tmp : -tmp) / (tmp2->unk_1 << 8);
+ this->speed = (tmp > 0 ? tmp : -tmp) / (tmp2->unk_1 << 8);
this->direction = sub_080045DA(tmp, 0) >> 3;
}
diff --git a/src/object/objectB2.c b/src/object/objectB2.c
index 71c7e4b5..0888ed38 100644
--- a/src/object/objectB2.c
+++ b/src/object/objectB2.c
@@ -22,12 +22,12 @@ void ObjectB2(Entity* this) {
this->attachedEntity = pEVar3;
InitializeAnimation(this, this->type);
}
- this->nonPlanarMovement = this->parent->nonPlanarMovement;
+ this->speed = this->parent->speed;
sub_0806F69C(this);
if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
DeleteThisEntity();
}
- if (this->nonPlanarMovement < 0x41) {
+ if (this->speed < 0x41) {
this->spriteSettings.b.draw ^= 1;
if (--this->actionDelay == 0) {
diff --git a/src/object/pot.c b/src/object/pot.c
index ceea4011..7161178e 100644
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -32,7 +32,7 @@ void sub_0808222C(Entity* this) {
this->action = 1;
this->hitbox = &gUnk_080FD338;
- this->nonPlanarMovement = 0x80;
+ this->speed = 0x80;
this->y.HALF.HI += 3;
this->field_0x16 = 0;
this->flags |= 0x80;
@@ -84,7 +84,7 @@ void sub_08082310(Entity* this) {
this->actionDelay = 32;
this->action = 4;
if (gPlayerState.flags.all & 0x80) {
- this->nonPlanarMovement >>= 1;
+ this->speed >>= 1;
this->actionDelay = 64;
}
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
@@ -183,7 +183,7 @@ void sub_08082614(Entity* this) {
this->action = 1;
if (gPlayerState.flags.all & 0x80) {
- this->nonPlanarMovement <<= 1;
+ this->speed <<= 1;
}
this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer);
diff --git a/src/object/smoke.c b/src/object/smoke.c
index 4c2739dd..86c75efc 100644
--- a/src/object/smoke.c
+++ b/src/object/smoke.c
@@ -36,7 +36,7 @@ void sub_0808A46C(Entity* this) {
void sub_0808A484(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
- this->nonPlanarMovement = 0x40;
+ this->speed = 0x40;
this->direction = 6;
this->spriteRendering.b3 = 1;
this->spritePriority.b0 = 0;
diff --git a/src/object/windcrest.c b/src/object/windcrest.c
index 0ce28743..d2dc4431 100644
--- a/src/object/windcrest.c
+++ b/src/object/windcrest.c
@@ -1,6 +1,5 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
#include "save.h"
#include "script.h"
@@ -14,8 +13,8 @@ void Windcrest(Entity* this) {
this->frameIndex = 0;
sub_0807DD64(this);
}
- sub_0807DDAC(this, NULL);
- sub_0807DDE4(this);
+ ExecuteScriptForEntity(this, NULL);
+ HandleEntity0x82Actions(this);
}
void sub_080A2124(Entity* this) {
diff --git a/src/player.c b/src/player.c
index e3038077..7dfcbb93 100644
--- a/src/player.c
+++ b/src/player.c
@@ -143,7 +143,7 @@ void sub_08070D20(Entity* this) {
void sub_08070D38(Entity* this) {
this->flags &= ~0x80;
this->direction = ((this->animationState & 0xe) << 2) ^ 0x10;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
this->field_0x42 = 0;
this->previousActionFlag++;
this->actionDelay = gPlayerState.field_0x38;
@@ -353,7 +353,7 @@ void sub_080710A8(Entity* this) {
asm("lsl r0, r0, #0x4");
this->field_0x20 = (temp - 4) * 64 * 64;
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
sub_0807A108();
SoundReq(0x7c);
SoundReq(0x78);
@@ -522,7 +522,7 @@ void sub_08071400(Entity* this) {
if ((this->x.HALF.HI != x) || (this->y.HALF.HI != y)) {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gArea.field_0x12, gArea.field_0x14);
- this->nonPlanarMovement = 0x100;
+ this->speed = 0x100;
sub_08079E08();
}
diff --git a/src/room.c b/src/room.c
index f79da48d..55625d0a 100644
--- a/src/room.c
+++ b/src/room.c
@@ -9,6 +9,7 @@
#include "main.h"
#include "structures.h"
#include "save.h"
+#include "script.h"
#include "random.h"
#include "functions.h"
@@ -387,7 +388,7 @@ u32 sub_0804B7A8(void) {
return 1;
}
-extern void* gUnk_08010A5C[];
+extern void* script_08010A5C[];
void sub_0804B7E8(void) {
if (CheckLocalFlag(0x91)) {
@@ -395,7 +396,7 @@ void sub_0804B7E8(void) {
DoFade(5, 0x100);
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x50;
gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38;
- sub_080751E8(1, 2, &gUnk_08010A5C);
+ sub_080751E8(1, 2, &script_08010A5C);
}
}
@@ -421,7 +422,7 @@ void sub_0804B86C(void) {
DoFade(5, 0x100);
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x50;
gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38;
- sub_080751E8(1, 2, &gUnk_08010A5C);
+ sub_080751E8(1, 2, &script_08010A5C);
}
}
@@ -447,7 +448,7 @@ void sub_0804B8F0(void) {
DoFade(5, 0x100);
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x60;
gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38;
- sub_080751E8(1, 2, &gUnk_08010A5C);
+ sub_080751E8(1, 2, &script_08010A5C);
}
}
@@ -647,14 +648,14 @@ u32 sub_0804BC50(void) {
return 1;
}
-extern u32 gUnk_08009E88;
+extern u32 script_08009E88;
void sub_0804BC70(void) {
if (!CheckLocalFlag(0x9f)) {
DoFade(5, 0x100);
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0xb0;
gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x40;
- sub_080751E8(0, 6, &gUnk_08009E88);
+ sub_080751E8(0, 6, &script_08009E88);
}
if (!CheckGlobalFlag(TABIDACHI)) {
sub_08052878();
@@ -970,7 +971,7 @@ void sub_0804BF38(u32 arg0, struct_0804BF38* arg1)
fx->x.HALF.HI = gUnk_080D8E50[iVar3].x + gRoomControls.roomOriginX + xOff;
fx->y.HALF.HI = gUnk_080D8E50[iVar3].y + gRoomControls.roomOriginY + -0xc + (entCnt & 1) * 8;
fx->direction = 0;
- fx->nonPlanarMovement = 0x100;
+ fx->speed = 0x100;
}
}
}
@@ -980,7 +981,7 @@ void sub_0804BF38(u32 arg0, struct_0804BF38* arg1)
}
#else
NAKED
-void sub_0804BF38(u32 arg0, void* arg1) {
+void sub_0804BF38(Entity* this, ScriptExecutionContext* context) {
asm(".include \"asm/non_matching/sub_0804BF38.inc\"");
}
#endif
@@ -4770,7 +4771,7 @@ u32 sub_0804E7D8() {
}
extern EntityData gUnk_080F31D8;
-extern u32 gUnk_08009B30;
+extern u32 script_08009B30;
void sub_0804E7DC(void) {
@@ -4778,7 +4779,7 @@ void sub_0804E7DC(void) {
sub_080A71C4(5, 1, 4, 4);
gUnk_02000070 = 0;
DoFade(5, 0x100);
- sub_080751E8(0, 6, &gUnk_08009B30);
+ sub_080751E8(0, 6, &script_08009B30);
}
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
@@ -4789,12 +4790,12 @@ void sub_0804E7DC(void) {
}
}
-extern u32 gUnk_08009E58;
+extern u32 script_08009E58;
void sub_0804E864(void) {
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x90;
gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38;
- sub_080751E8(1, 6, &gUnk_08009E58);
+ sub_080751E8(1, 6, &script_08009E58);
ModHealth(0xa0);
}
@@ -5266,14 +5267,14 @@ u32 sub_0804EFDC(void) {
}
extern EntityData gUnk_080F5DD0;
-extern u32 gUnk_08011C50;
+extern u32 script_08011C50;
void sub_0804EFF8(void) {
if (gSave.unk8 > 7) {
LoadRoomEntityList(&gUnk_080F5DD0);
}
if (CheckGlobalFlag(MAROYA_WAKEUP)) {
- sub_080751E8(1, 2, &gUnk_08011C50);
+ sub_080751E8(1, 2, &script_08011C50);
}
}
@@ -5670,35 +5671,35 @@ void sub_0804F680(Entity* parent, s32 x, s32 y) {
}
}
-void sub_0804F6A8(Entity* arg0) {
- sub_0804F680(arg0, 0x1d8, 0x108);
- sub_0804F680(arg0, 0x218, 0x188);
+void sub_0804F6A8(Entity* this) {
+ sub_0804F680(this, 0x1d8, 0x108);
+ sub_0804F680(this, 0x218, 0x188);
}
-void sub_0804F6C8(Entity* arg0) {
- sub_0804F680(arg0, 0x1e8, 0x108);
- sub_0804F680(arg0, 0x208, 0x188);
+void sub_0804F6C8(Entity* this) {
+ sub_0804F680(this, 0x1e8, 0x108);
+ sub_0804F680(this, 0x208, 0x188);
}
-void sub_0804F6E8(Entity* arg0) {
- sub_0804F680(arg0, 0x1f8, 0x108);
- sub_0804F680(arg0, 0x258, 0x138);
- sub_0804F680(arg0, 0x1f8, 0x188);
- sub_0804F680(arg0, 0x198, 0x158);
+void sub_0804F6E8(Entity* this) {
+ sub_0804F680(this, 0x1f8, 0x108);
+ sub_0804F680(this, 0x258, 0x138);
+ sub_0804F680(this, 0x1f8, 0x188);
+ sub_0804F680(this, 0x198, 0x158);
}
-void sub_0804F724(Entity* arg0) {
- sub_0804F680(arg0, 0x208, 0x108);
- sub_0804F680(arg0, 0x258, 0x148);
- sub_0804F680(arg0, 0x1e8, 0x188);
- sub_0804F680(arg0, 0x198, 0x148);
+void sub_0804F724(Entity* this) {
+ sub_0804F680(this, 0x208, 0x108);
+ sub_0804F680(this, 0x258, 0x148);
+ sub_0804F680(this, 0x1e8, 0x188);
+ sub_0804F680(this, 0x198, 0x148);
}
-void sub_0804F760(Entity* arg0) {
- sub_0804F680(arg0, 0x218, 0x108);
- sub_0804F680(arg0, 0x258, 0x158);
- sub_0804F680(arg0, 0x1d8, 0x188);
- sub_0804F680(arg0, 0x198, 0x138);
+void sub_0804F760(Entity* this) {
+ sub_0804F680(this, 0x218, 0x108);
+ sub_0804F680(this, 0x258, 0x158);
+ sub_0804F680(this, 0x1d8, 0x188);
+ sub_0804F680(this, 0x198, 0x138);
}
void sub_0804F79C(Entity* parent) {
diff --git a/src/script.c b/src/script.c
index 3033d528..26aff076 100644
--- a/src/script.c
+++ b/src/script.c
@@ -10,177 +10,294 @@
#include "random.h"
#include "functions.h"
-void sub_0807DAF0(Entity*, ScriptExecutionContext*, u16*);
-void sub_0807DB88(ScriptExecutionContext*, u16*);
+void InitScriptForEntity(Entity*, ScriptExecutionContext*, u16*);
+void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script);
void sub_0807DE80(Entity*);
void sub_0807DF38(void);
-void nullsub_507(Entity*, ScriptExecutionContext*);
-void sub_0807E004(Entity*, ScriptExecutionContext*);
-void sub_0807E014(Entity*, ScriptExecutionContext*);
-void sub_0807E024(Entity*, ScriptExecutionContext*);
-void sub_0807E050(Entity*, ScriptExecutionContext*);
-void sub_0807E064(Entity*, ScriptExecutionContext*);
-void sub_0807E078(Entity*, ScriptExecutionContext*);
-void sub_0807E0A0(Entity*, ScriptExecutionContext*);
-void sub_0807E0B8(Entity*, ScriptExecutionContext*);
-void sub_0807E0CC(Entity*, ScriptExecutionContext*);
-void sub_0807E0E0(Entity*, ScriptExecutionContext*);
-void sub_0807E10C(Entity*, ScriptExecutionContext*);
-void sub_0807E124(Entity*, ScriptExecutionContext*);
-void sub_0807E148(Entity*, ScriptExecutionContext*);
-void sub_0807E158(Entity*, ScriptExecutionContext*);
-void sub_0807E188(Entity*, ScriptExecutionContext*);
-void sub_0807E1D8(Entity*, ScriptExecutionContext*);
-void sub_0807E200(Entity*, ScriptExecutionContext*);
-void sub_0807E220(Entity*, ScriptExecutionContext*);
-void sub_0807E240(Entity*, ScriptExecutionContext*);
-void sub_0807E260(Entity*, ScriptExecutionContext*);
-void sub_0807E280(Entity*, ScriptExecutionContext*);
-void sub_0807E2A8(Entity*, ScriptExecutionContext*);
-void sub_0807E2E4(Entity*, ScriptExecutionContext*);
-void sub_0807E30C(Entity*, ScriptExecutionContext*);
-void sub_0807E390(Entity*, ScriptExecutionContext*);
-void sub_0807E3BC(Entity*, ScriptExecutionContext*);
-void sub_0807E3E8(Entity*, ScriptExecutionContext*);
-void sub_0807E40C(Entity*, ScriptExecutionContext*);
-void sub_0807E42C(Entity*, ScriptExecutionContext*);
-void sub_0807E48C(Entity*, ScriptExecutionContext*);
-void sub_0807E4AC(Entity*, ScriptExecutionContext*);
-void sub_0807E4CC(Entity*, ScriptExecutionContext*);
-void sub_0807E4EC(Entity*, ScriptExecutionContext*);
-void sub_0807E514(Entity*, ScriptExecutionContext*);
-void sub_0807E538(Entity*, ScriptExecutionContext*);
-void sub_0807E564(Entity*, ScriptExecutionContext*);
-void sub_0807E584(Entity*, ScriptExecutionContext*);
-void sub_0807E5A0(Entity*, ScriptExecutionContext*);
-void sub_0807E5CC(Entity*, ScriptExecutionContext*);
-void sub_0807E5F8(Entity*, ScriptExecutionContext*);
-void sub_0807E610(Entity*, ScriptExecutionContext*);
-void sub_0807E628(Entity*, ScriptExecutionContext*);
-void sub_0807E634(Entity*, ScriptExecutionContext*);
-void sub_0807E644(Entity*, ScriptExecutionContext*);
-void sub_0807E650(Entity*, ScriptExecutionContext*);
-void sub_0807E65C(Entity*, ScriptExecutionContext*);
-void sub_0807E668(Entity*, ScriptExecutionContext*);
-void sub_0807E674(Entity*, ScriptExecutionContext*);
-void sub_0807E680(Entity*, ScriptExecutionContext*);
-void sub_0807E690(Entity*, ScriptExecutionContext*);
-void sub_0807E6AC(Entity*, ScriptExecutionContext*);
-void sub_0807E6DC(Entity*, ScriptExecutionContext*);
-void sub_0807E700(Entity*, ScriptExecutionContext*);
-void sub_0807E72C(Entity*, ScriptExecutionContext*);
-void sub_0807E75C(Entity*, ScriptExecutionContext*);
-void sub_0807E778(Entity*, ScriptExecutionContext*);
-void sub_0807E788(Entity*, ScriptExecutionContext*);
-void sub_0807E79C(Entity*, ScriptExecutionContext*);
-void nullsub_508(Entity*, ScriptExecutionContext*);
-void sub_0807E7B0(Entity*, ScriptExecutionContext*);
-void sub_0807E7C4(Entity*, ScriptExecutionContext*);
-void sub_0807E7D8(Entity*, ScriptExecutionContext*);
-void sub_0807E7EC(Entity*, ScriptExecutionContext*);
-void sub_0807E800(Entity*, ScriptExecutionContext*);
-void sub_0807E80C(Entity*, ScriptExecutionContext*);
+void ScriptCommandNop(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_BeginBlock(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_EndBlock(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_Jump(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpIf(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpIfNot(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpTable(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpAbsolute(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpAbsoluteIf(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpAbsoluteIfNot(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_JumpAbsoluteTable(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_Call(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CallWithArg(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_LoadRoomEntityList(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_TestBit(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckInventory1(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckInventory2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckLocalFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckLocalFlagByOffset(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckGlobalFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckRoomFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckPlayerInRegion(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckPlayerInRegion2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E30C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_HasRupees(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E3BC(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E3E8(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckKinstoneFused(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_BuyItem(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E48C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_HasRoomItemForSale(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E4CC(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E4EC(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E514(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CheckPlayerFlags(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E564(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_EntityHasHeight(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ComparePlayerAction(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ComparePlayerAnimationState(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E5F8(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E610(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetLocalFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetLocalFlagByOffset(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ClearLocalFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetGlobalFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ClearGlobalFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetRoomFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ClearRoomFlag(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_Wait(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_WaitForSomething(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_WaitForSomething2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_WaitPlayerAction8(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_WaitForPlayerAction0x17(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_WaitFor_1(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_WaitFor_2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E788(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommandNop2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_DoFade4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_DoFade5(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_DoFade6(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_DoFade7(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E800(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E80C(Entity* entity, ScriptExecutionContext* context);
void sub_0807E818(u32);
-void sub_0807E858(Entity*, ScriptExecutionContext*);
-void sub_0807E864(Entity*, ScriptExecutionContext*);
-void sub_0807E878(Entity*, ScriptExecutionContext*);
-void sub_0807E888(Entity*, ScriptExecutionContext*);
-void sub_0807E898(Entity*, ScriptExecutionContext*);
-void sub_0807E8C4(Entity*, ScriptExecutionContext*);
-void sub_0807E8D4(Entity*, ScriptExecutionContext*);
-void sub_0807E8E4(Entity*, ScriptExecutionContext*);
-void sub_0807E908(Entity*, ScriptExecutionContext*);
-void sub_0807E914(Entity*, ScriptExecutionContext*);
-void sub_0807E924(Entity*, ScriptExecutionContext*);
-void sub_0807E930(Entity*, ScriptExecutionContext*);
-void sub_0807E944(Entity*, ScriptExecutionContext*);
-void sub_0807E974(Entity*, ScriptExecutionContext*);
-void sub_0807E9D4(Entity*, ScriptExecutionContext*);
-void sub_0807E9DC(Entity*, ScriptExecutionContext*);
-void sub_0807E9E4(Entity*, ScriptExecutionContext*);
-void sub_0807E9F0(Entity*, ScriptExecutionContext*);
-void sub_0807EA4C(Entity*, ScriptExecutionContext*);
-void sub_0807EA88(Entity*, ScriptExecutionContext*);
-void sub_0807EA94(Entity*, ScriptExecutionContext*);
-void sub_0807EAB4(Entity*, ScriptExecutionContext*);
-void sub_0807EAC0(Entity*, ScriptExecutionContext*);
-void sub_0807EAD0(Entity*, ScriptExecutionContext*);
-void sub_0807EAF0(Entity*, ScriptExecutionContext*);
-void sub_0807EB18(Entity*, ScriptExecutionContext*);
-void sub_0807EB28(Entity*, ScriptExecutionContext*);
-void sub_0807EB38(Entity*, ScriptExecutionContext*);
-void sub_0807EB44(Entity*, ScriptExecutionContext*);
-void sub_0807EB4C(Entity*, ScriptExecutionContext*);
-void sub_0807EB74(Entity*, ScriptExecutionContext*);
-void sub_0807EB8C(Entity*, ScriptExecutionContext*);
-void sub_0807EBA8(Entity*, ScriptExecutionContext*);
-void sub_0807EBB0(Entity*, ScriptExecutionContext*);
-void sub_0807EBC0(Entity*, ScriptExecutionContext*);
-void sub_0807EBC8(Entity*, ScriptExecutionContext*);
-void sub_0807EBD8(Entity*, ScriptExecutionContext*);
-void sub_0807EBF4(Entity*, ScriptExecutionContext*);
-void sub_0807EC08(Entity*, ScriptExecutionContext*);
-void nullsub_509(Entity*, ScriptExecutionContext*);
-void sub_0807EC1C(Entity*, ScriptExecutionContext*);
+void ScriptCommand_0807E858(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E864(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E878(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E888(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetPlayerAction(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_StartPlayerScript(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E8D4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E8E4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E908(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetIntVariable(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E924(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E930(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E944(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E9D4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E9DC(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E9E4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EA94(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_TextboxNoOverlapFollow(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_TextboxNoOverlap(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_TextboxNoOverlapFollowPos(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_TextboxNoOverlapFollowTable(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_TextboxNoOverlapVar(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EB28(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EB38(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EB44(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EB4C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EB74(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EB8C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetEntityDirection(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetEntityDirectionWithAnimationState(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetEntitySpeed(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetEntity0x20(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetEntityPositionRelative(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SetEntityPosition(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_MoveEntityToPlayer(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommandNop3(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EC1C(Entity* entity, ScriptExecutionContext* context);
void sub_0807EC44(Entity*, ScriptExecutionContext*);
-void sub_0807EC64(Entity*, ScriptExecutionContext*);
-void sub_0807EC94(Entity*, ScriptExecutionContext*);
-void sub_0807ECC4(Entity*, ScriptExecutionContext*);
-void sub_0807ECF4(Entity*, ScriptExecutionContext*);
-void sub_0807ED24(Entity*, ScriptExecutionContext*);
-void sub_0807EDD4(Entity*, ScriptExecutionContext*);
-void sub_0807EE04(Entity*, ScriptExecutionContext*);
-void sub_0807EE30(Entity*, ScriptExecutionContext*);
-void sub_0807EEB4(Entity*, ScriptExecutionContext*);
-void sub_0807EEF4(Entity*, ScriptExecutionContext*);
-void sub_0807EF3C(Entity*, ScriptExecutionContext*);
-void sub_0807EF80(Entity*, ScriptExecutionContext*);
-void sub_0807EF90(Entity*, ScriptExecutionContext*);
-void sub_0807EFA0(Entity*, ScriptExecutionContext*);
-void sub_0807EFAC(Entity*, ScriptExecutionContext*);
-void sub_0807EFD4(Entity*, ScriptExecutionContext*);
-void sub_0807EFE4(Entity*, ScriptExecutionContext*);
-void sub_0807EFF4(Entity*, ScriptExecutionContext*);
-void sub_0807F004(Entity*, ScriptExecutionContext*);
-void sub_0807F010(Entity*, ScriptExecutionContext*);
-void sub_0807F034(Entity*, ScriptExecutionContext*);
-void sub_0807F050(Entity*, ScriptExecutionContext*);
-void sub_0807F060(Entity*, ScriptExecutionContext*);
-void sub_0807F078(Entity*, ScriptExecutionContext*);
-void sub_0807F088(Entity*, ScriptExecutionContext*);
-void sub_0807F098(Entity*, ScriptExecutionContext*);
-void sub_0807F0A4(Entity*, ScriptExecutionContext*);
-void sub_0807F0B4(Entity*, ScriptExecutionContext*);
-void sub_0807F0C8(Entity*, ScriptExecutionContext*);
+void ScriptCommand_0807EC64(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EC94(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807ECC4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807ECF4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EDD4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EE04(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EEB4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807EF3C(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_DoPostScriptAction(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_DoPostScriptAction2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SoundReq2(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SoundReq3(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_SoundReq0x80100000(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ModRupees(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_ModHealth(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_IncreaseMaxHealth(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807F034(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807F050(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_GetInventoryValue(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807F078(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807F088(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CameraTargetEntity(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_CameraTargetPlayer(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807F0B4(Entity* entity, ScriptExecutionContext* context);
+void ScriptCommand_0807F0C8(Entity* entity, ScriptExecutionContext* context);
extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32);
extern void sub_0801C4A0(u32);
-void (*const gUnk_0811E524[])() = {
- nullsub_507, sub_0807E004, sub_0807E014, sub_0807E024, sub_0807E050, sub_0807E064, sub_0807E078, sub_0807E0A0,
- sub_0807E0B8, sub_0807E0CC, sub_0807E0E0, sub_0807E10C, sub_0807E124, sub_0807E148, sub_0807E158, sub_0807E188,
- sub_0807E1D8,
- sub_0807E4AC, // defined out of order
- sub_0807E200, sub_0807E220, sub_0807E240, sub_0807E260, sub_0807E280, sub_0807E2A8, sub_0807E2E4, sub_0807E30C,
- sub_0807E390, sub_0807E3BC, sub_0807E3E8, sub_0807E40C, sub_0807E42C, sub_0807E48C, sub_0807E4CC, sub_0807E4EC,
- sub_0807E514, sub_0807E538, sub_0807E564, sub_0807E584, sub_0807E5A0, sub_0807E5CC, sub_0807E5F8, sub_0807E610,
- sub_0807E628, sub_0807E634, sub_0807E644, sub_0807E650, sub_0807E65C, sub_0807E668, sub_0807E674, sub_0807E680,
- sub_0807E690, sub_0807E6AC, sub_0807E6DC, sub_0807E700, sub_0807E72C, sub_0807E75C, sub_0807E778, sub_0807E788,
- sub_0807E79C, nullsub_508, sub_0807E7B0, sub_0807E7C4, sub_0807E7D8, sub_0807E7EC, sub_0807E800, sub_0807E80C,
- sub_0807E858, sub_0807E864, sub_0807E878, sub_0807E888, sub_0807E898, sub_0807E8C4, sub_0807E8D4, sub_0807E8E4,
- sub_0807E8E4, // duplicate
- sub_0807E8E4, // duplicate
- sub_0807E8E4, // duplicate
- sub_0807E908, sub_0807E914, sub_0807E924, sub_0807E930, sub_0807E944, sub_0807E974, sub_0807E9D4, sub_0807E9DC,
- sub_0807E9E4, sub_0807E9F0, sub_0807EA4C, sub_0807EA88, sub_0807EA94, sub_0807EAB4, sub_0807EAC0, sub_0807EAD0,
- sub_0807EAF0, sub_0807EB18, sub_0807EB28, sub_0807EB38, sub_0807EB44, sub_0807EB4C, sub_0807EB74, sub_0807EB8C,
- sub_0807EBA8, sub_0807EBB0, sub_0807EBC0, sub_0807EBC8, sub_0807EBD8, sub_0807EBF4, sub_0807EC08, nullsub_509,
- sub_0807EC1C, sub_0807EC64, sub_0807EC94, sub_0807ECC4, sub_0807ECF4, sub_0807ED24, sub_0807EDD4, sub_0807EE04,
- sub_0807EE30, sub_0807EEB4, sub_0807EEF4, sub_0807EF3C, sub_0807EF80, sub_0807EF90, sub_0807EFA0, sub_0807EFAC,
- sub_0807EFD4, sub_0807EFE4, sub_0807EFF4, sub_0807F004, sub_0807F010, sub_0807F034, sub_0807F050, sub_0807F060,
- sub_0807F078, sub_0807F088, sub_0807F098, sub_0807F0A4, sub_0807F0B4, sub_0807F0C8
-};
+typedef void (*ScriptCommand)(Entity*, ScriptExecutionContext*);
+
+const ScriptCommand gScriptCommands[] = { ScriptCommandNop,
+ ScriptCommand_BeginBlock,
+ ScriptCommand_EndBlock,
+ ScriptCommand_Jump,
+ ScriptCommand_JumpIf,
+ ScriptCommand_JumpIfNot,
+ ScriptCommand_JumpTable,
+ ScriptCommand_JumpAbsolute,
+ ScriptCommand_JumpAbsoluteIf,
+ ScriptCommand_JumpAbsoluteIfNot,
+ ScriptCommand_JumpAbsoluteTable,
+ ScriptCommand_Call,
+ ScriptCommand_CallWithArg,
+ ScriptCommand_LoadRoomEntityList,
+ ScriptCommand_TestBit,
+ ScriptCommand_CheckInventory1,
+ ScriptCommand_CheckInventory2,
+ ScriptCommand_HasRoomItemForSale,
+ ScriptCommand_CheckLocalFlag,
+ ScriptCommand_CheckLocalFlagByOffset,
+ ScriptCommand_CheckGlobalFlag,
+ ScriptCommand_CheckRoomFlag,
+ ScriptCommand_CheckPlayerInRegion,
+ ScriptCommand_CheckPlayerInRegion2,
+ ScriptCommand_CheckEntityInteractType,
+ ScriptCommand_0807E30C,
+ ScriptCommand_HasRupees,
+ ScriptCommand_0807E3BC,
+ ScriptCommand_0807E3E8,
+ ScriptCommand_CheckKinstoneFused,
+ ScriptCommand_BuyItem,
+ ScriptCommand_0807E48C,
+ ScriptCommand_0807E4CC,
+ ScriptCommand_0807E4EC,
+ ScriptCommand_0807E514,
+ ScriptCommand_CheckPlayerFlags,
+ ScriptCommand_0807E564,
+ ScriptCommand_EntityHasHeight,
+ ScriptCommand_ComparePlayerAction,
+ ScriptCommand_ComparePlayerAnimationState,
+ ScriptCommand_0807E5F8,
+ ScriptCommand_0807E610,
+ ScriptCommand_SetLocalFlag,
+ ScriptCommand_SetLocalFlagByOffset,
+ ScriptCommand_ClearLocalFlag,
+ ScriptCommand_SetGlobalFlag,
+ ScriptCommand_ClearGlobalFlag,
+ ScriptCommand_SetRoomFlag,
+ ScriptCommand_ClearRoomFlag,
+ ScriptCommand_Wait,
+ ScriptCommand_WaitForSomething,
+ ScriptCommand_WaitForSomething2,
+ ScriptCommand_WaitPlayerAction8,
+ ScriptCommand_WaitForPlayerAction0x17,
+ ScriptCommand_WaitFor_1,
+ ScriptCommand_WaitFor_2,
+ ScriptCommand_0807E778,
+ ScriptCommand_0807E788,
+ ScriptCommand_0807E79C,
+ ScriptCommandNop2,
+ ScriptCommand_DoFade4,
+ ScriptCommand_DoFade5,
+ ScriptCommand_DoFade6,
+ ScriptCommand_DoFade7,
+ ScriptCommand_0807E800,
+ ScriptCommand_0807E80C,
+ ScriptCommand_0807E858,
+ ScriptCommand_0807E864,
+ ScriptCommand_0807E878,
+ ScriptCommand_0807E888,
+ ScriptCommand_SetPlayerAction,
+ ScriptCommand_StartPlayerScript,
+ ScriptCommand_0807E8D4,
+ ScriptCommand_0807E8E4,
+ ScriptCommand_0807E8E4,
+ ScriptCommand_0807E8E4,
+ ScriptCommand_0807E8E4,
+ ScriptCommand_0807E908,
+ ScriptCommand_SetIntVariable,
+ ScriptCommand_0807E924,
+ ScriptCommand_0807E930,
+ ScriptCommand_0807E944,
+ ScriptCommand_0807E974,
+ ScriptCommand_0807E9D4,
+ ScriptCommand_0807E9DC,
+ ScriptCommand_0807E9E4,
+ ScriptCommand_0807E9F0,
+ ScriptCommand_0807EA4C,
+ ScriptCommand_0807EA88,
+ ScriptCommand_0807EA94,
+ ScriptCommand_TextboxNoOverlapFollow,
+ ScriptCommand_TextboxNoOverlap,
+ ScriptCommand_TextboxNoOverlapFollowPos,
+ ScriptCommand_TextboxNoOverlapFollowTable,
+ ScriptCommand_TextboxNoOverlapVar,
+ ScriptCommand_0807EB28,
+ ScriptCommand_0807EB38,
+ ScriptCommand_0807EB44,
+ ScriptCommand_0807EB4C,
+ ScriptCommand_0807EB74,
+ ScriptCommand_0807EB8C,
+ ScriptCommand_SetEntityDirection,
+ ScriptCommand_SetEntityDirectionWithAnimationState,
+ ScriptCommand_SetEntitySpeed,
+ ScriptCommand_SetEntity0x20,
+ ScriptCommand_SetEntityPositionRelative,
+ ScriptCommand_SetEntityPosition,
+ ScriptCommand_MoveEntityToPlayer,
+ ScriptCommandNop3,
+ ScriptCommand_0807EC1C,
+ ScriptCommand_0807EC64,
+ ScriptCommand_0807EC94,
+ ScriptCommand_0807ECC4,
+ ScriptCommand_0807ECF4,
+ ScriptCommand_0807ED24,
+ ScriptCommand_0807EDD4,
+ ScriptCommand_0807EE04,
+ ScriptCommand_0807EE30,
+ ScriptCommand_0807EEB4,
+ ScriptCommand_0807EEF4,
+ ScriptCommand_0807EF3C,
+ ScriptCommand_DoPostScriptAction,
+ ScriptCommand_DoPostScriptAction2,
+ ScriptCommand_SoundReq,
+ ScriptCommand_SoundReq2,
+ ScriptCommand_SoundReq3,
+ ScriptCommand_SoundReq0x80100000,
+ ScriptCommand_ModRupees,
+ ScriptCommand_ModHealth,
+ ScriptCommand_IncreaseMaxHealth,
+ ScriptCommand_0807F034,
+ ScriptCommand_0807F050,
+ ScriptCommand_GetInventoryValue,
+ ScriptCommand_0807F078,
+ ScriptCommand_0807F088,
+ ScriptCommand_CameraTargetEntity,
+ ScriptCommand_CameraTargetPlayer,
+ ScriptCommand_0807F0B4,
+ ScriptCommand_0807F0C8 };
extern const u16 gUnk_08016984;
extern u8 gUnk_0811E514[];
@@ -188,11 +305,11 @@ extern u8 gUnk_0811E510[];
extern ScriptExecutionContext gPlayerScriptExecutionContext;
extern ScriptExecutionContext gScriptExecutionContextArray[0x20];
-void sub_0807DA70(void) {
- MemClear(&gUnk_02033280, sizeof(gUnk_02033280));
+void InitScriptData(void) {
+ MemClear(&gActiveScriptInfo, sizeof(gActiveScriptInfo));
MemClear(&gScriptExecutionContextArray, sizeof(gScriptExecutionContextArray));
MemClear(&gPlayerScriptExecutionContext, sizeof(gPlayerScriptExecutionContext));
- gUnk_02033280.unk_08 = 8;
+ gActiveScriptInfo.unk_08 = 8;
}
ScriptExecutionContext* CreateScriptExecutionContext(void) {
@@ -200,7 +317,7 @@ ScriptExecutionContext* CreateScriptExecutionContext(void) {
context = gScriptExecutionContextArray;
do {
- if (context->unk_00 == 0) {
+ if (context->scriptInstructionPointer == 0) {
return context;
}
context++;
@@ -212,20 +329,20 @@ void DestroyScriptExecutionContext(ScriptExecutionContext* context) {
MemClear(context, sizeof(ScriptExecutionContext));
}
-ScriptExecutionContext* StartCutscene(Entity* entity, u16* unk_2) {
+ScriptExecutionContext* StartCutscene(Entity* entity, u16* script) {
ScriptExecutionContext* context;
context = CreateScriptExecutionContext();
if (context) {
- sub_0807DAF0(entity, context, unk_2);
+ InitScriptForEntity(entity, context, script);
}
return context;
}
-void sub_0807DAF0(Entity* entity, ScriptExecutionContext* context, u16* unk1) {
+void InitScriptForEntity(Entity* entity, ScriptExecutionContext* context, u16* script) {
entity->flags = entity->flags | 2;
*(ScriptExecutionContext**)&entity->cutsceneBeh = context;
- sub_0807DB88(context, unk1);
+ InitScriptExecutionContext(context, script);
}
void UnloadCutsceneData(Entity* entity) {
@@ -236,11 +353,11 @@ void UnloadCutsceneData(Entity* entity) {
}
}
-void StartPlayerScript(u16* unk1) {
+void StartPlayerScript(u16* script) {
Entity* player;
MemClear(&gPlayerScriptExecutionContext, sizeof(gPlayerScriptExecutionContext));
- gPlayerScriptExecutionContext.unk_00 = unk1;
+ gPlayerScriptExecutionContext.scriptInstructionPointer = script;
player = &gPlayerEntity;
*(ScriptExecutionContext**)&player->cutsceneBeh = &gPlayerScriptExecutionContext;
gPlayerState.playerAction = 0x1c;
@@ -249,89 +366,89 @@ void StartPlayerScript(u16* unk1) {
gPlayerState.field_0x38 = 0;
}
-ScriptExecutionContext* sub_0807DB68(Entity* entity, u16* unk1) {
+ScriptExecutionContext* StartCutscene2(Entity* entity, u16* script) {
ScriptExecutionContext* context;
context = CreateScriptExecutionContext();
if (context) {
entity->flags |= 2;
*(ScriptExecutionContext**)&entity->field_0x3c = context;
- context->unk_00 = unk1;
+ context->scriptInstructionPointer = script;
}
return context;
}
-void sub_0807DB88(ScriptExecutionContext* context, u16* unk1) {
+void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script) {
MemClear(context, sizeof(ScriptExecutionContext));
- context->unk_00 = unk1;
+ context->scriptInstructionPointer = script;
}
-void sub_0807DB98(Entity* entity, ScriptExecutionContext* context) {
- u32 switchVar;
-
- while (context->unk_08) {
- switchVar = (~context->unk_08 + 1) & context->unk_08;
- context->unk_08 ^= switchVar;
- switch (switchVar) {
- case 1:
+void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) {
+ u32 bit;
+ // iterate over bits of context->postScriptActions, LSB first
+ while (context->postScriptActions) {
+ bit = (~context->postScriptActions + 1) & context->postScriptActions;
+ context->postScriptActions ^= bit;
+ switch (bit) {
+ case 1 << 0x00:
entity->field_0x80.HWORD = 0;
break;
- case 2:
+ case 1 << 0x01:
entity->field_0x80.HWORD = 4;
break;
- case 4:
+ case 1 << 0x02:
break;
- case 8:
+ case 1 << 0x03:
entity->field_0x20 = 0x18000;
break;
- case 0x10:
+ case 1 << 0x04:
CreateSpeechBubbleExclamationMark(entity, 8, -0x18);
break;
- case 0x20:
+ case 1 << 0x05:
CreateSpeechBubbleQuestionMark(entity, 8, -0x18);
break;
- case 0x40:
+ case 1 << 0x06:
DestroyScriptExecutionContext(context);
DeleteThisEntity();
- case 0x80:
+ case 1 << 0x07:
entity->spriteSettings.b.draw = 1;
break;
- case 0x100:
+ case 1 << 0x08:
entity->spriteSettings.b.draw = 0;
break;
- case 0x200:
+ case 1 << 0x09:
entity->spriteOffsetY = 0;
entity->spriteOffsetX = 0;
entity->field_0x82.HWORD = 0;
break;
- case 0x400:
+ case 1 << 0x0a:
entity->field_0x82.HWORD |= 2;
break;
- case 0x800:
+ case 1 << 0x0b:
entity->field_0x82.HWORD &= 0xfffd;
break;
- case 0x1000:
+ case 1 << 0x0c:
entity->field_0x82.HWORD &= 0xfffe;
break;
- case 0x2000:
+ case 1 << 0x0d:
entity->field_0x82.HWORD |= 1;
break;
- case 0x4000:
+ case 1 << 0x0e:
entity->field_0x82.HWORD |= 8;
break;
- case 0x8000:
+ case 1 << 0x0f:
entity->field_0x82.HWORD ^= 4;
break;
- case 0x10000:
+ case 1 << 0x10:
entity->field_0x82.HWORD ^= 0x10;
break;
- case 0x20000:
+ case 1 << 0x11:
entity->spriteSettings.b.flipX ^= 1;
break;
- case 0x40000:
+ case 1 << 0x12:
entity->field_0x82.HWORD |= 0x20;
break;
- case 0x80000:
+ case 1 << 0x13:
entity->field_0x82.HWORD &= 0xffdf;
break;
default:
@@ -352,27 +469,27 @@ void sub_0807DD64(Entity* entity) {
entity->field_0x82.HWORD = 0;
}
-void sub_0807DD80(Entity* entity, u16* unk1) {
- sub_0807DB88(*(ScriptExecutionContext**)&entity->cutsceneBeh, unk1);
+void sub_0807DD80(Entity* entity, u16* script) {
+ InitScriptExecutionContext(*(ScriptExecutionContext**)&entity->cutsceneBeh, script);
sub_0807DD64(entity);
}
void sub_0807DD94(Entity* entity, void (*function)(Entity*, ScriptExecutionContext*)) {
- sub_0807DDAC(entity, function);
- sub_0807DDE4(entity);
+ ExecuteScriptForEntity(entity, function);
+ HandleEntity0x82Actions(entity);
sub_0807DE80(entity);
}
-void sub_0807DDAC(Entity* entity, void (*function)(Entity*, ScriptExecutionContext*)) {
+void ExecuteScriptForEntity(Entity* entity, void (*postScriptCallback)(Entity*, ScriptExecutionContext*)) {
ScriptExecutionContext** piVar1;
piVar1 = (ScriptExecutionContext**)&entity->cutsceneBeh;
if (*piVar1) {
- ExecuteScriptCommandSet(entity, *piVar1);
- if (function) {
- function(entity, *piVar1);
+ ExecuteScript(entity, *piVar1);
+ if (postScriptCallback) {
+ postScriptCallback(entity, *piVar1);
} else {
- sub_0807DB98(entity, *piVar1);
+ HandlePostScriptActions(entity, *piVar1);
}
if (!entity->next) {
DeleteThisEntity();
@@ -380,36 +497,36 @@ void sub_0807DDAC(Entity* entity, void (*function)(Entity*, ScriptExecutionConte
}
}
-void sub_0807DDE4(Entity* entity) {
+void HandleEntity0x82Actions(Entity* entity) {
u32 temp;
- u32 switchVar;
+ u32 bit;
u32 loopVar;
loopVar = entity->field_0x82.HWORD;
while (loopVar) {
- switchVar = (~loopVar + 1) & loopVar;
- loopVar = loopVar ^ switchVar;
- switch (switchVar) {
- case 2:
+ bit = (~loopVar + 1) & loopVar;
+ loopVar = loopVar ^ bit;
+ switch (bit) {
+ case 1 << 1:
if (entity->kind == 7) {
sub_0806ED78(entity);
} else {
sub_0800445C(entity);
}
break;
- case 8:
+ case 1 << 3:
if ((gScreenTransition.frameCount & 3) == 0) {
temp = (entity->field_0xf + 2U) & 7;
entity->animationState = temp;
entity->field_0xf = temp;
}
break;
- case 0x10:
+ case 1 << 4:
if ((gScreenTransition.frameCount & 1) == 0) {
entity->spriteOffsetX = gUnk_0811E510[Random() & 3];
}
break;
- case 0x20:
+ case 1 << 5:
sub_08003FC4(entity, 0x2000);
break;
}
@@ -448,20 +565,20 @@ void sub_0807DE80(Entity* entity) {
sub_080042BA(entity, local1);
}
-void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 arg2, u32 arg3) {
- int temp;
- s32 t0, t1;
+void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y) {
+ int direction;
+ s32 xOffset, yOffset;
context->unk_19 = 8;
- context->unk_08 |= 2;
- context->unk_14 = 0;
- context->unk_1C.HALF.HI = arg2;
- context->unk_20.HALF.HI = arg3;
- t0 = context->unk_1C.HALF.HI - entity->x.HALF.HI;
- t1 = context->unk_20.HALF.HI - entity->y.HALF.HI;
- temp = sub_080045DA(t0, t1);
- entity->direction = temp;
- entity->animationState = (entity->animationState & 0x80) | gUnk_0811E514[(u32)(temp << 0x18) >> 0x1c];
+ context->postScriptActions |= 2;
+ context->condition = 0;
+ context->x.HALF.HI = x;
+ context->y.HALF.HI = y;
+ xOffset = context->x.HALF.HI - entity->x.HALF.HI;
+ yOffset = context->y.HALF.HI - entity->y.HALF.HI;
+ direction = sub_080045DA(xOffset, yOffset);
+ entity->direction = direction;
+ entity->animationState = (entity->animationState & 0x80) | gUnk_0811E514[(u32)(direction << 0x18) >> 0x1c];
}
void sub_0807DF28(void) {
@@ -483,124 +600,126 @@ void sub_0807DF50(void) {
sub_08079184();
}
-void ExecuteScriptCommandSet(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_00)
+void ExecuteScript(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->scriptInstructionPointer)
return;
- if (unk2->unk_10) {
- unk2->unk_10--;
+ if (context->wait) {
+ context->wait--;
} else {
- struct_02033280* tmp2 = &gUnk_02033280;
- tmp2->unk_07 = 0;
+ struct_02033280* activeScriptInfo = &gActiveScriptInfo;
+ activeScriptInfo->flags = 0;
do {
- u32 cmd = GetNextScriptCommandHalfword(unk2->unk_00);
- u16* tmp;
+ u32 cmd = GetNextScriptCommandHalfword(context->scriptInstructionPointer);
+ u16* lastInstruction;
if (cmd == 0xFFFF)
return;
- tmp2->unk_06 = cmd >> 0xA;
- tmp2->unk_04 = cmd & 0x3FF;
- tmp = unk2->unk_00;
- tmp2->unk_07 &= ~1;
- gUnk_0811E524[tmp2->unk_04](unk1, unk2);
- unk2->unk_00 += tmp2->unk_06;
- if (tmp != unk2->unk_00) {
- unk2->unk_18 = 0;
+ activeScriptInfo->commandSize = cmd >> 0xA;
+ activeScriptInfo->commandIndex = cmd & 0x3FF;
+ lastInstruction = context->scriptInstructionPointer;
+ activeScriptInfo->flags &= ~1;
+ gScriptCommands[activeScriptInfo->commandIndex](entity, context);
+ context->scriptInstructionPointer += activeScriptInfo->commandSize;
+ if (lastInstruction != context->scriptInstructionPointer) {
+ context->unk_18 = 0;
}
- } while (tmp2->unk_07 & 3);
+ } while (activeScriptInfo->flags & 3);
}
}
-void nullsub_507(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommandNop(Entity* entity, ScriptExecutionContext* context) {
}
-void sub_0807E004(Entity* unk1, ScriptExecutionContext* unk2) {
- gUnk_02033280.unk_07 |= 2;
+// not entirely sure this name is acurate
+void ScriptCommand_BeginBlock(Entity* entity, ScriptExecutionContext* context) {
+ gActiveScriptInfo.flags |= 2;
}
-void sub_0807E014(Entity* unk1, ScriptExecutionContext* unk2) {
- gUnk_02033280.unk_07 &= ~2;
+// not entirely sure this name is acurate
+void ScriptCommand_EndBlock(Entity* entity, ScriptExecutionContext* context) {
+ gActiveScriptInfo.flags &= ~2;
}
-void sub_0807E024(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_Jump(Entity* entity, ScriptExecutionContext* context) {
s16 tmp;
- unk2->unk_00++;
- tmp = GetNextScriptCommandHalfword(unk2->unk_00);
- unk2->unk_00 += (tmp / 2);
- gUnk_02033280.unk_06 = 0;
+ context->scriptInstructionPointer++;
+ tmp = GetNextScriptCommandHalfword(context->scriptInstructionPointer);
+ context->scriptInstructionPointer += (tmp / 2);
+ gActiveScriptInfo.commandSize = 0;
}
-void sub_0807E050(Entity* unk1, ScriptExecutionContext* unk2) {
- if (unk2->unk_14) {
- sub_0807E024(unk1, unk2);
+void ScriptCommand_JumpIf(Entity* entity, ScriptExecutionContext* context) {
+ if (context->condition) {
+ ScriptCommand_Jump(entity, context);
}
}
-void sub_0807E064(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_14) {
- sub_0807E024(unk1, unk2);
+void ScriptCommand_JumpIfNot(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->condition) {
+ ScriptCommand_Jump(entity, context);
}
}
-void sub_0807E078(Entity* unk1, ScriptExecutionContext* unk2) {
- if (gUnk_02033280.unk_06 > unk2->unk_04) {
- unk2->unk_00 += unk2->unk_04;
- sub_0807E024(unk1, unk2);
+void ScriptCommand_JumpTable(Entity* entity, ScriptExecutionContext* context) {
+ if (gActiveScriptInfo.commandSize > context->intVariable) {
+ context->scriptInstructionPointer += context->intVariable;
+ ScriptCommand_Jump(entity, context);
}
}
-void sub_0807E0A0(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_00 = (u16*)GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
- gUnk_02033280.unk_06 = 0;
+void ScriptCommand_JumpAbsolute(Entity* entity, ScriptExecutionContext* context) {
+ context->scriptInstructionPointer =
+ (u16*)GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
+ gActiveScriptInfo.commandSize = 0;
}
-void sub_0807E0B8(Entity* unk1, ScriptExecutionContext* unk2) {
- if (unk2->unk_14) {
- sub_0807E0A0(unk1, unk2);
+void ScriptCommand_JumpAbsoluteIf(Entity* entity, ScriptExecutionContext* context) {
+ if (context->condition) {
+ ScriptCommand_JumpAbsolute(entity, context);
}
}
-void sub_0807E0CC(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_14) {
- sub_0807E0A0(unk1, unk2);
+void ScriptCommand_JumpAbsoluteIfNot(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->condition) {
+ ScriptCommand_JumpAbsolute(entity, context);
}
}
-void sub_0807E0E0(Entity* unk1, ScriptExecutionContext* unk2) {
- if (gUnk_02033280.unk_06 > (unk2->unk_04 << 1) + 1) {
- unk2->unk_00 += unk2->unk_04 << 1;
- sub_0807E0A0(unk1, unk2);
+void ScriptCommand_JumpAbsoluteTable(Entity* entity, ScriptExecutionContext* context) {
+ if (gActiveScriptInfo.commandSize > (context->intVariable << 1) + 1) {
+ context->scriptInstructionPointer += context->intVariable << 1;
+ ScriptCommand_JumpAbsolute(entity, context);
}
}
-void sub_0807E10C(Entity* unk1, ScriptExecutionContext* unk2) {
- ((void (*)(Entity*, ScriptExecutionContext*))GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00))(unk1,
- unk2);
+void ScriptCommand_Call(Entity* entity, ScriptExecutionContext* context) {
+ ((ScriptCommand)GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer))(entity, context);
}
-void sub_0807E124(Entity* unk1, ScriptExecutionContext* unk2) {
- void (*tmp)(Entity*, ScriptExecutionContext*) =
- (void (*)(Entity*, ScriptExecutionContext*))GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
- unk2->unk_04 = GetNextScriptCommandWord(unk2->unk_00 + 3);
- tmp(unk1, unk2);
+// the called function can read an argument from context->intVariable
+void ScriptCommand_CallWithArg(Entity* entity, ScriptExecutionContext* context) {
+ ScriptCommand tmp = (ScriptCommand)GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
+ context->intVariable = GetNextScriptCommandWord(context->scriptInstructionPointer + 3);
+ tmp(entity, context);
}
-void sub_0807E148(Entity* unk1, ScriptExecutionContext* unk2) {
- LoadRoomEntityList(GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00));
+void ScriptCommand_LoadRoomEntityList(Entity* entity, ScriptExecutionContext* context) {
+ LoadRoomEntityList(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer));
}
-void sub_0807E158(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_TestBit(Entity* entity, ScriptExecutionContext* context) {
+ u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
u32 tmp2 = 0;
- u32 tmp3 = gUnk_02033280.unk_00;
+ u32 tmp3 = gActiveScriptInfo.unk_00;
if ((tmp3 & tmp) == tmp)
tmp2 = 1;
- unk2->unk_14 = tmp2;
- gUnk_02033280.unk_00 = tmp3 & ~tmp;
- gUnk_02033280.unk_07 |= 1;
+ context->condition = tmp2;
+ gActiveScriptInfo.unk_00 = tmp3 & ~tmp;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E188(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_CheckInventory1(Entity* entity, ScriptExecutionContext* context) {
u32 tmp;
- u32 tmp2 = GetNextScriptCommandHalfwordAfterCommandMetadata(unk2->unk_00);
+ u32 tmp2 = GetNextScriptCommandHalfwordAfterCommandMetadata(context->scriptInstructionPointer);
switch (tmp2) {
case 0x53:
tmp = sub_08052734();
@@ -617,416 +736,419 @@ void sub_0807E188(Entity* unk1, ScriptExecutionContext* unk2) {
default:
tmp = GetInventoryValue(tmp2);
}
- unk2->unk_14 = tmp;
- gUnk_02033280.unk_07 |= 1;
+ context->condition = tmp;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E1D8(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = GetInventoryValue(unk2->unk_00[1]) == 2;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckInventory2(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = GetInventoryValue(context->scriptInstructionPointer[1]) == 2;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E200(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = CheckLocalFlag(unk2->unk_00[1]);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckLocalFlag(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = CheckLocalFlag(context->scriptInstructionPointer[1]);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E220(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = CheckLocalFlagByOffset(unk2->unk_00[1], unk2->unk_00[2]);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckLocalFlagByOffset(Entity* entity, ScriptExecutionContext* context) {
+ context->condition =
+ CheckLocalFlagByOffset(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E240(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = CheckGlobalFlag(GetNextScriptCommandHalfwordAfterCommandMetadata(unk2->unk_00));
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckGlobalFlag(Entity* entity, ScriptExecutionContext* context) {
+ context->condition =
+ CheckGlobalFlag(GetNextScriptCommandHalfwordAfterCommandMetadata(context->scriptInstructionPointer));
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E260(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = CheckRoomFlag(unk2->unk_00[1]);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckRoomFlag(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = CheckRoomFlag(context->scriptInstructionPointer[1]);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E280(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_CheckPlayerInRegion(Entity* entity, ScriptExecutionContext* context) {
u32 x, y, width, height;
- width = unk2->unk_00[3];
+ width = context->scriptInstructionPointer[3];
height = width >> 8;
width &= 0xFF;
- x = unk2->unk_00[1];
- y = unk2->unk_00[2];
- unk2->unk_14 = CheckPlayerInRegion(x, y, width, height);
- gUnk_02033280.unk_07 |= 1;
+ x = context->scriptInstructionPointer[1];
+ y = context->scriptInstructionPointer[2];
+ context->condition = CheckPlayerInRegion(x, y, width, height);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E2A8(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_CheckPlayerInRegion2(Entity* entity, ScriptExecutionContext* context) {
u32 x, y, width, height;
- width = unk2->unk_00[1] & 0xFF;
- height = unk2->unk_00[1] >> 8;
- x = unk1->x.HALF.HI - gRoomControls.roomOriginX;
- y = unk1->y.HALF.HI - gRoomControls.roomOriginY;
- unk2->unk_14 = CheckPlayerInRegion(x, y, width, height);
- gUnk_02033280.unk_07 |= 1;
-}
-
-void sub_0807E2E4(Entity* unk1, ScriptExecutionContext* unk2) {
- if (unk1->interactType) {
- unk1->interactType = 0;
- unk2->unk_14 = 1;
+ width = context->scriptInstructionPointer[1] & 0xFF;
+ height = context->scriptInstructionPointer[1] >> 8;
+ x = entity->x.HALF.HI - gRoomControls.roomOriginX;
+ y = entity->y.HALF.HI - gRoomControls.roomOriginY;
+ context->condition = CheckPlayerInRegion(x, y, width, height);
+ gActiveScriptInfo.flags |= 1;
+}
+
+void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContext* context) {
+ if (entity->interactType) {
+ entity->interactType = 0;
+ context->condition = 1;
} else {
- unk2->unk_14 = 0;
+ context->condition = 0;
}
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E30C(Entity* unk1, ScriptExecutionContext* unk2) {
- if ((unk2->unk_1A & 0xF) == 0 && (gPlayerState.flags.all & 0x80) == 0 &&
- sub_080041A0(unk1, &gPlayerEntity, 0x28, 0x28)) {
- unk1->animationState = sub_0806F5B0(GetFacingDirection(unk1, &gPlayerEntity));
+void ScriptCommand_0807E30C(Entity* entity, ScriptExecutionContext* context) {
+ if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags.all & 0x80) == 0 &&
+ sub_080041A0(entity, &gPlayerEntity, 0x28, 0x28)) {
+ entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity));
}
- unk2->unk_1A++;
- if (unk1->interactType) {
- unk1->interactType = 0;
- unk2->unk_14 = 1;
- unk1->animationState = sub_0806F5B0(GetFacingDirection(unk1, &gPlayerEntity));
+ context->unk_1A++;
+ if (entity->interactType) {
+ entity->interactType = 0;
+ context->condition = 1;
+ entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity));
} else {
- unk2->unk_14 = 0;
+ context->condition = 0;
}
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E390(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = (unk2->unk_00[1] <= gSave.stats.rupees);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_HasRupees(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = (context->scriptInstructionPointer[1] <= gSave.stats.rupees);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E3BC(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = (unk2->unk_00[1] <= gSave.stats.field_0x1a);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E3BC(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = (context->scriptInstructionPointer[1] <= gSave.stats.field_0x1a);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E3E8(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = !gUnk_02000040.unk_01;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E3E8(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = !gUnk_02000040.unk_01;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E40C(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = CheckKinstoneFused(unk2->unk_00[1]);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckKinstoneFused(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = CheckKinstoneFused(context->scriptInstructionPointer[1]);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E42C(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp, tmp2;
- s32 tmp3;
- tmp = unk2->unk_00[1];
- tmp2 = unk2->unk_00[2];
- if (!tmp) {
- tmp = gRoomVars.itemForSaleIndex;
+void ScriptCommand_BuyItem(Entity* entity, ScriptExecutionContext* context) {
+ u32 item, tmp2;
+ s32 price;
+ item = context->scriptInstructionPointer[1];
+ tmp2 = context->scriptInstructionPointer[2];
+ if (!item) {
+ item = gRoomVars.itemForSaleIndex;
tmp2 = gRoomVars.field_0x7;
}
- tmp3 = sub_08053FE0(tmp);
- unk2->unk_14 = (tmp3 <= gSave.stats.rupees);
- if (unk2->unk_14) {
- ModRupees(-tmp3);
- sub_080A7C18(tmp, tmp2, 0);
+ price = GetItemPrice(item);
+ context->condition = (price <= gSave.stats.rupees);
+ if (context->condition) {
+ ModRupees(-price);
+ sub_080A7C18(item, tmp2, 0);
gRoomVars.itemForSaleIndex = 0;
gRoomVars.field_0x7 = 0;
}
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E48C(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = sub_080544DC(unk2->unk_00[1]);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E48C(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = sub_080544DC(context->scriptInstructionPointer[1]);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E4AC(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = !!gRoomVars.itemForSaleIndex;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_HasRoomItemForSale(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = !!gRoomVars.itemForSaleIndex;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E4CC(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = !!(unk2->unk_04 & unk2->unk_00[1]);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E4CC(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = !!(context->intVariable & context->scriptInstructionPointer[1]);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E4EC(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp = unk2->unk_00[1];
- unk2->unk_14 = tmp == (tmp & unk2->unk_04);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E4EC(Entity* entity, ScriptExecutionContext* context) {
+ u32 tmp = context->scriptInstructionPointer[1];
+ context->condition = tmp == (tmp & context->intVariable);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E514(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp = unk2->unk_00[1];
- unk2->unk_14 = tmp == unk2->unk_04;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E514(Entity* entity, ScriptExecutionContext* context) {
+ u32 tmp = context->scriptInstructionPointer[1];
+ context->condition = tmp == context->intVariable;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E538(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = !!(GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00) & gPlayerState.flags.all);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_CheckPlayerFlags(Entity* entity, ScriptExecutionContext* context) {
+ context->condition =
+ !!(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer) & gPlayerState.flags.all);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E564(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = (gPlayerState.flags.all >> 7) & 1;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E564(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = (gPlayerState.flags.all >> 7) & 1;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E584(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = unk1->height.WORD != 0;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_EntityHasHeight(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = entity->height.WORD != 0;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E5A0(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = unk2->unk_00[1] == gPlayerEntity.action;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_ComparePlayerAction(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = context->scriptInstructionPointer[1] == gPlayerEntity.action;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E5CC(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_14 = unk2->unk_00[1] == gPlayerEntity.animationState;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_ComparePlayerAnimationState(Entity* entity, ScriptExecutionContext* context) {
+ context->condition = context->scriptInstructionPointer[1] == gPlayerEntity.animationState;
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807E5F8(Entity* unk1, ScriptExecutionContext* unk2) {
- gUnk_02033280.unk_00 |= GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_0807E5F8(Entity* entity, ScriptExecutionContext* context) {
+ gActiveScriptInfo.unk_00 |= GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
}
-void sub_0807E610(Entity* unk1, ScriptExecutionContext* unk2) {
- gUnk_02033280.unk_00 &= ~GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_0807E610(Entity* entity, ScriptExecutionContext* context) {
+ gActiveScriptInfo.unk_00 &= ~GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
}
-void sub_0807E628(Entity* unk1, ScriptExecutionContext* unk2) {
- SetLocalFlag(unk2->unk_00[1]);
+void ScriptCommand_SetLocalFlag(Entity* entity, ScriptExecutionContext* context) {
+ SetLocalFlag(context->scriptInstructionPointer[1]);
}
-void sub_0807E634(Entity* unk1, ScriptExecutionContext* unk2) {
- SetLocalFlagByOffset(unk2->unk_00[1], unk2->unk_00[2]);
+void ScriptCommand_SetLocalFlagByOffset(Entity* entity, ScriptExecutionContext* context) {
+ SetLocalFlagByOffset(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]);
}
-void sub_0807E644(Entity* unk1, ScriptExecutionContext* unk2) {
- ClearLocalFlag(unk2->unk_00[1]);
+void ScriptCommand_ClearLocalFlag(Entity* entity, ScriptExecutionContext* context) {
+ ClearLocalFlag(context->scriptInstructionPointer[1]);
}
-void sub_0807E650(Entity* unk1, ScriptExecutionContext* unk2) {
- SetGlobalFlag(unk2->unk_00[1]);
+void ScriptCommand_SetGlobalFlag(Entity* entity, ScriptExecutionContext* context) {
+ SetGlobalFlag(context->scriptInstructionPointer[1]);
}
-void sub_0807E65C(Entity* unk1, ScriptExecutionContext* unk2) {
- ClearGlobalFlag(unk2->unk_00[1]);
+void ScriptCommand_ClearGlobalFlag(Entity* entity, ScriptExecutionContext* context) {
+ ClearGlobalFlag(context->scriptInstructionPointer[1]);
}
-void sub_0807E668(Entity* unk1, ScriptExecutionContext* unk2) {
- SetRoomFlag(unk2->unk_00[1]);
+void ScriptCommand_SetRoomFlag(Entity* entity, ScriptExecutionContext* context) {
+ SetRoomFlag(context->scriptInstructionPointer[1]);
}
-void sub_0807E674(Entity* unk1, ScriptExecutionContext* unk2) {
- ClearRoomFlag(unk2->unk_00[1]);
+void ScriptCommand_ClearRoomFlag(Entity* entity, ScriptExecutionContext* context) {
+ ClearRoomFlag(context->scriptInstructionPointer[1]);
}
-void sub_0807E680(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_10 = GetNextScriptCommandHalfwordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_Wait(Entity* entity, ScriptExecutionContext* context) {
+ context->wait = GetNextScriptCommandHalfwordAfterCommandMetadata(context->scriptInstructionPointer);
}
-void sub_0807E690(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
- if ((gUnk_02033280.unk_00 & tmp) != tmp) {
- gUnk_02033280.unk_06 = 0;
+void ScriptCommand_WaitForSomething(Entity* entity, ScriptExecutionContext* context) {
+ u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
+ if ((gActiveScriptInfo.unk_00 & tmp) != tmp) {
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807E6AC(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
- if ((gUnk_02033280.unk_00 & tmp) != tmp) {
- gUnk_02033280.unk_06 = 0;
+void ScriptCommand_WaitForSomething2(Entity* entity, ScriptExecutionContext* context) {
+ u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
+ if ((gActiveScriptInfo.unk_00 & tmp) != tmp) {
+ gActiveScriptInfo.commandSize = 0;
} else {
- gUnk_02033280.unk_00 &= ~tmp;
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.unk_00 &= ~tmp;
+ gActiveScriptInfo.flags |= 1;
}
}
-void sub_0807E6DC(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_WaitPlayerAction8(Entity* entity, ScriptExecutionContext* context) {
if (gPlayerEntity.action == 8) {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
} else {
- unk2->unk_10 = 0x2D;
+ context->wait = 0x2D;
}
}
-void sub_0807E700(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_WaitForPlayerAction0x17(Entity* entity, ScriptExecutionContext* context) {
if (gPlayerEntity.action != 0x17) {
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.flags |= 1;
} else {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807E72C(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_WaitFor_1(Entity* entity, ScriptExecutionContext* context) {
if (gRoomControls.unk6 & 4) {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
} else {
- gUnk_02033280.unk_07 |= 1;
+ gActiveScriptInfo.flags |= 1;
}
}
-void sub_0807E75C(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_WaitFor_2(Entity* entity, ScriptExecutionContext* context) {
if (gFadeControl.active) {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807E778(Entity* unk1, ScriptExecutionContext* unk2) {
- gUnk_02033280.unk_08 = unk2->unk_00[1];
+void ScriptCommand_0807E778(Entity* entity, ScriptExecutionContext* context) {
+ gActiveScriptInfo.unk_08 = context->scriptInstructionPointer[1];
}
-void sub_0807E788(Entity* unk1, ScriptExecutionContext* unk2) {
- gFadeControl.field_0x4 = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_0807E788(Entity* entity, ScriptExecutionContext* context) {
+ gFadeControl.field_0x4 = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
}
-void sub_0807E79C(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_080500F4(gUnk_02033280.unk_08);
+void ScriptCommand_0807E79C(Entity* entity, ScriptExecutionContext* context) {
+ sub_080500F4(gActiveScriptInfo.unk_08);
}
-void nullsub_508(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommandNop2(Entity* entity, ScriptExecutionContext* context) {
}
-void sub_0807E7B0(Entity* unk1, ScriptExecutionContext* unk2) {
- DoFade(4, gUnk_02033280.unk_08);
+void ScriptCommand_DoFade4(Entity* entity, ScriptExecutionContext* context) {
+ DoFade(4, gActiveScriptInfo.unk_08);
}
-void sub_0807E7C4(Entity* unk1, ScriptExecutionContext* unk2) {
- DoFade(5, gUnk_02033280.unk_08);
+void ScriptCommand_DoFade5(Entity* entity, ScriptExecutionContext* context) {
+ DoFade(5, gActiveScriptInfo.unk_08);
}
-void sub_0807E7D8(Entity* unk1, ScriptExecutionContext* unk2) {
- DoFade(6, gUnk_02033280.unk_08);
+void ScriptCommand_DoFade6(Entity* entity, ScriptExecutionContext* context) {
+ DoFade(6, gActiveScriptInfo.unk_08);
}
-void sub_0807E7EC(Entity* unk1, ScriptExecutionContext* unk2) {
- DoFade(7, gUnk_02033280.unk_08);
+void ScriptCommand_DoFade7(Entity* entity, ScriptExecutionContext* context) {
+ DoFade(7, gActiveScriptInfo.unk_08);
}
-void sub_0807E800(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E800(Entity* entity, ScriptExecutionContext* context) {
sub_0807E818(0x10);
}
-void sub_0807E80C(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E80C(Entity* entity, ScriptExecutionContext* context) {
sub_0807E818(0x11);
}
void sub_0807E818(u32 unk1) {
- Entity* tmp = gRoomControls.cameraTarget;
- u32 tmp2, tmp3;
- if (tmp) {
- tmp2 = tmp->x.HALF.HI - gRoomControls.roomScrollX;
- tmp3 = tmp->y.HALF.HI - gRoomControls.roomScrollY;
+ Entity* cameraTarget = gRoomControls.cameraTarget;
+ u32 x, y;
+ if (cameraTarget) {
+ x = cameraTarget->x.HALF.HI - gRoomControls.roomScrollX;
+ y = cameraTarget->y.HALF.HI - gRoomControls.roomScrollY;
} else {
- tmp2 = 0x78;
- tmp3 = 0x50;
+ x = 0x78;
+ y = 0x50;
}
- sub_08050110(tmp2, tmp3, unk1, gUnk_02033280.unk_08);
+ sub_08050110(x, y, unk1, gActiveScriptInfo.unk_08);
}
-void sub_0807E858(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_08050038(unk2->unk_00[1]);
+void ScriptCommand_0807E858(Entity* entity, ScriptExecutionContext* context) {
+ sub_08050038(context->scriptInstructionPointer[1]);
}
-void sub_0807E864(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E864(Entity* entity, ScriptExecutionContext* context) {
gPlayerState.field_0x8b = 3;
sub_08078B48();
}
-void sub_0807E878(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E878(Entity* entity, ScriptExecutionContext* context) {
gPlayerState.field_0x8b = 1;
}
-void sub_0807E888(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E888(Entity* entity, ScriptExecutionContext* context) {
gPlayerState.field_0x8b = 3;
}
-void sub_0807E898(Entity* unk1, ScriptExecutionContext* unk2) {
- u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_SetPlayerAction(Entity* entity, ScriptExecutionContext* context) {
+ u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
gPlayerState.playerAction = tmp;
gPlayerState.field_0x38 = tmp >> 8;
gPlayerState.field_0x39 = tmp >> 0x10;
gPlayerState.field_0x3a = tmp >> 0x18;
}
-void sub_0807E8C4(Entity* unk1, ScriptExecutionContext* unk2) {
- StartPlayerScript((u16*)GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00));
+void ScriptCommand_StartPlayerScript(Entity* entity, ScriptExecutionContext* context) {
+ StartPlayerScript((u16*)GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer));
}
-void sub_0807E8D4(Entity* unk1, ScriptExecutionContext* unk2) {
- gPlayerState.field_0x8 = unk2->unk_00[1];
+void ScriptCommand_0807E8D4(Entity* entity, ScriptExecutionContext* context) {
+ gPlayerState.field_0x8 = context->scriptInstructionPointer[1];
}
-void sub_0807E8E4(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E8E4(Entity* entity, ScriptExecutionContext* context) {
u32 tmp = (gUnk_08016984 & 0x3FF);
u32 tmp2;
- gPlayerEntity.animationState = tmp2 = (unk2->unk_00[0] - tmp) << 1;
+ gPlayerEntity.animationState = tmp2 = (context->scriptInstructionPointer[0] - tmp) << 1;
}
-void sub_0807E908(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->action = unk2->unk_00[1];
- unk1->previousActionFlag = 0;
+void ScriptCommand_0807E908(Entity* entity, ScriptExecutionContext* context) {
+ entity->action = context->scriptInstructionPointer[1];
+ entity->previousActionFlag = 0;
}
-void sub_0807E914(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_04 = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_SetIntVariable(Entity* entity, ScriptExecutionContext* context) {
+ context->intVariable = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
}
-void sub_0807E924(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_04 = unk1->frames.all;
- unk1->frames.all = 0;
+void ScriptCommand_0807E924(Entity* entity, ScriptExecutionContext* context) {
+ context->intVariable = entity->frames.all;
+ entity->frames.all = 0;
}
-void sub_0807E930(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->field_0x80.HWORD = unk2->unk_00[1];
- InitAnimationForceUpdate(unk1, unk2->unk_00[1]);
+void ScriptCommand_0807E930(Entity* entity, ScriptExecutionContext* context) {
+ entity->field_0x80.HWORD = context->scriptInstructionPointer[1];
+ InitAnimationForceUpdate(entity, context->scriptInstructionPointer[1]);
}
-void sub_0807E944(Entity* unk1, ScriptExecutionContext* unk2) {
- if (unk1->interactType) {
- unk1->interactType = 0;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807E944(Entity* entity, ScriptExecutionContext* context) {
+ if (entity->interactType) {
+ entity->interactType = 0;
+ gActiveScriptInfo.flags |= 1;
} else {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807E974(Entity* unk1, ScriptExecutionContext* unk2) {
- switch (unk2->unk_18) {
+void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context) {
+ switch (context->unk_18) {
default:
- if (!--unk2->unk_19)
+ if (!--context->unk_19)
return;
break;
case 0:
- if (!unk1->interactType)
+ if (!entity->interactType)
break;
- unk1->interactType = 0;
- unk2->unk_18++;
- TextboxNoOverlapFollow(unk2->unk_00[1]);
+ entity->interactType = 0;
+ context->unk_18++;
+ TextboxNoOverlapFollow(context->scriptInstructionPointer[1]);
break;
case 1:
if (gTextBox.doTextBox & 0x7F)
break;
- unk2->unk_18 = 2;
- unk2->unk_19 = 0xF;
+ context->unk_18 = 2;
+ context->unk_19 = 0xF;
break;
}
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
-void sub_0807E9D4(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_08078778(unk1);
+void ScriptCommand_0807E9D4(Entity* entity, ScriptExecutionContext* context) {
+ sub_08078778(entity);
}
-void sub_0807E9DC(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_080788E0(unk1);
+void ScriptCommand_0807E9DC(Entity* entity, ScriptExecutionContext* context) {
+ sub_080788E0(entity);
}
-void sub_0807E9E4(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_08078784(unk1, unk2->unk_00[1]);
+void ScriptCommand_0807E9E4(Entity* entity, ScriptExecutionContext* context) {
+ sub_08078784(entity, context->scriptInstructionPointer[1]);
}
-void sub_0807E9F0(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) {
u32 tmp;
sub_0801E00C();
tmp = 1;
@@ -1034,10 +1156,10 @@ void sub_0807E9F0(Entity* unk1, ScriptExecutionContext* unk2) {
case 2:
gPlayerState.field_0x8b = 3;
gUnk_02034490[0] = tmp;
- unk2->unk_14 = tmp;
+ context->condition = tmp;
break;
case 1:
- unk2->unk_14 = 0;
+ context->condition = 0;
break;
default:
goto lbl;
@@ -1047,351 +1169,356 @@ void sub_0807E9F0(Entity* unk1, ScriptExecutionContext* unk2) {
gPlayerState.field_0x8b = 1;
} else {
lbl:
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EA4C(Entity* unk1, ScriptExecutionContext* unk2) {
- if (unk1->interactType == 2) {
- sub_0801DFB4(unk1, 0, 0, 0);
- unk1->interactType = 0;
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context) {
+ if (entity->interactType == 2) {
+ sub_0801DFB4(entity, 0, 0, 0);
+ entity->interactType = 0;
+ gActiveScriptInfo.flags |= 1;
} else {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EA88(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_08078790(unk1, unk2->unk_00[1]);
+void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context) {
+ sub_08078790(entity, context->scriptInstructionPointer[1]);
}
-void sub_0807EA94(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807EA94(Entity* entity, ScriptExecutionContext* context) {
if (gTextBox.doTextBox & 0x7F) {
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EAB4(Entity* unk1, ScriptExecutionContext* unk2) {
- TextboxNoOverlapFollow(unk2->unk_00[1]);
+void ScriptCommand_TextboxNoOverlapFollow(Entity* entity, ScriptExecutionContext* context) {
+ TextboxNoOverlapFollow(context->scriptInstructionPointer[1]);
}
-void sub_0807EAC0(Entity* unk1, ScriptExecutionContext* unk2) {
- TextboxNoOverlap(unk2->unk_00[1], unk1);
+void ScriptCommand_TextboxNoOverlap(Entity* entity, ScriptExecutionContext* context) {
+ TextboxNoOverlap(context->scriptInstructionPointer[1], entity);
}
-void sub_0807EAD0(Entity* unk1, ScriptExecutionContext* unk2) {
- TextboxNoOverlapFollow(unk2->unk_00[1]);
+void ScriptCommand_TextboxNoOverlapFollowPos(Entity* entity, ScriptExecutionContext* context) {
+ TextboxNoOverlapFollow(context->scriptInstructionPointer[1]);
gTextBox.textWindowPosX = 1;
- gTextBox.textWindowPosY = unk2->unk_00[2];
+ gTextBox.textWindowPosY = context->scriptInstructionPointer[2];
}
-void sub_0807EAF0(Entity* unk1, ScriptExecutionContext* unk2) {
- if (gUnk_02033280.unk_06 > unk2->unk_04) {
- u16* tmp = unk2->unk_00 + unk2->unk_04;
+void ScriptCommand_TextboxNoOverlapFollowTable(Entity* entity, ScriptExecutionContext* context) {
+ if (gActiveScriptInfo.commandSize > context->intVariable) {
+ u16* tmp = context->scriptInstructionPointer + context->intVariable;
TextboxNoOverlapFollow(tmp[1]);
} else {
TextboxNoOverlapFollow(0);
}
}
-void sub_0807EB18(Entity* unk1, ScriptExecutionContext* unk2) {
- TextboxNoOverlap(unk2->unk_04, unk1);
+void ScriptCommand_TextboxNoOverlapVar(Entity* entity, ScriptExecutionContext* context) {
+ TextboxNoOverlap(context->intVariable, entity);
}
-void sub_0807EB28(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_08078AA8(unk2->unk_00[1], 0);
+void ScriptCommand_0807EB28(Entity* entity, ScriptExecutionContext* context) {
+ sub_08078AA8(context->scriptInstructionPointer[1], 0);
}
-void sub_0807EB38(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_04 = gUnk_02000040.unk_01;
+void ScriptCommand_0807EB38(Entity* entity, ScriptExecutionContext* context) {
+ context->intVariable = gUnk_02000040.unk_01;
}
-void sub_0807EB44(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->animationState = unk2->unk_00[1];
+void ScriptCommand_0807EB44(Entity* entity, ScriptExecutionContext* context) {
+ entity->animationState = context->scriptInstructionPointer[1];
}
-void sub_0807EB4C(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->animationState = sub_0806F5B0(
- sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY));
+void ScriptCommand_0807EB4C(Entity* entity, ScriptExecutionContext* context) {
+ entity->animationState =
+ sub_0806F5B0(sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.roomOriginX,
+ context->scriptInstructionPointer[2] + gRoomControls.roomOriginY));
}
-void sub_0807EB74(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->animationState = sub_0806F5B0(GetFacingDirection(unk1, &gPlayerEntity));
+void ScriptCommand_0807EB74(Entity* entity, ScriptExecutionContext* context) {
+ entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity));
}
-void sub_0807EB8C(Entity* unk1, ScriptExecutionContext* unk2) {
- gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, unk1)) & ~1;
+void ScriptCommand_0807EB8C(Entity* entity, ScriptExecutionContext* context) {
+ gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, entity)) & ~1;
}
-void sub_0807EBA8(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->direction = unk2->unk_00[1];
+void ScriptCommand_SetEntityDirection(Entity* entity, ScriptExecutionContext* context) {
+ entity->direction = context->scriptInstructionPointer[1];
}
-void sub_0807EBB0(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->direction = unk2->unk_00[1];
- unk1->animationState = unk1->direction / 4;
+void ScriptCommand_SetEntityDirectionWithAnimationState(Entity* entity, ScriptExecutionContext* context) {
+ entity->direction = context->scriptInstructionPointer[1];
+ entity->animationState = entity->direction / 4;
}
-void sub_0807EBC0(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->nonPlanarMovement = unk2->unk_00[1];
+void ScriptCommand_SetEntitySpeed(Entity* entity, ScriptExecutionContext* context) {
+ entity->speed = context->scriptInstructionPointer[1];
}
-void sub_0807EBC8(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->field_0x20 = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
+void ScriptCommand_SetEntity0x20(Entity* entity, ScriptExecutionContext* context) {
+ entity->field_0x20 = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer);
}
-void sub_0807EBD8(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->x.HALF.HI = gRoomControls.roomOriginX + unk2->unk_00[1];
- unk1->y.HALF.HI = gRoomControls.roomOriginY + unk2->unk_00[2];
+void ScriptCommand_SetEntityPositionRelative(Entity* entity, ScriptExecutionContext* context) {
+ entity->x.HALF.HI = gRoomControls.roomOriginX + context->scriptInstructionPointer[1];
+ entity->y.HALF.HI = gRoomControls.roomOriginY + context->scriptInstructionPointer[2];
}
-void sub_0807EBF4(Entity* unk1, ScriptExecutionContext* unk2) {
- unk1->x.HALF.HI += unk2->unk_00[1];
- unk1->y.HALF.HI += unk2->unk_00[2];
+void ScriptCommand_SetEntityPosition(Entity* entity, ScriptExecutionContext* context) {
+ entity->x.HALF.HI += context->scriptInstructionPointer[1];
+ entity->y.HALF.HI += context->scriptInstructionPointer[2];
}
-void sub_0807EC08(Entity* unk1, ScriptExecutionContext* unk2) {
- CopyPosition(&gPlayerEntity, unk1);
+void ScriptCommand_MoveEntityToPlayer(Entity* entity, ScriptExecutionContext* context) {
+ CopyPosition(&gPlayerEntity, entity);
}
-void nullsub_509(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommandNop3(Entity* entity, ScriptExecutionContext* context) {
}
-void sub_0807EC1C(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- unk2->unk_12 = unk2->unk_00[1];
- unk2->unk_08 |= 2;
+void ScriptCommand_0807EC1C(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ context->unk_12 = context->scriptInstructionPointer[1];
+ context->postScriptActions |= 2;
}
- sub_0807EC44(unk1, unk2);
+ sub_0807EC44(entity, context);
}
-void sub_0807EC44(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_0806F69C(unk1);
- if (--unk2->unk_12) {
- gUnk_02033280.unk_06 = 0;
+void sub_0807EC44(Entity* entity, ScriptExecutionContext* context) {
+ sub_0806F69C(entity);
+ if (--context->unk_12) {
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EC64(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- unk2->unk_12 = unk2->unk_00[1];
- unk1->animationState = 0;
- unk1->direction = 0;
- unk2->unk_08 |= 2;
+void ScriptCommand_0807EC64(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ context->unk_12 = context->scriptInstructionPointer[1];
+ entity->animationState = 0;
+ entity->direction = 0;
+ context->postScriptActions |= 2;
}
- sub_0807EC44(unk1, unk2);
+ sub_0807EC44(entity, context);
}
-void sub_0807EC94(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- unk2->unk_12 = unk2->unk_00[1];
- unk1->animationState = 2;
- unk1->direction = 8;
- unk2->unk_08 |= 2;
+void ScriptCommand_0807EC94(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ context->unk_12 = context->scriptInstructionPointer[1];
+ entity->animationState = 2;
+ entity->direction = 8;
+ context->postScriptActions |= 2;
}
- sub_0807EC44(unk1, unk2);
+ sub_0807EC44(entity, context);
}
-void sub_0807ECC4(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- unk2->unk_12 = unk2->unk_00[1];
- unk1->animationState = 4;
- unk1->direction = 0x10;
- unk2->unk_08 |= 2;
+void ScriptCommand_0807ECC4(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ context->unk_12 = context->scriptInstructionPointer[1];
+ entity->animationState = 4;
+ entity->direction = 0x10;
+ context->postScriptActions |= 2;
}
- sub_0807EC44(unk1, unk2);
+ sub_0807EC44(entity, context);
}
-void sub_0807ECF4(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- unk2->unk_12 = unk2->unk_00[1];
- unk1->animationState = 6;
- unk1->direction = 0x18;
- unk2->unk_08 |= 2;
+void ScriptCommand_0807ECF4(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ context->unk_12 = context->scriptInstructionPointer[1];
+ entity->animationState = 6;
+ entity->direction = 0x18;
+ context->postScriptActions |= 2;
}
- sub_0807EC44(unk1, unk2);
+ sub_0807EC44(entity, context);
}
-void sub_0807ED24(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
+void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
s32 tmp, tmp2, tmp3;
- unk2->unk_18 = 1;
- unk2->unk_12 = unk2->unk_00[3];
- tmp = unk2->unk_00[1];
- tmp2 = unk1->x.HALF.HI - gRoomControls.roomOriginX;
- unk2->unk_1C.WORD = ((tmp - tmp2) << 0x10) / unk2->unk_12;
- tmp = unk2->unk_00[2];
- tmp3 = unk1->y.HALF.HI - gRoomControls.roomOriginY;
- unk2->unk_20.WORD = ((tmp - tmp3) << 0x10) / unk2->unk_12;
- unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX,
- unk2->unk_00[2] + gRoomControls.roomOriginY));
- unk2->unk_08 |= 2;
+ context->unk_18 = 1;
+ context->unk_12 = context->scriptInstructionPointer[3];
+ tmp = context->scriptInstructionPointer[1];
+ tmp2 = entity->x.HALF.HI - gRoomControls.roomOriginX;
+ context->x.WORD = ((tmp - tmp2) << 0x10) / context->unk_12;
+ tmp = context->scriptInstructionPointer[2];
+ tmp3 = entity->y.HALF.HI - gRoomControls.roomOriginY;
+ context->y.WORD = ((tmp - tmp3) << 0x10) / context->unk_12;
+ entity->animationState =
+ sub_0806F5B0(sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.roomOriginX,
+ context->scriptInstructionPointer[2] + gRoomControls.roomOriginY));
+ context->postScriptActions |= 2;
} else {
- if (!--unk2->unk_12) {
- unk1->x.HALF.HI = unk2->unk_00[1] + gRoomControls.roomOriginX;
- unk1->y.HALF.HI = unk2->unk_00[2] + gRoomControls.roomOriginY;
+ if (!--context->unk_12) {
+ entity->x.HALF.HI = context->scriptInstructionPointer[1] + gRoomControls.roomOriginX;
+ entity->y.HALF.HI = context->scriptInstructionPointer[2] + gRoomControls.roomOriginY;
return;
}
- unk1->x.WORD += unk2->unk_1C.WORD;
- unk1->y.WORD += unk2->unk_20.WORD;
+ entity->x.WORD += context->x.WORD;
+ entity->y.WORD += context->y.WORD;
}
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
-void sub_0807EDD4(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- sub_0807EE04(unk1, unk2);
+void ScriptCommand_0807EDD4(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ ScriptCommand_0807EE04(entity, context);
}
- sub_0807EE30(unk1, unk2);
- if (!unk2->unk_14) {
- gUnk_02033280.unk_06 = 0;
+ ScriptCommand_0807EE30(entity, context);
+ if (!context->condition) {
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EE04(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_0807DEDC(unk1, unk2, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY);
- gUnk_02033280.unk_07 |= 1;
+void ScriptCommand_0807EE04(Entity* entity, ScriptExecutionContext* context) {
+ sub_0807DEDC(entity, context, context->scriptInstructionPointer[1] + gRoomControls.roomOriginX,
+ context->scriptInstructionPointer[2] + gRoomControls.roomOriginY);
+ gActiveScriptInfo.flags |= 1;
}
-void sub_0807EE30(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context) {
s32 tmp, tmp2;
- if (!--unk2->unk_19) {
- unk2->unk_19 = 8;
- unk1->direction = sub_080045DA(unk2->unk_1C.HALF.HI - unk1->x.HALF.HI, unk2->unk_20.HALF.HI - unk1->y.HALF.HI);
+ if (!--context->unk_19) {
+ context->unk_19 = 8;
+ entity->direction =
+ sub_080045DA(context->x.HALF.HI - entity->x.HALF.HI, context->y.HALF.HI - entity->y.HALF.HI);
}
- tmp = unk1->x.HALF.HI - unk2->unk_1C.HALF.HI;
- tmp2 = unk1->y.HALF.HI - unk2->unk_20.HALF.HI;
- sub_0806F62C(unk1, unk1->nonPlanarMovement, unk1->direction);
- tmp *= unk1->x.HALF.HI - unk2->unk_1C.HALF.HI;
- tmp2 *= unk1->y.HALF.HI - unk2->unk_20.HALF.HI;
+ tmp = entity->x.HALF.HI - context->x.HALF.HI;
+ tmp2 = entity->y.HALF.HI - context->y.HALF.HI;
+ sub_0806F62C(entity, entity->speed, entity->direction);
+ tmp *= entity->x.HALF.HI - context->x.HALF.HI;
+ tmp2 *= entity->y.HALF.HI - context->y.HALF.HI;
if (tmp <= 0 && tmp2 <= 0) {
- unk1->x.HALF.HI = unk2->unk_1C.HALF.HI;
- unk1->y.HALF.HI = unk2->unk_20.HALF.HI;
- unk2->unk_14 = 1;
+ entity->x.HALF.HI = context->x.HALF.HI;
+ entity->y.HALF.HI = context->y.HALF.HI;
+ context->condition = 1;
} else {
- unk2->unk_14 = 0;
+ context->condition = 0;
}
}
-void sub_0807EEB4(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- sub_0807DEDC(unk1, unk2, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
+void ScriptCommand_0807EEB4(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ sub_0807DEDC(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
}
- sub_0807EE30(unk1, unk2);
- if (!unk2->unk_14) {
- gUnk_02033280.unk_06 = 0;
+ ScriptCommand_0807EE30(entity, context);
+ if (!context->condition) {
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EEF4(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- sub_0807DEDC(unk1, unk2, unk1->x.HALF.HI + ((s16)unk2->unk_00[1]), unk1->y.HALF.HI + ((s16)unk2->unk_00[2]));
+void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ sub_0807DEDC(entity, context, entity->x.HALF.HI + ((s16)context->scriptInstructionPointer[1]),
+ entity->y.HALF.HI + ((s16)context->scriptInstructionPointer[2]));
}
- sub_0807EE30(unk1, unk2);
- if (!unk2->unk_14) {
- gUnk_02033280.unk_06 = 0;
+ ScriptCommand_0807EE30(entity, context);
+ if (!context->condition) {
+ gActiveScriptInfo.commandSize = 0;
}
}
-void sub_0807EF3C(Entity* unk1, ScriptExecutionContext* unk2) {
- if (!unk2->unk_18) {
- unk2->unk_18 = 1;
- unk1->field_0x20 = ((s16)unk2->unk_00[1]) << 8;
- unk2->unk_1C.HALF.LO = unk2->unk_00[2] << 8;
- sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO);
+void ScriptCommand_0807EF3C(Entity* entity, ScriptExecutionContext* context) {
+ if (!context->unk_18) {
+ context->unk_18 = 1;
+ entity->field_0x20 = ((s16)context->scriptInstructionPointer[1]) << 8;
+ context->x.HALF.LO = context->scriptInstructionPointer[2] << 8;
+ sub_08003FC4(entity, (u16)context->x.HALF.LO);
} else {
- if (!sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO))
+ if (!sub_08003FC4(entity, (u16)context->x.HALF.LO))
return;
}
- gUnk_02033280.unk_06 = 0;
+ gActiveScriptInfo.commandSize = 0;
}
-void sub_0807EF80(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_08 |= 1 << unk2->unk_00[1];
+void ScriptCommand_DoPostScriptAction(Entity* entity, ScriptExecutionContext* context) {
+ context->postScriptActions |= 1 << context->scriptInstructionPointer[1];
}
-void sub_0807EF90(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_08 |= 1 << unk2->unk_00[1];
+void ScriptCommand_DoPostScriptAction2(Entity* entity, ScriptExecutionContext* context) {
+ context->postScriptActions |= 1 << context->scriptInstructionPointer[1];
}
-void sub_0807EFA0(Entity* unk1, ScriptExecutionContext* unk2) {
- SoundReq(unk2->unk_00[1]);
+void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context) {
+ SoundReq(context->scriptInstructionPointer[1]);
}
-void sub_0807EFAC(Entity* unk1, ScriptExecutionContext* unk2) {
- if (unk2->unk_00[1] >= 100) {
+void ScriptCommand_SoundReq2(Entity* entity, ScriptExecutionContext* context) {
+ if (context->scriptInstructionPointer[1] >= 100) {
SoundReq(gArea.musicIndex);
} else {
- SoundReq(unk2->unk_00[1]);
+ SoundReq(context->scriptInstructionPointer[1]);
}
}
-void sub_0807EFD4(Entity* unk1, ScriptExecutionContext* unk2) {
- SoundReq(GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00));
+void ScriptCommand_SoundReq3(Entity* entity, ScriptExecutionContext* context) {
+ SoundReq(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer));
}
-void sub_0807EFE4(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_SoundReq0x80100000(Entity* entity, ScriptExecutionContext* context) {
SoundReq(0x80100000);
}
-void sub_0807EFF4(Entity* unk1, ScriptExecutionContext* unk2) {
- ModRupees((s16)unk2->unk_00[1]);
+void ScriptCommand_ModRupees(Entity* entity, ScriptExecutionContext* context) {
+ ModRupees((s16)context->scriptInstructionPointer[1]);
}
-void sub_0807F004(Entity* unk1, ScriptExecutionContext* unk2) {
- ModHealth(unk2->unk_00[1]);
+void ScriptCommand_ModHealth(Entity* entity, ScriptExecutionContext* context) {
+ ModHealth(context->scriptInstructionPointer[1]);
}
-void sub_0807F010(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_IncreaseMaxHealth(Entity* entity, ScriptExecutionContext* context) {
gSave.stats.maxHealth = min(gSave.stats.maxHealth + 8, 0xA0);
gSave.stats.health = gSave.stats.maxHealth;
}
-void sub_0807F034(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_0807F034(Entity* entity, ScriptExecutionContext* context) {
u32 tmp = 0;
- if (unk2->unk_00[1] == 0x3F) {
- tmp = unk2->unk_04;
+ if (context->scriptInstructionPointer[1] == 0x3F) {
+ tmp = context->intVariable;
}
- sub_080A7C18(unk2->unk_00[1], tmp, 0);
+ sub_080A7C18(context->scriptInstructionPointer[1], tmp, 0);
}
-void sub_0807F050(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_080A7C18(0x5C, unk2->unk_00[1], 0);
+void ScriptCommand_0807F050(Entity* entity, ScriptExecutionContext* context) {
+ sub_080A7C18(0x5C, context->scriptInstructionPointer[1], 0);
}
-void sub_0807F060(Entity* unk1, ScriptExecutionContext* unk2) {
- unk2->unk_04 = GetInventoryValue(unk2->unk_00[1]);
- unk2->unk_14 = unk2->unk_04 != 0;
+void ScriptCommand_GetInventoryValue(Entity* entity, ScriptExecutionContext* context) {
+ context->intVariable = GetInventoryValue(context->scriptInstructionPointer[1]);
+ context->condition = context->intVariable != 0;
}
-void sub_0807F078(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_0807CAA0(unk2->unk_00[1], unk2->unk_00[2]);
+void ScriptCommand_0807F078(Entity* entity, ScriptExecutionContext* context) {
+ sub_0807CAA0(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]);
}
-void sub_0807F088(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_080A7C18(unk2->unk_00[1], 0, 3);
+void ScriptCommand_0807F088(Entity* entity, ScriptExecutionContext* context) {
+ sub_080A7C18(context->scriptInstructionPointer[1], 0, 3);
}
-void sub_0807F098(Entity* unk1, ScriptExecutionContext* unk2) {
- gRoomControls.cameraTarget = unk1;
+void ScriptCommand_CameraTargetEntity(Entity* entity, ScriptExecutionContext* context) {
+ gRoomControls.cameraTarget = entity;
}
-void sub_0807F0A4(Entity* unk1, ScriptExecutionContext* unk2) {
+void ScriptCommand_CameraTargetPlayer(Entity* entity, ScriptExecutionContext* context) {
gRoomControls.cameraTarget = &gPlayerEntity;
}
-void sub_0807F0B4(Entity* unk1, ScriptExecutionContext* unk2) {
- gRoomControls.unk5 = unk2->unk_00[1] & 7;
+void ScriptCommand_0807F0B4(Entity* entity, ScriptExecutionContext* context) {
+ gRoomControls.unk5 = context->scriptInstructionPointer[1] & 7;
}
-void sub_0807F0C8(Entity* unk1, ScriptExecutionContext* unk2) {
- sub_08080964(unk2->unk_00[1], unk2->unk_00[2]);
+void ScriptCommand_0807F0C8(Entity* entity, ScriptExecutionContext* context) {
+ sub_08080964(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]);
}