This commit is contained in:
Daveo 2001-06-01 15:10:05 +00:00
parent 8f4cbe45a8
commit 99a6466f54
8 changed files with 113 additions and 128 deletions

BIN
Graphics/sfx/+bubblepop.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View file

@ -157,6 +157,7 @@ fx_src := fx \
fxbaseanim \ fxbaseanim \
fxbasetrail \ fxbasetrail \
fxbaseemitter \ fxbaseemitter \
fxbubble \
fxnrgbar \ fxnrgbar \
fxjfish \ fxjfish \
fxfallingtile \ fxfallingtile \

View file

@ -163,7 +163,7 @@ SFX_GFX := +smoke.bmp \
+Star0001.bmp +Star0002.bmp +Star0003.bmp \ +Star0001.bmp +Star0002.bmp +Star0003.bmp \
+Star20001.bmp +Star20002.bmp +Star20003.bmp \ +Star20001.bmp +Star20002.bmp +Star20003.bmp \
+fire01.bmp +fire02.bmp +fire03.bmp +fire04.bmp +fire05.bmp +fire06.bmp \ +fire01.bmp +fire02.bmp +fire03.bmp +fire04.bmp +fire05.bmp +fire06.bmp \
+drip.bmp \ +drip.bmp +bubblepop.bmp\
+leg.bmp +leg.bmp
SFX_GFX_IN := $(foreach FILE,$(SFX_GFX),$(SFX_GFX_DIR)/$(FILE)) SFX_GFX_IN := $(foreach FILE,$(SFX_GFX),$(SFX_GFX_DIR)/$(FILE))

View file

