Skip to content

Commit

Permalink
GLK: ALAN3: Move term.cpp code into glkio.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 6, 2019
1 parent 0f0c2c9 commit efdf25b
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 136 deletions.
1 change: 0 additions & 1 deletion engines/glk/alan3/exe.cpp
Expand Up @@ -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"
Expand Down
39 changes: 38 additions & 1 deletion engines/glk/alan3/glkio.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions engines/glk/alan3/glkio.h
Expand Up @@ -24,13 +24,15 @@
#define GLK_ALAN3_GLKIO

#include "glk/alan3/alan3.h"
#include "glk/alan3/jumps.h"
#include "glk/windows.h"

namespace Glk {
namespace Alan3 {

extern winid_t glkMainWin;
extern winid_t glkStatusWin;
extern bool onStatusLine;

#undef printf
#define printf glkio_printf
Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion engines/glk/alan3/main.cpp
Expand Up @@ -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 {
Expand Down
13 changes: 12 additions & 1 deletion engines/glk/alan3/output.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions engines/glk/alan3/output.h
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion engines/glk/alan3/parse.cpp
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion engines/glk/alan3/readline.cpp
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion engines/glk/alan3/scan.cpp
Expand Up @@ -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 {
Expand Down
85 changes: 0 additions & 85 deletions engines/glk/alan3/term.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions engines/glk/alan3/term.h

This file was deleted.

1 change: 0 additions & 1 deletion engines/glk/module.mk
Expand Up @@ -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 \
Expand Down

0 comments on commit efdf25b

Please sign in to comment.