This commit is contained in:
parent
a59bdb7bb3
commit
18e1f665af
18 changed files with 245 additions and 271 deletions
|
@ -1,3 +1,7 @@
|
|||
dsasdasda
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
phealth.cpp
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
dssadsadsadsda
|
||||
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
|
||||
phealth.h
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
// For the factory..
|
||||
|
||||
#ifndef __PICKUPS_PHEALTH_H__
|
||||
#include "pickups\phealth.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PICKUPS_PLIFE_H__
|
||||
#include "pickups\plife.h"
|
||||
#endif
|
||||
|
@ -414,6 +410,58 @@ void CBaseWeaponSimplePickup::renderPickup(DVECTOR *_pos)
|
|||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBaseBouncingPickup::init()
|
||||
{
|
||||
CBasePickup::init();
|
||||
m_timeTillVanish=TIME_TILL_VANISH;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBaseBouncingPickup::render()
|
||||
{
|
||||
if(m_timeTillVanish>FRAMES_TO_FLASH||m_timeTillVanish&3)
|
||||
{
|
||||
DVECTOR ofs,pos;
|
||||
int visibilityRadius;
|
||||
|
||||
CPickupThing::render();
|
||||
|
||||
ofs=CLevel::getCameraPos();
|
||||
pos.vx=Pos.vx-ofs.vx;
|
||||
pos.vy=Pos.vy-ofs.vy;
|
||||
visibilityRadius=getVisibilityRadius();
|
||||
if(pos.vx>0-visibilityRadius&&pos.vx<512+visibilityRadius&&
|
||||
pos.vy>0-visibilityRadius&&pos.vy<256+visibilityRadius)
|
||||
{
|
||||
renderPickup(&pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBaseBouncingPickup::collidedWith(CThing *_thisThing)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose: This is basically a factory method for making pickups :)
|
||||
|
@ -430,13 +478,10 @@ CBasePickup *createPickup(const PICKUP_TYPE _type,const DVECTOR *_pos)
|
|||
switch(_type)
|
||||
{
|
||||
case PICKUP__BIG_HEALTH:
|
||||
pickup=new ("LargeHealthPickup") CLargeHealthPickup();
|
||||
break;
|
||||
case PICKUP__MEDIUM_HEALTH:
|
||||
pickup=new ("MediumHealthPickup") CMediumHealthPickup();
|
||||
break;
|
||||
case PICKUP__SMALL_HEALTH:
|
||||
pickup=new ("SmallHealthPickup") CSmallHealthPickup();
|
||||
ASSERT(!"HEALTH PICKUPS ARE NO LONGER IN THE GAME");
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case PICKUP__LIFE:
|
||||
|
@ -488,7 +533,7 @@ CBasePickup *createPickup(const PICKUP_TYPE _type,const DVECTOR *_pos)
|
|||
break;
|
||||
|
||||
case PICKUP__BALLOON_AND_SPATULA:
|
||||
pickup=new ("BalloonAndSpatulaPickup") CBalloonAndSpatulaPickup();
|
||||
ASSERT(!"BALLOON AND SPATULA PICKUPS ARE NO LONGER IN THE GAME");
|
||||
break;
|
||||
|
||||
case PICKUP__JELLY_LAUNCHER:
|
||||
|
@ -499,6 +544,10 @@ CBasePickup *createPickup(const PICKUP_TYPE _type,const DVECTOR *_pos)
|
|||
pickup=new ("KelpTokenPickup") CKelpTokenPickup();
|
||||
break;
|
||||
|
||||
case PICKUP__BOUNCING_SPATULA:
|
||||
pickup=new ("BouncingSpatulaPickup") CBouncingSpatulaPickup();
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(!"UNKNOWN PICKUP TYPE");
|
||||
return NULL;
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
|
||||
typedef enum
|
||||
{
|
||||
PICKUP__BIG_HEALTH,
|
||||
PICKUP__MEDIUM_HEALTH,
|
||||
PICKUP__SMALL_HEALTH,
|
||||
PICKUP__BIG_HEALTH, // No longer in the game.. Yay(!)
|
||||
PICKUP__MEDIUM_HEALTH, // No longer in the game.. Yay(!)
|
||||
PICKUP__SMALL_HEALTH, // No longer in the game.. Yay(!)
|
||||
PICKUP__LIFE,
|
||||
PICKUP__SPATULA,
|
||||
PICKUP__JELLY_LAUNCHER_AMMO,
|
||||
|
@ -54,6 +54,9 @@ typedef enum
|
|||
PICKUP__BALLOON_AND_SPATULA,
|
||||
PICKUP__JELLY_LAUNCHER,
|
||||
PICKUP__KELP_TOKEN,
|
||||
|
||||
PICKUP__BOUNCING_SPATULA,
|
||||
|
||||
PICKUP__MAX
|
||||
}
|
||||
PICKUP_TYPE;
|
||||
|
@ -149,6 +152,28 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
class CBaseBouncingPickup : public CBasePickup
|
||||
{
|
||||
public:
|
||||
virtual void init();
|
||||
virtual void render();
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
TIME_TILL_VANISH=5*55,
|
||||
FRAMES_TO_FLASH=2*55,
|
||||
};
|
||||
|
||||
virtual void renderPickup(DVECTOR *_pos)=0;
|
||||
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
|
||||
int m_timeTillVanish;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Globals
|
||||
------- */
|
||||
|
|
|
@ -37,7 +37,10 @@
|
|||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#include "game/game.h"
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -109,8 +112,8 @@ DVECTOR CSpatulaPickup::getSizeForPlacement()
|
|||
---------------------------------------------------------------------- */
|
||||
void CSpatulaPickup::collect(class CPlayer *_player)
|
||||
{
|
||||
_player->addSpatula();
|
||||
CBasePickup::collect(_player);
|
||||
CGameSlotManager::getSlotData()->collectSpatula(GameScene.getChapterNumber()-1,GameScene.getLevelNumber()-1,m_spatulaNumber);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
@ -162,31 +165,21 @@ void CSpatulaPickup::renderPickup(DVECTOR *_pos)
|
|||
|
||||
|
||||
|
||||
extern int balloon_height;
|
||||
extern int balloon_r1;
|
||||
extern int balloon_g1;
|
||||
extern int balloon_b1;
|
||||
extern int balloon_r2;
|
||||
extern int balloon_g2;
|
||||
extern int balloon_b2;
|
||||
extern int balloon_speed;
|
||||
extern int balloon_scale1;
|
||||
extern int balloon_scale2;
|
||||
extern int balloon_phase;
|
||||
extern int balloon_vissize;
|
||||
extern int balloon_stringx;
|
||||
int bspat_stringendxoff=8;
|
||||
int bspat_stringendyoff=-13;
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBalloonAndSpatulaPickup::init()
|
||||
DVECTOR CBouncingSpatulaPickup::getSizeForPlacement()
|
||||
{
|
||||
CSpatulaPickup::init();
|
||||
m_sin=0;
|
||||
DVECTOR size;
|
||||
sFrameHdr *fh;
|
||||
|
||||
fh=CGameScene::getSpriteBank()->getFrameHeader(FRM__SPATULA);
|
||||
size.vx=fh->W;
|
||||
size.vy=fh->H;
|
||||
return size;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
@ -195,45 +188,32 @@ void CBalloonAndSpatulaPickup::init()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBalloonAndSpatulaPickup::thinkPickup(int _frames)
|
||||
{
|
||||
CSpatulaPickup::thinkPickup(_frames);
|
||||
m_sin=(m_sin+(_frames*balloon_speed))&4095;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBalloonAndSpatulaPickup::renderPickup(DVECTOR *_pos)
|
||||
void CBouncingSpatulaPickup::renderPickup(DVECTOR *_pos)
|
||||
{
|
||||
SpriteBank *sprites;
|
||||
sFrameHdr *fh,*fhspat;
|
||||
int xo1,xo2;
|
||||
sFrameHdr *fh;
|
||||
int x,y;
|
||||
|
||||
sprites=CGameScene::getSpriteBank();
|
||||
fh=sprites->getFrameHeader(FRM__BALLOON);
|
||||
fhspat=sprites->getFrameHeader(FRM__SPATULA);
|
||||
fh=sprites->getFrameHeader(FRM__SPATULA);
|
||||
x=_pos->vx-(fh->W/2);
|
||||
y=_pos->vy-(fh->H/2);
|
||||
sprites->printFT4(fh,x,y,0,0,OTPOS__PICKUP_POS);
|
||||
|
||||
xo1=((msin((m_sin+balloon_phase)&4095)*balloon_scale1)>>12);
|
||||
xo2=((msin(m_sin)*balloon_scale2)>>12);
|
||||
x=_pos->vx-(fh->W/2)+bspat_stringendxoff;
|
||||
y=_pos->vy-(fh->H/2)-(fhspat->H/2)-balloon_height+bspat_stringendyoff;
|
||||
sprites->printFT4(fh,x+xo1,y,0,0,OTPOS__PICKUP_POS);
|
||||
setCollisionCentreOffset(xo2,0);
|
||||
|
||||
x=_pos->vx+balloon_stringx+bspat_stringendxoff;
|
||||
y=_pos->vy+(fh->H/2)-(fhspat->H/2)-balloon_height+bspat_stringendyoff;
|
||||
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r1,balloon_g1,balloon_b1,OTPOS__PICKUP_POS);
|
||||
x++;
|
||||
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r2,balloon_g2,balloon_b2,OTPOS__PICKUP_POS);
|
||||
|
||||
_pos->vx+=xo2; // This is soooooooo naughty (pkg)
|
||||
CSpatulaPickup::renderPickup(_pos);
|
||||
/*
|
||||
if(m_glint<=spat_maxglint)
|
||||
{
|
||||
fh=sprites->getFrameHeader(spat_glintFrames[(m_glint>>spat_glintgrowspeed)&0x07]);
|
||||
x=x+spat_gxy.vx;
|
||||
y=y+spat_gxy.vy;
|
||||
sprites->printRotatedScaledSprite(fh,x,y,4095,4095,m_glintRot,OTPOS__PICKUP_POS-1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
||||
|
|
|
@ -60,20 +60,19 @@ private:
|
|||
int m_spatulaNumber;
|
||||
};
|
||||
|
||||
class CBalloonAndSpatulaPickup : public CSpatulaPickup
|
||||
|
||||
class CBouncingSpatulaPickup : public CBaseBouncingPickup
|
||||
{
|
||||
public:
|
||||
virtual void init();
|
||||
virtual DVECTOR getSizeForPlacement();
|
||||
|
||||
protected:
|
||||
virtual void thinkPickup(int _frames);
|
||||
virtual void renderPickup(DVECTOR *_pos);
|
||||
|
||||
private:
|
||||
int m_sin;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Globals
|
||||
------- */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue