This commit is contained in:
parent
8dfb2b0591
commit
d6b7483cc6
@ -1,6 +1,6 @@
|
||||
/*****************/
|
||||
/*** Bubble FX ***/
|
||||
/*****************/
|
||||
/***************/
|
||||
/*** Fire FX ***/
|
||||
/***************/
|
||||
|
||||
#include "system\global.h"
|
||||
#include <DStructs.h>
|
||||
@ -12,42 +12,98 @@
|
||||
#include "game\game.h"
|
||||
#include "level\layercollision.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);
|
||||
Life=32+getRndRange(63);
|
||||
Velocity.vy=-(getRndRange(4)+1);
|
||||
CurrentScaleX=CurrentScaleY=getRndRange(ONE/2)+(ONE/2);
|
||||
XIdx=getRnd()&15;
|
||||
OtPos++;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** 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 (Life<=0)
|
||||
{
|
||||
if (renderFrame!=FRM__BUBBLEPOP)
|
||||
{
|
||||
renderFrame=FRM__BUBBLEPOP;
|
||||
if (!HasInit) return;
|
||||
|
||||
|
||||
DVECTOR RenderPos;
|
||||
getFXRenderPos(RenderPos);
|
||||
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
|
||||
{
|
||||
killFX();
|
||||
}
|
||||
if (CurrentHeading<1024*2)
|
||||
{ // 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
|
||||
{
|
||||
CFXBaseAnim::think(_frames);
|
||||
Pos.vx+=XT[XIdx++];
|
||||
XIdx&=15;
|
||||
if (CurrentHeading<1024*3)
|
||||
{ // Down
|
||||
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
|
||||
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"
|
||||
#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 );
|
||||
|
||||
m_effect = CFX::Create( CFX::FX_TYPE_FLAMES, Pos );
|
||||
CFXBaseAnim *m_animEffect = (CFXBaseAnim *) m_effect;
|
||||
m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
||||
m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
||||
CFXFire *FX = (CFXFire *) m_effect;
|
||||
FX->SetSize(_w,_h);
|
||||
// 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 )
|
||||
{
|
||||
CFXBaseAnim *m_animEffect = (CFXBaseAnim *) m_effect;
|
||||
m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
||||
m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
||||
CFXFire *FX= (CFXFire *) m_effect;
|
||||
FX->SetSize(_w,_h);
|
||||
// m_animEffect->SetScaleX( ( _w * ONE ) >> 5 );
|
||||
// m_animEffect->SetScaleY( ( _h * ONE ) >> 5 );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user