2000-10-18 00:04:57 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
bubicles.h
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __GFX_BUBICLES_H__
|
|
|
|
#define __GFX_BUBICLES_H__
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
#ifndef __GFX_SPRBANK_H__
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
// Uncomment to see the emitters on screen
|
2001-01-12 22:12:13 +01:00
|
|
|
//#define SHOW_BUBICLE_EMITTERS
|
2000-10-18 20:36:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
//
|
|
|
|
// An individual particle and it's associated data
|
|
|
|
//
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
typedef struct RGBPack
|
|
|
|
{
|
2000-10-18 22:00:31 +02:00
|
|
|
u8 m_r,m_g,m_b;
|
2000-10-18 00:04:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2000-10-18 22:00:31 +02:00
|
|
|
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;
|
2001-01-23 22:56:51 +01:00
|
|
|
s16 m_w,m_h; // Size of bubicle
|
2000-10-18 22:00:31 +02:00
|
|
|
s16 m_dvSizeChange; // Speed at which bubbles changes height/width
|
|
|
|
s16 m_theta,m_vtheta;
|
|
|
|
s16 m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth;
|
|
|
|
s16 m_ot; // ot
|
|
|
|
RGBPack m_colour; // Colour
|
2000-10-18 00:04:57 +02:00
|
|
|
} BubicleData;
|
|
|
|
|
|
|
|
class CBubicle
|
|
|
|
{
|
2000-10-18 20:36:52 +02:00
|
|
|
// We don't really want anyone to instantiate this themselves.. only the factory is allowed to
|
|
|
|
private:
|
2000-10-18 00:04:57 +02:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ACCURACY_SHIFT=6,
|
|
|
|
};
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
CBubicle() {;}
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
void create();
|
2001-01-23 22:56:51 +01:00
|
|
|
void init(BubicleData *_init,int _x,int _y,int _applyMapOffset);
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
void think(int _frames);
|
2000-10-18 00:04:57 +02:00
|
|
|
void render();
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
int isActive() {return m_active;}
|
|
|
|
|
|
|
|
|
2000-10-18 22:00:31 +02:00
|
|
|
u8 m_active;
|
2000-10-18 00:04:57 +02:00
|
|
|
int m_x;
|
|
|
|
int m_y;
|
2000-10-18 22:00:31 +02:00
|
|
|
s16 m_typeSizeChange; // 0=Width, 1=Height
|
|
|
|
s16 m_vSizeChange;
|
|
|
|
s16 m_frameCount;
|
2001-01-23 22:56:51 +01:00
|
|
|
s16 m_applyMapOffset;
|
2000-10-18 20:36:52 +02:00
|
|
|
sFrameHdr *m_fhBub;
|
2000-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
BubicleData m_data;
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
friend class CBubicleFactory;
|
|
|
|
friend class CBubicleEmitter;
|
2000-10-18 00:04:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// An emitter
|
|
|
|
//
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2000-10-18 22:00:31 +02:00
|
|
|
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
|
2001-01-23 22:56:51 +01:00
|
|
|
s16 m_applyMapOffset; // Is bubicle position relative to the map or not?
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
BubicleData m_bubicleBase;
|
|
|
|
BubicleData m_bubicleRange;
|
2000-10-18 00:04:57 +02:00
|
|
|
} BubicleEmitterData;
|
|
|
|
|
|
|
|
class CBubicleEmitter
|
|
|
|
{
|
|
|
|
public:
|
2000-10-18 20:36:52 +02:00
|
|
|
void kill();
|
|
|
|
void setPos(int _x,int _y);
|
|
|
|
void setSize(int _w,int _h);
|
|
|
|
void setPosAndSize(int _x,int _y,int _w,int _h) {setPos(_x,_y);setSize(_w,_h);}
|
|
|
|
|
|
|
|
int isActive() {return m_active;}
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
private:
|
|
|
|
CBubicleEmitter() {;}
|
|
|
|
|
|
|
|
void create();
|
|
|
|
void init(BubicleEmitterData *_init);
|
|
|
|
|
|
|
|
void think(int _frames);
|
|
|
|
#ifdef SHOW_BUBICLE_EMITTERS
|
|
|
|
void render();
|
|
|
|
#endif
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 22:00:31 +02:00
|
|
|
u8 m_active;
|
2000-10-18 20:36:52 +02:00
|
|
|
BubicleEmitterData m_data;
|
|
|
|
int m_frameCount;
|
2000-10-18 22:00:31 +02:00
|
|
|
s16 m_spawnFrameCount;
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
friend class CBubicleFactory;
|
|
|
|
};
|
2000-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
//
|
|
|
|
// Particle factory
|
|
|
|
//
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
class CBubicleFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void init();
|
|
|
|
static void shutdown();
|
2000-11-15 16:37:12 +01:00
|
|
|
static void think(int _frames);
|
2000-10-18 20:36:52 +02:00
|
|
|
static void render();
|
|
|
|
|
|
|
|
static CBubicleEmitter *spawnEmitter(BubicleEmitterData *_init);
|
|
|
|
static CBubicle *spawnParticle(BubicleEmitterData *_init);
|
2000-11-28 01:06:22 +01:00
|
|
|
static sFrameHdr *getBubbleFrameHeader();
|
2000-10-18 20:36:52 +02:00
|
|
|
static SpriteBank *getSprites() {return s_sprites;}
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2001-01-23 22:56:51 +01:00
|
|
|
static void setMapOffset(DVECTOR *_offset);
|
|
|
|
static const DVECTOR *getMapOffset();
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
private:
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
NUM_EMITTERS=10,
|
2000-11-23 21:46:24 +01:00
|
|
|
NUM_BUBICLES=250,
|
2000-10-18 20:36:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
CBubicleFactory() {;}
|
|
|
|
|
|
|
|
static int s_initialised;
|
|
|
|
static CBubicleEmitter *s_emitters;
|
|
|
|
static CBubicle *s_bubicles;
|
|
|
|
static SpriteBank *s_sprites;
|
|
|
|
|
2000-11-28 01:06:22 +01:00
|
|
|
static int s_frameTypeCounter;
|
|
|
|
static const int s_frameTabSize;
|
|
|
|
static const int s_frameTabSizeMask;
|
|
|
|
static sFrameHdr *s_frameTab[];
|
|
|
|
static const int s_frameTabSrc[];
|
|
|
|
|
2001-01-23 22:56:51 +01:00
|
|
|
static DVECTOR s_mapPositionOffset;
|
|
|
|
|
2000-10-18 20:36:52 +02:00
|
|
|
};
|
2000-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Globals
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Functions
|
|
|
|
--------- */
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#endif /* __GFX_BUBICLES_H__ */
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|