ScummVM API documentation
people.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 #ifndef SLUDGE_PEOPLE_H
22 #define SLUDGE_PEOPLE_H
23 
24 #include "common/list.h"
25 
26 namespace Sludge {
27 
28 struct FrozenStuffStruct;
29 struct LoadedSpriteBank;
30 struct ScreenRegion;
31 struct VariableStack;
32 
33 class SludgeEngine;
34 
35 struct AnimFrame {
36  int frameNum, howMany;
37  int noise;
38 };
39 
40 #define EXTRA_FRONT 1
41 #define EXTRA_FIXEDSIZE 2
42 #define EXTRA_NOSCALE 2 // Alternative name
43 #define EXTRA_NOZB 4
44 #define EXTRA_FIXTOSCREEN 8
45 #define EXTRA_NOLITE 16
46 #define EXTRA_NOREMOVE 32
47 #define EXTRA_RECTANGULAR 64
48 
50  LoadedSpriteBank *theSprites;
51  AnimFrame *frames;
52  int numFrames;
53 
55  PersonaAnimation(int num, VariableStack *&stacky);
58 
59  // Setter & getter
60  int getTotalTime();
61 
62  // Save & load
63  bool save(Common::WriteStream *stream);
64  bool load(Common::SeekableReadStream *stream);
65 };
66 
67 struct Persona {
68  PersonaAnimation **animation;
69  int numDirections;
70 
71  // Save & load
72  bool save(Common::WriteStream *stream);
73  bool load(Common::SeekableReadStream *stream);
74 };
75 
77  float x, y;
78  int height, floaty, walkSpeed;
79  float scale;
80  int walkToX, walkToY, thisStepX, thisStepY, inPoly, walkToPoly;
81  bool walking, spinning;
82  struct LoadedFunction *continueAfterWalking;
83  PersonaAnimation *myAnim;
84  PersonaAnimation *lastUsedAnim;
85  Persona *myPersona;
86  int frameNum, frameTick, angle, wantAngle, angleOffset;
87  bool show;
88  int direction, directionWhenDoneWalking;
89  struct ObjectType *thisType;
90  int extra, spinSpeed;
91  byte r, g, b, colourmix, transparency;
92 
93  void makeTalker();
94  void makeSilent();
95  void setFrames(int a);
96 };
97 
99 
101 public:
103  ~PeopleManager();
104 
105  // Initialisation and creation
106  bool init();
107  bool addPerson(int x, int y, int objNum, Persona *p);
108 
109  // Draw to screen and to backdrop
110  void drawPeople();
111  void freezePeople(int, int);
112 
113  // Removalisationisms
114  void kill();
115  void killMostPeople();
116  void removeOneCharacter(int i);
117 
118  // Things which affect or use all characters
119  OnScreenPerson *findPerson(int v);
120  void setScale(int16 h, int16 d);
121 
122  // Things which affect one character
123  void setShown(bool h, int ob);
124  void setDrawMode(int h, int ob);
125  void setPersonTransparency(int ob, byte x);
126  void setPersonColourise(int ob, byte r, byte g, byte b, byte colourmix);
127 
128  // Moving 'em
129  void movePerson(int x, int y, int objNum);
130  bool makeWalkingPerson(int x, int y, int objNum, struct LoadedFunction *func, int di);
131  bool forceWalkingPerson(int x, int y, int objNum, struct LoadedFunction *func, int di);
132  void jumpPerson(int x, int y, int objNum);
133  void walkAllPeople();
134  bool turnPersonToFace(int thisNum, int direc);
135  bool stopPerson(int o);
136  bool floatCharacter(int f, int objNum);
137  bool setCharacterWalkSpeed(int f, int objNum);
138 
139  // Animating 'em
140  void animatePerson(int obj, PersonaAnimation *);
141  void animatePerson(int obj, Persona *per);
142  bool setPersonExtra(int f, int newSetting);
143 
144  // Loading and saving
145  bool savePeople(Common::WriteStream *stream);
146  bool loadPeople(Common::SeekableReadStream *stream);
147 
148  // Freeze
149  void freeze(FrozenStuffStruct *frozenStuff);
150  void resotre(FrozenStuffStruct *frozenStuff);
151 
152 private:
153  ScreenRegion *_personRegion;
154  OnScreenPersonList *_allPeople;
155  int16 _scaleHorizon;
156  int16 _scaleDivide;
157 
158  SludgeEngine *_vm;
159 
160  void shufflePeople();
161 
162  // OnScreenPerson manipulation
163  void turnMeAngle(OnScreenPerson *thisPerson, int direc);
164  void spinStep(OnScreenPerson *thisPerson);
165  void rethinkAngle(OnScreenPerson *thisPerson);
166  void moveAndScale(OnScreenPerson &me, float x, float y);
167  void setMyDrawMode(OnScreenPerson *moveMe, int h);
168  bool walkMe(OnScreenPerson *thisPerson, bool move = true);
169 };
170 
171 } // End of namespace Sludge
172 
173 #endif
Definition: people.h:100
Definition: variable.h:132
Definition: objtypes.h:32
Definition: people.h:76
Definition: people.h:49
Definition: stream.h:77
Definition: region.h:28
Definition: list.h:44
Definition: stream.h:745
Definition: people.h:67
Definition: people.h:35
Definition: function.h:37
Definition: sludge.h:68
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
constexpr remove_reference_t< T > && move(T &&t) noexcept
Definition: util.h:209
Definition: builtin.h:27
Definition: freeze.h:41
Definition: sprbanks.h:28