diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 09a0ce4..6347c96 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -70,7 +70,7 @@ add_library(modules STATIC target_include_directories(modules PUBLIC .) -target_compile_options(modules PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding) +target_compile_options(modules PRIVATE -Wno-pointer-sign) target_link_libraries(modules PRIVATE graph alk drawtext list) if (SDL2MIXER_FOUND) diff --git a/modules/NIGHTDLL/nt_msg.c b/modules/NIGHTDLL/nt_msg.c index 69903aa..19b5cd7 100644 --- a/modules/NIGHTDLL/nt_msg.c +++ b/modules/NIGHTDLL/nt_msg.c @@ -17,12 +17,14 @@ #include "nt_msg.h" #include "sprite.h" #include "sactcg.h" -#include "sjisname.h" #include "sactstring.h" extern int ntsel_dosel(void); +#define SNAME_RYO "亮    " +#define SNAME_RYO_DEF "亮" + // 通常メッセージ表示位置と大きさ #define MSGFRAME_0_X 6 #define MSGFRAME_0_Y 347 @@ -102,7 +104,7 @@ void ntmsg_init() { // 主人公名前 - nt_sstr_regist_replace(SNAME_RYO, SNAME_RYO_DEF); + nt_sstr_regist_replace(utf2sjis(SNAME_RYO), utf2sjis(SNAME_RYO_DEF)); night.msg.cbmove = cb_mousemove; night.msg.cbrelease = cb_keyrelease; diff --git a/modules/NIGHTDLL/sactstring.c b/modules/NIGHTDLL/sactstring.c index d8b47f1..acaf0b7 100644 --- a/modules/NIGHTDLL/sactstring.c +++ b/modules/NIGHTDLL/sactstring.c @@ -97,8 +97,8 @@ int nt_sstr_regist_replace(char *sstr, char *dstr) { if (sstr == dstr) return NG; ex = malloc(sizeof(strexchange_t)); - ex->src = strdup(sstr); - ex->dst = strdup(dstr); + ex->src = sstr; + ex->dst = dstr; strreplace = slist_append(strreplace, ex); return OK; } diff --git a/modules/NIGHTDLL/sjisname.h b/modules/NIGHTDLL/sjisname.h deleted file mode 100644 index 771c589..0000000 --- a/modules/NIGHTDLL/sjisname.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SNAME_RYO "@@@@" -#define SNAME_RYO_DEF "" diff --git a/modules/SACT/sactlog.c b/modules/SACT/sactlog.c index e45b398..f2dfec1 100644 --- a/modules/SACT/sactlog.c +++ b/modules/SACT/sactlog.c @@ -40,7 +40,17 @@ #include "ngraph.h" #include "drawtext.h" #include "utfsjis.h" -#include "sactlog_sjismsg.c" + +#define LOGMSG_LINES 6 + +static const char *logmsg[LOGMSG_LINES] = { + "\n", + "※バックログ操作方法※", + "[ESC]またはマウス右クリックでゲームに戻る", + "[PageUp][PageDown]でページスクロール", + "[↑][↓]またはマウスホイールで行スクロール", + "\n", +}; /* ホイールで上下スクロール @@ -73,21 +83,18 @@ static void draw_log() { // 表示始め位置 node = list_nth(sact.log, list_length(sact.log) - curline); for (i = 0; i < LOGLINENUM; i++) { - char *str, *streuc; if (cur <= 0) continue; - str = (char *)(node->data); + char *str = (char *)(node->data); if (0 == strcmp(str, "\n")) { gr_fill(chr, 0, y + FONTSIZE/2, sf0->width, 3, 128, 0, 0); } else { - streuc = sjis2utf(str); if (cur < 6) { dt_setfont(FONT_MINCHO, FONTSIZE); } else { dt_setfont(FONT_GOTHIC, FONTSIZE); } dt_drawtext(chr, 0, y, str); - free(streuc); } y += FONTSIZE; cur--; @@ -103,13 +110,15 @@ static void draw_log() { int sblog_start(void) { + static char *logmsg_sjis[6]; + if (!logmsg_sjis[0]) { + for (int i = 0; i < LOGMSG_LINES; i++) + logmsg_sjis[i] = utf2sjis(logmsg[i]); + } + // 説明文章を追加 - sact.log = list_append(sact.log, "\n"); - sact.log = list_append(sact.log, LOGMSG1); - sact.log = list_append(sact.log, LOGMSG2); - sact.log = list_append(sact.log, LOGMSG3); - sact.log = list_append(sact.log, LOGMSG4); - sact.log = list_append(sact.log, "\n"); + for (int i = 0; i < LOGMSG_LINES; i++) + sact.log = list_append(sact.log, logmsg_sjis[i]); back = sf_dup(sf0); chr = sf_create_surface(sf0->width, sf0->height, 8); @@ -129,7 +138,7 @@ int sblog_end(void) { sf_free(chr); // 説明文章を削除 - for (i = 0; i < 6; i++) { + for (i = 0; i < LOGMSG_LINES; i++) { node = list_last(sact.log); sact.log = list_remove(sact.log, node->data); } diff --git a/modules/SACT/sactlog_sjismsg.c b/modules/SACT/sactlog_sjismsg.c deleted file mode 100644 index 63bd4bb..0000000 --- a/modules/SACT/sactlog_sjismsg.c +++ /dev/null @@ -1,5 +0,0 @@ -#define LOGMSG1 "obNO@" -#define LOGMSG2 "[ESC]܂̓}EXENbNŃQ[ɖ߂" -#define LOGMSG3 "[PageUp][PageDown]Ńy[WXN[" -#define LOGMSG4 "[][]܂̓}EXzC[ōsXN[" -