diff --git a/s2d_parse.c b/s2d_parse.c index 35d19034..f5a64723 100644 --- a/s2d_parse.c +++ b/s2d_parse.c @@ -70,8 +70,11 @@ void s2d_snprint(int x, int y, const char *str, uObjMtx *buf, int len) { x += TAB_WIDTH_V; y += TEX_HEIGHT; break; + // case CH_SEPARATOR: + // CH_SKIP(p); + // break; default: - if (current_char != '\0') { + if (current_char != '\0' && current_char != CH_SEPARATOR) { draw_s2d_glyph(current_char, x, y, (buf++)); (x += (s2d_kerning_table[current_char] * myScale)); } diff --git a/s2d_print.h b/s2d_print.h index 0dce019a..901f4f3a 100644 --- a/s2d_print.h +++ b/s2d_print.h @@ -7,6 +7,7 @@ #define COLOR "\x83" // COLOR (r) (g) (b) (a) #define DROPSHADOW "\x84" // DROPSHADOW (no params) #define BACKGROUND "\x85" // BACKGROUND (w) (h) (alpha) +#define SEPARATOR "\x86" #define CH_SCALE '\x80' #define CH_ROT '\x81' @@ -14,6 +15,7 @@ #define CH_COLOR '\x83' #define CH_DROPSHADOW '\x84' #define CH_BACKGROUND '\x85' +#define CH_SEPARATOR '\x86' // ASCII standard escape codes #define CH_NEWLINE '\n' diff --git a/s2d_ustdlib.c b/s2d_ustdlib.c index 619957ec..63406bde 100644 --- a/s2d_ustdlib.c +++ b/s2d_ustdlib.c @@ -1,6 +1,6 @@ // ustdlib means un-standard library // i'm going to abuse so much of my power here lol - +#include "s2d_print.h" // int s2d_atoi(char *s, char **s2) { // int ret = 0; // int isNegative = (*s == '-'); @@ -25,12 +25,12 @@ int s2d_atoi(char *s, char **s2) { s++; (*s2)++; } - for (; *s != '\0' && *s != ' ' && *s >= '0' && *s <= '9'; s++) { + for (; *s != '\0' && *s != ' ' && *s != CH_SEPARATOR && *s >= '0' && *s <= '9'; s++) { ret *= 10; if (*s >= '0' && *s <= '9') ret += *s - '0'; else break; - if (!(*(s+1) != '\0' && *(s+1) != ' ' && *(s+1) >= '0' && *(s+1) <= '9')) break; + if (!(*(s+1) != '\0' && *(s+1) != CH_SEPARATOR && *(s+1) != ' ' && *(s+1) >= '0' && *(s+1) <= '9')) break; (*s2)++; } if (isNegative) ret *= -1; @@ -40,7 +40,7 @@ int s2d_atoi(char *s, char **s2) { int s2d_ilen(char *s) { int ret = 0; char *p = s; - while (*p >= '0' && *p <= '9') { + while (*p >= '0' && *p <= '9' && *p != CH_SEPARATOR) { ret++; p++; } diff --git a/x86_testing_ground/a.out b/x86_testing_ground/a.out index 674ddc84..192d4ac0 100755 Binary files a/x86_testing_ground/a.out and b/x86_testing_ground/a.out differ diff --git a/x86_testing_ground/atoi.c b/x86_testing_ground/atoi.c index 3c12a2a0..16b33717 100644 --- a/x86_testing_ground/atoi.c +++ b/x86_testing_ground/atoi.c @@ -195,10 +195,33 @@ int main(void) { // printf("%d\n", s2d_atoi(s, &s)); // printf("%s\n", s); // s2d_print(0,0, t); - while (pos != strlen(my2)) { + char laStrBuf[0x100]; + char ff[0x100]; + sprintf(ff, + "%s %d:" + TRANSLATE "134 93" "%s:" + , "Floor", 213, "Seed"); + sprintf( + laStrBuf, + "%s" + TRANSLATE "138 93" "%s" + TRANSLATE "138 110" "%s" + TRANSLATE "138 130" "%s" + , "The Basement", "LLRRABAB", "Continue", "End Run"); + + while (pos != strlen(laStrBuf)) { // s2d_type_print(0, 0, myS, &pos); - printf("%d %s\n",s2d_ilen(my2 + pos), my2 + pos); + printf("%d %s\n",s2d_ilen(laStrBuf + pos), laStrBuf + pos); pos++; } + pos = 0; + while (pos != strlen(ff)) { + // s2d_type_print(0, 0, myS, &pos); + printf("%d %s\n",s2d_ilen(ff + pos), ff + pos); + pos++; + } + // laStrBuf[strlen(laStrBuf)] = "\x1"; + // laStrBuf[strlen(laStrBuf)+1] = "\x1"; + // printf("%s\n", laStrBuf); // printf("%d\n", s2d_ilen(sss + 1)); } \ No newline at end of file