diff options
| author | Henny022p <info@henny022.de> | 2021-03-15 22:56:23 +0100 |
|---|---|---|
| committer | Henny022p <info@henny022.de> | 2021-03-15 22:56:23 +0100 |
| commit | a2cdfd6d8dd910aa402b7e6bdf32278ac9b80c50 (patch) | |
| tree | dd9524198ad151c49eb01e92f46743e6e306673e /src/object | |
| parent | aac7eb743646634c1476141ba5d07da53ab56193 (diff) | |
| parent | e09678c6ab4d6c1070495cf8b49b8b3dffefc4af (diff) | |
Merge branch 'master' into cleanup_declarations
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/backgroundCloud.c | 2 | ||||
| -rw-r--r-- | src/object/bird.c | 2 | ||||
| -rw-r--r-- | src/object/cloud.c | 2 | ||||
| -rw-r--r-- | src/object/fileScreenObjects.c | 4 | ||||
| -rw-r--r-- | src/object/greatFairy.c | 29 | ||||
| -rw-r--r-- | src/object/houseDoorExterior.c | 15 | ||||
| -rw-r--r-- | src/object/itemOnGround.c | 6 | ||||
| -rw-r--r-- | src/object/metalDoor.c | 2 | ||||
| -rw-r--r-- | src/object/minecart.c | 8 | ||||
| -rw-r--r-- | src/object/object1A.c | 2 | ||||
| -rw-r--r-- | src/object/objectA2.c | 2 | ||||
| -rw-r--r-- | src/object/objectB2.c | 4 | ||||
| -rw-r--r-- | src/object/pot.c | 6 | ||||
| -rw-r--r-- | src/object/smoke.c | 2 | ||||
| -rw-r--r-- | src/object/windcrest.c | 5 |
15 files changed, 45 insertions, 46 deletions
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) { |
