Cleanup window.c

This commit is contained in:
PokeCodec 2020-08-25 15:56:17 -04:00
parent b679e979b6
commit 83a7060143

View File

@ -30,21 +30,18 @@ static void nullsub_8(void)
bool16 InitWindows(const struct WindowTemplate *templates) bool16 InitWindows(const struct WindowTemplate *templates)
{ {
int i; int i, j;
void *bgTilemapBuffer;
int j;
u8 bgLayer;
u16 attrib;
u8* allocatedTilemapBuffer; u8* allocatedTilemapBuffer;
u16 attrib;
int allocatedBaseBlock; int allocatedBaseBlock;
u8 bgLayer;
for (i = 0; i < 0x4; ++i) for (i = 0; i < 0x4; ++i)
{ {
bgTilemapBuffer = GetBgTilemapBuffer(i); if (GetBgTilemapBuffer(i) != NULL)
if (bgTilemapBuffer != NULL)
gUnknown_03002F70[i] = nullsub_8; gUnknown_03002F70[i] = nullsub_8;
else else
gUnknown_03002F70[i] = bgTilemapBuffer; gUnknown_03002F70[i] = NULL;
} }
for (i = 0; i < 0x20; ++i) for (i = 0; i < 0x20; ++i)
@ -567,19 +564,19 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId)
switch (attributeId) switch (attributeId)
{ {
case WINDOW_BG: case WINDOW_BG:
return gWindows[windowId].window.bg; return (u32)gWindows[windowId].window.bg;
case WINDOW_TILEMAP_LEFT: case WINDOW_TILEMAP_LEFT:
return gWindows[windowId].window.tilemapLeft; return (u32)gWindows[windowId].window.tilemapLeft;
case WINDOW_TILEMAP_TOP: case WINDOW_TILEMAP_TOP:
return gWindows[windowId].window.tilemapTop; return (u32)gWindows[windowId].window.tilemapTop;
case WINDOW_WIDTH: case WINDOW_WIDTH:
return gWindows[windowId].window.width; return (u32)gWindows[windowId].window.width;
case WINDOW_HEIGHT: case WINDOW_HEIGHT:
return gWindows[windowId].window.height; return (u32)gWindows[windowId].window.height;
case WINDOW_PALETTE_NUM: case WINDOW_PALETTE_NUM:
return gWindows[windowId].window.paletteNum; return (u32)gWindows[windowId].window.paletteNum;
case WINDOW_BASE_BLOCK: case WINDOW_BASE_BLOCK:
return gWindows[windowId].window.baseBlock; return (u32)gWindows[windowId].window.baseBlock;
case WINDOW_TILE_DATA: case WINDOW_TILE_DATA:
return (u32)(gWindows[windowId].tileData); return (u32)(gWindows[windowId].tileData);
default: default:
@ -643,12 +640,9 @@ u16 AddWindow8Bit(const struct WindowTemplate *template)
} }
return 0xFF; return 0xFF;
} }
else gWindows[windowId].tileData = memAddress;
{ gWindows[windowId].window = *template;
gWindows[windowId].tileData = memAddress; return windowId;
gWindows[windowId].window = *template;
return windowId;
}
} }
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue) void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue)