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
40namespace Wintermute {
41
42class AdSpriteSet;
43class AdPath;
44class BaseSprite;
45class AdActor : public AdTalkHolder {
46public:
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 char *_talkAnimName;
73 char *_idleAnimName;
74 char *_walkAnimName;
75 char *_turnLeftAnimName;
76 char *_turnRightAnimName;
78 bool playAnim(const char *filename) override;
79 AdSpriteSet *getAnimByName(const char *animName);
80
81 // alternative behaviour when actor is blocked
82 bool _stopOnBlocked;
83 bool _actorIsBlocked;
84
85 // scripting interface
86 ScValue *scGetProperty(const char *name) override;
87 bool scSetProperty(const char *name, ScValue *value) override;
88 bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
89 const char *scToString() override;
90
91private:
92 bool setDefaultAnimNames();
93 BaseSprite *getTalkStanceOld(const char *stance);
94 bool mergeAnims(const char *animsFilename);
95 BaseSprite *_animSprite2;
96
97 void initLine(BasePoint startPt, BasePoint endPt);
98 void getNextStep();
99 void followPath();
100 double _pFStepX{};
101 double _pFStepY{};
102 double _pFX{};
103 double _pFY{};
104 int32 _pFCount{};
105};
106
107} // End of namespace Wintermute
108
109#endif
Definition: ad_actor.h:45
Definition: ad_path.h:37
Definition: ad_sprite_set.h:36
Definition: ad_talk_holder.h:35
Definition: coll_templ.h:345
Definition: base_game.h:79
Definition: base_point.h:36
Definition: base_sprite.h:40
Definition: script.h:44
Definition: script_stack.h:41
Definition: script_value.h:42