This commit is contained in:
Paul 2001-02-21 00:11:53 +00:00
parent e6e54de883
commit 8605ed3dfd
2 changed files with 193 additions and 0 deletions

128
source/pickups/pbubmix.cpp Normal file
View File

@ -0,0 +1,128 @@
/*=========================================================================
pbubmix.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\pbubmix.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 CBubbleMixturePickup::init()
{
CBasePickup::init();
m_sin=0;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBubbleMixturePickup::shutdown()
{
CBasePickup::shutdown();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int bubmix_bobspeed=10;
int bubmix_bobscale=3;
void CBubbleMixturePickup::think(int _frames)
{
CBasePickup::think(_frames);
m_sin=(m_sin+(_frames*bubmix_bobspeed))&4095;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBubbleMixturePickup::render()
{
DVECTOR ofs;
SpriteBank *sprites;
sFrameHdr *fh;
int x,y;
ofs=getRenderOffset();
sprites=getSpriteBank();
fh=sprites->getFrameHeader(FRM__BUBBLEMIXTURE);
x=Pos.vx-ofs.vx-(fh->W/2);
y=Pos.vy-ofs.vy-(fh->H/2)+((msin(m_sin)*bubmix_bobscale)>>12);
sprites->printFT4(fh,x,y,0,0,2);
CBasePickup::render();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBubbleMixturePickup::collect(class CPlayer *_player)
{
CBasePickup::collect(_player);
}
/*===========================================================================
end */

65
source/pickups/pbubmix.h Normal file
View File

@ -0,0 +1,65 @@
/*=========================================================================
pbubmix.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PICKUPS_PBUBMIX_H__
#define __PICKUPS_PBUBMIX_H__
/*----------------------------------------------------------------------
Includes
-------- */
#ifndef __PICKUPS_PICKUP_H__
#include "pickups/pickup.h"
#endif
/* Std Lib
------- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
class CBubbleMixturePickup : 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_PBUBMIX_H__ */
/*===========================================================================
end */