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