mirror of
https://github.com/zeldaret/tmc
synced 2026-09-06 02:58:07 -04:00
merge latest changes
This commit is contained in:
@@ -21,16 +21,6 @@ typedef struct {
|
||||
u8 unk1;
|
||||
} UStruct;
|
||||
|
||||
typedef struct {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
void* unk8;
|
||||
} WStruct;
|
||||
|
||||
void sub_0805F820(WStruct* r0, u32* r1);
|
||||
|
||||
u32 sub_0805F7DC(u32 r0, WStruct* r1) {
|
||||
|
||||
+2
-4
@@ -7,8 +7,6 @@
|
||||
#include "structures.h"
|
||||
#include "textbox.h"
|
||||
|
||||
extern u8 gBG3Buffer[];
|
||||
|
||||
extern void (*const gUnk_08109A30[])();
|
||||
|
||||
void HandleDebugTextScreen() {
|
||||
@@ -17,8 +15,8 @@ void HandleDebugTextScreen() {
|
||||
|
||||
void sub_0805FA04(void) {
|
||||
DispReset(1);
|
||||
MemClear(&gBG0Buffer, sizeof(BGBuffer));
|
||||
MemClear(&gBG3Buffer, 0x1000);
|
||||
MemClear(&gBG0Buffer, sizeof(gBG0Buffer));
|
||||
MemClear(&gBG3Buffer, sizeof(gBG3Buffer));
|
||||
gScreen.lcd.displayControl = 0x940;
|
||||
gScreen.bg.bg0xOffset = 0;
|
||||
gScreen.bg.bg0yOffset = 0;
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
#include "screen.h"
|
||||
#include "random.h"
|
||||
#include "functions.h"
|
||||
#include "structures.h"
|
||||
|
||||
void sub_0802A39C(Entity*);
|
||||
void sub_0802A334(Entity*);
|
||||
|
||||
extern u16 gBG3Buffer[];
|
||||
|
||||
extern void (*const gUnk_080CD030[])(Entity*);
|
||||
extern const u8 gUnk_080CD03C[];
|
||||
extern const s8 gUnk_080CD040[];
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
#include "menu.h"
|
||||
#include "random.h"
|
||||
#include "textbox.h"
|
||||
#include "functions.h"
|
||||
|
||||
// copy, erase, start
|
||||
#define NUM_FILE_OPERATIONS 3
|
||||
@@ -498,7 +499,7 @@ void sub_08050AFC(u32 idx) {
|
||||
SetActiveSave(idx);
|
||||
MemClear(&gBG1Buffer, sizeof(gBG1Buffer));
|
||||
if (gUnk_02019EE0.saveStatus[idx] == SAVE_VALID) {
|
||||
sub_08050B3C(&gBG1Buffer.unk29C);
|
||||
sub_08050B3C(&gBG1Buffer[0x14E]);
|
||||
}
|
||||
gScreen.bg.bg1Updated = 1;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "screen.h"
|
||||
#include "structures.h"
|
||||
#include "screen.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
@@ -10,7 +9,9 @@
|
||||
#include "save.h"
|
||||
#include "utils.h"
|
||||
#include "fileScreen.h"
|
||||
#include "menu.h"
|
||||
#include "functions.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern u8 gArea;
|
||||
extern Entity gPlayerEntity;
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ extern Entity* LoadRoomEntity(EntityData*);
|
||||
extern void* GetRoomProperty(u32, u32, u32);
|
||||
|
||||
extern u32 gUnk_02017654;
|
||||
extern u32* gAreaEntities;
|
||||
extern u32* gAreaTable;
|
||||
|
||||
extern void sub_080186EC();
|
||||
extern void sub_0804B16C();
|
||||
@@ -74,7 +74,7 @@ void sub_0804B0B0(u32 arg0, u32 arg1) {
|
||||
void SetCurrentRoomPropertyList(u32 arg0, u32 arg1) {
|
||||
u32** arr;
|
||||
gUnk_02017654 = 0;
|
||||
arr = &gAreaEntities;
|
||||
arr = &gAreaTable;
|
||||
if (arr[arg0] != 0) {
|
||||
gUnk_02017654 = arr[arg0][arg1];
|
||||
}
|
||||
@@ -94,7 +94,7 @@ void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2) {
|
||||
u32 temp;
|
||||
u32** arr;
|
||||
temp = 0;
|
||||
arr = &gAreaEntities;
|
||||
arr = &gAreaTable;
|
||||
if (arr[arg0] != NULL) {
|
||||
temp = arr[arg0][arg1];
|
||||
if (temp != 0) {
|
||||
|
||||
@@ -426,8 +426,6 @@ void sub_0805A94C(Manager15* this) {
|
||||
gScreen.controls.window1VerticalDimensions = (tmp1 << 8 | tmp2);
|
||||
}
|
||||
|
||||
extern u8 gBG3Buffer[];
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_0805A9CC(Manager15* this) {
|
||||
int tmp1, tmp2;
|
||||
|
||||
@@ -39,7 +39,6 @@ void sub_08057EFC(Manager8* this) {
|
||||
|
||||
void sub_08058004(u32, void*, void*);
|
||||
|
||||
extern u8 gBG3Buffer[];
|
||||
extern u8 gUnk_02006F00[];
|
||||
|
||||
void sub_08057F20(Manager8* this) {
|
||||
@@ -59,8 +58,8 @@ void sub_08057F20(Manager8* this) {
|
||||
tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2);
|
||||
gScreen.bg.bg1xOffset = tmp & 0xF;
|
||||
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1);
|
||||
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x800;
|
||||
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x800);
|
||||
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x400;
|
||||
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x400);
|
||||
tmp = ((tmp >> 4) << 1);
|
||||
if (this->unk_3c != tmp) {
|
||||
this->unk_3c = tmp;
|
||||
@@ -123,11 +122,11 @@ void sub_080580B0(u32 unk1) {
|
||||
gScreen.affine.bg3Updated = 1;
|
||||
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7
|
||||
tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2;
|
||||
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x800);
|
||||
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x400);
|
||||
gScreen.bg.bg1xOffset = tmp & 0xF;
|
||||
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
|
||||
gScreen.bg.bg1Control = 0x1E09;
|
||||
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x800;
|
||||
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x400;
|
||||
gScreen.bg.bg1Updated = 1;
|
||||
gScreen.controls.layerFXControl = 0x3C48;
|
||||
gScreen.controls.alphaBlend = 0x609;
|
||||
|
||||
@@ -13,11 +13,10 @@ typedef struct {
|
||||
void sub_08058204(Manager9*);
|
||||
void sub_08058210(Manager9*);
|
||||
u32 sub_08058244(int);
|
||||
void sub_080582A0(u32, u32*, u8*);
|
||||
void sub_080582A0(u32, u32*, u16*);
|
||||
void sub_080582F8(u8*, u8*);
|
||||
|
||||
extern u32 gUnk_02006F00[];
|
||||
extern u8 gBG3Buffer[];
|
||||
|
||||
const u16 gUnk_081081EC[] = { 0x30, 0x30, 0x30, 0x38 };
|
||||
|
||||
@@ -55,13 +54,13 @@ u32 sub_08058244(int i) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void sub_080582A0(u32 unk, u32* unk2, u8* unk3) {
|
||||
void sub_080582A0(u32 unk, u32* unk2, u16* unk3) {
|
||||
int i = 0x20;
|
||||
unk2 += unk >> 4;
|
||||
for (; i != 0; i--) {
|
||||
DmaSet(3, unk2, unk3, 0x80000020);
|
||||
unk2 += 0x40;
|
||||
unk3 += 0x40;
|
||||
unk3 += 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -5,16 +5,16 @@
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
static void sub_08081150(Entity*);
|
||||
static u8 sub_0808147C(u32);
|
||||
static void sub_080814A4(Entity*);
|
||||
static u32 sub_080814C0(Entity*);
|
||||
static void sub_08081500(Entity*);
|
||||
static void sub_0808153C(Entity*);
|
||||
static void sub_08081598(Entity*);
|
||||
static void sub_080813BC(Entity*);
|
||||
static void sub_080810FC(Entity*);
|
||||
static bool32 CheckShouldPlayItemGetCutscene(Entity*);
|
||||
void sub_08081150(Entity*);
|
||||
u8 sub_0808147C(u32);
|
||||
void sub_080814A4(Entity*);
|
||||
u32 sub_080814C0(Entity*);
|
||||
void sub_08081500(Entity*);
|
||||
void sub_0808153C(Entity*);
|
||||
void sub_08081598(Entity*);
|
||||
void sub_080813BC(Entity*);
|
||||
void sub_080810FC(Entity*);
|
||||
bool32 CheckShouldPlayItemGetCutscene(Entity*);
|
||||
|
||||
extern u32 sub_080002D0(Entity*);
|
||||
extern u32 sub_080177A0(Entity*, Entity*);
|
||||
@@ -137,7 +137,7 @@ void sub_08080F20(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_080810A8(Entity* this) {
|
||||
void sub_080810A8(Entity* this) {
|
||||
this->action = 1;
|
||||
sub_080814A4(this);
|
||||
if (this->direction & 0x80) {
|
||||
@@ -158,7 +158,7 @@ static void sub_080810A8(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_080810FC(Entity* this) {
|
||||
void sub_080810FC(Entity* this) {
|
||||
if (this->type != 0x5F) {
|
||||
sub_08081598(this);
|
||||
} else {
|
||||
@@ -176,7 +176,7 @@ void sub_08081134(Entity* this) {
|
||||
sub_08081150(this);
|
||||
}
|
||||
|
||||
static void sub_08081150(Entity* this) {
|
||||
void sub_08081150(Entity* this) {
|
||||
this->action = 2;
|
||||
this->flags |= 0x80;
|
||||
this->height.HALF.HI = -0x80;
|
||||
@@ -185,7 +185,7 @@ static void sub_08081150(Entity* this) {
|
||||
SoundReq(SFX_12D);
|
||||
}
|
||||
|
||||
static void sub_08081188(Entity* this) {
|
||||
void sub_08081188(Entity* this) {
|
||||
this->action = 2;
|
||||
this->flags |= 0x80;
|
||||
if (this->collisionLayer == 2) {
|
||||
@@ -304,7 +304,7 @@ void sub_0808136C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_080813BC(Entity* this) {
|
||||
void sub_080813BC(Entity* this) {
|
||||
gUnk_0811E840[this->subAction](this);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ bool32 sub_08081420(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 CheckShouldPlayItemGetCutscene(Entity* this) {
|
||||
bool32 CheckShouldPlayItemGetCutscene(Entity* this) {
|
||||
bool32 result = FALSE;
|
||||
if ((gUnk_080FD5B4[this->type].unk0[3] & 0x2) || !GetInventoryValue(this->type)) {
|
||||
result = TRUE;
|
||||
@@ -351,7 +351,7 @@ static bool32 CheckShouldPlayItemGetCutscene(Entity* this) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static u8 sub_0808147C(u32 arg0) {
|
||||
u8 sub_0808147C(u32 arg0) {
|
||||
const Unk_0811E84C* var0 = &gUnk_0811E84C[arg0];
|
||||
return var0->unk4;
|
||||
}
|
||||
@@ -363,7 +363,7 @@ void sub_0808148C(u32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_080814A4(Entity* this) {
|
||||
void sub_080814A4(Entity* this) {
|
||||
if (this->field_0x68.HALF.HI == 10) {
|
||||
this->field_0x6c.HWORD = 120;
|
||||
} else {
|
||||
@@ -371,7 +371,7 @@ static void sub_080814A4(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static u32 sub_080814C0(Entity* this) {
|
||||
u32 sub_080814C0(Entity* this) {
|
||||
if (!sub_0805E40C(this)) {
|
||||
if (--this->field_0x6c.HWORD == 0) {
|
||||
return TRUE;
|
||||
@@ -385,7 +385,7 @@ static u32 sub_080814C0(Entity* this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_08081500(Entity* this) {
|
||||
void sub_08081500(Entity* this) {
|
||||
if (this->field_0x68.HALF.LO == 0) {
|
||||
u32 var0 = sub_080044EC(this, 0x2800);
|
||||
if (var0 == 0) {
|
||||
@@ -401,7 +401,7 @@ static void sub_08081500(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0808153C(Entity* this) {
|
||||
void sub_0808153C(Entity* this) {
|
||||
if (this->field_0x68.HALF.LO > 1)
|
||||
return;
|
||||
|
||||
@@ -420,7 +420,7 @@ static void sub_0808153C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08081598(Entity* this) {
|
||||
void sub_08081598(Entity* this) {
|
||||
if (this->currentHealth == 0) {
|
||||
sub_08081404(this, 1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "game.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08083338(Entity*);
|
||||
void sub_080834B4(Entity*);
|
||||
void sub_080834EC(Entity*);
|
||||
void sub_08083518(Entity*);
|
||||
void sub_08083540(Entity*);
|
||||
void nullsub_513(Entity*);
|
||||
void sub_08083598(Entity*);
|
||||
void sub_080835C8(Entity*);
|
||||
void sub_080835F8(Entity*);
|
||||
|
||||
void sub_08083638(Entity*);
|
||||
void sub_08083658(Entity*);
|
||||
void sub_080836A0(Entity*);
|
||||
void sub_080836DC(Entity*, u32, u32);
|
||||
u32 sub_08083734(Entity*, u32);
|
||||
u32 sub_080837B0(Entity*);
|
||||
void sub_08083814(Entity*, u32);
|
||||
|
||||
void (*const gUnk_0811F65C[])(Entity*) = {
|
||||
sub_08083338, sub_080834B4, sub_080834EC, sub_08083518, sub_08083540,
|
||||
nullsub_513, sub_08083598, sub_080835C8, sub_080835F8,
|
||||
};
|
||||
|
||||
void LockedDoor(Entity* this) {
|
||||
gUnk_0811F65C[this->action](this);
|
||||
}
|
||||
|
||||
extern Hitbox gUnk_080FD170;
|
||||
|
||||
extern u32 sub_080001DA(u32, u32);
|
||||
extern void sub_08078850(Entity*, u32, u32, u32);
|
||||
extern void sub_0805E4E0(Entity*, u32);
|
||||
|
||||
typedef struct PACKED {
|
||||
s8 x;
|
||||
s8 y;
|
||||
} struct_0811F680;
|
||||
|
||||
const struct_0811F680 gUnk_0811F680[] = {
|
||||
{ 0, -2 },
|
||||
{ 2, 0 },
|
||||
{ 0, 2 },
|
||||
{ -2, 0 },
|
||||
};
|
||||
|
||||
const struct_0811F680 gUnk_0811F688[] = {
|
||||
{ 0, -21 },
|
||||
{ 21, 0 },
|
||||
{ 0, 21 },
|
||||
{ -21, 0 },
|
||||
};
|
||||
|
||||
const u16 gUnk_0811F690[] = {
|
||||
0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
|
||||
0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
|
||||
0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct_0811F680 unk_00;
|
||||
struct_0811F680 unk_02;
|
||||
} struct_0811F730;
|
||||
|
||||
const struct_0811F730 gUnk_0811F730[] = {
|
||||
{ { 8, 8 }, { -8, 8 } },
|
||||
{ { -8, 8 }, { -8, -8 } },
|
||||
{ { 8, -8 }, { -8, -8 } },
|
||||
{ { 8, 8 }, { 8, -8 } },
|
||||
};
|
||||
|
||||
const u8 gUnk_0811F740[] = {
|
||||
0xBE,
|
||||
0x7D,
|
||||
0xEB,
|
||||
0xD7,
|
||||
};
|
||||
|
||||
void sub_08083338(Entity* this) {
|
||||
if (this->cutsceneBeh.HWORD != 0xFFFF && CheckFlags(this->cutsceneBeh.HWORD)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (!sub_080837B0(this))
|
||||
return;
|
||||
this->type2 = (this->type >> 2) & 3;
|
||||
this->frameIndex = this->type & 3;
|
||||
this->speed = 0x300;
|
||||
this->field_0x70.HALF.LO = this->x.HALF.HI;
|
||||
this->field_0x70.HALF.HI = this->y.HALF.HI;
|
||||
this->field_0x7c.BYTES.byte2 = this->type & 3;
|
||||
this->hitbox = &gUnk_080FD170;
|
||||
this->spritePriority.b0 = 5;
|
||||
this->frames.all = this->type & 0xF;
|
||||
this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
this->field_0x74.HWORD = sub_080001DA(this->field_0x76.HWORD, this->collisionLayer);
|
||||
switch (this->type2) {
|
||||
case 0:
|
||||
if (!CheckFlags(this->field_0x86.HWORD)) {
|
||||
if (this->type & 0x10) {
|
||||
this->action = 3;
|
||||
} else {
|
||||
sub_080836A0(this);
|
||||
}
|
||||
} else {
|
||||
this->type &= ~0x10;
|
||||
sub_08083638(this);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!CheckFlags(this->field_0x86.HWORD)) {
|
||||
sub_08083638(this);
|
||||
} else {
|
||||
sub_080836A0(this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!CheckFlags(this->field_0x86.HWORD)) {
|
||||
this->frameIndex |= 4;
|
||||
sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD);
|
||||
if (!CheckIsDungeon()) {
|
||||
this->action = 5;
|
||||
} else {
|
||||
this->action = 8;
|
||||
sub_080787CC(this);
|
||||
sub_08078850(this, 0, gUnk_0811F740[this->field_0x7c.BYTES.byte2], 0);
|
||||
}
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080834B4(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 7;
|
||||
SetTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer);
|
||||
EnqueueSFX(0x10b);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080834EC(Entity* this) {
|
||||
sub_0806F69C(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
if (this->type & 0x80) {
|
||||
sub_08083638(this);
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08083518(Entity* this) {
|
||||
if (sub_08083734(this, this->field_0x7c.BYTES.byte2)) {
|
||||
this->action = 4;
|
||||
sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08083540(Entity* this) {
|
||||
sub_0806F69C(this);
|
||||
if (!--this->actionDelay) {
|
||||
if (this->type & 0x10) {
|
||||
this->type &= ~0x10;
|
||||
sub_080836A0(this);
|
||||
} else {
|
||||
if (this->type & 0x80) {
|
||||
sub_080836A0(this);
|
||||
} else {
|
||||
this->action = 5;
|
||||
}
|
||||
}
|
||||
sub_08083814(this, this->field_0x7c.BYTES.byte2);
|
||||
EnqueueSFX(0x10b);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_513(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08083598(Entity* this) {
|
||||
if (this->type2 == 0) {
|
||||
if (!CheckFlags(this->field_0x86.HWORD))
|
||||
return;
|
||||
} else {
|
||||
if (CheckFlags(this->field_0x86.HWORD))
|
||||
return;
|
||||
}
|
||||
sub_08083658(this);
|
||||
}
|
||||
|
||||
void sub_080835C8(Entity* this) {
|
||||
if (this->type2 == 0) {
|
||||
if (CheckFlags(this->field_0x86.HWORD))
|
||||
return;
|
||||
} else {
|
||||
if (!CheckFlags(this->field_0x86.HWORD))
|
||||
return;
|
||||
}
|
||||
this->action = 3;
|
||||
}
|
||||
|
||||
void sub_080835F8(Entity* this) {
|
||||
if (this->interactType == 0 && !CheckFlags(this->field_0x86.HWORD))
|
||||
return;
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x14;
|
||||
sub_08083658(this);
|
||||
SetFlag(this->field_0x86.HWORD);
|
||||
sub_080526F8(-1);
|
||||
}
|
||||
|
||||
void sub_08083638(Entity* this) {
|
||||
this->action = 7;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->x.HALF.HI = this->field_0x70.HALF.LO;
|
||||
this->y.HALF.HI = this->field_0x70.HALF.HI;
|
||||
}
|
||||
|
||||
void sub_08083658(Entity* this) {
|
||||
const struct_0811F680* tmp;
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x14;
|
||||
this->direction = this->field_0x7c.BYTES.byte2 << 3;
|
||||
tmp = &gUnk_0811F680[this->field_0x7c.BYTES.byte2];
|
||||
this->x.HALF.HI += tmp->x;
|
||||
this->y.HALF.HI += tmp->y;
|
||||
sub_0805E4E0(this, 0x3c);
|
||||
SoundReq(0x10b);
|
||||
}
|
||||
|
||||
void sub_080836A0(Entity* this) {
|
||||
this->action = 6;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->x.HALF.HI = this->field_0x70.HALF.LO;
|
||||
this->y.HALF.HI = this->field_0x70.HALF.HI;
|
||||
SetTile(0x4022, this->field_0x76.HWORD, this->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) {
|
||||
const struct_0811F680* tmp;
|
||||
SetTile(0x4022, unk_1, this->collisionLayer);
|
||||
this->actionDelay = 7;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->direction = (unk_0 << 3) ^ 0x10;
|
||||
tmp = &gUnk_0811F688[unk_0];
|
||||
if (this->type2 != 2) {
|
||||
this->x.HALF.HI += tmp->x;
|
||||
this->y.HALF.HI += tmp->y;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_08083734(Entity* this, u32 unk0) {
|
||||
switch (unk0) {
|
||||
case 0:
|
||||
if (this->field_0x70.HALF_U.HI + 0xd - gPlayerEntity.y.HALF.HI < 0)
|
||||
return 1;
|
||||
break;
|
||||
case 1:
|
||||
if (gPlayerEntity.x.HALF.HI - (this->field_0x70.HALF_U.LO - 0xb) < 0)
|
||||
return 1;
|
||||
break;
|
||||
case 2:
|
||||
if (gPlayerEntity.y.HALF.HI - (this->field_0x70.HALF_U.HI - 0x8) < 0)
|
||||
return 1;
|
||||
break;
|
||||
case 3:
|
||||
if (this->field_0x70.HALF_U.LO + 0xa - gPlayerEntity.x.HALF.HI < 0)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_080837B0(Entity* this) {
|
||||
u32 tmp;
|
||||
u32 tmp2 = gRoomControls.areaID;
|
||||
if (tmp2 < 0x40) {
|
||||
switch (tmp2) {
|
||||
default:
|
||||
tmp = 0xA;
|
||||
break;
|
||||
case 0x25:
|
||||
tmp = 0x1e7;
|
||||
break;
|
||||
case 0x35:
|
||||
tmp = 0x1c3;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
tmp = gUnk_0811F690[tmp2 - 0x40];
|
||||
}
|
||||
if (tmp2 == 0x68) {
|
||||
sub_0801D2B4(this, 0);
|
||||
} else {
|
||||
if (tmp2 == 0x88) {
|
||||
sub_0801D2B4(this, 1);
|
||||
}
|
||||
}
|
||||
LoadFixedGFX(this, tmp);
|
||||
}
|
||||
|
||||
void sub_08083814(Entity* this, u32 unk0) {
|
||||
Entity* fx;
|
||||
const struct_0811F730* tmp = &gUnk_0811F730[unk0];
|
||||
fx = CreateFx(this, 0x11, 0x40);
|
||||
if (fx) {
|
||||
fx->x.HALF.HI += tmp->unk_00.x;
|
||||
fx->y.HALF.HI += tmp->unk_00.y;
|
||||
}
|
||||
fx = CreateFx(this, 0x11, 0x40);
|
||||
if (fx) {
|
||||
fx->x.HALF.HI += tmp->unk_02.x;
|
||||
fx->y.HALF.HI += tmp->unk_02.y;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "entity.h"
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u8*);
|
||||
|
||||
|
||||
+6
-6
@@ -5595,7 +5595,7 @@ extern void sub_0804F5E8();
|
||||
extern u32 gUnk_080F7C80;
|
||||
extern void sub_0804F4E4();
|
||||
|
||||
u32 sub_0804F468(void) {
|
||||
u32 Vars_HyruleField_OutsideCastle(void) {
|
||||
if (CheckGlobalFlag(TABIDACHI) && !GetInventoryValue(0x11)) {
|
||||
gRoomVars.field_0x6c = &gUnk_080F7CD0;
|
||||
gRoomVars.field_0x88 = sub_0804F5E8;
|
||||
@@ -5618,7 +5618,7 @@ void sub_0804F4E4() {
|
||||
|
||||
extern EntityData gUnk_080F7D70;
|
||||
|
||||
void sub_0804F4F4(void) {
|
||||
void Load_HyruleField_OutsideCastle(void) {
|
||||
sub_0804F4E4();
|
||||
if (!CheckLocalFlag(0x8b)) {
|
||||
LoadRoomEntityList(&gUnk_080F7D70);
|
||||
@@ -5781,13 +5781,13 @@ void sub_0804F9C8(void) {
|
||||
sub_0807BA8C(0x4d9, 1);
|
||||
}
|
||||
|
||||
u32 sub_0804F9FC() {
|
||||
u32 Vars_HyruleField_OutsideCastleWest() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern EntityData gUnk_080F806C;
|
||||
|
||||
void sub_0804FA00(void) {
|
||||
void Load_HyruleField_OutsideCastleWest(void) {
|
||||
|
||||
sub_0805ADD8(0);
|
||||
if ((gSave.unk8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
|
||||
@@ -5795,13 +5795,13 @@ void sub_0804FA00(void) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0804FA2C() {
|
||||
u32 Vars_HyruleField_TrilbyHighlands() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern EntityData gUnk_080F82E0;
|
||||
|
||||
void sub_0804FA30(void) {
|
||||
void Load_HyruleField_TrilbyHighlands(void) {
|
||||
|
||||
sub_0805ADD8(0);
|
||||
if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(0x3) && !CheckLocalFlag(0x9c)) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "save.h"
|
||||
#include "gba/eeprom.h"
|
||||
#include "audio.h"
|
||||
#include "menu.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct SaveFileStatus {
|
||||
u16 checksum1;
|
||||
|
||||
+632
-86
@@ -8,15 +8,50 @@
|
||||
#include "structures.h"
|
||||
#include "save.h"
|
||||
|
||||
u32 sub_080564DC(void);
|
||||
u32 sub_080564EC(void);
|
||||
u32 sub_08056654(void);
|
||||
u32 sub_080565B4(void);
|
||||
u32 sub_080565F8(void);
|
||||
u32 sub_08056640(void);
|
||||
#define TEXTBOX_ADVANCE_KEYS (A_BUTTON | B_BUTTON | DPAD_ANY | R_BUTTON)
|
||||
#define TEXTBOX_PRESS_ANY_ADVANCE_KEYS ((gInput.newKeys & TEXTBOX_ADVANCE_KEYS) != 0)
|
||||
|
||||
u32 (*const gUnk_08107BC8[])(void) = {
|
||||
sub_080564DC, sub_080564EC, sub_08056654, sub_080565B4, sub_080565F8, sub_08056640,
|
||||
#define TEXTBOX_WIDTH 0x20
|
||||
#define TEXTBOX_POSITION_INDEX(window) ((window).yPos * TEXTBOX_WIDTH + (window).xPos)
|
||||
|
||||
extern void WriteBit(u32*, u32);
|
||||
extern void sub_0805EF40(u8*, u8*);
|
||||
extern void sub_0801C4A0(u32, u32);
|
||||
extern void sub_0801C494(void);
|
||||
extern void sub_0805F918(u32, u32, u32);
|
||||
extern u32 sub_0801D51C(u32, u8*, u32);
|
||||
|
||||
u32 sub_08056FEC(u32, u8*);
|
||||
|
||||
u16 sub_08056750(CurrentTextBox*);
|
||||
u32 sub_0805EFE8(u8*);
|
||||
void sub_08056ABC(u32, u32);
|
||||
void sub_080569C4(CurrentTextBox*, u32);
|
||||
u16 sub_0805F7DC(u32, u8*);
|
||||
u32 sub_GetFontStrWidth(u8*, u32);
|
||||
void sub_08056FBC(CurrentTextBox*);
|
||||
void SetDoTextBox(u32 doTextbox);
|
||||
void Load_02000D00_Asyc(void);
|
||||
|
||||
void DeleteWindow(void);
|
||||
void CreateWindow(void);
|
||||
u32 CalcWindowSize(u32 fade);
|
||||
|
||||
void DispMessageFrame(u16*, u32, u32, u32);
|
||||
void DispString(void);
|
||||
void DispCursor(void);
|
||||
|
||||
typedef u32 (*TextBoxFunction)(void);
|
||||
|
||||
u32 TextBoxFunction0(void);
|
||||
u32 TextBoxFunction1(void);
|
||||
u32 HandleTextBox(void);
|
||||
u32 TextBoxFunctionOpen(void);
|
||||
u32 TextBoxFunctionClose(void);
|
||||
u32 TextBoxFunction5(void);
|
||||
|
||||
const TextBoxFunction gTextBoxFunctions[] = {
|
||||
TextBoxFunction0, TextBoxFunction1, HandleTextBox, TextBoxFunctionOpen, TextBoxFunctionClose, TextBoxFunction5,
|
||||
};
|
||||
|
||||
extern u8 gUnk_020227DC, gUnk_020227E8, gUnk_020227F0, gUnk_020227F8, gUnk_02022800;
|
||||
@@ -24,22 +59,49 @@ u8* const gUnk_08107BE0[] = {
|
||||
&gUnk_020227DC, &gUnk_020227E8, &gUnk_020227F0, &gUnk_020227F8, &gUnk_02022800,
|
||||
};
|
||||
|
||||
void sub_08056684(struct_02022780*);
|
||||
void sub_080566B8(struct_02022780*);
|
||||
void sub_08056BA0(struct_02022780*);
|
||||
void sub_08056B1C(struct_02022780*);
|
||||
void sub_08056B7C(struct_02022780*);
|
||||
void sub_080569D4(struct_02022780*);
|
||||
typedef void (*TextBoxHandler)(CurrentTextBox*);
|
||||
|
||||
void (*const gUnk_08107BF4[])(struct_02022780*) = {
|
||||
sub_08056684, sub_080566B8, sub_08056BA0, sub_08056B1C, sub_08056B7C, sub_080569D4,
|
||||
void TextBoxHandler0(CurrentTextBox* this);
|
||||
void TextBoxHandler1(CurrentTextBox* param_1);
|
||||
void TextBoxHandlerAdvance(CurrentTextBox* ctb);
|
||||
void TextBoxHandlerNextBox(CurrentTextBox* ctb);
|
||||
void TextBoxHandler4(CurrentTextBox* ctb);
|
||||
void TextBoxHandlerQuestion(CurrentTextBox* ctb);
|
||||
|
||||
const TextBoxHandler gTextBoxHandlers[] = {
|
||||
TextBoxHandler0, TextBoxHandler1, TextBoxHandlerAdvance,
|
||||
TextBoxHandlerNextBox, TextBoxHandler4, TextBoxHandlerQuestion,
|
||||
};
|
||||
|
||||
extern u32 gUnk_02036A40;
|
||||
extern u32 gUnk_02036A38;
|
||||
extern u8 gUnk_02024030;
|
||||
typedef struct Window {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u8 xPos;
|
||||
u8 yPos;
|
||||
u8 width;
|
||||
u8 height;
|
||||
} Window;
|
||||
extern Window gCurrentWindow;
|
||||
extern Window gNewWindow;
|
||||
|
||||
extern struct {
|
||||
u8 unk_00;
|
||||
u8 unk_01[1];
|
||||
s8 unk_02;
|
||||
s8 unk_03;
|
||||
u8 unk_04[4];
|
||||
u16 unk_08[4];
|
||||
u16 unk_10[4];
|
||||
} gUnk_02024030;
|
||||
|
||||
extern u32 gUnk_0200005C;
|
||||
|
||||
extern u8 gUnk_020227A0;
|
||||
extern u8 gUnk_02000D00;
|
||||
extern u8 gUnk_02000D00[0xD00];
|
||||
|
||||
extern const u8 gUnk_08107C0C[];
|
||||
|
||||
s32 sub_08056338(void) {
|
||||
s32 result;
|
||||
@@ -52,7 +114,7 @@ s32 sub_08056338(void) {
|
||||
|
||||
void sub_08056360(void) {
|
||||
if ((gTextBox.doTextBox & 0x7f) != 0) {
|
||||
gTextBox.doTextBox = 0x80 | 0x8;
|
||||
gTextBox.doTextBox = 0x88;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,22 +126,22 @@ void TextboxNoOverlapFollow(u32 index) {
|
||||
}
|
||||
}
|
||||
|
||||
void TextboxNoOverlap(u32 index, Entity* ent) {
|
||||
void TextboxNoOverlap(u32 index, Entity* entity) {
|
||||
s16 y;
|
||||
s16 h;
|
||||
s16 height;
|
||||
|
||||
ShowTextbox(index);
|
||||
|
||||
y = ent->y.HALF.HI;
|
||||
h = ent->height.HALF.HI;
|
||||
y = entity->y.HALF.HI;
|
||||
height = entity->height.HALF.HI;
|
||||
|
||||
if (((y + h) - gRoomControls.roomScrollY) > 0x58) {
|
||||
if (((y + height) - gRoomControls.roomScrollY) > 0x58) {
|
||||
gTextBox.textWindowPosY = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080563C8(u32 param_1, u32 param_2) {
|
||||
TextboxAtPosition(param_1, 1, param_2);
|
||||
void TextBoxAtYPosition(u32 index, u32 y) {
|
||||
TextboxAtPosition(index, 1, y);
|
||||
}
|
||||
|
||||
void TextboxAtPosition(u32 index, u32 x, u32 y) {
|
||||
@@ -89,7 +151,7 @@ void TextboxAtPosition(u32 index, u32 x, u32 y) {
|
||||
}
|
||||
|
||||
void ShowTextbox(u32 index) {
|
||||
MemClear(&gTextBox, 32);
|
||||
MemClear(&gTextBox, sizeof(gTextBox));
|
||||
gTextBox.textIndex = index;
|
||||
gTextBox.textSpeed = 99;
|
||||
gTextBox.textWindowWidth = 26;
|
||||
@@ -100,10 +162,10 @@ void ShowTextbox(u32 index) {
|
||||
}
|
||||
|
||||
void MessageInitialize(void) {
|
||||
MemClear(&gTextBox, 32);
|
||||
MemClear(&gUnk_02022780, 168);
|
||||
MemClear(&gUnk_02036A40, 8);
|
||||
MemClear(&gUnk_02036A38, 8);
|
||||
MemClear(&gTextBox, sizeof(gTextBox));
|
||||
MemClear(&gCurrentTextBox, sizeof(gCurrentTextBox));
|
||||
MemClear(&gNewWindow, sizeof(gNewWindow));
|
||||
MemClear(&gCurrentWindow, sizeof(gCurrentWindow));
|
||||
MemClear(&gUnk_02000040, 4);
|
||||
}
|
||||
|
||||
@@ -111,125 +173,609 @@ void MessageUpdate(void) {
|
||||
int iVar1;
|
||||
|
||||
if (gTextBox.doTextBox == 1) {
|
||||
MemClear((u32*)&gUnk_02022780, sizeof(gUnk_02022780));
|
||||
MemClear((u32*)&gCurrentTextBox, sizeof(gCurrentTextBox));
|
||||
sub_080564C8(1);
|
||||
}
|
||||
|
||||
if (gUnk_02022780._8a != 0) {
|
||||
gUnk_02022780._8a--;
|
||||
if (gCurrentTextBox._8a != 0) {
|
||||
gCurrentTextBox._8a--;
|
||||
} else {
|
||||
do {
|
||||
iVar1 = gUnk_08107BC8[gUnk_02022780._88]();
|
||||
iVar1 = gTextBoxFunctions[gCurrentTextBox._88]();
|
||||
} while (iVar1 != 0);
|
||||
}
|
||||
if (gUnk_02022780._9d != 0) {
|
||||
gUnk_02022780._9d = 0;
|
||||
sub_08056F70();
|
||||
if (gCurrentTextBox._9d != 0) {
|
||||
gCurrentTextBox._9d = 0;
|
||||
Load_02000D00_Asyc();
|
||||
}
|
||||
DeleteWindow();
|
||||
CreateWindow();
|
||||
}
|
||||
|
||||
void sub_080564C8(u32 a1) {
|
||||
gUnk_02022780._88 = a1;
|
||||
gUnk_02022780._89 = 0;
|
||||
void sub_080564C8(u32 unk) {
|
||||
gCurrentTextBox._88 = unk;
|
||||
gCurrentTextBox.state = 0;
|
||||
}
|
||||
|
||||
u32 sub_080564DC(void) {
|
||||
gUnk_02022780._99 = 0;
|
||||
u32 TextBoxFunction0(void) {
|
||||
gCurrentTextBox._98.bytes.b1 = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// regalloc in loop
|
||||
NONMATCH("asm/non_matching/textbox/sub_080564EC.inc", u32 sub_080564EC(void)) {
|
||||
NONMATCH("asm/non_matching/textbox/TextBoxFunction1.inc", u32 TextBoxFunction1(void)) {
|
||||
u32 uVar1;
|
||||
char* dest;
|
||||
u32 i;
|
||||
char c;
|
||||
|
||||
MemClear((void*)&gUnk_02036A40, 8);
|
||||
MemClear((void*)&gNewWindow, 8);
|
||||
MemClear((void*)&gUnk_02024030, 0x18);
|
||||
MemClear((void*)&gUnk_02022780, 0xa8);
|
||||
MemCopy(&gTextBox, &gUnk_02022780, 32);
|
||||
if (gUnk_02022780._2 == 0x63) {
|
||||
gUnk_02022780._2 = gUnk_02000000->messageSpeed;
|
||||
MemClear((void*)&gCurrentTextBox, sizeof(gCurrentTextBox));
|
||||
MemCopy(&gTextBox, &gCurrentTextBox, sizeof(gTextBox));
|
||||
if (gCurrentTextBox.textBox.textSpeed == 0x63) {
|
||||
gCurrentTextBox.textBox.textSpeed = gUnk_02000000->messageSpeed;
|
||||
}
|
||||
gUnk_02022780._9c = 0xff;
|
||||
sub_0805EEB4(&gUnk_02022780._20, gUnk_02022780._8, 32);
|
||||
gUnk_02022780._5c = 2;
|
||||
gUnk_02022780._5d = 0xe;
|
||||
dest = gUnk_02022780._5e;
|
||||
gCurrentTextBox._9c = 0xff;
|
||||
sub_0805EEB4(&gCurrentTextBox._20, gCurrentTextBox.textBox.textIndex);
|
||||
gCurrentTextBox.playerName[0] = 2;
|
||||
gCurrentTextBox.playerName[1] = 0xe;
|
||||
dest = &gCurrentTextBox.playerName[2];
|
||||
|
||||
for (i = 0; i < 6; ++i) {
|
||||
for (i = 0; i < FILENAME_LENGTH; ++i) {
|
||||
c = gSave.playerName[i];
|
||||
if (c == '\0')
|
||||
break;
|
||||
dest[i] = c;
|
||||
*dest = c;
|
||||
dest++;
|
||||
}
|
||||
|
||||
dest[0] = 2;
|
||||
dest[1] = 15;
|
||||
dest[2] = 0;
|
||||
sub_08056FBC(&gUnk_02022780);
|
||||
gUnk_02022780._2c = &gUnk_08107BE0;
|
||||
gUnk_02022780._58 = &gUnk_02000D00;
|
||||
gUnk_02022780._54 = 0xd0;
|
||||
sub_08056C54(2);
|
||||
sub_08056FBC(&gCurrentTextBox);
|
||||
gCurrentTextBox._2c = &gUnk_08107BE0;
|
||||
gCurrentTextBox._50.unk8 = gUnk_02000D00;
|
||||
gCurrentTextBox._50.unk4 = 0xd0;
|
||||
SetDoTextBox(2);
|
||||
sub_08056BDC(0);
|
||||
sub_080564C8(2);
|
||||
return 1;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
u32 sub_080565B4(void) {
|
||||
if (gUnk_02022780._89 == 0) {
|
||||
gUnk_02022780._89 = 1;
|
||||
gUnk_02022780._99 = 1;
|
||||
sub_08056F88(gUnk_02022780._3[0], gUnk_02022780._53);
|
||||
u32 TextBoxFunctionOpen(void) {
|
||||
if (gCurrentTextBox.state == 0) {
|
||||
gCurrentTextBox.state = 1;
|
||||
gCurrentTextBox._98.bytes.b1 = 1;
|
||||
sub_08056F88(gCurrentTextBox.textBox.unk3, gCurrentTextBox._50.unk3);
|
||||
SoundReq(SFX_TEXTBOX_OPEN);
|
||||
}
|
||||
|
||||
if (sub_08056CC0(1)) {
|
||||
gUnk_02022780._99 = 2;
|
||||
if (CalcWindowSize(1)) {
|
||||
gCurrentTextBox._98.bytes.b1 = 2;
|
||||
sub_080564C8(2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_080565F8(void) {
|
||||
if (gUnk_02022780._89 == 0) {
|
||||
gUnk_02022780._89 = 1;
|
||||
gUnk_02022780._99 = 3;
|
||||
u32 TextBoxFunctionClose(void) {
|
||||
if (gCurrentTextBox.state == 0) {
|
||||
gCurrentTextBox.state = 1;
|
||||
gCurrentTextBox._98.bytes.b1 = 3;
|
||||
sub_08056BDC(0);
|
||||
SoundReq(SFX_TEXTBOX_CLOSE);
|
||||
}
|
||||
|
||||
if (sub_08056CC0(-1)) {
|
||||
gUnk_02022780._99 = 0;
|
||||
if (CalcWindowSize(-1)) {
|
||||
gCurrentTextBox._98.bytes.b1 = 0;
|
||||
sub_080564C8(2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_08056640() {
|
||||
sub_08056C54(0);
|
||||
u32 TextBoxFunction5(void) {
|
||||
SetDoTextBox(0);
|
||||
sub_080564C8(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_08056654(void) {
|
||||
sub_08056C54(4);
|
||||
gUnk_08107BF4[gUnk_02022780._89](&gUnk_02022780);
|
||||
sub_08056CC0(0);
|
||||
u32 HandleTextBox(void) {
|
||||
SetDoTextBox(4);
|
||||
gTextBoxHandlers[gCurrentTextBox.state](&gCurrentTextBox);
|
||||
CalcWindowSize(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_08056684(struct_02022780* this) {
|
||||
if ((gUnk_02022780._20 & 1) == 0) {
|
||||
if (gUnk_02022780._99 == '\0') {
|
||||
void TextBoxHandler0(CurrentTextBox* this) {
|
||||
if ((gCurrentTextBox._20 & 1) == 0) {
|
||||
if (gCurrentTextBox._98.bytes.b1 == 0) {
|
||||
sub_080564C8(5);
|
||||
}
|
||||
} else {
|
||||
this->_89 = 1;
|
||||
this->state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void TextBoxHandler1(CurrentTextBox* param_1) {
|
||||
u32 uVar3;
|
||||
s32 iVar4;
|
||||
int iVar5;
|
||||
int iVar6;
|
||||
|
||||
if (param_1->_95 != 0) {
|
||||
param_1->_95--;
|
||||
} else {
|
||||
if ((gInput.heldKeys & B_BUTTON) != 0) {
|
||||
iVar4 = 8;
|
||||
} else {
|
||||
iVar4 = 1;
|
||||
}
|
||||
param_1->_92 -= iVar4;
|
||||
if (param_1->_92 < 1) {
|
||||
iVar5 = 0;
|
||||
do {
|
||||
iVar5++;
|
||||
param_1->_92 += gUnk_08107C0C[param_1->textBox.textSpeed];
|
||||
} while (param_1->_92 < 1);
|
||||
iVar6 = 0;
|
||||
do {
|
||||
uVar3 = sub_08056750(param_1);
|
||||
if (((uVar3 == 0) || (param_1->_95 != 0)) || (param_1->_8a != 0))
|
||||
break;
|
||||
iVar6 += uVar3;
|
||||
iVar5--;
|
||||
} while (0 < iVar5);
|
||||
if (iVar6 != 0) {
|
||||
gCurrentTextBox._9d = 1;
|
||||
} else {
|
||||
param_1->_92 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/textbox/sub_08056750.inc", u16 sub_08056750(CurrentTextBox* param_1)) {
|
||||
s32 r0, r1, r2, r3;
|
||||
u32 r7;
|
||||
s32 tmp;
|
||||
u32 t;
|
||||
u32* t2;
|
||||
|
||||
r7 = param_1->_24;
|
||||
|
||||
if (r7 == 0) {
|
||||
r7 = sub_0805EFE8(¶m_1->_20);
|
||||
switch (r7) {
|
||||
case 0:
|
||||
if (gUnk_02000040.unk_00 == 1) {
|
||||
param_1->state = 5;
|
||||
sub_08056ABC(0, 0);
|
||||
} else {
|
||||
param_1->state = 2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
param_1->_8a = 2;
|
||||
if (param_1->_98.bytes.b0 == 0) {
|
||||
sub_08056BDC(1);
|
||||
} else {
|
||||
param_1->state = 3;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
sub_080564C8(3);
|
||||
break;
|
||||
case 3:
|
||||
sub_080564C8(4);
|
||||
break;
|
||||
case 4:
|
||||
param_1->_50.unk6 +=
|
||||
(param_1->_50.unk4 - param_1->_50.unk6 - sub_GetFontStrWidth(¶m_1->_20, 0)) / 2;
|
||||
break;
|
||||
case 5:
|
||||
gTextBox.unk = param_1->_22;
|
||||
break;
|
||||
case 6:
|
||||
t2 = &gUnk_0200005C;
|
||||
t = param_1->_22;
|
||||
WriteBit(t2, 0x1f & t);
|
||||
break;
|
||||
case 7:
|
||||
switch (param_1->_22) {
|
||||
case 0xe:
|
||||
param_1->_91 = param_1->_8f;
|
||||
r3 = 2;
|
||||
break;
|
||||
case 0xf:
|
||||
r3 = param_1->_91;
|
||||
break;
|
||||
default:
|
||||
r3 = param_1->_22;
|
||||
break;
|
||||
}
|
||||
param_1->_90 = 0;
|
||||
sub_080569C4(param_1, r3);
|
||||
break;
|
||||
case 8:
|
||||
SoundReq(param_1->_22);
|
||||
break;
|
||||
case 9:
|
||||
gCurrentTextBox.textBox.unk3 = param_1->_22;
|
||||
sub_08056F88(param_1->_22, param_1->_50.unk3);
|
||||
break;
|
||||
case 10:
|
||||
param_1->textBox.textWindowPosY = param_1->_22;
|
||||
break;
|
||||
case 12:
|
||||
if (gUnk_02000040.unk_00 != 1) {
|
||||
MemClear(&gUnk_02000040, 4);
|
||||
MemClear(&gUnk_02024030, sizeof(gUnk_02024030));
|
||||
gUnk_02024030.unk_00 = 1;
|
||||
gUnk_02000040.unk_00 = 1;
|
||||
}
|
||||
if (gUnk_02024030.unk_02 > 3)
|
||||
break;
|
||||
|
||||
gUnk_02024030.unk_10[gUnk_02024030.unk_02] = param_1->_26;
|
||||
gUnk_02024030.unk_08[gUnk_02024030.unk_02] = param_1->_50.unk6;
|
||||
gUnk_02024030.unk_02++;
|
||||
param_1->_50.unk6 += 8;
|
||||
break;
|
||||
case 13:
|
||||
switch (param_1->_22) {
|
||||
case 0xff:
|
||||
param_1->_8e = 1;
|
||||
break;
|
||||
case 0xfe:
|
||||
param_1->_8e = 2;
|
||||
break;
|
||||
default:
|
||||
param_1->_95 = param_1->_22;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
r1 = param_1->_22;
|
||||
param_1->_94 = r1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (r7 >> 8 == 0)
|
||||
return 0;
|
||||
}
|
||||
if (gCurrentTextBox._98.bytes.b1 != 2) {
|
||||
sub_080564C8(3);
|
||||
return 0;
|
||||
}
|
||||
if (gTextBox.unk == 0) {
|
||||
gTextBox.unk = 0x80;
|
||||
}
|
||||
param_1->_24 = 0;
|
||||
if (r7 >> 8 == 7) {
|
||||
param_1->_90 = param_1->_8f | 0x80;
|
||||
sub_080569C4(param_1, 0);
|
||||
} else {
|
||||
if ((param_1->_90 & 0x80) != 0) {
|
||||
r3 = param_1->_90;
|
||||
param_1->_90 = 0;
|
||||
sub_080569C4(param_1, r3);
|
||||
}
|
||||
}
|
||||
return sub_0805F7DC(r7, ¶m_1->_30[0x20]);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_080569C4(CurrentTextBox* ctb, u32 unk) {
|
||||
u32 temp = unk & 0x7;
|
||||
ctb->_8f = temp;
|
||||
ctb->_50.unk2 = temp;
|
||||
}
|
||||
|
||||
extern u8 gUnk_08107C14;
|
||||
extern u8 gUnk_08107C0F;
|
||||
void TextBoxHandlerQuestion(CurrentTextBox* ctb) {
|
||||
s32 r1, r5, r6;
|
||||
u32 error;
|
||||
u8* ptr1;
|
||||
u8* ptr2;
|
||||
|
||||
r5 = gUnk_02024030.unk_03;
|
||||
switch (gInput.newKeys) {
|
||||
case START_BUTTON:
|
||||
case A_BUTTON:
|
||||
r1 = gUnk_02024030.unk_10[r5];
|
||||
if (r1 == 0) {
|
||||
ptr2 = &gUnk_08107C14;
|
||||
ptr1 = &ctb->_20;
|
||||
} else {
|
||||
ctb->textBox.textIndex = r1;
|
||||
sub_0805EEB4(&ctb->_20, r1);
|
||||
ptr2 = &gUnk_08107C0F;
|
||||
ptr1 = &ctb->_20;
|
||||
}
|
||||
sub_0805EF40(ptr1, ptr2);
|
||||
gUnk_02000040.unk_01 = gUnk_02024030.unk_03;
|
||||
gUnk_02000040.unk_00 = 3;
|
||||
MemClear(&gUnk_02024030, sizeof(gUnk_02024030));
|
||||
SoundReq(0x6a); // SFX_TEXTBOX_SELECT
|
||||
ctb->state = 1;
|
||||
break;
|
||||
case DPAD_LEFT:
|
||||
r5--;
|
||||
break;
|
||||
case DPAD_RIGHT:
|
||||
r5++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
r5 = (r5 + gUnk_02024030.unk_02) % gUnk_02024030.unk_02;
|
||||
r6 = gUnk_02024030.unk_03;
|
||||
if (r5 != r6) {
|
||||
gUnk_02024030.unk_03 = r5;
|
||||
SoundReq(0x69); // SFX_TEXTBOX_CHOICE
|
||||
error = 1;
|
||||
} else {
|
||||
error = 0;
|
||||
}
|
||||
if (gUnk_02000040.unk_00 == 1) {
|
||||
gUnk_02024030.unk_00 = gUnk_02000040.unk_00 = 2;
|
||||
error = 1;
|
||||
}
|
||||
if (error != 0) {
|
||||
sub_08056ABC(r5, r6);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08056ABC(u32 unk_0, u32 unk_1) {
|
||||
u16 t;
|
||||
t = gCurrentTextBox._50.unk6;
|
||||
gCurrentTextBox._50.unk6 = gUnk_02024030.unk_08[unk_1];
|
||||
sub_0805F8E4(0, &gCurrentTextBox._50);
|
||||
gCurrentTextBox._50.unk6 = gUnk_02024030.unk_08[unk_0];
|
||||
sub_0805F8E4(1, &gCurrentTextBox._50);
|
||||
gCurrentTextBox._50.unk6 = t;
|
||||
gCurrentTextBox._9d = 1;
|
||||
}
|
||||
|
||||
void TextBoxHandlerNextBox(CurrentTextBox* ctb) {
|
||||
u32 t;
|
||||
u8* ptr;
|
||||
gTextBox.unk = 0;
|
||||
if (ctb->_94 != 0) {
|
||||
ctb->_94--;
|
||||
if (ctb->_94 != 0)
|
||||
return;
|
||||
ptr = &ctb->state;
|
||||
t = 4;
|
||||
} else {
|
||||
if (TEXTBOX_PRESS_ANY_ADVANCE_KEYS) {
|
||||
SoundReq(0x68); // SFX_TEXTBOX_SWAP
|
||||
ctb->_98.bytes.b2 = 0;
|
||||
ptr = &ctb->state;
|
||||
t = 4;
|
||||
} else {
|
||||
ptr = &ctb->_98.bytes.b2;
|
||||
t = *ptr + 1;
|
||||
}
|
||||
}
|
||||
*ptr = t;
|
||||
}
|
||||
|
||||
void TextBoxHandler4(CurrentTextBox* ctb) {
|
||||
sub_08056BDC(0);
|
||||
sub_080569C4(ctb, ctb->_8f | 0x40);
|
||||
ctb->state = 1;
|
||||
}
|
||||
|
||||
void TextBoxHandlerAdvance(CurrentTextBox* ctb) {
|
||||
gTextBox.unk = 0;
|
||||
SetDoTextBox(7);
|
||||
if ((ctb->_8e != 1) && (ctb->_8e == 2 || TEXTBOX_PRESS_ANY_ADVANCE_KEYS)) {
|
||||
sub_080564C8(4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08056BDC(u32 unk) {
|
||||
gCurrentTextBox._98.bytes.b0 = unk;
|
||||
if (unk == 0) {
|
||||
MemFill32(0xFFFFFFFF, gUnk_02000D00, sizeof(gUnk_02000D00));
|
||||
Load_02000D00_Asyc();
|
||||
gCurrentTextBox._9e = 0xf082;
|
||||
gCurrentTextBox._a0 = 0xf083;
|
||||
gCurrentTextBox._a2 = 0xf0b6;
|
||||
gCurrentTextBox._a4 = 0xf0b7;
|
||||
gCurrentTextBox._50.unk6 = 0;
|
||||
gCurrentTextBox._50.unk4 = 0xd0;
|
||||
} else {
|
||||
gCurrentTextBox._50.unk6 = 0xd0;
|
||||
gCurrentTextBox._50.unk4 = 0x1a0;
|
||||
}
|
||||
sub_080569C4(&gCurrentTextBox, gCurrentTextBox._8f | 0x40);
|
||||
}
|
||||
|
||||
void SetDoTextBox(u32 doTextbox) {
|
||||
gTextBox.doTextBox = gCurrentTextBox.textBox.doTextBox = doTextbox;
|
||||
}
|
||||
|
||||
void DeleteWindow(void) {
|
||||
u16* ptr;
|
||||
int i, j;
|
||||
|
||||
Window* window = &gCurrentWindow;
|
||||
|
||||
if (window->unk1 != 0) {
|
||||
window->unk1 = 0;
|
||||
ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(*window)];
|
||||
i = window->height + 2;
|
||||
do {
|
||||
j = 0;
|
||||
do {
|
||||
ptr[j] = 0;
|
||||
} while (j++, j < window->width + 2);
|
||||
ptr += TEXTBOX_WIDTH;
|
||||
i--;
|
||||
} while (i > 0);
|
||||
sub_0801C4A0(window->yPos, window->height);
|
||||
sub_0801C494();
|
||||
}
|
||||
}
|
||||
|
||||
u32 CalcWindowSize(u32 fade) {
|
||||
u32 scale;
|
||||
u32 ret;
|
||||
Window* window;
|
||||
|
||||
ret = 0;
|
||||
|
||||
gCurrentTextBox._98.bytes.sizeScale += fade;
|
||||
if (gCurrentTextBox._98.bytes.sizeScale < 1) {
|
||||
gCurrentTextBox._98.bytes.sizeScale = 0;
|
||||
} else {
|
||||
if (gCurrentTextBox._98.bytes.sizeScale < 8)
|
||||
goto LAB_08056cee;
|
||||
gCurrentTextBox._98.bytes.sizeScale = 8;
|
||||
}
|
||||
ret = 1;
|
||||
LAB_08056cee:
|
||||
window = &gNewWindow;
|
||||
if (gCurrentTextBox._98.bytes.sizeScale != 0) {
|
||||
scale = gCurrentTextBox._98.bytes.sizeScale;
|
||||
window->width = (scale * (gCurrentTextBox.textBox.textWindowWidth << 1)) / 16;
|
||||
if ((window->width & 1) != 0) {
|
||||
window->width++;
|
||||
}
|
||||
window->xPos = ((gCurrentTextBox.textBox.textWindowWidth / 2) + gCurrentTextBox.textBox.textWindowPosX) -
|
||||
(window->width / 2);
|
||||
|
||||
window->height = (scale * (gCurrentTextBox.textBox.textWindowHeight << 1)) / 16;
|
||||
if ((window->height & 1) != 0) {
|
||||
window->height++;
|
||||
}
|
||||
window->yPos = ((gCurrentTextBox.textBox.textWindowHeight / 2) + gCurrentTextBox.textBox.textWindowPosY) -
|
||||
(window->height / 2);
|
||||
} else {
|
||||
window->yPos = -1;
|
||||
window->xPos = -1;
|
||||
window->height = -1;
|
||||
window->width = -1;
|
||||
}
|
||||
window->unk1 = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CreateWindow(void) {
|
||||
s32 r0, r3;
|
||||
u16* ptr;
|
||||
|
||||
r0 = gCurrentTextBox._98.bytes.sizeScale;
|
||||
if (r0 <= 0)
|
||||
return;
|
||||
ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(gNewWindow)];
|
||||
r3 = 0xf07b;
|
||||
DispMessageFrame(ptr, gNewWindow.width, gNewWindow.height, r3);
|
||||
DispString();
|
||||
DispCursor();
|
||||
gCurrentWindow = gNewWindow;
|
||||
sub_0801C494();
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/textbox/DispMessageFrame.inc",
|
||||
void DispMessageFrame(u16* buffer, u32 width_, u32 height_, u32 flags_)) {
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
extern u16 gUnk_02034CB2[];
|
||||
extern u16 gUnk_0202281E[];
|
||||
|
||||
void DispString(void) {
|
||||
u32 r0, r2, r4;
|
||||
u16 *ptr, *ptr2;
|
||||
s32 i, j;
|
||||
|
||||
Window* window = &gNewWindow;
|
||||
|
||||
if (window->width != 0) {
|
||||
if (window->height != 0) {
|
||||
r4 = window->height;
|
||||
ptr = &gUnk_02034CB2[TEXTBOX_POSITION_INDEX(*window)];
|
||||
i = (s32)(4 - r4) / 2;
|
||||
do {
|
||||
j = window->width;
|
||||
r2 = gUnk_0202281E[i];
|
||||
ptr += TEXTBOX_WIDTH;
|
||||
r0 = i + 1;
|
||||
r4--;
|
||||
ptr2 = ptr;
|
||||
do {
|
||||
*ptr2 = r2;
|
||||
ptr2++;
|
||||
r2 += 2;
|
||||
j--;
|
||||
} while (j > 0);
|
||||
i = r0;
|
||||
} while (r4 != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DispCursor(void) {
|
||||
u32 offset;
|
||||
u16* ptr;
|
||||
|
||||
if ((gCurrentTextBox._98.word & 0x10ff00) == 0x100200) {
|
||||
ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(gNewWindow)];
|
||||
offset = (((gNewWindow.height + 1) * TEXTBOX_WIDTH) - 2);
|
||||
offset += gNewWindow.width;
|
||||
ptr += offset;
|
||||
*ptr = 0xf080;
|
||||
}
|
||||
}
|
||||
|
||||
void Load_02000D00_Asyc(void) {
|
||||
LoadResourceAsync(gUnk_02000D00, 0x0600D040, sizeof(gUnk_02000D00));
|
||||
}
|
||||
|
||||
void sub_08056F88(u32 unk_1, u32 unk_2) {
|
||||
u32 uVar1;
|
||||
|
||||
if (0xf < unk_1) {
|
||||
unk_1 = 0;
|
||||
}
|
||||
uVar1 = unk_1 << 4 | unk_2;
|
||||
if (gCurrentTextBox._9c != uVar1) {
|
||||
gCurrentTextBox._9c = uVar1;
|
||||
sub_0805F918(unk_1, unk_2, 0x0600CF60);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08056FBC(CurrentTextBox* ctb) {
|
||||
sub_08056FEC(ctb->textBox.field_0x10, &ctb->_66[0x2]);
|
||||
sub_08056FEC(ctb->textBox.field_0x14, &ctb->_66[0xa]);
|
||||
sub_08056FEC(ctb->textBox.field_0x18, &ctb->_77[0x1]);
|
||||
sub_08056FEC(ctb->textBox.field_0x1c, &ctb->_77[0x9]);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/textbox/sub_08056FEC.inc", u32 sub_08056FEC(u32 param_1, u8* param_2)) {
|
||||
u32 uVar1;
|
||||
int iVar2;
|
||||
int iVar3;
|
||||
int iVar4;
|
||||
u8 local_1c[8];
|
||||
|
||||
uVar1 = sub_0801D51C(param_1, param_2, param_1);
|
||||
uVar1 = uVar1 & 0xfffffff;
|
||||
iVar4 = 0;
|
||||
do {
|
||||
local_1c[iVar4++] = uVar1 & 0xf;
|
||||
uVar1 = uVar1 / 16;
|
||||
} while (uVar1 != 0);
|
||||
for (iVar3 = 0; --iVar4 >= 0; iVar3++) {
|
||||
param_2[iVar3] = local_1c[iVar4] | 0x30;
|
||||
}
|
||||
param_2[iVar3] = 0;
|
||||
return iVar4;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
Reference in New Issue
Block a user