diff --git a/src/ags.c b/src/ags.c index fc16a8f..1e8d5f0 100644 --- a/src/ags.c +++ b/src/ags.c @@ -120,7 +120,7 @@ boolean ags_check_param_xy(int *x, int *y) { return TRUE; } -void ags_init(const char *render_driver) { +void ags_init(const char *render_driver, bool enable_zb) { nact->ags.mouse_warp_enabled = true; nact->ags.world_size.width = SYS35_DEFAULT_WIDTH; nact->ags.world_size.height = SYS35_DEFAULT_HEIGHT; @@ -129,6 +129,9 @@ void ags_init(const char *render_driver) { nact->ags.view_area.y = 0; nact->ags.view_area.w = SYS35_DEFAULT_WIDTH; nact->ags.view_area.h = SYS35_DEFAULT_HEIGHT; + + nact->ags.enable_zb = enable_zb; + nact->ags.font_weight = enable_zb ? FONT_WEIGHT_BOLD : FONT_WEIGHT_NORMAL; sdl_Initialize(render_driver); font_init(); diff --git a/src/ags.h b/src/ags.h index 6efe960..28a34f4 100644 --- a/src/ags.h +++ b/src/ags.h @@ -113,7 +113,10 @@ struct _ags { agsurface_t *dib; /* main surface */ void (*eventcb)(agsevent_t *e); /* deliver event */ + int font_weight; + bool mouse_warp_enabled; + bool enable_zb; boolean noantialias; /* antialias を使用しない */ boolean noimagecursor; /* リソースファイルのカーソルを読みこまない */ }; @@ -122,7 +125,7 @@ typedef struct _ags ags_t; /* 初期化関係 */ -void ags_init(const char *render_driver); +void ags_init(const char *render_driver, bool enable_zb); void ags_remove(void); void ags_reset(void); diff --git a/src/cmdz.c b/src/cmdz.c index a9c43e5..ff1127d 100644 --- a/src/cmdz.c +++ b/src/cmdz.c @@ -115,8 +115,8 @@ void commandZB() { /* メッセージ文字を太さを設定 */ int weight = getCaliValue(); - nact->msg.MsgFontWeight = weight; - nact->sel.MsgFontWeight = weight; + if (nact->ags.enable_zb) + nact->ags.font_weight = weight; DEBUG_COMMAND("ZB %d:", weight); } diff --git a/src/font.h b/src/font.h index 3ed2b4c..80e8c5d 100644 --- a/src/font.h +++ b/src/font.h @@ -32,6 +32,7 @@ #define FONTTYPEMAX 2 #define FONT_WEIGHT_NORMAL 4 +#define FONT_WEIGHT_BOLD 7 extern void font_init(void); extern void font_set_name_and_index(int type, const char *name, int index); diff --git a/src/message.c b/src/message.c index 9df5cdf..e66c289 100644 --- a/src/message.c +++ b/src/message.c @@ -64,9 +64,8 @@ static void msgget_at_a(); void msg_init() { /* メッセージフォントの大きさ */ - msg.MsgFontSize = 16; - msg.MsgFontWeight = 7; - msg.MsgFont = FONT_GOTHIC; + msg.MsgFontSize = 16; + msg.MsgFont = FONT_GOTHIC; /* 各種色 */ msg.MsgFontColor = 255; @@ -141,7 +140,8 @@ void msg_putMessage(const char *m) { // fprintf(stdout, "x=%d, y = %d, msg=%s\n", msgcur.x,msgcur.y,msg); if (!msg.mg_dspMsg) return; - ags_setFontWithWeight(msg.MsgFont, msg.MsgFontSize, msg.MsgFontWeight); + ags_setFontWithWeight(msg.MsgFont, msg.MsgFontSize, nact->ags.font_weight); + switch(msgDecorateType) { case 0: default: diff --git a/src/message.h b/src/message.h index 1028e75..489f909 100644 --- a/src/message.h +++ b/src/message.h @@ -44,7 +44,6 @@ extern void msg_mg6_command(int cmd); struct __message { /* メッセージフォントの大きさ */ int MsgFontSize; - int MsgFontWeight; int MsgFont; /* 各種色 */ diff --git a/src/selection.c b/src/selection.c index 64ee1a8..cbe9547 100644 --- a/src/selection.c +++ b/src/selection.c @@ -93,7 +93,6 @@ void sel_init() { /* メッセージフォントの大きさ */ sel.MsgFontSize = 16; - sel.MsgFontWeight = 7; /* 各種色 */ sel.MsgFontColor = 255; @@ -302,7 +301,7 @@ static void init_selwindow() { NOTICE("frameType is Default"); break; } - ags_setFontWithWeight(FONT_GOTHIC, sel.MsgFontSize, sel.MsgFontWeight); + ags_setFontWithWeight(FONT_GOTHIC, sel.MsgFontSize, nact->ags.font_weight); for (i = 0; i < regnum; i++) { DEBUG_MESSAGE("%d:%s\n", i +1, elm[i]); ags_drawString(r.x +2, r.y + i * (sel.MsgFontSize +2) +1, elm[i], sel.MsgFontColor); diff --git a/src/selection.h b/src/selection.h index 78abecb..d91786a 100644 --- a/src/selection.h +++ b/src/selection.h @@ -55,7 +55,6 @@ struct _selection { /* メッセージフォントの大きさ */ int MsgFontSize; - int MsgFontWeight; /* 各種色 */ int MsgFontColor; diff --git a/src/xsystem35.c b/src/xsystem35.c index 3e80081..129bab4 100644 --- a/src/xsystem35.c +++ b/src/xsystem35.c @@ -97,6 +97,7 @@ static char *fontname_tt[FONTTYPEMAX] = {DEFAULT_GOTHIC_TTF, DEFAULT_MINCHO_TTF} static char fontface[FONTTYPEMAX]; static boolean font_noantialias; +static bool enable_zb = false; static bool integer_scaling = false; /* fullscreen on from command line */ static boolean fs_on; @@ -210,7 +211,7 @@ static void sys35_init() { v_init(); - ags_init(render_driver); + ags_init(render_driver, enable_zb); for (i = 0; i < FONTTYPEMAX; i++) font_set_name_and_index(i, fontname_tt[i], fontface[i]); @@ -293,6 +294,8 @@ static void sys35_ParseOption(int *argc, char **argv) { fs_on = TRUE; } else if (0 == strcmp(argv[i], "-noantialias")) { font_noantialias = TRUE; + } else if (0 == strcmp(argv[i], "-enable_zb")) { + enable_zb = TRUE; } else if (0 == strcmp(argv[i], "-ttfont_gothic")) { if (argv[i + 1] != NULL) { fontname_tt[FONT_GOTHIC] = argv[i + 1]; @@ -354,6 +357,13 @@ static void check_profile() { font_noantialias = TRUE; } } + /* Enable ZB command (font weight) */ + param = get_profile("enable_zb"); + if (param) { + if (0 == strcmp(param, "Yes")) { + enable_zb = TRUE; + } + } /* Audio buffer size */ param = get_profile("audio_buffer_size"); if (param) { diff --git a/xsys35rc.sample b/xsys35rc.sample index 52501d7..24ffb6d 100644 --- a/xsys35rc.sample +++ b/xsys35rc.sample @@ -97,3 +97,10 @@ #no_imagecursor: Yes # ----------------------------------------------------------- + +# Enables the ZB command (change the font weight). It is disabled by default +# because it makes the text too bold with our default fonts. +# This option is experimental and may be removed in the future. See +# https://github.com/kichikuou/xsystem35-sdl2/issues/44 for details. + +#enable_zb: Yes