diff options
Diffstat (limited to 'gflib')
-rw-r--r-- | gflib/bg.c | 112 | ||||
-rw-r--r-- | gflib/text.c | 92 | ||||
-rw-r--r-- | gflib/text.h | 17 | ||||
-rw-r--r-- | gflib/window.c | 36 |
4 files changed, 135 insertions, 122 deletions
diff --git a/gflib/bg.c b/gflib/bg.c index 12c42d124..66dd81a25 100644 --- a/gflib/bg.c +++ b/gflib/bg.c @@ -34,8 +34,8 @@ struct BgConfig2 u32 unk_3:18; void* tilemap; - s32 bg_x; // Maybe unsigned, but game treats it as if it is signed a LOT. - s32 bg_y; // Same for this variable. + s32 bg_x; + s32 bg_y; }; static struct BgControl sGpuBgConfigs; @@ -621,15 +621,17 @@ s32 GetBgX(u8 bg) { if (IsInvalidBg32(bg)) return -1; - if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) + else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) return -1; - return sGpuBgConfigs2[bg].bg_x; + else + return sGpuBgConfigs2[bg].bg_x; } s32 ChangeBgY(u8 bg, s32 value, u8 op) { u8 mode; - u16 temp1, temp2; + u16 temp1; + u16 temp2; if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) { @@ -698,7 +700,8 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op) s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op) { u8 mode; - u16 temp1, temp2; + u16 temp1; + u16 temp2; if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) { @@ -769,9 +772,10 @@ s32 GetBgY(u8 bg) { if (IsInvalidBg32(bg)) return -1; - if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) + else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) return -1; - return sGpuBgConfigs2[bg].bg_y; + else + return sGpuBgConfigs2[bg].bg_y; } void SetBgAffine(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle) @@ -870,77 +874,81 @@ void* GetBgTilemapBuffer(u8 bg) { if (IsInvalidBg32(bg)) return NULL; - if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) + else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE)) return NULL; - return sGpuBgConfigs2[bg].tilemap; + else + return sGpuBgConfigs2[bg].tilemap; } void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset) { - if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg)) - return; - if (mode != 0) - CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode); - else - LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2))); + if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg)) + { + if (mode != 0) + CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode); + else + LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2))); + } } void CopyBgTilemapBufferToVram(u8 bg) { u16 sizeToLoad; - if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg)) - return; - - switch (GetBgType(bg)) + if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg)) { - case 0: - sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800; - break; - case 1: - sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100; - break; - default: - sizeToLoad = 0; - break; + switch (GetBgType(bg)) + { + case 0: + sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800; + break; + case 1: + sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100; + break; + default: + sizeToLoad = 0; + break; + } + LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2); } - LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2); } -void CopyToBgTilemapBufferRect(u8 bg, const void *src, u8 destX, u8 destY, u8 width, u8 height) +void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height) { - u16 destX16, destY16; + u16 destX16; + u16 destY16; u16 mode; - if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg)) - return; - switch (GetBgType(bg)) - { - case 0: + if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg)) { - const u16 *srcCopy = src; - for (destY16 = destY; destY16 < (destY + height); destY16++) + switch (GetBgType(bg)) { - for (destX16 = destX; destX16 < (destX + width); destX16++) + case 0: + { + const u16 * srcCopy = src; + for (destY16 = destY; destY16 < (destY + height); destY16++) { - ((u16 *)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *srcCopy++; + for (destX16 = destX; destX16 < (destX + width); destX16++) + { + ((u16*)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *srcCopy++; + } } + break; } - break; - } - case 1: - { - const u8 *srcCopy = src; - mode = GetBgMetricAffineMode(bg, 0x1); - for (destY16 = destY; destY16 < (destY + height); destY16++) + case 1: { - for (destX16 = destX; destX16 < (destX + width); destX16++) + const u8 * srcCopy = src; + mode = GetBgMetricAffineMode(bg, 0x1); + for (destY16 = destY; destY16 < (destY + height); destY16++) { - ((u8 *)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *srcCopy++; + for (destX16 = destX; destX16 < (destX + width); destX16++) + { + ((u8*)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *srcCopy++; + } } + break; + } } - break; - } } } diff --git a/gflib/text.c b/gflib/text.c index a995c70a1..9f7fcde49 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -21,7 +21,7 @@ static u16 gLastTextFgColor; static u16 gLastTextShadowColor; const struct FontInfo *gFonts; -bool8 gUnknown_03002F84; +u8 gUnknown_03002F84; struct Struct_03002F90 gUnknown_03002F90; TextFlags gTextFlags; @@ -154,7 +154,7 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 printerTemplate.currentY = y; printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; - printerTemplate.style = gFonts[fontId].style; + printerTemplate.unk = gFonts[fontId].unk; printerTemplate.fgColor = gFonts[fontId].fgColor; printerTemplate.bgColor = gFonts[fontId].bgColor; printerTemplate.shadowColor = gFonts[fontId].shadowColor; @@ -205,7 +205,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2); gTextPrinters[printerTemplate->windowId].active = 0; } - gUnknown_03002F84 = FALSE; + gUnknown_03002F84 = 0; return TRUE; } @@ -213,7 +213,7 @@ void RunTextPrinters(void) { int i; - if (!gUnknown_03002F84) + if (gUnknown_03002F84 == 0) { for (i = 0; i < NUM_TEXT_PRINTERS; ++i) { @@ -451,18 +451,18 @@ u8 GetLastTextColor(u8 colorType) { switch (colorType) { - case COLOR_FOREGROUND: + case 0: return gLastTextFgColor; - case COLOR_BACKGROUND: + case 2: return gLastTextBgColor; - case COLOR_SHADOW: + case 1: return gLastTextShadowColor; default: return 0; } } -inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u32 *ptr, s32 width, s32 height) // +inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u32 *ptr, s32 width, s32 height) { u32 xAdd, yAdd, r5, bits, toOrr, dummyX; u8 *dst; @@ -570,7 +570,7 @@ u16 Font0Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 0; subStruct->hasGlyphIdBeenSet = TRUE; @@ -582,7 +582,7 @@ u16 Font1Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 1; subStruct->hasGlyphIdBeenSet = TRUE; @@ -594,7 +594,7 @@ u16 Font2Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 2; subStruct->hasGlyphIdBeenSet = TRUE; @@ -606,7 +606,7 @@ u16 Font3Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 3; subStruct->hasGlyphIdBeenSet = TRUE; @@ -618,7 +618,7 @@ u16 Font4Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 4; subStruct->hasGlyphIdBeenSet = TRUE; @@ -630,7 +630,7 @@ u16 Font5Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 5; subStruct->hasGlyphIdBeenSet = TRUE; @@ -642,7 +642,7 @@ u16 Font7Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 7; subStruct->hasGlyphIdBeenSet = TRUE; @@ -654,7 +654,7 @@ u16 Font8Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (!subStruct->hasGlyphIdBeenSet) + if (subStruct->hasGlyphIdBeenSet == FALSE) { subStruct->glyphId = 8; subStruct->hasGlyphIdBeenSet = TRUE; @@ -666,7 +666,7 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (gTextFlags.autoScroll == TRUE) + if (gTextFlags.autoScroll == 1) { subStruct->autoScrollDelay = 0; } @@ -682,7 +682,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); const u8 *arrowTiles; - if (!gTextFlags.autoScroll) + if (gTextFlags.autoScroll == 0) { if (subStruct->downArrowDelay != 0) { @@ -758,14 +758,14 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) { bool8 result = FALSE; - if (gTextFlags.autoScroll) + if (gTextFlags.autoScroll != 0) { result = TextPrinterWaitAutoMode(textPrinter); } else { TextPrinterDrawDownArrow(textPrinter); - if (JOY_NEW(A_BUTTON | B_BUTTON)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { result = TRUE; PlaySE(SE_SELECT); @@ -777,14 +777,17 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) bool16 TextPrinterWait(struct TextPrinter *textPrinter) { bool16 result = FALSE; - if (gTextFlags.autoScroll) + if (gTextFlags.autoScroll != 0) { result = TextPrinterWaitAutoMode(textPrinter); } - else if (JOY_NEW(A_BUTTON | B_BUTTON)) + else { - result = TRUE; - PlaySE(SE_SELECT); + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + result = TRUE; + PlaySE(SE_SELECT); + } } return result; } @@ -800,7 +803,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c else { FillWindowPixelRect(windowId, (bgColor << 4) | bgColor, x, y, 0x8, 0x10); - if (!drawArrow) + if (drawArrow == 0) { switch (gTextFlags.useAlternateDownArrow) { @@ -841,13 +844,13 @@ u16 RenderText(struct TextPrinter *textPrinter) switch (textPrinter->state) { case 0: - if ((JOY_HELD(A_BUTTON | B_BUTTON)) && subStruct->hasPrintBeenSpedUp) + if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && subStruct->hasPrintBeenSpedUp) textPrinter->delayCounter = 0; if (textPrinter->delayCounter && textPrinter->textSpeed) { textPrinter->delayCounter--; - if (gTextFlags.canABSpeedUpPrint && (JOY_NEW(A_BUTTON | B_BUTTON))) + if (gTextFlags.canABSpeedUpPrint && (gMain.newKeys & (A_BUTTON | B_BUTTON))) { subStruct->hasPrintBeenSpedUp = TRUE; textPrinter->delayCounter = 0; @@ -992,10 +995,10 @@ u16 RenderText(struct TextPrinter *textPrinter) textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++; return 2; case EXT_CTRL_CODE_JPN: - textPrinter->japanese = TRUE; + textPrinter->japanese = 1; return 2; case EXT_CTRL_CODE_ENG: - textPrinter->japanese = FALSE; + textPrinter->japanese = 0; return 2; } break; @@ -1056,10 +1059,13 @@ u16 RenderText(struct TextPrinter *textPrinter) textPrinter->printerTemplate.currentX += width; } } - else if (textPrinter->japanese) - textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing); else - textPrinter->printerTemplate.currentX += gUnknown_03002F90.width; + { + if (textPrinter->japanese) + textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing); + else + textPrinter->printerTemplate.currentX += gUnknown_03002F90.width; + } return 0; case 1: if (TextPrinterWait(textPrinter)) @@ -1545,7 +1551,7 @@ void SetDefaultFontsPointer(void) u8 GetFontAttribute(u8 fontId, u8 attributeId) { - u8 result = 0; + int result = 0; switch (attributeId) { case FONTATTR_MAX_LETTER_WIDTH: @@ -1560,8 +1566,8 @@ u8 GetFontAttribute(u8 fontId, u8 attributeId) case FONTATTR_LINE_SPACING: result = gFontInfos[fontId].lineSpacing; break; - case FONTATTR_STYLE: - result = gFontInfos[fontId].style; + case FONTATTR_UNKNOWN: + result = gFontInfos[fontId].unk; break; case FONTATTR_COLOR_FOREGROUND: result = gFontInfos[fontId].fgColor; @@ -1591,7 +1597,7 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 gUnknown_03002F90.width = 8; // gGlyphWidth - gUnknown_03002F90.height = 12; // gGlyphHeight + gUnknown_03002F90.height = 12; // gGlyphHeight } else { @@ -1634,7 +1640,7 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 gUnknown_03002F90.width = 8; // gGlyphWidth - gUnknown_03002F90.height = 15; // gGlyphHeight + gUnknown_03002F90.height = 15; // gGlyphHeight } else { @@ -1676,7 +1682,7 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 gUnknown_03002F90.width = 8; // gGlyphWidth - gUnknown_03002F90.height = 12; // gGlyphHeight + gUnknown_03002F90.height = 12; // gGlyphHeight } else { @@ -1716,10 +1722,10 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) { glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); - DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); - DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); - DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); - gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth + DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40 + DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20 + DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60 + gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth gUnknown_03002F90.height = 14; // gGlyphHeight } else @@ -1763,7 +1769,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 gUnknown_03002F90.width = 8; // gGlyphWidth - gUnknown_03002F90.height = 15; // gGlyphHeight + gUnknown_03002F90.height = 15; // gGlyphHeight } else { diff --git a/gflib/text.h b/gflib/text.h index 4cf5bc20b9..723a2fc0e 100644 --- a/gflib/text.h +++ b/gflib/text.h @@ -271,18 +271,11 @@ enum { - COLOR_FOREGROUND, - COLOR_SHADOW, - COLOR_BACKGROUND -}; - -enum -{ FONTATTR_MAX_LETTER_WIDTH, FONTATTR_MAX_LETTER_HEIGHT, FONTATTR_LETTER_SPACING, FONTATTR_LINE_SPACING, - FONTATTR_STYLE, + FONTATTR_UNKNOWN, // dunno what this is yet FONTATTR_COLOR_FOREGROUND, FONTATTR_COLOR_BACKGROUND, FONTATTR_COLOR_SHADOW @@ -310,7 +303,7 @@ struct TextPrinterTemplate u8 currentY; u8 letterSpacing; u8 lineSpacing; - u8 style:4; // 0xC + u8 unk:4; // 0xC u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; @@ -329,7 +322,7 @@ struct TextPrinter u8 delayCounter; u8 scrollDistance; u8 minLetterSpacing; // 0x20 - bool8 japanese; + u8 japanese; }; struct FontInfo @@ -339,7 +332,7 @@ struct FontInfo u8 maxLetterHeight; u8 letterSpacing; u8 lineSpacing; - u8 style:4; //unused + u8 unk:4; u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; @@ -379,7 +372,7 @@ struct Struct_03002F90 extern TextFlags gTextFlags; -extern bool8 gUnknown_03002F84; +extern u8 gUnknown_03002F84; extern struct Struct_03002F90 gUnknown_03002F90; void SetFontsPointer(const struct FontInfo *fonts); diff --git a/gflib/window.c b/gflib/window.c index 0be59773c..7c87ea86d 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -30,18 +30,21 @@ static void nullsub_8(void) bool16 InitWindows(const struct WindowTemplate *templates) { - int i, j; - u8* allocatedTilemapBuffer; + int i; + void *bgTilemapBuffer; + int j; + u8 bgLayer; u16 attrib; + u8* allocatedTilemapBuffer; int allocatedBaseBlock; - u8 bgLayer; for (i = 0; i < 0x4; ++i) { - if (GetBgTilemapBuffer(i) != NULL) + bgTilemapBuffer = GetBgTilemapBuffer(i); + if (bgTilemapBuffer != NULL) gUnknown_03002F70[i] = nullsub_8; else - gUnknown_03002F70[i] = NULL; + gUnknown_03002F70[i] = bgTilemapBuffer; } for (i = 0; i < 0x20; ++i) @@ -564,19 +567,19 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId) switch (attributeId) { case WINDOW_BG: - return (u32)gWindows[windowId].window.bg; + return gWindows[windowId].window.bg; case WINDOW_TILEMAP_LEFT: - return (u32)gWindows[windowId].window.tilemapLeft; + return gWindows[windowId].window.tilemapLeft; case WINDOW_TILEMAP_TOP: - return (u32)gWindows[windowId].window.tilemapTop; + return gWindows[windowId].window.tilemapTop; case WINDOW_WIDTH: - return (u32)gWindows[windowId].window.width; + return gWindows[windowId].window.width; case WINDOW_HEIGHT: - return (u32)gWindows[windowId].window.height; + return gWindows[windowId].window.height; case WINDOW_PALETTE_NUM: - return (u32)gWindows[windowId].window.paletteNum; + return gWindows[windowId].window.paletteNum; case WINDOW_BASE_BLOCK: - return (u32)gWindows[windowId].window.baseBlock; + return gWindows[windowId].window.baseBlock; case WINDOW_TILE_DATA: return (u32)(gWindows[windowId].tileData); default: @@ -640,9 +643,12 @@ u16 AddWindow8Bit(const struct WindowTemplate *template) } return 0xFF; } - gWindows[windowId].tileData = memAddress; - gWindows[windowId].window = *template; - return windowId; + else + { + gWindows[windowId].tileData = memAddress; + gWindows[windowId].window = *template; + return windowId; + } } void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue) |