SBSPSS/source/pickups/pshoes.cpp

158 lines
3.5 KiB
C++
Raw Normal View History

2001-02-21 16:03:08 +01:00
/*=========================================================================
pshoes.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
2001-02-21 18:13:37 +01:00
#include "pickups\pshoes.h"
2001-02-21 16:03:08 +01:00
#ifndef __MATHTABLE_HEADER__
#include "utils\mathtab.h"
#endif
2001-02-27 23:06:24 +01:00
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
2001-04-19 22:46:43 +02:00
#ifndef __GFX_OTPOS_H__
#include "gfx\otpos.h"
#endif
2001-02-21 16:03:08 +01:00
/* Std Lib
------- */
/* Data
---- */
2001-04-20 16:53:35 +02:00
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
2001-02-21 16:03:08 +01:00
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-21 18:13:37 +01:00
void CShoesPickup::init()
2001-02-21 16:03:08 +01:00
{
2001-04-20 18:57:05 +02:00
sFrameHdr *fh;
2001-02-27 23:06:24 +01:00
CBaseRespawningPickup::init();
2001-02-21 16:03:08 +01:00
m_sin=0;
2001-04-20 18:57:05 +02:00
fh=getSpriteBank()->getFrameHeader(FRM__SHOE);
setCollisionSize(fh->W,fh->H);
2001-02-21 16:03:08 +01:00
}
2001-04-02 23:37:20 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
DVECTOR CShoesPickup::getSizeForPlacement()
{
DVECTOR size;
sFrameHdr *fh;
fh=getSpriteBank()->getFrameHeader(FRM__SHOE);
size.vx=fh->W;
size.vy=fh->H;
return size;
}
2001-02-21 23:33:17 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CShoesPickup::collect(class CPlayer *_player)
{
2001-03-02 17:02:30 +01:00
_player->giveSqueakyBoots();
2001-03-01 21:06:46 +01:00
CBaseRespawningPickup::collect(_player);
2001-02-27 23:06:24 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CShoesPickup::getRespawnTime()
{
return 60*30;
2001-02-21 23:33:17 +01:00
}
2001-02-21 16:03:08 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-21 18:13:37 +01:00
int shoes_bobspeed=100;
int shoes_bobscale=2;
int shoes_seperation=4;
2001-02-21 23:33:17 +01:00
void CShoesPickup::thinkPickup(int _frames)
2001-02-21 16:03:08 +01:00
{
2001-02-21 18:13:37 +01:00
m_sin=(m_sin+(_frames*shoes_bobspeed))&4095;
2001-02-21 16:03:08 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-21 23:33:17 +01:00
void CShoesPickup::renderPickup(DVECTOR *_pos)
2001-02-21 16:03:08 +01:00
{
SpriteBank *sprites;
sFrameHdr *fh;
2001-02-21 18:13:37 +01:00
int x,y,yoff;
2001-02-21 16:03:08 +01:00
sprites=getSpriteBank();
2001-02-21 18:13:37 +01:00
fh=sprites->getFrameHeader(FRM__SHOE);
2001-02-21 23:33:17 +01:00
x=_pos->vx-(fh->W/2);
y=_pos->vy-(fh->H/2);
2001-02-21 18:13:37 +01:00
yoff=((msin(m_sin)*shoes_bobscale)>>12);
2001-04-19 22:46:43 +02:00
sprites->printFT4(fh,x+shoes_seperation,y+yoff,0,0,OTPOS__PICKUP_POS);
sprites->printFT4(fh,x-shoes_seperation,y-yoff,0,0,OTPOS__PICKUP_POS);
2001-02-21 16:03:08 +01:00
}
/*===========================================================================
end */