This commit is contained in:
parent
7989cdebf4
commit
9511d71b37
5 changed files with 264 additions and 237 deletions
|
@ -200,7 +200,8 @@ game_src := convo \
|
||||||
game \
|
game \
|
||||||
gamebubs \
|
gamebubs \
|
||||||
gameslot \
|
gameslot \
|
||||||
pause
|
pause \
|
||||||
|
healthman
|
||||||
|
|
||||||
gfx_src := prim \
|
gfx_src := prim \
|
||||||
tpage \
|
tpage \
|
||||||
|
|
|
@ -91,6 +91,10 @@
|
||||||
#include "game\gameslot.h"
|
#include "game\gameslot.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_HEALTH_MANAGER_H__
|
||||||
|
#include "game\healthman.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "gfx\actor.h"
|
#include "gfx\actor.h"
|
||||||
|
|
||||||
|
@ -101,6 +105,8 @@ int RenderZ=378;//256; Increased to make depth less, and SB more visible
|
||||||
FontBank *CGameScene::s_genericFont;
|
FontBank *CGameScene::s_genericFont;
|
||||||
SpriteBank *CGameScene::s_GlobalSpritebank;
|
SpriteBank *CGameScene::s_GlobalSpritebank;
|
||||||
CLayerCollision *CGameScene::s_GlobalCollision;
|
CLayerCollision *CGameScene::s_GlobalCollision;
|
||||||
|
CHealthManager *CGameScene::m_HealthManager;
|
||||||
|
|
||||||
MATRIX CGameScene::CamMtx;
|
MATRIX CGameScene::CamMtx;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -197,6 +203,9 @@ void CGameScene::init()
|
||||||
m_pauseMenu=new ("Pause Menu") CPauseMenu();
|
m_pauseMenu=new ("Pause Menu") CPauseMenu();
|
||||||
m_pauseMenu->init();
|
m_pauseMenu->init();
|
||||||
|
|
||||||
|
m_HealthManager= new ("Health Manager") CHealthManager();
|
||||||
|
m_HealthManager->init();
|
||||||
|
|
||||||
s_readyToExit=false;
|
s_readyToExit=false;
|
||||||
s_restartLevel=false;
|
s_restartLevel=false;
|
||||||
|
|
||||||
|
@ -230,6 +239,8 @@ void CGameScene::shutdown()
|
||||||
m_pauseMenu->shutdown(); delete m_pauseMenu;
|
m_pauseMenu->shutdown(); delete m_pauseMenu;
|
||||||
m_scalableFont->dump(); delete m_scalableFont;
|
m_scalableFont->dump(); delete m_scalableFont;
|
||||||
s_genericFont->dump(); delete s_genericFont;
|
s_genericFont->dump(); delete s_genericFont;
|
||||||
|
m_HealthManager->shutdown();delete m_HealthManager;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -258,6 +269,8 @@ void CGameScene::render()
|
||||||
SetTransMatrix(&CamMtx);
|
SetTransMatrix(&CamMtx);
|
||||||
|
|
||||||
Level.render();
|
Level.render();
|
||||||
|
m_HealthManager->render();
|
||||||
|
|
||||||
CActorPool::CleanUpCache();
|
CActorPool::CleanUpCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,6 +396,8 @@ void CGameScene::think(int _frames)
|
||||||
CBubicleFactory::setMapOffset(&camPos);
|
CBubicleFactory::setMapOffset(&camPos);
|
||||||
Level.setCameraCentre(camPos);
|
Level.setCameraCentre(camPos);
|
||||||
Level.think(_frames);
|
Level.think(_frames);
|
||||||
|
m_HealthManager->think(_frames);
|
||||||
|
m_HealthManager->checkPlayerCol(getPlayer());
|
||||||
|
|
||||||
#ifdef __VERSION_DEBUG__
|
#ifdef __VERSION_DEBUG__
|
||||||
if(PadGetDown(0)&PAD_R2)
|
if(PadGetDown(0)&PAD_R2)
|
||||||
|
@ -483,6 +498,14 @@ void CGameScene::initLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int DropAmount=69;
|
||||||
|
int DropVel=1;
|
||||||
|
void CGameScene::dropHealth(DVECTOR &Pos,int Amount,int Vel)
|
||||||
|
{
|
||||||
|
m_HealthManager->drop(Pos,DropAmount,DropVel);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CGameScene::shutdownLevel()
|
void CGameScene::shutdownLevel()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@ class FontBank;
|
||||||
class SpriteBank;
|
class SpriteBank;
|
||||||
class CPlayer;
|
class CPlayer;
|
||||||
class CLayerCollision;
|
class CLayerCollision;
|
||||||
|
class CHealthManager;
|
||||||
class CGameScene : public CScene
|
class CGameScene : public CScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -59,6 +60,7 @@ static ACTOR_TYPE getActorType( int actorNum ) {return actorType[actorNum];}
|
||||||
static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;}
|
static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;}
|
||||||
static int getBossHasBeenKilled() {return s_bossHasBeenKilled;}
|
static int getBossHasBeenKilled() {return s_bossHasBeenKilled;}
|
||||||
|
|
||||||
|
static void dropHealth(DVECTOR &Pos,int Amount,int Vel);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void initLevel();
|
void initLevel();
|
||||||
|
@ -69,6 +71,7 @@ protected:
|
||||||
CLevel Level;
|
CLevel Level;
|
||||||
class CPauseMenu *m_pauseMenu;
|
class CPauseMenu *m_pauseMenu;
|
||||||
class CPlayer *m_player;
|
class CPlayer *m_player;
|
||||||
|
static CHealthManager *m_HealthManager;
|
||||||
static FontBank *s_genericFont;
|
static FontBank *s_genericFont;
|
||||||
class ScalableFontBank *m_scalableFont;
|
class ScalableFontBank *m_scalableFont;
|
||||||
static MATRIX CamMtx;
|
static MATRIX CamMtx;
|
||||||
|
|
|
@ -1,187 +1,204 @@
|
||||||
/*=========================================================================
|
/******************************/
|
||||||
|
/*** Health throw out stuff ***/
|
||||||
|
/******************************/
|
||||||
|
|
||||||
gamebubs.cpp
|
#include "system\global.h"
|
||||||
|
#include "mem\memory.h"
|
||||||
|
#include "gfx\sprbank.h"
|
||||||
|
#include "utils\utils.h"
|
||||||
|
#include "gfx\prim.h"
|
||||||
|
//#include "gfx\actor.h"
|
||||||
|
#include "game\game.h"
|
||||||
|
#include "player\player.h"
|
||||||
|
#include "gfx\otpos.h"
|
||||||
|
#include "game\healthman.h"
|
||||||
|
|
||||||
Author: PKG
|
#include <sprites.h>
|
||||||
Created:
|
|
||||||
Project: Spongebob
|
|
||||||
Purpose:
|
|
||||||
|
|
||||||
Copyright (c) 2001 Climax Development Ltd
|
CHealthManager::sItemTable CHealthManager::ItemTable[]=
|
||||||
|
|
||||||
===========================================================================*/
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Includes
|
|
||||||
-------- */
|
|
||||||
|
|
||||||
#include "game\gamebubs.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
|
||||||
------- */
|
|
||||||
|
|
||||||
/* Data
|
|
||||||
---- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Tyepdefs && Defines
|
|
||||||
------------------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Structure defintions
|
|
||||||
-------------------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Function Prototypes
|
|
||||||
------------------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Vars
|
|
||||||
---- */
|
|
||||||
|
|
||||||
BubicleEmitterData CGameBubicleFactory::s_emitters[CGameBubicleFactory::NUM_TYPES]=
|
|
||||||
{
|
{
|
||||||
// TYPE_SMALL
|
{5,256, 255,255,0},
|
||||||
{
|
{1,256, 127,127,127},
|
||||||
0,0,0,0, // m_x,m_y,m_w,m_h
|
|
||||||
2,3, // m_birthRate,m_birthAmount
|
|
||||||
5, // m_life
|
|
||||||
true, // m_applyMapOffsets
|
|
||||||
{ // m_bubicleBase
|
|
||||||
10, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
-100,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
5,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,0, // m_theta,m_vtheta
|
|
||||||
0,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{200,200,200} // m_colour
|
|
||||||
},
|
|
||||||
{ // m_bubicleRange
|
|
||||||
50, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
50,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
3,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,100, // m_theta,m_vtheta
|
|
||||||
10,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{0,0,0} // m_colour
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// TYPE_MEDIUM
|
|
||||||
{
|
|
||||||
0,0,0,0, // m_x,m_y,m_w,m_h
|
|
||||||
2,10, // m_birthRate,m_birthAmount
|
|
||||||
5, // m_life
|
|
||||||
true, // m_applyMapOffsets
|
|
||||||
{ // m_bubicleBase
|
|
||||||
10, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
-100,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
5,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,0, // m_theta,m_vtheta
|
|
||||||
0,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{200,200,200} // m_colour
|
|
||||||
},
|
|
||||||
{ // m_bubicleRange
|
|
||||||
50, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
50,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
3,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,100, // m_theta,m_vtheta
|
|
||||||
10,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{0,0,0} // m_colour
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// TYPE_LARGE
|
|
||||||
{
|
|
||||||
0,0,0,0, // m_x,m_y,m_w,m_h
|
|
||||||
1,10, // m_birthRate,m_birthAmount
|
|
||||||
15, // m_life
|
|
||||||
true, // m_applyMapOffsets
|
|
||||||
{ // m_bubicleBase
|
|
||||||
10, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
-100,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
5,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,0, // m_theta,m_vtheta
|
|
||||||
0,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{200,200,200} // m_colour
|
|
||||||
},
|
|
||||||
{ // m_bubicleRange
|
|
||||||
50, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
50,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
3,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,100, // m_theta,m_vtheta
|
|
||||||
10,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{0,0,0} // m_colour
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// TYPE_SPONGEBOBSOAKUP
|
|
||||||
{
|
|
||||||
0,0,0,0, // m_x,m_y,m_w,m_h
|
|
||||||
1,1, // m_birthRate,m_birthAmount
|
|
||||||
15, // m_life
|
|
||||||
true, // m_applyMapOffsets
|
|
||||||
{ // m_bubicleBase
|
|
||||||
10, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
-100,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
10,7, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,0, // m_theta,m_vtheta
|
|
||||||
0,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{200,200,200} // m_colour
|
|
||||||
},
|
|
||||||
{ // m_bubicleRange
|
|
||||||
50, // m_life
|
|
||||||
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
||||||
50,0,0, // m_vy,m_vdy,m_vymax
|
|
||||||
3,3, // m_w,m_h
|
|
||||||
0, // m_dvSizeChange
|
|
||||||
0,100, // m_theta,m_vtheta
|
|
||||||
10,0,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
||||||
0, // m_ot
|
|
||||||
{0,0,0} // m_colour
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int CHealthManager::ItemTableSize=sizeof(CHealthManager::ItemTable)/sizeof(CHealthManager::sItemTable);
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
int HealthManGrav=128;
|
||||||
Function:
|
int HealthManShift=9;
|
||||||
Purpose:
|
int HealthManPickUpDelay=16;
|
||||||
Params:
|
|
||||||
Returns:
|
/*****************************************************************************/
|
||||||
---------------------------------------------------------------------- */
|
void CHealthManager::init()
|
||||||
void CGameBubicleFactory::spawnBubicles(int _x,int _y,int _w,int _h,GAMEBUBICLETYPE _type)
|
|
||||||
{
|
{
|
||||||
BubicleEmitterData *emt;
|
FrameHdr=CGameScene::getSpriteBank()->getFrameHeader(FRM__SPATULA);
|
||||||
|
for (int i=0; i<ITEM_MAX; i++)
|
||||||
|
{
|
||||||
|
ItemList[i].Life=0;
|
||||||
|
setTSprt(&ItemList[i].Sprite);
|
||||||
|
setTSprtTPage(&ItemList[i].Sprite,FrameHdr->TPage);
|
||||||
|
ItemList[i].Sprite.clut=FrameHdr->Clut;
|
||||||
|
ItemList[i].Sprite.u0=FrameHdr->U;
|
||||||
|
ItemList[i].Sprite.v0=FrameHdr->V;
|
||||||
|
ItemList[i].Sprite.w=FrameHdr->W;
|
||||||
|
ItemList[i].Sprite.h=FrameHdr->H;
|
||||||
|
}
|
||||||
|
|
||||||
emt=&s_emitters[_type];
|
|
||||||
|
|
||||||
emt->m_x=_x;
|
|
||||||
emt->m_y=_y;
|
|
||||||
emt->m_w=_w;
|
|
||||||
emt->m_h=_h;
|
|
||||||
|
|
||||||
CBubicleFactory::spawnEmitter(emt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CHealthManager::shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*****************************************************************************/
|
||||||
end */
|
const int AngleS=2048+1024+512;
|
||||||
|
void CHealthManager::drop(DVECTOR &Pos,int Amount,int Vel)
|
||||||
|
{
|
||||||
|
int Count=0;
|
||||||
|
int Am=Amount;
|
||||||
|
// Count em for Arc
|
||||||
|
for (int i=0; i<ItemTableSize; i++)
|
||||||
|
{
|
||||||
|
sItemTable &T=ItemTable[i];
|
||||||
|
|
||||||
|
while (Amount>=T.Count)
|
||||||
|
{
|
||||||
|
Amount-=T.Count;
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int Angle=AngleS;
|
||||||
|
int AngleInc=1024/Count;
|
||||||
|
// Split Em
|
||||||
|
Amount=Am;
|
||||||
|
for (int i=0; i<ItemTableSize; i++)
|
||||||
|
{
|
||||||
|
sItemTable &T=ItemTable[i];
|
||||||
|
|
||||||
|
while (Amount>=T.Count)
|
||||||
|
{
|
||||||
|
Amount-=T.Count;
|
||||||
|
addItem(Pos,i,Angle,Vel);
|
||||||
|
Angle+=AngleInc;
|
||||||
|
Angle&=4095;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CHealthManager::addItem(DVECTOR &Pos,int TableIdx,int Angle,int Vel)
|
||||||
|
{
|
||||||
|
int Idx=0;
|
||||||
|
|
||||||
|
while (ItemList[Idx].Life) Idx++;
|
||||||
|
ASSERT(Idx<ITEM_MAX);
|
||||||
|
|
||||||
|
ItemList[Idx].Life=ItemTable[TableIdx].Life;
|
||||||
|
setRGB0(&ItemList[Idx].Sprite,ItemTable[TableIdx].R,ItemTable[TableIdx].G,ItemTable[TableIdx].B);
|
||||||
|
ItemList[Idx].Pos.vx=Pos.vx<<HealthManShift;
|
||||||
|
ItemList[Idx].Pos.vy=Pos.vy<<HealthManShift;
|
||||||
|
|
||||||
|
ItemList[Idx].Vel.vx=-(msin(Angle)*Vel)>>1;
|
||||||
|
ItemList[Idx].Vel.vy=-(mcos(Angle)*Vel);
|
||||||
|
ItemList[Idx].Count=ItemTable[TableIdx].Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CHealthManager::checkPlayerCol(CPlayer *Player)
|
||||||
|
{
|
||||||
|
CRECT const &PRect=Player->getCollisionArea();
|
||||||
|
|
||||||
|
for (int i=0; i<ITEM_MAX; i++)
|
||||||
|
{
|
||||||
|
if (ItemList[i].Life && ItemList[i].Life<256-HealthManPickUpDelay)
|
||||||
|
{
|
||||||
|
if (PRect.x2<ItemList[i].ScrPos.vx || PRect.x1>ItemList[i].ScrPos.vx+16 ||
|
||||||
|
PRect.y2<ItemList[i].ScrPos.vy || PRect.y1>ItemList[i].ScrPos.vy+32)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ItemList[i].Life=0;
|
||||||
|
Player->addSpatula(ItemList[i].Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*** think *******************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CHealthManager::think(int frames)
|
||||||
|
{
|
||||||
|
CLayerCollision *ColLayer=CGameScene::getCollision();
|
||||||
|
|
||||||
|
for (int i=0; i<ITEM_MAX; i++)
|
||||||
|
{
|
||||||
|
for (int f=0; f<frames; f++)
|
||||||
|
{
|
||||||
|
if (ItemList[i].Life)
|
||||||
|
{
|
||||||
|
ItemList[i].Life--;
|
||||||
|
ItemList[i].Pos.vx+=ItemList[i].Vel.vx;
|
||||||
|
ItemList[i].Pos.vy+=ItemList[i].Vel.vy;
|
||||||
|
ItemList[i].ScrPos.vx=ItemList[i].Pos.vx>>HealthManShift;
|
||||||
|
ItemList[i].ScrPos.vy=ItemList[i].Pos.vy>>HealthManShift;
|
||||||
|
ItemList[i].Vel.vy+=HealthManGrav;
|
||||||
|
|
||||||
|
if (ItemList[i].Vel.vy>0)
|
||||||
|
{ // Check ground collision
|
||||||
|
int DistY = ColLayer->getHeightFromGround( ItemList[i].ScrPos.vx, ItemList[i].ScrPos.vy, 16 );
|
||||||
|
if (DistY<=0)
|
||||||
|
{
|
||||||
|
ItemList[i].Vel.vy=-ItemList[i].Vel.vy>>1;
|
||||||
|
ItemList[i].Vel.vx>>=1;
|
||||||
|
// ItemList[i].Pos.vy-=DistY<<(HealthManShift-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int XOfs;
|
||||||
|
if (ItemList[i].Vel.vx>0)
|
||||||
|
{
|
||||||
|
XOfs=+16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XOfs=-16;
|
||||||
|
}
|
||||||
|
// Check X collision
|
||||||
|
int DistX = ColLayer->getHeightFromGround( ItemList[i].ScrPos.vx+XOfs, ItemList[i].ScrPos.vy, 32 );
|
||||||
|
if (DistX<=0)
|
||||||
|
{
|
||||||
|
ItemList[i].Vel.vx=-ItemList[i].Vel.vx>>1;
|
||||||
|
// ItemList[i].Pos.vy-=DistY<<(HealthManShift-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*** render ******************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CHealthManager::render()
|
||||||
|
{
|
||||||
|
sOT *ThisOT=OtPtr;//+OTPOS__PICKUP_POS;
|
||||||
|
DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||||
|
|
||||||
|
for (int i=0; i<ITEM_MAX; i++)
|
||||||
|
{
|
||||||
|
if (ItemList[i].Life)
|
||||||
|
{
|
||||||
|
// Calc render pos (dont worry about clipping yet)
|
||||||
|
ItemList[i].Sprite.x0 = ItemList[i].ScrPos.vx - CamPos.vx;
|
||||||
|
ItemList[i].Sprite.y0 = (ItemList[i].ScrPos.vy - CamPos.vy)-32;
|
||||||
|
|
||||||
|
addPrim(ThisOT,&ItemList[i].Sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,71 +1,54 @@
|
||||||
/*=========================================================================
|
/******************************/
|
||||||
|
/*** Health throw out stuff ***/
|
||||||
|
/******************************/
|
||||||
|
|
||||||
gamebubs.h
|
#ifndef __GAME_HEALTH_MANAGER_H__
|
||||||
|
#define __GAME_HEALTH_MANAGER_H__
|
||||||
|
|
||||||
Author: PKG
|
/*****************************************************************************/
|
||||||
Created:
|
class CPlayer;
|
||||||
Project: Spongebob
|
class CHealthManager
|
||||||
Purpose:
|
|
||||||
|
|
||||||
Copyright (c) 2001 Climax Development Ltd
|
|
||||||
|
|
||||||
===========================================================================*/
|
|
||||||
|
|
||||||
#ifndef __GAME_GAMEBUBS_H__
|
|
||||||
#define __GAME_GAMEBUBS_H__
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Includes
|
|
||||||
-------- */
|
|
||||||
|
|
||||||
#ifndef __GFX_BUBICLES_H__
|
|
||||||
#include "gfx\bubicles.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
|
||||||
------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Tyepdefs && Defines
|
|
||||||
------------------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Structure defintions
|
|
||||||
-------------------- */
|
|
||||||
|
|
||||||
class CGameBubicleFactory
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef enum
|
enum
|
||||||
{
|
{
|
||||||
TYPE_SMALL,
|
ITEM_MAX = 160,
|
||||||
TYPE_MEDIUM,
|
};
|
||||||
TYPE_LARGE,
|
|
||||||
TYPE_SPONGEBOBSOAKUP,
|
|
||||||
|
|
||||||
NUM_TYPES
|
struct sItemTable
|
||||||
}GAMEBUBICLETYPE;
|
{
|
||||||
|
u16 Count;
|
||||||
|
u16 Life;
|
||||||
|
u8 R,G,B;
|
||||||
|
};
|
||||||
|
|
||||||
static void spawnBubicles(int _x,int _y,int _w,int _h,GAMEBUBICLETYPE _type);
|
struct sItem
|
||||||
|
{
|
||||||
|
VECTOR Pos;
|
||||||
|
VECTOR Vel;
|
||||||
|
DVECTOR ScrPos;
|
||||||
|
u16 Life;
|
||||||
|
u16 Count;
|
||||||
|
TSPRT Sprite;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
void init();
|
||||||
static struct BubicleEmitterData s_emitters[NUM_TYPES];
|
void shutdown();
|
||||||
|
|
||||||
|
void drop(DVECTOR &Pos,int Amount,int Vel);
|
||||||
|
|
||||||
|
void checkPlayerCol(CPlayer *Thing);
|
||||||
|
void think(int frames);
|
||||||
|
void render();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void addItem(DVECTOR &Pos,int TableIdx,int Angle,int Vel);
|
||||||
|
|
||||||
|
sItem ItemList[ITEM_MAX];
|
||||||
|
sFrameHdr *FrameHdr;
|
||||||
|
|
||||||
|
static sItemTable ItemTable[];
|
||||||
|
static const int ItemTableSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Globals
|
|
||||||
------- */
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Functions
|
|
||||||
--------- */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#endif /* __GAME_GAMEBUBS_H__ */
|
|
||||||
|
|
||||||
/*===========================================================================
|
|
||||||
end */
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue