Decompile some functions

This commit is contained in:
octorock
2022-03-28 17:30:56 +02:00
parent c86ada3e3d
commit eb1158855b
38 changed files with 935 additions and 2299 deletions
+78 -3
View File
@@ -34,6 +34,17 @@ Entity* sub_0806D00C(Entity* this);
void sub_0806D4C0(Entity*, u32);
extern const u8 gUnk_08114100[];
typedef struct {
s8 type;
s8 x;
s8 y;
u8 direction;
} struct_08114104;
extern const struct_08114104 gUnk_08114104[];
void BigGoron(Entity* this) {
gUnk_081140D4[this->type](this);
}
@@ -85,7 +96,27 @@ Entity* sub_0806D00C(Entity* this) {
return entity;
}
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D02C.inc", void sub_0806D02C(Entity* this))
void sub_0806D02C(Entity* this) {
s32 tmp1;
s32 tmp2;
sub_0806D164(this);
gScreen.lcd.displayControl |= 0x4000;
gScreen.controls.windowInsideControl = 0x3f3f;
gScreen.controls.windowOutsideControl = 0x3d;
tmp1 = -(s16)gScreen.bg1.xOffset;
tmp2 = tmp1 + 0x100;
tmp1 = min(max(0, tmp1), 0xf0);
tmp2 = min(max(0, tmp2), 0xf0);
gScreen.controls.window1HorizontalDimensions = (tmp1 << 8) | tmp2;
tmp1 = -(s16)gScreen.bg1.yOffset;
tmp2 = tmp1 + 0x100;
tmp1 = min(max(0, tmp1), 0xa0);
tmp2 = min(max(0, tmp2), 0xa0);
gScreen.controls.window1VerticalDimensions = (tmp1 << 8) | tmp2;
}
void sub_0806D0B0(Entity* this) {
gMapTop.bgControlPtr = 0;
@@ -310,7 +341,39 @@ void sub_0806D514(Entity* this) {
sub_0806D520(this, 3);
}
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D520.inc", void sub_0806D520(Entity* this, u32 param))
void sub_0806D520(Entity* this, u32 param_2) {
if (this->action == 0) {
this->action = 1;
this->field_0xf = gUnk_08114100[param_2] + 6;
this->frameIndex = this->field_0xf;
this->actionDelay = 8;
}
this->x.HALF.HI = this->parent->x.HALF.HI;
this->y.HALF.HI = this->parent->y.HALF.HI;
this->spriteOffsetX = this->parent->spriteOffsetX;
this->spriteOffsetY = this->parent->spriteOffsetY;
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
if (this->subAction != 0 ||
CheckPlayerProximity(this->x.HALF.HI + param_2 * -0x10 + 0xc, this->y.HALF.HI, 0x18, 0x40)) {
if (this->frameIndex >= this->field_0xf + 2) {
return;
}
if (--this->actionDelay != 0) {
return;
}
this->actionDelay = 8;
this->frameIndex++;
} else {
if (this->frameIndex <= this->field_0xf) {
return;
}
if (--this->actionDelay != 0) {
return;
}
this->actionDelay = 8;
this->frameIndex--;
}
}
void sub_0806D5D4(void) {
u32 itemSlot;
@@ -357,7 +420,19 @@ void sub_0806D66C(Entity* this) {
this->spriteOrientation.flipY = 2;
}
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D67C.inc", void sub_0806D67C(Entity* this))
void sub_0806D67C(Entity* this) {
const struct_08114104* ptr = gUnk_08114104;
while (ptr->type != -1) {
Entity* effect = CreateFx(this, ptr->type, 0x40);
if (effect != NULL) {
effect->x.HALF.HI = ptr->x + effect->x.HALF.HI;
effect->y.HALF.HI = ptr->y + effect->y.HALF.HI;
effect->direction = ptr->direction;
effect->speed = 0x100;
}
ptr++;
}
}
void sub_0806D6D0(void) {
Entity* entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
+61 -3
View File
@@ -10,10 +10,68 @@ extern u16 gUnk_08113078[];
extern void sub_08095BE0(Entity*, u32);
ASM_FUNC("asm/non_matching/librarians/Librarians.inc", void Librarians(Entity* this))
extern const u8 gUnk_08114F30[];
ASM_FUNC("asm/non_matching/librarians/sub_0806BA34.inc",
void sub_0806BA34(Entity* this, ScriptExecutionContext* context))
void Librarians(Entity* this) {
if (this->action == 0) {
this->action = 1;
sub_0807DD50(this);
this->spriteRendering.b3 = gUnk_08114F30[this->spriteRendering.b3];
}
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
GetNextFrame(this);
}
void sub_0806BA34(Entity* this, ScriptExecutionContext* context) {
u32 gotBook1;
u32 gotBook2;
u32 gotBook3;
u32 message = 0x4912;
context->condition = 0;
if (CheckLocalFlag(0x73)) {
message = 0x4913;
} else {
gotBook1 = GetInventoryValue(ITEM_QST_BOOK1);
gotBook2 = GetInventoryValue(ITEM_QST_BOOK2);
gotBook3 = GetInventoryValue(ITEM_QST_BOOK3);
if (gotBook1 == 1) {
message = 0x4906;
context->condition = 1;
SetLocalFlag(0x6b);
SetLocalFlag(0x6a);
} else if (gotBook2 == 1) {
message = 0x4907;
context->condition = 1;
SetLocalFlag(0x6b);
SetLocalFlag(0x6a);
} else if (gotBook3 == 1) {
message = 0x4908;
context->condition = 1;
SetLocalFlag(0x6b);
SetLocalFlag(0x6a);
} else {
if (CheckLocalFlag(0x6a)) {
if (!CheckLocalFlag(0x6b)) {
message = 0x4901;
SetLocalFlag(0x6b);
} else {
if (gotBook1 == 0) {
message = 0x4902;
SetLocalFlag(0x6b);
} else if (gotBook2 == 0) {
message = 0x4903;
SetLocalFlag(0x6d);
} else if (gotBook3 == 0) {
message = 0x4904;
SetLocalFlag(0x70);
}
}
}
}
}
MessageNoOverlap(message, this);
}
void sub_0806BB1C(Entity* this, ScriptExecutionContext* context) {
s32 item = 0xffffffff;