<ClCompile Include="..\..\src\autopick.c" />\r
<ClCompile Include="..\..\src\avatar.c" />\r
<ClCompile Include="..\..\src\birth.c" />\r
+ <ClCompile Include="..\..\src\cmd\cmd-sprocess-screen.c" />\r
<ClCompile Include="..\..\src\main\music-definitions-table.c" />\r
<ClCompile Include="..\..\src\main\sound-definitions-table.c" />\r
<ClCompile Include="..\..\src\market\building.c" />\r
<ClInclude Include="..\..\src\autopick.h" />\r
<ClInclude Include="..\..\src\avatar.h" />\r
<ClInclude Include="..\..\src\birth.h" />\r
+ <ClInclude Include="..\..\src\cmd\cmd-process-screen.h" />\r
<ClInclude Include="..\..\src\main\music-definitions-table.h" />\r
<ClInclude Include="..\..\src\main\sound-definitions-table.h" />\r
<ClInclude Include="..\..\src\market\building.h" />\r
<ClCompile Include="..\..\src\main\music-definitions-table.c">
<Filter>main</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\cmd\cmd-sprocess-screen.c">
+ <Filter>cmd</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\gamevalue.h" />
<ClInclude Include="..\..\src\main\music-definitions-table.h">
<Filter>main</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\cmd\cmd-process-screen.h">
+ <Filter>cmd</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
cmd/cmd-magiceat.c cmd/cmd-magiceat.h cmd/cmd-mane.c cmd/cmd-mane.h \
cmd/cmd-macro.c cmd/cmd-macro.h cmd/cmd-pet.c cmd/cmd-pet.h \
cmd/cmd-quaff.c cmd/cmd-quaff.h cmd/cmd-read.c cmd/cmd-read.h \
+ cmd/cmd-process-screen.c cmd/cmd-process-screen.h \
cmd/cmd-save.c cmd/cmd-save.h cmd/cmd-smith.c cmd/cmd-smith.h \
cmd/cmd-spell.c cmd/cmd-spell.h cmd/cmd-visuals.c cmd/cmd-visuals.h \
cmd/cmd-usestaff.c cmd/cmd-usestaff.h \
static TERM_COLOR attr_idx_feat[F_LIT_MAX];
static SYMBOL_CODE char_idx_feat[F_LIT_MAX];
-// Encode the screen colors
-static char hack[17] = "dwsorgbuDWvyRGBU";
-
/*!
* @brief prefファイルを選択して処理する /
* Ask for a "user pref line" and process it
/*
- * Hack -- load a screen dump from a file
- */
-void do_cmd_load_screen(void)
-{
- TERM_COLOR a = 0;
- SYMBOL_CODE c = ' ';
- bool okay = TRUE;
- FILE *fff;
- char buf[1024];
- TERM_LEN wid, hgt;
- Term_get_size(&wid, &hgt);
- path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
- fff = my_fopen(buf, "r");
- if (!fff)
- {
- msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
- msg_print(NULL);
- return;
- }
-
- screen_save();
- Term_clear();
- for (TERM_LEN y = 0; okay; y++)
- {
- if (!fgets(buf, 1024, fff)) okay = FALSE;
-
- if (buf[0] == '\n' || buf[0] == '\0') break;
- if (y >= hgt) continue;
-
- for (TERM_LEN x = 0; x < wid - 1; x++)
- {
- if (buf[x] == '\n' || buf[x] == '\0') break;
-
- Term_draw(x, y, TERM_WHITE, buf[x]);
- }
- }
-
- for (TERM_LEN y = 0; okay; y++)
- {
- if (!fgets(buf, 1024, fff)) okay = FALSE;
-
- if (buf[0] == '\n' || buf[0] == '\0') break;
- if (y >= hgt) continue;
-
- for (TERM_LEN x = 0; x < wid - 1; x++)
- {
- if (buf[x] == '\n' || buf[x] == '\0') break;
-
- (void)(Term_what(x, y, &a, &c));
- for (int i = 0; i < 16; i++)
- {
- if (hack[i] == buf[x]) a = (byte)i;
- }
-
- Term_draw(x, y, a, c);
- }
- }
-
- my_fclose(fff);
- prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
- flush();
- inkey();
- screen_load();
-}
-
-
-void do_cmd_save_screen_html_aux(char *filename, int message)
-{
- concptr tags[4] = {
- "HEADER_START:",
- "HEADER_END:",
- "FOOTER_START:",
- "FOOTER_END:",
- };
- concptr html_head[] = {
- "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
- "<pre>",
- 0,
- };
- concptr html_foot[] = {
- "</pre>\n",
- "</body>\n</html>\n",
- 0,
- };
-
- TERM_LEN wid, hgt;
- Term_get_size(&wid, &hgt);
- FILE_TYPE(FILE_TYPE_TEXT);
- FILE *fff;
- fff = my_fopen(filename, "w");
- if (!fff)
- {
- if (message)
- {
- msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
- msg_print(NULL);
- }
-
- return;
- }
-
- if (message) screen_save();
-
- char buf[2048];
- path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
- FILE *tmpfff;
- tmpfff = my_fopen(buf, "r");
- if (!tmpfff)
- {
- for (int i = 0; html_head[i]; i++)
- fputs(html_head[i], fff);
- }
- else
- {
- bool is_first_line = TRUE;
- while (!my_fgets(tmpfff, buf, sizeof(buf)))
- {
- if (is_first_line)
- {
- if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
- is_first_line = FALSE;
- }
- else
- {
- if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
- break;
- fprintf(fff, "%s\n", buf);
- }
- }
- }
-
- for (TERM_LEN y = 0; y < hgt; y++)
- {
- if (y != 0) fprintf(fff, "\n");
-
- TERM_COLOR a = 0, old_a = 0;
- char c = ' ';
- for (TERM_LEN x = 0; x < wid - 1; x++)
- {
- concptr cc = NULL;
- (void)(Term_what(x, y, &a, &c));
- switch (c)
- {
- case '&': cc = "&"; break;
- case '<': cc = "<"; break;
- case '>': cc = ">"; break;
-#ifdef WINDOWS
- case 0x1f: c = '.'; break;
- case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
-#endif
- }
-
- a = a & 0x0F;
- if ((y == 0 && x == 0) || a != old_a)
- {
- int rv = angband_color_table[a][1];
- int gv = angband_color_table[a][2];
- int bv = angband_color_table[a][3];
- fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
- ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
- old_a = a;
- }
-
- if (cc)
- fprintf(fff, "%s", cc);
- else
- fprintf(fff, "%c", c);
- }
- }
-
- fprintf(fff, "</font>");
- if (!tmpfff)
- {
- for (int i = 0; html_foot[i]; i++)
- fputs(html_foot[i], fff);
- }
- else
- {
- rewind(tmpfff);
- bool is_first_line = TRUE;
- while (!my_fgets(tmpfff, buf, sizeof(buf)))
- {
- if (is_first_line)
- {
- if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
- is_first_line = FALSE;
- }
- else
- {
- if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
- break;
- fprintf(fff, "%s\n", buf);
- }
- }
-
- my_fclose(tmpfff);
- }
-
- fprintf(fff, "\n");
- my_fclose(fff);
- if (message)
- {
- msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
- msg_print(NULL);
- }
-
- if (message)
- screen_load();
-}
-
-
-/*
- * Hack -- save a screen dump to a file
- */
-static void do_cmd_save_screen_html(void)
-{
- char buf[1024], tmp[256] = "screen.html";
-
- if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
- return;
- path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
-
- msg_print(NULL);
-
- do_cmd_save_screen_html_aux(buf, 1);
-}
-
-
-/*
- * Save a screen dump to a file
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @return なし
- */
-void do_cmd_save_screen(player_type *creature_ptr)
-{
- prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
- bool html_dump = FALSE;
- while (TRUE)
- {
- char c = inkey();
- if (c == 'Y' || c == 'y')
- break;
- else if (c == 'H' || c == 'h')
- {
- html_dump = TRUE;
- break;
- }
- else
- {
- prt("", 0, 0);
- return;
- }
- }
-
- int wid, hgt;
- Term_get_size(&wid, &hgt);
-
- bool old_use_graphics = use_graphics;
- if (old_use_graphics)
- {
- use_graphics = FALSE;
- reset_visuals(creature_ptr);
- creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
- handle_stuff(creature_ptr);
- }
-
- if (html_dump)
- {
- do_cmd_save_screen_html();
- do_cmd_redraw(creature_ptr);
- }
- else
- {
- TERM_LEN y, x;
- TERM_COLOR a = 0;
- SYMBOL_CODE c = ' ';
- FILE *fff;
- char buf[1024];
- path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
- FILE_TYPE(FILE_TYPE_TEXT);
- fff = my_fopen(buf, "w");
- if (!fff)
- {
- msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
- msg_print(NULL);
- return;
- }
-
- screen_save();
- for (y = 0; y < hgt; y++)
- {
- for (x = 0; x < wid - 1; x++)
- {
- (void)(Term_what(x, y, &a, &c));
- buf[x] = c;
- }
-
- buf[x] = '\0';
- fprintf(fff, "%s\n", buf);
- }
-
- fprintf(fff, "\n");
- for (y = 0; y < hgt; y++)
- {
- for (x = 0; x < wid - 1; x++)
- {
- (void)(Term_what(x, y, &a, &c));
- buf[x] = hack[a & 0x0F];
- }
-
- buf[x] = '\0';
- fprintf(fff, "%s\n", buf);
- }
-
- fprintf(fff, "\n");
- my_fclose(fff);
- msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
- msg_print(NULL);
- screen_load();
- }
-
- if (!old_use_graphics) return;
-
- use_graphics = TRUE;
- reset_visuals(creature_ptr);
- creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
- handle_stuff(creature_ptr);
-}
-
-
-/*
* todo okay = 既知のアーティファクト? と思われるが確証がない
* 分かりやすい変数名へ変更求む&万が一未知である旨の配列なら負論理なのでゴソッと差し替えるべき
* Check the status of "artifacts"
extern void do_cmd_note(void);
extern void do_cmd_version(void);
extern void do_cmd_feeling(player_type *creature_ptr);
-extern void do_cmd_load_screen(void);
-extern void do_cmd_save_screen_html_aux(char *filename, int message);
-extern void do_cmd_save_screen(player_type *creature_ptr);
extern void do_cmd_knowledge_quests_completed(player_type *creature_ptr, FILE *fff, QUEST_IDX quest_num[]);
extern void do_cmd_knowledge_quests_failed(player_type *creature_ptr, FILE *fff, QUEST_IDX quest_num[]);
extern void do_cmd_knowledge(player_type *creature_ptr);
--- /dev/null
+/*!
+* @file cmd-process-screen.c
+* @brief 記念撮影のセーブとロード
+* @date 2020/04/22
+* @Author Hourier
+*/
+
+#include "angband.h"
+#include "cmd/cmd-process-screen.h"
+#include "cmd/cmd-draw.h"
+#include "core.h" // 暫定、後で消す.
+#include "files.h"
+#include "gameterm.h"
+
+// Encode the screen colors
+static char hack[17] = "dwsorgbuDWvyRGBU";
+
+void do_cmd_save_screen_html_aux(char *filename, int message)
+{
+ concptr tags[4] = {
+ "HEADER_START:",
+ "HEADER_END:",
+ "FOOTER_START:",
+ "FOOTER_END:",
+ };
+ concptr html_head[] = {
+ "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
+ "<pre>",
+ 0,
+ };
+ concptr html_foot[] = {
+ "</pre>\n",
+ "</body>\n</html>\n",
+ 0,
+ };
+
+ TERM_LEN wid, hgt;
+ Term_get_size(&wid, &hgt);
+ FILE_TYPE(FILE_TYPE_TEXT);
+ FILE *fff;
+ fff = my_fopen(filename, "w");
+ if (!fff)
+ {
+ if (message)
+ {
+ msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
+ msg_print(NULL);
+ }
+
+ return;
+ }
+
+ if (message) screen_save();
+
+ char buf[2048];
+ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
+ FILE *tmpfff;
+ tmpfff = my_fopen(buf, "r");
+ if (!tmpfff)
+ {
+ for (int i = 0; html_head[i]; i++)
+ fputs(html_head[i], fff);
+ }
+ else
+ {
+ bool is_first_line = TRUE;
+ while (!my_fgets(tmpfff, buf, sizeof(buf)))
+ {
+ if (is_first_line)
+ {
+ if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
+ is_first_line = FALSE;
+ }
+ else
+ {
+ if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
+ break;
+ fprintf(fff, "%s\n", buf);
+ }
+ }
+ }
+
+ for (TERM_LEN y = 0; y < hgt; y++)
+ {
+ if (y != 0) fprintf(fff, "\n");
+
+ TERM_COLOR a = 0, old_a = 0;
+ char c = ' ';
+ for (TERM_LEN x = 0; x < wid - 1; x++)
+ {
+ concptr cc = NULL;
+ (void)(Term_what(x, y, &a, &c));
+ switch (c)
+ {
+ case '&': cc = "&"; break;
+ case '<': cc = "<"; break;
+ case '>': cc = ">"; break;
+#ifdef WINDOWS
+ case 0x1f: c = '.'; break;
+ case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
+#endif
+ }
+
+ a = a & 0x0F;
+ if ((y == 0 && x == 0) || a != old_a)
+ {
+ int rv = angband_color_table[a][1];
+ int gv = angband_color_table[a][2];
+ int bv = angband_color_table[a][3];
+ fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
+ ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
+ old_a = a;
+ }
+
+ if (cc)
+ fprintf(fff, "%s", cc);
+ else
+ fprintf(fff, "%c", c);
+ }
+ }
+
+ fprintf(fff, "</font>");
+ if (!tmpfff)
+ {
+ for (int i = 0; html_foot[i]; i++)
+ fputs(html_foot[i], fff);
+ }
+ else
+ {
+ rewind(tmpfff);
+ bool is_first_line = TRUE;
+ while (!my_fgets(tmpfff, buf, sizeof(buf)))
+ {
+ if (is_first_line)
+ {
+ if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
+ is_first_line = FALSE;
+ }
+ else
+ {
+ if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
+ break;
+ fprintf(fff, "%s\n", buf);
+ }
+ }
+
+ my_fclose(tmpfff);
+ }
+
+ fprintf(fff, "\n");
+ my_fclose(fff);
+ if (message)
+ {
+ msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
+ msg_print(NULL);
+ }
+
+ if (message)
+ screen_load();
+}
+
+
+/*
+ * Hack -- save a screen dump to a file
+ */
+static void do_cmd_save_screen_html(void)
+{
+ char buf[1024], tmp[256] = "screen.html";
+
+ if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
+ return;
+ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
+
+ msg_print(NULL);
+
+ do_cmd_save_screen_html_aux(buf, 1);
+}
+
+
+/*
+ * Save a screen dump to a file
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ */
+void do_cmd_save_screen(player_type *creature_ptr)
+{
+ prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
+ bool html_dump = FALSE;
+ while (TRUE)
+ {
+ char c = inkey();
+ if (c == 'Y' || c == 'y')
+ break;
+ else if (c == 'H' || c == 'h')
+ {
+ html_dump = TRUE;
+ break;
+ }
+ else
+ {
+ prt("", 0, 0);
+ return;
+ }
+ }
+
+ int wid, hgt;
+ Term_get_size(&wid, &hgt);
+
+ bool old_use_graphics = use_graphics;
+ if (old_use_graphics)
+ {
+ use_graphics = FALSE;
+ reset_visuals(creature_ptr);
+ creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
+ handle_stuff(creature_ptr);
+ }
+
+ if (html_dump)
+ {
+ do_cmd_save_screen_html();
+ do_cmd_redraw(creature_ptr);
+ }
+ else
+ {
+ TERM_LEN y, x;
+ TERM_COLOR a = 0;
+ SYMBOL_CODE c = ' ';
+ FILE *fff;
+ char buf[1024];
+ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
+ FILE_TYPE(FILE_TYPE_TEXT);
+ fff = my_fopen(buf, "w");
+ if (!fff)
+ {
+ msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
+ msg_print(NULL);
+ return;
+ }
+
+ screen_save();
+ for (y = 0; y < hgt; y++)
+ {
+ for (x = 0; x < wid - 1; x++)
+ {
+ (void)(Term_what(x, y, &a, &c));
+ buf[x] = c;
+ }
+
+ buf[x] = '\0';
+ fprintf(fff, "%s\n", buf);
+ }
+
+ fprintf(fff, "\n");
+ for (y = 0; y < hgt; y++)
+ {
+ for (x = 0; x < wid - 1; x++)
+ {
+ (void)(Term_what(x, y, &a, &c));
+ buf[x] = hack[a & 0x0F];
+ }
+
+ buf[x] = '\0';
+ fprintf(fff, "%s\n", buf);
+ }
+
+ fprintf(fff, "\n");
+ my_fclose(fff);
+ msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
+ msg_print(NULL);
+ screen_load();
+ }
+
+ if (!old_use_graphics) return;
+
+ use_graphics = TRUE;
+ reset_visuals(creature_ptr);
+ creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
+ handle_stuff(creature_ptr);
+}
+
+
+/*
+ * @brief Load a screen dump from a file
+ */
+void do_cmd_load_screen(void)
+{
+ TERM_COLOR a = 0;
+ SYMBOL_CODE c = ' ';
+ bool okay = TRUE;
+ FILE *fff;
+ char buf[1024];
+ TERM_LEN wid, hgt;
+ Term_get_size(&wid, &hgt);
+ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
+ fff = my_fopen(buf, "r");
+ if (!fff)
+ {
+ msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
+ msg_print(NULL);
+ return;
+ }
+
+ screen_save();
+ Term_clear();
+ for (TERM_LEN y = 0; okay; y++)
+ {
+ if (!fgets(buf, 1024, fff)) okay = FALSE;
+
+ if (buf[0] == '\n' || buf[0] == '\0') break;
+ if (y >= hgt) continue;
+
+ for (TERM_LEN x = 0; x < wid - 1; x++)
+ {
+ if (buf[x] == '\n' || buf[x] == '\0') break;
+
+ Term_draw(x, y, TERM_WHITE, buf[x]);
+ }
+ }
+
+ for (TERM_LEN y = 0; okay; y++)
+ {
+ if (!fgets(buf, 1024, fff)) okay = FALSE;
+
+ if (buf[0] == '\n' || buf[0] == '\0') break;
+ if (y >= hgt) continue;
+
+ for (TERM_LEN x = 0; x < wid - 1; x++)
+ {
+ if (buf[x] == '\n' || buf[x] == '\0') break;
+
+ (void)(Term_what(x, y, &a, &c));
+ for (int i = 0; i < 16; i++)
+ {
+ if (hack[i] == buf[x]) a = (byte)i;
+ }
+
+ Term_draw(x, y, a, c);
+ }
+ }
+
+ my_fclose(fff);
+ prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
+ flush();
+ inkey();
+ screen_load();
+}
--- /dev/null
+#pragma once
+
+void do_cmd_save_screen_html_aux(char *filename, int message);
+void do_cmd_save_screen(player_type *creature_ptr);
+void do_cmd_load_screen(void);
#include "cmd/cmd-diary.h"
#include "cmd/cmd-draw.h"
#include "cmd/cmd-dump.h"
+#include "cmd/cmd-process-screen.h"
#include "cmd/cmd-eat.h"
#include "cmd/cmd-help.h"
#include "cmd/cmd-hissatsu.h"
#include "chuukei.h"
#include "io/write-diary.h"
-#include "cmd/cmd-dump.h"
+#include "cmd/cmd-process-screen.h"
#include "cmd/cmd-save.h"
#include "view-mainwindow.h"
#include "floor.h"
#include "cmd/cmd-help.h"
#include "cmd/cmd-item.h"
#include "cmd/cmd-macro.h"
+#include "cmd/cmd-process-screen.h"
#include "cmd/cmd-smith.h"
#include "cmd/cmd-visuals.h"
#include "cmd/cmd-zapwand.h"
#include "avatar.h"
#include "market/building.h"
#include "io/write-diary.h"
-#include "cmd/cmd-dump.h"
+#include "cmd/cmd-process-screen.h"
#include "market/arena-info-table.h"
#include "realm-song.h"
#include "floor.h"