ScummVM API documentation
ad_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_ADOBJECT_H
29 #define WINTERMUTE_ADOBJECT_H
30 
31 #include "engines/wintermute/ad/ad_types.h"
32 #include "engines/wintermute/base/base_object.h"
33 
34 namespace Wintermute {
35 
36 class AdWaypointGroup;
37 class AdRegion;
38 class AdSentence;
39 class BaseFont;
40 class BaseRegion;
41 class AdInventory;
42 class PartEmitter;
43 
44 #define MAX_NUM_REGIONS 10
45 
46 class AdObject : public BaseObject {
47 public:
48  virtual PartEmitter *createParticleEmitter(bool followParent = false, int offsetX = 0, int offsetY = 0);
49  virtual bool updatePartEmitter();
50 
51  bool invalidateCurrRegions();
52  AdRegion *_stickRegion;
53  bool _sceneIndependent;
54 
55  bool updateBlockRegion();
56 
57  bool getExtendedFlag(const char *flagName) override;
58  bool resetSoundPan() override;
59  bool updateSounds() override;
60  bool reset();
61  DECLARE_PERSISTENT(AdObject, BaseObject)
62  virtual void talk(const char *text, const char *sound = nullptr, uint32 duration = 0, const char *stances = nullptr, TTextAlign align = TAL_CENTER);
63  int32 getHeight() override;
64 
65  bool setFont(const char *filename);
66  bool update() override;
67  bool display() override;
68 
69  bool _drawn;
70  bool _active;
71  virtual bool playAnim(const char *filename);
72 
73  TObjectType getType() const;
74  AdObject(BaseGame *inGame);
75  ~AdObject() override;
76 
77  BaseRegion *_currentBlockRegion;
78  AdWaypointGroup *_currentWptGroup;
79  AdInventory *getInventory();
80 
81  bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
82  bool afterMove() override;
83 
84  // scripting interface
85  ScValue *scGetProperty(const Common::String &name) override;
86  bool scSetProperty(const char *name, ScValue *value) override;
87  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
88  const char *scToString() override;
89  bool updateSpriteAttachments();
90  bool displaySpriteAttachments(bool preDisplay);
91 
92 protected:
93  PartEmitter *_partEmitter;
94  bool _ignoreItems;
95  bool _forcedTalkAnimUsed;
96  char *_forcedTalkAnimName;
97  BaseSprite *_animSprite;
98  BaseSprite *_currentSprite;
99  AdSentence *_sentence;
100  TObjectState _state;
101  TObjectState _nextState;
102  TObjectType _type;
103  BaseFont *_font;
104  BaseSprite *_tempSprite2;
105  BaseRegion *_blockRegion;
106  AdWaypointGroup *_wptGroup;
107  AdObject *_registerAlias;
108  bool getScale(float *scaleX, float *scaleY);
109 private:
110  bool _partFollowParent;
111  int32 _partOffsetX;
112  int32 _partOffsetY;
113  bool _subtitlesModRelative;
114  bool _subtitlesModXCenter;
115  int32 _subtitlesModX;
116  int32 _subtitlesModY;
117  int32 _subtitlesWidth;
118  AdRegion *_currentRegions[MAX_NUM_REGIONS];
119  BaseArray<AdObject *> _attachmentsPre;
120  BaseArray<AdObject *> _attachmentsPost;
121  bool displaySpriteAttachment(AdObject *attachment);
122  AdInventory *_inventory;
123 };
124 
125 } // End of namespace Wintermute
126 
127 #endif
Definition: script.h:44
Definition: ad_inventory.h:37
Definition: base_game.h:75
Definition: ad_sentence.h:43
Definition: script_value.h:42
Definition: str.h:59
Definition: ad_object.h:46
Definition: ad_region.h:35
Definition: base_dynamic_buffer.h:35
Definition: base_region.h:36
Definition: script_stack.h:41
Definition: part_emitter.h:38
Definition: coll_templ.h:63
Definition: base_font.h:37
Definition: ad_waypoint_group.h:35
Definition: base_sprite.h:40
Definition: base_object.h:57
Definition: achievements_tables.h:27