diff --git a/config.h b/config.h index 8f691a46..f148460a 100644 --- a/config.h +++ b/config.h @@ -4,15 +4,18 @@ // include your font header here #include "fonts/impact.h" -// get your symbols defined here +// get your font symbols defined here #define s2d_font impact_obj #define s2d_tex impact_tex // Debug: bypass custom matrix setup #define s2d_mat impact_mtx -// homebrew users: use this to rename your gdl head +// Homebrew users: use this to rename your gdl head #define gdl_head gDisplayListHead extern Gfx *gdl_head; +// Other games: change this to the appropriate alloc function +#define alloc alloc_display_list + #endif \ No newline at end of file diff --git a/s2d_parse.c b/s2d_parse.c index af86755d..01acce51 100644 --- a/s2d_parse.c +++ b/s2d_parse.c @@ -26,6 +26,8 @@ int s2d_atoi(char *s, char **s2) { return ret; } +extern u32 gGlobalTimer; + void s2d_print(int x, int y, const char *str, uObjMtx *buf) { char *p = str; int tx = 0, ty = 0; @@ -36,33 +38,33 @@ void s2d_print(int x, int y, const char *str, uObjMtx *buf) { int s, rd; switch (r) { case CH_SCALE: - CH_GET_NEXT(p); + CH_SKIP(p); s = s2d_atoi(p, &p); myScale = s; break; case CH_ROT: - CH_GET_NEXT(p); + CH_SKIP(p); rd = s2d_atoi(p, &p); saved_degrees = rd; myDegrees = rd; break; case CH_TRANSLATE: - CH_GET_NEXT(p); + CH_SKIP(p); x = s2d_atoi(p, &p); - CH_GET_NEXT(p); - CH_GET_NEXT(p); + CH_SKIP(p); + CH_SKIP(p); y = s2d_atoi(p, &p); break; case CH_COLOR: - CH_GET_NEXT(p); + CH_SKIP(p); s2d_red = s2d_atoi(p, &p); - CH_GET_NEXT(p); CH_GET_NEXT(p); + CH_SKIP(p); CH_SKIP(p); s2d_green = s2d_atoi(p, &p); - CH_GET_NEXT(p); CH_GET_NEXT(p); + CH_SKIP(p); CH_SKIP(p); s2d_blue = s2d_atoi(p, &p); - CH_GET_NEXT(p); CH_GET_NEXT(p); + CH_SKIP(p); CH_SKIP(p); s2d_alpha = s2d_atoi(p, &p); break; @@ -75,7 +77,7 @@ void s2d_print(int x, int y, const char *str, uObjMtx *buf) { draw_s2d_glyph(r, (x += ((8 * myScale))) + tx, y + ty, (buf++)); } // myDegrees += saved_degrees; - } while (*(++p) != '\0'); + } while (*p != '\0'); myScale = 1; myDegrees = 0; saved_degrees = 0; diff --git a/s2d_print.h b/s2d_print.h index e2d97fcf..6596d865 100644 --- a/s2d_print.h +++ b/s2d_print.h @@ -11,6 +11,10 @@ #define CH_TRANSLATE '\x82' #define CH_COLOR '\x83' +// ASCII standard escape codes +#define CH_NEWLINE '\n' + #define CH_GET_NEXT(x) (*(++x)) +#define CH_SKIP(x) ((++x)) extern void s2d_print(int x, int y, const char *str, uObjMtx *buf);