ScummVM API documentation
part_emitter.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_PARTEMITTER_H
29 #define WINTERMUTE_PARTEMITTER_H
30 
31 
32 #include "engines/wintermute/base/base_object.h"
33 #include "engines/wintermute/base/particles/part_force.h"
34 
35 namespace Wintermute {
36 class BaseRegion;
37 class PartParticle;
38 class PartEmitter : public BaseObject {
39 public:
40  DECLARE_PERSISTENT(PartEmitter, BaseObject)
41 
42  PartEmitter(BaseGame *inGame, BaseScriptHolder *Owner);
43  ~PartEmitter() override;
44 
45  int32 _width;
46  int32 _height;
47 
48  int32 _angle1;
49  int32 _angle2;
50 
51  float _rotation1;
52  float _rotation2;
53 
54  float _angVelocity1;
55  float _angVelocity2;
56 
57  float _growthRate1;
58  float _growthRate2;
59  bool _exponentialGrowth;
60 
61  float _velocity1;
62  float _velocity2;
63  bool _velocityZBased;
64 
65  float _scale1;
66  float _scale2;
67  bool _scaleZBased;
68 
69  int32 _maxParticles;
70 
71  int32 _lifeTime1;
72  int32 _lifeTime2;
73  bool _lifeTimeZBased;
74 
75  int32 _genInterval;
76  int32 _genAmount;
77 
78  bool _running;
79  int32 _overheadTime;
80 
81  int32 _maxBatches;
82  int32 _batchesGenerated;
83 
84  Common::Rect32 _border;
85  int32 _borderThicknessLeft;
86  int32 _borderThicknessRight;
87  int32 _borderThicknessTop;
88  int32 _borderThicknessBottom;
89 
90  int32 _fadeInTime;
91  int32 _fadeOutTime;
92 
93  int32 _alpha1;
94  int32 _alpha2;
95  bool _alphaTimeBased;
96 
97  bool _useRegion;
98 
99  char *_emitEvent;
100  BaseScriptHolder *_owner;
101 
102  bool start();
103 
104  bool update() override;
105  bool display() override { return display(nullptr); } // To avoid shadowing the inherited display-function.
106  bool display(BaseRegion *region);
107 
108  bool sortParticlesByZ();
109  bool addSprite(const char *filename);
110  bool removeSprite(const char *filename);
111  bool setBorder(int x, int y, int width, int height);
112  bool setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom);
113 
114  bool addForce(const Common::String &name, PartForce::TForceType type, int posX, int posY, float angle, float strength);
115  bool removeForce(const Common::String &name);
116 
117  BaseArray<PartForce *> _forces;
118 
119  // scripting interface
120  ScValue *scGetProperty(const Common::String &name) override;
121  bool scSetProperty(const char *name, ScValue *value) override;
122  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
123  const char *scToString() override;
124 
125 private:
126  PartForce *addForceByName(const Common::String &name);
127  int static compareZ(const void *obj1, const void *obj2);
128  bool initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta);
129  bool updateInternal(uint32 currentTime, uint32 timerDelta);
130  uint32 _lastGenTime;
131  BaseArray<PartParticle *> _particles;
132  BaseArray<char *> _sprites;
133 };
134 
135 } // End of namespace Wintermute
136 
137 #endif
Definition: script.h:44
Definition: base_game.h:75
Definition: rect.h:526
Definition: script_value.h:42
Definition: str.h:59
Definition: part_particle.h:41
Definition: part_force.h:38
Definition: base_region.h:36
Definition: script_stack.h:41
Definition: part_emitter.h:38
Definition: base_script_holder.h:37
Definition: coll_templ.h:347
Definition: coll_templ.h:373
Definition: base_object.h:49
Definition: achievements_tables.h:27