resolved SetWindowTemplateFields
This commit is contained in:
+1
-10
@@ -17,12 +17,6 @@ struct MenuAction
|
|||||||
} func;
|
} func;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WindowTemplateWithAttr
|
|
||||||
{
|
|
||||||
struct WindowTemplate *ptr;
|
|
||||||
u32 attr;
|
|
||||||
};
|
|
||||||
|
|
||||||
// menu2
|
// menu2
|
||||||
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 x, u8 y, const struct TextColor * color, s8 speed, const u8 * str);
|
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 x, u8 y, const struct TextColor * color, s8 speed, const u8 * str);
|
||||||
void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str);
|
void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str);
|
||||||
@@ -68,9 +62,6 @@ void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
|
|||||||
void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum);
|
void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum);
|
||||||
void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
|
void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
|
||||||
void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum);
|
void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum);
|
||||||
|
struct WindowTemplate SetWindowTemplateFields(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock);
|
||||||
// currently incorrect, WIP
|
|
||||||
void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock);
|
|
||||||
|
|
||||||
|
|
||||||
#endif // GUARD_MENU_H
|
#endif // GUARD_MENU_H
|
||||||
|
|||||||
+2
-4
@@ -110,13 +110,11 @@ void sub_815F070(void)
|
|||||||
void sub_815F094(void)
|
void sub_815F094(void)
|
||||||
{
|
{
|
||||||
struct WindowTemplate template;
|
struct WindowTemplate template;
|
||||||
struct WindowTemplate template2;
|
|
||||||
|
|
||||||
if (sub_81119D4(sub_809D6D4) != TRUE)
|
if (sub_81119D4(sub_809D6D4) != TRUE)
|
||||||
{
|
{
|
||||||
SetWindowTemplateFields(&template, 0, 1, 1, 8, 3, 15, 32);
|
template = SetWindowTemplateFields(0, 1, 1, 8, 3, 15, 32);
|
||||||
template2 = template;
|
gUnknown_203F464 = AddWindow(&template);
|
||||||
gUnknown_203F464 = AddWindow(&template2);
|
|
||||||
FillWindowPixelBuffer(gUnknown_203F464, 0);
|
FillWindowPixelBuffer(gUnknown_203F464, 0);
|
||||||
PutWindowTilemap(gUnknown_203F464);
|
PutWindowTilemap(gUnknown_203F464);
|
||||||
TextWindow_SetStdFrame0_WithPal(gUnknown_203F464, 0x21D, 0xD0);
|
TextWindow_SetStdFrame0_WithPal(gUnknown_203F464, 0x21D, 0xD0);
|
||||||
|
|||||||
+3
-4
@@ -80,11 +80,10 @@ void PrintCoinsString(u32 coinAmount)
|
|||||||
|
|
||||||
void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y)
|
void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y)
|
||||||
{
|
{
|
||||||
struct WindowTemplate template, template2;
|
struct WindowTemplate template;
|
||||||
|
|
||||||
SetWindowTemplateFields(&template, 0, x + 1, y + 1, 8, 3, 0xF, 0x20);
|
template = SetWindowTemplateFields(0, x + 1, y + 1, 8, 3, 0xF, 0x20);
|
||||||
template2 = template; // again, why...
|
sCoinsWindowId = AddWindow(&template);
|
||||||
sCoinsWindowId = AddWindow(&template2);
|
|
||||||
FillWindowPixelBuffer(sCoinsWindowId, 0);
|
FillWindowPixelBuffer(sCoinsWindowId, 0);
|
||||||
PutWindowTilemap(sCoinsWindowId);
|
PutWindowTilemap(sCoinsWindowId);
|
||||||
TextWindow_SetStdFrame0_WithPal(sCoinsWindowId, 0x21D, 0xD0);
|
TextWindow_SetStdFrame0_WithPal(sCoinsWindowId, 0x21D, 0xD0);
|
||||||
|
|||||||
+4
-105
@@ -519,11 +519,9 @@ static void sub_810FDE4(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, con
|
|||||||
AddItemMenuActionTextPrinters(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, GetFontAttribute(fontId, FONTATTR_LETTER_SPACING), lineHeight, itemCount, strs, orderArray);
|
AddItemMenuActionTextPrinters(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, GetFontAttribute(fontId, FONTATTR_LETTER_SPACING), lineHeight, itemCount, strs, orderArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
struct WindowTemplate SetWindowTemplateFields(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
||||||
struct WindowTemplateWithAttr SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
|
||||||
{
|
{
|
||||||
struct WindowTemplate temp;
|
struct WindowTemplate temp;
|
||||||
struct WindowTemplateWithAttr ret;
|
|
||||||
|
|
||||||
temp.bg = bg;
|
temp.bg = bg;
|
||||||
temp.tilemapLeft = left;
|
temp.tilemapLeft = left;
|
||||||
@@ -532,113 +530,14 @@ struct WindowTemplateWithAttr SetWindowTemplateFields(struct WindowTemplate *tem
|
|||||||
temp.height = height;
|
temp.height = height;
|
||||||
temp.paletteNum = paletteNum;
|
temp.paletteNum = paletteNum;
|
||||||
temp.baseBlock = baseBlock;
|
temp.baseBlock = baseBlock;
|
||||||
*template = temp;
|
return temp;
|
||||||
ret.ptr = template;
|
|
||||||
ret.attr = *((u32*)&temp);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
NAKED
|
|
||||||
void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
|
||||||
{
|
|
||||||
asm_unified("\n\
|
|
||||||
push {r4-r7,lr}\n\
|
|
||||||
mov r7, r10\n\
|
|
||||||
mov r6, r9\n\
|
|
||||||
mov r5, r8\n\
|
|
||||||
push {r5-r7}\n\
|
|
||||||
sub sp, 0x8\n\
|
|
||||||
ldr r4, [sp, 0x28]\n\
|
|
||||||
mov r12, r4\n\
|
|
||||||
ldr r4, [sp, 0x2C]\n\
|
|
||||||
mov r9, r4\n\
|
|
||||||
ldr r4, [sp, 0x30]\n\
|
|
||||||
mov r10, r4\n\
|
|
||||||
ldr r7, [sp, 0x34]\n\
|
|
||||||
lsls r1, 24\n\
|
|
||||||
lsrs r1, 24\n\
|
|
||||||
lsls r2, 24\n\
|
|
||||||
lsls r3, 24\n\
|
|
||||||
mov r4, r9\n\
|
|
||||||
lsls r4, 24\n\
|
|
||||||
lsrs r4, 24\n\
|
|
||||||
mov r9, r4\n\
|
|
||||||
mov r4, r10\n\
|
|
||||||
lsls r4, 24\n\
|
|
||||||
mov r10, r4\n\
|
|
||||||
ldr r4, _0810FEF0 @ =0xffffff00\n\
|
|
||||||
mov r8, r4\n\
|
|
||||||
mov r5, r8\n\
|
|
||||||
ldr r4, [sp]\n\
|
|
||||||
ands r5, r4\n\
|
|
||||||
orrs r5, r1\n\
|
|
||||||
str r5, [sp]\n\
|
|
||||||
lsrs r2, 16\n\
|
|
||||||
ldr r6, _0810FEF4 @ =0xffff00ff\n\
|
|
||||||
adds r4, r6, 0\n\
|
|
||||||
ands r4, r5\n\
|
|
||||||
orrs r4, r2\n\
|
|
||||||
str r4, [sp]\n\
|
|
||||||
lsrs r3, 8\n\
|
|
||||||
ldr r1, _0810FEF8 @ =0xff00ffff\n\
|
|
||||||
ands r1, r4\n\
|
|
||||||
orrs r1, r3\n\
|
|
||||||
str r1, [sp]\n\
|
|
||||||
mov r2, r12\n\
|
|
||||||
lsls r2, 24\n\
|
|
||||||
mov r12, r2\n\
|
|
||||||
ldr r2, _0810FEFC @ =0x00ffffff\n\
|
|
||||||
ands r1, r2\n\
|
|
||||||
mov r4, r12\n\
|
|
||||||
orrs r4, r1\n\
|
|
||||||
str r4, [sp]\n\
|
|
||||||
ldr r1, [sp, 0x4]\n\
|
|
||||||
mov r2, r8\n\
|
|
||||||
ands r1, r2\n\
|
|
||||||
mov r4, r9\n\
|
|
||||||
orrs r1, r4\n\
|
|
||||||
mov r8, r1\n\
|
|
||||||
str r1, [sp, 0x4]\n\
|
|
||||||
mov r1, r10\n\
|
|
||||||
lsrs r1, 16\n\
|
|
||||||
mov r2, r8\n\
|
|
||||||
ands r6, r2\n\
|
|
||||||
orrs r6, r1\n\
|
|
||||||
str r6, [sp, 0x4]\n\
|
|
||||||
lsls r2, r7, 16\n\
|
|
||||||
ldr r1, _0810FF00 @ =0x0000ffff\n\
|
|
||||||
ands r6, r1\n\
|
|
||||||
orrs r6, r2\n\
|
|
||||||
str r6, [sp, 0x4]\n\
|
|
||||||
ldr r1, [sp]\n\
|
|
||||||
ldr r2, [sp, 0x4]\n\
|
|
||||||
str r1, [r0]\n\
|
|
||||||
str r2, [r0, 0x4]\n\
|
|
||||||
add sp, 0x8\n\
|
|
||||||
pop {r3-r5}\n\
|
|
||||||
mov r8, r3\n\
|
|
||||||
mov r9, r4\n\
|
|
||||||
mov r10, r5\n\
|
|
||||||
pop {r4-r7}\n\
|
|
||||||
pop {r2}\n\
|
|
||||||
bx r2\n\
|
|
||||||
.align 2, 0\n\
|
|
||||||
_0810FEF0: .4byte 0xffffff00\n\
|
|
||||||
_0810FEF4: .4byte 0xffff00ff\n\
|
|
||||||
_0810FEF8: .4byte 0xff00ffff\n\
|
|
||||||
_0810FEFC: .4byte 0x00ffffff\n\
|
|
||||||
_0810FF00: .4byte 0x0000ffff\n\
|
|
||||||
");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// not used
|
// not used
|
||||||
static u16 CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
static u16 CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock)
|
||||||
{
|
{
|
||||||
struct WindowTemplate template, temp;
|
struct WindowTemplate template = SetWindowTemplateFields(bg, left, top, width, height, paletteNum, baseBlock);
|
||||||
|
return AddWindow(&template);
|
||||||
SetWindowTemplateFields(&template, bg, left, top, width, height, paletteNum, baseBlock);
|
|
||||||
temp = template;
|
|
||||||
return (u16)AddWindow(&temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateYesNoMenu(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
|
void CreateYesNoMenu(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
|
||||||
|
|||||||
+3
-4
@@ -121,11 +121,10 @@ void ChangeAmountInMoneyBox(int amount)
|
|||||||
|
|
||||||
void DrawMoneyBox(int amount, u8 x, u8 y)
|
void DrawMoneyBox(int amount, u8 x, u8 y)
|
||||||
{
|
{
|
||||||
struct WindowTemplate template, template2;
|
struct WindowTemplate template;
|
||||||
|
|
||||||
SetWindowTemplateFields(&template, 0, x + 1, y + 1, 8, 3, 15, 8);
|
template = SetWindowTemplateFields(0, x + 1, y + 1, 8, 3, 15, 8);
|
||||||
template2 = template;
|
sMoneyBoxWindowId = AddWindow(&template);
|
||||||
sMoneyBoxWindowId = AddWindow(&template2);
|
|
||||||
FillWindowPixelBuffer(sMoneyBoxWindowId, 0);
|
FillWindowPixelBuffer(sMoneyBoxWindowId, 0);
|
||||||
PutWindowTilemap(sMoneyBoxWindowId);
|
PutWindowTilemap(sMoneyBoxWindowId);
|
||||||
TextWindow_SetStdFrame0_WithPal(sMoneyBoxWindowId, 0x21D, 0xD0);
|
TextWindow_SetStdFrame0_WithPal(sMoneyBoxWindowId, 0x21D, 0xD0);
|
||||||
|
|||||||
@@ -671,10 +671,9 @@ u8 sub_80F78E0(u8 height)
|
|||||||
{
|
{
|
||||||
if (sStartMenuWindowId == 0xFF)
|
if (sStartMenuWindowId == 0xFF)
|
||||||
{
|
{
|
||||||
struct WindowTemplate wTemp1, wTemp2;
|
struct WindowTemplate template;
|
||||||
SetWindowTemplateFields(&wTemp1, 0, 0x16, 1, 7, height * 2 - 1, DLG_WINDOW_PALETTE_NUM, 0x13D);
|
template = SetWindowTemplateFields(0, 0x16, 1, 7, height * 2 - 1, DLG_WINDOW_PALETTE_NUM, 0x13D);
|
||||||
wTemp2 = wTemp1;
|
sStartMenuWindowId = AddWindow(&template);
|
||||||
sStartMenuWindowId = AddWindow(&wTemp2);
|
|
||||||
PutWindowTilemap(sStartMenuWindowId);
|
PutWindowTilemap(sStartMenuWindowId);
|
||||||
}
|
}
|
||||||
return sStartMenuWindowId;
|
return sStartMenuWindowId;
|
||||||
|
|||||||
Reference in New Issue
Block a user