Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -169,14 +169,14 @@ fx_src := fx \
|
|||||||
fxbaseanim \
|
fxbaseanim \
|
||||||
fxbasetrail \
|
fxbasetrail \
|
||||||
fxbaseemitter \
|
fxbaseemitter \
|
||||||
fxattachanim \
|
|
||||||
fxbubble \
|
fxbubble \
|
||||||
fxthwack \
|
fxthwack \
|
||||||
fxnrgbar \
|
fxnrgbar \
|
||||||
fxjfish \
|
fxjfish \
|
||||||
fxfallingtile \
|
fxfallingtile \
|
||||||
fxsteam \
|
fxsteam \
|
||||||
fxlaser
|
fxlaser \
|
||||||
|
fxgeyser
|
||||||
|
|
||||||
projectl_src := projectl \
|
projectl_src := projectl \
|
||||||
prnpc \
|
prnpc \
|
||||||
|
@ -162,7 +162,7 @@ SFX_GFX := +smoke.bmp \
|
|||||||
+splash001.bmp +splash002.bmp +splash003.bmp +splash004.bmp +splash005.bmp +splash006.bmp \
|
+splash001.bmp +splash002.bmp +splash003.bmp +splash004.bmp +splash005.bmp +splash006.bmp \
|
||||||
+fire01.bmp +fire02.bmp +fire03.bmp +fire04.bmp +fire05.bmp +fire06.bmp +fire07.bmp +fire08.bmp\
|
+fire01.bmp +fire02.bmp +fire03.bmp +fire04.bmp +fire05.bmp +fire06.bmp +fire07.bmp +fire08.bmp\
|
||||||
+drip.bmp +bubblepop.bmp \
|
+drip.bmp +bubblepop.bmp \
|
||||||
+Gush000.bmp +Gush001.bmp +Gush002.bmp +Gush003.bmp \
|
+Gush000.bmp +Gush001.bmp +Gush002.bmp +Gush003.bmp +GushBase.bmp \
|
||||||
+leg.bmp +thwack.bmp +lightning1.bmp +lightning2.bmp
|
+leg.bmp +thwack.bmp +lightning1.bmp +lightning2.bmp
|
||||||
|
|
||||||
SFX_GFX_IN := $(foreach FILE,$(SFX_GFX),$(SFX_GFX_DIR)/$(FILE))
|
SFX_GFX_IN := $(foreach FILE,$(SFX_GFX),$(SFX_GFX_DIR)/$(FILE))
|
||||||
|
434
source/fx/fx.cpp
@ -10,6 +10,8 @@
|
|||||||
#include <sprites.h>
|
#include <sprites.h>
|
||||||
#include "level\level.h"
|
#include "level\level.h"
|
||||||
#include "gfx\otpos.h"
|
#include "gfx\otpos.h"
|
||||||
|
#include "player\player.h"
|
||||||
|
|
||||||
|
|
||||||
#include "FX\FX.h"
|
#include "FX\FX.h"
|
||||||
#include "FX\FXjfish.h"
|
#include "FX\FXjfish.h"
|
||||||
@ -17,13 +19,13 @@
|
|||||||
#include "FX\FXBaseAnim.h"
|
#include "FX\FXBaseAnim.h"
|
||||||
#include "FX\FXBaseEmitter.h"
|
#include "FX\FXBaseEmitter.h"
|
||||||
|
|
||||||
#include "FX\FXAttachAnim.h"
|
|
||||||
|
|
||||||
#include "FX\FXLaser.h"
|
#include "FX\FXLaser.h"
|
||||||
#include "FX\FXThwack.h"
|
#include "FX\FXThwack.h"
|
||||||
#include "FX\FXBubble.h"
|
#include "FX\FXBubble.h"
|
||||||
#include "FX\FXfallingTile.h"
|
#include "FX\FXfallingTile.h"
|
||||||
#include "FX\FXSteam.h"
|
#include "FX\FXSteam.h"
|
||||||
|
#include "FX\FXGeyser.h"
|
||||||
|
|
||||||
#include "FX\FXNrgBar.h"
|
#include "FX\FXNrgBar.h"
|
||||||
|
|
||||||
@ -32,197 +34,49 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Anim Data
|
// Anim Data
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXWaterSplashData=
|
CFX::sFXRGB CFX::FXRGBTable[CFX::FX_RGB_MAX]=
|
||||||
{
|
{
|
||||||
ONE,
|
{127,127,255}, // Water
|
||||||
FRM__SPLASH001,FRM__SPLASH006,
|
{127,255,127}, // Acid
|
||||||
1,
|
{255, 0, 0}, // Lava
|
||||||
127,127,255,
|
{ 64, 64, 64}, // Oil
|
||||||
0,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXAcidSplashData=
|
CFX::sFXRGB FXRgbWater={127,127,255};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
CFXBaseAnim::sFXBaseData FXDropBaseData=
|
||||||
{
|
{
|
||||||
ONE,
|
FRM__DRIP,FRM__DRIP,1,
|
||||||
FRM__SPLASH001,FRM__SPLASH006,
|
FX_FLAG_LOOP | FX_FLAG_COLLIDE_KILL | FX_FLAG_HAS_GRAVITY | FX_FLAG_NO_THINK_KILL,
|
||||||
1,
|
|
||||||
127,255,127,
|
|
||||||
0,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXLavaSplashData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__SPLASH001,FRM__SPLASH006,
|
|
||||||
1,
|
|
||||||
255,0,0,
|
|
||||||
0,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXOilSplashData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__SPLASH001,FRM__SPLASH006,
|
|
||||||
1,
|
|
||||||
64,64,64,
|
|
||||||
0,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_EXPLODE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXExplodeData=
|
CFXBaseAnim::sFXBaseData FXSplashBaseData=
|
||||||
{
|
{
|
||||||
ONE,
|
FRM__SPLASH001,FRM__SPLASH006,1,
|
||||||
FRM__EXPLOSION0001,FRM__EXPLOSION0006,
|
FX_FLAG_NO_THINK_KILL,
|
||||||
1,
|
|
||||||
127,127,127,
|
|
||||||
0,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXFireData=
|
CFXBaseAnim::sFXBaseData FXExplodeBaseData=
|
||||||
{
|
{
|
||||||
ONE,
|
FRM__EXPLOSION0001,FRM__EXPLOSION0006,1,
|
||||||
FRM__FIRE01,FRM__FIRE08,
|
FX_FLAG_NO_THINK_KILL,
|
||||||
1,
|
|
||||||
127,127,127,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_TRANS,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXWaterDripData=
|
CFXBaseAnim::sFXBaseData FXFireBaseData=
|
||||||
{
|
{
|
||||||
ONE,
|
FRM__FIRE01,FRM__FIRE08,1,
|
||||||
FRM__DRIP,FRM__DRIP,
|
FX_FLAG_LOOP | FX_FLAG_TRANS,
|
||||||
1,
|
|
||||||
127,127,255,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY,
|
|
||||||
{0,1},
|
|
||||||
CFX::FX_TYPE_SPLASH_WATER
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXAcidDripData=
|
CFXBaseAnim::sFXBaseData FXBubbleBaseData=
|
||||||
{
|
{
|
||||||
ONE,
|
FRM__BUBBLE_2,FRM__BUBBLE_2,1,
|
||||||
FRM__DRIP,FRM__DRIP,
|
FX_FLAG_LOOP | FX_FLAG_COLLIDE_KILL | FX_FLAG_NO_THINK_KILL,
|
||||||
1,
|
|
||||||
127,255,127,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY | CFXBaseAnim::FXANIM_FLAG_INJURE_PLAYER,
|
|
||||||
{0,1},
|
|
||||||
CFX::FX_TYPE_SPLASH_ACID
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXLavaDripData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__DRIP,FRM__DRIP,
|
|
||||||
1,
|
|
||||||
255,127,127,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY | CFXBaseAnim::FXANIM_FLAG_INJURE_PLAYER,
|
|
||||||
{0,1},
|
|
||||||
CFX::FX_TYPE_SPLASH_LAVA
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXOilDripData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__DRIP,FRM__DRIP,
|
|
||||||
1,
|
|
||||||
64,64,64,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL | CFXBaseAnim::FXANIM_FLAG_HAS_GRAVITY | CFXBaseAnim::FXANIM_FLAG_INJURE_PLAYER,
|
|
||||||
{0,1},
|
|
||||||
CFX::FX_TYPE_SPLASH_OIL
|
|
||||||
};
|
|
||||||
// Bubble
|
|
||||||
CFXBaseAnim::sFXAnim FXBubbleWaterData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__BUBBLE_2,FRM__BUBBLE_2,
|
|
||||||
1,
|
|
||||||
127,127,255,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
|
|
||||||
{0,-1},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXBubbleAcidData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__BUBBLE_2,FRM__BUBBLE_2,
|
|
||||||
1,
|
|
||||||
0,255,0,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
|
|
||||||
{0,-1},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXBubbleLavaData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__BUBBLE_2,FRM__BUBBLE_2,
|
|
||||||
1,
|
|
||||||
255,0,0,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
|
|
||||||
{0,-1},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXBubbleOilData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__BUBBLE_2,FRM__BUBBLE_2,
|
|
||||||
1,
|
|
||||||
32,32,32,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP | CFXBaseAnim::FXANIM_FLAG_COLLIDE_KILL,
|
|
||||||
{0,-1},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
CFXBaseAnim::sFXAnim FXWaterFountainData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__GUSH000,FRM__GUSH003,
|
|
||||||
3,
|
|
||||||
127,127,255,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXAcidFountainData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__GUSH000,FRM__GUSH002,
|
|
||||||
3,
|
|
||||||
0,255,0,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXLavaFountainData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__GUSH000,FRM__GUSH002,
|
|
||||||
3,
|
|
||||||
255,0,0,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
|
||||||
CFXBaseAnim::sFXAnim FXOilFountainData=
|
|
||||||
{
|
|
||||||
ONE,
|
|
||||||
FRM__GUSH000,FRM__GUSH002,
|
|
||||||
3,
|
|
||||||
32,32,32,
|
|
||||||
CFXBaseAnim::FXANIM_FLAG_LOOP,
|
|
||||||
{0,0},
|
|
||||||
CFX::FX_TYPE_NONE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
CFXLaser *TestFXPtr=0;
|
CFXLaser *TestFXPtr=0;
|
||||||
void TestFX(DVECTOR Pos,CThing *Parent)
|
void TestFX(DVECTOR Pos,CThing *Parent)
|
||||||
{
|
{
|
||||||
@ -230,7 +84,6 @@ void TestFX(DVECTOR Pos,CThing *Parent)
|
|||||||
{
|
{
|
||||||
TestFXPtr=(CFXLaser*)CFX::Create(CFX::FX_TYPE_LASER,Parent);
|
TestFXPtr=(CFXLaser*)CFX::Create(CFX::FX_TYPE_LASER,Parent);
|
||||||
// TestFXPtr->setLife(32);
|
// TestFXPtr->setLife(32);
|
||||||
// TestFXPtr->setRelativeToMap(false);
|
|
||||||
// TestFXPtr=0;
|
// TestFXPtr=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -239,27 +92,18 @@ void TestFX(DVECTOR Pos,CThing *Parent)
|
|||||||
TestFXPtr=0;
|
TestFXPtr=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*
|
|
||||||
int FXType=(CFX::FX_TYPE)CFX::FX_TYPE_LASER;
|
int FXType=(CFX::FX_TYPE)CFX::FX_TYPE_GEYSER_WATER;
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
|
|
||||||
int OX=32;
|
|
||||||
int OY=32;
|
|
||||||
void TestFX(DVECTOR Pos,CThing *Parent)
|
void TestFX(DVECTOR Pos,CThing *Parent)
|
||||||
{
|
{
|
||||||
CFXLaser *FX=(CFXLaser*)CFX::Create((CFX::FX_TYPE)FXType,Pos);
|
CFX::Create((CFX::FX_TYPE)FXType,Pos);
|
||||||
|
|
||||||
// FX->setOrigin(Pos);
|
|
||||||
Pos.vx+=OX;
|
|
||||||
Pos.vy+=OY;
|
|
||||||
FX->setTarget(Pos);
|
|
||||||
// Parent->addChild(FX);
|
|
||||||
// TestFXPtr->setLife(32);
|
|
||||||
// CGameScene::dropHealth(Pos,0,0);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CFX *CFX::Create(const FX_TYPE Type)
|
CFX *CFX::Create(const FX_TYPE Type)
|
||||||
{
|
{
|
||||||
@ -272,109 +116,131 @@ CFX *NewFX;
|
|||||||
case FX_TYPE_NONE:
|
case FX_TYPE_NONE:
|
||||||
ASSERT(!"FX NONE CANT BE CREATED!");
|
ASSERT(!"FX NONE CANT BE CREATED!");
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_FALLINGTILE:
|
|
||||||
NewFX=new ("FXFalling Tile") CFXFallingTile();
|
|
||||||
break;
|
|
||||||
case FX_TYPE_STEAM:
|
|
||||||
NewFX=new ("FXSteam") CFXSteam();
|
|
||||||
break;
|
|
||||||
case FX_TYPE_SPLASH_WATER:
|
|
||||||
NewFX=new ("FXWaterSplash") CFXBaseAnim();
|
|
||||||
NewFX->setData(&FXWaterSplashData);
|
|
||||||
break;
|
|
||||||
case FX_TYPE_SPLASH_ACID:
|
|
||||||
NewFX=new ("FXAcidSplash") CFXBaseAnim();
|
|
||||||
NewFX->setData(&FXAcidSplashData);
|
|
||||||
break;
|
|
||||||
case FX_TYPE_SPLASH_LAVA:
|
|
||||||
NewFX=new ("FXLavaSplash") CFXBaseAnim();
|
|
||||||
NewFX->setData(&FXLavaSplashData);
|
|
||||||
break;
|
|
||||||
case FX_TYPE_SPLASH_OIL:
|
|
||||||
NewFX=new ("FXOilSplash") CFXBaseAnim();
|
|
||||||
NewFX->setData(&FXOilSplashData);
|
|
||||||
break;
|
|
||||||
case FX_TYPE_EXPLODE:
|
|
||||||
NewFX=new ("FXExplode") CFXBaseAnim();
|
|
||||||
NewFX->setData(&FXExplodeData);
|
|
||||||
break;
|
|
||||||
case FX_TYPE_FLAMES:
|
|
||||||
NewFX=new ("FXFlames") CFXBaseAnim();
|
|
||||||
NewFX->setData(&FXFireData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FX_TYPE_DROP_WATER:
|
case FX_TYPE_DROP_WATER:
|
||||||
NewFX=new ("FXWaterDrip") CFXBaseAnim();
|
NewFX=new ("FXWaterDrip") CFXBaseAnim();
|
||||||
NewFX->setData(&FXWaterDripData);
|
NewFX->setBaseData(&FXDropBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_WATER);
|
||||||
|
NewFX->setAfterEffect(CFX::FX_TYPE_SPLASH_WATER);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_DROP_ACID:
|
case FX_TYPE_DROP_ACID:
|
||||||
NewFX=new ("FXAcidDrip") CFXBaseAnim();
|
NewFX=new ("FXAcidDrip") CFXBaseAnim();
|
||||||
NewFX->setData(&FXAcidDripData);
|
NewFX->setBaseData(&FXDropBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_ACID);
|
||||||
|
NewFX->setAfterEffect(CFX::FX_TYPE_SPLASH_ACID);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_DROP_LAVA:
|
case FX_TYPE_DROP_LAVA:
|
||||||
NewFX=new ("FXLavaDrip") CFXBaseAnim();
|
NewFX=new ("FXLavaDrip") CFXBaseAnim();
|
||||||
NewFX->setData(&FXLavaDripData);
|
NewFX->setBaseData(&FXDropBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_LAVA);
|
||||||
|
NewFX->setAfterEffect(CFX::FX_TYPE_SPLASH_LAVA);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_DROP_OIL:
|
case FX_TYPE_DROP_OIL:
|
||||||
NewFX=new ("FXOilDrip") CFXBaseAnim();
|
NewFX=new ("FXOilDrip") CFXBaseAnim();
|
||||||
NewFX->setData(&FXOilDripData);
|
NewFX->setBaseData(&FXDropBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_OIL);
|
||||||
|
NewFX->setAfterEffect(CFX::FX_TYPE_SPLASH_OIL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FX_TYPE_SPLASH_WATER:
|
||||||
|
NewFX=new ("FXWaterSplash") CFXBaseAnim();
|
||||||
|
NewFX->setBaseData(&FXSplashBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_WATER);
|
||||||
|
break;
|
||||||
|
case FX_TYPE_SPLASH_ACID:
|
||||||
|
NewFX=new ("FXAcidSplash") CFXBaseAnim();
|
||||||
|
NewFX->setBaseData(&FXSplashBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_ACID);
|
||||||
|
break;
|
||||||
|
case FX_TYPE_SPLASH_LAVA:
|
||||||
|
NewFX=new ("FXLavaSplash") CFXBaseAnim();
|
||||||
|
NewFX->setBaseData(&FXSplashBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_LAVA);
|
||||||
|
break;
|
||||||
|
case FX_TYPE_SPLASH_OIL:
|
||||||
|
NewFX=new ("FXOilSplash") CFXBaseAnim();
|
||||||
|
NewFX->setBaseData(&FXSplashBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_OIL);
|
||||||
|
NewFX->setAfterEffect(CFX::FX_TYPE_EXPLODE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FX_TYPE_BUBBLE_WATER:
|
case FX_TYPE_BUBBLE_WATER:
|
||||||
NewFX=new ("FXBubbleWater") CFXBubble();
|
NewFX=new ("FXBubbleWater") CFXBubble();
|
||||||
NewFX->setData(&FXBubbleWaterData);
|
NewFX->setBaseData(&FXBubbleBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_WATER);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_BUBBLE_ACID:
|
case FX_TYPE_BUBBLE_ACID:
|
||||||
NewFX=new ("FXBubbleAcid") CFXBubble();
|
NewFX=new ("FXBubbleAcid") CFXBubble();
|
||||||
NewFX->setData(&FXBubbleAcidData);
|
NewFX->setBaseData(&FXBubbleBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_ACID);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_BUBBLE_LAVA:
|
case FX_TYPE_BUBBLE_LAVA:
|
||||||
NewFX=new ("FXBubbleLava") CFXBubble();
|
NewFX=new ("FXBubbleLava") CFXBubble();
|
||||||
NewFX->setData(&FXBubbleLavaData);
|
NewFX->setBaseData(&FXBubbleBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_LAVA);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_BUBBLE_OIL:
|
case FX_TYPE_BUBBLE_OIL:
|
||||||
NewFX=new ("FXBubbleOil") CFXBubble();
|
NewFX=new ("FXBubbleOil") CFXBubble();
|
||||||
NewFX->setData(&FXBubbleOilData);
|
NewFX->setBaseData(&FXBubbleBaseData);
|
||||||
|
NewFX->setRGB(FX_RGB_OIL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FX_TYPE_FOUNTAIN_WATER:
|
case FX_TYPE_GEYSER_WATER:
|
||||||
NewFX=new ("FXWaterFountain") CFXAttachAnim();
|
NewFX=new ("FXWaterGEYSER") CFXGeyser();
|
||||||
NewFX->setData(&FXWaterFountainData);
|
NewFX->setRGB(FX_RGB_WATER);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_FOUNTAIN_ACID:
|
case FX_TYPE_GEYSER_ACID:
|
||||||
NewFX=new ("FXAcidFountain") CFXAttachAnim();
|
NewFX=new ("FXAcidGEYSER") CFXGeyser();
|
||||||
NewFX->setData(&FXAcidFountainData);
|
NewFX->setRGB(FX_RGB_ACID);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_FOUNTAIN_LAVA:
|
case FX_TYPE_GEYSER_LAVA:
|
||||||
NewFX=new ("FXLavaFountain") CFXAttachAnim();
|
NewFX=new ("FXLavaGEYSER") CFXGeyser();
|
||||||
NewFX->setData(&FXLavaFountainData);
|
NewFX->setRGB(FX_RGB_LAVA);
|
||||||
break;
|
break;
|
||||||
case FX_TYPE_FOUNTAIN_OIL:
|
case FX_TYPE_GEYSER_OIL:
|
||||||
NewFX=new ("FXOilFountain") CFXAttachAnim();
|
NewFX=new ("FXOilGEYSER") CFXGeyser();
|
||||||
NewFX->setData(&FXOilFountainData);
|
NewFX->setRGB(FX_RGB_OIL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FX_TYPE_THWACK:
|
case FX_TYPE_THWACK:
|
||||||
NewFX=new ("FXThwack") CFXThwack();
|
NewFX=new ("FXThwack") CFXThwack();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FX_TYPE_NRG_BAR:
|
case FX_TYPE_LIGHTNING_BOLT:
|
||||||
NewFX=new ("NRG Bar") CFXNRGBar();
|
ASSERT(!"FX_TYPE_LIGHTNING_BOLT");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FX_TYPE_STEAM:
|
||||||
|
NewFX=new ("FXSteam") CFXSteam();
|
||||||
|
break;
|
||||||
|
case FX_TYPE_SMOKE:
|
||||||
|
ASSERT(!"FX_TYPE_SMOKE");
|
||||||
|
break;
|
||||||
|
case FX_TYPE_GAS:
|
||||||
|
ASSERT(!"FX_TYPE_GAS");
|
||||||
|
break;
|
||||||
|
case FX_TYPE_FLAMES:
|
||||||
|
NewFX=new ("FXFlames") CFXBaseAnim();
|
||||||
|
NewFX->setBaseData(&FXFireBaseData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FX_TYPE_JELLYFISH_LEGS:
|
case FX_TYPE_JELLYFISH_LEGS:
|
||||||
NewFX=new ("JellyFish Legs") CFXJellyFishLegs();
|
NewFX=new ("JellyFish Legs") CFXJellyFishLegs();
|
||||||
break;
|
break;
|
||||||
|
case FX_TYPE_FALLINGTILE:
|
||||||
|
NewFX=new ("FXFalling Tile") CFXFallingTile();
|
||||||
|
break;
|
||||||
|
case FX_TYPE_EXPLODE:
|
||||||
|
NewFX=new ("FXExplode") CFXBaseAnim();
|
||||||
|
NewFX->setBaseData(&FXExplodeBaseData);
|
||||||
|
break;
|
||||||
|
case FX_TYPE_NRG_BAR:
|
||||||
|
NewFX=new ("NRG Bar") CFXNRGBar();
|
||||||
|
break;
|
||||||
case FX_TYPE_LASER:
|
case FX_TYPE_LASER:
|
||||||
NewFX=new ("FX Laser") CFXLaser();
|
NewFX=new ("FX Laser") CFXLaser();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FX_TYPE_LIGHTNING_BOLT:
|
|
||||||
case FX_TYPE_DAZE:
|
|
||||||
case FX_TYPE_SMOKE:
|
|
||||||
case FX_TYPE_GAS:
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(!"UNKNOWN FX TYPE");
|
ASSERT(!"UNKNOWN FX TYPE");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -412,9 +278,8 @@ void CFX::init()
|
|||||||
{
|
{
|
||||||
CFXThing::init();
|
CFXThing::init();
|
||||||
OtPos=OTPOS__ACTOR_POS;
|
OtPos=OTPOS__ACTOR_POS;
|
||||||
RelativeToMap=true;
|
Flags=0;
|
||||||
Life=-1; // Set to immortal
|
Velocity.vx=Velocity.vy=0;
|
||||||
IsVisible=true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -424,6 +289,13 @@ void CFX::init(DVECTOR const &_Pos)
|
|||||||
Pos=_Pos;
|
Pos=_Pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CFX::setBaseData(void *Data)
|
||||||
|
{
|
||||||
|
setRGB(127,127,127);
|
||||||
|
AfterEffect=FX_TYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFX::shutdown()
|
void CFX::shutdown()
|
||||||
{
|
{
|
||||||
@ -444,8 +316,40 @@ void CFX::think(int _frames)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Flags & FX_FLAG_HAS_GRAVITY)
|
||||||
|
{
|
||||||
|
Velocity.vy++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pos.vx+=Velocity.vx;
|
||||||
|
Pos.vy+=Velocity.vy;
|
||||||
|
if (Flags & FX_FLAG_COLLIDE_KILL)
|
||||||
|
{
|
||||||
|
CLayerCollision *ColLayer=CGameScene::getCollision();
|
||||||
|
int DistY = ColLayer->getHeightFromGround( Pos.vx, Pos.vy, 16 );
|
||||||
|
|
||||||
|
if (DistY<=0)
|
||||||
|
{
|
||||||
|
Pos.vy-=DistY;
|
||||||
|
killFX();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CFX::killFX()
|
||||||
|
{
|
||||||
|
setToShutdown();
|
||||||
|
// If has follow on effect, create it now
|
||||||
|
if (AfterEffect!=CFX::FX_TYPE_NONE && canThink())
|
||||||
|
{
|
||||||
|
CFX::Create((CFX::FX_TYPE)AfterEffect,getPos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFX::render()
|
void CFX::render()
|
||||||
{
|
{
|
||||||
@ -458,13 +362,13 @@ bool CFX::getFXParentPos(DVECTOR &Pos)
|
|||||||
CThing *Parent=getParent();
|
CThing *Parent=getParent();
|
||||||
if (!Parent) return(false);
|
if (!Parent) return(false);
|
||||||
|
|
||||||
if (RelativeToMap)
|
if (Flags & FX_FLAG_SCREEN_FX)
|
||||||
{
|
{
|
||||||
Pos=Parent->getPos();
|
Pos=getPos();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pos=getPos();
|
Pos=Parent->getPos();
|
||||||
}
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@ -472,18 +376,36 @@ CThing *Parent=getParent();
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFX::getFXRenderPos(DVECTOR &Pos)
|
void CFX::getFXRenderPos(DVECTOR &Pos)
|
||||||
{
|
{
|
||||||
if (RelativeToMap)
|
if (Flags & FX_FLAG_SCREEN_FX)
|
||||||
{
|
{
|
||||||
CFX::render();
|
Pos=getPos();
|
||||||
Pos=getRenderPos();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pos=getPos();
|
CFX::render();
|
||||||
|
Pos=getRenderPos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFX::collidedWith(CThing *_thisThing)
|
void CFX::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
|
ASSERT(canCollide());
|
||||||
|
switch(_thisThing->getThingType())
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
CPlayer *player = (CPlayer *) _thisThing;
|
||||||
|
|
||||||
|
if ( !player->isRecoveringFromHit() )
|
||||||
|
{
|
||||||
|
player->takeDamage( DAMAGE__HIT_ENEMY );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,19 @@
|
|||||||
#include "thing/thing.h"
|
#include "thing/thing.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
enum FX_FLAG
|
||||||
|
{
|
||||||
|
FX_FLAG_LOOP =1<<0,
|
||||||
|
FX_FLAG_COLLIDE_KILL =1<<1,
|
||||||
|
FX_FLAG_HAS_GRAVITY =1<<2,
|
||||||
|
FX_FLAG_INJURE_PLAYER =1<<3,
|
||||||
|
FX_FLAG_TRANS =1<<4,
|
||||||
|
|
||||||
|
FX_FLAG_NO_THINK_KILL =1<<13,
|
||||||
|
FX_FLAG_HIDDEN =1<<14,
|
||||||
|
FX_FLAG_SCREEN_FX =1<<15,
|
||||||
|
};
|
||||||
|
|
||||||
class CFX : public CFXThing
|
class CFX : public CFXThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -15,6 +28,11 @@ public:
|
|||||||
{
|
{
|
||||||
FX_TYPE_NONE=0,
|
FX_TYPE_NONE=0,
|
||||||
|
|
||||||
|
FX_TYPE_DROP_WATER,
|
||||||
|
FX_TYPE_DROP_ACID,
|
||||||
|
FX_TYPE_DROP_LAVA,
|
||||||
|
FX_TYPE_DROP_OIL,
|
||||||
|
|
||||||
FX_TYPE_SPLASH_WATER,
|
FX_TYPE_SPLASH_WATER,
|
||||||
FX_TYPE_SPLASH_ACID,
|
FX_TYPE_SPLASH_ACID,
|
||||||
FX_TYPE_SPLASH_LAVA,
|
FX_TYPE_SPLASH_LAVA,
|
||||||
@ -25,22 +43,14 @@ public:
|
|||||||
FX_TYPE_BUBBLE_LAVA,
|
FX_TYPE_BUBBLE_LAVA,
|
||||||
FX_TYPE_BUBBLE_OIL,
|
FX_TYPE_BUBBLE_OIL,
|
||||||
|
|
||||||
FX_TYPE_DROP_WATER,
|
FX_TYPE_GEYSER_WATER,
|
||||||
FX_TYPE_DROP_ACID,
|
FX_TYPE_GEYSER_ACID,
|
||||||
FX_TYPE_DROP_LAVA,
|
FX_TYPE_GEYSER_LAVA,
|
||||||
FX_TYPE_DROP_OIL,
|
FX_TYPE_GEYSER_OIL,
|
||||||
|
|
||||||
FX_TYPE_FOUNTAIN_WATER,
|
|
||||||
FX_TYPE_FOUNTAIN_ACID,
|
|
||||||
FX_TYPE_FOUNTAIN_LAVA,
|
|
||||||
FX_TYPE_FOUNTAIN_OIL,
|
|
||||||
|
|
||||||
FX_TYPE_THWACK,
|
FX_TYPE_THWACK,
|
||||||
|
|
||||||
FX_TYPE_LIGHTNING_BOLT,
|
FX_TYPE_LIGHTNING_BOLT,
|
||||||
|
|
||||||
FX_TYPE_SHOCKWAVE,
|
|
||||||
FX_TYPE_DAZE,
|
|
||||||
FX_TYPE_STEAM,
|
FX_TYPE_STEAM,
|
||||||
FX_TYPE_SMOKE,
|
FX_TYPE_SMOKE,
|
||||||
FX_TYPE_GAS,
|
FX_TYPE_GAS,
|
||||||
@ -58,36 +68,65 @@ public:
|
|||||||
MAX_SUBTYPE =FX_TYPE_MAX,
|
MAX_SUBTYPE =FX_TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct sFXRGB
|
||||||
|
{
|
||||||
|
u8 R,G,B;
|
||||||
|
};
|
||||||
|
enum FX_RGB
|
||||||
|
{
|
||||||
|
FX_RGB_WATER,
|
||||||
|
FX_RGB_ACID,
|
||||||
|
FX_RGB_LAVA,
|
||||||
|
FX_RGB_OIL,
|
||||||
|
FX_RGB_MAX
|
||||||
|
};
|
||||||
|
|
||||||
static CFX *Create(const FX_TYPE Type);
|
static CFX *Create(const FX_TYPE Type);
|
||||||
static CFX *Create(const FX_TYPE Type,CThing *Parent);
|
static CFX *Create(const FX_TYPE Type,CThing *Parent);
|
||||||
static CFX *Create(const FX_TYPE Type,DVECTOR const &Pos);
|
static CFX *Create(const FX_TYPE Type,DVECTOR const &Pos);
|
||||||
virtual bool alwaysThink() {return(!RelativeToMap);}
|
|
||||||
virtual void leftThinkZone(int _frames) {killFX();}
|
virtual bool alwaysThink() {return(Flags & FX_FLAG_SCREEN_FX);}
|
||||||
|
virtual void leftThinkZone(int _frames) {if (Flags & FX_FLAG_NO_THINK_KILL) killFX();}
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void init(DVECTOR const &Pos);
|
virtual void init(DVECTOR const &Pos);
|
||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
virtual void render();
|
virtual void render();
|
||||||
virtual void setData(void *Data){};
|
|
||||||
virtual int canCollide() {return false;}
|
virtual int canCollide() {return(Flags & FX_FLAG_INJURE_PLAYER);}
|
||||||
virtual void SetOtPos(int Ot) {OtPos=Ot;}
|
virtual void SetOtPos(int Ot) {OtPos=Ot;}
|
||||||
virtual void setLife(int L) {Life=L;}
|
virtual void setLife(int L) {Life=L;}
|
||||||
virtual void setRelativeToMap(bool f) {RelativeToMap=f;}
|
|
||||||
|
|
||||||
virtual void getFXRenderPos(DVECTOR &Pos);
|
virtual void getFXRenderPos(DVECTOR &Pos);
|
||||||
virtual bool getFXParentPos(DVECTOR &Pos);
|
virtual bool getFXParentPos(DVECTOR &Pos);
|
||||||
|
|
||||||
virtual void killFX() {setToShutdown();}
|
virtual void killFX();
|
||||||
virtual void toggleVisible() {IsVisible = !IsVisible;}
|
virtual void toggleVisible() {Flags ^=FX_FLAG_HIDDEN;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
void collidedWith(CThing *_thisThing);
|
||||||
s32 OtPos;
|
|
||||||
s16 Life;
|
// Def Data
|
||||||
|
public:
|
||||||
|
virtual void setData(void *Data){}
|
||||||
|
virtual void setBaseData(void *Data);
|
||||||
|
|
||||||
|
void setRGB(u8 R,u8 G,u8 B) {RGB.R=R; RGB.G=G; RGB.B=B;}
|
||||||
|
void setRGB(sFXRGB &rgb) {setRGB(rgb.R,rgb.G,rgb.B);}
|
||||||
|
void setRGB(FX_RGB T) {setRGB(FXRGBTable[T]);}
|
||||||
|
|
||||||
|
void setAfterEffect(FX_TYPE Type) {AfterEffect=Type;}
|
||||||
|
//protected:
|
||||||
|
s16 Life;
|
||||||
|
u16 Flags;
|
||||||
|
sFXRGB RGB;
|
||||||
|
FX_TYPE AfterEffect;
|
||||||
|
DVECTOR Velocity;
|
||||||
|
|
||||||
|
s32 OtPos;
|
||||||
|
static sFXRGB FXRGBTable[FX_RGB_MAX];
|
||||||
|
|
||||||
bool RelativeToMap;
|
|
||||||
bool IsVisible;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -13,30 +13,34 @@
|
|||||||
#include "level\layercollision.h"
|
#include "level\layercollision.h"
|
||||||
#include "FX\FXBaseAnim.h"
|
#include "FX\FXBaseAnim.h"
|
||||||
|
|
||||||
#ifndef __PLAYER_PLAYER_H__
|
|
||||||
#include "player\player.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFXBaseAnim::init(DVECTOR const &_Pos)
|
void CFXBaseAnim::init(DVECTOR const &_Pos)
|
||||||
{
|
{
|
||||||
CFX::init(_Pos);
|
CFX::init(_Pos);
|
||||||
CurrentFrame=0;
|
CurrentFrame=0;
|
||||||
CurrentScaleX=CurrentScaleY=DataPtr->Scale;
|
CurrentScaleX=CurrentScaleY=ONE;
|
||||||
CurrentHeading = 0;
|
CurrentHeading = 0;
|
||||||
MaxFrame=((DataPtr->EndFrame-DataPtr->StartFrame)<<DataPtr->FrameShift)-1;
|
|
||||||
if (DataPtr->Flags & FXANIM_FLAG_LOOP)
|
MaxFrame=((BaseData->EndFrame-BaseData->StartFrame)<<BaseData->FrameShift)-1;
|
||||||
{ // Looping Anim, so let it live forever!
|
Flags|=BaseData->Flags;
|
||||||
|
renderFrame=BaseData->StartFrame;
|
||||||
|
|
||||||
|
if (Flags & FX_FLAG_LOOP)
|
||||||
|
{
|
||||||
Life=-1;
|
Life=-1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Life=MaxFrame;
|
Life=MaxFrame;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VelY=0;
|
/*****************************************************************************/
|
||||||
renderFrame=DataPtr->StartFrame;
|
void CFXBaseAnim::setBaseData(void *Data)
|
||||||
|
{
|
||||||
|
CFX::setBaseData(Data);
|
||||||
|
BaseData=(sFXBaseData*)Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -45,45 +49,20 @@ void CFXBaseAnim::init(DVECTOR const &_Pos)
|
|||||||
void CFXBaseAnim::think(int _frames)
|
void CFXBaseAnim::think(int _frames)
|
||||||
{
|
{
|
||||||
CFX::think(_frames);
|
CFX::think(_frames);
|
||||||
CurrentFrame+=_frames;
|
|
||||||
|
if (BaseData->StartFrame!=BaseData->EndFrame)
|
||||||
|
{
|
||||||
|
// CurrentFrame+=_frames;
|
||||||
|
CurrentFrame+=1;
|
||||||
|
|
||||||
if (CurrentFrame>=MaxFrame)
|
if (CurrentFrame>=MaxFrame)
|
||||||
{
|
{
|
||||||
CurrentFrame=0;
|
CurrentFrame=0;
|
||||||
}
|
}
|
||||||
Pos.vx+=DataPtr->Velocity.vx;
|
int ThisFrame=CurrentFrame>>BaseData->FrameShift;
|
||||||
Pos.vy+=DataPtr->Velocity.vy+VelY;
|
renderFrame=BaseData->StartFrame+ThisFrame;
|
||||||
|
|
||||||
int ThisFrame=CurrentFrame>>DataPtr->FrameShift;
|
|
||||||
renderFrame=DataPtr->StartFrame+ThisFrame;
|
|
||||||
|
|
||||||
if (DataPtr->Flags & FXANIM_FLAG_HAS_GRAVITY)
|
|
||||||
{
|
|
||||||
VelY++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
|
||||||
// If has follow on effect, create it now
|
|
||||||
if (DataPtr->EndFX!=CFX::FX_TYPE_NONE && canThink())
|
|
||||||
{
|
|
||||||
CFX::Create((CFX::FX_TYPE)DataPtr->EndFX,getPos());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -95,41 +74,14 @@ void CFXBaseAnim::render()
|
|||||||
DVECTOR RenderPos;
|
DVECTOR RenderPos;
|
||||||
|
|
||||||
getFXRenderPos(RenderPos);
|
getFXRenderPos(RenderPos);
|
||||||
if (!canRender() || !IsVisible) return;
|
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
||||||
|
|
||||||
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
||||||
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(renderFrame,RenderPos.vx,RenderPos.vy,CurrentScaleX,CurrentScaleY,CurrentHeading,OtPos);
|
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(renderFrame,RenderPos.vx,RenderPos.vy,CurrentScaleX,CurrentScaleY,CurrentHeading,OtPos);
|
||||||
setShadeTex(Ft4,0);
|
setShadeTex(Ft4,0);
|
||||||
setRGB0(Ft4,DataPtr->R,DataPtr->G,DataPtr->B);
|
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
|
||||||
setSemiTrans(Ft4,DataPtr->Flags & FXANIM_FLAG_TRANS);
|
setSemiTrans(Ft4,Flags & FX_FLAG_TRANS);
|
||||||
Frame=Ft4;
|
Frame=Ft4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CFXBaseAnim::collidedWith(CThing *_thisThing)
|
|
||||||
{
|
|
||||||
switch(_thisThing->getThingType())
|
|
||||||
{
|
|
||||||
case TYPE_PLAYER:
|
|
||||||
{
|
|
||||||
CPlayer *player = (CPlayer *) _thisThing;
|
|
||||||
|
|
||||||
if ( !player->isRecoveringFromHit() )
|
|
||||||
{
|
|
||||||
if ( DataPtr->Flags & FXANIM_FLAG_KILL_PLAYER )
|
|
||||||
{
|
|
||||||
player->takeDamage( DAMAGE__KILL_OUTRIGHT );
|
|
||||||
}
|
|
||||||
else if ( DataPtr->Flags & FXANIM_FLAG_INJURE_PLAYER )
|
|
||||||
{
|
|
||||||
player->takeDamage( DAMAGE__HIT_ENEMY );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -11,33 +11,17 @@
|
|||||||
class CFXBaseAnim : public CFX
|
class CFXBaseAnim : public CFX
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sFXAnim
|
struct sFXBaseData
|
||||||
{
|
{
|
||||||
s16 Scale;
|
s16 StartFrame,EndFrame,FrameShift;
|
||||||
s16 StartFrame,EndFrame;
|
u16 Flags;
|
||||||
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,
|
|
||||||
FXANIM_FLAG_INJURE_PLAYER =1<<3,
|
|
||||||
FXANIM_FLAG_KILL_PLAYER =1<<4,
|
|
||||||
FXANIM_FLAG_TRANS =1<<5,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void init(DVECTOR const &Pos);
|
virtual void init(DVECTOR const &Pos);
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
virtual void render();
|
virtual void render();
|
||||||
virtual void killFX();
|
|
||||||
virtual int canCollide() {return true;}
|
|
||||||
|
|
||||||
void setData(void *Data) {DataPtr=(sFXAnim*)Data;}
|
void setBaseData(void *Data);
|
||||||
|
|
||||||
virtual void SetScale(int S) {CurrentScaleX=CurrentScaleY=S;}
|
virtual void SetScale(int S) {CurrentScaleX=CurrentScaleY=S;}
|
||||||
virtual void SetScaleX(int S) {CurrentScaleX=S;}
|
virtual void SetScaleX(int S) {CurrentScaleX=S;}
|
||||||
@ -45,11 +29,10 @@ virtual void SetScaleY(int S) {CurrentScaleY=S;}
|
|||||||
virtual void SetHeading(int H) {CurrentHeading=H;}
|
virtual void SetHeading(int H) {CurrentHeading=H;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
|
||||||
|
|
||||||
sFXAnim *DataPtr;
|
sFXBaseData *BaseData;
|
||||||
POLY_FT4 *Frame;
|
POLY_FT4 *Frame;
|
||||||
s16 VelY;
|
|
||||||
s16 MaxFrame;
|
s16 MaxFrame;
|
||||||
s16 CurrentFrame;
|
s16 CurrentFrame;
|
||||||
u16 renderFrame;
|
u16 renderFrame;
|
||||||
|
@ -42,7 +42,7 @@ bool hasParent=getFXParentPos(Pos);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CFXBaseTrail::sList &CFXBaseTrail::moveHead()
|
CFXBaseTrail::sList &CFXBaseTrail::moveHead()
|
||||||
{
|
{
|
||||||
if ( IsVisible )
|
if ( Flags & FX_FLAG_HIDDEN )
|
||||||
{
|
{
|
||||||
HeadIdx--;
|
HeadIdx--;
|
||||||
if (HeadIdx<0) HeadIdx+=LIST_SIZE;
|
if (HeadIdx<0) HeadIdx+=LIST_SIZE;
|
||||||
|
@ -20,11 +20,10 @@ void CFXBubble::init(DVECTOR const &_Pos)
|
|||||||
{
|
{
|
||||||
CFXBaseAnim::init(_Pos);
|
CFXBaseAnim::init(_Pos);
|
||||||
Life=32+getRndRange(63);
|
Life=32+getRndRange(63);
|
||||||
VelY=-getRndRange(4)-1;
|
Velocity.vy=-(getRndRange(4)+1);
|
||||||
CurrentScaleX=CurrentScaleY=getRndRange(DataPtr->Scale/2)+(DataPtr->Scale/2);
|
CurrentScaleX=CurrentScaleY=getRndRange(ONE/2)+(ONE/2);
|
||||||
Die=0;
|
Die=0;
|
||||||
XIdx=getRnd()&15;
|
XIdx=getRnd()&15;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -55,7 +54,6 @@ void CFXBubble::think(int _frames)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFXBubble::killFX()
|
void CFXBubble::killFX()
|
||||||
{
|
{
|
||||||
|
|
||||||
Die=1;
|
Die=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,56 +11,75 @@
|
|||||||
#include "level\level.h"
|
#include "level\level.h"
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
|
|
||||||
#include "FX\FXBaseAnim.h"
|
#include "FX\FXGeyser.h"
|
||||||
#include "FX\FXAttachAnim.h"
|
|
||||||
|
|
||||||
int MaxHeight=128;
|
int MaxHeight=128;
|
||||||
|
int GeyserSpeed=4;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFXAttachAnim::init(DVECTOR const &_Pos)
|
void CFXGeyser::init(DVECTOR const &_Pos)
|
||||||
{
|
{
|
||||||
CFXBaseAnim::init(_Pos);
|
CFX::init(_Pos);
|
||||||
Height=TargetHeight=8;
|
Height=TargetHeight=8;
|
||||||
|
currentFrame=FRM__GUSH000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFXAttachAnim::thing(int Frames)
|
void CFXGeyser::think(int Frames)
|
||||||
{
|
{
|
||||||
CFXBaseAnim::think(Frames);
|
CFX::think(Frames);
|
||||||
CThing *Parent=getParent();
|
|
||||||
|
|
||||||
int HDiff=TargetHeight-Height;
|
currentFrame++;
|
||||||
Height+=(HDiff+1)/2;
|
if (currentFrame>FRM__GUSH003)
|
||||||
|
|
||||||
if (Parent)
|
|
||||||
{
|
{
|
||||||
Pos2=Parent->getRenderPos();
|
currentFrame=FRM__GUSH000;
|
||||||
}
|
}
|
||||||
else
|
TargetHeight=MaxHeight;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Render ******************************************************************/
|
/*** Render ******************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CFXAttachAnim::render()
|
void CFXGeyser::render()
|
||||||
{
|
{
|
||||||
CFXBaseAnim::render();
|
DVECTOR RenderPos;
|
||||||
|
POLY_FT4 *Ft4;
|
||||||
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
||||||
|
CThing *Parent=getParent();
|
||||||
|
|
||||||
|
getFXRenderPos(RenderPos);
|
||||||
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
||||||
|
|
||||||
int FrameW=Frame->x1-Frame->x0;
|
// is it attached to a platform?
|
||||||
int HalfW=FrameW>>1;
|
if (Parent)
|
||||||
|
{ // yes, so get pos, and return
|
||||||
|
Height=RenderPos.vy-Parent->getRenderPos().vy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int HDiff=TargetHeight-Height;
|
||||||
|
Height+=(HDiff+(GeyserSpeed-1))/GeyserSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
Frame->x0=Pos2.vx-HalfW;
|
// top
|
||||||
Frame->y0=Pos2.vy;
|
Ft4=SprBank->printFT4(currentFrame,RenderPos.vx,RenderPos.vy-Height,0,0,OtPos);
|
||||||
Frame->x1=Pos2.vx+HalfW;
|
setShadeTex(Ft4,0);
|
||||||
Frame->y1=Pos2.vy;
|
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
|
||||||
|
setSemiTrans(Ft4,Flags & FX_FLAG_TRANS);
|
||||||
|
|
||||||
int BY=Frame->y2-Frame->y0;
|
int FrameW=Ft4->x1-Ft4->x0;
|
||||||
// setCollisionCentreOffset(0,BY>>1);
|
setCollisionCentreOffset(FrameW>>1,-Height/2);
|
||||||
setCollisionSize(FrameW,BY*2);
|
setCollisionCentreOffset(0,-Height/2);
|
||||||
|
setCollisionSize(FrameW,Height);
|
||||||
|
|
||||||
|
// Base
|
||||||
|
Ft4=SprBank->printFT4(FRM__GUSHBASE,RenderPos.vx,RenderPos.vy,0,0,OtPos);
|
||||||
|
setShadeTex(Ft4,0);
|
||||||
|
setRGB0(Ft4,RGB.R,RGB.G,RGB.B);
|
||||||
|
setSemiTrans(Ft4,Flags & FX_FLAG_TRANS);
|
||||||
|
Ft4->y0=Ft4->y2-Height;
|
||||||
|
Ft4->y1=Ft4->y3-Height;
|
||||||
|
Ft4->v2--; Ft4->v3--;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,22 +2,23 @@
|
|||||||
/*** Anim Base Class ***/
|
/*** Anim Base Class ***/
|
||||||
/***********************/
|
/***********************/
|
||||||
|
|
||||||
#ifndef __FX_FX_ATTACH_ANIM_HEADER__
|
#ifndef __FX_FX_GEYSER_HEADER__
|
||||||
#define __FX_FX_ATTACH_ANIM_HEADER__
|
#define __FX_FX_GEYSER_HEADER__
|
||||||
|
|
||||||
#include "fx/fx.h"
|
#include "fx/fx.h"
|
||||||
#include "fx/fxbaseAnim.h"
|
#include "fx/fxbaseAnim.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CFXAttachAnim : public CFXBaseAnim
|
class CFXGeyser : public CFX
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void init(DVECTOR const &Pos);
|
virtual void init(DVECTOR const &Pos);
|
||||||
virtual void thing(int Frames);
|
virtual void think(int Frames);
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DVECTOR Pos2;
|
s16 TargetHeight,Height;
|
||||||
|
u16 currentFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ DVECTOR renderPos0,renderPos1;
|
|||||||
sOT *ThisOT=OtPtr+OtPos;
|
sOT *ThisOT=OtPtr+OtPos;
|
||||||
|
|
||||||
getFXRenderPos(renderPos0);
|
getFXRenderPos(renderPos0);
|
||||||
if (!canRender() || !IsVisible) return;
|
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
||||||
|
|
||||||
calcRenderPos(Target,renderPos1);
|
calcRenderPos(Target,renderPos1);
|
||||||
renderPos0.vx+=Offset.vx;
|
renderPos0.vx+=Offset.vx;
|
||||||
|
@ -35,7 +35,7 @@ void CFXThwack::render()
|
|||||||
DVECTOR RenderPos;
|
DVECTOR RenderPos;
|
||||||
|
|
||||||
getFXRenderPos(RenderPos);
|
getFXRenderPos(RenderPos);
|
||||||
if (!canRender() || !IsVisible) return;
|
if (!canRender() || Flags & FX_FLAG_HIDDEN) return;
|
||||||
|
|
||||||
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
||||||
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(FRM__THWACK,RenderPos.vx,RenderPos.vy,Scale,Scale,Angle,OtPos);
|
POLY_FT4 *Ft4=SprBank->printRotatedScaledSprite(FRM__THWACK,RenderPos.vx,RenderPos.vy,Scale,Scale,Angle,OtPos);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "utils\utils.h"
|
#include "utils\utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fx\fxattachAnim.h"
|
#include "fx\fxgeyser.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
const int DodgyFXOffset=16;
|
const int DodgyFXOffset=16;
|
||||||
@ -30,10 +30,11 @@ void CNpcGeyserPlatform::postInit()
|
|||||||
m_isFiring = false;
|
m_isFiring = false;
|
||||||
|
|
||||||
m_state = GEYSER_READY;
|
m_state = GEYSER_READY;
|
||||||
// Add fountain stuff
|
// Add GEYSER stuff
|
||||||
|
|
||||||
DVECTOR Pos=getPos();
|
DVECTOR Pos=getPos();
|
||||||
Pos.vy+=DodgyFXOffset;
|
Pos.vy+=DodgyFXOffset;
|
||||||
CThing *FX=CFX::Create(CFX::FX_TYPE_FOUNTAIN_OIL,Pos);
|
CThing *FX=CFX::Create(CFX::FX_TYPE_GEYSER_OIL,Pos);
|
||||||
addChild(FX);
|
addChild(FX);
|
||||||
|
|
||||||
}
|
}
|
||||||
|