diff options
author | nullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com> | 2018-12-05 22:31:01 +0800 |
---|---|---|
committer | nullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com> | 2018-12-06 10:38:28 +0800 |
commit | f9ff7316d5c7277eb7482e30121388cd65f4ecfc (patch) | |
tree | ee8f4a9c338f880a3585d6e9ed9ed695f27cef3d /src/window.c | |
parent | 405f1bb529809b8169364737087189df0fcca1d2 (diff) |
Remove uses of INVALID_ defines, clean up some arrays with constants, and spaces -> tabs
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/window.c b/src/window.c index d5b996df1..4e1a38eff 100644 --- a/src/window.c +++ b/src/window.c @@ -52,12 +52,12 @@ bool16 InitWindows(const struct WindowTemplate *templates) gWindows[i].tileData = NULL; } - for (i = 0, allocatedBaseBlock = 0, bgLayer = templates[i].bg; bgLayer != INVALID_U8 && i < 0x20; ++i, bgLayer = templates[i].bg) + for (i = 0, allocatedBaseBlock = 0, bgLayer = templates[i].bg; bgLayer != 0xFF && i < 0x20; ++i, bgLayer = templates[i].bg) { if (gUnneededFireRedVariable == 1) { allocatedBaseBlock = DummiedOutFireRedLeafGreenTileAllocFunc(bgLayer, 0, templates[i].width * templates[i].height, 0); - if (allocatedBaseBlock == INVALID_S32) + if (allocatedBaseBlock == -1) return FALSE; } @@ -65,7 +65,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) { attrib = GetBgAttribute(bgLayer, 0x8); - if (attrib != INVALID_U16) + if (attrib != 0xFFFF) { allocatedTilemapBuffer = AllocZeroed(attrib); @@ -121,12 +121,12 @@ u16 AddWindow(const struct WindowTemplate *template) for (win = 0; win < WINDOWS_MAX; ++win) { - if ((bgLayer = gWindows[win].window.bg) == INVALID_U8) + if ((bgLayer = gWindows[win].window.bg) == 0xFF) break; } if (win == WINDOWS_MAX) - return INVALID_U8; + return 0xFF; bgLayer = template->bg; allocatedBaseBlock = 0; @@ -135,20 +135,20 @@ u16 AddWindow(const struct WindowTemplate *template) { allocatedBaseBlock = DummiedOutFireRedLeafGreenTileAllocFunc(bgLayer, 0, template->width * template->height, 0); - if (allocatedBaseBlock == INVALID_S32) - return INVALID_U8; + if (allocatedBaseBlock == -1) + return 0xFF; } if (gUnknown_03002F70[bgLayer] == NULL) { attrib = GetBgAttribute(bgLayer, 0x8); - if (attrib != INVALID_U16) + if (attrib != 0xFFFF) { allocatedTilemapBuffer = AllocZeroed(attrib); if (allocatedTilemapBuffer == NULL) - return INVALID_U8; + return 0xFF; for (i = 0; i < attrib; ++i) allocatedTilemapBuffer[i] = 0; @@ -167,7 +167,7 @@ u16 AddWindow(const struct WindowTemplate *template) Free(gUnknown_03002F70[bgLayer]); gUnknown_03002F70[bgLayer] = allocatedTilemapBuffer; } - return INVALID_U8; + return 0xFF; } gWindows[win].tileData = allocatedTilemapBuffer; @@ -190,12 +190,12 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template) for (win = 0; win < WINDOWS_MAX; ++win) { - if (gWindows[win].window.bg == INVALID_U8) + if (gWindows[win].window.bg == 0xFF) break; } if (win == WINDOWS_MAX) - return INVALID_U8; + return 0xFF; bgLayer = template->bg; allocatedBaseBlock = 0; @@ -204,8 +204,8 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template) { allocatedBaseBlock = DummiedOutFireRedLeafGreenTileAllocFunc(bgLayer, 0, template->width * template->height, 0); - if (allocatedBaseBlock == INVALID_S32) - return INVALID_U8; + if (allocatedBaseBlock == -1) + return 0xFF; } gWindows[win].window = *template; @@ -609,21 +609,21 @@ u16 AddWindow8Bit(struct WindowTemplate *template) for (windowId = 0; windowId < 32; windowId++) { - if (gWindows[windowId].window.bg == INVALID_U8) + if (gWindows[windowId].window.bg == 0xFF) break; } if (windowId == WINDOWS_MAX) - return INVALID_U8; + return 0xFF; bgLayer = template->bg; if (gUnknown_03002F70[bgLayer] == 0) { u16 attribute = GetBgAttribute(bgLayer, 8); - if (attribute != INVALID_U16) + if (attribute != 0xFFFF) { s32 i; memAddress = Alloc(attribute); if (memAddress == NULL) - return INVALID_U8; + return 0xFF; for (i = 0; i < attribute; i++) // if we're going to zero out the memory anyway, why not call AllocZeroed? memAddress[i] = 0; gUnknown_03002F70[bgLayer] = memAddress; @@ -638,7 +638,7 @@ u16 AddWindow8Bit(struct WindowTemplate *template) Free(gUnknown_03002F70[bgLayer]); gUnknown_03002F70[bgLayer] = NULL; } - return INVALID_U8; + return 0xFF; } else { |