ScummVM API documentation
character.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 #ifndef GNAP_CHARACTER_H
23 #define GNAP_CHARACTER_H
24 
25 namespace Gnap {
26 
27 class GnapEngine;
28 
29 enum Facing {
30  kDirIdleLeft = 0,
31  kDirBottomRight = 1,
32  kDirBottomLeft = 3,
33  kDirIdleRight = 4,
34  kDirUpLeft = 5,
35  kDirUpRight = 7
36 };
37 
38 struct GridStruct {
39  int _deltaX, _deltaY;
40  int _gridX1, _gridY1;
41  int _sequenceId;
42  int _id;
43 };
44 
45 const int kMaxGridStructs = 30;
46 
47 class Character {
48 public:
49  Character(GnapEngine *vm);
50  virtual ~Character();
51 
52  void walkStep();
53 
54  virtual int getSequenceId(int kind, Common::Point gridPos) = 0;
55  virtual void playSequence(int sequenceId) = 0;
56  virtual void updateIdleSequence() = 0;
57  virtual void updateIdleSequence2() = 0;
58  virtual void initPos(int gridX, int gridY, Facing facing) = 0;
59  virtual int getWalkSequenceId(int deltaX, int deltaY) = 0;
60  virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) = 0;
61 
62  Common::Point _pos;
63  Facing _idleFacing;
64  int _actionStatus;
65  int _sequenceId;
66  int _sequenceDatNum;
67  int _id;
68  int _gridX;
69  int _gridY;
70  int _walkNodesCount;
71  GridStruct _walkNodes[kMaxGridStructs];
72  int _walkDestX, _walkDestY;
73  int _walkDeltaX, _walkDeltaY, _walkDirX, _walkDirY, _walkDirXIncr, _walkDirYIncr;
74 
75 protected:
76  GnapEngine *_vm;
77 };
78 
79 class PlayerGnap : public Character {
80 public:
82  int getSequenceId(int kind, Common::Point gridPos) override;
83  void initPos(int gridX, int gridY, Facing facing) override;
84  void playSequence(int sequenceId) override;
85  void updateIdleSequence() override;
86  void updateIdleSequence2() override;
87  int getWalkSequenceId(int deltaX, int deltaY) override;
88  bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) override;
89 
90  void actionIdle(int sequenceId);
91  bool doPlatypusAction(int gridX, int gridY, int platSequenceId, int callback);
92  int getShowSequenceId(int index, int gridX, int gridY);
93  Facing getWalkFacing(int deltaX, int deltaY);
94  int getWalkStopSequenceId(int deltaX, int deltaY);
95  void idle();
96  void initBrainPulseRndValue();
97  void kissPlatypus(int callback);
98  void playBrainPulsating(Common::Point gridPos = Common::Point(0, 0));
99  void playIdle(Common::Point gridPos = Common::Point(0, 0));
100  void playImpossible(Common::Point gridPos = Common::Point(0, 0));
101  void playMoan1(Common::Point gridPos = Common::Point(0, 0));
102  void playMoan2(Common::Point gridPos = Common::Point(0, 0));
103  void playPullOutDevice(Common::Point gridPos = Common::Point(0, 0));
104  void playPullOutDeviceNonWorking(Common::Point gridPos = Common::Point(0, 0));
105  void playScratchingHead(Common::Point gridPos = Common::Point(0, 0));
106  void playShowCurrItem(Common::Point destPos, int gridLookX, int gridLookY);
107  void playShowItem(int itemIndex, int gridLookX, int gridLookY);
108  void playUseDevice(Common::Point gridPos = Common::Point(0, 0));
109  void useDeviceOnPlatypus();
110  void useDisguiseOnPlatypus();
111  void useJointOnPlatypus();
112 
113  int _brainPulseNum;
114  int _brainPulseRndValue;
115 
116 private:
117  bool findPath1(int gridX, int gridY, int index);
118  bool findPath2(int gridX, int gridY, int index);
119  bool findPath3(int gridX, int gridY);
120  bool findPath4(int gridX, int gridY);
121 };
122 
123 class PlayerPlat : public Character {
124 public:
125  PlayerPlat(GnapEngine *vm);
126  ~PlayerPlat() override {}
127  int getSequenceId(int kind = 0, Common::Point gridPos = Common::Point(0, 0)) override;
128  void initPos(int gridX, int gridY, Facing facing) override;
129  void playSequence(int sequenceId) override;
130  void updateIdleSequence() override;
131  void updateIdleSequence2() override;
132  int getWalkSequenceId(int deltaX, int deltaY) override;
133  bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) override;
134 
135  void makeRoom();
136 
137 private:
138  bool findPath1(int gridX, int gridY, int index);
139  bool findPath2(int gridX, int gridY, int index);
140  bool findPath3(int gridX, int gridY);
141  bool findPath4(int gridX, int gridY);
142 };
143 } // End of namespace Gnap
144 
145 #endif // GNAP_CHARACTER_H
Definition: character.h:79
Definition: character.h:47
Definition: rect.h:45
Definition: character.h:25
Definition: gnap.h:222
Definition: character.h:123
Definition: character.h:38