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  TDirection _targetDir{DI_NONE};
56  TDirection _afterWalkDir;
57  virtual void turnTo(TDirection dir);
58  AdPath *_path;
59  AdSpriteSet *_walkSprite;
60  AdSpriteSet *_standSprite;
61  AdSpriteSet *_turnLeftSprite;
62  AdSpriteSet *_turnRightSprite;
63  BaseArray<AdSpriteSet *> _talkSprites;
64  BaseArray<AdSpriteSet *> _talkSpritesEx;
65  TDirection _dir;
66  AdActor(BaseGame *inGame/*=nullptr*/);
67  ~AdActor() override;
68  bool loadFile(const char *filename);
69  bool loadBuffer(char *buffer, bool complete = true);
70 
71  // new anim system
72  Common::String _talkAnimName;
73  Common::String _idleAnimName;
74  Common::String _walkAnimName;
75  Common::String _turnLeftAnimName;
76  Common::String _turnRightAnimName;
78  bool playAnim(const char *filename) override;
79  AdSpriteSet *getAnimByName(const Common::String &animName);
80 
81  // scripting interface
82  ScValue *scGetProperty(const Common::String &name) override;
83  bool scSetProperty(const char *name, ScValue *value) override;
84  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
85  const char *scToString() override;
86 
87  bool setDefaultAnimNames();
88  BaseSprite *getTalkStanceOld(const char *stance);
89  bool mergeAnims(const char *animsFilename);
90  BaseSprite *_animSprite2;
91 
92  void initLine(const BasePoint &startPt, const BasePoint &endPt);
93  void getNextStep();
94  void followPath();
95  double _pFStepX{};
96  double _pFStepY{};
97  double _pFX{};
98  double _pFY{};
99  int32 _pFCount{};
100 };
101 
102 } // End of namespace Wintermute
103 
104 #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:347
Definition: ad_path.h:37
Definition: base_sprite.h:40
Definition: achievements_tables.h:27