aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-23 03:01:05 +0200
committerEinar Johan Trøan Sømåen2012-07-23 03:10:41 +0200
commit448911930d8d6bf43a67769d50ee4048f296b7f4 (patch)
tree5617248f0227062e80e58e5f0b13679c74b935ae /engines/wintermute/base
parentdd6d093cf33f3ab3cf49f848ba6298733bad5831 (diff)
downloadscummvm-rg350-448911930d8d6bf43a67769d50ee4048f296b7f4.tar.gz
scummvm-rg350-448911930d8d6bf43a67769d50ee4048f296b7f4.tar.bz2
scummvm-rg350-448911930d8d6bf43a67769d50ee4048f296b7f4.zip
WINTERMUTE: Remove unused code from platform_osystem.h
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/base_active_rect.cpp2
-rw-r--r--engines/wintermute/base/base_fader.cpp7
-rw-r--r--engines/wintermute/base/base_file_manager.cpp22
-rw-r--r--engines/wintermute/base/base_game.cpp13
-rw-r--r--engines/wintermute/base/base_sub_frame.cpp2
-rw-r--r--engines/wintermute/base/base_transition_manager.cpp7
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp20
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h3
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp12
11 files changed, 48 insertions, 46 deletions
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp
index 493b35bf12..598324e10b 100644
--- a/engines/wintermute/base/base_active_rect.cpp
+++ b/engines/wintermute/base/base_active_rect.cpp
@@ -65,7 +65,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseRegion *
_owner = owner;
_region = region;
BasePlatform::copyRect(&_rect, &region->_rect);
- BasePlatform::offsetRect(&_rect, -offsetX, -offsetY);
+ _rect.offsetRect(-offsetX, -offsetY);
_zoomX = 100;
_zoomY = 100;
_precise = true;
diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp
index 4dcdf82347..c5f170bb43 100644
--- a/engines/wintermute/base/base_fader.cpp
+++ b/engines/wintermute/base/base_fader.cpp
@@ -29,7 +29,6 @@
#include "engines/wintermute/dcgf.h"
#include "engines/wintermute/base/base_fader.h"
#include "engines/wintermute/base/base_game.h"
-#include "engines/wintermute/platform_osystem.h"
#include "common/util.h"
namespace WinterMute {
@@ -67,7 +66,7 @@ bool BaseFader::update() {
uint32 time;
- if (_system) time = BasePlatform::getTime() - _startTime;
+ if (_system) time = g_system->getMillis() - _startTime;
else time = _gameRef->_timer - _startTime;
if (time >= _duration) _currentAlpha = _targetAlpha;
@@ -115,7 +114,7 @@ bool BaseFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) {
_duration = duration;
_system = system;
- if (_system) _startTime = BasePlatform::getTime();
+ if (_system) _startTime = g_system->getMillis();
else _startTime = _gameRef->_timer;
return STATUS_OK;
@@ -138,7 +137,7 @@ bool BaseFader::fadeOut(uint32 targetColor, uint32 duration, bool system) {
_duration = duration;
_system = system;
- if (_system) _startTime = BasePlatform::getTime();
+ if (_system) _startTime = g_system->getMillis();
else _startTime = _gameRef->_timer;
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index 57f59a144c..1eb27ad0c4 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -372,9 +372,11 @@ bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const
// some old version of ProjectMan writes invalid directory entries
// so at least prevent strupr from corrupting memory
name[nameLength - 1] = '\0';
-
-
- BasePlatform::strupr(name);
+
+ Common::String upcName = name;
+ upcName.toUppercase();
+ delete[] name;
+ name = NULL;
offset = package->readUint32LE();
offset += absoluteOffset;
@@ -386,7 +388,7 @@ bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const
timeDate1 = package->readUint32LE();
timeDate2 = package->readUint32LE();
}
- _filesIter = _files.find(name);
+ _filesIter = _files.find(upcName.c_str());
if (_filesIter == _files.end()) {
BaseFileEntry *file = new BaseFileEntry();
file->_package = pkg;
@@ -395,7 +397,7 @@ bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const
file->_compressedLength = compLength;
file->_flags = flags;
- _files[name] = file;
+ _files[upcName.c_str()] = file;
} else {
// current package has lower CD number or higher priority, than the registered
if (pkg->_cd < _filesIter->_value->_package->_cd || pkg->_priority > _filesIter->_value->_package->_priority) {
@@ -406,7 +408,6 @@ bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const
_filesIter->_value->_flags = flags;
}
}
- delete [] name;
}
}
@@ -441,16 +442,13 @@ Common::File *BaseFileManager::openPackage(const Common::String &name) {
//////////////////////////////////////////////////////////////////////////
BaseFileEntry *BaseFileManager::getPackageEntry(const Common::String &filename) {
- char *upc_name = new char[strlen(filename.c_str()) + 1];
- strcpy(upc_name, filename.c_str());
- BasePlatform::strupr(upc_name);
+ Common::String upc_name = filename;
+ upc_name.toUppercase();
BaseFileEntry *ret = NULL;
- _filesIter = _files.find(upc_name);
+ _filesIter = _files.find(upc_name.c_str());
if (_filesIter != _files.end()) ret = _filesIter->_value;
- delete [] upc_name;
-
return ret;
}
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index d3da177a92..e72deb4be2 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -62,6 +62,7 @@
#include "engines/wintermute/video/video_theora_player.h"
#include "engines/wintermute/utils/utils.h"
#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/platform_osystem.h"
#include "common/savefile.h"
#include "common/textconsole.h"
#include "common/util.h"
@@ -589,7 +590,7 @@ void BaseGame::setEngineLogCallback(ENGINE_LOG_CALLBACK callback, void *data) {
bool BaseGame::initLoop() {
_viewportSP = -1;
- _currentTime = BasePlatform::getTime();
+ _currentTime = g_system->getMillis();
getDebugMgr()->onGameTick();
_renderer->initLoop();
@@ -2183,7 +2184,7 @@ ScValue *BaseGame::scGetProperty(const char *name) {
// WindowsTime (RO)
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WindowsTime") == 0) {
- _scValue->setInt((int)BasePlatform::getTime());
+ _scValue->setInt((int)g_system->getMillis());
return _scValue;
}
@@ -4405,9 +4406,9 @@ void BaseGame::getMousePos(Point32 *pos) {
bool BaseGame::miniUpdate() {
if (!_miniUpdateEnabled) return STATUS_OK;
- if (BasePlatform::getTime() - _lastMiniUpdate > 200) {
+ if (g_system->getMillis() - _lastMiniUpdate > 200) {
if (_soundMgr) _soundMgr->initLoop();
- _lastMiniUpdate = BasePlatform::getTime();
+ _lastMiniUpdate = g_system->getMillis();
}
return STATUS_OK;
}
@@ -4440,8 +4441,8 @@ bool BaseGame::isDoubleClick(int buttonIndex) {
int moveY = abs(pos.y - _lastClick[buttonIndex].posY);
- if (_lastClick[buttonIndex].time == 0 || BasePlatform::getTime() - _lastClick[buttonIndex].time > maxDoubleCLickTime || moveX > maxMoveX || moveY > maxMoveY) {
- _lastClick[buttonIndex].time = BasePlatform::getTime();
+ if (_lastClick[buttonIndex].time == 0 || g_system->getMillis() - _lastClick[buttonIndex].time > maxDoubleCLickTime || moveX > maxMoveX || moveY > maxMoveY) {
+ _lastClick[buttonIndex].time = g_system->getMillis();
_lastClick[buttonIndex].posX = pos.x;
_lastClick[buttonIndex].posY = pos.y;
return false;
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index 05b7d21dfe..d30d38ef70 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -262,7 +262,7 @@ bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool comple
Rect32 rect;
BasePlatform::setRectEmpty(&rect);
if (_surface) BasePlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight());
- if (!BasePlatform::equalRect(&rect, &_rect))
+ if (!(rect == _rect))
buffer->putTextIndent(indent + 2, "RECT { %d,%d,%d,%d }\n", _rect.left, _rect.top, _rect.right, _rect.bottom);
if (_hotspotX != 0 || _hotspotY != 0)
diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp
index b524636af7..e4665756e2 100644
--- a/engines/wintermute/base/base_transition_manager.cpp
+++ b/engines/wintermute/base/base_transition_manager.cpp
@@ -29,7 +29,6 @@
#include "engines/wintermute/dcgf.h"
#include "engines/wintermute/base/base_transition_manager.h"
#include "engines/wintermute/base/base_game.h"
-#include "engines/wintermute/platform_osystem.h"
namespace WinterMute {
@@ -88,7 +87,7 @@ bool BaseTransitionMgr::update() {
if (!_started) {
_started = true;
- _lastTime = BasePlatform::getTime();
+ _lastTime = g_system->getMillis();
}
switch (_type) {
@@ -97,7 +96,7 @@ bool BaseTransitionMgr::update() {
break;
case TRANSITION_FADE_OUT: {
- uint32 time = BasePlatform::getTime() - _lastTime;
+ uint32 time = g_system->getMillis() - _lastTime;
int alpha = (int)(255 - (float)time / (float)FADE_DURATION * 255);
alpha = MIN(255, MAX(alpha, 0));
_gameRef->_renderer->fade((uint16)alpha);
@@ -108,7 +107,7 @@ bool BaseTransitionMgr::update() {
break;
case TRANSITION_FADE_IN: {
- uint32 time = BasePlatform::getTime() - _lastTime;
+ uint32 time = g_system->getMillis() - _lastTime;
int alpha = (int)((float)time / (float)FADE_DURATION * 255);
alpha = MIN(255, MAX(alpha, 0));
_gameRef->_renderer->fade((uint16)alpha);
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index 9782d1d7db..88eec8469f 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -641,13 +641,15 @@ bool BaseFontTT::initFont() {
Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(_fontFile);
if (!file) {
+ //TODO: Try to fallback from Arial to FreeSans
+ /*
// the requested font file is not in wme file space; try loading a system font
AnsiString fontFileName = PathUtil::combine(BasePlatform::getSystemFontPath(), PathUtil::getFileName(_fontFile));
file = _gameRef->_fileManager->openFile(fontFileName.c_str(), false);
if (!file) {
_gameRef->LOG(0, "Error loading TrueType font '%s'", _fontFile);
//return STATUS_FAILED;
- }
+ }*/
}
if (file) {
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 45544831e3..11fe6ff0cc 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -1148,7 +1148,7 @@ bool ScScript::sleep(uint32 duration) {
_state = SCRIPT_SLEEPING;
if (_gameRef->_state == GAME_FROZEN) {
- _waitTime = BasePlatform::getTime() + duration;
+ _waitTime = g_system->getMillis() + duration;
_waitFrozen = true;
} else {
_waitTime = _gameRef->_timer + duration;
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index e8544d8cd6..472e9d9fec 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -176,7 +176,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
if (!ignoreCache) {
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i] && scumm_stricmp(_cachedScripts[i]->_filename.c_str(), filename) == 0) {
- _cachedScripts[i]->_timestamp = BasePlatform::getTime();
+ _cachedScripts[i]->_timestamp = g_system->getMillis();
*outSize = _cachedScripts[i]->_size;
return _cachedScripts[i]->_buffer;
}
@@ -216,7 +216,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
CScCachedScript *cachedScript = new CScCachedScript(filename, compBuffer, compSize);
if (cachedScript) {
int index = 0;
- uint32 MinTime = BasePlatform::getTime();
+ uint32 MinTime = g_system->getMillis();
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i] == NULL) {
index = i;
@@ -275,7 +275,7 @@ bool ScEngine::tick() {
case SCRIPT_SLEEPING: {
if (_scripts[i]->_waitFrozen) {
- if (_scripts[i]->_waitTime <= BasePlatform::getTime()) _scripts[i]->run();
+ if (_scripts[i]->_waitTime <= g_system->getMillis()) _scripts[i]->run();
} else {
if (_scripts[i]->_waitTime <= _gameRef->_timer) _scripts[i]->run();
}
@@ -314,25 +314,25 @@ bool ScEngine::tick() {
// time sliced script
if (_scripts[i]->_timeSlice > 0) {
- uint32 StartTime = BasePlatform::getTime();
- while (_scripts[i]->_state == SCRIPT_RUNNING && BasePlatform::getTime() - StartTime < _scripts[i]->_timeSlice) {
+ uint32 StartTime = g_system->getMillis();
+ while (_scripts[i]->_state == SCRIPT_RUNNING && g_system->getMillis() - StartTime < _scripts[i]->_timeSlice) {
_currentScript = _scripts[i];
_scripts[i]->executeInstruction();
}
- if (_isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, BasePlatform::getTime() - StartTime);
+ if (_isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, g_system->getMillis() - StartTime);
}
// normal script
else {
uint32 startTime = 0;
bool isProfiling = _isProfiling;
- if (isProfiling) startTime = BasePlatform::getTime();
+ if (isProfiling) startTime = g_system->getMillis();
while (_scripts[i]->_state == SCRIPT_RUNNING) {
_currentScript = _scripts[i];
_scripts[i]->executeInstruction();
}
- if (isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, BasePlatform::getTime() - startTime);
+ if (isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, g_system->getMillis() - startTime);
}
_currentScript = NULL;
}
@@ -670,7 +670,7 @@ void ScEngine::enableProfiling() {
// destroy old data, if any
_scriptTimes.clear();
- _profilingStartTime = BasePlatform::getTime();
+ _profilingStartTime = g_system->getMillis();
_isProfiling = true;
}
@@ -687,7 +687,7 @@ void ScEngine::disableProfiling() {
//////////////////////////////////////////////////////////////////////////
void ScEngine::dumpStats() {
error("DumpStats not ported to ScummVM yet");
- /* uint32 totalTime = BasePlatform::getTime() - _profilingStartTime;
+ /* uint32 totalTime = g_system->getMillis() - _profilingStartTime;
typedef std::vector <std::pair<uint32, std::string> > TimeVector;
TimeVector times;
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index 6d2ed92e4f..3d85192aa6 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -33,7 +33,6 @@
#include "engines/wintermute/coll_templ.h"
#include "engines/wintermute/base/base.h"
#include "engines/wintermute/wme_debugger.h"
-#include "engines/wintermute/platform_osystem.h"
namespace WinterMute {
@@ -47,7 +46,7 @@ public:
class CScCachedScript {
public:
CScCachedScript(const char *filename, byte *buffer, uint32 size) {
- _timestamp = BasePlatform::getTime();
+ _timestamp = g_system->getMillis();
_buffer = new byte[size];
if (_buffer) memcpy(_buffer, buffer, size);
_size = size;
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index ffa362a938..383b956555 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -182,7 +182,9 @@ bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
else if (strcmp(name, "Delete") == 0) {
stack->correctParams(0);
close();
- stack->pushBool(BasePlatform::deleteFile(_filename) != false);
+ error("SXFile-Method: \"Delete\" not supported");
+ //stack->pushBool(BasePlatform::deleteFile(_filename) != false);
+ stack->pushBool(false);
return STATUS_OK;
}
@@ -191,11 +193,13 @@ bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Copy") == 0) {
stack->correctParams(2);
- const char *Dest = stack->pop()->getString();
- bool Overwrite = stack->pop()->getBool(true);
+ const char *dest = stack->pop()->getString();
+ bool overwrite = stack->pop()->getBool(true);
close();
- stack->pushBool(BasePlatform::copyFile(_filename, Dest, !Overwrite) != false);
+ error("SXFile-Method: Copy not supported");
+ //stack->pushBool(BasePlatform::copyFile(_filename, Dest, !Overwrite) != false);
+ stack->pushBool(false);
return STATUS_OK;
}