diff options
author | Marco Willems (M17.1) <progreon@gmail.com> | 2018-01-06 22:52:10 +0100 |
---|---|---|
committer | Marco Willems (M17.1) <progreon@gmail.com> | 2018-01-06 22:52:10 +0100 |
commit | dcecc8aebfd2480d6e79f3c1f54b737ecbb319f8 (patch) | |
tree | 269aa3818b69d5379194ffff713ed5d7f4576160 /src/engine/cable_car_util.c | |
parent | 344b8bffbb969cca8b1c23ddf994c0c8ec6fe1f8 (diff) | |
parent | 680d3fd7b980578024226eccffe2e01072826227 (diff) |
merge with master
Diffstat (limited to 'src/engine/cable_car_util.c')
-rw-r--r-- | src/engine/cable_car_util.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/engine/cable_car_util.c b/src/engine/cable_car_util.c new file mode 100644 index 000000000..02bfbc195 --- /dev/null +++ b/src/engine/cable_car_util.c @@ -0,0 +1,47 @@ +#include "global.h" +#include "cable_car_util.h" + +// static types + +// static declarations + +// rodata + +// text + +void CableCarUtil_FillWrapped(void *dest, u16 value, u8 left, u8 top, u8 width, u8 height) +{ + u8 i; + u8 j; + u8 x; + u8 y; + + for (i = 0, y = top; i < height; i++) + { + for (x = left, j = 0; j < width; j++) + { + *(u16 *)&((u8 *)dest)[y * 64 + x * 2] = value; + x = (x + 1) % 32; + } + y = (y + 1) % 32; + } +} + +void CableCarUtil_CopyWrapped(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) +{ + u8 i; + u8 j; + u8 x; + u8 y; + const u16 *_src; + + for (i = 0, _src = src, y = top; i < height; i++) + { + for (x = left, j = 0; j < width; j++) + { + *(u16 *)&((u8 *)dest)[y * 64 + x * 2] = *_src++; + x = (x + 1) % 32; + } + y = (y + 1) % 32; + } +} |