Rance 02: render '^' as 'é'

This commit is contained in:
Nunuhara Cabbage
2022-04-04 21:26:23 -07:00
parent 1f239c766f
commit 5fe61c14d9
4 changed files with 19 additions and 7 deletions
+2
View File
@@ -63,4 +63,6 @@ void get_time(int *hour, int *min, int *sec, int *ms);
#define XSYS4_DATA_DIR "/usr/local/share/xsystem4"
#endif
extern bool game_rance02_mg;
#endif /* XSYSTEM4_H */
+4
View File
@@ -29,6 +29,8 @@
#include "hll/hll.h"
bool game_rance02_mg = false;
static void write_instruction0(struct buffer *out, enum opcode op)
{
buffer_write_int16(out, op);
@@ -99,6 +101,8 @@ static void apply_rance02_hacks(struct ain *ain)
write_instruction0(&out, RETURN);
write_instruction1(&out, ENDFUNC, fno);
game_rance02_mg = true;
}
void apply_game_specific_hacks(struct ain *ain)
+3 -1
View File
@@ -164,7 +164,9 @@ static void charsprite_render(struct charsprite *cs)
char ch[3];
extract_sjis_char(cs->ch->text, ch);
if (ch[0] == '}' && !strcmp(config.game_name, "Rance 02")) {
// XXX: this is handled here and not in gfx_render_text because of the
// width calculation below
if (ch[0] == '}' && game_rance02_mg) {
ch[0] = 0x81;
ch[1] = 0x5c;
ch[2] = 0;
+10 -6
View File
@@ -320,15 +320,14 @@ static int _gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metr
set_font_style(sact_to_sdl_fontstyle(tm->weight));
int width;
char *conv = sjis2utf(msg, strlen(msg));
TTF_SizeUTF8(font->font, conv, &width, NULL);
TTF_SizeUTF8(font->font, msg, &width, NULL);
pos.y -= (TTF_FontAscent(font->font) - font->size * 0.9);
glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
if (tm->outline_left || tm->outline_up || tm->outline_right || tm->outline_down) {
Texture outline;
get_glyph(font->font, &outline, conv, tm->outline_color);
get_glyph(font->font, &outline, msg, tm->outline_color);
// XXX: This wont work if the outline size is larger than the stroke size
// of the font itself.
if (tm->outline_left) {
@@ -351,12 +350,11 @@ static int _gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metr
}
Texture glyph;
get_glyph(font->font, &glyph, conv, tm->color);
get_glyph(font->font, &glyph, msg, tm->color);
render_glyph(dst, &glyph, pos);
gfx_delete_texture(&glyph);
glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
free(conv);
return width;
}
@@ -380,7 +378,13 @@ int gfx_render_text(Texture *dst, Point pos, char *msg, struct text_metrics *tm,
int original_x = pos.x;
while (*msg) {
int len = extract_sjis_char(msg, c);
_gfx_render_text(dst, pos, c, tm);
if (msg[0] == '^' && game_rance02_mg) {
_gfx_render_text(dst, pos, "\xc3\xa9", tm);
} else {
char *utf = sjis2utf(c, len);
_gfx_render_text(dst, pos, utf, tm);
free(utf);
}
pos.x += (len == 2 ? tm->size : tm->size / 2) + char_space;
msg += len;
}