From 83a706014353f436646ea0b3a68a878f816796f8 Mon Sep 17 00:00:00 2001 From: PokeCodec Date: Tue, 25 Aug 2020 15:56:17 -0400 Subject: [PATCH] Cleanup window.c --- gflib/window.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/gflib/window.c b/gflib/window.c index 7c87ea86dc..0be59773c1 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -30,21 +30,18 @@ static void nullsub_8(void) bool16 InitWindows(const struct WindowTemplate *templates) { - int i; - void *bgTilemapBuffer; - int j; - u8 bgLayer; - u16 attrib; + int i, j; u8* allocatedTilemapBuffer; + u16 attrib; int allocatedBaseBlock; + u8 bgLayer; for (i = 0; i < 0x4; ++i) { - bgTilemapBuffer = GetBgTilemapBuffer(i); - if (bgTilemapBuffer != NULL) + if (GetBgTilemapBuffer(i) != NULL) gUnknown_03002F70[i] = nullsub_8; else - gUnknown_03002F70[i] = bgTilemapBuffer; + gUnknown_03002F70[i] = NULL; } for (i = 0; i < 0x20; ++i) @@ -567,19 +564,19 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId) switch (attributeId) { case WINDOW_BG: - return gWindows[windowId].window.bg; + return (u32)gWindows[windowId].window.bg; case WINDOW_TILEMAP_LEFT: - return gWindows[windowId].window.tilemapLeft; + return (u32)gWindows[windowId].window.tilemapLeft; case WINDOW_TILEMAP_TOP: - return gWindows[windowId].window.tilemapTop; + return (u32)gWindows[windowId].window.tilemapTop; case WINDOW_WIDTH: - return gWindows[windowId].window.width; + return (u32)gWindows[windowId].window.width; case WINDOW_HEIGHT: - return gWindows[windowId].window.height; + return (u32)gWindows[windowId].window.height; case WINDOW_PALETTE_NUM: - return gWindows[windowId].window.paletteNum; + return (u32)gWindows[windowId].window.paletteNum; case WINDOW_BASE_BLOCK: - return gWindows[windowId].window.baseBlock; + return (u32)gWindows[windowId].window.baseBlock; case WINDOW_TILE_DATA: return (u32)(gWindows[windowId].tileData); default: @@ -643,12 +640,9 @@ u16 AddWindow8Bit(const struct WindowTemplate *template) } return 0xFF; } - else - { - gWindows[windowId].tileData = memAddress; - gWindows[windowId].window = *template; - return windowId; - } + gWindows[windowId].tileData = memAddress; + gWindows[windowId].window = *template; + return windowId; } void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue)