You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
text typing now works; implemented initial vsprint
This commit is contained in:
67
s2d_parse.c
67
s2d_parse.c
@@ -1,6 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <PR/gs2dex.h>
|
||||
#include <PR/gu.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@@ -9,19 +10,22 @@
|
||||
#include "s2d_ustdlib.h"
|
||||
|
||||
int saved_degrees = 0;
|
||||
|
||||
int s2d_colorFrames = 0;
|
||||
|
||||
|
||||
extern u32 gGlobalTimer;
|
||||
|
||||
void s2d_print(int x, int y, const char *str, uObjMtx *buf) {
|
||||
void s2d_snprint(int x, int y, char *str, uObjMtx *buf, int len) {
|
||||
char *p = str;
|
||||
int tx = 0, ty = 0;
|
||||
int tmp_len = 0;
|
||||
// int r = 0, g = 0, b = 0, a = 0;
|
||||
if (*p == '\0') return;
|
||||
do {
|
||||
char r = *p;
|
||||
int s, rd;
|
||||
|
||||
|
||||
switch (r) {
|
||||
case CH_SCALE:
|
||||
CH_SKIP(p);
|
||||
@@ -42,6 +46,7 @@ void s2d_print(int x, int y, const char *str, uObjMtx *buf) {
|
||||
y = s2d_atoi(p, &p);
|
||||
break;
|
||||
case CH_COLOR:
|
||||
s2d_colorFrames++;
|
||||
CH_SKIP(p);
|
||||
s2d_red = s2d_atoi(p, &p);
|
||||
CH_SKIP(p); CH_SKIP(p);
|
||||
@@ -55,15 +60,23 @@ void s2d_print(int x, int y, const char *str, uObjMtx *buf) {
|
||||
s2d_alpha = s2d_atoi(p, &p);
|
||||
break;
|
||||
default:
|
||||
if (myDegrees == 0)
|
||||
draw_s2d_glyph(r, (x += (8 * myScale)) + tx, y + ty, (buf++));
|
||||
else
|
||||
draw_s2d_glyph(r, (x += ((8 * myScale))) + tx, y + ty, (buf++));
|
||||
// if (s2d_colorFrames > 2) {
|
||||
// s2d_colorFrames = 0;
|
||||
// s2d_red = s2d_green = s2d_blue = 255;
|
||||
// s2d_alpha = 255;
|
||||
// }
|
||||
if (r != '\0') {
|
||||
if (myDegrees == 0)
|
||||
draw_s2d_glyph(r, (x += (8 * myScale)) + tx, y + ty, (buf++));
|
||||
else
|
||||
draw_s2d_glyph(r, (x += ((8 * myScale))) + tx, y + ty, (buf++));
|
||||
}
|
||||
}
|
||||
// myDegrees += saved_degrees;
|
||||
if (*p == '\0') break;
|
||||
p++;
|
||||
} while (*p != '\0');
|
||||
tmp_len++;
|
||||
} while (tmp_len < len);
|
||||
myScale = 1;
|
||||
myDegrees = 0;
|
||||
// saved_degrees = 0;
|
||||
@@ -71,31 +84,25 @@ void s2d_print(int x, int y, const char *str, uObjMtx *buf) {
|
||||
ty = 0;
|
||||
}
|
||||
|
||||
int ilen = 0;
|
||||
void s2d_type_print(int x, int y, char *str, uObjMtx *buf, int *pos) {
|
||||
char *temp_str = str;
|
||||
char tmp = temp_str[*pos];
|
||||
int len = s2d_strlen(str);
|
||||
switch(tmp) {
|
||||
case CH_SCALE:
|
||||
ilen = s2d_ilen(str + *pos + 2);
|
||||
if (ilen <= 1) {
|
||||
(*pos) += ilen;
|
||||
} else {
|
||||
(*pos) += ilen + 1;
|
||||
}
|
||||
break;
|
||||
case CH_ROT:
|
||||
(*pos) += s2d_ilen(str + *pos);
|
||||
|
||||
break;
|
||||
}
|
||||
temp_str[*pos] = '\0';
|
||||
s2d_print(x, y, temp_str, buf);
|
||||
temp_str[*pos] = tmp;
|
||||
void s2d_print(int x, int y, const char *str, uObjMtx *buf) {
|
||||
s2d_snprint(x, y, str, buf, s2d_strlen(str));
|
||||
}
|
||||
|
||||
void s2d_type_print(int x, int y, char *str, uObjMtx *buf, int *pos) {
|
||||
int len = s2d_strlen(str);
|
||||
|
||||
s2d_snprint(x, y, str, buf, *pos);
|
||||
if (s2d_timer % 2 == 0) {
|
||||
if (*pos < len) (*pos)++;
|
||||
if (*pos < len) {
|
||||
(*pos)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void s2d_vsprint(int x, int y, uObjMtx *buf, char *str, ...) {
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
sprintf()
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user