[Scummvm-git-logs] scummvm master -> a41de0df27567cdc7b151772bd650be5906b5b11
dreammaster
paulfgilbert at gmail.com
Sun Feb 23 17:57:06 UTC 2020
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1dc56a37be ULTIMA8: Fix reading configuration and cleanup of screen resolution code
289c5947ce ULTIMA8: Redirect keybindings to now use Debugger
667ce5afbd ULTIMA8: Remapping console calls to debug and warning
ad2ee92d62 ULTIMA8: Move pout and perr to Debugger
c64617bdcd ULTIMA8: Completely remove old console and console gump
a41de0df27 ULTIMA8: Remove references to SDL, since it's no longer used
Commit: 1dc56a37be28803707467244232d92e270d93428
https://github.com/scummvm/scummvm/commit/1dc56a37be28803707467244232d92e270d93428
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T09:52:20-08:00
Commit Message:
ULTIMA8: Fix reading configuration and cleanup of screen resolution code
Changed paths:
engines/ultima/ultima8/conf/config_file_manager.cpp
engines/ultima/ultima8/conf/setting_manager.cpp
engines/ultima/ultima8/conf/setting_manager.h
engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
engines/ultima/ultima8/world/item.cpp
diff --git a/engines/ultima/ultima8/conf/config_file_manager.cpp b/engines/ultima/ultima8/conf/config_file_manager.cpp
index 5676a52..6f1e40b 100644
--- a/engines/ultima/ultima8/conf/config_file_manager.cpp
+++ b/engines/ultima/ultima8/conf/config_file_manager.cpp
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/conf/config_file_manager.h"
#include "ultima/ultima8/conf/ini_file.h"
+#include "common/config-manager.h"
namespace Ultima {
namespace Ultima8 {
@@ -100,10 +101,15 @@ void ConfigFileManager::clearRoot(istring root) {
}
bool ConfigFileManager::exists(istring key) {
- return (findKeyINI(key) != 0);
+ return ConfMan.hasKey(key) || (findKeyINI(key) != 0);
}
bool ConfigFileManager::get(istring key, string &ret) {
+ if (ConfMan.hasKey(key)) {
+ ret = ConfMan.get(key);
+ return true;
+ }
+
INIFile *ini = findKeyINI(key);
if (!ini) return false;
@@ -113,6 +119,11 @@ bool ConfigFileManager::get(istring key, string &ret) {
bool ConfigFileManager::get(istring key, int &ret) {
+ if (ConfMan.hasKey(key)) {
+ ret = ConfMan.getInt(key);
+ return true;
+ }
+
INIFile *ini = findKeyINI(key);
if (!ini) return false;
@@ -121,6 +132,11 @@ bool ConfigFileManager::get(istring key, int &ret) {
}
bool ConfigFileManager::get(istring key, bool &ret) {
+ if (ConfMan.hasKey(key)) {
+ ret = ConfMan.getBool(key);
+ return true;
+ }
+
INIFile *ini = findKeyINI(key);
if (!ini) return false;
diff --git a/engines/ultima/ultima8/conf/setting_manager.cpp b/engines/ultima/ultima8/conf/setting_manager.cpp
index d8ed7bc..a20f6f9 100644
--- a/engines/ultima/ultima8/conf/setting_manager.cpp
+++ b/engines/ultima/ultima8/conf/setting_manager.cpp
@@ -36,17 +36,6 @@ SettingManager::SettingManager() {
_confFileMan = ConfigFileManager::get_instance();
_confFileMan->readConfigString("", "defaultsettings", false);
-
- // Setup ScummVM configuration settings
- setupScummVMSettings();
-}
-
-void SettingManager::setupScummVMSettings() {
- _confFileMan->readConfigString("", "ScummVM", false);
-
- int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
- if (saveSlot != -1)
- set("lastSave", Std::string::format("@save/%d", saveSlot), DOM_SCUMMVM);
}
SettingManager::~SettingManager() {
@@ -72,7 +61,8 @@ bool SettingManager::exists(istring key, Domain dom) {
bool SettingManager::get(istring key, Std::string &ret, Domain dom) {
Domain keydom;
bool found = findKeyDomain(key, dom, keydom);
- if (!found) return false;
+ if (!found)
+ return false;
_confFileMan->get(getConfigKey(key, keydom), ret);
@@ -82,7 +72,8 @@ bool SettingManager::get(istring key, Std::string &ret, Domain dom) {
bool SettingManager::get(istring key, int &ret, Domain dom) {
Domain keydom;
bool found = findKeyDomain(key, dom, keydom);
- if (!found) return false;
+ if (!found)
+ return false;
_confFileMan->get(getConfigKey(key, keydom), ret);
@@ -92,7 +83,8 @@ bool SettingManager::get(istring key, int &ret, Domain dom) {
bool SettingManager::get(istring key, bool &ret, Domain dom) {
Domain keydom;
bool found = findKeyDomain(key, dom, keydom);
- if (!found) return false;
+ if (!found)
+ return false;
_confFileMan->get(getConfigKey(key, keydom), ret);
@@ -225,12 +217,15 @@ bool SettingManager::findKeyDomain(istring key, Domain dom, Domain &keydom) {
istring SettingManager::getConfigKey(istring key, Domain dom) {
istring ckey;
- if (dom == DOM_CURRENT) dom = _currentDomain;
+ if (dom == DOM_CURRENT)
+ dom = _currentDomain;
+
+ if (dom == DOM_GLOBAL && ConfMan.hasKey(key))
+ // Key exists in scummvm.ini, so can be used as is
+ return key;
if (dom == DOM_DEFAULTS) {
ckey = "defaultsettings/";
- } else if (dom == DOM_SCUMMVM) {
- ckey = "ScummVM/";
} else {
ckey = "settings/" + _domains[dom];
}
diff --git a/engines/ultima/ultima8/conf/setting_manager.h b/engines/ultima/ultima8/conf/setting_manager.h
index c558b7d..da658a1 100644
--- a/engines/ultima/ultima8/conf/setting_manager.h
+++ b/engines/ultima/ultima8/conf/setting_manager.h
@@ -45,9 +45,8 @@ public:
enum Domain {
DOM_DEFAULTS = 0,
- DOM_SCUMMVM = 1,
- DOM_GLOBAL = 2,
- DOM_GAME = 3,
+ DOM_GLOBAL = 1,
+ DOM_GAME = 2,
DOM_CURRENT = 100
};
@@ -122,7 +121,6 @@ private:
bool findKeyDomain(istring key, Domain dom, Domain &keydom);
istring getConfigKey(istring key, Domain dom);
void callCallbacks(istring key);
- void setupScummVMSettings();
Callbacks _callbacks;
Std::vector<istring> _domains;
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
index 25fe354..22d2ee7 100644
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
@@ -123,7 +123,7 @@ void PentagramMenuGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bo
Std::list<Gump *>::iterator it = _children.begin();
Std::list<Gump *>::iterator end = _children.end();
- Rect game_clip_rect(0, 45, SCREEN_WIDTH, _dims.h - 58);
+ Rect game_clip_rect(0, 45, 640, _dims.h - 58);
Rect cur_clip_rect;
surf->GetClippingRect(cur_clip_rect);
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 5eab862..19196ce 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -121,12 +121,12 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(Ultima8Engine, CoreApp)
Ultima8Engine::Ultima8Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
Shared::UltimaEngine(syst, gameDesc), CoreApp(gameDesc), _saveCount(0), _game(0),
_kernel(0), _objectManager(0), _hidManager(0), _mouse(0), _ucMachine(0), _screen(0),
- _fontManager(0), _fullScreen(false), _paletteManager(0), _gameData(0), _world(0),
- _desktopGump(0), _consoleGump(0), _gameMapGump(0), _avatarMoverProcess(0),
- _frameSkip(false), _frameLimit(true), _interpolate(true), _animationRate(100),
- _avatarInStasis(false), _paintEditorItems(false), _inversion(0), _painting(false),
- _showTouching(false), _timeOffset(0), _hasCheated(false), _cheatsEnabled(false),
- _drawRenderStats(false), _ttfOverrides(false), _audioMixer(0) {
+ _fontManager(0), _paletteManager(0), _gameData(0), _world(0), _desktopGump(0),
+ _consoleGump(0), _gameMapGump(0), _avatarMoverProcess(0), _frameSkip(false),
+ _frameLimit(true), _interpolate(true), _animationRate(100), _avatarInStasis(false),
+ _paintEditorItems(false), _inversion(0), _painting(false), _showTouching(false),
+ _timeOffset(0), _hasCheated(false), _cheatsEnabled(false), _drawRenderStats(false),
+ _ttfOverrides(false), _audioMixer(0) {
_application = this;
for (uint16 key = 0; key < HID_LAST; ++key) {
@@ -663,14 +663,11 @@ void Ultima8Engine::paint() {
}
void Ultima8Engine::GraphicSysInit() {
- _settingMan->setDefault("_fullScreen", false);
- _settingMan->setDefault("width", SCREEN_WIDTH);
- _settingMan->setDefault("height", SCREEN_HEIGHT);
+ _settingMan->setDefault("width", DEFAULT_SCREEN_WIDTH);
+ _settingMan->setDefault("height", DEFAULT_SCREEN_HEIGHT);
_settingMan->setDefault("bpp", 32);
- bool new_fullscreen;
int width, height, bpp;
- _settingMan->get("_fullScreen", new_fullscreen);
_settingMan->get("width", width);
_settingMan->get("height", height);
_settingMan->get("bpp", bpp);
@@ -685,29 +682,27 @@ void Ultima8Engine::GraphicSysInit() {
_settingMan->set("width", width);
_settingMan->set("height", height);
_settingMan->set("bpp", bpp);
- _settingMan->set("_fullScreen", new_fullscreen);
#endif
if (_screen) {
Rect old_dims;
_screen->GetSurfaceDims(old_dims);
- if (new_fullscreen == _fullScreen && width == old_dims.w && height == old_dims.h) return;
+ if (width == old_dims.w && height == old_dims.h)
+ return;
bpp = RenderSurface::format.s_bpp;
delete _screen;
}
_screen = 0;
- _fullScreen = new_fullscreen;
-
// Set Screen Resolution
con->Printf(MM_INFO, "Setting Video Mode %dx%dx%d...\n", width, height, bpp);
RenderSurface *new_screen = RenderSurface::SetVideoMode(width, height, bpp);
if (!new_screen) {
- perr << "Unable to set new video mode. Trying 640x480x32" << Std::endl;
- new_screen = RenderSurface::SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32);
+ perr << Common::String::format("Unable to set new video mode. Trying %dx%dx32", width, height) << Std::endl;
+ new_screen = RenderSurface::SetVideoMode(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32);
}
if (!new_screen) {
@@ -785,11 +780,7 @@ void Ultima8Engine::GraphicSysInit() {
paint();
}
-void Ultima8Engine::changeVideoMode(int width, int height, int new_fullscreen) {
- if (new_fullscreen == -2) _settingMan->set("_fullScreen", !_fullScreen);
- else if (new_fullscreen == 0) _settingMan->set("_fullScreen", false);
- else if (new_fullscreen == 1) _settingMan->set("_fullScreen", true);
-
+void Ultima8Engine::changeVideoMode(int width, int height) {
if (width > 0) _settingMan->set("width", width);
if (height > 0) _settingMan->set("height", height);
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index c961d58..7388fa1 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -50,8 +50,8 @@
namespace Ultima {
namespace Ultima8 {
-#define SCREEN_WIDTH 640
-#define SCREEN_HEIGHT 480
+#define DEFAULT_SCREEN_WIDTH 640
+#define DEFAULT_SCREEN_HEIGHT 480
class Debugger;
class Kernel;
@@ -98,7 +98,6 @@ private:
HIDManager *_hidManager;
UCMachine *_ucMachine;
RenderSurface *_screen;
- bool _fullScreen;
Mouse *_mouse;
PaletteManager *_paletteManager;
GameData *_gameData;
@@ -210,7 +209,8 @@ public:
// Used to enable access to the games gumps and shapes
void menuInitMinimal(istring game);
- void changeVideoMode(int width, int height, int fullscreen = -1); // -1 = no change, -2 = fullscreen toggle
+ void changeVideoMode(int width, int height);
+
RenderSurface *getRenderScreen() {
return _screen;
}
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 13e5464..379c0f7 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -372,8 +372,7 @@ void Item::movedByPlayer() {
UCList itemlist(2);
LOOPSCRIPT(script, LS_TOKEN_TRUE);
CurrentMap *currentmap = World::get_instance()->getCurrentMap();
- currentmap->areaSearch(&itemlist, script, sizeof(script),
- avatar, SCREEN_WIDTH, false);
+ currentmap->areaSearch(&itemlist, script, sizeof(script), avatar, 640, 0);
for (unsigned int i = 0; i < itemlist.getSize(); ++i) {
Actor *actor = getActor(itemlist.getuint16(i));
Commit: 289c5947ce2308e6a4e6edc76ad9e309d8fad37d
https://github.com/scummvm/scummvm/commit/289c5947ce2308e6a4e6edc76ad9e309d8fad37d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T09:52:20-08:00
Commit Message:
ULTIMA8: Redirect keybindings to now use Debugger
Changed paths:
engines/ultima/ultima8/kernel/hid_manager.cpp
engines/ultima/ultima8/kernel/hid_manager.h
engines/ultima/ultima8/misc/console.cpp
engines/ultima/ultima8/misc/console.h
engines/ultima/ultima8/misc/debugger.cpp
engines/ultima/ultima8/misc/debugger.h
engines/ultima/ultima8/misc/util.cpp
gui/debugger.h
diff --git a/engines/ultima/ultima8/kernel/hid_manager.cpp b/engines/ultima/ultima8/kernel/hid_manager.cpp
index c922477..4ebe582 100644
--- a/engines/ultima/ultima8/kernel/hid_manager.cpp
+++ b/engines/ultima/ultima8/kernel/hid_manager.cpp
@@ -24,6 +24,7 @@
#include "ultima/ultima8/kernel/hid_manager.h"
#include "ultima/ultima8/conf/setting_manager.h"
#include "ultima/ultima8/misc/console.h"
+#include "ultima/ultima8/misc/debugger.h"
#include "ultima/ultima8/misc/util.h"
#include "ultima/ultima8/conf/config_file_manager.h" // temporary!
@@ -40,7 +41,7 @@ HIDManager::HIDManager() {
}
HIDManager::~HIDManager() {
- Std::vector<Console::ArgvType *>::iterator it;
+ Std::vector<Debugger::ArgvType *>::iterator it;
con->Print(MM_INFO, "Destroying HIDManager...\n");
for (it = _commands.begin(); it != _commands.end(); ++it) {
@@ -58,7 +59,7 @@ bool HIDManager::handleEvent(HID_Key key, HID_Events events) {
uint32 keyEvent = (uint32)key | ((uint32)events << 16);
if (_bindings.contains(keyEvent)) {
- con->ExecuteConsoleCommand(*_bindings[keyEvent]);
+ g_debugger->executeCommand(*_bindings[keyEvent]);
handled = true;
}
@@ -66,7 +67,7 @@ bool HIDManager::handleEvent(HID_Key key, HID_Events events) {
}
void HIDManager::resetBindings() {
- Std::vector<Console::ArgvType *>::iterator it;
+ Std::vector<Debugger::ArgvType *>::iterator it;
_bindings.clear();
@@ -82,7 +83,7 @@ void HIDManager::resetBindings() {
}
void HIDManager::loadBindings() {
- Console::ArgsType args;
+ Debugger::ArgsType args;
con->Print(MM_INFO, "Loading HIDBindings...\n");
@@ -123,14 +124,14 @@ void HIDManager::saveBindings() {
confkey = section + HID_GetEventsName((HID_Events)events) + ' ' +
HID_GetKeyName((HID_Key) key);
- Console::ArgsType command;
+ Debugger::ArgsType command;
ArgvToString(*(it->_value), command);
settings->set(confkey, command);
// settings->unset(confkey);
}
}
-void HIDManager::bind(const istring &control, const Console::ArgvType &argv) {
+void HIDManager::bind(const istring &control, const Debugger::ArgvType &argv) {
HID_Key key = HID_LAST;
HID_Events event = HID_EVENT_DEPRESS;
Std::vector<istring> ctrl_argv;
@@ -147,18 +148,18 @@ void HIDManager::bind(const istring &control, const Console::ArgvType &argv) {
bind(key, event, argv);
}
-void HIDManager::bind(const istring &control, const Console::ArgsType &args) {
- Console::ArgvType argv;
+void HIDManager::bind(const istring &control, const Debugger::ArgsType &args) {
+ Debugger::ArgvType argv;
StringToArgv(args, argv);
bind(control, argv);
}
-void HIDManager::bind(HID_Key key, HID_Events event, const Console::ArgvType &argv) {
+void HIDManager::bind(HID_Key key, HID_Events event, const Debugger::ArgvType &argv) {
uint32 keyEvent = (uint32)key | ((uint32)event << 16);
- Console::ArgvType *command = 0;
+ Debugger::ArgvType *command = 0;
if (! argv.empty()) {
- Std::vector<Console::ArgvType *>::iterator it;
+ Std::vector<Debugger::ArgvType *>::iterator it;
for (it = _commands.begin(); it != _commands.end(); ++it) {
if (argv == (**it)) {
// Change from iterator to pointer
@@ -168,7 +169,7 @@ void HIDManager::bind(HID_Key key, HID_Events event, const Console::ArgvType &ar
}
if (!command) {
- command = new Console::ArgvType(argv);
+ command = new Debugger::ArgvType(argv);
_commands.push_back(command);
}
}
@@ -177,21 +178,21 @@ void HIDManager::bind(HID_Key key, HID_Events event, const Console::ArgvType &ar
_bindings[keyEvent] = command;
}
-void HIDManager::bind(HID_Key key, HID_Events event, const Console::ArgsType &args) {
- Console::ArgvType argv;
+void HIDManager::bind(HID_Key key, HID_Events event, const Debugger::ArgsType &args) {
+ Debugger::ArgvType argv;
StringToArgv(args, argv);
bind(key, event, argv);
}
void HIDManager::unbind(const istring &control) {
// bind to an empty control
- Console::ArgvType command;
+ Debugger::ArgvType command;
bind(control, command);
}
void HIDManager::listBindings() {
uint16 key, event;
- Console::ArgsType command;
+ Debugger::ArgsType command;
for (Bindings::iterator it = _bindings.begin(); it != _bindings.end(); ++it) {
key = it->_key & 0xffff;
diff --git a/engines/ultima/ultima8/kernel/hid_manager.h b/engines/ultima/ultima8/kernel/hid_manager.h
index 5d5684c..052bbbf 100644
--- a/engines/ultima/ultima8/kernel/hid_manager.h
+++ b/engines/ultima/ultima8/kernel/hid_manager.h
@@ -25,6 +25,7 @@
#include "ultima/shared/std/containers.h"
#include "ultima/ultima8/kernel/hid_keys.h"
+#include "ultima/ultima8/misc/debugger.h"
namespace Ultima {
namespace Ultima8 {
@@ -33,8 +34,8 @@ namespace Ultima8 {
class HIDManager {
private:
static HIDManager *_hidManager;
- Std::vector<Console::ArgvType *> _commands;
- typedef Common::HashMap<uint32, Console::ArgvType *> Bindings;
+ Std::vector<Debugger::ArgvType *> _commands;
+ typedef Common::HashMap<uint32, Debugger::ArgvType *> Bindings;
Bindings _bindings;
public:
HIDManager();
@@ -65,11 +66,11 @@ public:
//! loads a single keybinding
//! \param control a key or button to bind
//! \param bindingName name of the HIDBinding
- void bind(const istring &control, const Console::ArgvType &argv);
+ void bind(const istring &control, const Debugger::ArgvType &argv);
- void bind(const istring &control, const Console::ArgsType &args);
- void bind(HID_Key key, HID_Events event, const Console::ArgvType &argv);
- void bind(HID_Key key, HID_Events event, const Console::ArgsType &args);
+ void bind(const istring &control, const Debugger::ArgsType &args);
+ void bind(HID_Key key, HID_Events event, const Debugger::ArgvType &argv);
+ void bind(HID_Key key, HID_Events event, const Debugger::ArgsType &args);
//! removes all controls to a HIDBinding or the binding to one specified key
//! \param bindingName name of a HIDBinding or the name of key
diff --git a/engines/ultima/ultima8/misc/console.cpp b/engines/ultima/ultima8/misc/console.cpp
index 41e5036..69ecf41 100644
--- a/engines/ultima/ultima8/misc/console.cpp
+++ b/engines/ultima/ultima8/misc/console.cpp
@@ -516,188 +516,28 @@ void Console::ScrollConsole(int32 lines) {
// Console commands
//
-void Console::AddConsoleCommand(const ArgsType &command, Console::Function function) {
- ConsoleCommands[command] = function;
-}
-
-void Console::RemoveConsoleCommand(Console::Function function) {
- for (CommandsMap::iterator it = ConsoleCommands.begin(); it != ConsoleCommands.end(); ++it) {
- if (it->_value == function) {
- //pout << "Removing command: " << it->_key << Std::endl;
- it->_value = 0;
- }
- }
-}
-void Console::ExecuteConsoleCommand(const Console::ArgsType &args) {
- Console::ArgvType argv;
- StringToArgv(args, argv);
-
- ExecuteConsoleCommand(argv);
-}
-
-void Console::ExecuteConsoleCommand(const Console::ArgvType &argv) {
- CommandsMap::iterator it;
-
- // Empty?!?
- if (argv.empty())
- return;
-
- // Get the command name. Transparently handle conversions from original GUIApp
- Common::String commandName = argv[0];
- if (commandName.hasPrefix("GUIApp::"))
- commandName = "Ultima8Engine::" + Common::String(commandName.c_str() + 8);
-
- // Handle the command
- it = ConsoleCommands.find(commandName);
-
- if (it != ConsoleCommands.end() && it->_value)
- it->_value(argv);
- else
- Print(Common::String::format("Unknown command: %s\n", argv[0].c_str()).c_str());
-}
-
void Console::ExecuteCommandBuffer() {
- if (commandBuffer.empty()) return;
-
- Console::ArgsType args = commandBuffer;
- commandBuffer.clear();
-
- // TODO: Fix this
- //pout << "]" << args << Std::endl;
-
- ExecuteConsoleCommand(args);
-
- commandHistory.push_back(args);
- commandHistoryPos = 0;
- commandCursorPos = 0;
+ // DEPRECATED
}
void Console::ScrollCommandHistory(int num) {
- int total = commandHistory.size();
-
- // No history, don't do anything
- if (!total) return;
-
- if ((commandHistoryPos - num) <= 0) {
- if (commandHistoryPos == 1) return;
- commandHistoryPos = 1;
- } else
- commandHistoryPos -= num;
-
- if (commandHistoryPos > total)
- commandHistoryPos = total;
-
- commandBuffer = commandHistory[total - commandHistoryPos];
- commandCursorPos = commandBuffer.size();
+ // DEPRECATED
}
void Console::ClearCommandBuffer() {
- commandBuffer.clear();
- commandCursorPos = 0;
+ // DEPRECATED
}
void Console::AddCharacterToCommandBuffer(int ch) {
- // Enter (execute command)
- if (ch == Console::Enter) {
-
- ExecuteCommandBuffer();
- }
- // Backspace
- else if (ch == Console::Backspace) {
-
- DeleteCommandBufferChars(-1);
- }
- // Tab (command completion)
- else if (ch == Console::Tab) {
-
- if (!commandBuffer.empty()) {
-
- int count = 0;
- Console::ArgsType common;
- CommandsMap::iterator it;
- CommandsMap::iterator found;
-
- for (it = ConsoleCommands.begin(); it != ConsoleCommands.end(); ++it)
- if (it->_value) {
- if (it->_key.compareToIgnoreCase(commandBuffer))
- continue;
-
- if (!count) {
- common = it->_key;
- found = it;
- } else {
- Console::ArgsType::iterator it1 = common.begin();
- Console::ArgsType::const_iterator it2 = it->_key.begin();
- int comsize = 0;
-
- while (it1 != common.end()) {
- if (*it1 == *it2)
- break;
-
- comsize++;
- ++it1;
- ++it2;
- }
-
- common.resize(comsize);
- }
- count++;
- }
-
- if (count) {
- if (count > 1) {
- pout << "]" << commandBuffer << Std::endl;
-
- ArgsType args = "CmdList \"";
- args += commandBuffer;
- args += '\"';
-
- ArgvType argv;
- StringToArgv(args, argv);
-
- //ConCmd_CmdList(argv);
- commandBuffer = common;
- } else
- commandBuffer = common;
-
- commandCursorPos = commandBuffer.size();
- }
- }
- }
- // Add the character to the command buffer
- else {
- if (commandCursorPos == static_cast<int>(commandBuffer.size())) {
- commandBuffer += ch;
- } else if (commandInsert) {
- commandBuffer.insert(commandCursorPos, 1, ch);
- } else {
- commandBuffer[commandCursorPos] = ch;
- }
-
- commandCursorPos++;
- }
+ // DEPRECATED
}
void Console::DeleteCommandBufferChars(int num) {
- if (!num || commandBuffer.empty()) return;
-
- if (num < 0) {
- num = -num;
- if (num > commandCursorPos) num = commandCursorPos;
- commandCursorPos -= num;
- } else {
- if ((num + commandCursorPos) > static_cast<int>(commandBuffer.size()))
- num = commandBuffer.size() - commandCursorPos;
- }
-
- commandBuffer.erase(commandCursorPos, num);
+ // DEPRECATED
}
void Console::MoveCommandCursor(int num) {
- commandCursorPos += num;
-
- if (commandCursorPos < 0) commandCursorPos = 0;
- if (commandCursorPos > static_cast<int>(commandBuffer.size())) commandCursorPos = static_cast<int>(commandBuffer.size());
+ // DEPRECATED
}
/*
@@ -768,8 +608,8 @@ void Console::DrawConsole(RenderSurface *surf, int height) {
//putchar ('\n');
}
- const char *com = commandBuffer.c_str();
- int com_size = commandBuffer.size();
+ const char *com = "";
+ int com_size = 0;
int cur_pos = commandCursorPos;
if (com_size >= (_lineWidth - 1)) {
diff --git a/engines/ultima/ultima8/misc/console.h b/engines/ultima/ultima8/misc/console.h
index 8c309b5..6dd29b5 100644
--- a/engines/ultima/ultima8/misc/console.h
+++ b/engines/ultima/ultima8/misc/console.h
@@ -328,27 +328,6 @@ public:
// Console Commands
//
- typedef istring ArgsType;
- typedef Std::vector<ArgsType> ArgvType;
- typedef void (*Function)(const ArgvType &argv);
-
- //! Add a command to the console
- //! \param command The command to add
- //! \param function Function pointer for command
- void AddConsoleCommand(const ArgsType &command, Console::Function function);
-
- //! Remove all commands associated with a function from the console
- //! \param function Function pointer for command
- void RemoveConsoleCommand(Console::Function function);
-
- //! Execute a specific console command
- //! \param command The command to execute with args
- void ExecuteConsoleCommand(const Console::ArgsType &args);
-
- //! Execute a specific console command
- //! \param command The command to execute with argv
- void ExecuteConsoleCommand(const Console::ArgvType &argv);
-
//! Execute the currently queued console command
void ExecuteCommandBuffer();
@@ -397,14 +376,9 @@ private:
void PrintPutchar();
// Console Commands
- ArgsType commandBuffer;
int commandCursorPos;
bool commandInsert;
- Std::vector<ArgsType> commandHistory;
int commandHistoryPos;
-
- typedef Common::HashMap<Common::String, Function> CommandsMap;
- CommandsMap ConsoleCommands;
};
// Console object
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index e13a111..52f6925 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -42,6 +42,7 @@
#include "ultima/ultima8/kernel/memory_manager.h"
#include "ultima/ultima8/kernel/object_manager.h"
#include "ultima/ultima8/misc/id_man.h"
+#include "ultima/ultima8/misc/util.h"
#include "ultima/ultima8/usecode/uc_machine.h"
#include "ultima/ultima8/usecode/bit_set.h"
#include "ultima/ultima8/world/world.h"
@@ -54,7 +55,13 @@
namespace Ultima {
namespace Ultima8 {
+Debugger *g_debugger;
+
Debugger::Debugger() : Shared::Debugger() {
+ g_debugger = this;
+
+ // WARNING: Not only can the methods below be executed directly in the debugger,
+ // they also act as the methods keybindings are made to. So be wary of changing names
registerCmd("quit", WRAP_METHOD(Debugger, cmdQuit));
registerCmd("Ultima8Engine::quit", WRAP_METHOD(Debugger, cmdQuit));
registerCmd("Ultima8Engine::saveGame", WRAP_METHOD(Debugger, cmdSaveGame));
@@ -159,6 +166,43 @@ Debugger::Debugger() : Shared::Debugger() {
#endif
}
+Debugger::~Debugger() {
+ g_debugger = nullptr;
+}
+
+
+void Debugger::executeCommand(const ArgsType &args) {
+ ArgvType argv;
+ StringToArgv(args, argv);
+
+ executeCommand(argv);
+}
+
+void Debugger::executeCommand(const ArgvType &argv) {
+ if (argv.empty())
+ return;
+
+ Common::String commandName = argv[0];
+ if (commandName.hasPrefix("GUIApp::"))
+ commandName = "Ultima8Engine::" + Common::String(commandName.c_str() + 8);
+
+ Common::Array<const char *> cArgs;
+ cArgs.push_back(commandName.c_str());
+ for (uint idx = 1; idx < argv.size(); ++idx)
+ cArgs.push_back(argv[idx].c_str());
+
+ bool keepRunning = false;
+ if (!handleCommand(argv.size(), &cArgs[0], keepRunning)) {
+ debugPrintf("Unknown command - %s\n", commandName.c_str());
+ keepRunning = true;
+ }
+
+ // If any message occurred, then we need to ensure the debugger is opened if it isn't already
+ if (keepRunning)
+ attach();
+}
+
+
bool Debugger::cmdSaveGame(int argc, const char **argv) {
if (argc == 2) {
// Save a _game with the given name into the quicksave slot
@@ -837,8 +881,8 @@ bool Debugger::cmdDecrementSortOrder(int argc, const char **argv) {
bool Debugger::cmdBind(int argc, const char **argv) {
- Console::ArgvType argv2;
- Console::ArgvType::const_iterator it;
+ Debugger::ArgvType argv2;
+ Debugger::ArgvType::const_iterator it;
if (argc < 3) {
debugPrintf("Usage: %s <key> <action> [<arg> ...]: binds a key or button to an action\n",
argv[0]);
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 29948d5..05d52c0 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -24,6 +24,7 @@
#define ULTIMA_ULTIMA8_ENGINE_DEBUGGER_H
#include "ultima/shared/engine/debugger.h"
+#include "ultima/shared/std/containers.h"
namespace Ultima {
namespace Ultima8 {
@@ -34,6 +35,9 @@ class Ultima1Engine;
* Debugger base class
*/
class Debugger : public Shared::Debugger {
+public:
+ typedef Common::String ArgsType;
+ typedef Std::vector<ArgsType> ArgvType;
private:
const char *strBool(bool flag) {
return flag ? "true" : "false";
@@ -156,9 +160,14 @@ private:
public:
Debugger();
- ~Debugger() override {}
+ ~Debugger() override;
+
+ void executeCommand(const ArgsType &args);
+ void executeCommand(const ArgvType &argv);
};
+extern Debugger *g_debugger;
+
} // End of namespace Ultima8
} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/misc/util.cpp b/engines/ultima/ultima8/misc/util.cpp
index 41397aa..f2d8033 100644
--- a/engines/ultima/ultima8/misc/util.cpp
+++ b/engines/ultima/ultima8/misc/util.cpp
@@ -97,6 +97,7 @@ template<class T> void StringToArgv(const T &args, Std::vector<T> &argv) {
template void StringToArgv<Std::string>(const Std::string &args, Std::vector<Std::string> &argv);
template void StringToArgv<istring>(const istring &args, Std::vector<istring> &argv);
+template void StringToArgv<Common::String>(const Common::String &args, Std::vector<Common::String> &argv);
template<class T> void ArgvToString(const Std::vector<T> &argv, T &args) {
// Clear the string
@@ -134,6 +135,7 @@ template<class T> void ArgvToString(const Std::vector<T> &argv, T &args) {
template void ArgvToString<Std::string>(const Std::vector<Std::string> &argv, Std::string &args);
template void ArgvToString<istring>(const Std::vector<istring> &argv, istring &args);
+template void ArgvToString<Common::String>(const Std::vector<Common::String> &argv, Common::String &args);
template<class T> void TrimSpaces(T &str) {
if (str.empty()) return;
diff --git a/gui/debugger.h b/gui/debugger.h
index fc74e49..a100aae 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -194,6 +194,13 @@ protected:
virtual void postEnter();
/**
+ * Process the given command line.
+ * Returns true if and only if argv[0] is a known command and was
+ * handled, false otherwise.
+ */
+ virtual bool handleCommand(int argc, const char **argv, bool &keepRunning);
+
+ /**
* Subclasses should invoke the detach() method in their cmdFOO methods
* if that command will resume execution of the program (as opposed to
* executing, say, a "single step through code" command).
@@ -214,13 +221,6 @@ private:
bool parseCommand(const char *input);
bool tabComplete(const char *input, Common::String &completion) const;
- /**
- * Process the given command line.
- * Returns true if and only if argv[0] is a known command and was
- * handled, false otherwise.
- */
- virtual bool handleCommand(int argc, const char **argv, bool &keepRunning);
-
protected:
bool cmdExit(int argc, const char **argv);
bool cmdHelp(int argc, const char **argv);
Commit: 667ce5afbd6e2157f47ae6d9e23d8fcbc0489bf8
https://github.com/scummvm/scummvm/commit/667ce5afbd6e2157f47ae6d9e23d8fcbc0489bf8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T09:52:20-08:00
Commit Message:
ULTIMA8: Remapping console calls to debug and warning
Changed paths:
engines/ultima/ultima8/audio/audio_mixer.cpp
engines/ultima/ultima8/audio/audio_process.cpp
engines/ultima/ultima8/conf/config_file_manager.cpp
engines/ultima/ultima8/conf/setting_manager.cpp
engines/ultima/ultima8/filesys/file_system.cpp
engines/ultima/ultima8/games/game_data.cpp
engines/ultima/ultima8/graphics/fonts/font_manager.cpp
engines/ultima/ultima8/graphics/palette_manager.cpp
engines/ultima/ultima8/kernel/core_app.cpp
engines/ultima/ultima8/kernel/hid_manager.cpp
engines/ultima/ultima8/kernel/kernel.cpp
engines/ultima/ultima8/kernel/memory_manager.cpp
engines/ultima/ultima8/kernel/object_manager.cpp
engines/ultima/ultima8/kernel/segmented_pool.cpp
engines/ultima/ultima8/misc/common_types.h
engines/ultima/ultima8/misc/console.cpp
engines/ultima/ultima8/misc/console.h
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/usecode/uc_machine.cpp
engines/ultima/ultima8/world/world.cpp
diff --git a/engines/ultima/ultima8/audio/audio_mixer.cpp b/engines/ultima/ultima8/audio/audio_mixer.cpp
index a4722a6..bde0aca 100644
--- a/engines/ultima/ultima8/audio/audio_mixer.cpp
+++ b/engines/ultima/ultima8/audio/audio_mixer.cpp
@@ -42,7 +42,7 @@ AudioMixer::AudioMixer(Audio::Mixer *mixer) : _mixer(mixer), _midiPlayer(0) {
for (int idx = 0; idx < CHANNEL_COUNT; ++idx)
_channels[idx] = new AudioChannel(_mixer, SAMPLE_RATE, true);
- con->Print(MM_INFO, "Creating AudioMixer...\n");
+ debugN(MM_INFO, "Creating AudioMixer...\n");
}
void AudioMixer::createProcesses() {
@@ -56,7 +56,7 @@ void AudioMixer::createProcesses() {
}
AudioMixer::~AudioMixer(void) {
- con->Print(MM_INFO, "Destroying AudioMixer...\n");
+ debugN(MM_INFO, "Destroying AudioMixer...\n");
closeMidiOutput();
diff --git a/engines/ultima/ultima8/audio/audio_process.cpp b/engines/ultima/ultima8/audio/audio_process.cpp
index 4472d7e..29ab8db 100644
--- a/engines/ultima/ultima8/audio/audio_process.cpp
+++ b/engines/ultima/ultima8/audio/audio_process.cpp
@@ -237,7 +237,6 @@ int AudioProcess::playSample(AudioSample *sample, int _priority, int _loops, uin
void AudioProcess::playSFX(int _sfxNum, int _priority, ObjId _objId, int _loops,
bool no_duplicates, uint32 _pitchShift, uint16 _volume,
int16 _lVol, int16 _rVol) {
- //con->Printf("playSFX(%i, %i, 0x%X, %i)\n", _sfxNum, _priority, _objId, _loops);
SoundFlex *soundflx = GameData::get_instance()->getSoundFlex();
@@ -281,8 +280,6 @@ void AudioProcess::playSFX(int _sfxNum, int _priority, ObjId _objId, int _loops,
}
void AudioProcess::stopSFX(int _sfxNum, ObjId _objId) {
- //con->Printf("stopSFX(%i, 0x%X)\n", _sfxNum, _objId);
-
AudioMixer *mixer = AudioMixer::get_instance();
Std::list<SampleInfo>::iterator it;
@@ -297,8 +294,6 @@ void AudioProcess::stopSFX(int _sfxNum, ObjId _objId) {
}
bool AudioProcess::isSFXPlaying(int _sfxNum) {
- //con->Printf("isSFXPlaying(%i)\n", _sfxNum);
-
Std::list<SampleInfo>::iterator it;
for (it = _sampleInfo.begin(); it != _sampleInfo.end(); ++it) {
if (it->_sfxNum == _sfxNum)
@@ -309,7 +304,6 @@ bool AudioProcess::isSFXPlaying(int _sfxNum) {
}
void AudioProcess::setVolumeSFX(int _sfxNum, uint8 _volume) {
- //con->Printf("setVolumeSFX(%i, %i)\n", _sfxNum, _volume);
AudioMixer *mixer = AudioMixer::get_instance();
Std::list<SampleInfo>::iterator it;
@@ -500,7 +494,6 @@ uint32 AudioProcess::I_playAmbientSFX(const uint8 *args, unsigned int argsize) {
_objId = objid_;
}
-// con->Printf("playAmbientSFX(%i, %i, 0x%X)\n", _sfxNum, _priority, objID);
AudioProcess *ap = AudioProcess::get_instance();
if (ap) ap->playSFX(_sfxNum, _priority, _objId, -1, true);
else perr << "Error: No AudioProcess" << Std::endl;
diff --git a/engines/ultima/ultima8/conf/config_file_manager.cpp b/engines/ultima/ultima8/conf/config_file_manager.cpp
index 6f1e40b..11bc5e4 100644
--- a/engines/ultima/ultima8/conf/config_file_manager.cpp
+++ b/engines/ultima/ultima8/conf/config_file_manager.cpp
@@ -29,13 +29,13 @@ using Std::string;
ConfigFileManager *ConfigFileManager::_configFileManager = 0;
ConfigFileManager::ConfigFileManager() {
- con->Print(MM_INFO, "Creating ConfigFileManager...\n");
+ debugN(MM_INFO, "Creating ConfigFileManager...\n");
_configFileManager = this;
}
ConfigFileManager::~ConfigFileManager() {
- con->Print(MM_INFO, "Destroying ConfigFileManager...\n");
+ debugN(MM_INFO, "Destroying ConfigFileManager...\n");
clear();
_configFileManager = 0;
diff --git a/engines/ultima/ultima8/conf/setting_manager.cpp b/engines/ultima/ultima8/conf/setting_manager.cpp
index a20f6f9..81918a1 100644
--- a/engines/ultima/ultima8/conf/setting_manager.cpp
+++ b/engines/ultima/ultima8/conf/setting_manager.cpp
@@ -27,7 +27,7 @@ namespace Ultima8 {
SettingManager *SettingManager::_settingManager = 0;
SettingManager::SettingManager() {
- con->Print(MM_INFO, "Creating SettingManager...\n");
+ debugN(MM_INFO, "Creating SettingManager...\n");
_settingManager = this;
@@ -39,7 +39,7 @@ SettingManager::SettingManager() {
}
SettingManager::~SettingManager() {
- con->Print(MM_INFO, "Destroying SettingManager...\n");
+ debugN(MM_INFO, "Destroying SettingManager...\n");
_settingManager = 0;
}
diff --git a/engines/ultima/ultima8/filesys/file_system.cpp b/engines/ultima/ultima8/filesys/file_system.cpp
index 9b0f4e9..518ad1a 100644
--- a/engines/ultima/ultima8/filesys/file_system.cpp
+++ b/engines/ultima/ultima8/filesys/file_system.cpp
@@ -37,14 +37,14 @@ FileSystem *FileSystem::_fileSystem = 0;
FileSystem::FileSystem(bool noforced)
: _noForcedVPaths(noforced), _allowDataOverride(true) {
- con->Print(MM_INFO, "Creating FileSystem...\n");
+ debugN(MM_INFO, "Creating FileSystem...\n");
_fileSystem = this;
AddVirtualPath("@home", "");
}
FileSystem::~FileSystem() {
- con->Print(MM_INFO, "Destroying FileSystem...\n");
+ debugN(MM_INFO, "Destroying FileSystem...\n");
_fileSystem = 0;
}
@@ -141,7 +141,7 @@ bool FileSystem::rawOpen(Common::WriteStream *&out, const string &fname) {
#if 0
if (!rewrite_virtual_path(name)) {
- con->Print_err(MM_MAJOR_WARN, "Illegal file access\n");
+ warning("Illegal file access");
return false;
}
@@ -202,18 +202,14 @@ bool FileSystem::AddVirtualPath(const string &vpath, const string &realpath, con
rp.erase(rp.rfind('/'));
if (rp.find("..") != string::npos) {
- con->Printf_err(MM_MINOR_ERR,
- "Error mounting virtual path \"%s\": \"..\" not allowed.\n",
- vp.c_str());
+ warning("Error mounting virtual path \"%s\": \"..\" not allowed", vp.c_str());
return false;
}
// Finding Reserved Virtual Path Names
// memory path is reserved
if (vp == "@memory" || vp.substr(0, 8) == "@memory/") {
- con->Printf_err(MM_MINOR_ERR,
- "Error mounting virtual path \"%s\": %s\"@memory\" is a reserved virtual path name.\n",
- vp.c_str());
+ warning("Error mounting virtual path \"%s\": %s\"@memory\" is a reserved virtual path name", vp.c_str());
return false;
}
@@ -221,15 +217,14 @@ bool FileSystem::AddVirtualPath(const string &vpath, const string &realpath, con
rewrite_virtual_path(fullpath);
// When mounting a memory file, it wont exist, so don't attempt to create the dir
#ifdef DEBUG
- con->Printf(MM_INFO, "virtual path \"%s\": %s\n", vp.c_str(), fullpath.c_str());
+ debugN(MM_INFO, "virtual path \"%s\": %s\n", vp.c_str(), fullpath.c_str());
#endif
if (!(fullpath.substr(0, 8) == "@memory/")) {
if (!IsDir(fullpath)) {
if (!create) {
#ifdef DEBUG
- con->Printf_err(MM_MINOR_WARN,
- "Problem mounting virtual path \"%s\": directory not found: %s\n",
- vp.c_str(), fullpath.c_str());
+ warning("Problem mounting virtual path \"%s\": directory not found: %s",
+ vp.c_str(), fullpath.c_str());
#endif
return false;
} else {
diff --git a/engines/ultima/ultima8/games/game_data.cpp b/engines/ultima/ultima8/games/game_data.cpp
index 4032133..327b0b1 100644
--- a/engines/ultima/ultima8/games/game_data.cpp
+++ b/engines/ultima/ultima8/games/game_data.cpp
@@ -53,13 +53,13 @@ GameData *GameData::_gameData = 0;
GameData::GameData(GameInfo *gameInfo)
: _fixed(0), _mainShapes(0), _mainUsecode(0), _globs(), _fonts(0), _gumps(0),
_mouse(0), _music(0), _weaponOverlay(0), _soundFlex(0), _speech(1024), _gameInfo(gameInfo) {
- con->Print(MM_INFO, "Creating GameData...\n");
+ debugN(MM_INFO, "Creating GameData...\n");
_gameData = this;
}
GameData::~GameData() {
- con->Print(MM_INFO, "Destroying GameData...\n");
+ debugN(MM_INFO, "Destroying GameData...\n");
delete _fixed;
_fixed = 0;
diff --git a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
index 69f2b1c..367417a 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
@@ -43,7 +43,7 @@ namespace Ultima8 {
FontManager *FontManager::_fontManager = 0;
FontManager::FontManager(bool ttf_antialiasing_) : _ttfAntialiasing(ttf_antialiasing_) {
- con->Print(MM_INFO, "Creating Font Manager...\n");
+ debugN(MM_INFO, "Creating Font Manager...\n");
_fontManager = this;
@@ -52,7 +52,7 @@ FontManager::FontManager(bool ttf_antialiasing_) : _ttfAntialiasing(ttf_antialia
}
FontManager::~FontManager() {
- con->Print(MM_INFO, "Destroying Font Manager...\n");
+ debugN(MM_INFO, "Destroying Font Manager...\n");
resetGameFonts();
diff --git a/engines/ultima/ultima8/graphics/palette_manager.cpp b/engines/ultima/ultima8/graphics/palette_manager.cpp
index 7644d67..1874178 100644
--- a/engines/ultima/ultima8/graphics/palette_manager.cpp
+++ b/engines/ultima/ultima8/graphics/palette_manager.cpp
@@ -34,20 +34,20 @@ PaletteManager *PaletteManager::_paletteManager = 0;
PaletteManager::PaletteManager(RenderSurface *rs)
: _renderSurface(rs) {
- con->Print(MM_INFO, "Creating PaletteManager...\n");
+ debugN(MM_INFO, "Creating PaletteManager...\n");
_paletteManager = this;
}
PaletteManager::~PaletteManager() {
reset();
- con->Print(MM_INFO, "Destroying PaletteManager...\n");
+ debugN(MM_INFO, "Destroying PaletteManager...\n");
_paletteManager = 0;
}
// Reset the Palette Manager
void PaletteManager::reset() {
- con->Print(MM_INFO, "Resetting PaletteManager...\n");
+ debugN(MM_INFO, "Resetting PaletteManager...\n");
for (unsigned int i = 0; i < _palettes.size(); ++i)
delete _palettes[i];
@@ -62,7 +62,7 @@ void PaletteManager::updatedFont(PalIndex index) {
// Reset all the transforms back to default
void PaletteManager::resetTransforms() {
- con->Print(MM_INFO, "Resetting Palette Transforms...\n");
+ debugN(MM_INFO, "Resetting Palette Transforms...\n");
int16 matrix[12];
getTransformMatrix(matrix, Transform_None);
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index 9a46cc7..0f67a5f 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -67,18 +67,6 @@ void CoreApp::startup() {
ParseArgs(0, 0);
- // if we're spitting out help, we probably want to avoid having the
- // other cruft dumped too...
- if (_oHelp) {
- _oQuiet = _oVQuiet = true;
- }
- if (_oQuiet)
- con->setMsgMask(static_cast<MsgMask>(MM_ALL & ~MM_INFO &
- ~MM_MINOR_WARN));
- if (_oVQuiet)
- con->setMsgMask(static_cast<MsgMask>(MM_ALL & ~MM_INFO & ~MM_MINOR_WARN
- & ~MM_MAJOR_WARN & ~MM_MINOR_ERR));
-
if (_oHelp) {
helpMe(); // Note: this is virtual
error("Startup failed");
@@ -145,7 +133,7 @@ void CoreApp::loadConfig() {
void CoreApp::setupGameList() {
Std::vector<istring> gamelist;
gamelist = _settingMan->listGames();
- con->Print(MM_INFO, "Scanning config file for games:\n");
+ debugN(MM_INFO, "Scanning config file for games:\n");
Std::vector<istring>::iterator iter;
istring gamename;
@@ -155,17 +143,17 @@ void CoreApp::setupGameList() {
bool detected = getGameInfo(game, info);
// output detected game info
- con->Printf(MM_INFO, "%s: ", game.c_str());
+ debugN(MM_INFO, "%s: ", game.c_str());
if (detected) {
// add game to games map
_games[game] = info;
Std::string details = info->getPrintDetails();
- con->Print(MM_INFO, details.c_str());
+ debugN(MM_INFO, details.c_str());
} else {
- con->Print(MM_INFO, "unknown, skipping");
+ debugN(MM_INFO, "unknown, skipping");
}
- con->Print(MM_INFO, "\n");
+ debugN(MM_INFO, "\n");
}
}
@@ -326,7 +314,7 @@ void CoreApp::setupGamePaths(GameInfo *ginfo) {
// I'd prefer them to be created when needed. (-wjp)
_fileSystem->AddVirtualPath("@work", work, true);
- con->Printf(MM_INFO, "U8 Workdir: %s\n", work.c_str()); //!!FIXME (u8)
+ debugN(MM_INFO, "U8 Workdir: %s\n", work.c_str()); //!!FIXME (u8)
// make sure we've got a minimal sane _fileSystem under there...
_fileSystem->MkDir("@work/usecode");
@@ -342,7 +330,7 @@ void CoreApp::setupGamePaths(GameInfo *ginfo) {
// force creation if it doesn't exist
_fileSystem->AddVirtualPath("@save", save, true);
- con->Printf(MM_INFO, "Savegame directory: %s\n", save.c_str());
+ debugN(MM_INFO, "Savegame directory: %s\n", save.c_str());
}
void CoreApp::ParseArgs(const int argc_, const char *const *const argv_) {
@@ -350,10 +338,10 @@ void CoreApp::ParseArgs(const int argc_, const char *const *const argv_) {
}
void CoreApp::helpMe() {
- con->Print("\t-h\t\t- quick help menu (this)\n");
- con->Print("\t-q\t\t- silence general logging messages\n");
- con->Print("\t-qq\t\t- silence general logging messages and\n\t\t\t non-critical warnings/errors\n");
- con->Print("\t--game {name}\t- select a game\n");
+ debug("\t-h\t\t- quick help menu (this)\n");
+ debug("\t-q\t\t- silence general logging messages\n");
+ debug("\t-qq\t\t- silence general logging messages and\n\t\t\t non-critical warnings/errors\n");
+ debug("\t--game {name}\t- select a game\n");
}
GameInfo *CoreApp::getGameInfo(istring game) const {
diff --git a/engines/ultima/ultima8/kernel/hid_manager.cpp b/engines/ultima/ultima8/kernel/hid_manager.cpp
index 4ebe582..b5e5a5a 100644
--- a/engines/ultima/ultima8/kernel/hid_manager.cpp
+++ b/engines/ultima/ultima8/kernel/hid_manager.cpp
@@ -35,14 +35,14 @@ HIDManager *HIDManager::_hidManager = 0;
HIDManager::HIDManager() {
_hidManager = this;
- con->Print(MM_INFO, "Creating HIDManager...\n");
+ debugN(MM_INFO, "Creating HIDManager...\n");
resetBindings();
}
HIDManager::~HIDManager() {
Std::vector<Debugger::ArgvType *>::iterator it;
- con->Print(MM_INFO, "Destroying HIDManager...\n");
+ debugN(MM_INFO, "Destroying HIDManager...\n");
for (it = _commands.begin(); it != _commands.end(); ++it) {
if (*it) {
@@ -85,7 +85,7 @@ void HIDManager::resetBindings() {
void HIDManager::loadBindings() {
Debugger::ArgsType args;
- con->Print(MM_INFO, "Loading HIDBindings...\n");
+ debugN(MM_INFO, "Loading HIDBindings...\n");
SettingManager *settings = SettingManager::get_instance();
KeyMap keys;
@@ -95,7 +95,7 @@ void HIDManager::loadBindings() {
KeyMap::iterator end = keys.end();
if (i == end) {
- con->Print(MM_INFO, "Loading default HIDBindings...\n");
+ debugN(MM_INFO, "Loading default HIDBindings...\n");
ConfigFileManager *config = ConfigFileManager::get_instance();
keys = config->listKeyValues("bindings/bindings");
i = keys.begin();
diff --git a/engines/ultima/ultima8/kernel/kernel.cpp b/engines/ultima/ultima8/kernel/kernel.cpp
index 2a3ceb3..dc5ecd4 100644
--- a/engines/ultima/ultima8/kernel/kernel.cpp
+++ b/engines/ultima/ultima8/kernel/kernel.cpp
@@ -35,7 +35,7 @@ namespace Ultima8 {
Kernel *Kernel::kernel = 0;
Kernel::Kernel() : loading(false) {
- con->Print(MM_INFO, "Creating Kernel...\n");
+ debugN(MM_INFO, "Creating Kernel...\n");
kernel = this;
pIDs = new idMan(1, 32766, 128);
@@ -48,7 +48,7 @@ Kernel::Kernel() : loading(false) {
Kernel::~Kernel() {
reset();
- con->Print(MM_INFO, "Destroying Kernel...\n");
+ debugN(MM_INFO, "Destroying Kernel...\n");
kernel = 0;
@@ -56,7 +56,7 @@ Kernel::~Kernel() {
}
void Kernel::reset() {
- con->Print(MM_INFO, "Resetting Kernel...\n");
+ debugN(MM_INFO, "Resetting Kernel...\n");
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
delete(*it);
diff --git a/engines/ultima/ultima8/kernel/memory_manager.cpp b/engines/ultima/ultima8/kernel/memory_manager.cpp
index 1e24b2a..bc8ec04 100644
--- a/engines/ultima/ultima8/kernel/memory_manager.cpp
+++ b/engines/ultima/ultima8/kernel/memory_manager.cpp
@@ -62,7 +62,7 @@ void *MemoryManager::_allocate(size_t size) {
// else
void *ptr = malloc(size);
#ifdef DEBUG
- con->Printf("MemoryManager::allocate - Allocated %d bytes to 0x%X\n", size, ptr);
+ debugN"MemoryManager::allocate - Allocated %d bytes to 0x%X\n", size, ptr);
#endif
return ptr;
@@ -80,7 +80,7 @@ void MemoryManager::_deallocate(void *ptr) {
}
#ifdef DEBUG
- con->Printf("MemoryManager::deallocate - deallocating memory at 0x%X\n", ptr);
+ debugN"MemoryManager::deallocate - deallocating memory at 0x%X\n", ptr);
#endif
// Pray!
free(ptr);
diff --git a/engines/ultima/ultima8/kernel/object_manager.cpp b/engines/ultima/ultima8/kernel/object_manager.cpp
index e3dce30..8674196 100644
--- a/engines/ultima/ultima8/kernel/object_manager.cpp
+++ b/engines/ultima/ultima8/kernel/object_manager.cpp
@@ -72,7 +72,7 @@ struct ObjectLoader {
};
ObjectManager::ObjectManager() {
- con->Print(MM_INFO, "Creating ObjectManager...\n");
+ debugN(MM_INFO, "Creating ObjectManager...\n");
objectmanager = this;
@@ -87,7 +87,7 @@ ObjectManager::ObjectManager() {
ObjectManager::~ObjectManager() {
reset();
- con->Print(MM_INFO, "Destroying ObjectManager...\n");
+ debugN(MM_INFO, "Destroying ObjectManager...\n");
objectmanager = 0;
@@ -96,7 +96,7 @@ ObjectManager::~ObjectManager() {
}
void ObjectManager::reset() {
- con->Print(MM_INFO, "Resetting ObjectManager...\n");
+ debugN(MM_INFO, "Resetting ObjectManager...\n");
unsigned int i;
diff --git a/engines/ultima/ultima8/kernel/segmented_pool.cpp b/engines/ultima/ultima8/kernel/segmented_pool.cpp
index 90b2077..e8fca8d 100644
--- a/engines/ultima/ultima8/kernel/segmented_pool.cpp
+++ b/engines/ultima/ultima8/kernel/segmented_pool.cpp
@@ -117,7 +117,7 @@ void *SegmentedPool::allocate(size_t size) {
node->nextFree = 0;
-// con->Printf("Allocating Node 0x%08X\n", node);
+// debugN"Allocating Node 0x%08X\n", node);
uint8 *p = reinterpret_cast<uint8 *>(node) +
OFFSET_ALIGN(sizeof(SegmentedPoolNode) + redzoneSize);
@@ -141,7 +141,7 @@ void SegmentedPool::deallocate(void *ptr) {
VALGRIND_MEMPOOL_FREE(_startOfPool, ptr);
VALGRIND_DISCARD(node->valgrind_handle);
-// con->Printf("Free Node 0x%08X\n", node);
+// debugN"Free Node 0x%08X\n", node);
if (isFull()) {
firstFree = node;
lastFree = node;
@@ -158,12 +158,12 @@ void SegmentedPool::printInfo() {
size_t max, min, total;
SegmentedPoolNode *node;
- con->Printf(" start address 0x%X\tend address 0x%X\tnodeOffset 0x%X\n",
- _startOfPool, _endOfPool, _nodeOffset);
- con->Printf(" _nodeCapacity %d b\n total _nodes %d\tfree _nodes %d\n",
- _nodeCapacity, _nodes, _freeNodeCount);
- con->Printf(" total memory: %d\tfree memory: %d\n",
- _nodeCapacity * _nodes, _nodeCapacity * _freeNodeCount);
+ debug(MM_INFO, "start address 0x%X\tend address 0x%X\tnodeOffset 0x%X",
+ _startOfPool, _endOfPool, _nodeOffset);
+ debug(MM_INFO, "_nodeCapacity %d b\n total _nodes %d\tfree _nodes %d",
+ _nodeCapacity, _nodes, _freeNodeCount);
+ debug(MM_INFO, "total memory: %d\tfree memory: %d",
+ _nodeCapacity * _nodes, _nodeCapacity * _freeNodeCount);
max = 0;
min = _nodeCapacity;
@@ -179,10 +179,10 @@ void SegmentedPool::printInfo() {
}
if (_nodes > _freeNodeCount) {
- con->Printf(" smallest node: %d b\tlargest node: %d b\taverage size: %d b\n",
- min, max, total / (_nodes - _freeNodeCount));
+ debug(MM_INFO, "smallest node: %d b\tlargest node: %d b\taverage size: %d b",
+ min, max, total / (_nodes - _freeNodeCount));
} else {
- con->Printf(" Empty pool!!!\n");
+ debug(MM_INFO, "Empty pool!!!");
}
}
diff --git a/engines/ultima/ultima8/misc/common_types.h b/engines/ultima/ultima8/misc/common_types.h
index ad4528f..44d0691 100644
--- a/engines/ultima/ultima8/misc/common_types.h
+++ b/engines/ultima/ultima8/misc/common_types.h
@@ -25,6 +25,28 @@
namespace Ultima {
namespace Ultima8 {
+
+enum {
+ /* Output no message(s). For obvious reasons this probably should never need to be used... */
+ MM_NONE = 0x00,
+ /* general informative messages like the `virtual path "@home"...` stuff.
+ non-critical and in the general case non-useful unless trying to debug a problem. */
+ MM_INFO = 0x01,
+ /* similar in urgency to a general message, except it's just noting a possible, though
+ unlikely problem. The:
+ `Error mounting virtual path "@data": directory not found: /usr/local/share/pentagram`
+ message would be a good example of this, I believe. */
+ MM_MINOR_WARN = 0x02,
+ /* "We had a problem, and we're trying to recover from it, hopefully successfully." */
+ MM_MINOR_ERR = 4,
+ /* A message noting that we encountered a significant problem and that we're going to
+ (hopefully!) gracefully terminate the engine... Probably though a call to
+ CoreApp::application->ForceQuit();
+ "We had a rather significant problem. Shutting down pentagram now..."
+ */
+ MM_MAJOR_ERR = 5,
+};
+
//
// {s,u}int{8,16,32,ptr}
//
diff --git a/engines/ultima/ultima8/misc/console.cpp b/engines/ultima/ultima8/misc/console.cpp
index 69ecf41..dd19b15 100644
--- a/engines/ultima/ultima8/misc/console.cpp
+++ b/engines/ultima/ultima8/misc/console.cpp
@@ -47,7 +47,7 @@ Console::Console() : _current(0), _xOff(0), _display(0), _lineWidth(-1),
_totalLines(0), _visLines(0), _wordWrap(true), _cr(false),
_putChar_count(0), _stdOutputEnabled(0xFFFFFFFF),
_stdout_redir(0), _stderr_redir(0), _conFont(0),
- _autoPaint(0), _msgMask(MM_ALL), _frameNum(0),
+ _autoPaint(0), _msgMask(0), _frameNum(0),
commandCursorPos(0), commandInsert(true), commandHistoryPos(0) {
con = this;
_lineWidth = -1;
@@ -367,7 +367,7 @@ void Console::Print(const char *txt) {
}
// Print a _text string to the console, and output to stdout, with message filtering
-void Console::Print(const MsgMask mm, const char *txt) {
+void Console::Print(const int mm, const char *txt) {
if (mm & _msgMask) Print(txt);
}
@@ -383,7 +383,7 @@ int32 Console::Printf(const char *fmt, ...) {
}
// printf, and output to stdout, with message filtering.
-int32 Console::Printf(const MsgMask mm, const char *fmt, ...) {
+int32 Console::Printf(const int mm, const char *fmt, ...) {
if (!(mm & _msgMask)) return 0;
va_list argptr;
@@ -445,7 +445,7 @@ void Console::Print_err(const char *txt) {
}
// Print a _text string to the console, and output to stderr, with message filtering
-void Console::Print_err(const MsgMask mm, const char *txt) {
+void Console::Print_err(const int mm, const char *txt) {
if (mm & _msgMask) Print_err(txt);
}
@@ -461,7 +461,7 @@ int32 Console::Printf_err(const char *fmt, ...) {
}
// printf, and output to stderr, with message filtering
-int32 Console::Printf_err(const MsgMask mm, const char *fmt, ...) {
+int32 Console::Printf_err(const int mm, const char *fmt, ...) {
if (!(mm & _msgMask)) return 0;
va_list argptr;
diff --git a/engines/ultima/ultima8/misc/console.h b/engines/ultima/ultima8/misc/console.h
index 6dd29b5..f918882 100644
--- a/engines/ultima/ultima8/misc/console.h
+++ b/engines/ultima/ultima8/misc/console.h
@@ -48,45 +48,6 @@ class ODataSource;
class RenderSurface;
struct FixedWidthFont;
-enum MsgMask {
- /* Output no message(s). For obvious reasons this probably should never need to be used... */
- MM_NONE = 0x00,
- /* general informative messages like the `virtual path "@home"...` stuff.
- non-critical and in the general case non-useful unless trying to debug a problem. */
- MM_INFO = 0x01,
- /* similar in urgency to a general message, except it's just noting a possible, though
- unlikely problem. The:
- `Error mounting virtual path "@data": directory not found: /usr/local/share/pentagram`
- message would be a good example of this, I believe. */
- MM_MINOR_WARN = 0x02,
- /* The compatriot to MINOR_WARN, this one effectively says "there's likely a problem here" */
- MM_MAJOR_WARN = 0x04,
- /* "We had a problem, and we're trying to recover from it, hopefully successfully." */
- MM_MINOR_ERR = 0x08,
- /* A message noting that we encountered a significant problem and that we're going to
- (hopefully!) gracefully terminate the engine... Probably though a call to
- CoreApp::application->ForceQuit();
- "We had a rather significant problem. Shutting down pentagram now..."
- */
- MM_MAJOR_ERR = 0x10,
- /* Significant failures that simply can't be recovered from, since there's either no way to
- recover, or it's likely we'll crash in the final execution of the main loop before everything
- shuts down.
- Effectively things you'll want to be calling `exit(-1);` on, immediately after issuing the
- warning. *grin* */
- MM_TERMINAL_ERR = 0x20,
- /* Displays no matter what the warning level. Only really useful to setup the relevant internal masks. */
- MM_ALL = 0x3F
- /* TODO:
- Thoughts:
- * Maybe there should be a MM_UNINPORTANT for MM_INFO messages that, whilst
- potentially useful, are useful in very, very rare circumstances...
- Would be turned on by a -v flag or something.
- * This is probably too detailed already though.
- */
-};
-
-
class ConsoleStream : public Common::WriteStream {
private:
Std::Precision _precision;
@@ -192,8 +153,9 @@ class Console {
void (*_autoPaint)(void);
- MsgMask _msgMask; // mask to determine which messages are printed or not
+ uint32 _int; // mask to determine which messages are printed or not
+ int _msgMask;
// Overlay timing
uint32 _frameNum;
uint32 _times[CON_NUM_TIMES]; // framenum the line was generated
@@ -263,11 +225,6 @@ public:
return _stdOutputEnabled;
}
- // sets what message types to ignore
- void setMsgMask(const MsgMask mm) {
- _msgMask = mm;
- }
-
void setFrameNum(uint32 f) {
_frameNum = f;
}
@@ -278,11 +235,11 @@ public:
// Print a text string to the console, and output to stdout
void Print(const char *txt);
- void Print(const MsgMask mm, const char *txt);
+ void Print(const int mm, const char *txt);
// printf, and output to stdout
int32 Printf(const char *fmt, ...);
- int32 Printf(const MsgMask mm, const char *fmt, ...); // with msg filtering
+ int32 Printf(const int mm, const char *fmt, ...); // with msg filtering
// printf, and output to stdout (va_list)
int32 vPrintf(const char *fmt, va_list);
@@ -300,11 +257,11 @@ public:
// Print a text string to the console, and output to stderr
void Print_err(const char *txt);
- void Print_err(const MsgMask mm, const char *txt);
+ void Print_err(const int mm, const char *txt);
// printf, and output to stderr
int32 Printf_err(const char *fmt, ...);
- int32 Printf_err(const MsgMask mm, const char *fmt, ...);
+ int32 Printf_err(const int mm, const char *fmt, ...);
// printf, and output to stderr (va_list)
int32 vPrintf_err(const char *fmt, va_list);
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 19196ce..39b832c 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -310,9 +310,9 @@ void Ultima8Engine::startupGame() {
// system-wide config
if (_configFileMan->readConfigFile(bindingsfile,
"bindings", true))
- con->Printf(MM_INFO, "%s... Ok\n", bindingsfile.c_str());
+ debugN(MM_INFO, "%s... Ok\n", bindingsfile.c_str());
else
- con->Printf(MM_MINOR_WARN, "%s... Failed\n", bindingsfile.c_str());
+ debugN(MM_MINOR_WARN, "%s... Failed\n", bindingsfile.c_str());
}
_hidManager->loadBindings();
@@ -437,24 +437,24 @@ void Ultima8Engine::shutdownGame(bool reloading) {
Rect dims;
_screen->GetSurfaceDims(dims);
- con->Print(MM_INFO, "Creating Desktop...\n");
+ debugN(MM_INFO, "Creating Desktop...\n");
_desktopGump = new DesktopGump(0, 0, dims.w, dims.h);
_desktopGump->InitGump(0);
_desktopGump->MakeFocus();
- con->Print(MM_INFO, "Creating _scalerGump...\n");
+ debugN(MM_INFO, "Creating _scalerGump...\n");
_scalerGump = new ScalerGump(0, 0, dims.w, dims.h);
_scalerGump->InitGump(0);
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
- con->Print(MM_INFO, "Creating Graphics Console...\n");
+ debugN(MM_INFO, "Creating Graphics Console...\n");
_consoleGump = new ConsoleGump(0, 0, dims.w, dims.h);
_consoleGump->InitGump(0);
_consoleGump->HideConsole();
- con->Print(MM_INFO, "Creating Inverter...\n");
+ debugN(MM_INFO, "Creating Inverter...\n");
_inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
_inverterGump->InitGump(0);
@@ -696,7 +696,7 @@ void Ultima8Engine::GraphicSysInit() {
_screen = 0;
// Set Screen Resolution
- con->Printf(MM_INFO, "Setting Video Mode %dx%dx%d...\n", width, height, bpp);
+ debugN(MM_INFO, "Setting Video Mode %dx%dx%d...\n", width, height, bpp);
RenderSurface *new_screen = RenderSurface::SetVideoMode(width, height, bpp);
@@ -718,19 +718,19 @@ void Ultima8Engine::GraphicSysInit() {
}
// setup normal mouse cursor
- con->Print(MM_INFO, "Loading Default Mouse Cursor...\n");
+ debugN(MM_INFO, "Loading Default Mouse Cursor...\n");
_mouse->setup();
Std::string alt_confont;
bool confont_loaded = false;
if (_settingMan->get("console_font", alt_confont)) {
- con->Print(MM_INFO, "Alternate console font found...\n");
+ debugN(MM_INFO, "Alternate console font found...\n");
confont_loaded = LoadConsoleFont(alt_confont);
}
if (!confont_loaded) {
- con->Print(MM_INFO, "Loading default console font...\n");
+ debugN(MM_INFO, "Loading default console font...\n");
if (!LoadConsoleFont("@data/fixedfont.ini")) {
error("Failed to load console font. Exiting");
}
@@ -789,7 +789,7 @@ void Ultima8Engine::changeVideoMode(int width, int height) {
bool Ultima8Engine::LoadConsoleFont(Std::string confontini) {
// try to load the file
- con->Printf(MM_INFO, "Loading console font config: %s... ", confontini.c_str());
+ debugN(MM_INFO, "Loading console font config: %s... ", confontini.c_str());
if (_configFileMan->readConfigFile(confontini, "confont", true))
pout << "Ok" << Std::endl;
else {
@@ -1157,7 +1157,7 @@ Common::Error Ultima8Engine::saveGameStream(Common::WriteStream *stream, bool is
}
void Ultima8Engine::resetEngine() {
- con->Print(MM_INFO, "-- Resetting Engine --\n");
+ debugN(MM_INFO, "-- Resetting Engine --\n");
// kill music
if (_audioMixer) _audioMixer->reset();
@@ -1193,37 +1193,37 @@ void Ultima8Engine::resetEngine() {
_saveCount = 0;
_hasCheated = false;
- con->Print(MM_INFO, "-- Engine Reset --\n");
+ debugN(MM_INFO, "-- Engine Reset --\n");
}
void Ultima8Engine::setupCoreGumps() {
- con->Print(MM_INFO, "Setting up core _game gumps...\n");
+ debugN(MM_INFO, "Setting up core _game gumps...\n");
Rect dims;
_screen->GetSurfaceDims(dims);
- con->Print(MM_INFO, "Creating Desktop...\n");
+ debugN(MM_INFO, "Creating Desktop...\n");
_desktopGump = new DesktopGump(0, 0, dims.w, dims.h);
_desktopGump->InitGump(0);
_desktopGump->MakeFocus();
- con->Print(MM_INFO, "Creating _scalerGump...\n");
+ debugN(MM_INFO, "Creating _scalerGump...\n");
_scalerGump = new ScalerGump(0, 0, dims.w, dims.h);
_scalerGump->InitGump(0);
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
- con->Print(MM_INFO, "Creating Graphics Console...\n");
+ debugN(MM_INFO, "Creating Graphics Console...\n");
_consoleGump = new ConsoleGump(0, 0, dims.w, dims.h);
_consoleGump->InitGump(0);
_consoleGump->HideConsole();
- con->Print(MM_INFO, "Creating Inverter...\n");
+ debugN(MM_INFO, "Creating Inverter...\n");
_inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
_inverterGump->InitGump(0);
- con->Print(MM_INFO, "Creating GameMapGump...\n");
+ debugN(MM_INFO, "Creating GameMapGump...\n");
_gameMapGump = new GameMapGump(0, 0, scaled_dims.w, scaled_dims.h);
_gameMapGump->InitGump(0);
@@ -1241,7 +1241,7 @@ void Ultima8Engine::setupCoreGumps() {
}
bool Ultima8Engine::newGame(int saveSlot) {
- con->Print(MM_INFO, "Starting New Game...\n");
+ debugN(MM_INFO, "Starting New Game...\n");
resetEngine();
@@ -1249,10 +1249,10 @@ bool Ultima8Engine::newGame(int saveSlot) {
_game->startGame();
- con->Print(MM_INFO, "Create Camera...\n");
+ debugN(MM_INFO, "Create Camera...\n");
CameraProcess::SetCameraProcess(new CameraProcess(1)); // Follow Avatar
- con->Print(MM_INFO, "Create persistent Processes...\n");
+ debugN(MM_INFO, "Create persistent Processes...\n");
_avatarMoverProcess = new AvatarMoverProcess();
_kernel->addProcess(_avatarMoverProcess);
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index 56dd1a0..011e71a 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -83,7 +83,7 @@ enum UCSegments {
UCMachine *UCMachine::_ucMachine = 0;
UCMachine::UCMachine(Intrinsic *iset, unsigned int icount) {
- con->Print(MM_INFO, "Creating UCMachine...\n");
+ debugN(MM_INFO, "Creating UCMachine...\n");
_ucMachine = this;
@@ -104,7 +104,7 @@ UCMachine::UCMachine(Intrinsic *iset, unsigned int icount) {
UCMachine::~UCMachine() {
- con->Print(MM_INFO, "Destroying UCMachine...\n");
+ debugN(MM_INFO, "Destroying UCMachine...\n");
_ucMachine = 0;
delete _globals;
@@ -118,7 +118,7 @@ UCMachine::~UCMachine() {
}
void UCMachine::reset() {
- con->Print(MM_INFO, "Resetting UCMachine\n");
+ debugN(MM_INFO, "Resetting UCMachine\n");
// clear _globals
_globals->setSize(0x1000);
diff --git a/engines/ultima/ultima8/world/world.cpp b/engines/ultima/ultima8/world/world.cpp
index b89e62f..590b870 100644
--- a/engines/ultima/ultima8/world/world.cpp
+++ b/engines/ultima/ultima8/world/world.cpp
@@ -51,14 +51,14 @@ namespace Ultima8 {
World *World::_world = 0;
World::World() : _currentMap(0) {
- con->Print(MM_INFO, "Creating World...\n");
+ debugN(MM_INFO, "Creating World...\n");
_world = this;
}
World::~World() {
- con->Print(MM_INFO, "Destroying World...\n");
+ debugN(MM_INFO, "Destroying World...\n");
clear();
_world = 0;
@@ -82,7 +82,7 @@ void World::clear() {
}
void World::reset() {
- con->Print(MM_INFO, "Resetting World...\n");
+ debugN(MM_INFO, "Resetting World...\n");
clear();
Commit: ad2ee92d62e2f3feef65a21680b5a85575994d87
https://github.com/scummvm/scummvm/commit/ad2ee92d62e2f3feef65a21680b5a85575994d87
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T09:52:20-08:00
Commit Message:
ULTIMA8: Move pout and perr to Debugger
Changed paths:
engines/ultima/ultima8/kernel/core_app.cpp
engines/ultima/ultima8/misc/console.cpp
engines/ultima/ultima8/misc/console.h
engines/ultima/ultima8/misc/debugger.cpp
engines/ultima/ultima8/misc/debugger.h
engines/ultima/ultima8/misc/pent_include.h
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index 0f67a5f..ebd13f7 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -27,6 +27,7 @@
#include "ultima/ultima8/conf/setting_manager.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/misc/args.h"
+#include "ultima/ultima8/misc/console.h"
#include "ultima/ultima8/games/game_info.h"
#include "ultima/shared/std/misc.h"
diff --git a/engines/ultima/ultima8/misc/console.cpp b/engines/ultima/ultima8/misc/console.cpp
index dd19b15..05e7c1c 100644
--- a/engines/ultima/ultima8/misc/console.cpp
+++ b/engines/ultima/ultima8/misc/console.cpp
@@ -36,9 +36,6 @@ namespace Ultima8 {
// The console
Console *con;
-// Console out/err pointers
-console_ostream<char> *ppout;
-console_err_ostream<char> *pperr;
//
// Constructor
@@ -56,9 +53,6 @@ Console::Console() : _current(0), _xOff(0), _display(0), _lineWidth(-1),
Std::memset(_times, 0, sizeof(_times));
- // Set output pointers
- ppout = &_strOut;
- pperr = &_errOut;
PrintInternal("Console initialized.\n");
}
@@ -69,9 +63,6 @@ Console::Console() : _current(0), _xOff(0), _display(0), _lineWidth(-1),
Console::~Console() {
// Need to do this first
PrintPutchar();
-
- ppout = nullptr;
- pperr = nullptr;
}
/*
diff --git a/engines/ultima/ultima8/misc/console.h b/engines/ultima/ultima8/misc/console.h
index f918882..aeb3065 100644
--- a/engines/ultima/ultima8/misc/console.h
+++ b/engines/ultima/ultima8/misc/console.h
@@ -48,77 +48,6 @@ class ODataSource;
class RenderSurface;
struct FixedWidthFont;
-class ConsoleStream : public Common::WriteStream {
-private:
- Std::Precision _precision;
-public:
- ConsoleStream() : Common::WriteStream(), _precision(Std::dec) {
- }
-
- int32 pos() const override {
- return 0;
- }
-
- void Print(const char *fmt, ...) {
- va_list argptr;
- va_start(argptr, fmt);
- Common::String str = Common::String::vformat(fmt, argptr);
- va_end(argptr);
-
- write(str.c_str(), str.size());
- }
-
- ConsoleStream &operator<<(const char *s) {
- write(s, strlen(s));
- return *this;
- }
-
- ConsoleStream &operator<<(const void *ptr) {
- Common::String str = Common::String::format("%p", ptr);
- write(str.c_str(), str.size());
- return *this;
- }
-
- ConsoleStream &operator<<(const Common::String &str) {
- write(str.c_str(), str.size());
- return *this;
- }
-
- ConsoleStream &operator<<(int val) {
- Common::String str = Common::String::format(
- (_precision == Std::hex) ? "%x" : "%d", val);
- write(str.c_str(), str.size());
- return *this;
- }
-};
-
-template<class T>
-class console_ostream : public ConsoleStream {
- uint32 write(const void *dataPtr, uint32 dataSize) override {
- Common::String str((const char *)dataPtr, (const char *)dataPtr + dataSize);
- debugN("%s", str.c_str());
- return dataSize;
- }
-};
-
-template<class T>
-class console_err_ostream : public ConsoleStream {
-public:
- uint32 write(const void *dataPtr, uint32 dataSize) override {
- Common::String str((const char *)dataPtr, dataSize);
- ::warning("%s", str.c_str());
- return str.size();
- }
-};
-
-// Standard Output Stream Object
-extern console_ostream<char> *ppout;
-// Error Output Stream Object
-extern console_err_ostream<char> *pperr;
-
-#define pout (*ppout)
-#define perr (*pperr)
-
class Console {
char _text[CON_TEXTSIZE];
@@ -139,11 +68,6 @@ class Console {
uint32 _stdOutputEnabled;
- // Standard Output Stream Object
- console_ostream<char> _strOut;
- // Error Output Stream Object
- console_err_ostream<char> _errOut;
-
// stdout and stderr redirection
ODataSource *_stdout_redir;
ODataSource *_stderr_redir;
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 52f6925..9134733 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -57,9 +57,17 @@ namespace Ultima8 {
Debugger *g_debugger;
+// Console out/err pointers
+console_ostream<char> *ppout;
+console_err_ostream<char> *pperr;
+
Debugger::Debugger() : Shared::Debugger() {
g_debugger = this;
+ // Set output pointers
+ ppout = &_strOut;
+ pperr = &_errOut;
+
// WARNING: Not only can the methods below be executed directly in the debugger,
// they also act as the methods keybindings are made to. So be wary of changing names
registerCmd("quit", WRAP_METHOD(Debugger, cmdQuit));
@@ -168,6 +176,8 @@ Debugger::Debugger() : Shared::Debugger() {
Debugger::~Debugger() {
g_debugger = nullptr;
+ ppout = nullptr;
+ pperr = nullptr;
}
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 05d52c0..8052abd 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -23,14 +23,91 @@
#ifndef ULTIMA_ULTIMA8_ENGINE_DEBUGGER_H
#define ULTIMA_ULTIMA8_ENGINE_DEBUGGER_H
+#include "ultima/ultima8/misc/common_types.h"
#include "ultima/shared/engine/debugger.h"
#include "ultima/shared/std/containers.h"
+#include "ultima/shared/std/misc.h"
+#include "common/debug.h"
+#include "common/stream.h"
namespace Ultima {
namespace Ultima8 {
class Ultima1Engine;
+
+class ConsoleStream : public Common::WriteStream {
+private:
+ Std::Precision _precision;
+public:
+ ConsoleStream() : Common::WriteStream(), _precision(Std::dec) {
+ }
+
+ int32 pos() const override {
+ return 0;
+ }
+
+ void Print(const char *fmt, ...) {
+ va_list argptr;
+ va_start(argptr, fmt);
+ Common::String str = Common::String::vformat(fmt, argptr);
+ va_end(argptr);
+
+ write(str.c_str(), str.size());
+ }
+
+ ConsoleStream &operator<<(const char *s) {
+ write(s, strlen(s));
+ return *this;
+ }
+
+ ConsoleStream &operator<<(const void *ptr) {
+ Common::String str = Common::String::format("%p", ptr);
+ write(str.c_str(), str.size());
+ return *this;
+ }
+
+ ConsoleStream &operator<<(const Common::String &str) {
+ write(str.c_str(), str.size());
+ return *this;
+ }
+
+ ConsoleStream &operator<<(int val) {
+ Common::String str = Common::String::format(
+ (_precision == Std::hex) ? "%x" : "%d", val);
+ write(str.c_str(), str.size());
+ return *this;
+ }
+};
+
+template<class T>
+class console_ostream : public ConsoleStream {
+ uint32 write(const void *dataPtr, uint32 dataSize) override {
+ Common::String str((const char *)dataPtr, (const char *)dataPtr + dataSize);
+ debugN(MM_INFO, "%s", str.c_str());
+ return dataSize;
+ }
+};
+
+template<class T>
+class console_err_ostream : public ConsoleStream {
+public:
+ uint32 write(const void *dataPtr, uint32 dataSize) override {
+ Common::String str((const char *)dataPtr, dataSize);
+ ::warning("%s", str.c_str());
+ return str.size();
+ }
+};
+
+// Standard Output Stream Object
+extern console_ostream<char> *ppout;
+// Error Output Stream Object
+extern console_err_ostream<char> *pperr;
+
+#define pout (*ppout)
+#define perr (*pperr)
+
+
/**
* Debugger base class
*/
@@ -39,10 +116,15 @@ public:
typedef Common::String ArgsType;
typedef Std::vector<ArgsType> ArgvType;
private:
+ // Standard Output Stream Object
+ console_ostream<char> _strOut;
+ // Error Output Stream Object
+ console_err_ostream<char> _errOut;
+private:
const char *strBool(bool flag) {
return flag ? "true" : "false";
}
-private:
+
// Engine
bool cmdSaveGame(int argc, const char **argv);
bool cmdLoadGame(int argc, const char **argv);
diff --git a/engines/ultima/ultima8/misc/pent_include.h b/engines/ultima/ultima8/misc/pent_include.h
index 5c5513c..1bea36b 100644
--- a/engines/ultima/ultima8/misc/pent_include.h
+++ b/engines/ultima/ultima8/misc/pent_include.h
@@ -51,10 +51,10 @@
//
-// The Console
+// The Debugger
//
-#include "ultima/ultima8/misc/console.h"
+#include "ultima/ultima8/misc/debugger.h"
//
Commit: c64617bdcde5e84a886b9899cdef43f19ae972fd
https://github.com/scummvm/scummvm/commit/c64617bdcde5e84a886b9899cdef43f19ae972fd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T09:52:21-08:00
Commit Message:
ULTIMA8: Completely remove old console and console gump
Changed paths:
R engines/ultima/ultima8/gumps/console_gump.cpp
R engines/ultima/ultima8/gumps/console_gump.h
R engines/ultima/ultima8/misc/console.cpp
R engines/ultima/ultima8/misc/console.h
engines/ultima/module.mk
engines/ultima/ultima8/gumps/desktop_gump.cpp
engines/ultima/ultima8/gumps/scaler_gump.cpp
engines/ultima/ultima8/kernel/core_app.cpp
engines/ultima/ultima8/kernel/core_app.h
engines/ultima/ultima8/kernel/hid_manager.cpp
engines/ultima/ultima8/kernel/object_manager.cpp
engines/ultima/ultima8/misc/common_types.h
engines/ultima/ultima8/misc/debugger.cpp
engines/ultima/ultima8/misc/debugger.h
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
engines/ultima/ultima8/usecode/uc_machine.cpp
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8b3e1cc..9c38076 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -396,7 +396,6 @@ MODULE_OBJS := \
ultima8/gumps/bark_gump.o \
ultima8/gumps/bind_gump.o \
ultima8/gumps/book_gump.o \
- ultima8/gumps/console_gump.o \
ultima8/gumps/container_gump.o \
ultima8/gumps/controls_gump.o \
ultima8/gumps/credits_gump.o \
@@ -447,7 +446,6 @@ MODULE_OBJS := \
ultima8/kernel/segmented_allocator.o \
ultima8/kernel/segmented_pool.o \
ultima8/misc/args.o \
- ultima8/misc/console.o \
ultima8/misc/debugger.o \
ultima8/misc/encoding.o \
ultima8/misc/id_man.o \
diff --git a/engines/ultima/ultima8/gumps/console_gump.cpp b/engines/ultima/ultima8/gumps/console_gump.cpp
deleted file mode 100644
index 48787d3..0000000
--- a/engines/ultima/ultima8/gumps/console_gump.cpp
+++ /dev/null
@@ -1,326 +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 "ultima/ultima8/misc/pent_include.h"
-#include "ultima/ultima8/gumps/console_gump.h"
-#include "ultima/ultima8/kernel/kernel.h"
-#include "ultima/ultima8/graphics/render_surface.h"
-#include "ultima/ultima8/filesys/idata_source.h"
-#include "ultima/ultima8/filesys/odata_source.h"
-#include "ultima/ultima8/ultima8.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-DEFINE_RUNTIME_CLASSTYPE_CODE(ConsoleGump, Gump)
-
-ConsoleGump::ConsoleGump() : Gump() {
-}
-
-ConsoleGump::ConsoleGump(int x, int y, int width, int height) :
- Gump(x, y, width, height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP, LAYER_CONSOLE),
- _scrollState(NORMAL_DISPLAY), _scrollFrame(8) {
- con->ClearCommandBuffer();
-
- // Resize it
- con->CheckResize(width);
-}
-
-ConsoleGump::~ConsoleGump() {
-}
-
-void ConsoleGump::RenderSurfaceChanged() {
- // Resize the desktop gump to match the RenderSurface
- Rect new_dims;
- _parent->GetDims(new_dims);
- con->CheckResize(new_dims.w);
- _dims.w = new_dims.w;
- _dims.h = new_dims.h;
-
- Gump::RenderSurfaceChanged();
-}
-
-void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
- int h = _dims.h;
- uint32 next_frame = _scrollFrame + 1;
- Gump::PaintThis(surf, lerp_factor, scaled);
-
- switch (_scrollState) {
- case NOTIFY_OVERLAY:
-#ifdef DEBUG
- con->DrawConsoleNotify(surf);
-#endif
- return;
- case WAITING_TO_SHOW:
- return;
-
- case SCROLLING_TO_HIDE:
- if (_scrollFrame == 0)
- return;
- // Just reverse next_frame
- next_frame = _scrollFrame - 1;
- // Intentional fall-through
-
- case SCROLLING_TO_SHOW:
- if (next_frame > 8)
- break;
-
- // Take in part from Item::doLerp()
- if (lerp_factor == 256)
- h = (h * next_frame) >> 3;
- else if (lerp_factor == 0)
- h = (h * _scrollFrame) >> 3;
- else
- h = (h * ((_scrollFrame * (256 - lerp_factor))
- + (next_frame * lerp_factor))) >> 11;
-
- if (h > _dims.h)
- h = _dims.h;
- else if (h < 0)
- h = 0;
- default:
- break;
- }
-
- //surf->FillBlended(0x60000000,0,0,_dims.w,h);
-
- // This line shows some draw lag when uncommented
- //surf->Fill32(0x00FFFFFF,0,h-1,_dims.w,h);
- con->DrawConsole(surf, h);
-}
-
-void ConsoleGump::ToggleConsole() {
- switch (_scrollState) {
- case WAITING_TO_HIDE:
- case SCROLLING_TO_HIDE:
- _scrollState = SCROLLING_TO_SHOW;
- break;
-
- case NOTIFY_OVERLAY:
- _scrollState = WAITING_TO_SHOW;
- break;
-
- case WAITING_TO_SHOW:
- case SCROLLING_TO_SHOW:
- _scrollState = SCROLLING_TO_HIDE;
- break;
-
- case NORMAL_DISPLAY:
- _scrollState = WAITING_TO_HIDE;
- Ultima8Engine::get_instance()->leaveTextMode(this);
- con->ClearCommandBuffer();
- break;
-
- default:
- break;
- }
-}
-
-
-void ConsoleGump::HideConsole() {
- switch (_scrollState) {
- case WAITING_TO_SHOW:
- case SCROLLING_TO_SHOW:
- _scrollState = SCROLLING_TO_HIDE;
- break;
-
- case NORMAL_DISPLAY:
- _scrollState = WAITING_TO_HIDE;
- Ultima8Engine::get_instance()->leaveTextMode(this);
- con->ClearCommandBuffer();
- break;
-
- default:
- break;
- }
-}
-
-
-void ConsoleGump::ShowConsole() {
- switch (_scrollState) {
- case WAITING_TO_HIDE:
- case SCROLLING_TO_HIDE:
- _scrollState = SCROLLING_TO_SHOW;
- break;
-
- case NOTIFY_OVERLAY:
- _scrollState = WAITING_TO_SHOW;
- break;
-
- default:
- break;
- }
-}
-
-bool ConsoleGump::ConsoleIsVisible() {
- return _scrollState != NOTIFY_OVERLAY;
-}
-
-void ConsoleGump::run() {
- Gump::run();
-
- con->setFrameNum(Kernel::get_instance()->getFrameNum());
-
- switch (_scrollState) {
- case WAITING_TO_HIDE:
- _scrollState = SCROLLING_TO_HIDE;
- break;
-
- case SCROLLING_TO_HIDE:
- if (_scrollFrame > 0) {
- --_scrollFrame;
- break;
- }
- _scrollFrame = 0;
- _scrollState = NOTIFY_OVERLAY;
- break;
-
- case WAITING_TO_SHOW:
- _scrollState = SCROLLING_TO_SHOW;
- break;
-
- case SCROLLING_TO_SHOW:
- if (_scrollFrame < 8) {
- ++_scrollFrame;
- break;
- }
- _scrollFrame = 8;
- _scrollState = NORMAL_DISPLAY;
- Ultima8Engine::get_instance()->enterTextMode(this);
- con->ClearCommandBuffer();
- break;
-
- default:
- break;
- }
-}
-
-void ConsoleGump::saveData(ODataSource *ods) {
- CANT_HAPPEN_MSG("Trying to save ConsoleGump");
-}
-
-bool ConsoleGump::loadData(IDataSource *ids, uint32 version) {
- CANT_HAPPEN_MSG("Trying to save ConsoleGump");
-
- return false;
-}
-
-bool ConsoleGump::OnTextInput(int unicode) {
- bool handled = false;
- if (_scrollState == NORMAL_DISPLAY) {
-
- con->AddCharacterToCommandBuffer(unicode);
- handled = true;
- }
- return handled;
-}
-
-
-bool ConsoleGump::OnKeyDown(int key, int mod) {
- bool handled = false;
- if (_scrollState == NORMAL_DISPLAY) {
- switch (key) {
- // Command completion
- case Common::KEYCODE_TAB:
- con->AddCharacterToCommandBuffer(Console::Tab);
- break;
-
- case Common::KEYCODE_ESCAPE:
- ToggleConsole();
- break;
-
- case Common::KEYCODE_RETURN:
- case Common::KEYCODE_KP_ENTER:
- con->AddCharacterToCommandBuffer(Console::Enter);
- break;
-
- case Common::KEYCODE_BACKSPACE:
- con->DeleteCommandBufferChars(-1);
- break;
-
- case Common::KEYCODE_DELETE:
- con->DeleteCommandBufferChars(1);
- break;
-
- case Common::KEYCODE_PAGEUP:
- con->ScrollConsole(-3);
- break;
-
- case Common::KEYCODE_PAGEDOWN:
- con->ScrollConsole(3);
- break;
-
- case Common::KEYCODE_UP:
- con->ScrollCommandHistory(-1);
- break;
-
- case Common::KEYCODE_DOWN:
- con->ScrollCommandHistory(1);
- break;
-
- case Common::KEYCODE_LEFT:
- con->MoveCommandCursor(-1);
- break;
-
- case Common::KEYCODE_RIGHT:
- con->MoveCommandCursor(1);
- break;
-
- case Common::KEYCODE_INSERT:
- con->ToggleCommandInsert();
- break;
-
- case Common::KEYCODE_KP0:
- case Common::KEYCODE_KP1:
- case Common::KEYCODE_KP2:
- case Common::KEYCODE_KP3:
- case Common::KEYCODE_KP4:
- case Common::KEYCODE_KP5:
- case Common::KEYCODE_KP6:
- case Common::KEYCODE_KP7:
- case Common::KEYCODE_KP8:
- case Common::KEYCODE_KP9:
- OnTextInput(key - Common::KEYCODE_KP0 + '0');
- break;
-
- default:
- break;
- }
- handled = true;
- }
- return handled;
-}
-
-void ConsoleGump::OnFocus(bool gain) {
- /*
- if (_scrollState == NORMAL_DISPLAY) {
- if (gain)
- Ultima8Engine::get_instance()->enterTextMode(this);
- else
- Ultima8Engine::get_instance()->leaveTextMode(this);
- }
- */
-
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/gumps/console_gump.h b/engines/ultima/ultima8/gumps/console_gump.h
deleted file mode 100644
index 3353b3f..0000000
--- a/engines/ultima/ultima8/gumps/console_gump.h
+++ /dev/null
@@ -1,83 +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 ULTIMA8_GUMPS_CONSOLEGUMP_H
-#define ULTIMA8_GUMPS_CONSOLEGUMP_H
-
-#include "ultima/ultima8/gumps/gump.h"
-#include "ultima/ultima8/misc/p_dynamic_cast.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-class ConsoleGump : public Gump {
- enum ConsoleScrollState {
- NORMAL_DISPLAY,
- WAITING_TO_HIDE,
- SCROLLING_TO_HIDE,
- NOTIFY_OVERLAY,
- WAITING_TO_SHOW,
- SCROLLING_TO_SHOW
- };
-
- ConsoleScrollState _scrollState;
- uint32 _scrollFrame;
-
-public:
- ENABLE_RUNTIME_CLASSTYPE()
-
- ConsoleGump();
- ConsoleGump(int x, int y, int w, int h);
- ~ConsoleGump() override;
-
- void ToggleConsole();
- void ShowConsole();
- void HideConsole();
- bool ConsoleIsVisible();
-
- // ConsoleGump doesn't have any 'effective' area
- bool PointOnGump(int mx, int my) override {
- return false;
- }
-
- void run() override;
-
- void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
-
- void RenderSurfaceChanged() override;
-
- bool OnTextInput(int unicode) override;
- void OnFocus(bool /*gain*/) override;
- bool OnKeyDown(int key, int mod) override;
-
- bool loadData(IDataSource *ids, uint32 version);
-
-protected:
- void saveData(ODataSource *ods) override;
-
-private:
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index 4aec2ab..4cc5c49 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -26,7 +26,6 @@
#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
-#include "ultima/ultima8/gumps/console_gump.h"
#include "ultima/ultima8/gumps/modal_gump.h"
#include "ultima/ultima8/gumps/target_gump.h"
@@ -50,14 +49,6 @@ DesktopGump::~DesktopGump(void) {
}
void DesktopGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
- // Just fill it (only if console showing, or in debug mode)
-
-#ifndef DEBUG
- ConsoleGump *console = Ultima8Engine::get_instance()->getConsoleGump();
- if (console->ConsoleIsVisible() || (_children.size() && _children.front()->IsOfType<ConsoleGump>()))
-#endif
- surf->Fill32(0x000000, 0, 0, _dims.w, _dims.h);
- //surf->Fill32(0x3f3f3f, 0, 0, _dims.w, _dims.h);
}
void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
diff --git a/engines/ultima/ultima8/gumps/scaler_gump.cpp b/engines/ultima/ultima8/gumps/scaler_gump.cpp
index 797f755..582c194 100644
--- a/engines/ultima/ultima8/gumps/scaler_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scaler_gump.cpp
@@ -35,12 +35,13 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ScalerGump, DesktopGump)
ScalerGump::ScalerGump(int32 x, int32 y, int32 width, int32 height) :
- DesktopGump(x, y, width, height),
- _swidth1(width), _sheight1(height), _scaler1(0), _buffer1(0),
- _swidth2(width), _sheight2(height), _scaler2(0), _buffer2(0),
- _width(width), _height(height) {
+ DesktopGump(x, y, width, height),
+ _swidth1(width), _sheight1(height), _scaler1(0), _buffer1(0),
+ _swidth2(width), _sheight2(height), _scaler2(0), _buffer2(0),
+ _width(width), _height(height) {
setupScaling();
+ _buffer1->Fill32(0, 0, 0, _dims.w, _dims.h);
}
ScalerGump::~ScalerGump() {
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index ebd13f7..4a634f8 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -27,7 +27,6 @@
#include "ultima/ultima8/conf/setting_manager.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/misc/args.h"
-#include "ultima/ultima8/misc/console.h"
#include "ultima/ultima8/games/game_info.h"
#include "ultima/shared/std/misc.h"
@@ -45,7 +44,6 @@ CoreApp::CoreApp(const Ultima::UltimaGameDescription *gameDesc)
: _gameDesc(gameDesc), _isRunning(false), _gameInfo(0), _fileSystem(0),
_configFileMan(0), _settingMan(0), _oHelp(false), _oQuiet(false), _oVQuiet(false) {
_application = this;
- _console = new Console();
}
CoreApp::~CoreApp() {
@@ -58,7 +56,6 @@ CoreApp::~CoreApp() {
FORGET_OBJECT(_settingMan);
FORGET_OBJECT(_configFileMan);
FORGET_OBJECT(_gameInfo);
- FORGET_OBJECT(_console);
_application = 0;
}
diff --git a/engines/ultima/ultima8/kernel/core_app.h b/engines/ultima/ultima8/kernel/core_app.h
index 7e62e27..15e3961 100644
--- a/engines/ultima/ultima8/kernel/core_app.h
+++ b/engines/ultima/ultima8/kernel/core_app.h
@@ -112,7 +112,6 @@ protected:
private:
const Ultima::UltimaGameDescription *_gameDesc;
- Console *_console;
//! start filesystem, kernel, config
virtual void sysInit();
diff --git a/engines/ultima/ultima8/kernel/hid_manager.cpp b/engines/ultima/ultima8/kernel/hid_manager.cpp
index b5e5a5a..52e1985 100644
--- a/engines/ultima/ultima8/kernel/hid_manager.cpp
+++ b/engines/ultima/ultima8/kernel/hid_manager.cpp
@@ -23,7 +23,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/kernel/hid_manager.h"
#include "ultima/ultima8/conf/setting_manager.h"
-#include "ultima/ultima8/misc/console.h"
#include "ultima/ultima8/misc/debugger.h"
#include "ultima/ultima8/misc/util.h"
#include "ultima/ultima8/conf/config_file_manager.h" // temporary!
@@ -77,9 +76,6 @@ void HIDManager::resetBindings() {
}
}
_commands.clear();
-
- bind(HID_BACKQUOTE, HID_EVENT_PREEMPT, "ConsoleGump::toggle");
- bind(HID_TILDE, HID_EVENT_PREEMPT, "ConsoleGump::toggle");
}
void HIDManager::loadBindings() {
diff --git a/engines/ultima/ultima8/kernel/object_manager.cpp b/engines/ultima/ultima8/kernel/object_manager.cpp
index 8674196..41ebb58 100644
--- a/engines/ultima/ultima8/kernel/object_manager.cpp
+++ b/engines/ultima/ultima8/kernel/object_manager.cpp
@@ -39,7 +39,6 @@
#include "ultima/ultima8/world/glob_egg.h"
#include "ultima/ultima8/gumps/game_map_gump.h"
#include "ultima/ultima8/gumps/desktop_gump.h"
-#include "ultima/ultima8/gumps/console_gump.h"
#include "ultima/ultima8/gumps/ask_gump.h"
#include "ultima/ultima8/gumps/bark_gump.h"
#include "ultima/ultima8/gumps/container_gump.h"
diff --git a/engines/ultima/ultima8/misc/common_types.h b/engines/ultima/ultima8/misc/common_types.h
index 44d0691..78802b7 100644
--- a/engines/ultima/ultima8/misc/common_types.h
+++ b/engines/ultima/ultima8/misc/common_types.h
@@ -26,25 +26,12 @@ namespace Ultima {
namespace Ultima8 {
-enum {
- /* Output no message(s). For obvious reasons this probably should never need to be used... */
- MM_NONE = 0x00,
- /* general informative messages like the `virtual path "@home"...` stuff.
- non-critical and in the general case non-useful unless trying to debug a problem. */
- MM_INFO = 0x01,
- /* similar in urgency to a general message, except it's just noting a possible, though
- unlikely problem. The:
- `Error mounting virtual path "@data": directory not found: /usr/local/share/pentagram`
- message would be a good example of this, I believe. */
- MM_MINOR_WARN = 0x02,
- /* "We had a problem, and we're trying to recover from it, hopefully successfully." */
- MM_MINOR_ERR = 4,
- /* A message noting that we encountered a significant problem and that we're going to
- (hopefully!) gracefully terminate the engine... Probably though a call to
- CoreApp::application->ForceQuit();
- "We had a rather significant problem. Shutting down pentagram now..."
- */
- MM_MAJOR_ERR = 5,
+enum DebugLevel {
+ // General info debug information
+ MM_INFO = 1,
+
+ // Minor warnings not important enough to show to the user normally
+ MM_MINOR_WARN = 1
};
//
diff --git a/engines/ultima/ultima8/misc/console.cpp b/engines/ultima/ultima8/misc/console.cpp
deleted file mode 100644
index 05e7c1c..0000000
--- a/engines/ultima/ultima8/misc/console.cpp
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
-Copyright (C) 1997-2001 Id Software, Inc.
-
-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.
-
-*/
-
-#include "ultima/ultima8/misc/console.h"
-#include "ultima/ultima8/misc/pent_include.h"
-#include "ultima/ultima8/filesys/odata_source.h"
-#include "ultima/ultima8/graphics/render_surface.h"
-#include "ultima/ultima8/misc/util.h"
-#include "ultima/ultima8/graphics/fonts/fixed_width_font.h"
-#include "ultima/shared/std/misc.h"
-#include "common/file.h"
-#include "common/debug.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-#define MAXPRINTMSG 4096
-
-// The console
-Console *con;
-
-
-//
-// Constructor
-//
-Console::Console() : _current(0), _xOff(0), _display(0), _lineWidth(-1),
- _totalLines(0), _visLines(0), _wordWrap(true), _cr(false),
- _putChar_count(0), _stdOutputEnabled(0xFFFFFFFF),
- _stdout_redir(0), _stderr_redir(0), _conFont(0),
- _autoPaint(0), _msgMask(0), _frameNum(0),
- commandCursorPos(0), commandInsert(true), commandHistoryPos(0) {
- con = this;
- _lineWidth = -1;
-
- CheckResize(0);
-
- Std::memset(_times, 0, sizeof(_times));
-
-
- PrintInternal("Console initialized.\n");
-}
-
-//
-// Destructor
-//
-Console::~Console() {
- // Need to do this first
- PrintPutchar();
-}
-
-/*
-================
-Con_Clear_f
-================
-*/
-void Console::Clear() {
- Std::memset(_text, ' ', CON_TEXTSIZE);
- _putChar_count = 0;
-}
-
-
-/*
-================
-Con_Dump_f
-
-Save the console contents out to a file
-================
-*/
-void Console::Dump(const char *name) {
- int l, x;
- char *line;
- Common::DumpFile f;
- char buffer[1024];
-
- // Need to do this first
- PrintPutchar();
-
- Printf("Dumped console _text to %s.\n", name);
-
- if (!f.open(name)) {
- Print("ERROR: couldn't open.\n");
- return;
- }
-
- // skip empty lines
- for (l = _current - _totalLines + 1 ; l <= _current ; l++) {
- line = _text + (l % _totalLines) * _lineWidth;
- for (x = 0 ; x < _lineWidth ; x++)
- if (line[x] != ' ')
- break;
- if (x != _lineWidth)
- break;
- }
-
- // write the remaining lines
- buffer[_lineWidth] = 0;
- for (; l <= _current ; l++) {
- line = _text + (l % _totalLines) * _lineWidth;
- Std::strncpy(buffer, line, _lineWidth);
- for (x = _lineWidth - 1 ; x >= 0 ; x--) {
- if (buffer[x] == ' ')
- buffer[x] = 0;
- else
- break;
- }
- for (x = 0; buffer[x]; x++)
- buffer[x] &= 0x7f;
-
- f.writeString(buffer);
- f.writeByte('\n');
- }
-
- f.close();
-}
-
-
-/*
-================
-Con_CheckResize
-
-If the line width has changed, reformat the buffer.
-================
-*/
-void Console::CheckResize(int scrwidth) {
- int i, j, width, oldwidth, oldtotallines, numlines, numchars;
- char tbuf[CON_TEXTSIZE];
-
- // Need to do this first
- PrintPutchar();
-
- if (!_conFont)
- width = (scrwidth >> 3) - 2;
- else
- width = (scrwidth / _conFont->_width) - 2;
-
- if (width == _lineWidth)
- return;
-
- if (width < 1) { // video hasn't been initialized yet
- width = 78;
- _lineWidth = width;
- _totalLines = CON_TEXTSIZE / _lineWidth;
- Std::memset(_text, ' ', CON_TEXTSIZE);
- } else {
- oldwidth = _lineWidth;
- _lineWidth = width;
- oldtotallines = _totalLines;
- _totalLines = CON_TEXTSIZE / _lineWidth;
- numlines = oldtotallines;
-
- if (_totalLines < numlines)
- numlines = _totalLines;
-
- numchars = oldwidth;
-
- if (_lineWidth < numchars)
- numchars = _lineWidth;
-
- Std::memcpy(tbuf, _text, CON_TEXTSIZE);
- Std::memset(_text, ' ', CON_TEXTSIZE);
-
- for (i = 0 ; i < numlines ; i++) {
- for (j = 0 ; j < numchars ; j++) {
- _text[(_totalLines - 1 - i) * _lineWidth + j] =
- tbuf[((_current - i + oldtotallines) %
- oldtotallines) * oldwidth + j];
- }
- }
- }
-
- _current = _totalLines - 1;
- _display = _current;
-}
-
-
-//
-// Internal Methods
-//
-
-// Print a _text string to the console
-void Console::PrintInternal(const char *txt) {
- int y;
- int c, l;
-
- // Need to do this first
- PrintPutchar();
-
- while (0 != (c = *txt)) {
- if (_wordWrap) {
- // count word length
- for (l = 0 ; l < _lineWidth ; l++)
- if (txt[l] <= ' ')
- break;
-
- // word wrap
- if (l != _lineWidth && (_xOff + l > _lineWidth))
- _xOff = 0;
- }
-
- txt++;
-
- if (_cr) {
- _current--;
- _cr = false;
- }
-
- if (!_xOff) {
- Linefeed();
- // mark time for transparent overlay
- if (_current >= 0) _times[_current % CON_NUM_TIMES] = _frameNum;
- }
-
- switch (c) {
- case '\n':
- _xOff = 0;
- break;
-
- case '\r':
- _xOff = 0;
- _cr = true;
- break;
-
- default: // _display character and advance
- y = _current % _totalLines;
- _text[y * _lineWidth + _xOff] = static_cast<char>(c);
- _xOff++;
- if (_xOff >= _lineWidth) _xOff = 0;
- break;
- }
-
- }
-}
-
-// Print a _text string to the console
-void Console::PrintRawInternal(const char *txt, int n) {
- int y;
- int c, l;
-
- // Need to do this first
- PrintPutchar();
-
- for (int i = 0; i < n; i++) {
- c = *txt;
-
- if (_wordWrap) {
- // count word length
- for (l = 0 ; l < _lineWidth && l < n; l++)
- if (txt[l] <= ' ') break;
-
- // word wrap
- if (l != _lineWidth && (_xOff + l > _lineWidth))
- _xOff = 0;
- }
-
- txt++;
-
- if (_cr) {
- _current--;
- _cr = false;
- }
-
- if (!_xOff) {
- Linefeed();
- // mark time for transparent overlay
- if (_current >= 0) _times[_current % CON_NUM_TIMES] = _frameNum;
- }
-
- switch (c) {
- case '\n':
- _xOff = 0;
- break;
-
- case '\r':
- _xOff = 0;
- _cr = true;
- break;
-
- default: // _display character and advance
- y = _current % _totalLines;
- _text[y * _lineWidth + _xOff] = static_cast<char>(c);
- _xOff++;
- if (_xOff >= _lineWidth) _xOff = 0;
- break;
- }
-
- }
-}
-
-// Add a linefeed to the buffer
-void Console::Linefeed(void) {
- _xOff = 0;
- _display++;
- _current++;
- Std::memset(&_text[(_current % _totalLines)*_lineWidth], ' ', _lineWidth);
-
- if (_autoPaint) _autoPaint();
-}
-
-// Print a _text string to the console
-void Console::PutcharInternal(int c) {
- // Add the character
- _putChar_buf[_putChar_count] = static_cast<char>(c);
-
- // Increment the counter
- _putChar_count++;
-
- // If it was a space or less, or we've hit the limit we'll add it to the
- // actual buffer
- if (c <= ' ' || _putChar_count == (CON_PUTCHAR_SIZE - 1)) PrintPutchar();
-}
-
-// Print the Putchar data, if possible
-void Console::PrintPutchar() {
- if (!_putChar_count) return;
-
- // Get the count
- //int count = _putChar_count; //Darke: UNUSED?
-
- // Terminate the string
- _putChar_buf[_putChar_count] = 0;
-
- // Clear the counter
- _putChar_count = 0;
-
- // Print it
- PrintInternal(_putChar_buf);
-}
-
-//
-// STDOUT Methods
-//
-
-// Print a _text string to the console, and output to stdout
-void Console::Print(const char *txt) {
- if (_stdOutputEnabled & CON_STDOUT)
- debug("%s", txt);
-
- if (_stdout_redir)
- _stdout_redir->write(txt, Std::strlen(txt));
- PrintInternal(txt);
-}
-
-// Print a _text string to the console, and output to stdout, with message filtering
-void Console::Print(const int mm, const char *txt) {
- if (mm & _msgMask) Print(txt);
-}
-
-// printf, and output to stdout
-int32 Console::Printf(const char *fmt, ...) {
- va_list argptr;
-
- va_start(argptr, fmt);
- int32 count = vPrintf(fmt, argptr);
- va_end(argptr);
-
- return count;
-}
-
-// printf, and output to stdout, with message filtering.
-int32 Console::Printf(const int mm, const char *fmt, ...) {
- if (!(mm & _msgMask)) return 0;
-
- va_list argptr;
-
- va_start(argptr, fmt);
- int32 count = vPrintf(fmt, argptr);
- va_end(argptr);
-
- return count;
-}
-
-// printf, and output to stdout (va_list)
-int32 Console::vPrintf(const char *fmt, va_list argptr) {
- Common::String str = Common::String::vformat(fmt, argptr);
-
- if (_stdOutputEnabled & CON_STDOUT) {
- debug("%s", str.c_str());
- }
-
- if (_stdout_redir)
- _stdout_redir->write(str.c_str(), str.size());
- PrintInternal(str.c_str());
-
- return str.size();
-}
-
-// Print a _text string to the console, and output to stdout
-void Console::PrintRaw(const char *txt, int n) {
- if (_stdOutputEnabled & CON_STDOUT) {
- Common::String str(txt, txt + n);
- debug("%s", str.c_str());
- }
-
- if (_stdout_redir) _stdout_redir->write(txt, n);
- PrintRawInternal(txt, n);
-}
-
-// putchar, and output to stdout
-void Console::Putchar(int c) {
- if (_stdOutputEnabled & CON_STDOUT)
- debug("%c", c);
-
- if (_stdout_redir) _stdout_redir->write1(c);
- PutcharInternal(c);
-}
-
-
-//
-// STDERR Methods
-//
-
-// Print a _text string to the console, and output to stderr
-void Console::Print_err(const char *txt) {
- if (_stdOutputEnabled & CON_STDERR)
- debug("%s", txt);
-
- if (_stderr_redir) _stderr_redir->write(txt, Std::strlen(txt));
- PrintInternal(txt);
-}
-
-// Print a _text string to the console, and output to stderr, with message filtering
-void Console::Print_err(const int mm, const char *txt) {
- if (mm & _msgMask) Print_err(txt);
-}
-
-// printf, and output to stderr
-int32 Console::Printf_err(const char *fmt, ...) {
- va_list argptr;
-
- va_start(argptr, fmt);
- int32 count = vPrintf_err(fmt, argptr);
- va_end(argptr);
-
- return count;
-}
-
-// printf, and output to stderr, with message filtering
-int32 Console::Printf_err(const int mm, const char *fmt, ...) {
- if (!(mm & _msgMask)) return 0;
-
- va_list argptr;
-
- va_start(argptr, fmt);
- int32 count = vPrintf_err(fmt, argptr);
- va_end(argptr);
-
- return count;
-}
-
-// printf, and output to stderr (va_list)
-int32 Console::vPrintf_err(const char *fmt, va_list argptr) {
- Common::String str = Common::String::format(fmt, argptr);
-
- if (_stdOutputEnabled & CON_STDERR)
- debug("%s", str.c_str());
-
- if (_stderr_redir)
- _stderr_redir->write(str.c_str(), str.size());
- PrintInternal(str.c_str());
-
- return str.size();
-}
-
-// Print a _text string to the console, and output to stderr
-void Console::PrintRaw_err(const char *txt, int n) {
- if (_stdOutputEnabled & CON_STDERR)
- debug("%d", n);
-
- if (_stderr_redir) _stderr_redir->write(txt, n);
- PrintRawInternal(txt, n);
-}
-
-// putchar, and output to stderr
-void Console::Putchar_err(int c) {
- if (_stdOutputEnabled & CON_STDERR)
- debug("%c", c);
-
- if (_stderr_redir) _stderr_redir->write1(c);
- PutcharInternal(c);
-}
-
-void Console::ScrollConsole(int32 lines) {
- _display += lines;
-
- if (_display < 0) _display = 0;
- if (_display > _current) _display = _current;
-}
-
-//
-// Console commands
-//
-
-void Console::ExecuteCommandBuffer() {
- // DEPRECATED
-}
-
-void Console::ScrollCommandHistory(int num) {
- // DEPRECATED
-}
-
-void Console::ClearCommandBuffer() {
- // DEPRECATED
-}
-
-void Console::AddCharacterToCommandBuffer(int ch) {
- // DEPRECATED
-}
-
-void Console::DeleteCommandBufferChars(int num) {
- // DEPRECATED
-}
-
-void Console::MoveCommandCursor(int num) {
- // DEPRECATED
-}
-
-/*
-==============================================================================
-
-DRAWING
-
-==============================================================================
-*/
-
-void Console::DrawConsole(RenderSurface *surf, int height) {
- int i, x, y;
- int rows;
- int row;
- int lines;
-/// char version[64];
-
- // Need to do this first
- PrintPutchar();
-
- lines = height;
- if (lines <= 0)
- return;
-
- //if (lines > viddef.height)
- // lines = viddef.height;
-
- //Com_sprintf (version, sizeof(version), "v%4.2f", VERSION);
- //for (x=0 ; x<5 ; x++)
- // re.DrawChar (viddef.width-44+x*8, lines-12, 128 + version[x] );
-
- // draw the _text
- _visLines = lines;
-
-#if 0
- rows = (lines - 8) >> 3; // rows of _text to draw
-
- y = lines - 24;
-#else
- rows = (lines / _conFont->_height) - 2; // rows of _text to draw
-
- y = lines - (_conFont->_height * 3);
-#endif
-
-// draw from the bottom up
- if (_display != _current) {
- // draw arrows to show the buffer is backscrolled
- for (x = 0 ; x < _lineWidth ; x += 4)
- surf->PrintCharFixed(_conFont, '^', (x + 1) * _conFont->_width, y);
-
- y -= _conFont->_height;
- rows--;
- }
-
- row = _display;
- for (i = 0 ; i < rows ; i++, y -= _conFont->_height, row--) {
- if (row < 0)
- break;
- if (_current - row >= _totalLines)
- break; // past scrollback wrap point
-
- char *txt = _text + (row % _totalLines) * _lineWidth;
-
- for (x = 0 ; x < _lineWidth ; x++) {
- surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->_width, y);
- // putchar (txt[x]);
- }
- //putchar ('\n');
- }
-
- const char *com = "";
- int com_size = 0;
- int cur_pos = commandCursorPos;
-
- if (com_size >= (_lineWidth - 1)) {
- com_size = cur_pos;
- }
-
- // prestep if horizontally scrolling
- if (com_size >= (_lineWidth - 1)) {
- com += 1 + com_size - (_lineWidth - 1);
- cur_pos = _lineWidth - 2;
- }
-
- y = lines - (_conFont->_height * 2);
-
- surf->PrintCharFixed(_conFont, ']', _conFont->_width, y);
-
- for (x = 0 ; x < (_lineWidth - 2) && com[x]; x++) {
- surf->PrintCharFixed(_conFont, com[x], (x + 2)*_conFont->_width, y);
- // putchar (txt[x]);
- }
-
- // Now for cursor position
- if (commandInsert)
- surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->_width) + 1, y, 2, _conFont->_height);
- else
- surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->_width) + 1, y + _conFont->_height - 2, _conFont->_width, 2);
-}
-
-
-void Console::DrawConsoleNotify(RenderSurface *surf) {
- int x, v;
- char *txt;
- int i;
- int time;
-
- v = 0;
- for (i = _current - CON_NUM_TIMES + 1 ; i <= _current ; i++) {
- if (i < 0) continue;
- time = con->_times[i % CON_NUM_TIMES];
- if (time == 0) continue;
-
- time = _frameNum - time;
- //if (time > con_notifytime->value*1000)
- if (time > 150) // Each message lasts 5 seconds (30*5=150 frames)
- continue;
- txt = _text + (i % _totalLines) * _lineWidth;
-
- for (x = 0 ; x < con->_lineWidth ; x++)
- surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->_width, v);
-
- v += _conFont->_height;
- }
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/misc/console.h b/engines/ultima/ultima8/misc/console.h
deleted file mode 100644
index aeb3065..0000000
--- a/engines/ultima/ultima8/misc/console.h
+++ /dev/null
@@ -1,271 +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 ULTIMA8_MISC_CONSOLE_H
-#define ULTIMA8_MISC_CONSOLE_H
-
-#include "ultima/ultima8/misc/istring.h"
-#include "ultima/shared/std/containers.h"
-#include "ultima/shared/std/misc.h"
-#include "common/debug.h"
-#include "common/hashmap.h"
-#include "common/file.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-//
-// The Console
-//
-#define CON_TEXTSIZE 32768
-#define CON_PUTCHAR_SIZE 256
-#define CON_NUM_TIMES 4
-
-// For Enable/Disable flags
-#define CON_STDOUT 0x01
-#define CON_STDERR 0x02
-
-class ODataSource;
-class RenderSurface;
-struct FixedWidthFont;
-
-
-class Console {
- char _text[CON_TEXTSIZE];
- int32 _current; // line where next message will be printed
- int32 _xOff; // offset in current line for next print
- int32 _display; // bottom of console displays this line
-
- int32 _lineWidth; // characters across screen
- int32 _totalLines; // total lines in console scrollback
-
- int32 _visLines;
-
- bool _wordWrap; // Enable/Disable word wrapping
- bool _cr; // Line feed marker
-
- int32 _putChar_count; // Number of characters that have been putchar'd
- char _putChar_buf[CON_PUTCHAR_SIZE]; // The Characters that have been putchar'd
-
- uint32 _stdOutputEnabled;
-
- // stdout and stderr redirection
- ODataSource *_stdout_redir;
- ODataSource *_stderr_redir;
-
- // Confont
- FixedWidthFont *_conFont;
-
- void (*_autoPaint)(void);
-
- uint32 _int; // mask to determine which messages are printed or not
-
- int _msgMask;
- // Overlay timing
- uint32 _frameNum;
- uint32 _times[CON_NUM_TIMES]; // framenum the line was generated
- // for transparent notify lines
-public:
- enum SpecialChars {
- Tab = '\t',
- Backspace = '\b',
- Enter = '\n'
- };
-
-
- Console();
- ~Console();
-
- // Clear the buffer
- void Clear();
-
- // Dump the buffer to a text file
- void Dump(const char *name);
-
- // Resize the console buffer (on screen change)
- void CheckResize(int scrwidth);
-
- // Draw the Console
- void DrawConsole(RenderSurface *surf, int height);
-
- // Draw the Console Notify Overlay
- void DrawConsoleNotify(RenderSurface *surf);
-
- // Set the console font texture
- void SetConFont(FixedWidthFont *cf) {
- _conFont = cf;
- }
-
- // Get the console font texture
- FixedWidthFont *GetConFont() {
- return _conFont;
- }
-
- // Autopaint will cause the GUIApp to re-paint everything after a linefeed
- void SetAutoPaint(void (*func)(void)) {
- _autoPaint = func;
- }
-
- // Scroll through the console. - is up + is down
- void ScrollConsole(int32 lines);
-
- // Redirection
- void RedirectOutputStream(uint32 mask, ODataSource *ds) {
- if (mask & CON_STDOUT) _stdout_redir = ds;
- if (mask & CON_STDERR) _stderr_redir = ds;
- }
-
- // Enabling output
- void setOutputEnabled(uint32 mask) {
- _stdOutputEnabled |= mask;
- }
-
- // Disabling output
- void unsetOutputEnabled(uint32 mask) {
- _stdOutputEnabled &= ~mask;
- }
-
- // Enabling output
- uint32 getOutputEnabled() {
- return _stdOutputEnabled;
- }
-
- void setFrameNum(uint32 f) {
- _frameNum = f;
- }
-
- //
- // STDOUT Methods
- //
-
- // Print a text string to the console, and output to stdout
- void Print(const char *txt);
- void Print(const int mm, const char *txt);
-
- // printf, and output to stdout
- int32 Printf(const char *fmt, ...);
- int32 Printf(const int mm, const char *fmt, ...); // with msg filtering
-
- // printf, and output to stdout (va_list)
- int32 vPrintf(const char *fmt, va_list);
-
- // putchar, and output to stdout
- void Putchar(int c);
-
- // Print a text string to the console, and output to stdout
- void PrintRaw(const char *txt, int n);
-
-
- //
- // STDERR Methods
- //
-
- // Print a text string to the console, and output to stderr
- void Print_err(const char *txt);
- void Print_err(const int mm, const char *txt);
-
- // printf, and output to stderr
- int32 Printf_err(const char *fmt, ...);
- int32 Printf_err(const int mm, const char *fmt, ...);
-
- // printf, and output to stderr (va_list)
- int32 vPrintf_err(const char *fmt, va_list);
-
- // putchar, and output to stderr
- void Putchar_err(int c);
-
- // Print a text string to the console, and output to stderr
- void PrintRaw_err(const char *txt, int n);
-
-
- // Enable/Disable word wrapping
- void EnableWordWrap() {
- _wordWrap = true;
- }
- void DisableWordWrap() {
- _wordWrap = false;
- }
-
- //
- // Console Commands
- //
-
- //! Execute the currently queued console command
- void ExecuteCommandBuffer();
-
- //! Scroll the command history
- //! \param num Number of commands to scroll through (neg numbers are older)
- void ScrollCommandHistory(int num);
-
- //! Clear the queued console command buffer
- void ClearCommandBuffer();
-
- //! Add a character to the Queued Console command input buffer
- //! \param ch Character to add.
- //! \note '\n' will execute the command
- //! \note '\t' will do command completion
- //! \note '\b' will do backspace
- void AddCharacterToCommandBuffer(int ch);
-
- //! Delete the character before or after the current cursor position
- //! \param num Number of chars to delete and direction (neg = left, pos = right)
- void DeleteCommandBufferChars(int num);
-
- //! Move the command input cursor
- //! \param num Number of chars to move by
- void MoveCommandCursor(int num);
-
- //! Toggle command input insert mode
- void ToggleCommandInsert() {
- commandInsert = !commandInsert;
- }
-
-private:
-
- // Print a text string to the console
- void PrintInternal(const char *txt);
-
- // Print a text string to the console
- void PrintRawInternal(const char *txt, int n);
-
- // Put char
- void PutcharInternal(int c);
-
- // Add a linefeed to the buffer
- void Linefeed();
-
- // Print the Putchar data, if possible
- void PrintPutchar();
-
- // Console Commands
- int commandCursorPos;
- bool commandInsert;
- int commandHistoryPos;
-};
-
-// Console object
-extern Console *con;
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 9134733..0f6ed9a 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -28,7 +28,6 @@
#include "ultima/ultima8/filesys/file_system.h"
#include "ultima/ultima8/filesys/raw_archive.h"
#include "ultima/ultima8/graphics/inverter_process.h"
-#include "ultima/ultima8/gumps/console_gump.h"
#include "ultima/ultima8/gumps/fast_area_vis_gump.h"
#include "ultima/ultima8/gumps/game_map_gump.h"
#include "ultima/ultima8/gumps/minimap_gump.h"
@@ -75,7 +74,6 @@ Debugger::Debugger() : Shared::Debugger() {
registerCmd("Ultima8Engine::saveGame", WRAP_METHOD(Debugger, cmdSaveGame));
registerCmd("Ultima8Engine::loadGame", WRAP_METHOD(Debugger, cmdLoadGame));
registerCmd("Ultima8Engine::newGame", WRAP_METHOD(Debugger, cmdNewGame));
- registerCmd("Ultima8Engine::_drawRenderStats", WRAP_METHOD(Debugger, cmdDrawRenderStats));
registerCmd("Ultima8Engine::engineStats", WRAP_METHOD(Debugger, cmdEngineStats));
registerCmd("Ultima8Engine::changeGame", WRAP_METHOD(Debugger, cmdChangeGame));
registerCmd("Ultima8Engine::listGames", WRAP_METHOD(Debugger, cmdListGames));
@@ -246,17 +244,6 @@ bool Debugger::cmdQuit(int argc, const char **argv) {
return true;
}
-bool Debugger::cmdDrawRenderStats(int argc, const char **argv) {
- if (argc == 1) {
- debugPrintf("Ultima8Engine::_drawRenderStats = %s",
- strBool(Ultima8Engine::get_instance()->_drawRenderStats));
- return true;
- } else {
- Ultima8Engine::get_instance()->_drawRenderStats = Std::strtol(argv[1], 0, 0) != 0;
- return false;
- }
-}
-
bool Debugger::cmdEngineStats(int argc, const char **argv) {
Kernel::get_instance()->kernelStats();
ObjectManager::get_instance()->objectStats();
@@ -1463,12 +1450,6 @@ bool Debugger::cmdStopTrace(int argc, const char **argv) {
#endif
-bool Debugger::cmdToggleConsole(int argc, const char **argv) {
- ConsoleGump *consoleGump = Ultima8Engine::get_instance()->getConsoleGump();
- consoleGump->ToggleConsole();
- return false;
-}
-
bool Debugger::cmdVerifyQuit(int argc, const char **argv) {
QuitGump::verifyQuit();
return false;
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 8052abd..8d44e31 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -133,7 +133,6 @@ private:
bool cmdChangeGame(int argc, const char **argv);
bool cmdListGames(int argc, const char **argv);
bool cmdSetVideoMode(int argc, const char **argv);
- bool cmdDrawRenderStats(int argc, const char **argv);
bool cmdEngineStats(int argc, const char **argv);
bool cmdToggleAvatarInStasis(int argc, const char **argv);
bool cmdTogglePaintEditorItems(int argc, const char **argv);
@@ -225,7 +224,6 @@ private:
#endif
// Miscellaneous
- bool cmdToggleConsole(int argc, const char **argv);
bool cmdToggleFastArea(int argc, const char **argv);
bool cmdVerifyQuit(int argc, const char **argv);
bool cmdU8ShapeViewer(int argc, const char **argv);
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 39b832c..a020834 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -55,7 +55,6 @@
#include "ultima/ultima8/filesys/savegame.h"
#include "ultima/ultima8/gumps/gump.h"
#include "ultima/ultima8/gumps/desktop_gump.h"
-#include "ultima/ultima8/gumps/console_gump.h"
#include "ultima/ultima8/gumps/game_map_gump.h"
#include "ultima/ultima8/gumps/inverter_gump.h"
#include "ultima/ultima8/gumps/scaler_gump.h"
@@ -122,11 +121,10 @@ Ultima8Engine::Ultima8Engine(OSystem *syst, const Ultima::UltimaGameDescription
Shared::UltimaEngine(syst, gameDesc), CoreApp(gameDesc), _saveCount(0), _game(0),
_kernel(0), _objectManager(0), _hidManager(0), _mouse(0), _ucMachine(0), _screen(0),
_fontManager(0), _paletteManager(0), _gameData(0), _world(0), _desktopGump(0),
- _consoleGump(0), _gameMapGump(0), _avatarMoverProcess(0), _frameSkip(false),
- _frameLimit(true), _interpolate(true), _animationRate(100), _avatarInStasis(false),
- _paintEditorItems(false), _inversion(0), _painting(false), _showTouching(false),
- _timeOffset(0), _hasCheated(false), _cheatsEnabled(false), _drawRenderStats(false),
- _ttfOverrides(false), _audioMixer(0) {
+ _gameMapGump(0), _avatarMoverProcess(0), _frameSkip(false), _frameLimit(true),
+ _interpolate(true), _animationRate(100), _avatarInStasis(false), _paintEditorItems(false),
+ _inversion(0), _painting(false), _showTouching(false), _timeOffset(0), _hasCheated(false),
+ _cheatsEnabled(false), _ttfOverrides(false), _audioMixer(0) {
_application = this;
for (uint16 key = 0; key < HID_LAST; ++key) {
@@ -180,9 +178,7 @@ void Ultima8Engine::deinitialize() {
}
void Ultima8Engine::startup() {
- // Set the console to auto paint, till we have finished initing
- con->SetAutoPaint(conAutoPaint);
-
+ setDebugger(new Debugger());
pout << "-- Initializing Pentagram -- " << Std::endl;
// parent's startup first
@@ -196,7 +192,6 @@ void Ultima8Engine::startup() {
_kernel = new Kernel();
_memoryManager = new MemoryManager();
- setDebugger(new Debugger());
//!! move this elsewhere
_kernel->addProcessLoader("DelayProcess",
@@ -284,16 +279,10 @@ void Ultima8Engine::startup() {
else
startupPentagramMenu();
- // Unset the console auto paint, since we have finished initing
- con->SetAutoPaint(0);
-
- // pout << "Paint Initial display" << Std::endl;
paint();
}
void Ultima8Engine::startupGame() {
- con->SetAutoPaint(conAutoPaint);
-
pout << Std::endl << "-- Initializing Game: " << _gameInfo->_name << " --" << Std::endl;
GraphicSysInit();
@@ -310,9 +299,9 @@ void Ultima8Engine::startupGame() {
// system-wide config
if (_configFileMan->readConfigFile(bindingsfile,
"bindings", true))
- debugN(MM_INFO, "%s... Ok\n", bindingsfile.c_str());
+ debug(MM_INFO, "%s... Ok", bindingsfile.c_str());
else
- debugN(MM_MINOR_WARN, "%s... Failed\n", bindingsfile.c_str());
+ debug(MM_MINOR_WARN, "%s... Failed", bindingsfile.c_str());
}
_hidManager->loadBindings();
@@ -352,9 +341,6 @@ void Ultima8Engine::startupGame() {
_game->loadFiles();
_gameData->setupFontOverrides();
- // Unset the console auto paint (can't have it from here on)
- con->SetAutoPaint(0);
-
// Create Midi Driver for Ultima 8
if (getGameInfo()->_type == GameInfo::GAME_U8)
_audioMixer->openMidiOutput();
@@ -362,14 +348,10 @@ void Ultima8Engine::startupGame() {
int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
newGame(saveSlot);
- _consoleGump->HideConsole();
-
pout << "-- Game Initialized --" << Std::endl << Std::endl;
}
void Ultima8Engine::startupPentagramMenu() {
- con->SetAutoPaint(conAutoPaint);
-
pout << Std::endl << "-- Initializing Pentagram Menu -- " << Std::endl;
setupGame(getGameInfo("pentagram"));
@@ -377,10 +359,6 @@ void Ultima8Engine::startupPentagramMenu() {
GraphicSysInit();
- // Unset the console auto paint, since we have finished initing
- con->SetAutoPaint(0);
- _consoleGump->HideConsole();
-
Rect dims;
_desktopGump->GetDims(dims);
@@ -419,7 +397,6 @@ void Ultima8Engine::shutdownGame(bool reloading) {
FORGET_OBJECT(_gameData);
_desktopGump = 0;
- _consoleGump = 0;
_gameMapGump = 0;
_scalerGump = 0;
_inverterGump = 0;
@@ -449,16 +426,9 @@ void Ultima8Engine::shutdownGame(bool reloading) {
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
- debugN(MM_INFO, "Creating Graphics Console...\n");
- _consoleGump = new ConsoleGump(0, 0, dims.w, dims.h);
- _consoleGump->InitGump(0);
- _consoleGump->HideConsole();
-
debugN(MM_INFO, "Creating Inverter...\n");
_inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
_inverterGump->InitGump(0);
-
- enterTextMode(_consoleGump);
}
}
@@ -586,13 +556,6 @@ void Ultima8Engine::runGame() {
}
}
-
-// conAutoPaint hackery
-void Ultima8Engine::conAutoPaint(void) {
- Ultima8Engine *app = Ultima8Engine::get_instance();
- if (app && !app->isPainting()) app->paint();
-}
-
// Paint the _screen
void Ultima8Engine::paint() {
static long prev = 0;
@@ -625,37 +588,6 @@ void Ultima8Engine::paint() {
// Draw the mouse
_mouse->paint();
- if (_drawRenderStats) {
- static long diff = 0;
- static long fps = 0;
- static long paintGumps = 0;
- char buf[256] = { '\0' };
- FixedWidthFont *confont = con->GetConFont();
- int v_offset = 0;
- int char_w = confont->_width;
-
- if (tdiff >= 250) {
- diff = tdiff / t;
- paintGumps = tpaint / t;
- fps = 1000 * t / tdiff;
- t = 0;
- tdiff = 0;
- tpaint = 0;
- }
-
- snprintf(buf, 255, "Rendering time %li ms %li FPS ", diff, fps);
- _screen->PrintTextFixed(confont, buf, dims.w - char_w * strlen(buf), v_offset);
- v_offset += confont->_height;
-
- snprintf(buf, 255, "Paint Gumps %li ms ", paintGumps);
- _screen->PrintTextFixed(confont, buf, dims.w - char_w * strlen(buf), v_offset);
- v_offset += confont->_height;
-
- snprintf(buf, 255, "t %02d:%02d gh %i ", I_getTimeInMinutes(0, 0), I_getTimeInSeconds(0, 0) % 60, I_getTimeInGameHours(0, 0));
- _screen->PrintTextFixed(confont, buf, dims.w - char_w * strlen(buf), v_offset);
- v_offset += confont->_height;
- }
-
// End _painting
_screen->EndPainting();
@@ -743,9 +675,6 @@ void Ultima8Engine::GraphicSysInit() {
_scalerGump = new ScalerGump(0, 0, width, height);
_scalerGump->InitGump(0);
- _consoleGump = new ConsoleGump(0, 0, width, height);
- _consoleGump->InitGump(0);
-
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
@@ -797,15 +726,6 @@ bool Ultima8Engine::LoadConsoleFont(Std::string confontini) {
return false;
}
- FixedWidthFont *confont = FixedWidthFont::Create("confont");
-
- if (!confont) {
- perr << "Failed to load Console Font." << Std::endl;
- return false;
- }
-
- con->SetConFont(confont);
-
return true;
}
@@ -1173,7 +1093,6 @@ void Ultima8Engine::resetEngine() {
// Reset thet gumps
_desktopGump = 0;
- _consoleGump = 0;
_gameMapGump = 0;
_scalerGump = 0;
_inverterGump = 0;
@@ -1214,11 +1133,6 @@ void Ultima8Engine::setupCoreGumps() {
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
- debugN(MM_INFO, "Creating Graphics Console...\n");
- _consoleGump = new ConsoleGump(0, 0, dims.w, dims.h);
- _consoleGump->InitGump(0);
- _consoleGump->HideConsole();
-
debugN(MM_INFO, "Creating Inverter...\n");
_inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
_inverterGump->InitGump(0);
@@ -1231,9 +1145,8 @@ void Ultima8Engine::setupCoreGumps() {
// TODO: clean this up
assert(_desktopGump->getObjId() == 256);
assert(_scalerGump->getObjId() == 257);
- assert(_consoleGump->getObjId() == 258);
- assert(_inverterGump->getObjId() == 259);
- assert(_gameMapGump->getObjId() == 260);
+ assert(_inverterGump->getObjId() == 258);
+ assert(_gameMapGump->getObjId() == 259);
for (uint16 i = 261; i < 384; ++i)
@@ -1455,8 +1368,8 @@ void Ultima8Engine::addGump(Gump *gump) {
assert(_desktopGump);
if (gump->IsOfType<ShapeViewerGump>() || gump->IsOfType<MiniMapGump>() ||
- gump->IsOfType<ConsoleGump>() || gump->IsOfType<ScalerGump>() ||
- gump->IsOfType<PentagramMenuGump>() || gump->IsOfType<MessageBoxGump>()// ||
+ gump->IsOfType<ScalerGump>() || gump->IsOfType<PentagramMenuGump>() ||
+ gump->IsOfType<MessageBoxGump>()// ||
//(_ttfOverrides && (gump->IsOfType<BarkGump>() ||
// gump->IsOfType<AskGump>()))
) {
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 7388fa1..2db3636 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -42,7 +42,6 @@
#include "ultima/ultima8/kernel/core_app.h"
#include "ultima/ultima8/kernel/mouse.h"
#include "ultima/ultima8/kernel/hid_keys.h"
-#include "ultima/ultima8/misc/console.h"
#include "ultima/ultima8/misc/p_dynamic_cast.h"
#include "ultima/ultima8/graphics/point_scaler.h"
#include "common/events.h"
@@ -59,7 +58,6 @@ class MemoryManager;
class UCMachine;
class Game;
class Gump;
-class ConsoleGump;
class GameMapGump;
class ScalerGump;
class InverterGump;
@@ -105,7 +103,6 @@ private:
FontManager *_fontManager;
Gump *_desktopGump;
- ConsoleGump *_consoleGump;
GameMapGump *_gameMapGump;
ScalerGump *_scalerGump;
InverterGump *_inverterGump;
@@ -134,7 +131,6 @@ private:
uint32 _lastDown[HID_LAST];
bool _down[HID_LAST];
unsigned int _inversion;
- bool _drawRenderStats;
private:
/**
* Does engine deinitialization
@@ -146,8 +142,6 @@ private:
*/
void showSplashScreen();
- static void conAutoPaint(void);
-
private:
//! write savegame info (time, ..., game-specifics)
void writeSaveInfo(ODataSource *ods);
@@ -264,9 +258,6 @@ public:
GameMapGump *getGameMapGump() {
return _gameMapGump;
}
- ConsoleGump *getConsoleGump() {
- return _consoleGump;
- }
Gump *getDesktopGump() {
return _desktopGump;
}
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index 011e71a..4e6be62 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -35,7 +35,6 @@
#include "ultima/ultima8/usecode/bit_set.h"
#include "ultima/ultima8/usecode/uc_list.h"
#include "ultima/ultima8/misc/id_man.h"
-#include "ultima/ultima8/gumps/console_gump.h"
#include "ultima/ultima8/world/get_object.h"
#define INCLUDE_CONVERTUSECODEU8_WITHOUT_BRINGING_IN_FOLD
Commit: a41de0df27567cdc7b151772bd650be5906b5b11
https://github.com/scummvm/scummvm/commit/a41de0df27567cdc7b151772bd650be5906b5b11
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-23T09:52:21-08:00
Commit Message:
ULTIMA8: Remove references to SDL, since it's no longer used
Changed paths:
engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
engines/ultima/ultima8/graphics/base_soft_render_surface.h
engines/ultima/ultima8/graphics/fonts/font_manager.cpp
engines/ultima/ultima8/graphics/fonts/font_manager.h
engines/ultima/ultima8/graphics/graphics_errors.h
engines/ultima/ultima8/graphics/render_surface.cpp
engines/ultima/ultima8/graphics/render_surface.h
engines/ultima/ultima8/graphics/soft_render_surface.cpp
engines/ultima/ultima8/graphics/soft_render_surface.h
engines/ultima/ultima8/gumps/bind_gump.cpp
engines/ultima/ultima8/kernel/hid_keys.cpp
engines/ultima/ultima8/kernel/hid_keys.h
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
diff --git a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
index ab2b76a..cbb1cb1 100644
--- a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
@@ -38,37 +38,37 @@ namespace Ultima8 {
//
// BaseSoftRenderSurface::BaseSoftRenderSurface(Graphics::Surface *s)
//
-// Desc: Constructor for BaseSoftRenderSurface from a SDL_Surface
+// Desc: Constructor for BaseSoftRenderSurface from a managed surface
//
BaseSoftRenderSurface::BaseSoftRenderSurface(Graphics::ManagedSurface *s) :
_pixels(0), _pixels00(0), _zBuffer(0), _zBuffer00(0),
_bytesPerPixel(0), _bitsPerPixel(0), _formatType(0),
_ox(0), _oy(0), _width(0), _height(0), _pitch(0), _zPitch(0),
_flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0),
- _sdlSurf(s), _rttTex(0) {
- _clipWindow.ResizeAbs(_width = _sdlSurf->w, _height = _sdlSurf->h);
- _pitch = _sdlSurf->pitch;
- _bitsPerPixel = _sdlSurf->format.bpp();
- _bytesPerPixel = _sdlSurf->format.bytesPerPixel;
+ _surface(s), _rttTex(0) {
+ _clipWindow.ResizeAbs(_width = _surface->w, _height = _surface->h);
+ _pitch = _surface->pitch;
+ _bitsPerPixel = _surface->format.bpp();
+ _bytesPerPixel = _surface->format.bytesPerPixel;
RenderSurface::format.s_bpp = _bitsPerPixel;
RenderSurface::format.s_bytes_per_pixel = _bytesPerPixel;
- RenderSurface::format.r_loss = _sdlSurf->format.rLoss;
- RenderSurface::format.g_loss = _sdlSurf->format.gLoss;
- RenderSurface::format.b_loss = _sdlSurf->format.bLoss;
- RenderSurface::format.a_loss = _sdlSurf->format.aLoss;
+ RenderSurface::format.r_loss = _surface->format.rLoss;
+ RenderSurface::format.g_loss = _surface->format.gLoss;
+ RenderSurface::format.b_loss = _surface->format.bLoss;
+ RenderSurface::format.a_loss = _surface->format.aLoss;
RenderSurface::format.r_loss16 = format.r_loss + 8;
RenderSurface::format.g_loss16 = format.g_loss + 8;
RenderSurface::format.b_loss16 = format.b_loss + 8;
RenderSurface::format.a_loss16 = format.a_loss + 8;
- RenderSurface::format.r_shift = _sdlSurf->format.rShift;
- RenderSurface::format.g_shift = _sdlSurf->format.gShift;
- RenderSurface::format.b_shift = _sdlSurf->format.bShift;
- RenderSurface::format.a_shift = _sdlSurf->format.aShift;
- RenderSurface::format.r_mask = _sdlSurf->format.rMax() << _sdlSurf->format.rShift;
- RenderSurface::format.g_mask = _sdlSurf->format.gMax() << _sdlSurf->format.gShift;
- RenderSurface::format.b_mask = _sdlSurf->format.bMax() << _sdlSurf->format.bShift;
- RenderSurface::format.a_mask = _sdlSurf->format.aMax() << _sdlSurf->format.aShift;
+ RenderSurface::format.r_shift = _surface->format.rShift;
+ RenderSurface::format.g_shift = _surface->format.gShift;
+ RenderSurface::format.b_shift = _surface->format.bShift;
+ RenderSurface::format.a_shift = _surface->format.aShift;
+ RenderSurface::format.r_mask = _surface->format.rMax() << _surface->format.rShift;
+ RenderSurface::format.g_mask = _surface->format.gMax() << _surface->format.gShift;
+ RenderSurface::format.b_mask = _surface->format.bMax() << _surface->format.bShift;
+ RenderSurface::format.a_mask = _surface->format.aMax() << _surface->format.aShift;
SetPixelsPointer();
@@ -121,7 +121,7 @@ BaseSoftRenderSurface::BaseSoftRenderSurface(int w, int h, int bpp,
_pixels(0), _pixels00(0), _zBuffer(0), _zBuffer00(0),
_bytesPerPixel(0), _bitsPerPixel(0), _formatType(0),
_ox(0), _oy(0), _width(0), _height(0), _pitch(0), _zPitch(0),
- _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0), _sdlSurf(0), _rttTex(0) {
+ _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0), _surface(0), _rttTex(0) {
_clipWindow.ResizeAbs(_width = w, _height = h);
switch (bpp) {
@@ -183,7 +183,7 @@ BaseSoftRenderSurface::BaseSoftRenderSurface(int w, int h, uint8 *buf) :
_pixels(0), _pixels00(0), _zBuffer(0), _zBuffer00(0),
_bytesPerPixel(0), _bitsPerPixel(0), _formatType(0),
_ox(0), _oy(0), _width(0), _height(0), _pitch(0), _zPitch(0),
- _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0), _sdlSurf(0), _rttTex(0) {
+ _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0), _surface(0), _rttTex(0) {
_clipWindow.ResizeAbs(_width = w, _height = h);
int bpp = RenderSurface::format.s_bpp;
@@ -205,7 +205,7 @@ BaseSoftRenderSurface::BaseSoftRenderSurface(int w, int h) :
_pixels(0), _pixels00(0), _zBuffer(0), _zBuffer00(0),
_bytesPerPixel(0), _bitsPerPixel(0), _formatType(0),
_ox(0), _oy(0), _width(0), _height(0), _pitch(0), _zPitch(0),
- _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0), _sdlSurf(0), _rttTex(0) {
+ _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0), _surface(0), _rttTex(0) {
_clipWindow.ResizeAbs(_width = w, _height = h);
int bpp = RenderSurface::format.s_bpp;
@@ -254,12 +254,12 @@ BaseSoftRenderSurface::~BaseSoftRenderSurface() {
ECode BaseSoftRenderSurface::BeginPainting() {
if (!_lockCount) {
- if (_sdlSurf) {
+ if (_surface) {
// Pixels pointer
- Graphics::Surface s = _sdlSurf->getSubArea(Common::Rect(0, 0, _sdlSurf->w, _sdlSurf->h));
+ Graphics::Surface s = _surface->getSubArea(Common::Rect(0, 0, _surface->w, _surface->h));
_pixels00 = static_cast<uint8 *>(s.getPixels());
- _pitch = _sdlSurf->pitch;
+ _pitch = _surface->pitch;
if (_flipped) _pitch = -_pitch;
} else {
ECode ret = GenericLock();
@@ -301,12 +301,12 @@ ECode BaseSoftRenderSurface::EndPainting() {
--_lockCount;
if (!_lockCount) {
- if (_sdlSurf) {
+ if (_surface) {
// Clear pointers
_pixels = _pixels00 = 0;
// Render the screen
- Graphics::Screen *screen = dynamic_cast<Graphics::Screen *>(_sdlSurf);
+ Graphics::Screen *screen = dynamic_cast<Graphics::Screen *>(_surface);
assert(screen);
screen->update();
diff --git a/engines/ultima/ultima8/graphics/base_soft_render_surface.h b/engines/ultima/ultima8/graphics/base_soft_render_surface.h
index 3c09bfc..7904877 100644
--- a/engines/ultima/ultima8/graphics/base_soft_render_surface.h
+++ b/engines/ultima/ultima8/graphics/base_soft_render_surface.h
@@ -63,12 +63,12 @@ protected:
// Locking count
uint32 _lockCount; // Number of locks on surface
- Graphics::ManagedSurface *_sdlSurf;
+ Graphics::ManagedSurface *_surface;
// Renderint to a texture
Texture *_rttTex;
- // Create from a SDL_Surface
+ // Create from a managed surface
BaseSoftRenderSurface(Graphics::ManagedSurface *);
// Create with Texture
@@ -167,7 +167,7 @@ public:
void CreateNativePalette(Palette *palette) override;
Graphics::ManagedSurface *getRawSurface() const override {
- return _sdlSurf;
+ return _surface;
}
};
diff --git a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
index 367417a..1b31b42 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
@@ -109,7 +109,7 @@ Graphics::Font *FontManager::getTTF_Font(Std::string filename, int pointsize) {
return 0;
}
- // open font using SDL_RWops.
+ // open font using ScummVM TTF API
// Note: The RWops and IDataSource will be deleted by the TTF_Font
Common::SeekableReadStream *rs = fontids->GetRawStream();
Graphics::Font *font = Graphics::loadTTFFont(*rs, pointsize);
diff --git a/engines/ultima/ultima8/graphics/fonts/font_manager.h b/engines/ultima/ultima8/graphics/fonts/font_manager.h
index 69ae5d2..0b61c39 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_manager.h
+++ b/engines/ultima/ultima8/graphics/fonts/font_manager.h
@@ -31,7 +31,7 @@ namespace Ultima8 {
class Font;
-// This is TTF_Font struct from SDL_ttf
+// This is TTF_Font struct
typedef struct _TTF_Font TTF_Font;
class IDataSource;
diff --git a/engines/ultima/ultima8/graphics/graphics_errors.h b/engines/ultima/ultima8/graphics/graphics_errors.h
index 4f5f9e1..bef47ed 100644
--- a/engines/ultima/ultima8/graphics/graphics_errors.h
+++ b/engines/ultima/ultima8/graphics/graphics_errors.h
@@ -61,9 +61,6 @@ namespace Ultima8 {
// Surface Locked with NULL SoftRenderSurface::pixels pointer
#define GR_SOFT_ERROR_LOCKED_NULL_PIXELS (GR_SOFT_ERROR_BASE-1)
-// SDL Surface Lock Failed
-#define GR_SOFT_ERROR_SDL_LOCK_FAILED (GR_SOFT_ERROR_BASE-2)
-
// BeginPainting()/EndPainting() Mismatch
#define GR_SOFT_ERROR_BEGIN_END_MISMATCH (GR_SOFT_ERROR_BASE-3)
diff --git a/engines/ultima/ultima8/graphics/render_surface.cpp b/engines/ultima/ultima8/graphics/render_surface.cpp
index 0157d54..751cdc9 100644
--- a/engines/ultima/ultima8/graphics/render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/render_surface.cpp
@@ -63,13 +63,13 @@ RenderSurface *RenderSurface::SetVideoMode(uint32 width, uint32 height, int bpp)
initGraphics(width, height, &pixelFormat);
// Set up blitting surface
- Graphics::ManagedSurface *sdl_surf = new Graphics::Screen(width, height, pixelFormat);
- assert(sdl_surf);
+ Graphics::ManagedSurface *surface = new Graphics::Screen(width, height, pixelFormat);
+ assert(surface);
// Now create the SoftRenderSurface
RenderSurface *surf;
- if (pixelFormat.bytesPerPixel == 4) surf = new SoftRenderSurface<uint32>(sdl_surf);
- else surf = new SoftRenderSurface<uint16>(sdl_surf);
+ if (pixelFormat.bytesPerPixel == 4) surf = new SoftRenderSurface<uint32>(surface);
+ else surf = new SoftRenderSurface<uint16>(surface);
// Initialize gamma correction tables
for (int i = 0; i < 256; i++) {
diff --git a/engines/ultima/ultima8/graphics/render_surface.h b/engines/ultima/ultima8/graphics/render_surface.h
index 7c67d01..b449ce6 100644
--- a/engines/ultima/ultima8/graphics/render_surface.h
+++ b/engines/ultima/ultima8/graphics/render_surface.h
@@ -69,10 +69,6 @@ public:
static uint8 Gamma10toGamma22[256];
static uint8 Gamma22toGamma10[256];
- //
- // TODO: Improve the way SDL Surfaces are created. Should be more versatile.
- //
-
//! Create a standard RenderSurface
static RenderSurface *SetVideoMode(uint32 width, uint32 height, int bpp);
diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.cpp b/engines/ultima/ultima8/graphics/soft_render_surface.cpp
index 5be6d1f..ee2997b 100644
--- a/engines/ultima/ultima8/graphics/soft_render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/soft_render_surface.cpp
@@ -45,7 +45,7 @@ namespace Ultima8 {
//
// SoftRenderSurface::SoftRenderSurface(Graphics::Surface *s)
//
-// Desc: Create a SoftRenderSurface from a SDL_Surface
+// Desc: Create a SoftRenderSurface from a managed surface
//
template<class uintX> SoftRenderSurface<uintX>::SoftRenderSurface(Graphics::ManagedSurface *s)
: BaseSoftRenderSurface(s) {
diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.h b/engines/ultima/ultima8/graphics/soft_render_surface.h
index e2adb91..ce12a3b 100644
--- a/engines/ultima/ultima8/graphics/soft_render_surface.h
+++ b/engines/ultima/ultima8/graphics/soft_render_surface.h
@@ -41,7 +41,7 @@ protected:
public:
- // Create from a SDL_Surface
+ // Create from a managed surface
SoftRenderSurface(Graphics::ManagedSurface *);
// Create a Generic surface that matches current screen parameters
diff --git a/engines/ultima/ultima8/gumps/bind_gump.cpp b/engines/ultima/ultima8/gumps/bind_gump.cpp
index df92dba..32d9f03 100644
--- a/engines/ultima/ultima8/gumps/bind_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bind_gump.cpp
@@ -68,9 +68,6 @@ bool BindGump::OnKeyDown(int key, int mod) {
HIDManager *hidmanager = HIDManager::get_instance();
if (key == Common::KEYCODE_BACKSPACE) {
hidmanager->unbind(*binding);
- } else {
-// istring control = SDL_GetKeyName(static_cast<SDLKey>(key));
-// hidmanager->bind(control, *binding);
}
if (invoker)
invoker->ChildNotify(this, UPDATE);
diff --git a/engines/ultima/ultima8/kernel/hid_keys.cpp b/engines/ultima/ultima8/kernel/hid_keys.cpp
index e4bd549..c67707c 100644
--- a/engines/ultima/ultima8/kernel/hid_keys.cpp
+++ b/engines/ultima/ultima8/kernel/hid_keys.cpp
@@ -311,7 +311,7 @@ HID_Key HID_GetKeyFromName(istring &name) {
return HID_LAST;
}
-HID_Key HID_translateSDLKey(Common::KeyCode key) {
+HID_Key HID_translateKey(Common::KeyCode key) {
switch (key) {
case Common::KEYCODE_BACKSPACE:
return HID_BACKSPACE;
@@ -554,7 +554,7 @@ HID_Key HID_translateSDLKey(Common::KeyCode key) {
return HID_LAST;
}
-HID_Events HID_translateSDLKeyFlags(byte flags) {
+HID_Events HID_translateKeyFlags(byte flags) {
HID_Events result = 0;
if (flags & Common::KBD_CTRL)
@@ -569,7 +569,7 @@ HID_Events HID_translateSDLKeyFlags(byte flags) {
return result;
}
-HID_Key HID_translateSDLMouseButton(uint8 button) {
+HID_Key HID_translateMouseButton(uint8 button) {
switch (button) {
case 1:
return HID_MOUSE1;
@@ -609,7 +609,7 @@ HID_Key HID_translateSDLMouseButton(uint8 button) {
return HID_LAST;
}
-HID_Key HID_translateSDLJoystickButton(uint8 button) {
+HID_Key HID_translateJoystickButton(uint8 button) {
switch (button) {
case 1:
return HID_JOY1;
diff --git a/engines/ultima/ultima8/kernel/hid_keys.h b/engines/ultima/ultima8/kernel/hid_keys.h
index 22e9b9d..34b4460 100644
--- a/engines/ultima/ultima8/kernel/hid_keys.h
+++ b/engines/ultima/ultima8/kernel/hid_keys.h
@@ -208,9 +208,9 @@ enum HID_Key {
const char *HID_GetKeyName(HID_Key key);
HID_Key HID_GetKeyFromName(istring &name);
-HID_Key HID_translateSDLKey(Common::KeyCode key);
-HID_Key HID_translateSDLMouseButton(uint8 button);
-HID_Key HID_translateSDLJoystickButton(uint8 button);
+HID_Key HID_translateKey(Common::KeyCode key);
+HID_Key HID_translateMouseButton(uint8 button);
+HID_Key HID_translateJoystickButton(uint8 button);
enum HID_Event {
HID_EVENT_DEPRESS = 0,
@@ -227,7 +227,7 @@ enum HID_Event {
};
typedef uint16 HID_Events;
-HID_Events HID_translateSDLKeyFlags(byte flags);
+HID_Events HID_translateKeyFlags(byte flags);
const char *HID_GetEventsName(HID_Events event);
HID_Events HID_GetEventFromName(const istring &name);
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index a020834..504f17d 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -758,44 +758,44 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- key = HID_translateSDLKey(event.kbd.keycode);
- evn = HID_translateSDLKeyFlags(event.kbd.flags);
+ key = HID_translateKey(event.kbd.keycode);
+ evn = HID_translateKeyFlags(event.kbd.flags);
break;
case Common::EVENT_KEYUP:
// Any system keys not in the bindings can be handled here
break;
case Common::EVENT_LBUTTONDOWN:
- key = HID_translateSDLMouseButton(1);
+ key = HID_translateMouseButton(1);
evn = HID_EVENT_DEPRESS;
break;
case Common::EVENT_LBUTTONUP:
- key = HID_translateSDLMouseButton(1);
+ key = HID_translateMouseButton(1);
evn = HID_EVENT_RELEASE;
break;
case Common::EVENT_RBUTTONDOWN:
- key = HID_translateSDLMouseButton(2);
+ key = HID_translateMouseButton(2);
evn = HID_EVENT_DEPRESS;
break;
case Common::EVENT_RBUTTONUP:
- key = HID_translateSDLMouseButton(2);
+ key = HID_translateMouseButton(2);
evn = HID_EVENT_RELEASE;
break;
case Common::EVENT_MBUTTONDOWN:
- key = HID_translateSDLMouseButton(3);
+ key = HID_translateMouseButton(3);
evn = HID_EVENT_DEPRESS;
break;
case Common::EVENT_MBUTTONUP:
- key = HID_translateSDLMouseButton(3);
+ key = HID_translateMouseButton(3);
evn = HID_EVENT_RELEASE;
break;
case Common::EVENT_JOYBUTTON_DOWN:
- key = HID_translateSDLJoystickButton(event.joystick.button + 1);
+ key = HID_translateJoystickButton(event.joystick.button + 1);
evn = HID_EVENT_DEPRESS;
break;
case Common::EVENT_JOYBUTTON_UP:
- key = HID_translateSDLJoystickButton(event.joystick.button + 1);
+ key = HID_translateJoystickButton(event.joystick.button + 1);
evn = HID_EVENT_DEPRESS;
break;
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 2db3636..87756c8 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -305,10 +305,10 @@ public:
//! \return true if succesful.
bool newGame(int saveSlot = -1);
- //! Enter gump text mode (aka SDL Unicode keyhandling)
+ //! Enter gump text mode (aka Unicode keyhandling)
void enterTextMode(Gump *);
- //! Leave gump text mode (aka SDL Unicode keyhandling)
+ //! Leave gump text mode (aka Unicode keyhandling)
void leaveTextMode(Gump *);
//! Display an error message box
More information about the Scummvm-git-logs
mailing list