summaryrefslogtreecommitdiff
path: root/src/cable_car_util.c
diff options
context:
space:
mode:
authorjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-07-15 00:04:06 +0800
committerjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-07-15 00:04:06 +0800
commit96fa1a23edaf12082034b4ef79244e6ce3dd3128 (patch)
tree969c8a73b9f5b3ecdb0f7fc13d551f73d4d70e63 /src/cable_car_util.c
parent277726fd5e8c6da021206deeecb163f40073ff3c (diff)
parent53b950019aca8896d70c4d5e4f9e2a1d5143e489 (diff)
Merge branch 'master' into pokemon
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..7bad79079
--- /dev/null
+++ b/src/cable_car_util.c
@@ -0,0 +1,38 @@
+#include "global.h"
+
+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;
+ }
+}