diff options
author | Paul Gilbert | 2019-07-03 21:56:09 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-07-06 15:27:09 -0700 |
commit | efdf25b3d28113b01e18ef0c69221194a1100e9e (patch) | |
tree | b602ca9f6b29b4a4ecd4eb4047e5fd1163353047 | |
parent | 0f0c2c97e13d01cd77ba9fb489aec77398ce6945 (diff) | |
download | scummvm-rg350-efdf25b3d28113b01e18ef0c69221194a1100e9e.tar.gz scummvm-rg350-efdf25b3d28113b01e18ef0c69221194a1100e9e.tar.bz2 scummvm-rg350-efdf25b3d28113b01e18ef0c69221194a1100e9e.zip |
GLK: ALAN3: Move term.cpp code into glkio.cpp
-rw-r--r-- | engines/glk/alan3/exe.cpp | 1 | ||||
-rw-r--r-- | engines/glk/alan3/glkio.cpp | 39 | ||||
-rw-r--r-- | engines/glk/alan3/glkio.h | 4 | ||||
-rw-r--r-- | engines/glk/alan3/main.cpp | 1 | ||||
-rw-r--r-- | engines/glk/alan3/output.cpp | 13 | ||||
-rw-r--r-- | engines/glk/alan3/output.h | 1 | ||||
-rw-r--r-- | engines/glk/alan3/parse.cpp | 1 | ||||
-rw-r--r-- | engines/glk/alan3/readline.cpp | 1 | ||||
-rw-r--r-- | engines/glk/alan3/scan.cpp | 1 | ||||
-rw-r--r-- | engines/glk/alan3/term.cpp | 85 | ||||
-rw-r--r-- | engines/glk/alan3/term.h | 43 | ||||
-rw-r--r-- | engines/glk/module.mk | 1 |
12 files changed, 55 insertions, 136 deletions
diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp index f30ebc2c6b..e2555f505c 100644 --- a/engines/glk/alan3/exe.cpp +++ b/engines/glk/alan3/exe.cpp @@ -41,7 +41,6 @@ #include "glk/alan3/state.h" #include "glk/alan3/syserr.h" #include "glk/alan3/sysdep.h" -#include "glk/alan3/term.h" #include "glk/alan3/types.h" #include "glk/alan3/utils.h" #include "glk/alan3/word.h" diff --git a/engines/glk/alan3/glkio.cpp b/engines/glk/alan3/glkio.cpp index 6cc264f30a..f36c396ed0 100644 --- a/engines/glk/alan3/glkio.cpp +++ b/engines/glk/alan3/glkio.cpp @@ -20,15 +20,19 @@ * */ -#include "glk/alan3/alan3.h" #include "glk/alan3/glkio.h" #include "glk/alan3/acode.h" +#include "glk/alan3/current.h" +#include "glk/alan3/instance.h" +#include "glk/alan3/options.h" +#include "glk/alan3/output.h" namespace Glk { namespace Alan3 { winid_t glkMainWin; winid_t glkStatusWin; +bool onStatusLine; void glkio_printf(const char *fmt, ...) { // If there's a savegame being loaded from the launcher, ignore any text out @@ -97,5 +101,38 @@ void setStyle(int style) { } } +void statusline(CONTEXT) { + uint32 glkWidth; + char line[100]; + int pcol = col; + + if (!statusLineOption) return; + if (glkStatusWin == NULL) + return; + + g_vm->glk_set_window(glkStatusWin); + g_vm->glk_window_clear(glkStatusWin); + g_vm->glk_window_get_size(glkStatusWin, &glkWidth, NULL); + + onStatusLine = TRUE; + col = 1; + g_vm->glk_window_move_cursor(glkStatusWin, 1, 0); + CALL1(sayInstance, where(HERO, /*TRUE*/ TRANSITIVE)) + + // TODO Add status message1 & 2 as author customizable messages + if (header->maximumScore > 0) + sprintf(line, "Score %d(%d)/%d moves", current.score, (int)header->maximumScore, current.tick); + else + sprintf(line, "%d moves", current.tick); + g_vm->glk_window_move_cursor(glkStatusWin, glkWidth - strlen(line) - 1, 0); + g_vm->glk_put_string(line); + needSpace = FALSE; + + col = pcol; + onStatusLine = FALSE; + + g_vm->glk_set_window(glkMainWin); +} + } // End of namespace Alan3 } // End of namespace Glk diff --git a/engines/glk/alan3/glkio.h b/engines/glk/alan3/glkio.h index 32ce758d01..b0629ce8f8 100644 --- a/engines/glk/alan3/glkio.h +++ b/engines/glk/alan3/glkio.h @@ -24,6 +24,7 @@ #define GLK_ALAN3_GLKIO #include "glk/alan3/alan3.h" +#include "glk/alan3/jumps.h" #include "glk/windows.h" namespace Glk { @@ -31,6 +32,7 @@ namespace Alan3 { extern winid_t glkMainWin; extern winid_t glkStatusWin; +extern bool onStatusLine; #undef printf #define printf glkio_printf @@ -42,6 +44,8 @@ extern void playSound(int sound); extern void setStyle(int style); +extern void statusline(CONTEXT); + } // End of namespace Alan3 } // End of namespace Glk diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp index c32693ef8b..de65b095d3 100644 --- a/engines/glk/alan3/main.cpp +++ b/engines/glk/alan3/main.cpp @@ -51,7 +51,6 @@ #include "glk/alan3/state.h" #include "glk/alan3/syserr.h" #include "glk/alan3/syntax.h" -#include "glk/alan3/term.h" #include "glk/alan3/utils.h" namespace Glk { diff --git a/engines/glk/alan3/output.cpp b/engines/glk/alan3/output.cpp index aa699c960c..15d4ff4f04 100644 --- a/engines/glk/alan3/output.cpp +++ b/engines/glk/alan3/output.cpp @@ -27,7 +27,6 @@ #include "glk/alan3/memory.h" #include "glk/alan3/word.h" #include "glk/alan3/lists.h" -#include "glk/alan3/term.h" #include "glk/alan3/syserr.h" #include "glk/alan3/dictionary.h" #include "glk/alan3/current.h" @@ -55,6 +54,18 @@ strid_t logFile; /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/* + getPageSize() + + Try to get the current page size from the system, else use the ones + from the header. + + */ +void getPageSize(void) { + pageLength = 0; + pageWidth = 0; +} + /*----------------------------------------------------------------------*/ static int updateColumn(int currentColumn, const char *string) { diff --git a/engines/glk/alan3/output.h b/engines/glk/alan3/output.h index 6f52cfccf6..fc344909de 100644 --- a/engines/glk/alan3/output.h +++ b/engines/glk/alan3/output.h @@ -42,6 +42,7 @@ extern bool skipSpace; extern strid_t logFile; /* FUNCTIONS */ +extern void getPageSize(); extern void setSubHeaderStyle(void); extern void setNormalStyle(void); extern void newline(void); diff --git a/engines/glk/alan3/parse.cpp b/engines/glk/alan3/parse.cpp index 6618e9dde9..efa5464c33 100644 --- a/engines/glk/alan3/parse.cpp +++ b/engines/glk/alan3/parse.cpp @@ -43,7 +43,6 @@ #include "glk/alan3/syntax.h" #include "glk/alan3/scan.h" #include "glk/alan3/syserr.h" -#include "glk/alan3/term.h" #include "glk/alan3/utils.h" #include "glk/alan3/word.h" diff --git a/engines/glk/alan3/readline.cpp b/engines/glk/alan3/readline.cpp index 832f00d87e..7be20c7b9c 100644 --- a/engines/glk/alan3/readline.cpp +++ b/engines/glk/alan3/readline.cpp @@ -24,7 +24,6 @@ #include "glk/alan3/sysdep.h" #include "glk/alan3/output.h" -#include "glk/alan3/term.h" #include "glk/alan3/exe.h" #include "glk/alan3/save.h" #include "glk/alan3/location.h" diff --git a/engines/glk/alan3/scan.cpp b/engines/glk/alan3/scan.cpp index 6d1e7d408d..6cc1ef9076 100644 --- a/engines/glk/alan3/scan.cpp +++ b/engines/glk/alan3/scan.cpp @@ -35,7 +35,6 @@ #include "glk/alan3/params.h" #include "glk/alan3/readline.h" #include "glk/alan3/syserr.h" -#include "glk/alan3/term.h" #include "glk/alan3/word.h" namespace Glk { diff --git a/engines/glk/alan3/term.cpp b/engines/glk/alan3/term.cpp deleted file mode 100644 index 37f709e377..0000000000 --- a/engines/glk/alan3/term.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "glk/alan3/current.h" -#include "glk/alan3/glkio.h" -#include "glk/alan3/instance.h" -#include "glk/alan3/memory.h" -#include "glk/alan3/output.h" -#include "glk/alan3/options.h" -#include "glk/alan3/sysdep.h" - -namespace Glk { -namespace Alan3 { - -/* PUBLIC DATA */ -bool onStatusLine = FALSE; /* To know if where printing the status line or not */ - -/*====================================================================== - - getPageSize() - - Try to get the current page size from the system, else use the ones - from the header. - - */ -void getPageSize(void) { - pageLength = 0; - pageWidth = 0; -} - -/*======================================================================*/ -void statusline(CONTEXT) { - uint32 glkWidth; - char line[100]; - int pcol = col; - - if (!statusLineOption) return; - if (glkStatusWin == NULL) - return; - - g_vm->glk_set_window(glkStatusWin); - g_vm->glk_window_clear(glkStatusWin); - g_vm->glk_window_get_size(glkStatusWin, &glkWidth, NULL); - - onStatusLine = TRUE; - col = 1; - g_vm->glk_window_move_cursor(glkStatusWin, 1, 0); - CALL1(sayInstance, where(HERO, /*TRUE*/ TRANSITIVE)) - - // TODO Add status message1 & 2 as author customizable messages - if (header->maximumScore > 0) - sprintf(line, "Score %d(%d)/%d moves", current.score, (int)header->maximumScore, current.tick); - else - sprintf(line, "%d moves", current.tick); - g_vm->glk_window_move_cursor(glkStatusWin, glkWidth - strlen(line) - 1, 0); - g_vm->glk_put_string(line); - needSpace = FALSE; - - col = pcol; - onStatusLine = FALSE; - - g_vm->glk_set_window(glkMainWin); -} - -} // End of namespace Alan3 -} // End of namespace Glk diff --git a/engines/glk/alan3/term.h b/engines/glk/alan3/term.h deleted file mode 100644 index 1f6dadc6b6..0000000000 --- a/engines/glk/alan3/term.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GLK_ALAN3_TERM -#define GLK_ALAN3_TERM - -/* Header file for terminal functions in ARUN, the Alan interpreter */ - -#include "glk/alan3/jumps.h" - -namespace Glk { -namespace Alan3 { - -/* DATA */ -extern bool onStatusLine; - -/* FUNCTIONS */ -extern void getPageSize(); -extern void statusline(CONTEXT); - -} // End of namespace Alan3 -} // End of namespace Glk - -#endif diff --git a/engines/glk/module.mk b/engines/glk/module.mk index 11b44fe296..3d3c62b083 100644 --- a/engines/glk/module.mk +++ b/engines/glk/module.mk @@ -96,7 +96,6 @@ MODULE_OBJS := \ alan3/syntax.o \ alan3/sysdep.o \ alan3/syserr.o \ - alan3/term.o \ alan3/types.o \ alan3/utils.o \ alan3/word.o \ |