This commit is contained in:
Daveo 2001-05-30 20:36:44 +00:00
parent 0e4bdb4d66
commit 094ef45f8f
5 changed files with 75 additions and 149 deletions

View file

@ -132,8 +132,10 @@ CFX *NewFX;
case FX_TYPE_JELLYFISH_LEGS: case FX_TYPE_JELLYFISH_LEGS:
// NewFX=new ("JellyFish Legs") CFXJellyFishLegs(); NewFX=new ("JellyFish Legs") CFXJellyFishLegs();
ASSERT(!"FISH LEGS OUT OF STOCK\n"); break;
case FX_TYPE_BUBBLE: case FX_TYPE_BUBBLE:
case FX_TYPE_BUBBLE_WATER: case FX_TYPE_BUBBLE_WATER:
case FX_TYPE_BUBBLE_ACID: case FX_TYPE_BUBBLE_ACID:
@ -172,9 +174,8 @@ CFX *CFX::Create(const FX_TYPE Type,CThing *Parent)
{ {
CFX *NewFX=CFX::Create(Type); CFX *NewFX=CFX::Create(Type);
ASSERT(Parent);
NewFX->init(Parent->getPos()); NewFX->init(Parent->getPos());
ASSERT(Parent);
Parent->addChild(NewFX); Parent->addChild(NewFX);
return NewFX; return NewFX;

View file

@ -9,157 +9,96 @@
#include "gfx\sprbank.h" #include "gfx\sprbank.h"
#include <sprites.h> #include <sprites.h>
#include "level\level.h" #include "level\level.h"
#include "game\game.h"
#include "FX\FXjfish.h" #include "FX\FXjfish.h"
int LegCount=3;
int LegWInc=32/LegCount;
int LegHInc=-4;
int LegAngleInc=7;
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CFXJellyFishLegs::init() void CFXJellyFishLegs::init(DVECTOR const &_Pos)
{ {
CFX::init(); CFX::init();
FXList=0; Pos=_Pos;
Ofs.vx=0; Ofs.vy=0;
Angle=getRnd();
AngleInc=LegAngleInc+getRndRange(3);
} }
/*****************************************************************************/ /*****************************************************************************/
void CFXJellyFishLegs::shutdown() void CFXJellyFishLegs::shutdown()
{ {
for (int L=0; L<Width; L++)
{
MemFree(FXList[L]);
}
MemFree(FXList);
MemFree(WidthTable);
MemFree(HeightTable);
CFX::shutdown(); CFX::shutdown();
} }
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ void CFXJellyFishLegs::Setup(int XOfs,int YOfs,bool XFlip)
void CFXJellyFishLegs::SetUp(int _Width,int _Gap,int _Length,int _Count)
{ {
/* Ofs.vx=XOfs;
XOfs=-(_Width/2); Ofs.vy=YOfs;
Width=_Width/_Gap; this->XFlip=XFlip;
Gap=_Gap;
Length=_Length;
Count=_Count;
FXList=(sList**)MemAlloc(Width*sizeof(sList*),"FishLegTable");
for (int L=0; L<Width; L++)
{
sList *ThisList=(sList*)MemAlloc(Count*sizeof(sList),"FishLeg");
FXList[L]=ThisList;
}
ListIdx=0;
WidthTable=(s16*)MemAlloc(Count*sizeof(s16),"FishLegWTable");
for (int W=0; W<Count; W++)
{
int dW=((8<<12)/Count)/2;
WidthTable[W]=(dW*W)>>12;
}
HeightTable=(s16*)MemAlloc(Width*sizeof(s16),"FishLegHTable");
int AInc=1024/Width;
for (int H=0; H<Width; H++)
{
int Ofs=abs(H-(Width/2));
int dH=8-Ofs;
dH*=2;
if (dH>8) dH=8;
if (dH<2) dH=2;
HeightTable[H]=(s16)dH;
}
*/
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Think *******************************************************************/ /*** Think *******************************************************************/
/*****************************************************************************/ /*****************************************************************************/
//int XT[]={-3,-3,-3,-2,-2,-2,-1,-1, +1,+1,+2,+2,+2,+3,+3,+3};
int XT[]={-3,-2,-2,-2,-2,-1,-1,-1, +1,+1,+1,+2,+2,+2,+2,+3};
void CFXJellyFishLegs::think(int _frames) void CFXJellyFishLegs::think(int _frames)
{ {
/* ASSERT(FXList); Pos=getParent()->getPos();
CFX::think(_frames); CFX::think(_frames);
Angle++; Angle&=CIRCLE_TAB_MASK;
ListIdx--; AngleInc=LegAngleInc;
if (ListIdx<0) ListIdx+=Count;
for (int i=0; i<Width; i++)
{
sList *ThisList=FXList[i];
ThisList[ListIdx].Ofs=Parent->getPos();
// ThisList[ListIdx].Ofs.vx/=16;
// ThisList[ListIdx].Ofs.vy/=16;
int XO=getRnd();
XO&=15;
ThisList[ListIdx].Ofs.vx+=XT[XO];
}
*/
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Render ******************************************************************/ /*** Render ******************************************************************/
/*****************************************************************************/ /*****************************************************************************/
const int Trans=3;
int LX=8;
int LY=32;
void CFXJellyFishLegs::render() void CFXJellyFishLegs::render()
{ {
/* CFX::render();
DVECTOR _MapOfs=CLevel::getCameraPos(); if (!canRender()) return;
DVECTOR MapOfs;
int dRGB=256/Count;
s16 *dH=HeightTable;
_MapOfs.vx+=LX; SpriteBank *SprBank=CGameScene::getSpriteBank();;
_MapOfs.vy+=LY; DVECTOR RenderPos=getRenderPos();
int WOfs=0;
int H;
int ThisAngle=Angle;
int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4;
if (!Parent->canRender()) return; RenderPos.vx+=Ofs.vx;
MapOfs.vx=_MapOfs.vx+XOfs; RenderPos.vy+=Ofs.vy;
for (int L=0; L<Width; L++) for (int i=0; i<LegCount; i++)
{ {
u8 C=255; ThisAngle+=AngleInc;
s16 *dW=WidthTable; ThisAngle&=CIRCLE_TAB_MASK;
int Idx=ListIdx; H=LegHeight+(CircleTable[ThisAngle]>>5);
sList *List=FXList[L];
DVECTOR LastPos;
int LastdW;
int Height=*dH++;
MapOfs.vy=_MapOfs.vy; POLY_FT4 *Ft4=SprBank->printFT4(FRM__LEG,RenderPos.vx,RenderPos.vy,XFlip,0,OtPos*0);
LastPos.vx=List[Idx].Ofs.vx-MapOfs.vx;
LastPos.vy=List[Idx].Ofs.vy-MapOfs.vy;
LastdW=*dW++;
MapOfs.vy-=Length;
Idx++;
for (int i=0; i<Count-1; i++) if (!XFlip)
{ {
if (Idx>=Count) Idx=0; Ft4->x1-=WOfs;
POLY_FT4 *Ft4=CGameScene::getSpriteBank()->printFT4(FRM__TENTACLE,LastPos.vx,LastPos.vy,0,0,OtPos); Ft4->x3-=WOfs;
}
else
{
Ft4->x0+=WOfs;
Ft4->x2+=WOfs;
}
Ft4->x0=LastPos.vx+0+LastdW; Ft4->y0=LastPos.vy;
Ft4->x1=LastPos.vx+8-LastdW; Ft4->y1=LastPos.vy; Ft4->y2=Ft4->y0+H;
setSemiTrans(Ft4,1); Ft4->y3=Ft4->y1+H;
Ft4->tpage|=Trans<<5; RenderPos.vy+=H+LegHInc;
LastPos.vx=List[Idx].Ofs.vx-MapOfs.vx; WOfs+=LegWInc;
LastPos.vy=List[Idx].Ofs.vy-MapOfs.vy;
LastdW=*dW++;
Ft4->x2=LastPos.vx+0+LastdW; Ft4->y2=LastPos.vy;
Ft4->x3=LastPos.vx+8-LastdW; Ft4->y3=LastPos.vy;
setRGB0(Ft4,C,C,C);
C-=dRGB;
MapOfs.vy-=Height;
Idx++;
} }
MapOfs.vx+=Gap;
}
*/
} }

View file

@ -11,29 +11,20 @@
class CFXJellyFishLegs : public CFX class CFXJellyFishLegs : public CFX
{ {
public: public:
struct sList
{
DVECTOR Ofs;
};
virtual void init(); 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();
void SetUp(int _Width,int _Gap,int _Length,int _Count); void Setup(int XOfs,int YOfs,bool XFlip);
//virtual CRECT const &getCollisionArea() {return (Parent->getCollisionArea());}
protected: protected:
DVECTOR Ofs;
int XOfs; int Angle,AngleInc;
int Width,Gap; bool XFlip;
int Length,Count;
sList **FXList;
int ListIdx;
s16 *WidthTable;
s16 *HeightTable;
}; };
#endif #endif

View file

@ -19,6 +19,15 @@
#endif #endif
/*****************************************************************************/
const s16 CircleTable[ CIRCLE_TAB_MAX] =
{
0,25,49,74,97,120,142,162,181,197,212,225,236,244,251,254,
255,254,251,244,236,225,212,197,181,162,142,120,97,74,49,25,
0,-25,-49,-74,-97,-120,-142,-162,-181,-197,-212,-225,-236,-244,-251,-254,
-255,-254,-251,-244,-236,-225,-212,-197,-181,-162,-142,-120,-97,-74,-49,-25
};
/*****************************************************************************/ /*****************************************************************************/
/* /*
const MATRIX IdentityMtx = const MATRIX IdentityMtx =

View file

@ -14,26 +14,12 @@
#endif #endif
/*****************************************************************************/ /*****************************************************************************/
#define NO_SIN 64 #define CIRCLE_TAB_MAX 64
#define SINMASK (NO_SIN - 1) #define CIRCLE_TAB_MASK 63
#define COSPOS (NO_SIN / 4) extern const s16 CircleTable[ CIRCLE_TAB_MAX];
//extern const s16 c_circle[ NO_SIN ];
//extern const MATRIX IdentityMtx;
/*****************************************************************************/
/*
struct sBox
{
s16 x0,y0;
s16 x1,y1;
s16 x2,y2;
s16 x3,y3;
};
*/
/*****************************************************************************/ /*****************************************************************************/
u8 *MakePtr(void *BasePtr,int Offset); u8 *MakePtr(void *BasePtr,int Offset);
//void RotateBox(sBox *B,int W,int H,int _xScale,int _yScale,int _rot);
/*****************************************************************************/ /*****************************************************************************/
/*** Loads of inlines ********************************************************/ /*** Loads of inlines ********************************************************/