aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-09 01:23:20 +0200
committerEinar Johan Trøan Sømåen2012-07-09 01:23:20 +0200
commitc4fac37bd0035ac19ab0279941d4f1a2eb118409 (patch)
tree826a8cc40626c229c6358c8801eff8d34eefc944 /engines/wintermute
parenta77ab4be6d35ac035540e94fddb3aac1ba63187d (diff)
downloadscummvm-rg350-c4fac37bd0035ac19ab0279941d4f1a2eb118409.tar.gz
scummvm-rg350-c4fac37bd0035ac19ab0279941d4f1a2eb118409.tar.bz2
scummvm-rg350-c4fac37bd0035ac19ab0279941d4f1a2eb118409.zip
WINTERMUTE: Start removing useless Windows-only code, and the compiler-references.
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/Ad/AdGame.cpp11
-rw-r--r--engines/wintermute/Ad/AdGame.h1
-rw-r--r--engines/wintermute/Base/BGame.cpp51
-rw-r--r--engines/wintermute/Base/BGame.h3
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.cpp85
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.h4
-rw-r--r--engines/wintermute/dcscript.h8
-rw-r--r--engines/wintermute/persistent.h8
-rw-r--r--engines/wintermute/wintypes.h4
9 files changed, 15 insertions, 160 deletions
diff --git a/engines/wintermute/Ad/AdGame.cpp b/engines/wintermute/Ad/AdGame.cpp
index d6485f5cd4..da64c19fe9 100644
--- a/engines/wintermute/Ad/AdGame.cpp
+++ b/engines/wintermute/Ad/AdGame.cpp
@@ -1047,17 +1047,6 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
-void CAdGame::PublishNatives() {
- if (!_scEngine || !_scEngine->_compilerAvailable) return;
-
- CBGame::PublishNatives();
-
- _scEngine->ExtDefineFunction("Actor");
- _scEngine->ExtDefineFunction("Entity");
-}
-
-
-//////////////////////////////////////////////////////////////////////////
HRESULT CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) {
CScValue *this_obj;
diff --git a/engines/wintermute/Ad/AdGame.h b/engines/wintermute/Ad/AdGame.h
index 4eef4b8df4..ed5f5b3f73 100644
--- a/engines/wintermute/Ad/AdGame.h
+++ b/engines/wintermute/Ad/AdGame.h
@@ -147,7 +147,6 @@ public:
HRESULT loadItemsBuffer(byte *buffer, bool merge = false);
- virtual void PublishNatives();
virtual HRESULT ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
// scripting interface
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index 2117e18f8b..bebccec08f 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -197,8 +197,6 @@ CBGame::CBGame(): CBObject(this) {
_subtitlesSpeed = 70;
- _resourceModule = 0;
-
_forceNonStreamedSounds = false;
_thumbnailWidth = _thumbnailHeight = 0;
@@ -2891,49 +2889,6 @@ bool CBGame::validObject(CBObject *object) {
//////////////////////////////////////////////////////////////////////////
-void CBGame::PublishNatives() {
- if (!_scEngine || !_scEngine->_compilerAvailable) return;
-
- _scEngine->ExtDefineFunction("LOG");
- _scEngine->ExtDefineFunction("String");
- _scEngine->ExtDefineFunction("MemBuffer");
- _scEngine->ExtDefineFunction("File");
- _scEngine->ExtDefineFunction("Date");
- _scEngine->ExtDefineFunction("Array");
- _scEngine->ExtDefineFunction("TcpClient");
- _scEngine->ExtDefineFunction("Object");
- //_scEngine->ExtDefineFunction("Game");
- _scEngine->ExtDefineFunction("Sleep");
- _scEngine->ExtDefineFunction("WaitFor");
- _scEngine->ExtDefineFunction("Random");
- _scEngine->ExtDefineFunction("SetScriptTimeSlice");
- _scEngine->ExtDefineFunction("MakeRGBA");
- _scEngine->ExtDefineFunction("MakeRGB");
- _scEngine->ExtDefineFunction("MakeHSL");
- _scEngine->ExtDefineFunction("RGB");
- _scEngine->ExtDefineFunction("GetRValue");
- _scEngine->ExtDefineFunction("GetGValue");
- _scEngine->ExtDefineFunction("GetBValue");
- _scEngine->ExtDefineFunction("GetAValue");
- _scEngine->ExtDefineFunction("GetHValue");
- _scEngine->ExtDefineFunction("GetSValue");
- _scEngine->ExtDefineFunction("GetLValue");
- _scEngine->ExtDefineFunction("Debug");
-
- _scEngine->ExtDefineFunction("ToString");
- _scEngine->ExtDefineFunction("ToInt");
- _scEngine->ExtDefineFunction("ToBool");
- _scEngine->ExtDefineFunction("ToFloat");
-
- _scEngine->ExtDefineVariable("Game");
- _scEngine->ExtDefineVariable("Math");
- _scEngine->ExtDefineVariable("Directory");
- _scEngine->ExtDefineVariable("self");
- _scEngine->ExtDefineVariable("this");
-}
-
-
-//////////////////////////////////////////////////////////////////////////
HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) {
CScValue *thisObj;
@@ -4075,12 +4030,6 @@ void CBGame::resetMousePos() {
//////////////////////////////////////////////////////////////////////////
-void CBGame::setResourceModule(HMODULE resModule) {
- _resourceModule = resModule;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
HRESULT CBGame::displayContent(bool update, bool displayAll) {
return S_OK;
}
diff --git a/engines/wintermute/Base/BGame.h b/engines/wintermute/Base/BGame.h
index 6ece353ee7..70ae0d5be1 100644
--- a/engines/wintermute/Base/BGame.h
+++ b/engines/wintermute/Base/BGame.h
@@ -143,8 +143,6 @@ public:
int _thumbnailHeight;
bool _reportTextureFormat;
- HMODULE _resourceModule;
- void setResourceModule(HMODULE resModule);
void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = NULL, void *data = NULL);
ENGINE_LOG_CALLBACK _engineLogCallback;
@@ -222,7 +220,6 @@ public:
virtual HRESULT invalidateDeviceObjects();
virtual HRESULT restoreDeviceObjects();
- virtual void PublishNatives();
virtual HRESULT ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp
index 53e62e2b9d..b70f04f568 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.cpp
+++ b/engines/wintermute/Base/scriptables/ScEngine.cpp
@@ -48,56 +48,6 @@ IMPLEMENT_PERSISTENT(CScEngine, true)
CScEngine::CScEngine(CBGame *inGame): CBBase(inGame) {
Game->LOG(0, "Initializing scripting engine...");
- /*
- #ifdef __WIN32__
- char CompilerPath[MAX_PATH];
- strcpy(CompilerPath, COMPILER_DLL);
-
- _compilerDLL = ::LoadLibrary(CompilerPath);
- if (_compilerDLL == NULL) {
- char ModuleName[MAX_PATH];
- ::GetModuleFileName(NULL, ModuleName, MAX_PATH);
-
- // switch to exe's dir
- char *ExeDir = CBUtils::GetPath(ModuleName);
- sprintf(CompilerPath, "%s%s", ExeDir, COMPILER_DLL);
- _compilerDLL = ::LoadLibrary(CompilerPath);
-
- delete [] ExeDir;
- }
- if (_compilerDLL != NULL) {
- // bind compiler's functionality
- ExtCompileBuffer = (DLL_COMPILE_BUFFER) ::GetProcAddress(_compilerDLL, "CompileBuffer");
- ExtCompileFile = (DLL_COMPILE_FILE) ::GetProcAddress(_compilerDLL, "CompileFile");
- ExtReleaseBuffer = (DLL_RELEASE_BUFFER) ::GetProcAddress(_compilerDLL, "ReleaseBuffer");
- ExtSetCallbacks = (DLL_SET_CALLBACKS) ::GetProcAddress(_compilerDLL, "SetCallbacks");
- ExtDefineFunction = (DLL_DEFINE_FUNCTION)::GetProcAddress(_compilerDLL, "DefineFunction");
- ExtDefineVariable = (DLL_DEFINE_VARIABLE)::GetProcAddress(_compilerDLL, "DefineVariable");
-
- if (!ExtCompileBuffer || !ExtCompileFile || !ExtReleaseBuffer || !ExtSetCallbacks || !ExtDefineFunction || !ExtDefineVariable) {
- _compilerAvailable = false;
- ::FreeLibrary(_compilerDLL);
- _compilerDLL = NULL;
- } else {
- */ /*
- // publish external methods to the compiler
- CALLBACKS c;
- c.Dll_AddError = AddError;
- c.Dll_CloseFile = CloseFile;
- c.Dll_LoadFile = LoadFile;
- ExtSetCallbacks(&c, Game);
- */
- /*
- _compilerAvailable = true;
- }
- } else _compilerAvailable = false;
- #else
- */
- _compilerAvailable = false;
- _compilerDLL = 0;
-//#endif
-
-
if (_compilerAvailable) Game->LOG(0, " Script compiler bound successfuly");
else Game->LOG(0, " Script compiler is NOT available");
@@ -144,9 +94,7 @@ CScEngine::~CScEngine() {
saveBreakpoints();
disableProfiling();
-#ifdef __WIN32__
- if (_compilerAvailable && _compilerDLL) ::FreeLibrary(_compilerDLL);
-#endif
+
cleanup();
for (int i = 0; i < _breakpoints.GetSize(); i++) {
@@ -219,7 +167,7 @@ void CScEngine::addError(void *data, int line, char *text) {
//////////////////////////////////////////////////////////////////////////
-void WINAPI CScEngine::parseElement(void *data, int line, int type, void *elementData) {
+void CScEngine::parseElement(void *data, int line, int type, void *elementData) {
CBGame *Game = (CBGame *)data;
if (Game) {
@@ -300,32 +248,9 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i
delete [] buffer;
return NULL;
}
-
- compiledNow = true;
-
- // publish external methods to the compiler
- CALLBACKS c;
- c.Dll_AddError = addError;
- c.Dll_CloseFile = closeFile;
- c.Dll_LoadFile = loadFile;
- c.Dll_ParseElement = parseElement;
- ExtSetCallbacks(&c, Game);
-
- // publish native interfaces
- Game->PublishNatives();
-
- // We have const char* everywhere but in the DLL-interfaces...
- char *tempFileName = new char[strlen(filename) + 1];
- memcpy(tempFileName, filename, strlen(filename) + 1);
-
- setFileToCompile(filename);
- compBuffer = ExtCompileFile(tempFileName, &compSize);
- delete[] tempFileName;
- if (!compBuffer) {
- Game->quickMessage("Script compiler error. View log for details.");
- delete [] buffer;
- return NULL;
- }
+ // This code will never be called, since _compilerAvailable is const false.
+ // It's only here in the event someone would want to reinclude the compiler.
+ error("Script needs compilation, ScummVM does not contain a WME compiler");
}
byte *ret = NULL;
diff --git a/engines/wintermute/Base/scriptables/ScEngine.h b/engines/wintermute/Base/scriptables/ScEngine.h
index d49e474ea8..479c77a77a 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.h
+++ b/engines/wintermute/Base/scriptables/ScEngine.h
@@ -132,8 +132,8 @@ public:
HRESULT tick();
CScValue *_globals;
CScScript *runScript(const char *filename, CBScriptHolder *owner = NULL);
- bool _compilerAvailable;
- HINSTANCE _compilerDLL;
+ static const bool _compilerAvailable = false;
+
CScEngine(CBGame *inGame);
virtual ~CScEngine();
static void addError(void *data, int line, char *text);
diff --git a/engines/wintermute/dcscript.h b/engines/wintermute/dcscript.h
index a4a608da46..7969e049b0 100644
--- a/engines/wintermute/dcscript.h
+++ b/engines/wintermute/dcscript.h
@@ -139,10 +139,10 @@ typedef enum {
// compiler interface
-typedef byte *(WINAPI DLL_LOAD_FILE)(void *Data, char *Filename, uint32 *Size);
-typedef void (WINAPI DLL_CLOSE_FILE)(void *Data, byte *Buffer);
-typedef void (WINAPI DLL_ADD_ERROR)(void *Data, int Line, char *Text);
-typedef void (WINAPI DLL_PARSE_ELEMENT)(void *Data, int Line, int Type, void *ElementData);
+typedef byte *(DLL_LOAD_FILE)(void *data, char *filename, uint32 *size);
+typedef void (DLL_CLOSE_FILE)(void *data, byte *buffer);
+typedef void (DLL_ADD_ERROR)(void *data, int line, char *text);
+typedef void (DLL_PARSE_ELEMENT)(void *data, int line, int type, void *elementData);
typedef struct {
DLL_LOAD_FILE *Dll_LoadFile;
diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h
index 5d81ff51e9..5d4acda210 100644
--- a/engines/wintermute/persistent.h
+++ b/engines/wintermute/persistent.h
@@ -36,8 +36,8 @@ namespace WinterMute {
class CBPersistMgr;
// persistence support
-typedef void *(WINAPI *PERSISTBUILD)(void);
-typedef HRESULT(WINAPI *PERSISTLOAD)(void *, CBPersistMgr *);
+typedef void *(*PERSISTBUILD)(void);
+typedef HRESULT(*PERSISTLOAD)(void *, CBPersistMgr *);
typedef void (*SYS_INSTANCE_CALLBACK)(void *Instance, void *Data);
} // end of namespace WinterMute
@@ -48,9 +48,9 @@ namespace WinterMute {
#define DECLARE_PERSISTENT(class_name, parent_class)\
static const char _className[];\
- static void* WINAPI persistBuild(void);\
+ static void* persistBuild(void);\
virtual const char* getClassName();\
- static HRESULT WINAPI persistLoad(void* Instance, CBPersistMgr* PersistMgr);\
+ static HRESULT persistLoad(void* Instance, CBPersistMgr* PersistMgr);\
class_name(TDynamicConstructor p1, TDynamicConstructor p2):parent_class(p1, p2){ /*memset(this, 0, sizeof(class_name));*/ };\
virtual HRESULT persist(CBPersistMgr* PersistMgr);\
void* operator new (size_t size);\
diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h
index 82134f7725..efddc13614 100644
--- a/engines/wintermute/wintypes.h
+++ b/engines/wintermute/wintypes.h
@@ -35,9 +35,6 @@
#ifndef __WIN32__
-#define WINAPI
-#define CALLBACK
-
#define PI ((float) 3.141592653589793f)
#define DRGBA(r,g,b,a) ((uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
@@ -69,7 +66,6 @@ typedef struct tagPOINT {
typedef uint32 HINSTANCE;
-typedef uint32 HMODULE;
typedef uint32 HWND;
typedef int32 HRESULT;