BIN
Graphics/pickups/+glint1.bmp
Normal file
After Width: | Height: | Size: 198 B |
BIN
Graphics/pickups/+glint2.bmp
Normal file
After Width: | Height: | Size: 198 B |
BIN
Graphics/pickups/+glint3.bmp
Normal file
After Width: | Height: | Size: 154 B |
BIN
Graphics/pickups/+glint4.bmp
Normal file
After Width: | Height: | Size: 154 B |
BIN
Graphics/pickups/+health100.bmp
Normal file
After Width: | Height: | Size: 294 B |
BIN
Graphics/pickups/+health25.bmp
Normal file
After Width: | Height: | Size: 250 B |
BIN
Graphics/pickups/+health50.bmp
Normal file
After Width: | Height: | Size: 250 B |
BIN
Graphics/pickups/+pants.bmp
Normal file
After Width: | Height: | Size: 582 B |
BIN
Graphics/pickups/+spatula.bmp
Normal file
After Width: | Height: | Size: 646 B |
178
source/pickups/phealth.cpp
Normal file
|
@ -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 <ingamefx.h>
|
||||||
|
#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 */
|
92
source/pickups/phealth.h
Normal file
|
@ -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 */
|
207
source/pickups/pickup.cpp
Normal file
|
@ -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 <ingamefx.h>
|
||||||
|
#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 */
|
85
source/pickups/pickup.h
Normal file
|
@ -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 */
|
130
source/pickups/plife.cpp
Normal file
|
@ -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 <ingamefx.h>
|
||||||
|
#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 */
|
66
source/pickups/plife.h
Normal file
|
@ -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 */
|
141
source/pickups/pspatula.cpp
Normal file
|
@ -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 <ingamefx.h>
|
||||||
|
#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 */
|
65
source/pickups/pspatula.h
Normal file
|
@ -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 */
|