2001-05-31 00:05:41 +02:00
|
|
|
/******************/
|
|
|
|
/*** Energy Bar ***/
|
|
|
|
/******************/
|
2001-05-30 22:58:48 +02:00
|
|
|
|
|
|
|
#include "system\global.h"
|
2001-06-21 21:19:15 +02:00
|
|
|
#include "system\vid.h"
|
2001-05-30 22:58:48 +02:00
|
|
|
#include <DStructs.h>
|
|
|
|
#include "utils\utils.h"
|
|
|
|
#include "gfx\prim.h"
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#include <sprites.h>
|
|
|
|
#include "level\level.h"
|
|
|
|
#include "game\game.h"
|
|
|
|
|
2001-05-31 00:05:41 +02:00
|
|
|
#include "FX\FXNRGBar.h"
|
|
|
|
#include "enemy\npc.h"
|
|
|
|
|
2001-07-16 18:09:16 +02:00
|
|
|
#include "FX\FXBubble.h"
|
2001-05-30 22:58:48 +02:00
|
|
|
|
2001-08-03 21:23:11 +02:00
|
|
|
const int NRGX=96;
|
2001-07-16 18:09:16 +02:00
|
|
|
const int NRGY=188;
|
2001-08-03 21:23:11 +02:00
|
|
|
const int NRGXInc=32;
|
|
|
|
const int NRGMaxHealth=10;
|
|
|
|
const int NRGW=INGAME_SCREENW-(NRGMaxHealth*NRGXInc);
|
|
|
|
const int NRGBaseRGB=240;
|
|
|
|
const int NRGRGBInc=NRGBaseRGB/NRGMaxHealth;
|
2001-05-30 22:58:48 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-05-31 00:05:41 +02:00
|
|
|
void CFXNRGBar::init(DVECTOR const &_Pos)
|
2001-05-30 22:58:48 +02:00
|
|
|
{
|
|
|
|
CFX::init();
|
2001-05-31 00:05:41 +02:00
|
|
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
2001-05-30 22:58:48 +02:00
|
|
|
|
2001-07-16 18:09:16 +02:00
|
|
|
CurrentHealth=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CFXNRGBar::SetMax(int Max)
|
|
|
|
{
|
|
|
|
MaxHealth=Max;
|
|
|
|
CurrentHealth=Max;
|
2001-05-30 22:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*** Think *******************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-05-31 00:05:41 +02:00
|
|
|
void CFXNRGBar::think(int _frames)
|
2001-05-30 22:58:48 +02:00
|
|
|
{
|
2001-05-31 00:05:41 +02:00
|
|
|
CNpcEnemy *P=(CNpcEnemy*)ParentThing;
|
2001-07-16 18:09:16 +02:00
|
|
|
int Health=P->getHealth();
|
2001-06-27 20:28:21 +02:00
|
|
|
|
2001-07-16 18:09:16 +02:00
|
|
|
if (CurrentHealth<Health) CurrentHealth=Health;
|
|
|
|
if (CurrentHealth>Health)
|
2001-05-31 00:05:41 +02:00
|
|
|
{
|
2001-07-16 18:09:16 +02:00
|
|
|
CurrentHealth--;
|
|
|
|
for (int b=0; b<4; b++)
|
|
|
|
{
|
|
|
|
DVECTOR Pos;
|
2001-08-03 21:23:11 +02:00
|
|
|
Pos.vx=NRGX+(CurrentHealth*NRGXInc);
|
2001-07-16 18:09:16 +02:00
|
|
|
Pos.vy=NRGY;
|
|
|
|
|
|
|
|
CFXBubble *FX=(CFXBubble*)CFX::Create(CFX::FX_TYPE_BUBBLE_WATER,Pos);
|
|
|
|
FX->Flags|=FX_FLAG_SCREEN_FX;
|
|
|
|
FX->SetOtPos(0);
|
|
|
|
}
|
2001-05-31 00:05:41 +02:00
|
|
|
}
|
|
|
|
|
2001-05-30 22:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*** Render ******************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-08-03 21:23:11 +02:00
|
|
|
int asd=0;
|
2001-05-31 00:05:41 +02:00
|
|
|
void CFXNRGBar::render()
|
2001-05-30 22:58:48 +02:00
|
|
|
{
|
2001-05-31 00:05:41 +02:00
|
|
|
// CFX::render();
|
|
|
|
|
|
|
|
SpriteBank *SprBank=CGameScene::getSpriteBank();
|
|
|
|
POLY_FT4 *Ft4;
|
2001-08-03 21:23:11 +02:00
|
|
|
int RGB=NRGBaseRGB;
|
|
|
|
int x=NRGX;
|
|
|
|
|
2001-07-16 18:09:16 +02:00
|
|
|
for (int i=0; i<CurrentHealth; i++)
|
|
|
|
{
|
2001-08-03 21:23:11 +02:00
|
|
|
Ft4=SprBank->printFT4(FRM__HEALTHBUBBLE,x,NRGY,0,0,0);
|
|
|
|
setRGB0(Ft4,RGB,NRGBaseRGB-RGB,0);
|
|
|
|
setSemiTrans(Ft4,1);
|
|
|
|
Ft4->tpage|=asd<<5;
|
|
|
|
|
|
|
|
RGB-=NRGRGBInc;
|
|
|
|
x+=NRGXInc;
|
2001-07-16 18:09:16 +02:00
|
|
|
}
|
2001-05-31 00:05:41 +02:00
|
|
|
|
2001-05-30 22:58:48 +02:00
|
|
|
}
|