summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-10-04 17:55:20 -0500
committerGitHub <noreply@github.com>2018-10-04 17:55:20 -0500
commitf044c8215b9d44f19ad90a43e9e0f4263a828254 (patch)
treee2fa5828e97a76d109276ed1d144e14cbce88f56 /include/global.h
parent4880b33ff2cff769a7c9bc73c9d792b40c10fbf7 (diff)
parent621cfbebee08dfd856a4e5a6164b9f27bcdbbadd (diff)
Merge pull request #9 from ProjectRevoTPP/battle_ai
decompile battle_ai_script_commands.c
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/global.h b/include/global.h
index dd466678d..e5c463c6e 100644
--- a/include/global.h
+++ b/include/global.h
@@ -31,6 +31,24 @@ char* strcpy(char *dst0, const char *src0);
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
+// There are many quirks in the source code which have overarching behavioral differences from
+// a number of other files. For example, diploma.c seems to declare rodata before each use while
+// other files declare out of order and must be at the beginning. There are also a number of
+// macros which differ from one file to the next due to the method of obtaining the result, such
+// as these below. Because of this, there is a theory (Two Team Theory) that states that these
+// 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))
+#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))
+#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)
+
extern u8 gStringVar1[];
extern u8 gStringVar2[];
extern u8 gStringVar3[];