summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorEllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>2022-01-16 17:55:03 +0000
committerGitHub <noreply@github.com>2022-01-16 17:55:03 +0000
commit924fa9aadf99f9efdc3cd19411bb1c834f3ad74c (patch)
treebdc8a6dc1920ec7da9f51eead1a19ea15a3f6a47 /src/code
parentb47941968d9e718fe54d6a0c35f987c5788500ed (diff)
EnMag OK and documented (#547)
* Name textures in object_mag * Corrections * tabs -> spaces * OK, data imported * Remove obsolete comment * Start documentation * Defines for most texture sizes * Name most static variables, add state enum * Macros, name all the statics * Couple of minor tweaks to other files * Name some more effect stuff * Fix kanfont data * Name everything else, move macros * Format * Review
Diffstat (limited to 'src/code')
-rw-r--r--src/code/sys_math.c2
-rw-r--r--src/code/z_kanfont.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/src/code/sys_math.c b/src/code/sys_math.c
index 9b274c7e2..da4ccc9d2 100644
--- a/src/code/sys_math.c
+++ b/src/code/sys_math.c
@@ -34,7 +34,7 @@ f32 func_80179400(s32 n) {
//! @bug No check for negative argument. Will read the array out-of-bounds if the argument is negative.
//! (The OoT version does an unsigned check instead, which will return sFactorialTbl[12] for a negative argument.)
- if (n > 12) {
+ if (n >= ARRAY_COUNT(sFactorialTbl)) {
ret = sFactorialTbl[12];
for (i = 13; i <= n; i++) {
ret *= i;
diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c
index b678642b1..2a4849ccb 100644
--- a/src/code/z_kanfont.c
+++ b/src/code/z_kanfont.c
@@ -19,11 +19,13 @@ void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
FONT_CHAR_TEX_SIZE);
}
-static u8 sFontOrdering[] = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
- "!\"#$%&\'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "\x00\x0D\x0E\x1A"
- "afjmosvwxyz{|}~"
- "\x7F\x80\x81\x84\x86\x87\x88\x89\x8A\x8B\x8C";
+static u8 sFontOrdering[] = {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
+ 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x41, 0x42,
+ 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
+ 0x56, 0x57, 0x58, 0x59, 0x5A, 0x00, 0x0D, 0x0E, 0x1A, 0x61, 0x66, 0x6A, 0x6D, 0x6F, 0x73, 0x76, 0x77, 0x78, 0x79,
+ 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x84, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C,
+};
void Font_LoadOrderedFont(Font* font) {
u32 loadOffset;
@@ -36,7 +38,7 @@ void Font_LoadOrderedFont(Font* font) {
if (sFontOrdering[codePointIndex] == 0) {
loadOffset = 0;
}
- // UB to convert pointer to u32
+
DmaMgr_SendRequest0(writeLocation, (uintptr_t)SEGMENT_ROM_START(nes_font_static) + loadOffset,
FONT_CHAR_TEX_SIZE);
if (sFontOrdering[codePointIndex] == 0x8C) {