aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/scriptables
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/base/scriptables')
-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
4 files changed, 20 insertions, 17 deletions
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;
}