MTROPOLIS: Prep for moving some things from runtime to core, add IInterfaceBase to quiet warnings about missing virtual dtor

This commit is contained in:
elasota 2022-06-04 20:08:00 -04:00 committed by Eugene Sandulenko
parent 1dae5a71eb
commit 3baac5a15e
5 changed files with 78 additions and 12 deletions

View File

@ -0,0 +1,29 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "mtropolis/core.h"
namespace MTropolis {
IInterfaceBase::~IInterfaceBase() {
}
} // End of namespace MTropolis

33
engines/mtropolis/core.h Normal file
View File

@ -0,0 +1,33 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MTROPOLIS_CORE_H
#define MTROPOLIS_CORE_H
namespace MTropolis {
struct IInterfaceBase {
virtual ~IInterfaceBase();
};
} // End of namespace MTropolis
#endif /* MTROPOLIS_CORE_H */

View File

@ -26,6 +26,8 @@
#include "common/ptr.h"
#include "common/hashmap.h"
#include "mtropolis/core.h"
#define MTROPOLIS_DEBUG_VTHREAD_STACKS
#define MTROPOLIS_DEBUG_ENABLE
@ -68,7 +70,7 @@ struct IDebugInspectionReport {
virtual void declareLoose(const Common::String &data) = 0;
};
struct IDebuggable {
struct IDebuggable : public IInterfaceBase {
virtual SupportStatus debugGetSupportStatus() const = 0;
virtual const char *debugGetTypeName() const = 0;
virtual const Common::String &debugGetName() const = 0;

View File

@ -3,6 +3,7 @@ MODULE := engines/mtropolis
MODULE_OBJS = \
asset_factory.o \
assets.o \
core.o \
data.o \
debug.o \
detection.o \

View File

@ -34,6 +34,7 @@
#include "graphics/pixelformat.h"
#include "mtropolis/actions.h"
#include "mtropolis/core.h"
#include "mtropolis/data.h"
#include "mtropolis/debug.h"
#include "mtropolis/hacks.h"
@ -376,7 +377,7 @@ struct ObjectReference {
inline ObjectReference() {
}
inline explicit ObjectReference(const Common::WeakPtr<RuntimeObject> object) : object(object) {
inline explicit ObjectReference(const Common::WeakPtr<RuntimeObject> objectPtr) : object(objectPtr) {
}
inline bool operator==(const ObjectReference &other) const {
@ -450,13 +451,13 @@ struct MessageFlags {
struct DynamicValue;
struct DynamicList;
struct IDynamicValueReadInterface {
struct IDynamicValueReadInterface : public IInterfaceBase {
virtual MiniscriptInstructionOutcome read(MiniscriptThread *thread, DynamicValue &dest, const void *objectRef, uintptr ptrOrOffset) const = 0;
virtual MiniscriptInstructionOutcome readAttrib(MiniscriptThread *thread, DynamicValue &dest, const void *objectRef, uintptr ptrOrOffset, const Common::String &attrib) const = 0;
virtual MiniscriptInstructionOutcome readAttribIndexed(MiniscriptThread *thread, DynamicValue &dest, const void *objectRef, uintptr ptrOrOffset, const Common::String &attrib, const DynamicValue &index) const = 0;
};
struct IDynamicValueWriteInterface {
struct IDynamicValueWriteInterface : public IInterfaceBase {
virtual MiniscriptInstructionOutcome write(MiniscriptThread *thread, const DynamicValue &dest, void *objectRef, uintptr ptrOrOffset) const = 0;
virtual MiniscriptInstructionOutcome refAttrib(MiniscriptThread *thread, DynamicValueWriteProxy &proxy, void *objectRef, uintptr ptrOrOffset, const Common::String &attrib) const = 0;
virtual MiniscriptInstructionOutcome refAttribIndexed(MiniscriptThread *thread, DynamicValueWriteProxy &proxy, void *objectRef, uintptr ptrOrOffset, const Common::String &attrib, const DynamicValue &index) const = 0;
@ -1113,7 +1114,7 @@ struct SegmentDescription {
Common::SeekableReadStream *stream;
};
struct IPlugInModifierRegistrar {
struct IPlugInModifierRegistrar : public IInterfaceBase {
virtual void registerPlugInModifier(const char *name, const Data::IPlugInModifierDataFactory *loader, const IPlugInModifierFactory *factory) = 0;
void registerPlugInModifier(const char *name, const IPlugInModifierFactoryAndDataFactory *loaderFactory);
};
@ -1756,7 +1757,7 @@ private:
#endif
};
struct IModifierContainer {
struct IModifierContainer : public IInterfaceBase {
virtual const Common::Array<Common::SharedPtr<Modifier> > &getModifiers() const = 0;
virtual void appendModifier(const Common::SharedPtr<Modifier> &modifier) = 0;
};
@ -1823,14 +1824,14 @@ private:
Common::WeakPtr<RuntimeObject> _source;
};
struct IStructuralReferenceVisitor {
struct IStructuralReferenceVisitor : public IInterfaceBase {
virtual void visitChildStructuralRef(Common::SharedPtr<Structural> &structural) = 0;
virtual void visitChildModifierRef(Common::SharedPtr<Modifier> &modifier) = 0;
virtual void visitWeakStructuralRef(Common::WeakPtr<Structural> &structural) = 0;
virtual void visitWeakModifierRef(Common::WeakPtr<Modifier> &modifier) = 0;
};
struct IMessageConsumer {
struct IMessageConsumer : public IInterfaceBase {
// These should only be implemented as direct responses - child traversal is handled by the message propagation process
virtual bool respondsToEvent(const Event &evt) const = 0;
virtual VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) = 0;
@ -2013,7 +2014,7 @@ private:
Common::HashMap<Common::String, const IPlugInModifierFactory *> _factoryRegistry;
};
struct IPlayMediaSignalReceiver {
struct IPlayMediaSignalReceiver : public IInterfaceBase {
virtual void playMedia(Runtime *runtime, Project *project) = 0;
};
@ -2030,7 +2031,7 @@ private:
Common::Array<IPlayMediaSignalReceiver *> _receivers;
};
struct ISegmentUnloadSignalReceiver {
struct ISegmentUnloadSignalReceiver : public IInterfaceBase {
virtual void onSegmentUnloaded(int segmentIndex) = 0;
};
@ -2049,7 +2050,7 @@ private:
Common::Array<ISegmentUnloadSignalReceiver *> _receivers;
};
struct IKeyboardEventReceiver {
struct IKeyboardEventReceiver : public IInterfaceBase {
virtual void onKeyboardEvent(Runtime *runtime, Common::EventType evtType, bool repeat, const Common::KeyState &keyEvt) = 0;
};
@ -2067,7 +2068,7 @@ private:
Common::SharedPtr<KeyboardEventSignaller> _signaller;
};
struct ICollider {
struct ICollider : public IInterfaceBase {
virtual void getCollisionProperties(Modifier *&modifier, bool &collideInFront, bool &collideBehind, bool &excludeParents) const = 0;
virtual void triggerCollision(Runtime *runtime, Structural *collidingElement, bool wasInContact, bool isInContact, bool &outShouldStop) = 0;
};