ScummVM API documentation
ad_actor_3dx.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.
24  * http://dead-code.org/redir.php?target=wme
25  * Copyright (c) 2003-2013 Jan Nedoma and contributors
26  */
27 
28 #ifndef WINTERMUTE_AD_ACTOR_3DX_H
29 #define WINTERMUTE_AD_ACTOR_3DX_H
30 
31 #include "engines/wintermute/ad/ad_object_3d.h"
32 #include "engines/wintermute/base/base_animation_transition_time.h"
33 #include "engines/wintermute/base/base_point.h"
34 #include "engines/wintermute/base/gfx/xmath.h"
35 #include "engines/wintermute/coll_templ.h"
36 
37 namespace Wintermute {
38 
39 class AdAttach3DX;
40 class AdPath;
41 class AdPath3D;
42 
43 class AdActor3DX : public AdObject3D {
44 public:
45  PartEmitter *createParticleEmitter(bool followParent = false, int offsetX = 0, int offsetY = 0) override;
46  virtual PartEmitter *createParticleEmitter(const char *boneName, DXVector3 offset);
47  bool updatePartEmitter() override;
48  Common::String _partBone;
49  DXVector3 _partOffset;
50 
51  bool displayShadowVolume();
52  bool restoreDeviceObjects() override;
53  bool invalidateDeviceObjects() override;
54  int32 _stateAnimChannel;
55  void talk(const char *text, const char *sound = nullptr, uint32 duration = 0, const char *stances = nullptr, TTextAlign align = TAL_CENTER) override;
56  int32 getHeight() override;
57  bool playAnim3DX(const char *name, bool setState);
58  bool playAnim3DX(int channel, const char *name, bool setState);
59 
60  uint32 getAnimTransitionTime(char *from, char *to) override;
62 
63  virtual bool renderModel() override;
64 
65  uint32 _defaultTransTime;
66  uint32 _defaultStopTransTime;
67 
68  float _afterWalkAngle;
69  Common::String _talkAnimName;
70  Common::String _idleAnimName;
71  Common::String _walkAnimName;
72  Common::String _turnLeftAnimName;
73  Common::String _turnRightAnimName;
74 
75  int32 _talkAnimChannel;
76 
77  TDirectWalkMode _directWalkMode;
78  TDirectTurnMode _directTurnMode;
79  Common::String _directWalkAnim;
80  Common::String _directTurnAnim;
81  float _directWalkVelocity;
82  float _directTurnVelocity;
83 
84  int32 _goToTolerance;
85 
86  DECLARE_PERSISTENT(AdActor3DX, AdObject3D)
87  bool _turningLeft;
88 
89  void initLine3D(DXVector3 startPt, DXVector3 endPt, bool firstStep);
90  void getNextStep3D();
91  void followPath3D();
92 
93  void getNextStep2D();
94  void followPath2D();
95 
96  void goTo3D(DXVector3 targetPos, float targetAngle = -1.0f);
97  void goTo2D(int x, int y, float targetAngle = -1.0f);
98  bool turnTo(float angle);
99  DXVector3 _targetPoint3D;
100  BasePoint *_targetPoint2D;
101  float _targetAngle;
102  bool display() override;
103  bool update() override;
104  AdActor3DX(BaseGame *inGame);
105  virtual ~AdActor3DX();
106  AdPath3D *_path3D;
107  AdPath *_path2D;
108  bool loadFile(const char *filename);
109  bool loadBuffer(byte *buffer, bool complete = true);
110  float dirToAngle(TDirection dir);
111  TDirection angleToDir(float angle);
112 
113  bool updateAttachments();
114  bool displayAttachments(bool registerObjects);
115 
116  // scripting interface
117  ScValue *scGetProperty(const Common::String &name) override;
118  bool scSetProperty(const char *name, ScValue *value) override;
119  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
120  const char *scToString() override;
121 
122 private:
123  bool parseEffect(byte *buffer);
124  BaseArray<AdAttach3DX *> _attachments;
125  bool turnToStep(float velocity);
126  bool prepareTurn(float targetAngle);
127  bool mergeAnimations(const char *filename);
128  bool mergeAnimations2(const char *filename);
129  bool unloadAnimation(const char *animName);
130  bool isGoToNeeded(int x, int y);
131 };
132 
133 } // namespace Wintermute
134 
135 #endif
Definition: script.h:44
Definition: base_game.h:76
Definition: base_point.h:36
Definition: ad_path3d.h:37
Definition: script_value.h:42
Definition: str.h:59
Definition: xmath.h:50
Definition: ad_actor_3dx.h:43
Definition: script_stack.h:41
Definition: part_emitter.h:38
Definition: ad_object_3d.h:37
Definition: coll_templ.h:63
Definition: ad_path.h:37
Definition: achievements_tables.h:27