@ -17,6 +17,7 @@
#include "FX\FXBaseAnim.h" #include "FX\FXBaseAnim.h"
#include "FX\FXBaseEmitter.h" #include "FX\FXBaseEmitter.h"
#include "FX\FXBubble.h"
#include "FX\FXfallingTile.h" #include "FX\FXfallingTile.h"
#include "FX\FXSteam.h" #include "FX\FXSteam.h"
@ -107,7 +108,7 @@ CFXBaseAnim::sFXAnim FXAcidDripData=
FRM__DRIP,FRM__DRIP, FRM__DRIP,FRM__DRIP,
1, 1,
127,127,255, 127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL, CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY,
{0,1}, {0,1},
CFX::FX_TYPE_SPLASH_WATER CFX::FX_TYPE_SPLASH_WATER
}; };
@ -117,7 +118,7 @@ CFXBaseAnim::sFXAnim FXLavaDripData=
FRM__DRIP,FRM__DRIP, FRM__DRIP,FRM__DRIP,
1, 1,
127,127,255, 127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL, CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY,
{0,1}, {0,1},
CFX::FX_TYPE_SPLASH_WATER CFX::FX_TYPE_SPLASH_WATER
}; };
@ -127,10 +128,52 @@ CFXBaseAnim::sFXAnim FXOilDripData=
FRM__DRIP,FRM__DRIP, FRM__DRIP,FRM__DRIP,
1, 1,
127,127,255, 127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL, CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY,
{0,1}, {0,1},
CFX::FX_TYPE_SPLASH_WATER CFX::FX_TYPE_SPLASH_WATER
}; };
// Bubble
CFXBaseAnim::sFXAnim FXBubbleWaterData=
{
ONE/2,
FRM__BUBBLE_2,FRM__BUBBLE_2,
1,
127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
{0,-1},
CFX::FX_TYPE_SPLASH_WATER
};
CFXBaseAnim::sFXAnim FXBubbleAcidData=
{
ONE/2,
FRM__BUBBLE_2,FRM__BUBBLE_2,
1,
127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
{0,-1},
CFX::FX_TYPE_SPLASH_WATER
};
CFXBaseAnim::sFXAnim FXBubbleLavaData=
{
ONE/2,
FRM__BUBBLE_2,FRM__BUBBLE_2,
1,
127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
{0,-1},
CFX::FX_TYPE_SPLASH_WATER
};
CFXBaseAnim::sFXAnim FXBubbleOilData=
{
ONE/2,
FRM__BUBBLE_2,FRM__BUBBLE_2,
1,
127,127,255,
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
{0,-1},
CFX::FX_TYPE_SPLASH_WATER
};
/*****************************************************************************/ /*****************************************************************************/
/* /*
@ -154,7 +197,7 @@ void TestFX(DVECTOR Pos)
} }
*/ */
/*****************************************************************************/ /*****************************************************************************/
int FXType=(CFX::FX_TYPE)CFX::FX_TYPE_DROP_WATER; int FXType=(CFX::FX_TYPE)CFX::FX_TYPE_BUBBLE_WATER;
void TestFX(DVECTOR Pos) void TestFX(DVECTOR Pos)
{ {
CFX::Create((CFX::FX_TYPE)FXType,Pos); CFX::Create((CFX::FX_TYPE)FXType,Pos);
@ -217,6 +260,22 @@ CFX *NewFX;
NewFX=new ("FXOilDrip") CFXBaseAnim(); NewFX=new ("FXOilDrip") CFXBaseAnim();
NewFX->setData(&FXOilDripData); NewFX->setData(&FXOilDripData);
break; break;
case FX_TYPE_BUBBLE_WATER:
NewFX=new ("FXBubbleWater") CFXBubble();
NewFX->setData(&FXBubbleWaterData);
break;
case FX_TYPE_BUBBLE_ACID:
NewFX=new ("FXBubbleAcid") CFXBubble();
NewFX->setData(&FXBubbleAcidData);
break;
case FX_TYPE_BUBBLE_LAVA:
NewFX=new ("FXBubbleLava") CFXBubble();
NewFX->setData(&FXBubbleLavaData);
break;
case FX_TYPE_BUBBLE_OIL:
NewFX=new ("FXBubbleOil") CFXBubble();
NewFX->setData(&FXBubbleOilData);
break;
case FX_TYPE_NRG_BAR: case FX_TYPE_NRG_BAR:
NewFX=new ("NRG Bar") CFXNRGBar(); NewFX=new ("NRG Bar") CFXNRGBar();
@ -226,10 +285,6 @@ CFX *NewFX;
NewFX=new ("JellyFish Legs") CFXJellyFishLegs(); NewFX=new ("JellyFish Legs") CFXJellyFishLegs();
break; break;
case FX_TYPE_BUBBLE_WATER:
case FX_TYPE_BUBBLE_ACID:
case FX_TYPE_BUBBLE_LAVA:
case FX_TYPE_BUBBLE_OIL:
case FX_TYPE_LIGHTNING_BOLT: case FX_TYPE_LIGHTNING_BOLT:
case FX_TYPE_LIGHTNING_SHEET: case FX_TYPE_LIGHTNING_SHEET:
case FX_TYPE_LIGHTNING_BLAST: case FX_TYPE_LIGHTNING_BLAST:
@ -245,7 +300,6 @@ CFX *NewFX;
case FX_TYPE_SMOKE: case FX_TYPE_SMOKE:
case FX_TYPE_GAS: case FX_TYPE_GAS:
default: default:
ASSERT(!"UNKNOWN FX TYPE"); ASSERT(!"UNKNOWN FX TYPE");
return NULL; return NULL;

View file

@ -30,7 +30,8 @@ void CFXBaseAnim::init(DVECTOR const &_Pos)
Life=MaxFrame; Life=MaxFrame;
} }
Gravity=0; VelY=0;
renderFrame=DataPtr->StartFrame;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -52,11 +53,14 @@ void CFXBaseAnim::think(int _frames)
CurrentFrame=0; CurrentFrame=0;
} }
Pos.vx+=DataPtr->Velocity.vx; Pos.vx+=DataPtr->Velocity.vx;
Pos.vy+=DataPtr->Velocity.vy+Gravity; Pos.vy+=DataPtr->Velocity.vy+VelY;
int ThisFrame=CurrentFrame>>DataPtr->FrameShift;
renderFrame=DataPtr->StartFrame+ThisFrame;
if (DataPtr->Flags & FXANIM_FLAG_HAS_GRAVITY) if (DataPtr->Flags & FXANIM_FLAG_HAS_GRAVITY)
{ {
Gravity++; VelY++;
} }
if (DataPtr->Flags & FXANIM_FLAG_COLLIDE_KILL) if (DataPtr->Flags & FXANIM_FLAG_COLLIDE_KILL)
@ -96,9 +100,7 @@ DVECTOR RenderPos;
SpriteBank *SprBank=CGameScene::getSpriteBank(); SpriteBank *SprBank=CGameScene::getSpriteBank();
int ThisFrame=CurrentFrame>>DataPtr->FrameShift; POLY_FT4 *Ft4=SprBank->printFT4Scaled(renderFrame,RenderPos.vx,RenderPos.vy,0,0,OtPos*0,CurrentScale>>4);
POLY_FT4 *Ft4=SprBank->printFT4Scaled(DataPtr->StartFrame+ThisFrame,RenderPos.vx,RenderPos.vy,0,0,OtPos*0,CurrentScale>>4);
Ft4->u1--; Ft4->u3--; Ft4->u1--; Ft4->u3--;
Ft4->v2--; Ft4->v3--; Ft4->v2--; Ft4->v3--;
setShadeTex(Ft4,0); setShadeTex(Ft4,0);

View file

@ -40,10 +40,10 @@ virtual void SetScale(int S) {CurrentScale=S;}
protected: protected:
sFXAnim *DataPtr; sFXAnim *DataPtr;
s16 VelY;
s16 Gravity;
s16 MaxFrame; s16 MaxFrame;
s16 CurrentFrame; s16 CurrentFrame;
u16 renderFrame;
s16 CurrentScale; s16 CurrentScale;
}; };

View file

