SBSPSS/source/pickups/pspatula.cpp

143 lines
3.4 KiB
C++
Raw Normal View History

2001-02-20 23:53:35 +01:00
/*=========================================================================
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"
/* 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;
2001-03-29 22:53:10 +02:00
m_glintRot=0;
2001-02-20 23:53:35 +01:00
}
2001-04-02 23:37:20 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
DVECTOR CSpatulaPickup::getSizeForPlacement()
{
DVECTOR size;
sFrameHdr *fh;
fh=getSpriteBank()->getFrameHeader(FRM__SPATULA);
size.vx=fh->W;
size.vy=fh->H;
return size;
}
2001-02-21 23:33:17 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CSpatulaPickup::collect(class CPlayer *_player)
{
CBasePickup::collect(_player);
}
2001-02-20 23:53:35 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-31 04:05:24 +02:00
int spat_glintspeed=1;
2001-03-29 22:53:10 +02:00
int spat_maxglint=100;
int spat_glintrotspeed=50;
int spat_glintgrowspeed=5;
DVECTOR spat_gxy1={0,28};
2001-03-31 04:05:24 +02:00
DVECTOR spat_gxy2={50,-35};
2001-03-29 22:53:10 +02:00
static const int spat_glintFrames[]={FRM__GLINT1,FRM__GLINT2,FRM__GLINT3,FRM__GLINT4,FRM__GLINT4,FRM__GLINT3,FRM__GLINT2,FRM__GLINT1};
2001-02-21 23:33:17 +01:00
void CSpatulaPickup::thinkPickup(int _frames)
2001-02-20 23:53:35 +01:00
{
m_glint+=_frames*spat_glintspeed;
if(m_glint>spat_maxglint)m_glint-=spat_maxglint;
2001-03-29 22:53:10 +02:00
m_glintRot+=_frames*spat_glintrotspeed;
m_glintRot&=4095;
2001-02-20 23:53:35 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-21 23:33:17 +01:00
void CSpatulaPickup::renderPickup(DVECTOR *_pos)
2001-02-20 23:53:35 +01:00
{
SpriteBank *sprites;
sFrameHdr *fh;
int x,y;
sprites=getSpriteBank();
fh=sprites->getFrameHeader(FRM__SPATULA);
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
sprites->printFT4(fh,x,y,0,0,PICKUPS_OT_POS);
2001-02-20 23:53:35 +01:00
if(m_glint<=255)
{
2001-03-29 22:53:10 +02:00
fh=sprites->getFrameHeader(spat_glintFrames[(m_glint>>spat_glintgrowspeed)&0x07]);
2001-02-20 23:53:35 +01:00
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;
2001-03-29 22:53:10 +02:00
sprites->printRotatedScaledSprite(fh,x,y,4095,4095,m_glintRot,PICKUPS_OT_POS-1);
2001-02-20 23:53:35 +01:00
}
}
/*===========================================================================
end */