This commit is contained in:
parent
8ebf3df0d2
commit
e6e54de883
140
source/pickups/pjlammo.cpp
Normal file
140
source/pickups/pjlammo.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
/*=========================================================================
|
||||
|
||||
pjlammo.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\pjlammo.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 CJellyLauncherAmmoPickup::init()
|
||||
{
|
||||
CBasePickup::init();
|
||||
m_rattle=0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CJellyLauncherAmmoPickup::shutdown()
|
||||
{
|
||||
CBasePickup::shutdown();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int rattlespeed=500;
|
||||
int rattlescale=90;
|
||||
int rattlecount=5;
|
||||
int waitcount=10;
|
||||
void CJellyLauncherAmmoPickup::think(int _frames)
|
||||
{
|
||||
CBasePickup::think(_frames);
|
||||
m_rattle+=rattlespeed*_frames;
|
||||
if(m_rattle>(rattlecount+waitcount)*4095)m_rattle=0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CJellyLauncherAmmoPickup::render()
|
||||
{
|
||||
DVECTOR ofs;
|
||||
SpriteBank *sprites;
|
||||
sFrameHdr *fh;
|
||||
int x,y;
|
||||
int angle;
|
||||
|
||||
ofs=getRenderOffset();
|
||||
sprites=getSpriteBank();
|
||||
fh=sprites->getFrameHeader(FRM__JELLYAMMO);
|
||||
x=Pos.vx-ofs.vx;
|
||||
y=Pos.vy-ofs.vy;
|
||||
if(m_rattle<=rattlecount*4095)
|
||||
{
|
||||
angle=((msin(m_rattle&4095)*rattlescale)>>12)&4095;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle=0;
|
||||
}
|
||||
sprites->printRotatedScaledSprite(fh,x,y,4096,4096,angle,2);
|
||||
|
||||
CBasePickup::render();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CJellyLauncherAmmoPickup::collect(class CPlayer *_player)
|
||||
{
|
||||
CBasePickup::collect(_player);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
65
source/pickups/pjlammo.h
Normal file
65
source/pickups/pjlammo.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*=========================================================================
|
||||
|
||||
pjlammo.h
|
||||
|
||||
Author: PKG
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PICKUPS_PJLAMMO_H__
|
||||
#define __PICKUPS_PJLAMMO_H__
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Includes
|
||||
-------- */
|
||||
|
||||
#ifndef __PICKUPS_PICKUP_H__
|
||||
#include "pickups/pickup.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Tyepdefs && Defines
|
||||
------------------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Structure defintions
|
||||
-------------------- */
|
||||
|
||||
class CJellyLauncherAmmoPickup : 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_rattle;
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Globals
|
||||
------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Functions
|
||||
--------- */
|
||||
|
||||
/*---------------------------------------------------------------------- */
|
||||
|
||||
#endif /* __PICKUPS_PJLAMMO_H__ */
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
Loading…
Reference in New Issue
Block a user