summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-08-08 20:03:12 +0300
committerTal Hayon <talhayon1@gmail.com>2022-08-08 20:03:12 +0300
commit79bae9cd8a7891dd4545649fa196aad5a36237d2 (patch)
tree1e59403522cbeeaa36c33ca34662f17c49866639 /src/object
parent22cbdd2fd645a5525a6ef0c9b8ee8ec11af9e9aa (diff)
Various documentations
Diffstat (limited to 'src/object')
-rw-r--r--src/object/barrelInside.c34
-rw-r--r--src/object/enemyItem.c2
-rw-r--r--src/object/fairy.c2
-rw-r--r--src/object/fourElements.c8
-rw-r--r--src/object/frozenOctorok.c2
-rw-r--r--src/object/gleerokParticle.c4
-rw-r--r--src/object/gyorgBossObject.c4
-rw-r--r--src/object/keyStealingTakkuri.c2
-rw-r--r--src/object/ladderUp.c2
-rw-r--r--src/object/lavaPlatform.c2
-rw-r--r--src/object/lilypadLarge.c4
-rw-r--r--src/object/linkHoldingItem.c28
-rw-r--r--src/object/macroPlayer.c2
-rw-r--r--src/object/minishPortalCloseup.c2
-rw-r--r--src/object/object30.c8
-rw-r--r--src/object/objectA8.c2
-rw-r--r--src/object/whirlwind.c2
17 files changed, 55 insertions, 55 deletions
diff --git a/src/object/barrelInside.c b/src/object/barrelInside.c
index 9c67eeb4..3ef99da4 100644
--- a/src/object/barrelInside.c
+++ b/src/object/barrelInside.c
@@ -6,38 +6,40 @@
*/
#include "entity.h"
-const u8 gUnk_08120C80[];
-const u8 gUnk_08120C92[];
+typedef struct {
+ u8 b3Rendering;
+ u8 b0Priority;
+ u8 flipY;
+} PACKED BarrelInsideSpriteDef;
void BarrelInside(Entity* this) {
- const u8* ptr;
+ static const BarrelInsideSpriteDef spriteDefs[] = {
+ { 2, 5, 2 }, { 2, 5, 2 }, { 3, 4, 2 }, { 3, 6, 3 }, { 3, 5, 3 }, { 3, 6, 3 },
+ };
+
+ static const u8 frameIndices[] = {
+ 4, 6, 7, 0, 0, 0,
+ };
+ const BarrelInsideSpriteDef* ptr;
if (this->action == 0) {
this->action = 1;
this->spriteSettings.draw = 1;
this->frameIndex = this->type;
this->timer = 16;
this->subtimer = 1;
- ptr = gUnk_08120C80 + this->type * 3;
- this->spriteRendering.b3 = *ptr;
- this->spritePriority.b0 = *(ptr + 1);
- this->spriteOrientation.flipY = *(ptr + 2);
+ ptr = &spriteDefs[this->type];
+ this->spriteRendering.b3 = ptr->b3Rendering;
+ this->spritePriority.b0 = ptr->b0Priority;
+ this->spriteOrientation.flipY = ptr->flipY;
}
if (this->type == 4) {
if (--this->timer == 0) {
this->timer = 16;
- this->frameIndex = gUnk_08120C92[this->subtimer++];
+ this->frameIndex = frameIndices[this->subtimer++];
if (this->subtimer == 3) {
this->subtimer = 0;
}
}
}
}
-
-const u8 gUnk_08120C80[] = {
- 2, 5, 2, 2, 5, 2, 3, 4, 2, 3, 6, 3, 3, 5, 3, 3, 6, 3,
-};
-
-const u8 gUnk_08120C92[] = {
- 4, 6, 7, 0, 0, 0,
-};
diff --git a/src/object/enemyItem.c b/src/object/enemyItem.c
index 5a238b52..862f184e 100644
--- a/src/object/enemyItem.c
+++ b/src/object/enemyItem.c
@@ -43,7 +43,7 @@ void EnemyItem(EnemyItemEntity* this) {
if (super->child == NULL) {
sub_080A2534(this);
}
- sub_08054564();
+ DisableRandomDrops();
}
entity = super->child;
if (entity != NULL) {
diff --git a/src/object/fairy.c b/src/object/fairy.c
index 91cda244..8b177ced 100644
--- a/src/object/fairy.c
+++ b/src/object/fairy.c
@@ -214,7 +214,7 @@ void Fairy_Action4(FairyEntity* this) {
}
if (--super->subtimer == 0) {
super->subtimer = 6;
- if (((--super->spriteOffsetY) * 0x1000000) >> 0x18 < -0x16) {
+ if (--super->spriteOffsetY < -0x16) {
sub_08081404(super, 1);
}
}
diff --git a/src/object/fourElements.c b/src/object/fourElements.c
index 1a8f5240..ef79e2f0 100644
--- a/src/object/fourElements.c
+++ b/src/object/fourElements.c
@@ -51,7 +51,7 @@ void FourElements_Init(FourElementsEntity* this) {
super->spritePriority.b1 = 2;
super->spriteRendering.b3 = 1;
super->hitbox = (Hitbox*)&gHitbox_6;
- super->z.HALF.HI = 0xff40;
+ super->z.HALF.HI = -192;
this->unk_6a = 0x40;
switch (super->type) {
case 0x41:
@@ -157,10 +157,10 @@ void sub_080A0424(FourElementsEntity* this) {
}
void sub_080A0444(FourElementsEntity* this) {
- static const u8 gUnk_081248B4[] = {
- 249, 248, 247, 246, 245, 246, 247, 248,
+ static const s8 gUnk_081248B4[] = {
+ -7, -8, -9, -10, -11, -10, -9, -8,
};
- super->z.HALF.HI = gUnk_081248B4[(super->subtimer++ >> 3) & 7] << 0x18 >> 0x18;
+ super->z.HALF.HI = gUnk_081248B4[(super->subtimer++ >> 3) & 7];
}
void sub_080A0464(FourElementsEntity* this, ScriptExecutionContext* context) {
diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c
index 4d497b72..5415125e 100644
--- a/src/object/frozenOctorok.c
+++ b/src/object/frozenOctorok.c
@@ -344,7 +344,7 @@ void sub_0809CB70(FrozenOctorokEntity* this, s32 angle, s32 radius) {
NONMATCH("asm/non_matching/frozenOctorok/sub_0809CBE4.inc", void sub_0809CBE4(FrozenOctorokEntity* this)) {
this->unk_79 += super->subtimer;
if ((s8)super->subtimer < 0) {
- if (super->timer < -(this->unk_79 << 0x18 >> 0x18)) {
+ if (super->timer < -this->unk_79) {
super->subtimer = -super->subtimer;
SoundReq(SFX_19E);
}
diff --git a/src/object/gleerokParticle.c b/src/object/gleerokParticle.c
index e878f2a1..0ab61153 100644
--- a/src/object/gleerokParticle.c
+++ b/src/object/gleerokParticle.c
@@ -130,12 +130,12 @@ void GleerokParticle_Init(GleerokParticleEntity* this) {
this->unk7c = 0xce;
this->unk74 = 0;
if ((ptr->unk4 & 0x40) != 0) {
- this->unk80.HALF.HI = 0xff00;
+ this->unk80.HALF.HI = -0x100;
} else {
this->unk80.HALF.HI = 0x100;
}
if ((ptr->unk4 & 0x80) != 0) {
- this->unk84.HALF.HI = 0xff00;
+ this->unk84.HALF.HI = -0x100;
} else {
this->unk84.HALF.HI = 0x100;
}
diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c
index d9f44c6d..8652b3c4 100644
--- a/src/object/gyorgBossObject.c
+++ b/src/object/gyorgBossObject.c
@@ -102,7 +102,7 @@ void GyorgBossObject_SetupStart(GyorgBossObjectEntity* this) {
this->unk_76 = 0xc0;
this->unk_78 = 0xc0;
gRoomTransition.field_0x39 = 1;
- gPlayerState.flags |= PL_FLAGS20000;
+ gPlayerState.flags |= PL_GYORG_FIGHT;
gPlayerState.startPosX = gRoomControls.origin_x + 0x200;
gPlayerState.startPosY = gRoomControls.origin_y + 0x210;
#ifndef EU
@@ -238,7 +238,7 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) {
this->timer = 420;
super->direction = 0;
super->speed = 0x60;
- gPlayerState.flags &= ~PL_FLAGS20000;
+ gPlayerState.flags &= ~PL_GYORG_FIGHT;
CopyPosition(&gPlayerEntity, super);
gRoomControls.camera_target = super;
SetPlayerControl(2);
diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c
index 1cc970ca..1b166cab 100644
--- a/src/object/keyStealingTakkuri.c
+++ b/src/object/keyStealingTakkuri.c
@@ -284,7 +284,7 @@ void KeyStealingTakkuri_Type3_Init(KeyStealingTakkuriEntity* this) {
ptr = &gUnk_08124132[super->type2 * 2];
super->x.HALF.HI = gRoomControls.origin_x + ptr[0];
super->y.HALF.HI = gRoomControls.origin_y + ptr[1] + 0x40;
- super->z.HALF.HI = 0xffc0;
+ super->z.HALF.HI = -64;
UpdateSpriteForCollisionLayer(super);
InitAnimationForceUpdate(super, gUnk_08124128[super->type2]);
obj = CreateObject(KEY_STEALING_TAKKURI, 1, 0);
diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c
index 1264763e..8743fadc 100644
--- a/src/object/ladderUp.c
+++ b/src/object/ladderUp.c
@@ -31,7 +31,7 @@ void LadderUp(Entity* this) {
this->spriteOffsetY += 8;
InitializeAnimation(this, 10);
if (this->action == 1) {
- this->z.HALF.HI = 0xff80;
+ this->z.HALF.HI = -0x80;
}
if (this->type2) {
return;
diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c
index 016e0e7e..a79e8c4f 100644
--- a/src/object/lavaPlatform.c
+++ b/src/object/lavaPlatform.c
@@ -127,7 +127,7 @@ void LavaPlatform_Type1Action1(LavaPlatformEntity* this) {
super->animationState ^= 1;
InitializeAnimation(super, (u32)super->animationState);
}
- if (--super->spriteOffsetY * 0x1000000 >> 0x18 == -3) {
+ if (--super->spriteOffsetY == -3) {
sub_0809264C(this);
}
}
diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c
index 71a1f443..e03dd38f 100644
--- a/src/object/lilypadLarge.c
+++ b/src/object/lilypadLarge.c
@@ -372,12 +372,12 @@ void sub_08085A98(LilypadLargeEntity* this) {
super->subAction = 2;
if (gArea.locationIndex == 0x1b) {
super->y.HALF.HI += 0xd0;
- super->z.HALF.HI = 0xff30;
+ super->z.HALF.HI = -0xd0;
this->unk_82 = 0x46;
SetLocalFlag(0x73);
} else {
super->y.HALF.HI += 0x40;
- super->z.HALF.HI = 0xffc0;
+ super->z.HALF.HI = -0x40;
this->unk_82 = 0xf;
}
CreateObjectWithParent(super, LILYPAD_LARGE_FALLING, 0, 0);
diff --git a/src/object/linkHoldingItem.c b/src/object/linkHoldingItem.c
index 7f536b5f..d3a98df9 100644
--- a/src/object/linkHoldingItem.c
+++ b/src/object/linkHoldingItem.c
@@ -62,10 +62,10 @@ void LinkHoldingItem_Action1(LinkHoldingItemEntity* this) {
case 1:
this->unk_68 = GiveItem(super->type, super->type2);
switch (super->type) {
- case 0x40:
- case 0x41:
- case 0x42:
- case 0x43:
+ case ITEM_EARTH_ELEMENT:
+ case ITEM_FIRE_ELEMENT:
+ case ITEM_WATER_ELEMENT:
+ case ITEM_WIND_ELEMENT:
break;
default:
SoundReq(SFX_ITEM_GET);
@@ -78,7 +78,7 @@ void LinkHoldingItem_Action1(LinkHoldingItemEntity* this) {
SoundReq(SFX_ITEM_GET);
break;
case 5:
- tmp = GetInventoryValue((u32)super->type);
+ tmp = GetInventoryValue(super->type);
ptr = &gItemMetaData[super->type];
if (tmp == 0) {
this->unk_68 = *(u16*)&ptr->textId;
@@ -109,10 +109,10 @@ void LinkHoldingItem_Action2(LinkHoldingItemEntity* this) {
messageIndex = this->unk_68;
if (messageIndex != 0) {
switch (super->type) {
- case 0x63:
+ case ITEM_HEART_PIECE:
messageIndex += gSave.stats.heartPieces;
break;
- case 0x3f:
+ case ITEM_SHELLS:
if (super->type2 > 1) {
if (messageIndex == TEXT_INDEX(TEXT_ITEM_GET, 0x77)) {
messageIndex--;
@@ -138,11 +138,11 @@ void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) {
case 0:
case 1:
case 2:
- if (super->type != 0x62) {
- if (super->type != 0x63) {
+ if (super->type != ITEM_HEART_CONTAINER) {
+ if (super->type != ITEM_HEART_PIECE) {
break;
}
- ModHealth(0xa0);
+ ModHealth(160);
gSave.stats.heartPieces++;
if (gSave.stats.heartPieces < 4) {
break;
@@ -150,15 +150,15 @@ void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) {
gSave.stats.heartPieces = 0;
}
gSave.stats.maxHealth += 8;
- if (gSave.stats.maxHealth > 0xa0) {
- gSave.stats.maxHealth = 0xa0;
+ if (gSave.stats.maxHealth > 160) {
+ gSave.stats.maxHealth = 160;
}
- ModHealth(0xa0);
+ ModHealth(160);
break;
case 3:
tmp = GetBottleContaining(super->type);
if (tmp != 0) {
- gSave.stats.itemButtons[tmp + 1] = 0x20;
+ gSave.stats.itemButtons[tmp + 1] = ITEM_BOTTLE_EMPTY;
} else {
SetInventoryValue(super->type, ITEM_GREEN_SWORD);
}
diff --git a/src/object/macroPlayer.c b/src/object/macroPlayer.c
index 71a2eb9b..79921a39 100644
--- a/src/object/macroPlayer.c
+++ b/src/object/macroPlayer.c
@@ -113,7 +113,7 @@ void MacroPlayer_Type0_Init(MacroPlayerEntity* this) {
super->spriteOrientation.flipY = 2;
this->unk68.HWORD = 0x114;
super->animIndex = 0xff;
- super->z.HALF.HI = 0xff50;
+ super->z.HALF.HI = -0xb0;
this->unk6a = 4;
super->spriteRendering.b0 = 3;
SetAffineInfo(super, 4, 4, 0);
diff --git a/src/object/minishPortalCloseup.c b/src/object/minishPortalCloseup.c
index 6b6877b0..f0e3c8c4 100644
--- a/src/object/minishPortalCloseup.c
+++ b/src/object/minishPortalCloseup.c
@@ -85,7 +85,7 @@ void sub_0808D030(void) {
s32 index;
ptr = gOAMControls.oam;
- index = 0x80;
+ index = ARRAY_COUNT(gOAMControls.oam);
MemClear(&gOAMControls, 0xb74);
while (index != 0) {
// TODO split up into bitfield writes?
diff --git a/src/object/object30.c b/src/object/object30.c
index dc304585..196a3bc4 100644
--- a/src/object/object30.c
+++ b/src/object/object30.c
@@ -67,10 +67,9 @@ void Object30_Action1(Object30Entity* this) {
}
void Object30_Action2(Object30Entity* this) {
- static const u8 gUnk_08121194[] = {
- 249, 248, 247, 246, 245, 246, 247, 248,
+ static const s8 gUnk_08121194[] = {
+ -7, -8, -9, -10, -11, -10, -9, -8,
};
- u8 tmp;
switch (super->type) {
case 0:
if (this->gravity != 0) {
@@ -90,8 +89,7 @@ void Object30_Action2(Object30Entity* this) {
}
// fallthrough
case 1:
- tmp = gUnk_08121194[(super->subtimer++ >> 3) & 7];
- super->z.HALF.HI = tmp << 0x18 >> 0x18;
+ super->z.HALF.HI = gUnk_08121194[(super->subtimer++ >> 3) & 7];
if (!IsCollidingPlayer(super)) {
return;
}
diff --git a/src/object/objectA8.c b/src/object/objectA8.c
index 05845e66..fcaf3966 100644
--- a/src/object/objectA8.c
+++ b/src/object/objectA8.c
@@ -217,7 +217,7 @@ void ObjectA8_Action6(ObjectA8Entity* this) {
}
if (--super->subtimer == 0) {
super->subtimer = 6;
- if (((--super->spriteOffsetY) * 0x1000000) >> 0x18 < -0x16) {
+ if (--super->spriteOffsetY < -0x16) {
sub_08081404(super, 1);
}
}
diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c
index b7933500..0193f063 100644
--- a/src/object/whirlwind.c
+++ b/src/object/whirlwind.c
@@ -46,7 +46,7 @@ void Whirlwind_Init(Entity* this) {
ChangeObjPalette(this, 0x161);
InitializeAnimation(this, 1);
} else {
- this->z.HALF.HI = 0xffe8;
+ this->z.HALF.HI = -24;
InitializeAnimation(this, 1);
}
if ((this->flags & ENT_SCRIPTED) != 0) {