mirror of https://github.com/zeldaret/tmc.git
code refactoring and naming stuff
This commit is contained in:
parent
a7c7f88cd8
commit
bd793c0078
|
@ -646,7 +646,7 @@ _08052BEC:
|
||||||
_08052BEE:
|
_08052BEE:
|
||||||
ldrh r0, [r3, #0x36]
|
ldrh r0, [r3, #0x36]
|
||||||
adds r1, r2, #0
|
adds r1, r2, #0
|
||||||
bl sub_080563C8
|
bl TextBoxAtYPosition
|
||||||
pop {pc}
|
pop {pc}
|
||||||
|
|
||||||
thumb_func_start sub_08052BF8
|
thumb_func_start sub_08052BF8
|
||||||
|
|
|
@ -430,7 +430,7 @@ _080A3F96:
|
||||||
bl SoundReq
|
bl SoundReq
|
||||||
ldr r0, _080A3FC8 @ =0x00000702
|
ldr r0, _080A3FC8 @ =0x00000702
|
||||||
movs r1, #0xe
|
movs r1, #0xe
|
||||||
bl sub_080563C8
|
bl TextBoxAtYPosition
|
||||||
movs r0, #1
|
movs r0, #1
|
||||||
strb r0, [r5, #6]
|
strb r0, [r5, #6]
|
||||||
movs r0, #0x78
|
movs r0, #0x78
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
|
|
||||||
.section .text
|
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
push {r4, r5, r6, lr}
|
|
||||||
ldr r5, _08056CB8 @ =gCurrentWindow
|
|
||||||
ldrb r0, [r5, #1]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08056CB4
|
|
||||||
movs r0, #0
|
|
||||||
strb r0, [r5, #1]
|
|
||||||
ldrb r0, [r5, #5]
|
|
||||||
lsls r0, r0, #5
|
|
||||||
ldrb r1, [r5, #4]
|
|
||||||
adds r0, r0, r1
|
|
||||||
lsls r0, r0, #1
|
|
||||||
ldr r1, _08056CBC @ =gBG0Buffer
|
|
||||||
adds r1, r0, r1
|
|
||||||
ldrb r0, [r5, #7]
|
|
||||||
adds r0, #2
|
|
||||||
movs r6, #0
|
|
||||||
_08056C8A:
|
|
||||||
movs r2, #0
|
|
||||||
adds r4, r1, #0
|
|
||||||
adds r4, #0x40
|
|
||||||
subs r3, r0, #1
|
|
||||||
_08056C92:
|
|
||||||
strh r6, [r1]
|
|
||||||
adds r1, #2
|
|
||||||
adds r2, #1
|
|
||||||
ldrb r0, [r5, #6]
|
|
||||||
adds r0, #2
|
|
||||||
cmp r2, r0
|
|
||||||
blt _08056C92
|
|
||||||
adds r1, r4, #0
|
|
||||||
adds r0, r3, #0
|
|
||||||
cmp r0, #0
|
|
||||||
bgt _08056C8A
|
|
||||||
ldrb r0, [r5, #5]
|
|
||||||
ldrb r1, [r5, #7]
|
|
||||||
bl sub_0801C4A0
|
|
||||||
bl sub_0801C494
|
|
||||||
_08056CB4:
|
|
||||||
pop {r4, r5, r6, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_08056CB8: .4byte gCurrentWindow
|
|
||||||
_08056CBC: .4byte gBG0Buffer
|
|
||||||
|
|
||||||
.syntax divided
|
|
|
@ -1,52 +0,0 @@
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
push {r4, r5, r6, r7, lr}
|
|
||||||
ldr r6, _08056F10 @ =gNewWindow
|
|
||||||
ldrb r0, [r6, #6]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08056F0E
|
|
||||||
ldrb r0, [r6, #7]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08056F0E
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r0, [r6, #5]
|
|
||||||
lsls r0, r0, #5
|
|
||||||
ldrb r1, [r6, #4]
|
|
||||||
adds r0, r0, r1
|
|
||||||
lsls r0, r0, #1
|
|
||||||
ldr r1, _08056F14 @ =gUnk_02034CB2
|
|
||||||
adds r5, r0, r1
|
|
||||||
movs r0, #4
|
|
||||||
subs r0, r0, r4
|
|
||||||
lsrs r1, r0, #0x1f
|
|
||||||
adds r0, r0, r1
|
|
||||||
asrs r1, r0, #1
|
|
||||||
ldr r7, _08056F18 @ =gUnk_0202281E
|
|
||||||
_08056EEC:
|
|
||||||
ldrb r3, [r6, #6]
|
|
||||||
lsls r0, r1, #1
|
|
||||||
adds r0, r0, r7
|
|
||||||
ldrh r2, [r0]
|
|
||||||
adds r5, #0x40
|
|
||||||
adds r0, r1, #1
|
|
||||||
subs r4, #1
|
|
||||||
adds r1, r5, #0
|
|
||||||
_08056EFC:
|
|
||||||
strh r2, [r1]
|
|
||||||
adds r1, #2
|
|
||||||
adds r2, #2
|
|
||||||
subs r3, #1
|
|
||||||
cmp r3, #0
|
|
||||||
bgt _08056EFC
|
|
||||||
adds r1, r0, #0
|
|
||||||
cmp r4, #0
|
|
||||||
bne _08056EEC
|
|
||||||
_08056F0E:
|
|
||||||
pop {r4, r5, r6, r7, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_08056F10: .4byte gNewWindow
|
|
||||||
_08056F14: .4byte gUnk_02034CB2
|
|
||||||
_08056F18: .4byte gUnk_0202281E
|
|
||||||
|
|
||||||
.syntax divided
|
|
|
@ -72,7 +72,7 @@ _08056560:
|
||||||
movs r0, #0xd0
|
movs r0, #0xd0
|
||||||
strh r0, [r4]
|
strh r0, [r4]
|
||||||
movs r0, #2
|
movs r0, #2
|
||||||
bl sub_08056C54
|
bl SetDoTextBox
|
||||||
movs r0, #0
|
movs r0, #0
|
||||||
bl sub_08056BDC
|
bl sub_08056BDC
|
||||||
movs r0, #2
|
movs r0, #2
|
|
@ -264,13 +264,8 @@ extern void sub_08073904(Entity*);
|
||||||
extern u32 sub_08056134(void);
|
extern u32 sub_08056134(void);
|
||||||
extern void sub_08004484(Entity*, Entity*);
|
extern void sub_08004484(Entity*, Entity*);
|
||||||
extern void sub_080564C8(u32);
|
extern void sub_080564C8(u32);
|
||||||
extern void sub_08056F70(void);
|
|
||||||
extern void DeleteWindow(void);
|
|
||||||
extern void CreateWindow(void);
|
|
||||||
extern void sub_0805EEB4(u8*, u32);
|
extern void sub_0805EEB4(u8*, u32);
|
||||||
extern void sub_08056C54(u32);
|
|
||||||
extern void sub_08056BDC(u32);
|
extern void sub_08056BDC(u32);
|
||||||
extern void sub_08056F88(u32, u32);
|
extern void sub_08056F88(u32, u32);
|
||||||
extern u32 sub_08056CC0(u32);
|
|
||||||
extern void sub_0805F8E4(u32 r0, WStruct* r1);
|
extern void sub_0805F8E4(u32 r0, WStruct* r1);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
#define SAVE_H
|
#define SAVE_H
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "entity.h"
|
#include "player.h"
|
||||||
#include "functions.h"
|
|
||||||
#include "menu.h"
|
|
||||||
#include "structures.h"
|
#include "structures.h"
|
||||||
|
|
||||||
#define FILENAME_LENGTH 6
|
#define FILENAME_LENGTH 6
|
||||||
|
|
|
@ -148,23 +148,10 @@ typedef struct {
|
||||||
} data;
|
} data;
|
||||||
} Dialog;
|
} Dialog;
|
||||||
|
|
||||||
typedef struct {
|
extern u16 gBG0Buffer[0x400];
|
||||||
u8 filler0[0x29C];
|
extern u16 gBG1Buffer[0x400];
|
||||||
u16 unk29C;
|
extern u16 gBG2Buffer[0x400];
|
||||||
u8 filler29E[0x562];
|
extern u16 gBG3Buffer[0x800];
|
||||||
} BGBuffer;
|
|
||||||
extern BGBuffer gBG0Buffer;
|
|
||||||
extern BGBuffer gBG1Buffer;
|
|
||||||
extern BGBuffer gBG2Buffer;
|
|
||||||
static_assert(sizeof(BGBuffer) == 0x800);
|
|
||||||
|
|
||||||
/*
|
|
||||||
typedef struct {
|
|
||||||
u16 filler0[0x800];
|
|
||||||
} BG3Buffer;
|
|
||||||
extern BG3Buffer gBG3Buffer;
|
|
||||||
static_assert(sizeof(BG3Buffer) == 0x1000);
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u8 filler[0x70];
|
u8 filler[0x70];
|
||||||
|
|
|
@ -36,13 +36,12 @@ typedef struct {
|
||||||
void* _2c;
|
void* _2c;
|
||||||
u8 _30[0x20];
|
u8 _30[0x20];
|
||||||
WStruct _50;
|
WStruct _50;
|
||||||
u8 _5c;
|
char playerName[0xa];
|
||||||
u8 _5d;
|
u8 _66[0x10];
|
||||||
u8 _5e[24];
|
|
||||||
u8 _76;
|
u8 _76;
|
||||||
u8 _77[0x11];
|
u8 _77[0x11];
|
||||||
u8 _88;
|
u8 _88;
|
||||||
u8 _89;
|
u8 state;
|
||||||
u8 _8a;
|
u8 _8a;
|
||||||
u8 _8b;
|
u8 _8b;
|
||||||
u8 _8c;
|
u8 _8c;
|
||||||
|
@ -63,7 +62,7 @@ typedef struct {
|
||||||
u8 b0;
|
u8 b0;
|
||||||
u8 b1;
|
u8 b1;
|
||||||
u8 b2;
|
u8 b2;
|
||||||
s8 b3;
|
s8 sizeScale;
|
||||||
} bytes;
|
} bytes;
|
||||||
} _98;
|
} _98;
|
||||||
u8 _9c;
|
u8 _9c;
|
||||||
|
@ -102,9 +101,9 @@ void TextboxAtPosition(u32 index, u32 x, u32 y);
|
||||||
* @brief Show a message that attempts not to obscure the entity.
|
* @brief Show a message that attempts not to obscure the entity.
|
||||||
*
|
*
|
||||||
* @param index u32 Message index
|
* @param index u32 Message index
|
||||||
* @param ent Entity* Your important entity
|
* @param entity Entity* Your important entity
|
||||||
*/
|
*/
|
||||||
void TextboxNoOverlap(u32 index, Entity* ent);
|
void TextboxNoOverlap(u32 index, Entity* entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Show a message that attempts not to obscure the camera target.
|
* @brief Show a message that attempts not to obscure the camera target.
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#include "structures.h"
|
#include "structures.h"
|
||||||
#include "textbox.h"
|
#include "textbox.h"
|
||||||
|
|
||||||
extern u8 gBG3Buffer[];
|
|
||||||
|
|
||||||
extern void (*const gUnk_08109A30[])();
|
extern void (*const gUnk_08109A30[])();
|
||||||
|
|
||||||
void HandleDebugTextScreen() {
|
void HandleDebugTextScreen() {
|
||||||
|
@ -17,8 +15,8 @@ void HandleDebugTextScreen() {
|
||||||
|
|
||||||
void sub_0805FA04(void) {
|
void sub_0805FA04(void) {
|
||||||
DispReset(1);
|
DispReset(1);
|
||||||
MemClear(&gBG0Buffer, sizeof(BGBuffer));
|
MemClear(&gBG0Buffer, sizeof(gBG0Buffer));
|
||||||
MemClear(&gBG3Buffer, 0x1000);
|
MemClear(&gBG3Buffer, sizeof(gBG3Buffer));
|
||||||
gScreen.lcd.displayControl = 0x940;
|
gScreen.lcd.displayControl = 0x940;
|
||||||
gScreen.bg.bg0xOffset = 0;
|
gScreen.bg.bg0xOffset = 0;
|
||||||
gScreen.bg.bg0yOffset = 0;
|
gScreen.bg.bg0yOffset = 0;
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "structures.h"
|
||||||
|
|
||||||
void sub_0802A39C(Entity*);
|
void sub_0802A39C(Entity*);
|
||||||
void sub_0802A334(Entity*);
|
void sub_0802A334(Entity*);
|
||||||
|
|
||||||
extern u16 gBG3Buffer[];
|
|
||||||
|
|
||||||
extern void (*const gUnk_080CD030[])(Entity*);
|
extern void (*const gUnk_080CD030[])(Entity*);
|
||||||
extern const u8 gUnk_080CD03C[];
|
extern const u8 gUnk_080CD03C[];
|
||||||
extern const s8 gUnk_080CD040[];
|
extern const s8 gUnk_080CD040[];
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "textbox.h"
|
#include "textbox.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
// copy, erase, start
|
// copy, erase, start
|
||||||
#define NUM_FILE_OPERATIONS 3
|
#define NUM_FILE_OPERATIONS 3
|
||||||
|
@ -498,7 +499,7 @@ void sub_08050AFC(u32 idx) {
|
||||||
SetActiveSave(idx);
|
SetActiveSave(idx);
|
||||||
MemClear(&gBG1Buffer, sizeof(gBG1Buffer));
|
MemClear(&gBG1Buffer, sizeof(gBG1Buffer));
|
||||||
if (gUnk_02019EE0.saveStatus[idx] == SAVE_VALID) {
|
if (gUnk_02019EE0.saveStatus[idx] == SAVE_VALID) {
|
||||||
sub_08050B3C(&gBG1Buffer.unk29C);
|
sub_08050B3C(&gBG1Buffer[0x14E]);
|
||||||
}
|
}
|
||||||
gScreen.bg.bg1Updated = 1;
|
gScreen.bg.bg1Updated = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "structures.h"
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
@ -10,7 +9,9 @@
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "fileScreen.h"
|
#include "fileScreen.h"
|
||||||
|
#include "menu.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "structures.h"
|
||||||
|
|
||||||
extern u8 gArea;
|
extern u8 gArea;
|
||||||
extern Entity gPlayerEntity;
|
extern Entity gPlayerEntity;
|
||||||
|
|
|
@ -426,8 +426,6 @@ void sub_0805A94C(Manager15* this) {
|
||||||
gScreen.controls.window1VerticalDimensions = (tmp1 << 8 | tmp2);
|
gScreen.controls.window1VerticalDimensions = (tmp1 << 8 | tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern u8 gBG3Buffer[];
|
|
||||||
|
|
||||||
#ifdef NON_MATCHING
|
#ifdef NON_MATCHING
|
||||||
void sub_0805A9CC(Manager15* this) {
|
void sub_0805A9CC(Manager15* this) {
|
||||||
int tmp1, tmp2;
|
int tmp1, tmp2;
|
||||||
|
|
|
@ -39,7 +39,6 @@ void sub_08057EFC(Manager8* this) {
|
||||||
|
|
||||||
void sub_08058004(u32, void*, void*);
|
void sub_08058004(u32, void*, void*);
|
||||||
|
|
||||||
extern u8 gBG3Buffer[];
|
|
||||||
extern u8 gUnk_02006F00[];
|
extern u8 gUnk_02006F00[];
|
||||||
|
|
||||||
void sub_08057F20(Manager8* this) {
|
void sub_08057F20(Manager8* this) {
|
||||||
|
@ -59,8 +58,8 @@ void sub_08057F20(Manager8* this) {
|
||||||
tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2);
|
tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2);
|
||||||
gScreen.bg.bg1xOffset = tmp & 0xF;
|
gScreen.bg.bg1xOffset = tmp & 0xF;
|
||||||
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1);
|
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1);
|
||||||
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x800;
|
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x400;
|
||||||
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x800);
|
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x400);
|
||||||
tmp = ((tmp >> 4) << 1);
|
tmp = ((tmp >> 4) << 1);
|
||||||
if (this->unk_3c != tmp) {
|
if (this->unk_3c != tmp) {
|
||||||
this->unk_3c = tmp;
|
this->unk_3c = tmp;
|
||||||
|
@ -123,11 +122,11 @@ void sub_080580B0(u32 unk1) {
|
||||||
gScreen.affine.bg3Updated = 1;
|
gScreen.affine.bg3Updated = 1;
|
||||||
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7
|
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7
|
||||||
tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2;
|
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.bg1xOffset = tmp & 0xF;
|
||||||
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
|
gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
|
||||||
gScreen.bg.bg1Control = 0x1E09;
|
gScreen.bg.bg1Control = 0x1E09;
|
||||||
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x800;
|
gScreen.bg.bg1Tilemap = gBG3Buffer + 0x400;
|
||||||
gScreen.bg.bg1Updated = 1;
|
gScreen.bg.bg1Updated = 1;
|
||||||
gScreen.controls.layerFXControl = 0x3C48;
|
gScreen.controls.layerFXControl = 0x3C48;
|
||||||
gScreen.controls.alphaBlend = 0x609;
|
gScreen.controls.alphaBlend = 0x609;
|
||||||
|
|
|
@ -13,11 +13,10 @@ typedef struct {
|
||||||
void sub_08058204(Manager9*);
|
void sub_08058204(Manager9*);
|
||||||
void sub_08058210(Manager9*);
|
void sub_08058210(Manager9*);
|
||||||
u32 sub_08058244(int);
|
u32 sub_08058244(int);
|
||||||
void sub_080582A0(u32, u32*, u8*);
|
void sub_080582A0(u32, u32*, u16*);
|
||||||
void sub_080582F8(u8*, u8*);
|
void sub_080582F8(u8*, u8*);
|
||||||
|
|
||||||
extern u32 gUnk_02006F00[];
|
extern u32 gUnk_02006F00[];
|
||||||
extern u8 gBG3Buffer[];
|
|
||||||
|
|
||||||
const u16 gUnk_081081EC[] = { 0x30, 0x30, 0x30, 0x38 };
|
const u16 gUnk_081081EC[] = { 0x30, 0x30, 0x30, 0x38 };
|
||||||
|
|
||||||
|
@ -55,13 +54,13 @@ u32 sub_08058244(int i) {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_080582A0(u32 unk, u32* unk2, u8* unk3) {
|
void sub_080582A0(u32 unk, u32* unk2, u16* unk3) {
|
||||||
int i = 0x20;
|
int i = 0x20;
|
||||||
unk2 += unk >> 4;
|
unk2 += unk >> 4;
|
||||||
for (; i != 0; i--) {
|
for (; i != 0; i--) {
|
||||||
DmaSet(3, unk2, unk3, 0x80000020);
|
DmaSet(3, unk2, unk3, 0x80000020);
|
||||||
unk2 += 0x40;
|
unk2 += 0x40;
|
||||||
unk3 += 0x40;
|
unk3 += 0x20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
#include "script.h"
|
#include "script.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
extern void sub_08078850(Entity*, u32, u32, u8*);
|
extern void sub_08078850(Entity*, u32, u32, u8*);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
#include "gba/eeprom.h"
|
#include "gba/eeprom.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
typedef struct SaveFileStatus {
|
typedef struct SaveFileStatus {
|
||||||
u16 checksum1;
|
u16 checksum1;
|
||||||
|
|
307
src/textbox.c
307
src/textbox.c
|
@ -8,6 +8,12 @@
|
||||||
#include "structures.h"
|
#include "structures.h"
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
|
|
||||||
|
#define TEXTBOX_ADVANCE_KEYS (A_BUTTON | B_BUTTON | DPAD_ANY | R_BUTTON)
|
||||||
|
#define TEXTBOX_PRESS_ANY_ADVANCE_KEYS ((gInput.newKeys & TEXTBOX_ADVANCE_KEYS) != 0)
|
||||||
|
|
||||||
|
#define TEXTBOX_WIDTH 0x20
|
||||||
|
#define TEXTBOX_POSITION_INDEX(window) ((window).yPos * TEXTBOX_WIDTH + (window).xPos)
|
||||||
|
|
||||||
extern void WriteBit(u32*, u32);
|
extern void WriteBit(u32*, u32);
|
||||||
extern void sub_0805EF40(u8*, u8*);
|
extern void sub_0805EF40(u8*, u8*);
|
||||||
extern void sub_0801C4A0(u32, u32);
|
extern void sub_0801C4A0(u32, u32);
|
||||||
|
@ -17,12 +23,6 @@ extern u32 sub_0801D51C(u32, u8*, u32);
|
||||||
|
|
||||||
u32 sub_08056FEC(u32, u8*);
|
u32 sub_08056FEC(u32, u8*);
|
||||||
|
|
||||||
u32 sub_080564DC(void);
|
|
||||||
u32 sub_080564EC(void);
|
|
||||||
u32 sub_08056654(void);
|
|
||||||
u32 sub_080565B4(void);
|
|
||||||
u32 sub_080565F8(void);
|
|
||||||
u32 sub_08056640(void);
|
|
||||||
u16 sub_08056750(CurrentTextBox*);
|
u16 sub_08056750(CurrentTextBox*);
|
||||||
u32 sub_0805EFE8(u8*);
|
u32 sub_0805EFE8(u8*);
|
||||||
void sub_08056ABC(u32, u32);
|
void sub_08056ABC(u32, u32);
|
||||||
|
@ -30,9 +30,28 @@ void sub_080569C4(CurrentTextBox*, u32);
|
||||||
u16 sub_0805F7DC(u32, u8*);
|
u16 sub_0805F7DC(u32, u8*);
|
||||||
u32 sub_GetFontStrWidth(u8*, u32);
|
u32 sub_GetFontStrWidth(u8*, u32);
|
||||||
void sub_08056FBC(CurrentTextBox*);
|
void sub_08056FBC(CurrentTextBox*);
|
||||||
|
void SetDoTextBox(u32 doTextbox);
|
||||||
|
void Load_02000D00_Asyc(void);
|
||||||
|
|
||||||
u32 (*const gUnk_08107BC8[])(void) = {
|
void DeleteWindow(void);
|
||||||
sub_080564DC, sub_080564EC, sub_08056654, sub_080565B4, sub_080565F8, sub_08056640,
|
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;
|
extern u8 gUnk_020227DC, gUnk_020227E8, gUnk_020227F0, gUnk_020227F8, gUnk_02022800;
|
||||||
|
@ -40,15 +59,18 @@ u8* const gUnk_08107BE0[] = {
|
||||||
&gUnk_020227DC, &gUnk_020227E8, &gUnk_020227F0, &gUnk_020227F8, &gUnk_02022800,
|
&gUnk_020227DC, &gUnk_020227E8, &gUnk_020227F0, &gUnk_020227F8, &gUnk_02022800,
|
||||||
};
|
};
|
||||||
|
|
||||||
void sub_08056684(CurrentTextBox*);
|
typedef void (*TextBoxHandler)(CurrentTextBox*);
|
||||||
void sub_080566B8(CurrentTextBox*);
|
|
||||||
void sub_08056BA0(CurrentTextBox*);
|
|
||||||
void sub_08056B1C(CurrentTextBox*);
|
|
||||||
void sub_08056B7C(CurrentTextBox*);
|
|
||||||
void sub_080569D4(CurrentTextBox*);
|
|
||||||
|
|
||||||
void (*const gUnk_08107BF4[])(CurrentTextBox*) = {
|
void TextBoxHandler0(CurrentTextBox* this);
|
||||||
sub_08056684, sub_080566B8, sub_08056BA0, sub_08056B1C, sub_08056B7C, sub_080569D4,
|
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,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct Window {
|
typedef struct Window {
|
||||||
|
@ -56,10 +78,10 @@ typedef struct Window {
|
||||||
u8 unk1;
|
u8 unk1;
|
||||||
u8 unk2;
|
u8 unk2;
|
||||||
u8 unk3;
|
u8 unk3;
|
||||||
u8 unk4;
|
u8 xPos;
|
||||||
u8 unk5;
|
u8 yPos;
|
||||||
u8 unk6;
|
u8 width;
|
||||||
u8 unk7;
|
u8 height;
|
||||||
} Window;
|
} Window;
|
||||||
extern Window gCurrentWindow;
|
extern Window gCurrentWindow;
|
||||||
extern Window gNewWindow;
|
extern Window gNewWindow;
|
||||||
|
@ -77,7 +99,7 @@ extern struct {
|
||||||
extern u32 gUnk_0200005C;
|
extern u32 gUnk_0200005C;
|
||||||
|
|
||||||
extern u8 gUnk_020227A0;
|
extern u8 gUnk_020227A0;
|
||||||
extern u8 gUnk_02000D00;
|
extern u8 gUnk_02000D00[0xD00];
|
||||||
|
|
||||||
extern const u8 gUnk_08107C0C[];
|
extern const u8 gUnk_08107C0C[];
|
||||||
|
|
||||||
|
@ -92,7 +114,7 @@ s32 sub_08056338(void) {
|
||||||
|
|
||||||
void sub_08056360(void) {
|
void sub_08056360(void) {
|
||||||
if ((gTextBox.doTextBox & 0x7f) != 0) {
|
if ((gTextBox.doTextBox & 0x7f) != 0) {
|
||||||
gTextBox.doTextBox = 0x80 | 0x8;
|
gTextBox.doTextBox = 0x88;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,21 +126,21 @@ void TextboxNoOverlapFollow(u32 index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextboxNoOverlap(u32 index, Entity* ent) {
|
void TextboxNoOverlap(u32 index, Entity* entity) {
|
||||||
s16 y;
|
s16 y;
|
||||||
s16 h;
|
s16 height;
|
||||||
|
|
||||||
ShowTextbox(index);
|
ShowTextbox(index);
|
||||||
|
|
||||||
y = ent->y.HALF.HI;
|
y = entity->y.HALF.HI;
|
||||||
h = ent->height.HALF.HI;
|
height = entity->height.HALF.HI;
|
||||||
|
|
||||||
if (((y + h) - gRoomControls.roomScrollY) > 0x58) {
|
if (((y + height) - gRoomControls.roomScrollY) > 0x58) {
|
||||||
gTextBox.textWindowPosY = 1;
|
gTextBox.textWindowPosY = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_080563C8(u32 index, u32 y) {
|
void TextBoxAtYPosition(u32 index, u32 y) {
|
||||||
TextboxAtPosition(index, 1, y);
|
TextboxAtPosition(index, 1, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,29 +181,29 @@ void MessageUpdate(void) {
|
||||||
gCurrentTextBox._8a--;
|
gCurrentTextBox._8a--;
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
iVar1 = gUnk_08107BC8[gCurrentTextBox._88]();
|
iVar1 = gTextBoxFunctions[gCurrentTextBox._88]();
|
||||||
} while (iVar1 != 0);
|
} while (iVar1 != 0);
|
||||||
}
|
}
|
||||||
if (gCurrentTextBox._9d != 0) {
|
if (gCurrentTextBox._9d != 0) {
|
||||||
gCurrentTextBox._9d = 0;
|
gCurrentTextBox._9d = 0;
|
||||||
sub_08056F70();
|
Load_02000D00_Asyc();
|
||||||
}
|
}
|
||||||
DeleteWindow();
|
DeleteWindow();
|
||||||
CreateWindow();
|
CreateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_080564C8(u32 a1) {
|
void sub_080564C8(u32 unk) {
|
||||||
gCurrentTextBox._88 = a1;
|
gCurrentTextBox._88 = unk;
|
||||||
gCurrentTextBox._89 = 0;
|
gCurrentTextBox.state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sub_080564DC(void) {
|
u32 TextBoxFunction0(void) {
|
||||||
gCurrentTextBox._98.bytes.b1 = 0;
|
gCurrentTextBox._98.bytes.b1 = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// regalloc in loop
|
// 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;
|
u32 uVar1;
|
||||||
char* dest;
|
char* dest;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
@ -195,16 +217,17 @@ NONMATCH("asm/non_matching/textbox/sub_080564EC.inc", u32 sub_080564EC(void)) {
|
||||||
gCurrentTextBox.textBox.textSpeed = gUnk_02000000->messageSpeed;
|
gCurrentTextBox.textBox.textSpeed = gUnk_02000000->messageSpeed;
|
||||||
}
|
}
|
||||||
gCurrentTextBox._9c = 0xff;
|
gCurrentTextBox._9c = 0xff;
|
||||||
sub_0805EEB4(&gCurrentTextBox._20, gCurrentTextBox.textBox.textIndex /*, 32*/);
|
sub_0805EEB4(&gCurrentTextBox._20, gCurrentTextBox.textBox.textIndex);
|
||||||
gCurrentTextBox._5c = 2;
|
gCurrentTextBox.playerName[0] = 2;
|
||||||
gCurrentTextBox._5d = 0xe;
|
gCurrentTextBox.playerName[1] = 0xe;
|
||||||
dest = gCurrentTextBox._5e;
|
dest = &gCurrentTextBox.playerName[2];
|
||||||
|
|
||||||
for (i = 0; i < 6; ++i) {
|
for (i = 0; i < FILENAME_LENGTH; ++i) {
|
||||||
c = gSave.playerName[i];
|
c = gSave.playerName[i];
|
||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
break;
|
break;
|
||||||
dest[i] = c;
|
*dest = c;
|
||||||
|
dest++;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest[0] = 2;
|
dest[0] = 2;
|
||||||
|
@ -212,69 +235,69 @@ NONMATCH("asm/non_matching/textbox/sub_080564EC.inc", u32 sub_080564EC(void)) {
|
||||||
dest[2] = 0;
|
dest[2] = 0;
|
||||||
sub_08056FBC(&gCurrentTextBox);
|
sub_08056FBC(&gCurrentTextBox);
|
||||||
gCurrentTextBox._2c = &gUnk_08107BE0;
|
gCurrentTextBox._2c = &gUnk_08107BE0;
|
||||||
gCurrentTextBox._50.unk8 = &gUnk_02000D00;
|
gCurrentTextBox._50.unk8 = gUnk_02000D00;
|
||||||
gCurrentTextBox._50.unk4 = 0xd0;
|
gCurrentTextBox._50.unk4 = 0xd0;
|
||||||
sub_08056C54(2);
|
SetDoTextBox(2);
|
||||||
sub_08056BDC(0);
|
sub_08056BDC(0);
|
||||||
sub_080564C8(2);
|
sub_080564C8(2);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
END_NONMATCH
|
END_NONMATCH
|
||||||
|
|
||||||
u32 sub_080565B4(void) {
|
u32 TextBoxFunctionOpen(void) {
|
||||||
if (gCurrentTextBox._89 == 0) {
|
if (gCurrentTextBox.state == 0) {
|
||||||
gCurrentTextBox._89 = 1;
|
gCurrentTextBox.state = 1;
|
||||||
gCurrentTextBox._98.bytes.b1 = 1;
|
gCurrentTextBox._98.bytes.b1 = 1;
|
||||||
sub_08056F88(gCurrentTextBox.textBox.unk3, gCurrentTextBox._50.unk3);
|
sub_08056F88(gCurrentTextBox.textBox.unk3, gCurrentTextBox._50.unk3);
|
||||||
SoundReq(SFX_TEXTBOX_OPEN);
|
SoundReq(SFX_TEXTBOX_OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_08056CC0(1)) {
|
if (CalcWindowSize(1)) {
|
||||||
gCurrentTextBox._98.bytes.b1 = 2;
|
gCurrentTextBox._98.bytes.b1 = 2;
|
||||||
sub_080564C8(2);
|
sub_080564C8(2);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sub_080565F8(void) {
|
u32 TextBoxFunctionClose(void) {
|
||||||
if (gCurrentTextBox._89 == 0) {
|
if (gCurrentTextBox.state == 0) {
|
||||||
gCurrentTextBox._89 = 1;
|
gCurrentTextBox.state = 1;
|
||||||
gCurrentTextBox._98.bytes.b1 = 3;
|
gCurrentTextBox._98.bytes.b1 = 3;
|
||||||
sub_08056BDC(0);
|
sub_08056BDC(0);
|
||||||
SoundReq(SFX_TEXTBOX_CLOSE);
|
SoundReq(SFX_TEXTBOX_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_08056CC0(-1)) {
|
if (CalcWindowSize(-1)) {
|
||||||
gCurrentTextBox._98.bytes.b1 = 0;
|
gCurrentTextBox._98.bytes.b1 = 0;
|
||||||
sub_080564C8(2);
|
sub_080564C8(2);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sub_08056640(void) {
|
u32 TextBoxFunction5(void) {
|
||||||
sub_08056C54(0);
|
SetDoTextBox(0);
|
||||||
sub_080564C8(0);
|
sub_080564C8(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sub_08056654(void) {
|
u32 HandleTextBox(void) {
|
||||||
sub_08056C54(4);
|
SetDoTextBox(4);
|
||||||
gUnk_08107BF4[gCurrentTextBox._89](&gCurrentTextBox);
|
gTextBoxHandlers[gCurrentTextBox.state](&gCurrentTextBox);
|
||||||
sub_08056CC0(0);
|
CalcWindowSize(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056684(CurrentTextBox* this) {
|
void TextBoxHandler0(CurrentTextBox* this) {
|
||||||
if ((gCurrentTextBox._20 & 1) == 0) {
|
if ((gCurrentTextBox._20 & 1) == 0) {
|
||||||
if (gCurrentTextBox._98.bytes.b1 == '\0') {
|
if (gCurrentTextBox._98.bytes.b1 == 0) {
|
||||||
sub_080564C8(5);
|
sub_080564C8(5);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->_89 = 1;
|
this->state = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_080566B8(CurrentTextBox* param_1) {
|
void TextBoxHandler1(CurrentTextBox* param_1) {
|
||||||
u32 uVar3;
|
u32 uVar3;
|
||||||
s32 iVar4;
|
s32 iVar4;
|
||||||
int iVar5;
|
int iVar5;
|
||||||
|
@ -326,10 +349,10 @@ NONMATCH("asm/non_matching/textbox/sub_08056750.inc", u16 sub_08056750(CurrentTe
|
||||||
switch (r7) {
|
switch (r7) {
|
||||||
case 0:
|
case 0:
|
||||||
if (gUnk_02000040.unk_00 == 1) {
|
if (gUnk_02000040.unk_00 == 1) {
|
||||||
param_1->_89 = 5;
|
param_1->state = 5;
|
||||||
sub_08056ABC(0, 0);
|
sub_08056ABC(0, 0);
|
||||||
} else {
|
} else {
|
||||||
param_1->_89 = 2;
|
param_1->state = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -337,7 +360,7 @@ NONMATCH("asm/non_matching/textbox/sub_08056750.inc", u16 sub_08056750(CurrentTe
|
||||||
if (param_1->_98.bytes.b0 == 0) {
|
if (param_1->_98.bytes.b0 == 0) {
|
||||||
sub_08056BDC(1);
|
sub_08056BDC(1);
|
||||||
} else {
|
} else {
|
||||||
param_1->_89 = 3;
|
param_1->state = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -452,7 +475,7 @@ void sub_080569C4(CurrentTextBox* ctb, u32 unk) {
|
||||||
|
|
||||||
extern u8 gUnk_08107C14;
|
extern u8 gUnk_08107C14;
|
||||||
extern u8 gUnk_08107C0F;
|
extern u8 gUnk_08107C0F;
|
||||||
void sub_080569D4(CurrentTextBox* ctb) {
|
void TextBoxHandlerQuestion(CurrentTextBox* ctb) {
|
||||||
s32 r1, r5, r6;
|
s32 r1, r5, r6;
|
||||||
u32 error;
|
u32 error;
|
||||||
u8* ptr1;
|
u8* ptr1;
|
||||||
|
@ -477,7 +500,7 @@ void sub_080569D4(CurrentTextBox* ctb) {
|
||||||
gUnk_02000040.unk_00 = 3;
|
gUnk_02000040.unk_00 = 3;
|
||||||
MemClear(&gUnk_02024030, sizeof(gUnk_02024030));
|
MemClear(&gUnk_02024030, sizeof(gUnk_02024030));
|
||||||
SoundReq(0x6a); // SFX_TEXTBOX_SELECT
|
SoundReq(0x6a); // SFX_TEXTBOX_SELECT
|
||||||
ctb->_89 = 1;
|
ctb->state = 1;
|
||||||
break;
|
break;
|
||||||
case DPAD_LEFT:
|
case DPAD_LEFT:
|
||||||
r5--;
|
r5--;
|
||||||
|
@ -517,7 +540,7 @@ void sub_08056ABC(u32 unk_0, u32 unk_1) {
|
||||||
gCurrentTextBox._9d = 1;
|
gCurrentTextBox._9d = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056B1C(CurrentTextBox* ctb) {
|
void TextBoxHandlerNextBox(CurrentTextBox* ctb) {
|
||||||
u32 t;
|
u32 t;
|
||||||
u8* ptr;
|
u8* ptr;
|
||||||
gTextBox.unk = 0;
|
gTextBox.unk = 0;
|
||||||
|
@ -525,13 +548,13 @@ void sub_08056B1C(CurrentTextBox* ctb) {
|
||||||
ctb->_94--;
|
ctb->_94--;
|
||||||
if (ctb->_94 != 0)
|
if (ctb->_94 != 0)
|
||||||
return;
|
return;
|
||||||
ptr = &ctb->_89;
|
ptr = &ctb->state;
|
||||||
t = 4;
|
t = 4;
|
||||||
} else {
|
} else {
|
||||||
if ((gInput.newKeys & 0x1f3) != 0) {
|
if (TEXTBOX_PRESS_ANY_ADVANCE_KEYS) {
|
||||||
SoundReq(0x68); // SFX_TEXTBOX_SWAP
|
SoundReq(0x68); // SFX_TEXTBOX_SWAP
|
||||||
ctb->_98.bytes.b2 = 0;
|
ctb->_98.bytes.b2 = 0;
|
||||||
ptr = &ctb->_89;
|
ptr = &ctb->state;
|
||||||
t = 4;
|
t = 4;
|
||||||
} else {
|
} else {
|
||||||
ptr = &ctb->_98.bytes.b2;
|
ptr = &ctb->_98.bytes.b2;
|
||||||
|
@ -541,16 +564,16 @@ void sub_08056B1C(CurrentTextBox* ctb) {
|
||||||
*ptr = t;
|
*ptr = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056B7C(CurrentTextBox* ctb) {
|
void TextBoxHandler4(CurrentTextBox* ctb) {
|
||||||
sub_08056BDC(0);
|
sub_08056BDC(0);
|
||||||
sub_080569C4(ctb, ctb->_8f | 0x40);
|
sub_080569C4(ctb, ctb->_8f | 0x40);
|
||||||
ctb->_89 = 1;
|
ctb->state = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056BA0(CurrentTextBox* ctb) {
|
void TextBoxHandlerAdvance(CurrentTextBox* ctb) {
|
||||||
gTextBox.unk = 0;
|
gTextBox.unk = 0;
|
||||||
sub_08056C54(7);
|
SetDoTextBox(7);
|
||||||
if ((ctb->_8e != 1) && ((ctb->_8e == 2 || ((gInput.newKeys & 0x1f3) != 0)))) {
|
if ((ctb->_8e != 1) && (ctb->_8e == 2 || TEXTBOX_PRESS_ANY_ADVANCE_KEYS)) {
|
||||||
sub_080564C8(4);
|
sub_080564C8(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,8 +581,8 @@ void sub_08056BA0(CurrentTextBox* ctb) {
|
||||||
void sub_08056BDC(u32 unk) {
|
void sub_08056BDC(u32 unk) {
|
||||||
gCurrentTextBox._98.bytes.b0 = unk;
|
gCurrentTextBox._98.bytes.b0 = unk;
|
||||||
if (unk == 0) {
|
if (unk == 0) {
|
||||||
MemFill32(-1, &gUnk_02000D00, 0xd00);
|
MemFill32(0xFFFFFFFF, gUnk_02000D00, sizeof(gUnk_02000D00));
|
||||||
sub_08056F70();
|
Load_02000D00_Asyc();
|
||||||
gCurrentTextBox._9e = 0xf082;
|
gCurrentTextBox._9e = 0xf082;
|
||||||
gCurrentTextBox._a0 = 0xf083;
|
gCurrentTextBox._a0 = 0xf083;
|
||||||
gCurrentTextBox._a2 = 0xf0b6;
|
gCurrentTextBox._a2 = 0xf0b6;
|
||||||
|
@ -573,98 +596,86 @@ void sub_08056BDC(u32 unk) {
|
||||||
sub_080569C4(&gCurrentTextBox, gCurrentTextBox._8f | 0x40);
|
sub_080569C4(&gCurrentTextBox, gCurrentTextBox._8f | 0x40);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056C54(u32 unk) {
|
void SetDoTextBox(u32 doTextbox) {
|
||||||
gTextBox.doTextBox = gCurrentTextBox.textBox.doTextBox = unk;
|
gTextBox.doTextBox = gCurrentTextBox.textBox.doTextBox = doTextbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteWindow(void) {
|
void DeleteWindow(void) {
|
||||||
u32 r0;
|
|
||||||
u16* ptr;
|
u16* ptr;
|
||||||
u16* ptr2;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
Window* tp = &gCurrentWindow;
|
Window* window = &gCurrentWindow;
|
||||||
|
|
||||||
if (tp->unk1 != 0) {
|
if (window->unk1 != 0) {
|
||||||
tp->unk1 = 0;
|
window->unk1 = 0;
|
||||||
r0 = tp->unk5 << 5;
|
ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(*window)];
|
||||||
r0 += tp->unk4;
|
i = window->height + 2;
|
||||||
ptr = &((u16*)(&gBG0Buffer.filler0))[r0];
|
|
||||||
i = tp->unk7 + 2;
|
|
||||||
do {
|
do {
|
||||||
j = 0;
|
j = 0;
|
||||||
do {
|
do {
|
||||||
ptr[j] = 0;
|
ptr[j] = 0;
|
||||||
} while (j++, j < tp->unk6 + 2);
|
} while (j++, j < window->width + 2);
|
||||||
ptr += 0x20;
|
ptr += TEXTBOX_WIDTH;
|
||||||
i--;
|
i--;
|
||||||
} while (i > 0);
|
} while (i > 0);
|
||||||
sub_0801C4A0(tp->unk5, tp->unk7);
|
sub_0801C4A0(window->yPos, window->height);
|
||||||
sub_0801C494();
|
sub_0801C494();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sub_08056CC0(u32 unk) {
|
u32 CalcWindowSize(u32 fade) {
|
||||||
u32 iVar1;
|
u32 scale;
|
||||||
u32 uVar2;
|
u32 ret;
|
||||||
u32 uVar3;
|
Window* window;
|
||||||
Window* ptr;
|
|
||||||
|
|
||||||
uVar3 = 0;
|
ret = 0;
|
||||||
|
|
||||||
// inline function?
|
gCurrentTextBox._98.bytes.sizeScale += fade;
|
||||||
gCurrentTextBox._98.bytes.b3 += unk;
|
if (gCurrentTextBox._98.bytes.sizeScale < 1) {
|
||||||
if (gCurrentTextBox._98.bytes.b3 < 1) {
|
gCurrentTextBox._98.bytes.sizeScale = 0;
|
||||||
gCurrentTextBox._98.bytes.b3 = 0;
|
|
||||||
} else {
|
} else {
|
||||||
if (gCurrentTextBox._98.bytes.b3 < 8)
|
if (gCurrentTextBox._98.bytes.sizeScale < 8)
|
||||||
goto LAB_08056cee;
|
goto LAB_08056cee;
|
||||||
gCurrentTextBox._98.bytes.b3 = 8;
|
gCurrentTextBox._98.bytes.sizeScale = 8;
|
||||||
}
|
}
|
||||||
uVar3 = 1;
|
ret = 1;
|
||||||
LAB_08056cee:
|
LAB_08056cee:
|
||||||
ptr = &gNewWindow;
|
window = &gNewWindow;
|
||||||
if (gCurrentTextBox._98.bytes.b3 != 0) {
|
if (gCurrentTextBox._98.bytes.sizeScale != 0) {
|
||||||
iVar1 = gCurrentTextBox._98.bytes.b3;
|
scale = gCurrentTextBox._98.bytes.sizeScale;
|
||||||
uVar2 = (iVar1 * (gCurrentTextBox.textBox.textWindowWidth << 1)) / 16;
|
window->width = (scale * (gCurrentTextBox.textBox.textWindowWidth << 1)) / 16;
|
||||||
ptr->unk6 = uVar2;
|
if ((window->width & 1) != 0) {
|
||||||
if ((uVar2 & 1) != 0) {
|
window->width++;
|
||||||
ptr->unk6++;
|
|
||||||
}
|
}
|
||||||
ptr->unk4 =
|
window->xPos = ((gCurrentTextBox.textBox.textWindowWidth / 2) + gCurrentTextBox.textBox.textWindowPosX) -
|
||||||
((gCurrentTextBox.textBox.textWindowWidth / 2) + gCurrentTextBox.textBox.textWindowPosX) - (ptr->unk6 / 2);
|
(window->width / 2);
|
||||||
uVar2 = (iVar1 * (gCurrentTextBox.textBox.textWindowHeight << 1)) / 16;
|
|
||||||
ptr->unk7 = uVar2;
|
|
||||||
if ((uVar2 & 1) != 0) {
|
|
||||||
ptr->unk7++;
|
|
||||||
}
|
|
||||||
ptr->unk5 =
|
|
||||||
((gCurrentTextBox.textBox.textWindowHeight / 2) + gCurrentTextBox.textBox.textWindowPosY) - (ptr->unk7 / 2);
|
|
||||||
} else {
|
|
||||||
ptr->unk5 = 0xff;
|
|
||||||
ptr->unk4 = -1;
|
|
||||||
ptr->unk7 = -1;
|
|
||||||
ptr->unk6 = -1;
|
|
||||||
}
|
|
||||||
ptr->unk1 = 1;
|
|
||||||
return uVar3;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DispMessageFrame(u16*, u32, u32, u32);
|
window->height = (scale * (gCurrentTextBox.textBox.textWindowHeight << 1)) / 16;
|
||||||
extern void DispString(void);
|
if ((window->height & 1) != 0) {
|
||||||
extern void DispCursor(void);
|
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) {
|
void CreateWindow(void) {
|
||||||
s32 r0, r3;
|
s32 r0, r3;
|
||||||
u16* ptr;
|
u16* ptr;
|
||||||
|
|
||||||
r0 = gCurrentTextBox._98.bytes.b3;
|
r0 = gCurrentTextBox._98.bytes.sizeScale;
|
||||||
if (r0 <= 0)
|
if (r0 <= 0)
|
||||||
return;
|
return;
|
||||||
r0 = ((gNewWindow.unk5 << 5) + gNewWindow.unk4);
|
ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(gNewWindow)];
|
||||||
ptr = &((u16*)(&gBG0Buffer.filler0))[r0];
|
|
||||||
r3 = 0xf07b;
|
r3 = 0xf07b;
|
||||||
DispMessageFrame(ptr, gNewWindow.unk6, gNewWindow.unk7, r3);
|
DispMessageFrame(ptr, gNewWindow.width, gNewWindow.height, r3);
|
||||||
DispString();
|
DispString();
|
||||||
DispCursor();
|
DispCursor();
|
||||||
gCurrentWindow = gNewWindow;
|
gCurrentWindow = gNewWindow;
|
||||||
|
@ -686,13 +697,13 @@ void DispString(void) {
|
||||||
|
|
||||||
Window* window = &gNewWindow;
|
Window* window = &gNewWindow;
|
||||||
|
|
||||||
if (window->unk6 != 0) {
|
if (window->width != 0) {
|
||||||
if (window->unk7 != 0) {
|
if (window->height != 0) {
|
||||||
r4 = window->unk7;
|
r4 = window->height;
|
||||||
r5 = &gUnk_02034CB2[(window->unk5 << 5) + window->unk4];
|
r5 = &gUnk_02034CB2[TEXTBOX_POSITION_INDEX(*window)];
|
||||||
i = (s32)(4 - r4) / 2;
|
i = (s32)(4 - r4) / 2;
|
||||||
do {
|
do {
|
||||||
j = window->unk6;
|
j = window->width;
|
||||||
r2 = gUnk_0202281E[i];
|
r2 = gUnk_0202281E[i];
|
||||||
r5 += 0x20;
|
r5 += 0x20;
|
||||||
r0 = i + 1;
|
r0 = i + 1;
|
||||||
|
@ -715,16 +726,16 @@ void DispCursor(void) {
|
||||||
u16* ptr;
|
u16* ptr;
|
||||||
|
|
||||||
if ((gCurrentTextBox._98.word & 0x10ff00) == 0x100200) {
|
if ((gCurrentTextBox._98.word & 0x10ff00) == 0x100200) {
|
||||||
ptr = &((u16*)(gBG0Buffer.filler0))[(gNewWindow.unk5 << 5) + gNewWindow.unk4];
|
ptr = &gBG0Buffer[TEXTBOX_POSITION_INDEX(gNewWindow)];
|
||||||
r0 = (((gNewWindow.unk7 + 1) << 5) - 2);
|
r0 = (((gNewWindow.height + 1) << 5) - 2);
|
||||||
r0 += gNewWindow.unk6;
|
r0 += gNewWindow.width;
|
||||||
ptr += r0;
|
ptr += r0;
|
||||||
*ptr = 0xf080;
|
*ptr = 0xf080;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056F70(void) {
|
void Load_02000D00_Asyc(void) {
|
||||||
LoadResourceAsync(&gUnk_02000D00, 0x0600D040, 0xd00);
|
LoadResourceAsync(gUnk_02000D00, 0x0600D040, sizeof(gUnk_02000D00));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056F88(u32 unk_1, u32 unk_2) {
|
void sub_08056F88(u32 unk_1, u32 unk_2) {
|
||||||
|
@ -741,8 +752,8 @@ void sub_08056F88(u32 unk_1, u32 unk_2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_08056FBC(CurrentTextBox* ctb) {
|
void sub_08056FBC(CurrentTextBox* ctb) {
|
||||||
sub_08056FEC(ctb->textBox.field_0x10, &ctb->_5e[0xa]);
|
sub_08056FEC(ctb->textBox.field_0x10, &ctb->_66[0x2]);
|
||||||
sub_08056FEC(ctb->textBox.field_0x14, &ctb->_5e[0x12]);
|
sub_08056FEC(ctb->textBox.field_0x14, &ctb->_66[0xa]);
|
||||||
sub_08056FEC(ctb->textBox.field_0x18, &ctb->_77[0x1]);
|
sub_08056FEC(ctb->textBox.field_0x18, &ctb->_77[0x1]);
|
||||||
sub_08056FEC(ctb->textBox.field_0x1c, &ctb->_77[0x9]);
|
sub_08056FEC(ctb->textBox.field_0x1c, &ctb->_77[0x9]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue