summaryrefslogtreecommitdiff
path: root/src/cable_car_util.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-07-29 21:10:54 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2019-07-29 21:10:54 -0400
commite130a00cdf69c58dbff8e98a69559aeb33f87b60 (patch)
treee128e502a2229f5d934f0436a0eb31dc86350bbb /src/cable_car_util.c
parentef4c86fbfdd18b78700f61b629907a85579197c0 (diff)
parentd4cc0e161bf103d3d3e01fefa02e867d4a2053c2 (diff)
Merge branch 'master' into slot_machine
Diffstat (limited to 'src/cable_car_util.c')
-rw-r--r--src/cable_car_util.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/cable_car_util.c b/src/cable_car_util.c
new file mode 100644
index 000000000..c57038e1c
--- /dev/null
+++ b/src/cable_car_util.c
@@ -0,0 +1,38 @@
+#include "global.h"
+
+static 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;
+ }
+}
+
+static 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;
+ }
+}