scummvm/engines/wintermute/Base/PartEmitter.h

140 lines
3.6 KiB
C
Raw Normal View History

/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
2012-03-06 03:26:55 +00:00
/*
* This file is based on WME Lite.
* http://dead-code.org/redir.php?target=wmelite
* Copyright (c) 2011 Jan Nedoma
*/
#ifndef WINTERMUTE_PARTEMITTER_H
#define WINTERMUTE_PARTEMITTER_H
2012-03-06 03:26:55 +00:00
#include "engines/wintermute/Base/BObject.h"
#include "engines/wintermute/Base/PartParticle.h"
#include "engines/wintermute/Base/PartForce.h"
2012-03-06 03:26:55 +00:00
namespace WinterMute {
class CBRegion;
class CPartEmitter : public CBObject {
public:
DECLARE_PERSISTENT(CPartEmitter, CBObject)
CPartEmitter(CBGame *inGame, CBScriptHolder *Owner);
virtual ~CPartEmitter(void);
int _width;
int _height;
2012-03-06 03:26:55 +00:00
int _angle1;
int _angle2;
2012-03-06 03:26:55 +00:00
float _rotation1;
float _rotation2;
2012-03-06 03:26:55 +00:00
float _angVelocity1;
float _angVelocity2;
2012-03-06 03:26:55 +00:00
float _growthRate1;
float _growthRate2;
bool _exponentialGrowth;
2012-03-06 03:26:55 +00:00
float _velocity1;
float _velocity2;
bool _velocityZBased;
2012-03-06 03:26:55 +00:00
float _scale1;
float _scale2;
bool _scaleZBased;
2012-03-06 03:26:55 +00:00
int _maxParticles;
2012-03-06 03:26:55 +00:00
int _lifeTime1;
int _lifeTime2;
bool _lifeTimeZBased;
2012-03-06 03:26:55 +00:00
int _genInterval;
int _genAmount;
2012-03-06 03:26:55 +00:00
bool _running;
int _overheadTime;
2012-03-06 03:26:55 +00:00
int _maxBatches;
int _batchesGenerated;
2012-03-06 03:26:55 +00:00
RECT _border;
int _borderThicknessLeft;
int _borderThicknessRight;
int _borderThicknessTop;
int _borderThicknessBottom;
2012-03-06 03:26:55 +00:00
int _fadeInTime;
int _fadeOutTime;
2012-03-06 03:26:55 +00:00
int _alpha1;
int _alpha2;
bool _alphaTimeBased;
2012-03-06 03:26:55 +00:00
bool _useRegion;
2012-03-06 03:26:55 +00:00
char *_emitEvent;
CBScriptHolder *_owner;
2012-03-06 03:26:55 +00:00
HRESULT Start();
HRESULT Update();
HRESULT Display(CBRegion *Region = NULL);
HRESULT SortParticlesByZ();
HRESULT AddSprite(const char *Filename);
HRESULT RemoveSprite(const char *Filename);
2012-03-06 03:26:55 +00:00
HRESULT SetBorder(int X, int Y, int Width, int Height);
HRESULT SetBorderThickness(int ThicknessLeft, int ThicknessRight, int ThicknessTop, int ThicknessBottom);
HRESULT AddForce(const char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength);
HRESULT RemoveForce(const char *Name);
2012-03-06 03:26:55 +00:00
CBArray<CPartForce *, CPartForce *> _forces;
2012-03-06 03:26:55 +00:00
// scripting interface
virtual CScValue *ScGetProperty(const char *Name);
virtual HRESULT ScSetProperty(const char *Name, CScValue *Value);
virtual HRESULT ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisStack, const char *Name);
virtual const char *ScToString();
2012-03-06 03:26:55 +00:00
private:
CPartForce *AddForceByName(const char *Name);
2012-03-06 03:26:55 +00:00
int static CompareZ(const void *Obj1, const void *Obj2);
HRESULT InitParticle(CPartParticle *Particle, uint32 CurrentTime, uint32 TimerDelta);
HRESULT UpdateInternal(uint32 CurrentTime, uint32 TimerDelta);
uint32 _lastGenTime;
CBArray<CPartParticle *, CPartParticle *> _particles;
CBArray<char *, char *> _sprites;
2012-03-06 03:26:55 +00:00
};
} // end of namespace WinterMute
#endif