diff options
-rw-r--r-- | data/window.s | 7 | ||||
-rw-r--r-- | include/window.h | 30 | ||||
-rw-r--r-- | ld_script.txt | 2 | ||||
-rw-r--r-- | src/window.c | 24 |
4 files changed, 40 insertions, 23 deletions
diff --git a/data/window.s b/data/window.s deleted file mode 100644 index 204152b3e..000000000 --- a/data/window.s +++ /dev/null @@ -1,7 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gDummyWindowTemplate:: @ 82E9584 - window_template -1, 0, 0, 0, 0, 0, 0 diff --git a/include/window.h b/include/window.h index fb446fecf..6f5f55c11 100644 --- a/include/window.h +++ b/include/window.h @@ -1,8 +1,6 @@ #ifndef GUARD_WINDOW_H #define GUARD_WINDOW_H -#define WINDOWS_MAX 32 - enum { WINDOW_PRIORITY, @@ -32,6 +30,32 @@ struct Window u8 *tileData; }; -extern struct Window gWindows[WINDOWS_MAX]; +bool16 InitWindows(struct WindowTemplate *templates); +u16 AddWindow(struct WindowTemplate *template); +int AddWindowWithoutTileMap(struct WindowTemplate *template); +void RemoveWindow(u8 windowId); +void FreeAllWindowBuffers(void); +void CopyWindowToVram(u8 windowId, u8 mode); +void CopyWindowRectToVram(u32 windowId, u32 mode, u32 x, u32 y, u32 w, u32 h); +void PutWindowTilemap(u8 windowId); +void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 palette); +void ClearWindowTilemap(u8 windowId); +void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height); +void BlitBitmapToWindow(u8 windowId, u8 *pixels, u16 x, u16 y, u16 width, u16 height); +void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight); +void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); +void CopyToWindowPixelBuffer(u8 windowId, u8 *src, u16 size, u16 tileOffset); +void FillWindowPixelBuffer(u8 windowId, u8 fillValue); +void ScrollWindow(u8 windowId, u8 direction, u8 distance, u8 fillValue); +void CallWindowFunction(u8 windowId, void ( *func)(u8, u8, u8, u8, u8, u8)); +bool8 SetWindowAttribute(u8 windowId, u8 attributeId, u32 value); +u32 GetWindowAttribute(u8 windowId, u8 attributeId); +u16 AddWindow8Bit(struct WindowTemplate *template); +u16 AddWindow8Bit(struct WindowTemplate *template); +void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); +void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); +void CopyWindowToVram8Bit(u8 windowId, u8 mode); + +extern struct Window gWindows[]; #endif // GUARD_WINDOW_H diff --git a/ld_script.txt b/ld_script.txt index 43e3535cc..75547e82b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -256,7 +256,7 @@ SECTIONS { { src/main.o(.rodata); data/bg.o(.rodata); - data/window.o(.rodata); + src/window.o(.rodata); src/text.o(.rodata); data/sprite.o(.rodata); src/string_util.o(.rodata); diff --git a/src/window.c b/src/window.c index e011d60be..f3d2e833e 100644 --- a/src/window.c +++ b/src/window.c @@ -6,6 +6,8 @@ extern u8 gUnknown_03002F60; extern void* gUnknown_03002F70[]; extern u32 gUnneededFireRedVariable; +#define WINDOWS_MAX 32 + EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0}; EWRAM_DATA static struct Window* sWindowPtr = NULL; EWRAM_DATA static u16 sWindowSize = 0; @@ -13,9 +15,7 @@ EWRAM_DATA static u16 sWindowSize = 0; extern void* GetBgTilemapBuffer(u8 bg); extern int DummiedOutFireRedLeafGreenTileAllocFunc(int, int, int, int); extern u16 GetBgAttribute(u8 bg, u8 attributeId); -extern void FreeAllWindowBuffers(void); extern void SetBgTilemapBuffer(u8 bg, void *tilemap); -extern u8 GetNumActiveWindowsOnBg(u8 bgId); extern void CopyBgTilemapBufferToVram(u8 bg); extern u8 LoadBgTiles(u8 bg, void *src, u16 size, u16 destOffset); extern void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, u16 tileNumDelta); @@ -25,12 +25,12 @@ extern void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dest, u1 extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); extern void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); -void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight); -u8 GetNumActiveWindowsOnBg8Bit(u8 bgId); +static u8 GetNumActiveWindowsOnBg(u8 bgId); +static u8 GetNumActiveWindowsOnBg8Bit(u8 bgId); -extern const struct WindowTemplate gDummyWindowTemplate; +static const struct WindowTemplate sDummyWindowTemplate = {0xFF, 0, 0, 0, 0, 0, 0}; -void nullsub_8(void) +static void nullsub_8(void) { } @@ -56,7 +56,7 @@ bool16 InitWindows(struct WindowTemplate *templates) for (i = 0; i < 0x20; ++i) { - gWindows[i].window = gDummyWindowTemplate; + gWindows[i].window = sDummyWindowTemplate; gWindows[i].tileData = NULL; } @@ -236,7 +236,7 @@ void RemoveWindow(u8 windowId) DummiedOutFireRedLeafGreenTileAllocFunc(bgLayer, gWindows[windowId].window.baseBlock, gWindows[windowId].window.width * gWindows[windowId].window.height, 2); } - gWindows[windowId].window = gDummyWindowTemplate; + gWindows[windowId].window = sDummyWindowTemplate; if (GetNumActiveWindowsOnBg(bgLayer) == 0) { @@ -424,7 +424,7 @@ void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u BlitBitmapRect4Bit(&sourceRect, &destRect, srcX, srcY, destX, destY, rectWidth, rectHeight, 0); } -void BlitBitmapRectToWindowWithColorKey(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 colorKey) +static void BlitBitmapRectToWindowWithColorKey(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 colorKey) { struct Bitmap sourceRect; struct Bitmap destRect; @@ -1214,7 +1214,7 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId) } } -u8 GetNumActiveWindowsOnBg(u8 bgId) +static u8 GetNumActiveWindowsOnBg(u8 bgId) { u8 windowsNum = 0; s32 i; @@ -1226,7 +1226,7 @@ u8 GetNumActiveWindowsOnBg(u8 bgId) return windowsNum; } -void nullsub_9(void) +static void nullsub_9(void) { } @@ -1335,7 +1335,7 @@ void CopyWindowToVram8Bit(u8 windowId, u8 mode) } } -u8 GetNumActiveWindowsOnBg8Bit(u8 bgId) +static u8 GetNumActiveWindowsOnBg8Bit(u8 bgId) { u8 windowsNum = 0; s32 i; |