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