summaryrefslogtreecommitdiff
path: root/src/cable_car_util.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-03-31 14:37:24 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-03-31 14:37:24 -0400
commit0015d6fe2c6a53c5f757599122ae9fd1a156a69f (patch)
tree81b7269c767da1ad4a5a9ac01e58ead5e92f0983 /src/cable_car_util.c
parent46bc01f0dd1a3435b3c6ce71e1be0d19b7aaa5bd (diff)
parent59f81c5f2a25ec77baf4a30c3da9ccb7675d1562 (diff)
Merge branch 'master' into contest_link_80C2020
Diffstat (limited to 'src/cable_car_util.c')
-rw-r--r--src/cable_car_util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cable_car_util.c b/src/cable_car_util.c
new file mode 100644
index 000000000..02bfbc195
--- /dev/null
+++ b/src/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;
+ }
+}