aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
Diffstat (limited to 'saga')
-rw-r--r--saga/actionmap.cpp8
-rw-r--r--saga/actor.cpp10
-rw-r--r--saga/animation.cpp6
-rw-r--r--saga/console.cpp231
-rw-r--r--saga/console.h69
-rw-r--r--saga/console_mod.h53
-rw-r--r--saga/cvar.cpp20
-rw-r--r--saga/events.cpp6
-rw-r--r--saga/input.cpp18
-rw-r--r--saga/interface.cpp6
-rw-r--r--saga/objectmap.cpp8
-rw-r--r--saga/render.cpp4
-rw-r--r--saga/saga.cpp18
-rw-r--r--saga/saga.h2
-rw-r--r--saga/scene.cpp30
-rw-r--r--saga/script.cpp12
-rw-r--r--saga/sdebug.cpp1
-rw-r--r--saga/sfuncs.cpp22
-rw-r--r--saga/sstack.cpp4
-rw-r--r--saga/sthread.cpp20
20 files changed, 259 insertions, 289 deletions
diff --git a/saga/actionmap.cpp b/saga/actionmap.cpp
index 38611133fa..12469508c3 100644
--- a/saga/actionmap.cpp
+++ b/saga/actionmap.cpp
@@ -26,7 +26,7 @@
#include "saga/cvar_mod.h"
#include "saga/gfx.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/actionmap.h"
@@ -183,10 +183,10 @@ void ActionMap::actionInfo(int argc, char *argv[]) {
return;
}
- CON_Print("%d exits loaded.\n", _n_exits);
+ _vm->_console->print("%d exits loaded.\n", _n_exits);
for (i = 0; i < _n_exits; i++) {
- CON_Print ("Action %d: Exit to: %d; Pts: %d; Unk0: %d Unk2: %d Scr_N: %d",
+ _vm->_console->print ("Action %d: Exit to: %d; Pts: %d; Unk0: %d Unk2: %d Scr_N: %d",
i, _exits_tbl[i].exit_scene,
_exits_tbl[i].pt_count,
_exits_tbl[i].unknown00,
@@ -196,7 +196,7 @@ void ActionMap::actionInfo(int argc, char *argv[]) {
for (pt_i = 0; pt_i < _exits_tbl[i].pt_count; pt_i++) {
pt = &_exits_tbl[i].pt_tbl[pt_i];
- CON_Print(" pt: %d (%d, %d)", pt_i, pt->x, pt->y);
+ _vm->_console->print(" pt: %d (%d, %d)", pt_i, pt->x, pt->y);
}
}
}
diff --git a/saga/actor.cpp b/saga/actor.cpp
index ae4d4dc534..69f29393bd 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -27,7 +27,7 @@
#include "saga/game_mod.h"
#include "saga/cvar_mod.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/rscfile_mod.h"
#include "saga/script_mod.h"
#include "saga/sndres.h"
@@ -1139,26 +1139,24 @@ static void CF_actor_setact(int argc, char *argv[], void *refCon) {
actor = ((Actor *)refCon)->lookupActor(index);
if (actor == NULL) {
- CON_Print("Invalid actor index.");
+ _vm->_console->print("Invalid actor index.");
return;
}
if ((action_n < 0) || (action_n >= actor->action_ct)) {
- CON_Print("Invalid action number.");
+ _vm->_console->print("Invalid action number.");
return;
}
- CON_Print("Action frame counts: %d %d %d %d.",
+ _vm->_console->print("Action frame counts: %d %d %d %d.",
actor->act_tbl[action_n].dir[0].frame_count,
actor->act_tbl[action_n].dir[1].frame_count,
actor->act_tbl[action_n].dir[2].frame_count,
actor->act_tbl[action_n].dir[3].frame_count);
((Actor *)refCon)->setAction(index, action_n, ACTION_LOOP);
-
- return;
}
} // End of namespace Saga
diff --git a/saga/animation.cpp b/saga/animation.cpp
index dbae4dc4d9..d1a80aa8bd 100644
--- a/saga/animation.cpp
+++ b/saga/animation.cpp
@@ -26,7 +26,7 @@
#include "saga/gfx.h"
#include "saga/cvar_mod.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/game_mod.h"
#include "saga/events_mod.h"
#include "saga/render.h"
@@ -905,14 +905,14 @@ void Anim::animInfo(int argc, char *argv[]) {
anim_ct = _anim_count;
- CON_Print("There are %d animations loaded:", anim_ct);
+ _vm->_console->print("There are %d animations loaded:", anim_ct);
for (idx = 0, i = 0; i < anim_ct; idx++, i++) {
while (_anim_tbl[idx] == NULL) {
idx++;
}
- CON_Print("%02d: Frames: %u Flags: %u", i, _anim_tbl[idx]->n_frames, _anim_tbl[idx]->flags);
+ _vm->_console->print("%02d: Frames: %u Flags: %u", i, _anim_tbl[idx]->n_frames, _anim_tbl[idx]->flags);
}
}
diff --git a/saga/console.cpp b/saga/console.cpp
index 000e9cf246..d082a7ef70 100644
--- a/saga/console.cpp
+++ b/saga/console.cpp
@@ -29,55 +29,48 @@
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
-#include "saga/console_mod.h"
#include "saga/console.h"
namespace Saga {
-static R_CONSOLEINFO ConInfo = {
- 0,
- R_CON_DEFAULTPOS,
- R_CON_DEFAULTLINES,
- R_CON_DEFAULTCMDS,
- 0,
- 0,
- 0,
- 0,
- 0,
- "",
- 0
-};
-
-static R_CON_SCROLLBACK ConScrollback;
-static R_CON_SCROLLBACK ConHistory;
-
-static int CV_ConResize = R_CON_DEFAULTPOS;
-static int CV_ConDroptime = R_CON_DROPTIME;
-
-int CON_Register() {
- CVAR_Register_I(&CV_ConResize, "con_h", NULL, R_CVAR_NONE, 12, R_CON_DEFAULTPOS);
- CVAR_Register_I(&CV_ConDroptime, "con_droptime", NULL, R_CVAR_NONE, 0, 5000);
- CVAR_Register_I(&ConInfo.line_max, "con_lines", NULL, R_CVAR_NONE, 5, 5000);
+int Console::reg() {
+ CVAR_Register_I(&_resize, "con_h", NULL, R_CVAR_NONE, 12, R_CON_DEFAULTPOS);
+ CVAR_Register_I(&_droptime, "con_droptime", NULL, R_CVAR_NONE, 0, 5000);
+ CVAR_Register_I(&_lineMax, "con_lines", NULL, R_CVAR_NONE, 5, 5000);
return R_SUCCESS;
}
-int CON_Init() {
- return R_SUCCESS;
+Console::Console(SagaEngine *vm) : _vm(vm) {
+ memset(&_scrollback, 0, sizeof(_scrollback));
+ memset(&_history, 0, sizeof(_history));
+
+ _resize = R_CON_DEFAULTPOS;
+ _droptime = R_CON_DROPTIME;
+
+ _active = false;
+ _yMax = R_CON_DEFAULTPOS;
+ _lineMax = R_CON_DEFAULTLINES;
+ _histMax = R_CON_DEFAULTCMDS;
+ _histPos = 0;
+ _linePos = 0;
+ _yPos = 0;
+ _prompt = NULL;
+ _promptW = 0;
+ *_inputBuf = 0;
+ _inputPos = 0;
}
-int CON_Shutdown() {
- debug(0, "CON_Shutdown(): Deleting console scrollback and command history.");
-
- CON_DeleteScroll(&ConScrollback);
- CON_DeleteScroll(&ConHistory);
+Console::~Console() {
+ debug(0, "~Console(): Deleting console scrollback and command history.");
- return R_SUCCESS;
+ deleteScroll(&_scrollback);
+ deleteScroll(&_history);
}
-int CON_Activate() {
+int Console::activate() {
R_EVENT con_event;
- if (ConInfo.active) {
+ if (_active) {
return R_FAILURE;
}
@@ -85,19 +78,19 @@ int CON_Activate() {
con_event.code = R_CONSOLE_EVENT | R_NODESTROY;
con_event.op = EVENT_ACTIVATE;
con_event.time = 0;
- con_event.duration = CV_ConDroptime;
+ con_event.duration = _droptime;
EVENT_Queue(&con_event);
- ConInfo.active = 1;
+ _active = true;
return R_SUCCESS;
}
-int CON_Deactivate() {
+int Console::deactivate() {
R_EVENT con_event;
- if (!ConInfo.active) {
+ if (!_active) {
return R_FAILURE;
}
@@ -105,23 +98,23 @@ int CON_Deactivate() {
con_event.code = R_CONSOLE_EVENT | R_NODESTROY;
con_event.op = EVENT_DEACTIVATE;
con_event.time = 0;
- con_event.duration = CV_ConDroptime;
+ con_event.duration = _droptime;
EVENT_Queue(&con_event);
return R_SUCCESS;
}
-int CON_IsActive(void) {
- return ConInfo.active;
+bool Console::isActive(void) {
+ return _active;
}
// Responsible for processing character input to the console and maintaining
// the console input buffer.
// Input buffer is processed by EXPR_Parse on enter.
// High ASCII characters are ignored.
-int CON_Type(int in_char) {
- int input_pos = ConInfo.input_pos;
+int Console::type(int in_char) {
+ int input_pos = _inputPos;
const char *expr;
int expr_len;
int result;
@@ -133,7 +126,7 @@ int CON_Type(int in_char) {
const char *expr_err;
const char *err_str;
- if (ConInfo.y_pos != ConInfo.y_max) {
+ if (_yPos != _yMax) {
// Ignore keypress until console fully down
return R_SUCCESS;
}
@@ -145,17 +138,17 @@ int CON_Type(int in_char) {
switch (in_char) {
case '\r':
- expr = ConInfo.input_buf;
- CON_Print("> %s", ConInfo.input_buf);
- expr_len = strlen(ConInfo.input_buf);
+ expr = _inputBuf;
+ _vm->_console->print("> %s", _inputBuf);
+ expr_len = strlen(_inputBuf);
result = EXPR_Parse(&expr, &expr_len, &con_cvar, &rvalue);
- CON_AddLine(&ConHistory, ConInfo.hist_max, ConInfo.input_buf);
- memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
- ConInfo.input_pos = 0;
- ConInfo.hist_pos = 0;
+ _vm->_console->addLine(&_history, _histMax, _inputBuf);
+ memset(_inputBuf, 0, R_CON_INPUTBUF_LEN);
+ _inputPos = 0;
+ _histPos = 0;
if (result != R_SUCCESS) {
EXPR_GetError(&expr_err);
- CON_Print("Parse error: %s", expr_err);
+ _vm->_console->print("Parse error: %s", expr_err);
break;
}
@@ -168,20 +161,20 @@ int CON_Type(int in_char) {
CVAR_Exec(con_cvar, rvalue);
} else if (CVAR_SetValue(con_cvar, rvalue) != R_SUCCESS) {
CVAR_GetError(&err_str);
- CON_Print("Illegal assignment: %s.", err_str);
+ _vm->_console->print("Illegal assignment: %s.", err_str);
}
break;
case '\b':
- ConInfo.input_buf[input_pos] = 0;
+ _inputBuf[input_pos] = 0;
if (input_pos > 0) {
- ConInfo.input_pos--;
- ConInfo.input_buf[ConInfo.input_pos] = 0;
+ _inputPos--;
+ _inputBuf[_inputPos] = 0;
}
break;
default:
if (input_pos < R_CON_INPUTBUF_LEN) {
- ConInfo.input_buf[input_pos] = (char)in_char;
- ConInfo.input_pos++;
+ _inputBuf[input_pos] = (char)in_char;
+ _inputPos++;
}
break;
}
@@ -192,7 +185,7 @@ int CON_Type(int in_char) {
return R_SUCCESS;
}
-int CON_Draw(R_SURFACE *ds) {
+int Console::draw(R_SURFACE *ds) {
int line_y;
R_CONSOLE_LINE *walk_ptr;
R_CONSOLE_LINE *start_ptr;
@@ -201,32 +194,32 @@ int CON_Draw(R_SURFACE *ds) {
R_RECT fill_rect;
int i;
- if (!ConInfo.active) {
+ if (!_active) {
return R_FAILURE;
}
- if (CV_ConResize != ConInfo.y_max) {
- ConInfo.y_max = CV_ConResize;
- ConInfo.y_pos = CV_ConResize;
+ if (_resize != _yMax) {
+ _yMax = _resize;
+ _yPos = _resize;
}
fill_rect.top = 0;
fill_rect.left = 0;
- fill_rect.bottom = ConInfo.y_pos;
+ fill_rect.bottom = _yPos;
fill_rect.right = ds->buf_w - 1;
_vm->_gfx->drawRect(ds, &fill_rect, _vm->_gfx->matchColor(R_CONSOLE_BGCOLOR));
txt_fgcolor = _vm->_gfx->matchColor(R_CONSOLE_TXTCOLOR);
txt_shcolor = _vm->_gfx->matchColor(R_CONSOLE_TXTSHADOW);
- _vm->_font->draw(SMALL_FONT_ID, ds, ">", 1, 2, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
- _vm->_font->draw(SMALL_FONT_ID, ds, ConInfo.input_buf, strlen(ConInfo.input_buf),
- 10, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
+ _vm->_font->draw(SMALL_FONT_ID, ds, ">", 1, 2, _yPos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
+ _vm->_font->draw(SMALL_FONT_ID, ds, _inputBuf, strlen(_inputBuf),
+ 10, _yPos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
- line_y = ConInfo.y_pos - (R_CON_INPUT_H + R_CON_LINE_H);
- start_ptr = ConScrollback.head;
+ line_y = _yPos - (R_CON_INPUT_H + R_CON_LINE_H);
+ start_ptr = _scrollback.head;
- for (i = 0; i < ConInfo.line_pos; i++) {
+ for (i = 0; i < _linePos; i++) {
if (start_ptr->next) {
start_ptr = start_ptr->next;
} else {
@@ -244,33 +237,33 @@ int CON_Draw(R_SURFACE *ds) {
return R_SUCCESS;
}
-int CON_Print(const char *fmt_str, ...) {
+int Console::print(const char *fmt_str, ...) {
char vsstr_p[R_CON_PRINTFLIMIT + 1];
va_list argptr;
int ret_val;
va_start(argptr, fmt_str);
ret_val = vsprintf(vsstr_p, fmt_str, argptr);
- CON_AddLine(&ConScrollback, ConInfo.line_max, vsstr_p);
+ _vm->_console->addLine(&_scrollback, _lineMax, vsstr_p);
va_end(argptr);
- ConInfo.line_pos = 0;
+ _linePos = 0;
return ret_val;
}
-int CON_CmdUp() {
- R_CONSOLE_LINE *start_ptr = ConHistory.head;
+int Console::cmdUp() {
+ R_CONSOLE_LINE *start_ptr = _history.head;
int i;
if (!start_ptr) {
return R_SUCCESS;
}
- if (ConInfo.hist_pos < ConHistory.lines) {
- ConInfo.hist_pos++;
+ if (_histPos < _history.lines) {
+ _histPos++;
}
- for (i = 1; (i < ConInfo.hist_pos); i++) {
+ for (i = 1; (i < _histPos); i++) {
if (start_ptr->next) {
start_ptr = start_ptr->next;
} else {
@@ -278,32 +271,32 @@ int CON_CmdUp() {
}
}
- memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
- strcpy(ConInfo.input_buf, start_ptr->str_p);
- ConInfo.input_pos = start_ptr->str_len - 1;
+ memset(_inputBuf, 0, R_CON_INPUTBUF_LEN);
+ strcpy(_inputBuf, start_ptr->str_p);
+ _inputPos = start_ptr->str_len - 1;
- debug(0, "History pos: %d/%d", ConInfo.hist_pos, ConHistory.lines);
+ debug(0, "History pos: %d/%d", _histPos, _history.lines);
return R_SUCCESS;
}
-int CON_CmdDown(void) {
- R_CONSOLE_LINE *start_ptr = ConHistory.head;
+int Console::cmdDown(void) {
+ R_CONSOLE_LINE *start_ptr = _history.head;
int i;
- if (ConInfo.hist_pos == 1) {
+ if (_histPos == 1) {
debug(0, "Erased input buffer.");
- memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
- ConInfo.input_pos = 0;
- ConInfo.hist_pos--;
+ memset(_inputBuf, 0, R_CON_INPUTBUF_LEN);
+ _inputPos = 0;
+ _histPos--;
return R_SUCCESS;
- } else if (ConInfo.hist_pos) {
- ConInfo.hist_pos--;
+ } else if (_histPos) {
+ _histPos--;
} else {
return R_SUCCESS;
}
- for (i = 1; i < ConInfo.hist_pos; i++) {
+ for (i = 1; i < _histPos; i++) {
if (start_ptr->next) {
start_ptr = start_ptr->next;
} else {
@@ -311,41 +304,41 @@ int CON_CmdDown(void) {
}
}
- memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
- strcpy(ConInfo.input_buf, start_ptr->str_p);
- ConInfo.input_pos = start_ptr->str_len - 1;
+ memset(_inputBuf, 0, R_CON_INPUTBUF_LEN);
+ strcpy(_inputBuf, start_ptr->str_p);
+ _inputPos = start_ptr->str_len - 1;
- debug(0, "History pos: %d/%d", ConInfo.hist_pos, ConHistory.lines);
+ debug(0, "History pos: %d/%d", _histPos, _history.lines);
return R_SUCCESS;
}
-int CON_PageUp() {
+int Console::pageUp() {
int n_lines;
- n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H;
+ n_lines = (_yMax - R_CON_INPUT_H) / R_CON_LINE_H;
- if (ConInfo.line_pos < (ConScrollback.lines - n_lines)) {
- ConInfo.line_pos += n_lines;
+ if (_linePos < (_scrollback.lines - n_lines)) {
+ _linePos += n_lines;
}
- debug(0, "Line pos: %d", ConInfo.line_pos);
+ debug(0, "Line pos: %d", _linePos);
return R_SUCCESS;
}
-int CON_PageDown() {
+int Console::pageDown() {
int n_lines;
- n_lines = (ConInfo.y_max - R_CON_INPUT_H) / R_CON_LINE_H;
+ n_lines = (_yMax - R_CON_INPUT_H) / R_CON_LINE_H;
- if (ConInfo.line_pos > n_lines) {
- ConInfo.line_pos -= n_lines;
+ if (_linePos > n_lines) {
+ _linePos -= n_lines;
} else {
- ConInfo.line_pos = 0;
+ _linePos = 0;
}
return R_SUCCESS;
}
-int CON_DropConsole(double percent) {
+int Console::dropConsole(double percent) {
R_SURFACE *back_buf;
if (percent > 1.0) {
@@ -353,28 +346,28 @@ int CON_DropConsole(double percent) {
}
back_buf = _vm->_gfx->getBackBuffer();
- CON_SetDropPos(percent);
- CON_Draw(back_buf);
+ _vm->_console->setDropPos(percent);
+ _vm->_console->draw(back_buf);
return R_SUCCESS;
}
-int CON_RaiseConsole(double percent) {
+int Console::raiseConsole(double percent) {
R_SURFACE *back_buf;
if (percent >= 1.0) {
percent = 1.0;
- ConInfo.active = 0;
+ _active = false;
}
back_buf = _vm->_gfx->getBackBuffer();
- CON_SetDropPos(1.0 - percent);
- CON_Draw(back_buf);
+ _vm->_console->setDropPos(1.0 - percent);
+ _vm->_console->draw(back_buf);
return R_SUCCESS;
}
-static int CON_SetDropPos(double percent) {
+int Console::setDropPos(double percent) {
double exp_percent;
if (percent > 1.0)
@@ -383,12 +376,12 @@ static int CON_SetDropPos(double percent) {
percent = 0.0;
exp_percent = percent * percent;
- ConInfo.y_pos = (int)(ConInfo.y_max * exp_percent);
+ _yPos = (int)(_yMax * exp_percent);
return R_SUCCESS;
}
-static int CON_AddLine(R_CON_SCROLLBACK *scroll, int line_max, const char *constr_p) {
+int Console::addLine(R_CON_SCROLLBACK *scroll, int line_max, const char *constr_p) {
int constr_len;
char *newstr_p;
R_CONSOLE_LINE *newline_p;
@@ -427,14 +420,14 @@ static int CON_AddLine(R_CON_SCROLLBACK *scroll, int line_max, const char *const
del_lines = scroll->lines - line_max;
for (i = 0; i < del_lines; i++) {
- CON_DeleteLine(scroll);
+ _vm->_console->deleteLine(scroll);
}
}
return R_SUCCESS;
}
-static int CON_DeleteLine(R_CON_SCROLLBACK *scroll) {
+int Console::deleteLine(R_CON_SCROLLBACK *scroll) {
R_CONSOLE_LINE *temp_p = scroll->tail;
if (temp_p->prev == NULL) {
@@ -453,7 +446,7 @@ static int CON_DeleteLine(R_CON_SCROLLBACK *scroll) {
return R_SUCCESS;
}
-static int CON_DeleteScroll(R_CON_SCROLLBACK * scroll) {
+int Console::deleteScroll(R_CON_SCROLLBACK * scroll) {
R_CONSOLE_LINE *walk_ptr;
R_CONSOLE_LINE *temp_ptr;
diff --git a/saga/console.h b/saga/console.h
index c2fb5ad24c..b24f2540c1 100644
--- a/saga/console.h
+++ b/saga/console.h
@@ -34,20 +34,6 @@ namespace Saga {
#define R_CONSOLE_TXTCOLOR 0x00FFFFFFUL
#define R_CONSOLE_TXTSHADOW 0x00202020UL
-struct R_CONSOLEINFO {
- int active;
- int y_max;
- int line_max;
- int hist_max;
- int hist_pos;
- int line_pos;
- int y_pos;
- char *prompt;
- int prompt_w;
- char input_buf[R_CON_INPUTBUF_LEN + 1];
- int input_pos;
-};
-
struct R_CONSOLE_LINE {
R_CONSOLE_LINE *next;
R_CONSOLE_LINE *prev;
@@ -61,11 +47,6 @@ struct R_CON_SCROLLBACK {
int lines;
};
-static int CON_AddLine(R_CON_SCROLLBACK *scroll, int line_max, const char *constr_p);
-static int CON_DeleteLine(R_CON_SCROLLBACK *scroll);
-static int CON_DeleteScroll(R_CON_SCROLLBACK *scroll);
-static int CON_SetDropPos(double percent);
-
#define R_CON_DEFAULTPOS 136
#define R_CON_DEFAULTLINES 100
#define R_CON_DEFAULTCMDS 10
@@ -74,6 +55,56 @@ static int CON_SetDropPos(double percent);
#define R_CON_LINE_H 10
#define R_CON_INPUT_H 10
+class Console {
+ public:
+ int reg(void);
+ Console(SagaEngine *vm);
+ ~Console(void);
+
+ int activate(void);
+ int deactivate(void);
+ bool isActive(void);
+
+ int type(int in_char);
+ int draw(R_SURFACE *ds);
+ int print(const char *fmt_str, ...);
+
+ int cmdUp(void);
+ int cmdDown(void);
+ int pageUp(void);
+ int pageDown(void);
+
+ int dropConsole(double percent);
+ int raiseConsole(double percent);
+
+ private:
+ int addLine(R_CON_SCROLLBACK *scroll, int line_max, const char *constr_p);
+ int deleteLine(R_CON_SCROLLBACK *scroll);
+ int deleteScroll(R_CON_SCROLLBACK *scroll);
+ int setDropPos(double percent);
+
+ private:
+ SagaEngine *_vm;
+
+ R_CON_SCROLLBACK _scrollback;
+ R_CON_SCROLLBACK _history;
+
+ int _resize;
+ int _droptime;
+
+ bool _active;
+ int _yMax;
+ int _lineMax;
+ int _histMax;
+ int _histPos;
+ int _linePos;
+ int _yPos;
+ char *_prompt;
+ int _promptW;
+ char _inputBuf[R_CON_INPUTBUF_LEN + 1];
+ int _inputPos;
+};
+
} // End of namespace Saga
#endif
diff --git a/saga/console_mod.h b/saga/console_mod.h
deleted file mode 100644
index 3395c89b8c..0000000000
--- a/saga/console_mod.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2004 The ScummVM project
- *
- * The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Header$
- *
- */
-
-// Console module public header file
-
-#ifndef SAGA_CONSOLE_MOD_H_
-#define SAGA_CONSOLE_MOD_H_
-
-namespace Saga {
-
-int CON_Register(void);
-int CON_Init(void);
-int CON_Shutdown(void);
-
-int CON_Activate(void);
-int CON_Deactivate(void);
-int CON_IsActive(void);
-
-int CON_Type(int in_char);
-int CON_Draw(R_SURFACE *ds);
-int CON_Print(const char *fmt_str, ...);
-
-int CON_CmdUp(void);
-int CON_CmdDown(void);
-int CON_PageUp(void);
-int CON_PageDown(void);
-
-int CON_DropConsole(double percent);
-int CON_RaiseConsole(double percent);
-
-} // End of namespace Saga
-
-#endif
diff --git a/saga/cvar.cpp b/saga/cvar.cpp
index 345f9e773d..dcb64757d9 100644
--- a/saga/cvar.cpp
+++ b/saga/cvar.cpp
@@ -25,7 +25,7 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/cvar_mod.h"
#include "saga/cvar.h"
@@ -145,7 +145,7 @@ int CVAR_Exec(R_CVAR_P cvar_func, char *r_value) {
cf_argc = EXPR_GetArgs(r_value, &cf_argv);
if (cf_argc < cvar_func->t.func.min_args) {
- CON_Print("Too few arguments to function.");
+ _vm->_console->print("Too few arguments to function.");
if (cf_argv)
free(cf_argv);
return R_FAILURE;
@@ -153,7 +153,7 @@ int CVAR_Exec(R_CVAR_P cvar_func, char *r_value) {
max_args = cvar_func->t.func.max_args;
if ((max_args > -1) && (cf_argc > max_args)) {
- CON_Print("Too many arguments to function.");
+ _vm->_console->print("Too many arguments to function.");
if (cf_argv)
free(cf_argv);
return R_FAILURE;
@@ -449,31 +449,31 @@ int CVAR_Print(R_CVAR_P con_cvar) {
switch (con_cvar->type) {
case R_CVAR_INT:
- CON_Print("\"%s\"(i) = %d", con_cvar->name, *(con_cvar->t.i.var_p));
+ _vm->_console->print("\"%s\"(i) = %d", con_cvar->name, *(con_cvar->t.i.var_p));
break;
case R_CVAR_UINT:
- CON_Print("\"%s\"(ui) = %u", con_cvar->name, *(con_cvar->t.ui.var_p));
+ _vm->_console->print("\"%s\"(ui) = %u", con_cvar->name, *(con_cvar->t.ui.var_p));
break;
case R_CVAR_FLOAT:
- CON_Print("\"%s\"(ui) = %f", con_cvar->name, *(con_cvar->t.f.var_p));
+ _vm->_console->print("\"%s\"(ui) = %f", con_cvar->name, *(con_cvar->t.f.var_p));
break;
case R_CVAR_STRING:
- CON_Print("\"%s\"(s) = \"%s\"", con_cvar->name, con_cvar->t.s.var_str);
+ _vm->_console->print("\"%s\"(s) = \"%s\"", con_cvar->name, con_cvar->t.s.var_str);
break;
case R_CVAR_FUNC:
if (con_cvar->t.func.func_argstr) {
- CON_Print("\"%s\"(func) Args: %s", con_cvar->name, con_cvar->t.func.func_argstr);
+ _vm->_console->print("\"%s\"(func) Args: %s", con_cvar->name, con_cvar->t.func.func_argstr);
} else {
- CON_Print("\"%s\"(func) No arguments.", con_cvar->name);
+ _vm->_console->print("\"%s\"(func) No arguments.", con_cvar->name);
}
break;
default:
- CON_Print("Invalid variable type.\n");
+ _vm->_console->print("Invalid variable type.\n");
break;
}
diff --git a/saga/events.cpp b/saga/events.cpp
index 8f4b29841f..51713e0016 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -30,7 +30,7 @@
#include "saga/yslib.h"
#include "saga/animation.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/scene.h"
#include "saga/interface.h"
#include "saga/text.h"
@@ -185,10 +185,10 @@ int HandleContinuous(R_EVENT *event) {
case R_CONSOLE_EVENT:
switch (event->op) {
case EVENT_ACTIVATE:
- CON_DropConsole(event_pc);
+ _vm->_console->dropConsole(event_pc);
break;
case EVENT_DEACTIVATE:
- CON_RaiseConsole(event_pc);
+ _vm->_console->raiseConsole(event_pc);
break;
default:
break;
diff --git a/saga/input.cpp b/saga/input.cpp
index 29e13d14cf..9b71e97e6f 100644
--- a/saga/input.cpp
+++ b/saga/input.cpp
@@ -24,7 +24,7 @@
#include "saga/gfx.h"
#include "saga/actor.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/interface.h"
#include "saga/render.h"
#include "saga/scene.h"
@@ -44,29 +44,29 @@ int SYSINPUT_ProcessInput() {
switch (event.event_code) {
case OSystem::EVENT_KEYDOWN:
- if (CON_IsActive()) {
+ if (_vm->_console->isActive()) {
in_char = event.kbd.ascii;
switch (event.kbd.keycode) {
case 96: // backquote
- CON_Deactivate();
+ _vm->_console->deactivate();
break;
case 280: // page up
- CON_PageUp();
+ _vm->_console->pageUp();
break;
case 281: // page down
- CON_PageDown();
+ _vm->_console->pageDown();
break;
case 273: // up
case 264: // keypad up
- CON_CmdUp();
+ _vm->_console->cmdUp();
break;
case 274: // down
case 258: // keypad down
- CON_CmdDown();
+ _vm->_console->cmdDown();
break;
default:
if (in_char) {
- CON_Type(in_char);
+ _vm->_console->type(in_char);
}
break;
}
@@ -75,7 +75,7 @@ int SYSINPUT_ProcessInput() {
switch (event.kbd.keycode) {
case 96: // back quote
- CON_Activate();
+ _vm->_console->activate();
break;
case 114: // r
_vm->_interface->draw();
diff --git a/saga/interface.cpp b/saga/interface.cpp
index 3d38fd0d76..a87957b818 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -28,7 +28,7 @@
#include "saga/game_mod.h"
#include "saga/cvar_mod.h"
#include "saga/actor.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/font.h"
#include "saga/objectmap.h"
#include "saga/rscfile_mod.h"
@@ -493,7 +493,7 @@ int Interface::handlePlayfieldClick(R_SURFACE *ds, R_POINT *imouse_pt) {
}
if (_vm->_objectMap->getFlags(object_num, &object_flags) != R_SUCCESS) {
- CON_Print("Invalid object number: %d\n", object_num);
+ _vm->_console->print("Invalid object number: %d\n", object_num);
return R_FAILURE;
}
@@ -536,7 +536,7 @@ int Interface::handlePlayfieldUpdate(R_SURFACE *ds, R_POINT *imouse_pt) {
}
if (_vm->_objectMap->getFlags(object_num, &object_flags) != R_SUCCESS) {
- CON_Print("Invalid object number: %d\n", object_num);
+ _vm->_console->print("Invalid object number: %d\n", object_num);
return R_FAILURE;
}
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index ac55d5599c..021cff534d 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -30,7 +30,7 @@
#include "saga/gfx.h"
#include "saga/cvar_mod.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/font.h"
#include "saga/objectmap.h"
@@ -430,11 +430,11 @@ void ObjectMap::objectInfo(int argc, char *argv[]) {
return;
}
- CON_Print("%d objects loaded.", _n_objects);
+ _vm->_console->print("%d objects loaded.", _n_objects);
for (i = 0; i < _n_objects; i++) {
- CON_Print("%s:", _names[i]);
- CON_Print("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, _object_maps[i].unknown0,
+ _vm->_console->print("%s:", _names[i]);
+ _vm->_console->print("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, _object_maps[i].unknown0,
_object_maps[i].flags,
_object_maps[i].object_num,
_object_maps[i].script_num,
diff --git a/saga/render.cpp b/saga/render.cpp
index db74fb207f..c9558fed9f 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -26,7 +26,7 @@
#include "saga/gfx.h"
#include "saga/actor.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/cvar_mod.h"
#include "saga/font.h"
#include "saga/game_mod.h"
@@ -183,7 +183,7 @@ int Render::drawScene() {
}
// Draw console
- CON_Draw(backbuf_surface);
+ _vm->_console->draw(backbuf_surface);
_system->copyRectToScreen(backbuf_surface->buf, backbuf_surface->buf_w, 0, 0,
backbuf_surface->buf_w, backbuf_surface->buf_h);
diff --git a/saga/saga.cpp b/saga/saga.cpp
index 45bf3d5c36..1834592d0c 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -37,7 +37,7 @@
#include "saga/render.h"
#include "saga/actor.h"
#include "saga/animation.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
#include "saga/actionmap.h"
@@ -105,14 +105,11 @@ void SagaEngine::errorString(const char *buf1, char *buf2) {
void SagaEngine::go() {
int msec = 0;
- // Register engine modules
- CON_Register(); // Register console cvars first
-
- GAME_Register();
-
_soundEnabled = 1;
_musicEnabled = 1;
+ _console = new Console(this);
+
CVAR_RegisterFunc(CF_testfunc, "testfunc", "foo [ optional foo ]", R_CVAR_NONE, 0, -1, this);
CVAR_Register_I(&_soundEnabled, "sound", NULL, R_CVAR_CFG, 0, 1);
@@ -194,6 +191,9 @@ void SagaEngine::go() {
debug(0, "Sound disabled.");
}
+ // Register engine modules
+ _console->reg(); // Register console cvars first
+ GAME_Register();
_scene->reg();
_actor->reg();
_script->reg();
@@ -241,7 +241,7 @@ void SagaEngine::shutdown() {
delete _script;
delete _sprite;
delete _font;
- CON_Shutdown();
+ delete _console;
CVAR_Shutdown();
EVENT_Shutdown();
@@ -268,10 +268,10 @@ static void CF_quitfunc(int argc, char *argv[], void *refCon) {
static void CF_testfunc(int argc, char *argv[], void *refCon) {
int i;
- CON_Print("Test function invoked: Got %d arguments.", argc);
+ _vm->_console->print("Test function invoked: Got %d arguments.", argc);
for (i = 0; i < argc; i++) {
- CON_Print("Arg %d: %s", i, argv[i]);
+ _vm->_console->print("Arg %d: %s", i, argv[i]);
}
}
diff --git a/saga/saga.h b/saga/saga.h
index ac38e14857..3fa74693c4 100644
--- a/saga/saga.h
+++ b/saga/saga.h
@@ -56,6 +56,7 @@ class Font;
class Sprite;
class Scene;
class Interface;
+class Console;
using Common::MemoryReadStream;
@@ -114,6 +115,7 @@ public:
Sprite *_sprite;
Scene *_scene;
Interface *_interface;
+ Console *_console;
private:
int decodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len);
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 3cf7d9675e..50df78e496 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -28,7 +28,7 @@
#include "saga/gfx.h"
#include "saga/game_mod.h"
#include "saga/animation.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
#include "saga/actionmap.h"
@@ -830,16 +830,16 @@ void Scene::sceneChangeCmd(int argc, char *argv[]) {
scene_num = atoi(argv[0]);
if ((scene_num < 1) || (scene_num > _sceneMax)) {
- CON_Print("Invalid scene number.");
+ _vm->_console->print("Invalid scene number.");
return;
}
clearSceneQueue();
if (changeScene(scene_num) == R_SUCCESS) {
- CON_Print("Scene changed.");
+ _vm->_console->print("Scene changed.");
} else {
- CON_Print("Couldn't change scene!");
+ _vm->_console->print("Couldn't change scene!");
}
}
@@ -850,17 +850,17 @@ static void CF_scenechange(int argc, char *argv[], void *refCon) {
void Scene::sceneInfoCmd(int argc, char *argv[]) {
const char *fmt = "%-20s %d";
- CON_Print(fmt, "Scene number:", _sceneNumber);
- CON_Print(fmt, "Descriptor R#:", _sceneResNum);
- CON_Print("-------------------------");
- CON_Print(fmt, "Unknown:", _desc.unknown0);
- CON_Print(fmt, "Resource list R#:", _desc.res_list_rn);
- CON_Print(fmt, "End slope:", _desc.end_slope);
- CON_Print(fmt, "Begin slope:", _desc.begin_slope);
- CON_Print(fmt, "Script resource:", _desc.script_num);
- CON_Print(fmt, "Scene script:", _desc.scene_scriptnum);
- CON_Print(fmt, "Start script:", _desc.start_scriptnum);
- CON_Print(fmt, "Music R#", _desc.music_rn);
+ _vm->_console->print(fmt, "Scene number:", _sceneNumber);
+ _vm->_console->print(fmt, "Descriptor R#:", _sceneResNum);
+ _vm->_console->print("-------------------------");
+ _vm->_console->print(fmt, "Unknown:", _desc.unknown0);
+ _vm->_console->print(fmt, "Resource list R#:", _desc.res_list_rn);
+ _vm->_console->print(fmt, "End slope:", _desc.end_slope);
+ _vm->_console->print(fmt, "Begin slope:", _desc.begin_slope);
+ _vm->_console->print(fmt, "Script resource:", _desc.script_num);
+ _vm->_console->print(fmt, "Scene script:", _desc.scene_scriptnum);
+ _vm->_console->print(fmt, "Start script:", _desc.start_scriptnum);
+ _vm->_console->print(fmt, "Music R#", _desc.music_rn);
}
static void CF_sceneinfo(int argc, char *argv[], void *refCon) {
diff --git a/saga/script.cpp b/saga/script.cpp
index 6a0a744ef2..afec808736 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -28,7 +28,7 @@
#include "saga/gfx.h"
#include "saga/rscfile_mod.h"
#include "saga/game_mod.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/cvar_mod.h"
#include "saga/script_mod.h"
@@ -501,12 +501,12 @@ void CF_script_info(int argc, char *argv[], void *refCon) {
n_entrypoints = ((Script *)refCon)->currentScript()->bytecode->n_entrypoints;
- CON_Print("Current script contains %d entrypoints:", n_entrypoints);
+ _vm->_console->print("Current script contains %d entrypoints:", n_entrypoints);
for (i = 0; i < n_entrypoints; i++) {
name_ptr = (char *)((Script *)refCon)->currentScript()->bytecode->bytecode_p +
((Script *)refCon)->currentScript()->bytecode->entrypoints[i].name_offset;
- CON_Print("%lu: %s", i, name_ptr);
+ _vm->_console->print("%lu: %s", i, name_ptr);
}
}
@@ -520,16 +520,16 @@ void CF_script_exec(int argc, char *argv[], void *refCon) {
ep_num = atoi(argv[0]);
if (((Script *)refCon)->_dbg_thread == NULL) {
- CON_Print("Creating debug thread...");
+ _vm->_console->print("Creating debug thread...");
((Script *)refCon)->_dbg_thread = STHREAD_Create();
if (((Script *)refCon)->_dbg_thread == NULL) {
- CON_Print("Thread creation failed.");
+ _vm->_console->print("Thread creation failed.");
return;
}
}
if (ep_num >= ((Script *)refCon)->currentScript()->bytecode->n_entrypoints) {
- CON_Print("Invalid entrypoint.");
+ _vm->_console->print("Invalid entrypoint.");
return;
}
diff --git a/saga/sdebug.cpp b/saga/sdebug.cpp
index 374d9a4d96..3943a31c2a 100644
--- a/saga/sdebug.cpp
+++ b/saga/sdebug.cpp
@@ -25,7 +25,6 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/console_mod.h"
#include "saga/text.h"
#include "saga/scene.h"
#include "saga/font.h"
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index 0af72e4eda..98c7fbabb4 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -28,7 +28,7 @@
#include "saga/gfx.h"
#include "saga/actor.h"
#include "saga/animation.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/interface.h"
#include "saga/script.h"
@@ -175,7 +175,7 @@ int SF_actorWalkTo(R_SCRIPTFUNC_PARAMS) {
actor_id = _vm->_sdata->readWordS(actor_parm);
actor_idx = _vm->_actor->getActorIndex(actor_id);
if (actor_idx < 0) {
- CON_Print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.", actor_id);
+ _vm->_console->print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.", actor_id);
return R_FAILURE;
}
@@ -210,7 +210,7 @@ int SF_setFacing(R_SCRIPTFUNC_PARAMS) {
orientation = _vm->_sdata->readWordS(orient_parm);
actor_idx = _vm->_actor->getActorIndex(actor_id);
if (actor_idx < 0) {
- CON_Print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.", actor_id);
+ _vm->_console->print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.", actor_id);
return R_FAILURE;
}
@@ -273,7 +273,7 @@ int SF_startAnim(R_SCRIPTFUNC_PARAMS) {
anim_id = _vm->_sdata->readWordS(anim_id_parm);
if (_vm->_anim->play(anim_id, 0) != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "SF.26: Anim::play() failed. Anim id: %u\n", anim_id);
+ _vm->_console->print(S_WARN_PREFIX "SF.26: Anim::play() failed. Anim id: %u\n", anim_id);
return R_FAILURE;
}
@@ -300,7 +300,7 @@ int SF_actorWalkToAsync(R_SCRIPTFUNC_PARAMS) {
actor_id = _vm->_sdata->readWordS(actor_parm);
actor_idx = _vm->_actor->getActorIndex(actor_id);
if (actor_idx < 0) {
- CON_Print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.",
+ _vm->_console->print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.",
actor_id);
return R_FAILURE;
}
@@ -343,7 +343,7 @@ int SF_moveTo(R_SCRIPTFUNC_PARAMS) {
if (!_vm->_actor->actorExists(actor_id)) {
result = _vm->_actor->create(actor_id, pt.x, pt.y);
if (result != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "SF.30: Couldn't create actor 0x%X.", actor_id);
+ _vm->_console->print(S_WARN_PREFIX "SF.30: Couldn't create actor 0x%X.", actor_id);
return R_FAILURE;
}
} else {
@@ -381,7 +381,7 @@ int SF_actorWalk(R_SCRIPTFUNC_PARAMS) {
actor_idx = _vm->_actor->getActorIndex(_vm->_sdata->readWordS(actor_parm));
if (actor_idx < 0) {
- CON_Print(S_WARN_PREFIX "SF.36: Actor id 0x%X not found.", (int)actor_parm);
+ _vm->_console->print(S_WARN_PREFIX "SF.36: Actor id 0x%X not found.", (int)actor_parm);
return R_FAILURE;
}
@@ -423,7 +423,7 @@ int SF_cycleActorFrames(R_SCRIPTFUNC_PARAMS) {
actor_idx = _vm->_actor->getActorIndex(actor_id);
if (_vm->_actor->setAction(actor_idx, action, ACTION_NONE) != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "SF.37: Actor::setAction() failed.");
+ _vm->_console->print(S_WARN_PREFIX "SF.37: Actor::setAction() failed.");
return R_FAILURE;
}
@@ -456,7 +456,7 @@ int SF_setFrame(R_SCRIPTFUNC_PARAMS) {
actor_idx = _vm->_actor->getActorIndex(actor_id);
if (_vm->_actor->setAction(actor_idx, action, ACTION_NONE) != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "SF.38: Actor::setAction() failed.");
+ _vm->_console->print(S_WARN_PREFIX "SF.38: Actor::setAction() failed.");
return R_FAILURE;
}
@@ -488,7 +488,7 @@ int SF_linkAnim(R_SCRIPTFUNC_PARAMS) {
anim_id2 = _vm->_sdata->readWordU(anim2_parm);
if (_vm->_anim->link(anim_id1, anim_id2) != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "SF.41: Anim::link() failed. (%u->%u)\n", anim_id1, anim_id2);
+ _vm->_console->print(S_WARN_PREFIX "SF.41: Anim::link() failed. (%u->%u)\n", anim_id1, anim_id2);
return R_FAILURE;
}
@@ -537,7 +537,7 @@ int SF_placeActor(R_SCRIPTFUNC_PARAMS) {
if (!_vm->_actor->actorExists(actor_id)) {
result = _vm->_actor->create(actor_id, pt.x, pt.y);
if (result != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "SF.43: Couldn't create actor 0x%X.", actor_id);
+ _vm->_console->print(S_WARN_PREFIX "SF.43: Couldn't create actor 0x%X.", actor_id);
return R_FAILURE;
}
} else {
diff --git a/saga/sstack.cpp b/saga/sstack.cpp
index adadd87c41..fa967839c9 100644
--- a/saga/sstack.cpp
+++ b/saga/sstack.cpp
@@ -26,7 +26,7 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/script.h"
#include "saga/sstack.h"
@@ -136,7 +136,7 @@ int SSTACK_Grow(SSTACK stack) {
SDataWord_T *new_data;
if ((stack->len * 2) > R_STACK_SIZE_LIMIT) {
- CON_Print(S_ERROR_PREFIX "Stack fault: growing beyond limit.");
+ _vm->_console->print(S_ERROR_PREFIX "Stack fault: growing beyond limit.");
return STACK_OVERFLOW;
}
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index faf20092ef..5de0d81a06 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -27,7 +27,7 @@
#include "saga/gfx.h"
#include "saga/actor.h"
-#include "saga/console_mod.h"
+#include "saga/console.h"
#include "saga/script.h"
#include "saga/script_mod.h"
@@ -341,23 +341,23 @@ int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
n_args = readS.readByte();
func_num = readS.readUint16LE();
if (func_num >= R_SFUNC_NUM) {
- CON_Print(S_ERROR_PREFIX "Invalid script function number: (%X)\n", func_num);
+ _vm->_console->print(S_ERROR_PREFIX "Invalid script function number: (%X)\n", func_num);
thread->executing = 0;
break;
}
sfunc = SFuncList[func_num].sfunc_fp;
if (sfunc == NULL) {
- CON_Print(S_WARN_PREFIX "%X: Undefined script function number: (%X)\n",
+ _vm->_console->print(S_WARN_PREFIX "%X: Undefined script function number: (%X)\n",
thread->i_offset, func_num);
- CON_Print(S_WARN_PREFIX "Removing %d operand(s) from stack.\n", n_args);
+ _vm->_console->print(S_WARN_PREFIX "Removing %d operand(s) from stack.\n", n_args);
for (i = 0; i < n_args; i++) {
SSTACK_Pop(thread->stack, NULL);
}
} else {
FIXME_SHADOWED_result = sfunc(thread);
if (FIXME_SHADOWED_result != R_SUCCESS) {
- CON_Print(S_WARN_PREFIX "%X: Script function %d failed.\n", thread->i_offset, func_num);
+ _vm->_console->print(S_WARN_PREFIX "%X: Script function %d failed.\n", thread->i_offset, func_num);
}
}
}
@@ -374,7 +374,7 @@ int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
case 0x1C:
result = SSTACK_Pop(thread->stack, &data);
if (result != STACK_SUCCESS) {
- CON_Print("Script execution complete.");
+ _vm->_console->print("Script execution complete.");
thread->executing = 0;
} else {
thread->i_offset = data;
@@ -479,7 +479,7 @@ int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
}
}
if (!branch_found) {
- CON_Print(S_ERROR_PREFIX "%X: Random jump target out of " "bounds.", thread->i_offset);
+ _vm->_console->print(S_ERROR_PREFIX "%X: Random jump target out of " "bounds.", thread->i_offset);
}
}
break;
@@ -721,7 +721,7 @@ int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
a_index = _vm->_actor->getActorIndex(param1);
if (a_index < 0) {
- CON_Print(S_WARN_PREFIX "%X: DLGP Actor id not found.", thread->i_offset);
+ _vm->_console->print(S_WARN_PREFIX "%X: DLGP Actor id not found.", thread->i_offset);
}
for (i = 0; i < n_voices; i++) {
@@ -766,7 +766,7 @@ int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
default:
- CON_Print(S_ERROR_PREFIX "%X: Invalid opcode encountered: " "(%X).\n", thread->i_offset, in_char);
+ _vm->_console->print(S_ERROR_PREFIX "%X: Invalid opcode encountered: " "(%X).\n", thread->i_offset, in_char);
thread->executing = 0;
break;
}
@@ -776,7 +776,7 @@ int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
thread->i_offset = readS.pos();
}
if (unhandled) {
- CON_Print(S_ERROR_PREFIX "%X: Unhandled opcode.\n", thread->i_offset);
+ _vm->_console->print(S_ERROR_PREFIX "%X: Unhandled opcode.\n", thread->i_offset);
thread->executing = 0;
}
if (thread->executing && debug_print) {