From 77c42af859c12ea7279c28373a200a916e77204f Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Fri, 22 Jun 2012 18:59:19 +0200 Subject: WINTERMUTE: Remove BEvent. --- engines/wintermute/Base/BEvent.cpp | 197 ------------------------------------- engines/wintermute/Base/BEvent.h | 56 ----------- engines/wintermute/module.mk | 1 - engines/wintermute/persistent.cpp | 2 - 4 files changed, 256 deletions(-) delete mode 100644 engines/wintermute/Base/BEvent.cpp delete mode 100644 engines/wintermute/Base/BEvent.h diff --git a/engines/wintermute/Base/BEvent.cpp b/engines/wintermute/Base/BEvent.cpp deleted file mode 100644 index 1272f85322..0000000000 --- a/engines/wintermute/Base/BEvent.cpp +++ /dev/null @@ -1,197 +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. - * - */ - -/* - * This file is based on WME Lite. - * http://dead-code.org/redir.php?target=wmelite - * Copyright (c) 2011 Jan Nedoma - */ - -#include "engines/wintermute/Base/BGame.h" -#include "engines/wintermute/Base/BFileManager.h" -#include "engines/wintermute/Base/BEvent.h" -#include "engines/wintermute/Base/BParser.h" - -namespace WinterMute { - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -IMPLEMENT_PERSISTENT(CBEvent, false) - -////////////////////////////////////////////////////////////////////////// -CBEvent::CBEvent(CBGame *inGame): CBBase(inGame) { - _type = EVENT_NONE; - _script = NULL; - _name = NULL; -} - - -////////////////////////////////////////////////////////////////////////// -CBEvent::CBEvent(CBGame *inGame, TEventType Type, char *Script): CBBase(inGame) { - _type = Type; - _script = new char [strlen(Script) + 1]; - if (_script) strcpy(_script, Script); - _name = NULL; -} - - -////////////////////////////////////////////////////////////////////////// -CBEvent::~CBEvent() { - delete[] _script; - _script = NULL; - delete[] _name; - _name = NULL; -} - - -////////////////////////////////////////////////////////////////////////// -const char *CBEvent::GetEventName(TEventType Type) { - switch (Type) { - case EVENT_INIT: - return "INIT"; - case EVENT_SHUTDOWN: - return "SHUTDOWN"; - case EVENT_LEFT_CLICK: - return "LEFT_CLICK"; - case EVENT_RIGHT_CLICK: - return "RIGHT_CLICK"; - case EVENT_MIDDLE_CLICK: - return "MIDDLE_CLICK"; - case EVENT_LEFT_DBLCLICK: - return "LEFT_DBLCLICK"; - case EVENT_PRESS: - return "PRESS"; - case EVENT_IDLE: - return "IDLE"; - case EVENT_MOUSE_OVER: - return "MOUSE_OVER"; - case EVENT_LEFT_RELEASE: - return "LEFT_RELEASE"; - case EVENT_RIGHT_RELEASE: - return "RIGHT_RELEASE"; - case EVENT_MIDDLE_RELEASE: - return "MIDDLE_RELEASE"; - - default: - return "NONE"; - } -} - - -////////////////////////////////////////////////////////////////////////// -void CBEvent::SetScript(const char *Script) { - if (_script) delete [] _script; - - _script = new char [strlen(Script) + 1]; - if (_script) strcpy(_script, Script); -} - - -////////////////////////////////////////////////////////////////////////// -void CBEvent::SetName(const char *Name) { - if (_name) delete [] _name; - - _name = new char [strlen(Name) + 1]; - if (_name) strcpy(_name, Name); -} - - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBEvent::LoadFile(const char *Filename) { - byte *Buffer = Game->_fileManager->ReadWholeFile(Filename); - if (Buffer == NULL) { - Game->LOG(0, "CBEvent::LoadFile failed for file '%s'", Filename); - return E_FAIL; - } - - HRESULT ret; - - if (FAILED(ret = LoadBuffer(Buffer, true))) Game->LOG(0, "Error parsing EVENT file '%s'", Filename); - - delete [] Buffer; - - return ret; -} - - -TOKEN_DEF_START -TOKEN_DEF(EVENT) -TOKEN_DEF(NAME) -TOKEN_DEF(SCRIPT) -TOKEN_DEF_END -////////////////////////////////////////////////////////////////////////// -HRESULT CBEvent::LoadBuffer(byte *Buffer, bool Complete) { - TOKEN_TABLE_START(commands) - TOKEN_TABLE(EVENT) - TOKEN_TABLE(NAME) - TOKEN_TABLE(SCRIPT) - TOKEN_TABLE_END - - byte *params; - int cmd; - CBParser parser(Game); - - if (Complete) { - if (parser.GetCommand((char **)&Buffer, commands, (char **)¶ms) != TOKEN_EVENT) { - Game->LOG(0, "'EVENT' keyword expected."); - return E_FAIL; - } - Buffer = params; - } - - while ((cmd = parser.GetCommand((char **)&Buffer, commands, (char **)¶ms)) > 0) { - switch (cmd) { - case TOKEN_NAME: - SetName((char *)params); - break; - - case TOKEN_SCRIPT: - SetScript((char *)params); - break; - } - - } - if (cmd == PARSERR_TOKENNOTFOUND) { - Game->LOG(0, "Syntax error in EVENT definition"); - return E_FAIL; - } - - return S_OK; -} - - -////////////////////////////////////////////////////////////////////////// -HRESULT CBEvent::Persist(CBPersistMgr *persistMgr) { - - persistMgr->transfer(TMEMBER(Game)); - - persistMgr->transfer(TMEMBER(_script)); - persistMgr->transfer(TMEMBER(_name)); - persistMgr->transfer(TMEMBER_INT(_type)); - - return S_OK; -} - -} // end of namespace WinterMute diff --git a/engines/wintermute/Base/BEvent.h b/engines/wintermute/Base/BEvent.h deleted file mode 100644 index a58f7d08d1..0000000000 --- a/engines/wintermute/Base/BEvent.h +++ /dev/null @@ -1,56 +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. - * - */ - -/* - * This file is based on WME Lite. - * http://dead-code.org/redir.php?target=wmelite - * Copyright (c) 2011 Jan Nedoma - */ - -#ifndef WINTERMUTE_BEVENT_H -#define WINTERMUTE_BEVENT_H - - -#include "engines/wintermute/Base/BBase.h" -#include "engines/wintermute/dctypes.h" // Added by ClassView - -namespace WinterMute { - -class CBEvent : public CBBase { -public: - DECLARE_PERSISTENT(CBEvent, CBBase) - void SetScript(const char *Script); - void SetName(const char *Name); - static const char *GetEventName(TEventType Type); - char *_script; - char *_name; - TEventType _type; - CBEvent(CBGame *inGame); - CBEvent(CBGame *inGame, TEventType Type, char *Script); - virtual ~CBEvent(); - HRESULT LoadFile(const char *Filename); - HRESULT LoadBuffer(byte *Buffer, bool Complete = true); -}; - -} // end of namespace WinterMute - -#endif diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index 4fe22fc795..8dbdd94b0a 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -47,7 +47,6 @@ MODULE_OBJS := \ Base/BBase.o \ Base/BDebugger.o \ Base/BDynBuffer.o \ - Base/BEvent.o \ Base/BFader.o \ Base/BFileEntry.o \ Base/BFileManager.o \ diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp index 347d0e822d..3b8f70bf0c 100644 --- a/engines/wintermute/persistent.cpp +++ b/engines/wintermute/persistent.cpp @@ -52,7 +52,6 @@ #include "engines/wintermute/Ad/AdTalkHolder.h" #include "engines/wintermute/Ad/AdTalkNode.h" #include "engines/wintermute/Ad/AdWaypointGroup.h" -#include "engines/wintermute/Base/BEvent.h" #include "engines/wintermute/Base/BFader.h" #include "engines/wintermute/Base/BFontBitmap.h" #include "engines/wintermute/Base/BFontStorage.h" @@ -122,7 +121,6 @@ void registerClasses() { REGISTER_CLASS(CAdTalkNode, false) REGISTER_CLASS(CAdWaypointGroup, false) - REGISTER_CLASS(CBEvent, false) REGISTER_CLASS(CBFader, false) REGISTER_CLASS(CBFont, false) REGISTER_CLASS(CBFontBitmap, false) -- cgit v1.2.3