summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-11-04 22:42:28 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2017-11-04 22:42:28 -0400
commitb4c6e0560a7b1310cc08b93ea04935d4fbb7c3de (patch)
tree8f4bded9d721a993674a4e5d9eeb57ad86580d39 /include
parenteb802f60a26d72e23c5e381bc06de2a7f3bfc7c0 (diff)
BAD_MEM macros to MEM_ALT
Diffstat (limited to 'include')
-rw-r--r--include/battle.h9
-rw-r--r--include/global.h4
2 files changed, 8 insertions, 5 deletions
diff --git a/include/battle.h b/include/battle.h
index 9adcaaf95..dc9ac93cc 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -694,15 +694,18 @@ extern u8 ewram[];
// functions that invoke this macro will not match without this egregeous
// assumption about the variable names, so in order to avoid this assumption,
// we opt to pass the variables themselves, even though it is likely that
-// Sogabe assumed the variables were named src and dest.
-#define BAD_MEMSET(data, c, size, var, dest) \
+// Sogabe assumed the variables were named src and dest. Trust me: I tried to
+// avoid assuming variable names, but the ROM just will not match without the
+// assumptions. Therefore, these macros are bad practice, but I'm putting them
+// here anyway.
+#define MEMSET_ALT(data, c, size, var, dest) \
{ \
dest = (u8 *)data; \
for(var = 0; var < (u32)size; var++) \
dest[var] = c; \
} \
-#define BAD_MEMCPY(data, dest, size, var, src) \
+#define MEMCPY_ALT(data, dest, size, var, src) \
{ \
src = (u8 *)data; \
for(var = 0; var < (u32)size; var++) \
diff --git a/include/global.h b/include/global.h
index e0a1c6452..647f66bc8 100644
--- a/include/global.h
+++ b/include/global.h
@@ -63,13 +63,13 @@ enum
// programming projects had more than 1 "programming team" which utilized different macros for
// each of the files that were worked on.
#define T1_READ_8(ptr) ((ptr)[0])
-#define T1_READ_16(ptr) ((ptr)[0] | ((ptr)[1] << 8)) // why do you use OR here but not for READ_32?
+#define T1_READ_16(ptr) ((ptr)[0] | ((ptr)[1] << 8))
#define T1_READ_32(ptr) ((ptr)[0] | ((ptr)[1] << 8) | ((ptr)[2] << 16) | ((ptr)[3] << 24))
#define T1_READ_PTR(ptr) (u8*) T1_READ_32(ptr)
// T2_READ_8 is a duplicate to remain consistent with each group.
#define T2_READ_8(ptr) ((ptr)[0])
-#define T2_READ_16(ptr) ((ptr)[0] + ((ptr)[1] << 8)) // why do you use OR here but not for READ_32?
+#define T2_READ_16(ptr) ((ptr)[0] + ((ptr)[1] << 8))
#define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24))
#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr)