From b3848be20286e7e9385e8c7b01bacd28fccf6d90 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 20 Feb 2001 22:53:35 +0000 Subject: [PATCH] --- Graphics/pickups/+glint1.bmp | Bin 0 -> 198 bytes Graphics/pickups/+glint2.bmp | Bin 0 -> 198 bytes Graphics/pickups/+glint3.bmp | Bin 0 -> 154 bytes Graphics/pickups/+glint4.bmp | Bin 0 -> 154 bytes Graphics/pickups/+health100.bmp | Bin 0 -> 294 bytes Graphics/pickups/+health25.bmp | Bin 0 -> 250 bytes Graphics/pickups/+health50.bmp | Bin 0 -> 250 bytes Graphics/pickups/+pants.bmp | Bin 0 -> 582 bytes Graphics/pickups/+spatula.bmp | Bin 0 -> 646 bytes source/pickups/phealth.cpp | 178 +++++++++++++++++++++++++++ source/pickups/phealth.h | 92 ++++++++++++++ source/pickups/pickup.cpp | 207 ++++++++++++++++++++++++++++++++ source/pickups/pickup.h | 85 +++++++++++++ source/pickups/plife.cpp | 130 ++++++++++++++++++++ source/pickups/plife.h | 66 ++++++++++ source/pickups/pspatula.cpp | 141 ++++++++++++++++++++++ source/pickups/pspatula.h | 65 ++++++++++ 17 files changed, 964 insertions(+) create mode 100644 Graphics/pickups/+glint1.bmp create mode 100644 Graphics/pickups/+glint2.bmp create mode 100644 Graphics/pickups/+glint3.bmp create mode 100644 Graphics/pickups/+glint4.bmp create mode 100644 Graphics/pickups/+health100.bmp create mode 100644 Graphics/pickups/+health25.bmp create mode 100644 Graphics/pickups/+health50.bmp create mode 100644 Graphics/pickups/+pants.bmp create mode 100644 Graphics/pickups/+spatula.bmp create mode 100644 source/pickups/phealth.cpp create mode 100644 source/pickups/phealth.h create mode 100644 source/pickups/pickup.cpp create mode 100644 source/pickups/pickup.h create mode 100644 source/pickups/plife.cpp create mode 100644 source/pickups/plife.h create mode 100644 source/pickups/pspatula.cpp create mode 100644 source/pickups/pspatula.h diff --git a/Graphics/pickups/+glint1.bmp b/Graphics/pickups/+glint1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..bf1cd410da5fa89a14d4815b2b8cc0cf2aee2322 GIT binary patch literal 198 zcmZ?rJ;ne5Wk5;;h&h3n3y2vRSb!u0LjVv9aYL{GkPX8BfiQRaLWc5<`xtumo?w`F z{2arw%Xb*|Uc19^=;;fFt1sU(-23>2;raW|3~#>wWcdF5H^ck?{~5jmv145y0|WmD hpeaDWzaE9=|9}2JNZ{9+H>*G@V0?6Sa6SXX8~{c+IE(-Q literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+glint2.bmp b/Graphics/pickups/+glint2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e7f5220d6dffcd6726b347fc31edea62da2d48b7 GIT binary patch literal 198 zcmZ?rJ;ne5Wk5;;h&h3n3y2vRSb!u0LjVv9aYL{GkPX8BfiQRaLWc5<`xtumo?w`F z{2arw%Xb*|Uc19^=;;fFt1sU(-23>2;raW|3~#>wWcdF5H^ck?{~5jmv145y1H%WP sAwa;to`E0C`1Su6Scw13da(GP_h9a?_22;raW|3~#>wWcdF5H^ck?{~5jmv145y13wV{ f`ta)m|N37a82+4RVEA{Qf&V>-4;J~r53~aSt}r?% literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+glint4.bmp b/Graphics/pickups/+glint4.bmp new file mode 100644 index 0000000000000000000000000000000000000000..cb67707ab00710552193abbd736d811c50d6df5d GIT binary patch literal 154 zcmZ?roy7nFWk5;;h&h0m6NniZSb!u0g9;D}aYL{GkPX8BfiQRaLWc5<`xtumo?w`F z{2arw%Xb*|Uc19^=;;fFt1sU(-23>2;raW|3~#>wWcdF5H^ck?{~5jmv145y&;))4 k{tv%C{91pWf&b5&4-9|)uV?u6;RFAApbQW*d|+Sz0H8WJ@Bjb+ literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+health100.bmp b/Graphics/pickups/+health100.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a51f706e22011e7adb5ec407486a5748227ddf53 GIT binary patch literal 294 zcmbV`u?>JQ3we#Wj|C(`2|HVzyW4M(=bJ>Dy)Y_@MhH~C#g3}?Dfgr^!`ulv_j36$GYa8 NeUHx4XCWr%mKV)$HRb>S literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+health25.bmp b/Graphics/pickups/+health25.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f12fbeed1541856a632226e6da155a14cc6ef8de GIT binary patch literal 250 zcmbV_!3}^g3A0L9m4$Q%yb(nyaSdLG*IGun>c2e6(j`LN$i?V|a%%Ew4r5mgW ziG@C)E?&P;tQpM=^n+isoTh9p2e<2MaR-C=p#h5`VX5A BH1Gfb literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+health50.bmp b/Graphics/pickups/+health50.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e0ddf16676790a57ed3932342bdecbbb847a9401 GIT binary patch literal 250 zcmbV_F%E?=3`0}tZ!8TGci10-)W AfB*mh literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+pants.bmp b/Graphics/pickups/+pants.bmp new file mode 100644 index 0000000000000000000000000000000000000000..880d6034b576d1b0e825033c4ad3cb9e451ca73a GIT binary patch literal 582 zcmX|-L14dA#l^=kGqVlL%WbGsw&AUO59{k+U~B6ubUGc_-~SA| z-5+pp@Qu%Zpx-Cx6T#Hfnr^GLw=th@505%_R4funzxaQV4Q#itaB;*FO1Uoj;Zeel zNik29X?B=kB*J7D#R~n_+^%Os88eE45{LYS5h3ci*3U*ID9{st@$i)#7D~UcG>sM) z?A(=N(=7*REs3jK(DI71A?mcCJbXyEz=;dV;wGN!TRpfFN6k0M_E45+GHIh=t|`|; z^l2h#OKeKH(({-xIsPmrBqx~DOajv%mSVP)O=+Id_~`5>n)8cI?9vVW{_=Eo+Xt@m=rB5PjJE0Yrdr}q!MHW=rh+=0bbK#{<%q+2Ku75 z#sk^i2+~fLC|bk^@0bC)PAK2HPNb}V6E*6W)48f+>H!U9R3oWe^)?T1q`j7t%8X#J I8z1k(UuSvwkN^Mx literal 0 HcmV?d00001 diff --git a/Graphics/pickups/+spatula.bmp b/Graphics/pickups/+spatula.bmp new file mode 100644 index 0000000000000000000000000000000000000000..590138a5c31c4c7ff1ed68412ccbbe5c0dccc751 GIT binary patch literal 646 zcmZ?rZDV2pgEAng0mRZktO&%63@kvBfk6N$FT@SO0w6vR{|Ca{=?fXkH|}HT*?WRv z-tlt`%P!wx*n8~`!=a}y7_Pp2&v5VK7l!BWKQp}f{*&SR_umZf|Nm$B4#bXieGDA` z8-S)D!2Hj@5gZ^Z-`xa-KR4W&|NqU_z(qJLch3m1M|g|l=bqhL-Rvj86tMl=wKBXp-Uh+nU0vcC_T>ar zfbGZbh;6|w@y*bXiFy*%91`SS;e0zdQ3282B$JK-BPfcgBO<{9 literal 0 HcmV?d00001 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 */