Various documentations

This commit is contained in:
Tal Hayon
2022-08-08 20:03:12 +03:00
parent 22cbdd2fd6
commit 79bae9cd8a
83 changed files with 297 additions and 275 deletions
+18 -16
View File
@@ -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,
};
+1 -1
View File
@@ -43,7 +43,7 @@ void EnemyItem(EnemyItemEntity* this) {
if (super->child == NULL) {
sub_080A2534(this);
}
sub_08054564();
DisableRandomDrops();
}
entity = super->child;
if (entity != NULL) {
+1 -1
View File
@@ -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);
}
}
+4 -4
View File
@@ -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) {
+1 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
}
}
+2 -2
View File
@@ -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);
+14 -14
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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?
+3 -5
View File
@@ -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;
}
+1 -1
View File
@@ -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);
}
}
+1 -1
View File
@@ -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) {