This commit is contained in:
parent
8dfb2b0591
commit
d6b7483cc6
@ -1,6 +1,6 @@
|
|||||||
/*****************/
|
/***************/
|
||||||
/*** Bubble FX ***/
|
/*** Fire FX ***/
|
||||||
/*****************/
|
/***************/
|
||||||
|
|
||||||
#include "system\global.h"
|
#include "system\global.h"
|
||||||
#include <DStructs.h>
|
#include <DStructs.h>
|
||||||
@ -12,42 +12,98 @@
|
|||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#include "level\layercollision.h"
|
#include "level\layercollision.h"
|
||||||
#include "FX\FXBaseAnim.h"
|
#include "FX\FXBaseAnim.h"
|
||||||
#include "FX\FXBubble.h"
|
#include "FX\FXFire.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFXBubble::init(DVECTOR const &_Pos)
|
void CFXFire::init(DVECTOR const &_Pos)
|
||||||
{
|
{
|
||||||
CFXBaseAnim::init(_Pos);
|
CFXBaseAnim::init(_Pos);
|
||||||
Life=32+getRndRange(63);
|
OtPos++;
|
||||||
Velocity.vy=-(getRndRange(4)+1);
|
|
||||||
CurrentScaleX=CurrentScaleY=getRndRange(ONE/2)+(ONE/2);
|
|
||||||
XIdx=getRnd()&15;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Think *******************************************************************/
|
/*** Render ******************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static const s16 XT[16]={ 0,+1,+0,+1,+0, 0,-1,+0,-1,+0,0,+1,+0,+1,+0,};
|
static const int FT=3;
|
||||||
|
static const int FC=128;
|
||||||
|
static const int FO=2;
|
||||||
|
|
||||||
void CFXBubble::think(int _frames)
|
void CFXFire::render()
|
||||||
{
|
{
|
||||||
Life-=_frames;
|
if (!HasInit) return;
|
||||||
if (Life<=0)
|
|
||||||
{
|
|
||||||
if (renderFrame!=FRM__BUBBLEPOP)
|
DVECTOR RenderPos;
|
||||||
{
|
getFXRenderPos(RenderPos);
|
||||||
renderFrame=FRM__BUBBLEPOP;
|
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
||||||
|
|
||||||
|
POLY_FT4 *Ft4;
|
||||||
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
||||||
|
sFrameHdr *Hdr=SprBank->getFrameHeader(renderFrame);
|
||||||
|
int SW=Hdr->W;
|
||||||
|
int SH=Hdr->H;
|
||||||
|
|
||||||
|
int W=SprW;
|
||||||
|
int HW=SprW/2;
|
||||||
|
int H=SprH;
|
||||||
|
int HH=SprH/2;
|
||||||
|
int FXO=0;
|
||||||
|
int FYO=0;
|
||||||
|
Frame=SprBank->printFT4(renderFrame,RenderPos.vx,RenderPos.vy,0,0,OtPos);
|
||||||
|
setShadeTex(Frame,0);
|
||||||
|
setRGB0(Frame,FC,FC,FC);
|
||||||
|
setSemiTrans(Frame,1);
|
||||||
|
Frame->tpage|=FT<<5;
|
||||||
|
Frame->u1--; Frame->u2--;
|
||||||
|
Frame->v2--; Frame->v3--;
|
||||||
|
|
||||||
|
if (CurrentHeading<1024*1)
|
||||||
|
{ // up
|
||||||
|
RenderPos.vy+=HH;
|
||||||
|
Frame->x0=RenderPos.vx-HW; Frame->y0=RenderPos.vy-H;
|
||||||
|
Frame->x1=RenderPos.vx+HW; Frame->y1=RenderPos.vy-H;
|
||||||
|
Frame->x2=RenderPos.vx-HW; Frame->y2=RenderPos.vy;
|
||||||
|
Frame->x3=RenderPos.vx+HW; Frame->y3=RenderPos.vy;
|
||||||
|
FYO=-FO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
if (CurrentHeading<1024*2)
|
||||||
killFX();
|
{ // Right
|
||||||
}
|
RenderPos.vx-=HH;
|
||||||
|
Frame->x0=RenderPos.vx-W; Frame->y0=RenderPos.vy+HW;
|
||||||
|
Frame->x1=RenderPos.vx-W; Frame->y1=RenderPos.vy-HW;
|
||||||
|
Frame->x2=RenderPos.vx; Frame->y2=RenderPos.vy+HW;
|
||||||
|
Frame->x3=RenderPos.vx; Frame->y3=RenderPos.vy-HW;
|
||||||
|
FXO=+FO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
if (CurrentHeading<1024*3)
|
||||||
CFXBaseAnim::think(_frames);
|
{ // Down
|
||||||
Pos.vx+=XT[XIdx++];
|
RenderPos.vy-=HH;
|
||||||
XIdx&=15;
|
Frame->x0=RenderPos.vx-HW; Frame->y0=RenderPos.vy+H;
|
||||||
|
Frame->x1=RenderPos.vx+HW; Frame->y1=RenderPos.vy+H;
|
||||||
|
Frame->x2=RenderPos.vx-HW; Frame->y2=RenderPos.vy;
|
||||||
|
Frame->x3=RenderPos.vx+HW; Frame->y3=RenderPos.vy;
|
||||||
|
FYO=+FO;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (CurrentHeading<1024*4)
|
||||||
|
{ // Left
|
||||||
|
RenderPos.vx+=HH;
|
||||||
|
Frame->x0=RenderPos.vx-H; Frame->y0=RenderPos.vy+HW;
|
||||||
|
Frame->x1=RenderPos.vx-H; Frame->y1=RenderPos.vy-HW;
|
||||||
|
Frame->x2=RenderPos.vx; Frame->y2=RenderPos.vy+HW;
|
||||||
|
Frame->x3=RenderPos.vx; Frame->y3=RenderPos.vy-HW;
|
||||||
|
FXO=-FO;
|
||||||
|
}
|
||||||
|
Ft4=GetPrimFT4();
|
||||||
|
*Ft4=*Frame;
|
||||||
|
AddPrimToList(Ft4,OtPos);
|
||||||
|
Ft4->x0+=FXO; Ft4->y0+=FYO;
|
||||||
|
Ft4->x1+=FXO; Ft4->y1+=FYO;
|
||||||
|
Ft4->x2+=FXO; Ft4->y2+=FYO;
|
||||||
|
Ft4->x3+=FXO; Ft4->y3+=FYO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "player\player.h"
|
#include "player\player.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "fx\fxfire.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -27,9 +28,10 @@ void CFlameEmitterTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
|
|||||||
CTrigger::setPositionAndSize( _x, _y, _w, _h );
|
CTrigger::setPositionAndSize( _x, _y, _w, _h );
|
||||||
|
|
||||||
m_effect = CFX::Create( CFX::FX_TYPE_FLAMES, Pos );
|
m_effect = CFX::Create( CFX::FX_TYPE_FLAMES, Pos );
|
||||||
CFXBaseAnim *m_animEffect = (CFXBaseAnim *) m_effect;
|
CFXFire *FX = (CFXFire *) m_effect;
|
||||||
m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
FX->SetSize(_w,_h);
|
||||||
m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
// m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
||||||
|
// m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -44,9 +46,10 @@ void CFlameEmitterTrigger::setHeading(int newHeading)
|
|||||||
|
|
||||||
void CFlameEmitterTrigger::setSize( int _w, int _h )
|
void CFlameEmitterTrigger::setSize( int _w, int _h )
|
||||||
{
|
{
|
||||||
CFXBaseAnim *m_animEffect = (CFXBaseAnim *) m_effect;
|
CFXFire *FX= (CFXFire *) m_effect;
|
||||||
m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
FX->SetSize(_w,_h);
|
||||||
m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
// m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
||||||
|
// m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user