SBSPSS/source/pickups/pkelp.cpp

158 lines
3.4 KiB
C++
Raw Normal View History

2001-05-29 22:19:24 +02:00
/*=========================================================================
pkelp.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\pkelp.h"
#ifndef __GFX_OTPOS_H__
#include "gfx\otpos.h"
#endif
#ifndef __MATHTABLE_HEADER__
#include "utils\mathtab.h"
#endif
#ifndef __GAME_GAMESLOT_H__
#include "game\gameslot.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
#include "game/game.h"
/* Std Lib
------- */
/* Data
---- */
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-05-29 22:42:16 +02:00
void CKelpTokenPickup::init()
2001-05-29 22:19:24 +02:00
{
sFrameHdr *fh;
CBasePickup::init();
fh=CGameScene::getSpriteBank()->getFrameHeader(FRM__TOKEN);
setCollisionSize(fh->W,fh->H);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-05-29 22:42:16 +02:00
DVECTOR CKelpTokenPickup::getSizeForPlacement()
2001-05-29 22:19:24 +02:00
{
DVECTOR size;
sFrameHdr *fh;
fh=CGameScene::getSpriteBank()->getFrameHeader(FRM__TOKEN);
size.vx=fh->W;
size.vy=fh->H;
return size;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-05-29 22:42:16 +02:00
void CKelpTokenPickup::collect(class CPlayer *_player)
2001-05-29 22:19:24 +02:00
{
CBasePickup::collect(_player);
2001-06-01 20:59:33 +02:00
CGameSlotManager::getSlotData()->collectKelpToken(GameScene.getChapterNumber()-1,GameScene.getLevelNumber()-1,m_tokenNumber);
2001-05-29 22:19:24 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-05-29 22:42:16 +02:00
void CKelpTokenPickup::renderPickup(DVECTOR *_pos)
2001-05-29 22:19:24 +02:00
{
SpriteBank *sprites;
sFrameHdr *fh;
int x,y;
sprites=CGameScene::getSpriteBank();
fh=sprites->getFrameHeader(FRM__TOKEN);
x=_pos->vx-(fh->W/2);
y=_pos->vy-(fh->H/2);
sprites->printFT4(fh,x,y,0,0,OTPOS__PICKUP_POS);
}
2001-06-08 16:05:48 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CKelpTokenPickup::collidedWith(CThing *_thisThing)
{
switch(_thisThing->getThingType())
{
case TYPE_PLAYER:
case TYPE_NPC:
collect((CPlayer*)_thisThing);
CSoundMediator::playSfx(sfxToPlayWhenCollected());
break;
default:
ASSERT(0);
break;
}
}
2001-05-29 22:19:24 +02:00
/*===========================================================================
end */