From 6991960a8b0bacc87c2c5183c2098e606bf5d72d Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Wed, 25 Jun 2014 19:12:26 +0200 Subject: Remove cmovie support --- src/cave.cc | 2 +- src/cmovie.cc | 444 --------------------------------------------------------- src/dungeon.cc | 16 --- src/externs.h | 7 - src/util.cc | 12 +- src/z-term.c | 88 ------------ src/z-term.h | 6 - 7 files changed, 3 insertions(+), 572 deletions(-) (limited to 'src') diff --git a/src/cave.cc b/src/cave.cc index a0b8c7fc..bb883d26 100644 --- a/src/cave.cc +++ b/src/cave.cc @@ -1519,7 +1519,7 @@ void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp, /* - * Special version of map_info, for use by cmovie and HTML converter + * Special version of map_info, for use by HTML converter * to obtain pure-ASCII image of dungeon map */ void map_info_default(int y, int x, byte *ap, char *cp) diff --git a/src/cmovie.cc b/src/cmovie.cc index 85db2a32..b6cb4d05 100644 --- a/src/cmovie.cc +++ b/src/cmovie.cc @@ -4,408 +4,6 @@ #include "angband.h" -/* - * Play a given cmovie - */ -s16b do_play_cmovie(cptr cmov_file) -{ - FILE *fff; - - int y, line = 0, x; - int delay; - - char *s; - - char buf[1024]; - char cbuf[90]; - char ch; - - char mode = 0; - - - /* Cmovie files are moved to the user directory on the multiuser systems */ - - /* Build the filename */ - path_build(buf, 1024, ANGBAND_DIR_CMOV, cmov_file); - - /* File type is "TEXT" */ - FILE_TYPE(FILE_TYPE_TEXT); - - /* Read the file */ - fff = my_fopen(buf, "r"); - - /* Failure */ - if (!fff) return ( -1); - - /* Save screen */ - character_icky = TRUE; - Term_save(); - Term_clear(); - - /* Give some usefull info */ - prt("While viewing the movie you can press Escape to exit, t/Space to switch between", 0, 0); - prt("fluid more and step by step mode and any other key to step a frame in step by", 1, 0); - prt("step mode.", 2, 0); - prt("You can press D to do an html screenshot of the current frame.", 3, 0); - prt("You can also use + and - to speed up/down the playing speed.", 5, 0); - prt("Press any key when ready.", 8, 0); - - inkey(); - - Term_clear(); - - line = -1; - - delay = 1; - - /* Init to white */ - for (x = 0; x < 80; x++) - { - cbuf[x] = 'w'; - } - - /* Parse */ - while (0 == my_fgets(fff, buf, 1024)) - { - /* Do not wait */ - inkey_scan = TRUE; - ch = inkey(); - - /* Stop */ - if (ch == ESCAPE) break; - - /* Change mode */ - else if (ch == 't') - { - mode = FALSE; - } - else if (ch == ' ') - { - mode = TRUE; - } - - /* Change speed */ - else if (ch == '+') - { - delay--; - if (delay < 0) delay = 0; - } - else if (ch == '-') - { - delay++; - if (delay > 5) delay = 5; - } - else if (ch == 'D') - { - do_cmd_html_dump(); - } - - line++; - - /* Skip comments and blank lines */ - if (!buf[0] || (buf[0] == '#')) continue; - - /* Verify correct "colon" format */ - if (buf[1] != ':') break; - - /* Clean screen */ - if (buf[0] == 'C') - { - Term_clear(); - - /* Next */ - continue; - } - - /* Displays a textbox */ - if (buf[0] == 'B') - { - int len = strlen(buf + 2); - - /* Clear the line */ - Term_erase(0, 0, 255); - - /* Display the message */ - c_put_str(TERM_VIOLET, "###", 0, 0); - c_put_str(TERM_ORANGE, buf + 2, 0, 3); - c_put_str(TERM_VIOLET, "###", 0, 3 + len); - c_put_str(TERM_WHITE, "(more)", 0, 6 + len); - - /* Next */ - continue; - } - - /* Wait a key */ - if (buf[0] == 'W') - { - inkey(); - - /* Next */ - continue; - } - - /* Sleep */ - if (buf[0] == 'S') - { - long msec; - - /* Scan for the values */ - if (1 != sscanf(buf + 2, "%ld:", &msec)) - { - return ( -2); - } - - if (!mode) - { - Term_xtra(TERM_XTRA_DELAY, msec); - } - else - { - bool_ stop = FALSE; - - while (TRUE) - { - ch = inkey(); - - /* Stop */ - if (ch == ESCAPE) - { - stop = TRUE; - break; - } - /* Change mode */ - else if (ch == 't') - { - mode = FALSE; - break; - } - /* Change mode */ - else if (ch == ' ') - { - if (mode) continue; - mode = TRUE; - break; - } - /* Change speed */ - else if (ch == '+') - { - delay--; - if (delay < 0) delay = 0; - } - else if (ch == '-') - { - delay++; - if (delay > 5) delay = 5; - } - else if (ch == 'D') - { - do_cmd_html_dump(); - } - else break; - } - if (stop) break; - } - - /* Next */ - continue; - } - - /* Get color for the NEXT L line */ - if (buf[0] == 'E') - { - /* Find the colon before the name */ - s = strchr(buf + 2, ':'); - - /* Verify that colon */ - if (!s) return ( -2); - - /* Nuke the colon, advance to the name */ - *s++ = '\0'; - - /* Paranoia -- require a name */ - if (!*s) return ( -2); - - /* Get the index */ - y = atoi(buf + 2); - - /* Copy */ - for (int i = 0; i < 80; i++) - { - cbuf[i] = s[i]; - } - - /* Next... */ - continue; - } - - /* Print a line */ - if (buf[0] == 'L') - { - /* Find the colon before the name */ - s = strchr(buf + 2, ':'); - - /* Verify that colon */ - if (!s) return ( -2); - - /* Nuke the colon, advance to the name */ - *s++ = '\0'; - - /* Paranoia -- require a name */ - if (!*s) return ( -2); - - /* Get the index */ - y = atoi(buf + 2); - - for (x = 0; x < 80; x++) - { - Term_putch(x, y, color_char_to_attr(cbuf[x]), s[x]); - - /* Reinit to white */ - cbuf[x] = 'w'; - } - Term_redraw_section(0, y, 79, y); - - /* Next... */ - continue; - } - - /* Update 1 char */ - if (buf[0] == 'P') - { - int x, y, a, c; - - /* Scan for the values */ - if (4 != sscanf(buf + 2, "%d:%d:%d:%d", - &x, &y, &c, &a)) - { - a = 'w'; - if (3 != sscanf(buf + 2, "%d:%d:%d", - &x, &y, &c)) return ( -2); - } - - Term_putch(x, y, color_char_to_attr(cbuf[x]), c); - Term_redraw_section(x, y, x + 1, y + 1); - - /* Next... */ - continue; - } - } - - /* Load screen */ - Term_load(); - character_icky = FALSE; - - /* Close */ - my_fclose(fff); - - return (0); -} - - -/* - * Start the recording of a cmovie - */ -void do_record_cmovie(cptr cmovie) -{ - char buf[1024]; - int fd = -1; - int y; - - - /* Build the filename */ - path_build(buf, 1024, ANGBAND_DIR_CMOV, cmovie); - - /* File type is "TEXT" */ - FILE_TYPE(FILE_TYPE_TEXT); - - /* Check for existing file */ - fd = fd_open(buf, O_RDONLY); - - /* Existing file */ - if (fd >= 0) - { - char out_val[160]; - - /* Close the file */ - (void)fd_close(fd); - - /* Build query */ - (void)sprintf(out_val, "Replace existing file %s? ", cmovie); - - /* Ask */ - if (get_check(out_val)) fd = -1; - } - - /* Be sure */ - if (!get_check("Ready to record(Press ctrl+D to enter a textual note while recording)?")) return; - - /* Open the non-existing file */ - if (fd < 0) movfile = my_fopen(buf, "w"); - - /* Invalid file */ - if (movfile == NULL) - { - msg_format("Cmovie recording failed!"); - - return; - } - - /* First thing: Record clear screen then enable the recording */ - fprintf(movfile, "# Generated by %s\n", - get_version_string()); - fprintf(movfile, "C:\n"); - last_paused = 0; - do_movies = 1; - cmovie_init_second(); - - /* Mega Hack, get the screen */ - for (y = 0; y < Term->hgt; y++) - { - cmovie_record_line(y); - } -} - - -/* - * Stop the recording - */ -void do_stop_cmovie() -{ - if (do_movies == 1) - { - do_movies = 0; - my_fclose(movfile); - } -} - - -/* - * Start a cmovie - */ -void do_start_cmovie() -{ - char name[90], rname[94]; - - - /* Should never happen */ - if (do_movies == 1) return; - - /* Default */ - sprintf(name, "%s", player_base); - - if (get_string("Cmovie name: ", name, 80)) - { - if (name[0] && (name[0] != ' ')) - { - sprintf(rname, "%s.cmv", name); - - if (get_check("Record(y), Play(n)?")) do_record_cmovie(rname); - else do_play_cmovie(rname); - } - } -} - - void cmovie_clean_line(int y, char *abuf, char *cbuf) { const byte *ap = Term->scr->a[y]; @@ -456,45 +54,3 @@ void cmovie_clean_line(int y, char *abuf, char *cbuf) abuf[x] = '\0'; cbuf[x] = '\0'; } - - -/* - * Write a record of a screen row into a cmovie file - */ -void cmovie_record_line(int y) -{ - char abuf[256]; - char cbuf[256]; - - cmovie_clean_line(y, abuf, cbuf); - - /* Write a colour record */ - fprintf(movfile, "E:%d:%.80s\n", y, abuf); - - /* Write a char record */ - fprintf(movfile, "L:%d:%.80s\n", y, cbuf); -} - - -/* - * Record a "text box" - */ -void do_cmovie_insert() -{ - char buf[81] = ""; - - /* Dont record */ - do_movies = 2; - - while (get_string("Textbox(ESC to end): ", buf, 80)) - { - fprintf(movfile, "B:%s\nW:\n", buf); - buf[0] = '\0'; - } - - /* We reinit the time as to not count the time the user needed ot enter the text */ - cmovie_init_second(); - - /* Continue recording */ - do_movies = 1; -} diff --git a/src/dungeon.cc b/src/dungeon.cc index df3b41aa..b133f7f4 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -4394,22 +4394,6 @@ static void process_command(void) break; } - /* Activate cmovie */ - case '|': - { - /* Stop ? */ - if (do_movies == 1) - { - do_stop_cmovie(); - msg_print("Cmovie recording stopped."); - } - else - { - do_start_cmovie(); - } - break; - } - /* Extended command */ case '#': { diff --git a/src/externs.h b/src/externs.h index c9219579..aba54eb5 100644 --- a/src/externs.h +++ b/src/externs.h @@ -616,14 +616,7 @@ extern int random_quest_number(void); extern int new_effect(int type, int dam, int time, int cy, int cx, int rad, s32b flags); /* cmovie.c */ -extern void cmovie_init_second(void); -extern s16b do_play_cmovie(cptr cmov_file); -extern void do_record_cmovie(cptr cmovie); -extern void do_stop_cmovie(void); -extern void do_start_cmovie(void); extern void cmovie_clean_line(int y, char *abuf, char *cbuf); -extern void cmovie_record_line(int y); -extern void do_cmovie_insert(void); /* cmd1.c */ extern void attack_special(monster_type *m_ptr, s32b special, int dam); diff --git a/src/util.cc b/src/util.cc index ccb0eea7..87cfde03 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1791,9 +1791,6 @@ static cptr inkey_next = NULL; * "signal_count" variable, and of the "character_saved" variable. * * Hack -- Note the use of "inkey_next" to allow "keymaps" to be processed. -* -* Mega-Hack -- Note the use of "inkey_hack" to allow the "Borg" to steal -* control of the keyboard from the user. */ char inkey(void) { @@ -1943,13 +1940,8 @@ char inkey(void) /* Strip this key */ ch = 0; - if (!do_movies) - /* Do an html dump */ - do_cmd_html_dump(); - else - /* Do a text box in the cmovie */ - do_cmovie_insert(); - + /* Do an html dump */ + do_cmd_html_dump(); /* Continue */ continue; diff --git a/src/z-term.c b/src/z-term.c index 4e89ffb7..c8d30941 100644 --- a/src/z-term.c +++ b/src/z-term.c @@ -271,19 +271,6 @@ */ term *Term = NULL; -/* File handler for saving movies */ -FILE *movfile = NULL; -int do_movies = 0; /* Later set this as a global */ -/* set to 1 if you want movies made */ -time_t lastc; -int last_paused = 0; -int cmovie_get_msecond(void); - -/* Record cmovies with millisecond frame rate */ -long cmov_last_time_msec; -long cmov_delta_time_msec; - - /*** Local routines ***/ @@ -1307,16 +1294,6 @@ errr Term_fresh(void) byte na = Term->attr_blank; char nc = Term->char_blank; - if ((do_movies == 1) && IN_MAINWINDOW) - { - if (!cmovie_get_msecond()) - { - fprintf(movfile, "S:%ld:\n", cmov_delta_time_msec); - } - fprintf(movfile, "C:\n"); - last_paused = 0; - } - /* Physically erase the entire window */ Term_xtra(TERM_XTRA_CLEAR, 0); @@ -1460,13 +1437,6 @@ errr Term_fresh(void) /* Flush each "modified" row */ if (x1 <= x2) { - if ((do_movies == 1) && IN_MAINWINDOW) - { - /* Most magic happens here */ - cmovie_record_line(y); - last_paused = 0; - } - /* Always use "Term_pict()" */ if (Term->always_pict) { @@ -1930,17 +1900,6 @@ errr Term_clear(void) */ errr Term_redraw(void) { - /* Pat */ - if ((do_movies == 1) && IN_MAINWINDOW) - { - if (!cmovie_get_msecond()) - { - fprintf(movfile, "S:%ld:\n", cmov_delta_time_msec); - } - last_paused = 1; - } - /* Endpat */ - /* Force "total erase" */ Term->total_erase = TRUE; @@ -2156,14 +2115,6 @@ errr Term_inkey(char *ch, bool_ wait, bool_ take) Term_xtra(TERM_XTRA_BORED, 0); } - /* PatN */ - if ((do_movies == 1) && (last_paused == 0) && (!cmovie_get_msecond())) - { - fprintf(movfile, "S:%ld:\n", cmov_delta_time_msec); - last_paused = 1; - } - /* PatNEnd */ - /* Wait */ if (wait) { @@ -2735,42 +2686,3 @@ errr term_init(term *t, int w, int h, int k) /* Success */ return (0); } - -/* - * Determine if we are called in the same second as the last time? - * This *ASSUMES* that time_t is seconds past something. Is this portable? - */ -int cmovie_get_msecond(void) -{ -#ifndef USE_PRECISE_CMOVIE - /* Not very precise, but portable */ - time_t thisc; - - thisc = time(NULL); - - cmov_delta_time_msec = 300; - - if (thisc == lastc) - { - return 1; - } - return 0; -#else /* Very precise but needs main-foo.c to define TERM_XTRA_GET_DELAY */ -Term_xtra(TERM_XTRA_GET_DELAY, 0); - - cmov_delta_time_msec = Term_xtra_long - cmov_last_time_msec; - cmov_last_time_msec = Term_xtra_long; - return 0; -#endif -} - -void cmovie_init_second() -{ -#ifndef USE_PRECISE_CMOVIE - /* Not very precise, but portable */ - cmov_last_time_msec = 0; -#else /* Precise but need main-foo.c to have TERM_XTRA_GET_DELAY */ - Term_xtra(TERM_XTRA_GET_DELAY, 0); - cmov_last_time_msec = Term_xtra_long; -#endif -} diff --git a/src/z-term.h b/src/z-term.h index 31e5b308..2e27173f 100644 --- a/src/z-term.h +++ b/src/z-term.h @@ -17,8 +17,6 @@ extern "C" { #include "h-basic.h" -#define IN_MAINWINDOW (Term == term_screen) - /* * A term_win is a "window" for a Term * @@ -280,10 +278,6 @@ struct term /**** Available Variables ****/ extern term *Term; -extern FILE *movfile; -extern int do_movies; -extern int last_paused; - /**** Available Functions ****/ -- cgit v1.2.3