Eliminate SJIS string constants

This commit is contained in:
kichikuou
2020-07-24 08:54:45 +09:00
parent 50b3812364
commit ce67aa7028
6 changed files with 28 additions and 24 deletions
+1 -1
View File
@@ -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)
+4 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
}
-2
View File
@@ -1,2 +0,0 @@
#define SNAME_RYO "亮    "
#define SNAME_RYO_DEF "亮"
+21 -12
View File
@@ -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);
}
-5
View File
@@ -1,5 +0,0 @@
#define LOGMSG1 "※バックログ操作方法※"
#define LOGMSG2 "[ESC]またはマウス右クリックでゲームに戻る"
#define LOGMSG3 "[PageUp][PageDown]でページスクロール"
#define LOGMSG4 "[↑][↓]またはマウスホイールで行スクロール"