From ebda143270d2d1f4aa01c1731426b5490647e5cc Mon Sep 17 00:00:00 2001 From: Daveo Date: Wed, 30 May 2001 22:05:41 +0000 Subject: [PATCH] --- makefile.gaz | 1 + makefile.gfx | 6 +- source/enemy/nmjfish.cpp | 9 +++ source/enemy/nmjfish.h | 1 + source/enemy/npc.h | 1 + source/fx/fx.cpp | 5 ++ source/fx/fx.h | 2 + source/fx/fxjfish.cpp | 8 +-- source/fx/fxnrgbar.cpp | 116 ++++++++++++++++++--------------------- source/fx/fxnrgbar.h | 22 ++++---- 10 files changed, 90 insertions(+), 81 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index 8dcfda0d5..a4002cf9a 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -155,6 +155,7 @@ hazard_src := hazard \ fx_src := fx \ fxbaseanim \ fxbasetrail \ + fxnrgbar \ fxjfish \ fxfallingtile \ fxsteam \ diff --git a/makefile.gfx b/makefile.gfx index 1e7374506..a32f1146b 100644 --- a/makefile.gfx +++ b/makefile.gfx @@ -191,12 +191,12 @@ PICKUP_GFX := +spatula +token +pants +health100 +health50 +health25 +glint1 + PICKUP_GFX_IN := $(foreach FILE,$(PICKUP_GFX),$(PICKUP_GFX_DIR)/$(FILE).bmp) INGAMEFX_GFX_DIR := $(GRAF_DIR)/ingamefx -INGAMEFX_GFX_TRANS := +bubble_1 +bubble_2 +bubble_3 +tentacle\ - +health_full_1 +health_full_2 +health_full_3 +health_full_4 +health_full_5 \ +INGAMEFX_GFX_TRANS := +health_full_1 +health_full_2 +health_full_3 +health_full_4 +health_full_5 \ +health_empty_1 +health_empty_2 +health_empty_3 +health_empty_4 +health_empty_5 \ +watermeter +waterhilight +netblob \ +spike -INGAMEFX_GFX_TRANS_NONROT_NONCLIP := +water +aim_arrow +INGAMEFX_GFX_TRANS_NONROT_NONCLIP := +bubble_1 +bubble_2 +bubble_3 \ + +water +aim_arrow INGAMEFX_GFX_TRANS_IN := $(foreach FILE,$(INGAMEFX_GFX_TRANS),$(INGAMEFX_GFX_DIR)/$(FILE).bmp) INGAMEFX_GFX_TRANS_NONROT_NONCLIP_IN := $(foreach FILE,$(INGAMEFX_GFX_TRANS_NONROT_NONCLIP),$(INGAMEFX_GFX_DIR)/$(FILE).bmp) diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index 36545d0e8..e4f7c2eb1 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -41,6 +41,7 @@ #include "fx\fx.h" #include "fx\fxjfish.h" +#include "fx\fxnrgbar.h" @@ -50,6 +51,7 @@ void CNpcMotherJellyfishEnemy::postInit() { m_state = MOTHER_JELLYFISH_RETURN_TO_START_1; m_spawnTimer = 0; + m_meterOn=false; if ( CLevel::getIsBossRespawn() ) { @@ -371,6 +373,13 @@ void CNpcMotherJellyfishEnemy::render() if (canRender()) { + if (!m_meterOn) + { + CFXNRGBar *T=(CFXNRGBar*)CFX::Create(CFX::FX_TYPE_NRG_BAR,this); + T->SetMax(m_health); + m_meterOn=true; + } + DVECTOR &renderPos=getRenderPos(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false); diff --git a/source/enemy/nmjfish.h b/source/enemy/nmjfish.h index 27f839d58..29d295da8 100644 --- a/source/enemy/nmjfish.h +++ b/source/enemy/nmjfish.h @@ -44,6 +44,7 @@ protected: s32 m_spawnTimer; s32 m_cycleWidth; s32 m_halfCycleWidth; + bool m_meterOn; }; #endif \ No newline at end of file diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 1426a031e..9ebd687e6 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -127,6 +127,7 @@ public: bool canBeSuckedUp(); bool suckUp( DVECTOR *suckPos, int _frames ); + int getHealth() {return(m_health);} protected: // NPC data structure definitions // diff --git a/source/fx/fx.cpp b/source/fx/fx.cpp index 0494c7841..000ad5883 100644 --- a/source/fx/fx.cpp +++ b/source/fx/fx.cpp @@ -22,6 +22,7 @@ #include "FX\FXSplashLava.h" #include "FX\FXSplashOil.h" #include "FX\FXExplode.h" +#include "FX\FXNrgBar.h" /* FX Jellyfish legs @@ -131,6 +132,10 @@ CFX *NewFX; break; + case FX_TYPE_NRG_BAR: + NewFX=new ("NRG Bar") CFXNRGBar(); + break; + case FX_TYPE_JELLYFISH_LEGS: NewFX=new ("JellyFish Legs") CFXJellyFishLegs(); break; diff --git a/source/fx/fx.h b/source/fx/fx.h index 5b6e9d0cb..da93f366c 100644 --- a/source/fx/fx.h +++ b/source/fx/fx.h @@ -46,6 +46,8 @@ public: FX_TYPE_FLAMES, FX_TYPE_EXPLODE, FX_TYPE_DEBRIS, + + FX_TYPE_NRG_BAR, FX_TYPE_MAX }; enum diff --git a/source/fx/fxjfish.cpp b/source/fx/fxjfish.cpp index 1eb8a0e78..5558e3bb5 100644 --- a/source/fx/fxjfish.cpp +++ b/source/fx/fxjfish.cpp @@ -13,10 +13,10 @@ #include "FX\FXjfish.h" -int LegCount=3; -int LegWInc=32/LegCount; -int LegHInc=-4; -int LegAngleInc=7; +static const int LegCount=3; +static const int LegWInc=32/LegCount; +static const int LegHInc=-4; +static const int LegAngleInc=7; /*****************************************************************************/ /*****************************************************************************/ diff --git a/source/fx/fxnrgbar.cpp b/source/fx/fxnrgbar.cpp index 1eb8a0e78..15cfd4a65 100644 --- a/source/fx/fxnrgbar.cpp +++ b/source/fx/fxnrgbar.cpp @@ -1,6 +1,6 @@ -/**********************/ -/*** JellyFish Legs ***/ -/**********************/ +/******************/ +/*** Energy Bar ***/ +/******************/ #include "system\global.h" #include @@ -11,94 +11,84 @@ #include "level\level.h" #include "game\game.h" -#include "FX\FXjfish.h" +#include "FX\FXNRGBar.h" +#include "enemy\npc.h" + +int NRGX=32; +int NRGY=188; +int NRGW=512-64; -int LegCount=3; -int LegWInc=32/LegCount; -int LegHInc=-4; -int LegAngleInc=7; /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ -void CFXJellyFishLegs::init(DVECTOR const &_Pos) +void CFXNRGBar::init(DVECTOR const &_Pos) { CFX::init(); - Pos=_Pos; - - Ofs.vx=0; Ofs.vy=0; - Angle=getRnd(); - AngleInc=LegAngleInc+getRndRange(3); +SpriteBank *SprBank=CGameScene::getSpriteBank(); + + GfxW=SprBank->getFrameWidth(FRM__BUBBLE_1); + GfxHalfW=GfxW/2; + DrawW=NRGW; } /*****************************************************************************/ -void CFXJellyFishLegs::shutdown() +void CFXNRGBar::shutdown() { CFX::shutdown(); } -/*****************************************************************************/ -void CFXJellyFishLegs::Setup(int XOfs,int YOfs,bool XFlip) -{ - Ofs.vx=XOfs; - Ofs.vy=YOfs; - this->XFlip=XFlip; -} - /*****************************************************************************/ /*** Think *******************************************************************/ /*****************************************************************************/ -void CFXJellyFishLegs::think(int _frames) +void CFXNRGBar::think(int _frames) { - Pos=getParent()->getPos(); - CFX::think(_frames); - Angle++; Angle&=CIRCLE_TAB_MASK; - AngleInc=LegAngleInc; +CNpcEnemy *P=(CNpcEnemy*)ParentThing; +int Health=P->getHealth(); + CurrentW=((NRGW/MaxHealth)*Health); + +int Diff=DrawW-CurrentW; + + DrawW-=(Diff+1)>>1; + if (DrawW<=0 && Health==0) + { + setToShutdown(); + } + } /*****************************************************************************/ /*** Render ******************************************************************/ /*****************************************************************************/ -void CFXJellyFishLegs::render() +void CFXNRGBar::render() { - CFX::render(); - if (!canRender()) return; +// CFX::render(); -SpriteBank *SprBank=CGameScene::getSpriteBank();; -DVECTOR RenderPos=getRenderPos(); -int WOfs=0; -int H; -int ThisAngle=Angle; -int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4; - - RenderPos.vx+=Ofs.vx; - RenderPos.vy+=Ofs.vy; +SpriteBank *SprBank=CGameScene::getSpriteBank(); +POLY_FT4 *Ft4; +// Draw Start + Ft4=SprBank->printFT4(FRM__BUBBLE_1,NRGX,NRGY,0,0,0); + Ft4->x1-=GfxHalfW; + Ft4->x3-=GfxHalfW; + Ft4->u1-=GfxHalfW; + Ft4->u3-=GfxHalfW; - for (int i=0; i>5); +// Draw Start + Ft4=SprBank->printFT4(FRM__BUBBLE_1,NRGX+GfxHalfW,NRGY,0,0,0); + Ft4->x1+=DrawW-GfxW; + Ft4->x3+=DrawW-GfxW; + Ft4->u0+=GfxHalfW-1; + Ft4->u1-=GfxHalfW-1; + Ft4->u2+=GfxHalfW-1; + Ft4->u3-=GfxHalfW-1; - POLY_FT4 *Ft4=SprBank->printFT4(FRM__LEG,RenderPos.vx,RenderPos.vy,XFlip,0,OtPos*0); +// Draw End + Ft4=SprBank->printFT4(FRM__BUBBLE_1,NRGX+DrawW+GfxHalfW,NRGY,0,0,0); + Ft4->x1-=GfxHalfW; + Ft4->x3-=GfxHalfW; + Ft4->u0+=GfxHalfW; + Ft4->u2+=GfxHalfW; - if (!XFlip) - { - Ft4->x1-=WOfs; - Ft4->x3-=WOfs; - } - else - { - Ft4->x0+=WOfs; - Ft4->x2+=WOfs; - } - - - Ft4->y2=Ft4->y0+H; - Ft4->y3=Ft4->y1+H; - RenderPos.vy+=H+LegHInc; - WOfs+=LegWInc; - } } diff --git a/source/fx/fxnrgbar.h b/source/fx/fxnrgbar.h index 8899b8f26..89690499b 100644 --- a/source/fx/fxnrgbar.h +++ b/source/fx/fxnrgbar.h @@ -1,14 +1,14 @@ -/**********************/ -/*** JellyFish Legs ***/ -/**********************/ +/******************/ +/*** Energy Bar ***/ +/******************/ -#ifndef __FX_FX_JELLYFISH_LEGS_HEADER__ -#define __FX_FX_JELLYFISH_LEGS_HEADER__ +#ifndef __FX_FX_NRG_BAR_HEADER__ +#define __FX_FX_NRG_BAR_HEADER__ #include "fx/fx.h" /*****************************************************************************/ -class CFXJellyFishLegs : public CFX +class CFXNRGBar : public CFX { public: @@ -17,14 +17,14 @@ virtual void shutdown(); virtual void think(int _frames); virtual void render(); - void Setup(int XOfs,int YOfs,bool XFlip); + void SetMax(int Max) {MaxHealth=Max-1;} + bool alwaysThink() {return(true);} protected: - DVECTOR Ofs; - - int Angle,AngleInc; - bool XFlip; + int GfxW,GfxHalfW; + int MaxHealth; + int CurrentW,DrawW; }; #endif