@ -1,6 +1,6 @@
/***********************/ /*****************/
/*** Anim Base Class ***/ /*** Bubble FX ***/
/***********************/ /*****************/
#include "system\global.h" #include "system\global.h"
#include <DStructs.h> #include <DStructs.h>
@ -12,95 +12,50 @@
#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"
/*****************************************************************************/ /*****************************************************************************/
void CFXBaseAnim::init(DVECTOR const &_Pos) void CFXBubble::init(DVECTOR const &_Pos)
{ {
CFX::init(_Pos); CFXBaseAnim::init(_Pos);
CurrentFrame=0; Life=32+getRndRange(63);
CurrentScale=DataPtr->Scale; VelY=-getRndRange(4)-1;
MaxFrame=((DataPtr->EndFrame-DataPtr->StartFrame)<<DataPtr->FrameShift)-1; CurrentScale=getRndRange(DataPtr->Scale/2)+(DataPtr->Scale/2);
if (DataPtr->Flags & FXANIM_FLAG_LOOP) Die=0;
{ // Looping Anim, so let it live forever! XIdx=getRnd()&15;
Life=-1;
}
else
{
Life=MaxFrame;
}
Gravity=0;
}
/*****************************************************************************/
void CFXBaseAnim::shutdown()
{
CFX::shutdown();
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Think *******************************************************************/ /*** Think *******************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CFXBaseAnim::think(int _frames) int XT[16]={ 0,+1,+0,+1,+0, 0,-1,+0,-1,+0,0,+1,+0,+1,+0,};
void CFXBubble::think(int _frames)
{ {
CFX::think(_frames); if (Die)
CurrentFrame+=_frames;
if (CurrentFrame>=MaxFrame)
{ {
CurrentFrame=0; if (renderFrame!=FRM__BUBBLEPOP)
}
Pos.vx+=DataPtr->Velocity.vx;
Pos.vy+=DataPtr->Velocity.vy+Gravity;
if (DataPtr->Flags & FXANIM_FLAG_HAS_GRAVITY)
{ {
Gravity++; renderFrame=FRM__BUBBLEPOP;
} }
else
if (DataPtr->Flags & FXANIM_FLAG_COLLIDE_KILL)
{
CLayerCollision *ColLayer=CGameScene::getCollision();
int DistY = ColLayer->getHeightFromGround( Pos.vx, Pos.vy, 16 );
if (DistY<=0)
{
Pos.vy-=DistY;
killFX();
}
}
}
/*****************************************************************************/
void CFXBaseAnim::killFX()
{ {
setToShutdown(); setToShutdown();
// If has follow on effect, create it now }
if (DataPtr->EndFX) }
else
{ {
CFX::Create((CFX::FX_TYPE)DataPtr->EndFX,getPos()); CFXBaseAnim::think(_frames);
Pos.vx+=XT[XIdx++];
XIdx&=15;
} }
} }
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ void CFXBubble::killFX()
/*** Render ******************************************************************/
/*****************************************************************************/
void CFXBaseAnim::render()
{ {
DVECTOR RenderPos;
getFXRenderPos(RenderPos); Die=1;
if (!canRender()) return;
SpriteBank *SprBank=CGameScene::getSpriteBank();
int ThisFrame=CurrentFrame>>DataPtr->FrameShift;
POLY_FT4 *Ft4=SprBank->printFT4Scaled(DataPtr->StartFrame+ThisFrame,RenderPos.vx,RenderPos.vy,0,0,OtPos*0,CurrentScale>>4);
Ft4->u1--; Ft4->u3--;
Ft4->v2--; Ft4->v3--;
setShadeTex(Ft4,0);
setRGB0(Ft4,DataPtr->R,DataPtr->G,DataPtr->B);
} }

View file

@ -1,50 +1,23 @@
/***********************/ /*****************/
/*** Anim Base Class ***/ /*** Bubble FX ***/
/***********************/ /*****************/
#ifndef __FX_FX_BASE_ANIM_HEADER__ #ifndef __FX_FX_BUBBLE_HEADER__
#define __FX_FX_BASE_ANIM_HEADER__ #define __FX_FX_BUBBLE_HEADER__
#include "fx/fx.h" #include "fx/fxbaseanim.h"
/*****************************************************************************/ /*****************************************************************************/
class CFXBaseAnim : public CFX class CFXBubble : public CFXBaseAnim
{ {
public: public:
struct sFXAnim
{
s16 Scale;
s16 StartFrame,EndFrame;
s16 FrameShift;
u8 R,G,B;
u8 Flags;
DVECTOR Velocity;
u16 EndFX;
};
enum FXAnim_Flags
{
FXANIM_FLAG_LOOP =1<<0,
FXANIM_FLAG_COLLIDE_KILL =1<<1,
FXANIM_FLAG_HAS_GRAVITY =1<<2,
};
virtual void init(DVECTOR const &Pos); virtual void init(DVECTOR const &Pos);
virtual void shutdown();
virtual void think(int _frames); virtual void think(int _frames);
virtual void render();
virtual void killFX(); virtual void killFX();
void setData(void *Data) {DataPtr=(sFXAnim*)Data;}
virtual void SetScale(int S) {CurrentScale=S;}
protected: protected:
sFXAnim *DataPtr; s8 Die;
u16 XIdx;
s16 Gravity;
s16 MaxFrame;
s16 CurrentFrame;
s16 CurrentScale;
}; };
#endif #endif