SBSPSS/source/pickups/pballoon.cpp

201 lines
4.4 KiB
C++
Raw Normal View History

2001-02-21 20:34:16 +01:00
/*=========================================================================
pballoon.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\pballoon.h"
2001-02-21 23:33:17 +01:00
#ifndef __LEVEL_LEVEL_H__
#include "level\level.h"
#endif
#ifndef __LAYER_COLLISION_H__
#include "layer\collision.h"
#endif
#ifndef __PRIM_HEADER__
#include "gfx\prim.h"
#endif
#ifndef __MATHTABLE_HEADER__
#include "utils\mathtab.h"
#endif
2001-02-28 20:37:01 +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-05-25 20:43:47 +02:00
#include "game\game.h"
2001-02-21 20:34:16 +01:00
/* Std Lib
------- */
/* Data
---- */
2001-04-20 16:53:35 +02:00
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
2001-02-21 20:34:16 +01:00
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-02-21 23:33:17 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBalloonPickup::init()
{
2001-02-26 21:42:25 +01:00
sFrameHdr *fh;
2001-05-18 23:03:51 +02:00
CBaseWeaponPickup::init();
2001-02-21 23:33:17 +01:00
m_sin=0;
2001-02-26 21:42:25 +01:00
2001-05-25 20:43:47 +02:00
fh=CGameScene::getSpriteBank()->getFrameHeader(FRM__BALLOON);
2001-02-26 21:42:25 +01:00
setCollisionSize(fh->W,fh->H);
2001-02-21 23:33:17 +01:00
}
2001-04-02 23:37:20 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
DVECTOR CBalloonPickup::getSizeForPlacement()
{
DVECTOR size;
sFrameHdr *fh;
2001-05-25 20:43:47 +02:00
fh=CGameScene::getSpriteBank()->getFrameHeader(FRM__BALLOON);
2001-04-02 23:37:20 +02:00
size.vx=fh->W;
size.vy=fh->H;
return size;
}
2001-02-21 20:34:16 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBalloonPickup::collect(class CPlayer *_player)
{
2001-03-25 22:36:28 +02:00
_player->setMode(PLAYER_MODE_BALLOON);
2001-05-18 23:03:51 +02:00
CBaseWeaponPickup::collect(_player);
2001-02-21 23:33:17 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int balloon_height=30;
2001-03-25 22:36:28 +02:00
int balloon_r1=251;
int balloon_g1=207;
int balloon_b1=167;
int balloon_r2=147;
int balloon_g2=95;
int balloon_b2=75;
2001-02-21 23:33:17 +01:00
int balloon_speed=25;
int balloon_scale1=5;
int balloon_scale2=2;
int balloon_phase=1024;
int balloon_vissize=40;
2001-03-25 22:36:28 +02:00
int balloon_stringx=-3;
2001-02-21 23:33:17 +01:00
int CBalloonPickup::getVisibilityRadius()
{
return balloon_vissize;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CBalloonPickup::getRespawnTime()
{
return 60*10;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBalloonPickup::thinkPickup(int _frames)
{
m_sin=(m_sin+(_frames*balloon_speed))&4095;
2001-02-21 20:34:16 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBalloonPickup::renderPickup(DVECTOR *_pos)
{
SpriteBank *sprites;
sFrameHdr *fh;
2001-02-21 23:33:17 +01:00
int xo1,xo2;
2001-02-21 20:34:16 +01:00
int x,y;
2001-05-25 20:43:47 +02:00
sprites=CGameScene::getSpriteBank();
2001-02-21 23:33:17 +01:00
fh=sprites->getFrameHeader(FRM__BALLOON);
xo1=((msin((m_sin+balloon_phase)&4095)*balloon_scale1)>>12);
xo2=((msin(m_sin)*balloon_scale2)>>12);
2001-02-21 20:34:16 +01:00
x=_pos->vx-(fh->W/2);
y=_pos->vy-(fh->H/2);
2001-04-19 22:46:43 +02:00
sprites->printFT4(fh,x+xo1,y,0,0,OTPOS__PICKUP_POS);
2001-02-26 21:42:25 +01:00
setCollisionCentreOffset(xo1,0);
2001-02-21 23:33:17 +01:00
2001-03-25 22:36:28 +02:00
x=_pos->vx+balloon_stringx;
2001-02-21 23:33:17 +01:00
y=_pos->vy+(fh->H/2);
2001-04-19 22:46:43 +02:00
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r1,balloon_g1,balloon_b1,OTPOS__PICKUP_POS);
2001-03-25 22:36:28 +02:00
x++;
2001-04-19 22:46:43 +02:00
DrawLine(x+xo1,y,x+xo2,y+balloon_height,balloon_r2,balloon_g2,balloon_b2,OTPOS__PICKUP_POS);
2001-02-21 20:34:16 +01:00
}
/*===========================================================================
end */