This commit is contained in:
parent
72651463f8
commit
89a3d6a95f
@ -82,11 +82,14 @@ const int CBubicleFactory::s_frameTabSrc[s_frameTabSize]=
|
||||
FRM__BUBBLE_2,FRM__BUBBLE_1,FRM__BUBBLE_2,FRM__BUBBLE_3,
|
||||
};
|
||||
|
||||
DVECTOR CBubicleFactory::s_mapPositionOffset={0,0};
|
||||
|
||||
int s_numLiveBubicleEmitters=0;
|
||||
int s_numLiveBubicles=0;
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
@ -152,10 +155,15 @@ void CBubicleEmitter::think(int _frames)
|
||||
#ifdef SHOW_BUBICLE_EMITTERS
|
||||
void CBubicleEmitter::render()
|
||||
{
|
||||
DVECTOR mapPos={0,0}
|
||||
POLY_F4 *f4;
|
||||
if(m_data.m_applyMapOffset)
|
||||
{
|
||||
mapPos=*CBubicleFactory::getMapOffset();
|
||||
}
|
||||
f4=GetPrimF4();
|
||||
setPolyF4(f4);
|
||||
setXYWH(f4,m_data.m_x,m_data.m_y,m_data.m_w,m_data.m_h);
|
||||
setXYWH(f4,m_data.m_x-mapPos->vx,m_data.m_y-mapPos->vy,m_data.m_w,m_data.m_h);
|
||||
setSemiTrans(f4,1);
|
||||
setShadeTex(f4,0);
|
||||
setRGB0(f4,30,40,50);
|
||||
@ -227,7 +235,7 @@ void CBubicle::create()
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBubicle::init(BubicleData *_init,int _x,int _y)
|
||||
void CBubicle::init(BubicleData *_init,int _x,int _y,int _applyMapOffset)
|
||||
{
|
||||
m_data=*_init;
|
||||
|
||||
@ -242,6 +250,7 @@ void CBubicle::init(BubicleData *_init,int _x,int _y)
|
||||
m_typeSizeChange=getRnd()&1;
|
||||
m_vSizeChange=0;
|
||||
m_frameCount=0;
|
||||
m_applyMapOffset=_applyMapOffset;
|
||||
|
||||
m_fhBub=CBubicleFactory::getBubbleFrameHeader();
|
||||
|
||||
@ -340,11 +349,17 @@ void CBubicle::render()
|
||||
{
|
||||
ASSERT(isActive());
|
||||
|
||||
DVECTOR mapPos={0,0};
|
||||
POLY_FT4 *ft4;
|
||||
int x,y,w,h;
|
||||
|
||||
x=m_x>>ACCURACY_SHIFT;
|
||||
y=m_y>>ACCURACY_SHIFT;
|
||||
if(m_applyMapOffset)
|
||||
{
|
||||
mapPos=*CBubicleFactory::getMapOffset();
|
||||
}
|
||||
|
||||
x=(m_x>>ACCURACY_SHIFT)-mapPos.vx;
|
||||
y=(m_y>>ACCURACY_SHIFT)-mapPos.vy;
|
||||
w=m_data.m_w>>ACCURACY_SHIFT;
|
||||
h=m_data.m_h>>ACCURACY_SHIFT;
|
||||
|
||||
@ -558,7 +573,7 @@ CBubicle *CBubicleFactory::spawnParticle(BubicleEmitterData *_init)
|
||||
newBubData.m_colour.m_g=_init->m_bubicleBase.m_colour.m_r+getRndRange(_init->m_bubicleRange.m_colour.m_g);
|
||||
newBubData.m_colour.m_b=_init->m_bubicleBase.m_colour.m_r+getRndRange(_init->m_bubicleRange.m_colour.m_b);
|
||||
|
||||
bub->init(&newBubData,x,y);
|
||||
bub->init(&newBubData,x,y,_init->m_applyMapOffset);
|
||||
s_numLiveBubicles++;
|
||||
return bub;
|
||||
}
|
||||
@ -583,5 +598,29 @@ sFrameHdr *CBubicleFactory::getBubbleFrameHeader()
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBubicleFactory::setMapOffset(DVECTOR *_offset)
|
||||
{
|
||||
s_mapPositionOffset=*_offset;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
const DVECTOR *CBubicleFactory::getMapOffset()
|
||||
{
|
||||
return &s_mapPositionOffset;
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
@ -54,7 +54,7 @@ typedef struct
|
||||
s16 m_life; // Frames to live for
|
||||
s16 m_vx,m_vdx,m_vxmax; // Velocity, velocitydelta, max velocity
|
||||
s16 m_vy,m_vdy,m_vymax;
|
||||
int m_w,m_h; // Size of bubicle
|
||||
s16 m_w,m_h; // Size of bubicle
|
||||
s16 m_dvSizeChange; // Speed at which bubbles changes height/width
|
||||
s16 m_theta,m_vtheta;
|
||||
s16 m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth;
|
||||
@ -74,7 +74,7 @@ private:
|
||||
CBubicle() {;}
|
||||
|
||||
void create();
|
||||
void init(BubicleData *_init,int _x,int _y);
|
||||
void init(BubicleData *_init,int _x,int _y,int _applyMapOffset);
|
||||
|
||||
void think(int _frames);
|
||||
void render();
|
||||
@ -88,6 +88,7 @@ private:
|
||||
s16 m_typeSizeChange; // 0=Width, 1=Height
|
||||
s16 m_vSizeChange;
|
||||
s16 m_frameCount;
|
||||
s16 m_applyMapOffset;
|
||||
sFrameHdr *m_fhBub;
|
||||
|
||||
BubicleData m_data;
|
||||
@ -107,6 +108,7 @@ typedef struct
|
||||
int m_x,m_y,m_w,m_h; // Size and position of emitter
|
||||
s16 m_birthRate,m_birthAmount; // birthAmount bubicles born every birthRate frames
|
||||
s16 m_life; // -1 for infinite life
|
||||
s16 m_applyMapOffset; // Is bubicle position relative to the map or not?
|
||||
|
||||
BubicleData m_bubicleBase;
|
||||
BubicleData m_bubicleRange;
|
||||
@ -162,6 +164,9 @@ public:
|
||||
static sFrameHdr *getBubbleFrameHeader();
|
||||
static SpriteBank *getSprites() {return s_sprites;}
|
||||
|
||||
static void setMapOffset(DVECTOR *_offset);
|
||||
static const DVECTOR *getMapOffset();
|
||||
|
||||
|
||||
private:
|
||||
enum
|
||||
@ -183,6 +188,8 @@ private:
|
||||
static sFrameHdr *s_frameTab[];
|
||||
static const int s_frameTabSrc[];
|
||||
|
||||
static DVECTOR s_mapPositionOffset;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,6 +69,7 @@ BubicleEmitterData s_fadeBubicleSpawner=
|
||||
0,0,512,40, // m_x,m_y,m_w,m_h
|
||||
0,0, // m_birthRate,m_birthAmount
|
||||
0, // m_life
|
||||
false, // m_applyMapOffsets
|
||||
|
||||
// m_bubicleBase
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user