diff --git a/Graphics/pickups/+glint1.bmp b/Graphics/pickups/+glint1.bmp new file mode 100644 index 000000000..bf1cd410d Binary files /dev/null and b/Graphics/pickups/+glint1.bmp differ diff --git a/Graphics/pickups/+glint2.bmp b/Graphics/pickups/+glint2.bmp new file mode 100644 index 000000000..e7f5220d6 Binary files /dev/null and b/Graphics/pickups/+glint2.bmp differ diff --git a/Graphics/pickups/+glint3.bmp b/Graphics/pickups/+glint3.bmp new file mode 100644 index 000000000..d65bf37c3 Binary files /dev/null and b/Graphics/pickups/+glint3.bmp differ diff --git a/Graphics/pickups/+glint4.bmp b/Graphics/pickups/+glint4.bmp new file mode 100644 index 000000000..cb67707ab Binary files /dev/null and b/Graphics/pickups/+glint4.bmp differ diff --git a/Graphics/pickups/+health100.bmp b/Graphics/pickups/+health100.bmp new file mode 100644 index 000000000..a51f706e2 Binary files /dev/null and b/Graphics/pickups/+health100.bmp differ diff --git a/Graphics/pickups/+health25.bmp b/Graphics/pickups/+health25.bmp new file mode 100644 index 000000000..f12fbeed1 Binary files /dev/null and b/Graphics/pickups/+health25.bmp differ diff --git a/Graphics/pickups/+health50.bmp b/Graphics/pickups/+health50.bmp new file mode 100644 index 000000000..e0ddf1667 Binary files /dev/null and b/Graphics/pickups/+health50.bmp differ diff --git a/Graphics/pickups/+pants.bmp b/Graphics/pickups/+pants.bmp new file mode 100644 index 000000000..880d6034b Binary files /dev/null and b/Graphics/pickups/+pants.bmp differ diff --git a/Graphics/pickups/+spatula.bmp b/Graphics/pickups/+spatula.bmp new file mode 100644 index 000000000..590138a5c Binary files /dev/null and b/Graphics/pickups/+spatula.bmp differ diff --git a/source/pickups/phealth.cpp b/source/pickups/phealth.cpp new file mode 100644 index 000000000..e6e074714 --- /dev/null +++ b/source/pickups/phealth.cpp @@ -0,0 +1,178 @@ +/*========================================================================= + + phealth.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __GFX_SPRBANK_H__ +#include "gfx\sprbank.h" // Damnit.. include order! :( (pkg) +#endif + +#include "pickups\phealth.h" + +#ifndef __MATHTABLE_HEADER__ +#include "utils\mathtab.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __SPR_INGAMEFX_H__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBaseHealthPickup::init() +{ + CBasePickup::init(); + m_sin=0; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBaseHealthPickup::shutdown() +{ + CBasePickup::shutdown(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int health_rotatespeed=200; +int health_rotatescale=200; +void CBaseHealthPickup::think(int _frames) +{ + CBasePickup::think(_frames); + m_sin=(m_sin+(_frames*health_rotatespeed))&4095; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBaseHealthPickup::render() +{ + DVECTOR ofs; + SpriteBank *sprites; + sFrameHdr *fh; + int x,y; + int angle; + + ofs=getRenderOffset(); + sprites=getSpriteBank(); + fh=sprites->getFrameHeader(getFrameNumber()); + x=Pos.vx-ofs.vx; + y=Pos.vy-ofs.vy; + angle=((msin(m_sin)*health_rotatescale)>>12)&4095; + sprites->printRotatedScaledSprite(fh,x,y,4096,4096,angle,0); + + CBasePickup::render(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBaseHealthPickup::collect(class CPlayer *_player) +{ + CBasePickup::collect(_player); +} + + + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int C100HealthPickup::getHealthPoints() +{ + return 100; +} +int C100HealthPickup::getFrameNumber() +{ + return FRM__HEALTH100; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int C50HealthPickup::getHealthPoints() +{ + return 50; +} +int C50HealthPickup::getFrameNumber() +{ + return FRM__HEALTH50; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int C25HealthPickup::getHealthPoints() +{ + return 25; +} +int C25HealthPickup::getFrameNumber() +{ + return FRM__HEALTH25; +} + +/*=========================================================================== +end */ diff --git a/source/pickups/phealth.h b/source/pickups/phealth.h new file mode 100644 index 000000000..21c2a38e7 --- /dev/null +++ b/source/pickups/phealth.h @@ -0,0 +1,92 @@ +/*========================================================================= + + phealth.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PICKUPS_PHEALTH_H__ +#define __PICKUPS_PHEALTH_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __PICKUPS_PICKUP_H__ +#include "pickups/pickup.h" +#endif + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CBaseHealthPickup : public CBasePickup +{ +public: + virtual void init(); + virtual void shutdown(); + virtual void think(int _frames); + virtual void render(); + + virtual void collect(class CPlayer *_player); + +protected: + virtual int getHealthPoints()=0; + virtual int getFrameNumber()=0; + +private: + int m_sin; + +}; + + +class C100HealthPickup : public CBaseHealthPickup +{ +protected: + virtual int getHealthPoints(); + virtual int getFrameNumber(); +}; + +class C50HealthPickup : public CBaseHealthPickup +{ +protected: + virtual int getHealthPoints(); + virtual int getFrameNumber(); +}; + +class C25HealthPickup : public CBaseHealthPickup +{ +protected: + virtual int getHealthPoints(); + virtual int getFrameNumber(); +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PICKUPS_PHEALTH_H__ */ + +/*=========================================================================== + end */ diff --git a/source/pickups/pickup.cpp b/source/pickups/pickup.cpp new file mode 100644 index 000000000..3a2f63fc1 --- /dev/null +++ b/source/pickups/pickup.cpp @@ -0,0 +1,207 @@ +/*========================================================================= + + pickup.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __GFX_SPRBANK_H__ +#include "gfx\sprbank.h" // Damnit.. include order! :( (pkg) +#endif + +#include "pickups\pickup.h" + +#ifndef __LEVEL_LEVEL_H__ +#include "level\level.h" +#endif + +// For the factory.. + +#ifndef __PICKUPS_PHEALTH_H__ +#include "pickups\phealth.h" +#endif + +#ifndef __PICKUPS_PLIFE_H__ +#include "pickups\plife.h" +#endif + +#ifndef __PICKUPS_PSPATULA_H__ +#include "pickups\pspatula.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __SPR_INGAMEFX_H__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBasePickup::init() +{ + CThing::init(); + + m_spriteBank=new ("pickup sprite") SpriteBank(); + m_spriteBank->load(INGAMEFX_INGAMEFX_SPR); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBasePickup::shutdown() +{ + m_spriteBank->dump(); delete m_spriteBank; + CThing::shutdown(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBasePickup::think(int _frames) +{ + CThing::think(_frames); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBasePickup::render() +{ + /* + DVECTOR ofs; + int x,y; + + ofs=getRenderOffset(); + x=Pos.vx-ofs.vx; + y=Pos.vy-ofs.vy; + DrawLine(x-15,y-15,x+15,y+15,255,255,255,0); + DrawLine(x+15,y-15,x-15,y+15,255,255,255,0); + */ +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBasePickup::setPos(const DVECTOR *_pos) +{ + Pos=*_pos; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CBasePickup::collect(class CPlayer *_player) +{ + shutdown(); + delete this; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +DVECTOR CBasePickup::getRenderOffset() +{ + return CLevel::getCameraPos(); +} + + + + +/*---------------------------------------------------------------------- + Function: + Purpose: This is basicially a factory method for making pickups :) + Params: + Returns: + ---------------------------------------------------------------------- */ +CBasePickup *createPickup(const PICKUP_TYPE _type,const DVECTOR *_pos) +{ + CBasePickup *pickup; + + switch(_type) + { + case PICKUP__100_PERCENT_LIFE: + pickup=new ("100HealthPickup") C100HealthPickup(); + break; + case PICKUP__50_PERCENT_LIFE: + pickup=new ("15HealthPickup") C50HealthPickup(); + break; + case PICKUP__25_PERCENT_LIFE: + pickup=new ("25HealthPickup") C25HealthPickup(); + break; + + case PICKUP__LIFE: + pickup=new ("LifePickup") CLifePickup(); + break; + + case PICKUP__SPATULA: + pickup=new ("SpatulaPickup") CSpatulaPickup(); + break; + + default: + ASSERT(!"UNKNOWN PICKUP TYPE"); + pickup=new ("Pickup") CBasePickup(); + break; + } + + pickup->init(); + pickup->setPos(_pos); + + return pickup; +} + +/*=========================================================================== +end */ diff --git a/source/pickups/pickup.h b/source/pickups/pickup.h new file mode 100644 index 000000000..681bdc76a --- /dev/null +++ b/source/pickups/pickup.h @@ -0,0 +1,85 @@ +/*========================================================================= + + pickup.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PICKUPS_PICKUP_H__ +#define __PICKUPS_PICKUP_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __GAME_THING_H__ +#include "game/thing.h" +#endif + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +typedef enum +{ + PICKUP__100_PERCENT_LIFE, + PICKUP__50_PERCENT_LIFE, + PICKUP__25_PERCENT_LIFE, + PICKUP__LIFE, + PICKUP__SPATULA, +} +PICKUP_TYPE; + + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CBasePickup : public CThing +{ +public: + virtual void init(); + virtual void shutdown(); + virtual void think(int _frames); + virtual void render(); + + void setPos(const struct DVECTOR *_pos); + virtual void collect(class CPlayer *_player); + +protected: + class SpriteBank *getSpriteBank() {return m_spriteBank;} + DVECTOR getRenderOffset(); + +private: + class SpriteBank *m_spriteBank; + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +CBasePickup *createPickup(const PICKUP_TYPE _type,const DVECTOR *_pos); + + +/*---------------------------------------------------------------------- */ + +#endif /* __PICKUPS_PICKUP_H__ */ + +/*=========================================================================== + end */ diff --git a/source/pickups/plife.cpp b/source/pickups/plife.cpp new file mode 100644 index 000000000..fa9262590 --- /dev/null +++ b/source/pickups/plife.cpp @@ -0,0 +1,130 @@ +/*========================================================================= + + plife.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __GFX_SPRBANK_H__ +#include "gfx\sprbank.h" // Damnit.. include order! :( (pkg) +#endif + +#include "pickups\plife.h" + +#ifndef __MATHTABLE_HEADER__ +#include "utils\mathtab.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __SPR_INGAMEFX_H__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CLifePickup::init() +{ + CBasePickup::init(); + m_sin=0; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CLifePickup::shutdown() +{ + CBasePickup::shutdown(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int life_pulsespeed=205; +int life_pulsescale=75; +void CLifePickup::think(int _frames) +{ + CBasePickup::think(_frames); + m_sin=(m_sin+(_frames*life_pulsespeed))&4095; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CLifePickup::render() +{ + DVECTOR ofs; + SpriteBank *sprites; + sFrameHdr *fh; + int x,y; + int size; + + ofs=getRenderOffset(); + sprites=getSpriteBank(); + fh=sprites->getFrameHeader(FRM__PANTS); + x=Pos.vx-ofs.vx-(fh->W/2); + y=Pos.vy-ofs.vy-(fh->H/2); + size=256+((msin(m_sin)*life_pulsescale)>>12); + sprites->printFT4Scaled(fh,x,y,0,0,0,size); + + CBasePickup::render(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CLifePickup::collect(class CPlayer *_player) +{ + CBasePickup::collect(_player); +} + +/*=========================================================================== +end */ diff --git a/source/pickups/plife.h b/source/pickups/plife.h new file mode 100644 index 000000000..66660f04a --- /dev/null +++ b/source/pickups/plife.h @@ -0,0 +1,66 @@ +/*========================================================================= + + plife.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PICKUPS_PLIFE_H__ +#define __PICKUPS_PLIFE_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __PICKUPS_PICKUP_H__ +#include "pickups/pickup.h" +#endif + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CLifePickup : public CBasePickup +{ +public: + virtual void init(); + virtual void shutdown(); + virtual void think(int _frames); + virtual void render(); + + virtual void collect(class CPlayer *_player); + +private: + int m_sin; + +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PICKUPS_PLIFE_H__ */ + +/*=========================================================================== + end */ diff --git a/source/pickups/pspatula.cpp b/source/pickups/pspatula.cpp new file mode 100644 index 000000000..243958304 --- /dev/null +++ b/source/pickups/pspatula.cpp @@ -0,0 +1,141 @@ +/*========================================================================= + + pspatula.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __GFX_SPRBANK_H__ +#include "gfx\sprbank.h" // Damnit.. include order! :( (pkg) +#endif + +#include "pickups\pspatula.h" + +#ifndef __MATHTABLE_HEADER__ +#include "utils\mathtab.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +#ifndef __SPR_INGAMEFX_H__ +#include +#endif + + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CSpatulaPickup::init() +{ + CBasePickup::init(); + m_glint=0; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CSpatulaPickup::shutdown() +{ + CBasePickup::shutdown(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int spat_glintspeed=3; +int spat_maxglint=600; +DVECTOR spat_gxy1={-5,30}; +DVECTOR spat_gxy2={10,-5}; +int spat_glintFrames[]={FRM__GLINT1,FRM__GLINT2,FRM__GLINT3,FRM__GLINT4}; +void CSpatulaPickup::think(int _frames) +{ + CBasePickup::think(_frames); + m_glint+=_frames*spat_glintspeed; + if(m_glint>spat_maxglint)m_glint-=spat_maxglint; +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CSpatulaPickup::render() +{ + DVECTOR ofs; + SpriteBank *sprites; + sFrameHdr *fh; + int x,y; + int angle; + + ofs=getRenderOffset(); + sprites=getSpriteBank(); + fh=sprites->getFrameHeader(FRM__SPATULA); + x=Pos.vx-ofs.vx-(fh->W/2); + y=Pos.vy-ofs.vy-(fh->H/2); + sprites->printFT4(fh,x,y,0,0,1); + + if(m_glint<=255) + { + fh=sprites->getFrameHeader(spat_glintFrames[m_glint&0x03]); + x=x+(((spat_gxy2.vx-spat_gxy1.vx)*m_glint)>>8)+spat_gxy1.vx; + y=y+(((spat_gxy2.vy-spat_gxy1.vy)*m_glint)>>8)+spat_gxy1.vy; + sprites->printFT4(fh,x,y,0,0,0); + } + + CBasePickup::render(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CSpatulaPickup::collect(class CPlayer *_player) +{ + CBasePickup::collect(_player); +} + +/*=========================================================================== +end */ diff --git a/source/pickups/pspatula.h b/source/pickups/pspatula.h new file mode 100644 index 000000000..c3da93547 --- /dev/null +++ b/source/pickups/pspatula.h @@ -0,0 +1,65 @@ +/*========================================================================= + + pspatula.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PICKUPS_PSPATULA_H__ +#define __PICKUPS_PSPATULA_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __PICKUPS_PICKUP_H__ +#include "pickups/pickup.h" +#endif + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CSpatulaPickup : public CBasePickup +{ +public: + virtual void init(); + virtual void shutdown(); + virtual void think(int _frames); + virtual void render(); + + virtual void collect(class CPlayer *_player); + +private: + int m_glint; +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __PICKUPS_PSPATULA_H__ */ + +/*=========================================================================== + end */