1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 /* 24 * This file is based on WME Lite. 25 * http://dead-code.org/redir.php?target=wmelite 26 * Copyright (c) 2011 Jan Nedoma 27 */ 28 29 #ifndef WINTERMUTE_BASE_OBJECT_H 30 #define WINTERMUTE_BASE_OBJECT_H 31 32 33 #include "engines/wintermute/base/base_script_holder.h" 34 #include "engines/wintermute/persistent.h" 35 #include "common/events.h" 36 #include "graphics/transform_struct.h" 37 38 namespace Wintermute { 39 40 class BaseSprite; 41 class BaseSound; 42 class BaseSurface; 43 class BaseScriptHolder; 44 class ScValue; 45 class ScStack; 46 class ScScript; 47 class BaseObject : public BaseScriptHolder { 48 protected: 49 bool _autoSoundPanning; 50 uint32 _sFXStart; 51 bool setSFXTime(uint32 time); 52 bool setSFXVolume(int volume); 53 bool resumeSFX(); 54 bool pauseSFX(); 55 bool stopSFX(bool deleteSound = true); 56 bool playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = nullptr, uint32 loopStart = 0); 57 BaseSound *_sFX; 58 TSFXType _sFXType; 59 float _sFXParam1; 60 float _sFXParam2; 61 float _sFXParam3; 62 float _sFXParam4; 63 float _relativeRotate; 64 bool _rotateValid; 65 float _rotate; 66 void setSoundEvent(const char *eventName); 67 bool _rotatable; 68 float _scaleX; 69 float _scaleY; 70 float _relativeScale; 71 bool _editorSelected; 72 bool _editorAlwaysRegister; 73 bool _ready; 74 Rect32 _rect; 75 bool _rectSet; 76 int32 _iD; 77 char *_soundEvent; 78 public: 79 Graphics::TSpriteBlendMode _blendMode; 80 virtual bool afterMove(); 81 float _scale; 82 uint32 _alphaColor; 83 virtual bool isReady(); 84 virtual bool getExtendedFlag(const char *flagName); 85 virtual bool resetSoundPan(); 86 virtual bool updateSounds(); 87 bool updateOneSound(BaseSound *sound); 88 int32 _sFXVolume; 89 90 virtual bool handleMouseWheel(int delta); 91 virtual bool handleMouse(TMouseEvent event, TMouseButton button); 92 virtual bool handleKeypress(Common::Event *event, bool printable = false); 93 virtual int32 getHeight(); 94 bool setCursor(const char *filename); 95 bool setActiveCursor(const char *filename); 96 bool cleanup(); 97 const char *getCaption(int caseVal = 1); 98 void setCaption(const char *caption, int caseVal = 1); 99 100 bool _editorOnly; 101 bool _is3D; 102 103 DECLARE_PERSISTENT(BaseObject, BaseScriptHolder) 104 virtual bool showCursor(); 105 BaseSprite *_cursor; 106 bool _sharedCursors; 107 BaseSprite *_activeCursor; 108 virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); 109 virtual bool listen(BaseScriptHolder *param1, uint32 param2); 110 111 bool _movable; 112 bool _zoomable; 113 bool _shadowable; 114 int32 _posY; 115 int32 _posX; 116 bool _registrable; 117 char *_caption[7]; 118 bool _saveState; 119 120 BaseObject(BaseGame *inGame); 121 virtual ~BaseObject(); 122 // base update()123 virtual bool update() { 124 return STATUS_FAILED; 125 }; display()126 virtual bool display() { 127 return STATUS_FAILED; 128 }; invalidateDeviceObjects()129 virtual bool invalidateDeviceObjects() { 130 return STATUS_OK; 131 }; restoreDeviceObjects()132 virtual bool restoreDeviceObjects() { 133 return STATUS_OK; 134 }; 135 bool _nonIntMouseEvents; 136 137 138 public: 139 // scripting interface 140 virtual ScValue *scGetProperty(const Common::String &name) override; 141 virtual bool scSetProperty(const char *name, ScValue *value) override; 142 virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override; 143 virtual const char *scToString() override; 144 }; 145 146 } // End of namespace Wintermute 147 148 #endif 149