diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-05 22:15:05 -0700 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-05 22:15:05 -0700 |
commit | 8d035c81528d172570338ec82c07770e7ebcfe50 (patch) | |
tree | 2a4c18fa41cdcf4727381cb3758cac9734db8a0e /src/engine | |
parent | e28c11ef9518c80e23ce0076b8ba9be4cb140015 (diff) |
cable car util
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/cable_car_util.c | 46 |
1 files changed, 46 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..27f703b42 --- /dev/null +++ b/src/engine/cable_car_util.c @@ -0,0 +1,46 @@ +#include "global.h" +#include "cable_car_util.h" + +// static types + +// static declarations + +// rodata + +// text + +void CableCarUtil_FillWrapped(void *dest, u16 value, u8 x, u8 y, u8 width, u8 height) +{ + u8 i; + u8 j; + u8 _x; + u8 _y; + + for (i = 0, _y = y; i < height; i++) + { + for (_x = x, 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 x, u8 y, u8 width, u8 height) +{ + u8 i; + u8 j; + u8 _x; + u8 _y; + const u16 *_src; + + for (i = 0, _src = src, _y = y; i < height; i++) + { + for (_x = x, j = 0; j < width; j++) + { + *(u16 *)&((u8 *)dest)[_y * 64 + _x * 2] = *_src++; + _x = (_x + 1) % 32; + } + _y = (_y + 1) % 32; + } +} |