ScummVM API documentation
ad_actor.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_ADACTOR_H
29 #define WINTERMUTE_ADACTOR_H
30 
31 #include "engines/wintermute/dctypes.h" // Added by ClassView
32 #include "engines/wintermute/ad/ad_types.h" // Added by ClassView
33 #include "engines/wintermute/ad/ad_talk_holder.h"
34 #include "engines/wintermute/coll_templ.h"
35 #include "engines/wintermute/base/base_point.h" // Added by ClassView
36 #include "engines/wintermute/persistent.h"
37 
38 #include "common/str.h"
39 
40 namespace Wintermute {
41 
42 class AdSpriteSet;
43 class AdPath;
44 class BaseSprite;
45 class AdActor : public AdTalkHolder {
46 public:
47  TDirection angleToDirection(int angle);
48  DECLARE_PERSISTENT(AdActor, AdTalkHolder)
49  int32 getHeight() override;
50  BaseSprite *getTalkStance(const char *stance) override;
51  virtual void goTo(int x, int y, TDirection afterWalkDir = DI_NONE);
52  BasePoint *_targetPoint;
53  bool update() override;
54  bool display() override;
55  virtual void turnTo(TDirection dir);
56  AdActor(BaseGame *inGame/*=nullptr*/);
57  ~AdActor() override;
58  bool loadFile(const char *filename);
59  bool loadBuffer(char *buffer, bool complete = true);
60 
61 
62 private:
63  TDirection _targetDir;
64  TDirection _afterWalkDir;
65 
66  AdPath *_path;
67  AdSpriteSet *_walkSprite;
68  AdSpriteSet *_standSprite;
69  AdSpriteSet *_turnLeftSprite;
70  AdSpriteSet *_turnRightSprite;
71  BaseArray<AdSpriteSet *> _talkSprites;
72  BaseArray<AdSpriteSet *> _talkSpritesEx;
73  TDirection _dir;
74  // new anim system
75  Common::String _talkAnimName;
76  Common::String _idleAnimName;
77  Common::String _walkAnimName;
78  Common::String _turnLeftAnimName;
79  Common::String _turnRightAnimName;
81  bool playAnim(const char *filename) override;
82  AdSpriteSet *getAnimByName(const Common::String &animName);
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 
90  bool setDefaultAnimNames();
91  BaseSprite *getTalkStanceOld(const char *stance);
92  bool mergeAnims(const char *animsFilename);
93  BaseSprite *_animSprite2;
94 
95  void initLine(const BasePoint &startPt, const BasePoint &endPt);
96  void getNextStep();
97  void followPath();
98  double _pFStepX;
99  double _pFStepY;
100  double _pFX;
101  double _pFY;
102  int32 _pFCount;
103 };
104 
105 } // End of namespace Wintermute
106 
107 #endif
Definition: script.h:44
Definition: base_game.h:75
Definition: base_point.h:36
Definition: ad_actor.h:45
Definition: script_value.h:42
Definition: str.h:59
Definition: ad_talk_holder.h:35
Definition: script_stack.h:41
Definition: ad_sprite_set.h:36
Definition: coll_templ.h:63
Definition: ad_path.h:37
Definition: base_sprite.h:40
Definition: achievements_tables.h:27