ScummVM API documentation
base_object.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_BASE_OBJECT_H
29#define WINTERMUTE_BASE_OBJECT_H
30
31
32#include "engines/wintermute/base/base_script_holder.h"
33#include "engines/wintermute/base/gfx/xmath.h"
34#include "engines/wintermute/persistent.h"
35#include "common/events.h"
36#include "graphics/transform_struct.h"
37
38namespace Wintermute {
39
40class BaseSprite;
41class BaseSound;
42class BaseSurface;
43class BaseScriptHolder;
44class ScValue;
45class ScStack;
46class ScScript;
47class XModel;
48
50public:
51 char *_accessCaption;
52 virtual const char *getAccessCaption();
53
54 Graphics::TSpriteBlendMode _blendMode;
55#ifdef ENABLE_WME3D
56 virtual bool renderModel();
57#endif
58 virtual bool afterMove();
59 float _relativeRotate;
60 bool _rotateValid;
61 float _rotate;
62 void setSoundEvent(const char *eventName);
63 bool _rotatable;
64 uint32 _alphaColor;
65 float _scale;
66 float _scaleX;
67 float _scaleY;
68 float _relativeScale;
69 virtual bool isReady();
70 virtual bool getExtendedFlag(const char *flagName);
71 virtual bool resetSoundPan();
72 virtual bool updateSounds();
73 bool updateOneSound(BaseSound *sound);
74 bool _autoSoundPanning;
75 uint32 _sFXStart;
76 int32 _sFXVolume;
77 bool setSFXTime(uint32 time);
78 bool setSFXVolume(int volume);
79 bool resumeSFX();
80 bool pauseSFX();
81 bool stopSFX(bool deleteSound = true);
82 bool playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = nullptr, uint32 loopStart = 0);
83 BaseSound *_sFX;
84
85 TSFXType _sFXType;
86 float _sFXParam1;
87 float _sFXParam2;
88 float _sFXParam3;
89 float _sFXParam4;
90
91 virtual bool handleMouseWheel(int32 delta);
92 virtual bool handleMouse(TMouseEvent event, TMouseButton button);
93 virtual bool handleKeypress(Common::Event *event, bool printable = false);
94 virtual int32 getHeight();
95 bool setCursor(const char *filename);
96 bool setActiveCursor(const char *filename);
97 bool cleanup();
98 const char *getCaption(int caseVal = 1);
99 void setCaption(const char *caption, int caseVal = 1);
100 bool _editorSelected;
101 bool _editorAlwaysRegister;
102 bool _editorOnly;
103 bool _is3D;
104 DECLARE_PERSISTENT(BaseObject, BaseScriptHolder)
105 virtual bool showCursor();
106 BaseSprite *_cursor;
107 bool _sharedCursors;
108 BaseSprite *_activeCursor;
109 bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
110 bool listen(BaseScriptHolder *param1, uint32 param2) override;
111 bool _ready;
112 bool _registrable;
113 bool _zoomable;
114 bool _shadowable;
115 Common::Rect32 _rect;
116 bool _rectSet;
117 int32 _id;
118 bool _movable;
119 BaseObject(BaseGame *inGame);
120 ~BaseObject() override;
121 char *_caption[7];
122 char *_soundEvent;
123 int32 _posY;
124 int32 _posX;
125 bool _saveState;
126
127 // base
128 virtual bool update() {
129 return STATUS_FAILED;
130 };
131 virtual bool display() {
132 return STATUS_FAILED;
133 };
134 virtual bool invalidateDeviceObjects() {
135 return STATUS_OK;
136 };
137 virtual bool restoreDeviceObjects() {
138 return STATUS_OK;
139 };
140 bool _nonIntMouseEvents;
141
142#ifdef ENABLE_WME3D
143 float _angle;
144 XModel *_xmodel;
145 XModel *_shadowModel;
146 DXMatrix _worldMatrix;
147 DXVector3 _posVector;
148 bool getMatrix(DXMatrix *modelMatrix, DXVector3 *posVect = nullptr);
149 uint32 _shadowColor;
150 BaseSurface *_shadowImage;
151 float _shadowSize;
152 float _scale3D;
153 DXVector3 _shadowLightPos;
154 bool _drawBackfaces;
155 TShadowType _shadowType;
156 virtual uint32 getAnimTransitionTime(const char *from, const char *to) {
157 return 0;
158 };
159#endif
160
161public:
162 // scripting interface
163 ScValue *scGetProperty(const char *name) override;
164 bool scSetProperty(const char *name, ScValue *value) override;
165 bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
166 const char *scToString() override;
167};
168
169} // End of namespace Wintermute
170
171#endif
Definition: base_dynamic_buffer.h:35
Definition: base_game.h:79
Definition: base_object.h:49
Definition: base_script_holder.h:37
Definition: base_sound.h:39
Definition: base_sprite.h:40
Definition: base_surface.h:37
Definition: script.h:44
Definition: script_stack.h:41
Definition: script_value.h:42
Definition: xmodel.h:54
Definition: events.h:218
Definition: rect.h:538
Definition: xmath.h:139
Definition: xmath.h:72