ScummVM API documentation
part_particle.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_PARTPARTICLE_H
29 #define WINTERMUTE_PARTPARTICLE_H
30 
31 #include "common/rect.h"
32 #include "engines/wintermute/base/base.h"
33 #include "engines/wintermute/math/vector2.h"
34 
35 namespace Wintermute {
36 
37 class PartEmitter;
38 class BaseSprite;
39 class BasePersistenceManager;
40 
41 class PartParticle : public BaseClass {
42 public:
43  enum TParticleState {
44  PARTICLE_NORMAL,
45  PARTICLE_FADEIN,
46  PARTICLE_FADEOUT
47  };
48 
49  PartParticle(BaseGame *inGame);
50  ~PartParticle() override;
51 
52  float _growthRate;
53  bool _exponentialGrowth;
54 
55  float _rotation;
56  float _angVelocity;
57 
58  int32 _alpha1;
59  int32 _alpha2;
60 
61  Common::Rect32 _border;
62  Vector2 _pos;
63  float _posZ;
64  Vector2 _velocity;
65  float _scale;
66  BaseSprite *_sprite;
67  uint32 _creationTime;
68  int32 _lifeTime;
69  bool _isDead;
70  TParticleState _state;
71 
72  bool update(PartEmitter *emitter, uint32 currentTime, uint32 timerDelta);
73  bool display(PartEmitter *emitter);
74 
75  bool setSprite(const Common::String &filename);
76 
77  bool fadeIn(uint32 currentTime, int fadeTime);
78  bool fadeOut(uint32 currentTime, int fadeTime);
79 
80  bool persist(BasePersistenceManager *PersistMgr) override;
81 
82 private:
83  uint32 _fadeStart;
84  int32 _fadeTime;
85  int32 _currentAlpha;
86  int32 _fadeStartAlpha{};
87 };
88 
89 } // End of namespace Wintermute
90 
91 #endif
Definition: base_game.h:75
Definition: rect.h:526
Definition: str.h:59
Definition: base_persistence_manager.h:55
Definition: part_particle.h:41
Definition: vector2.h:33
Definition: part_emitter.h:38
Definition: base.h:43
Definition: base_sprite.h:40
Definition: achievements_tables.h:27