SBSPSS/source/triggers/tplatfrm.cpp

121 lines
2.5 KiB
C++
Raw Normal View History

2001-05-23 18:01:00 +02:00
/*=========================================================================
tplatfrm.cpp
2001-06-04 21:01:17 +02:00
Author: CRB
2001-05-23 18:01:00 +02:00
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
2001-05-29 22:31:02 +02:00
#include "triggers\trigger.h"
2001-05-23 18:01:00 +02:00
#include "triggers\tplatfrm.h"
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
#if defined (__USER_art__) || defined (__USER_sbart__)
#include "gfx\prim.h"
void CPlatformTrigger::render()
{
DVECTOR ofs;
CRECT area;
CTriggerThing::render();
ofs=CLevel::getCameraPos();
area=getCollisionArea();
area.x1-=ofs.vx;
area.y1-=ofs.vy;
area.x2-=ofs.vx;
area.y2-=ofs.vy;
if(area.x1<=511&&area.x2>=0&&
area.y1<=255&&area.y2>=0)
{
POLY_F4 *f4;
f4=GetPrimF4();
setXY4(f4,area.x1,area.y1,
area.x2,area.y1,
area.x1,area.y2,
area.x2,area.y2);
setRGB0(f4,0,255,0);
setSemiTrans(f4,true);
AddPrimToList(f4,0);
DrawLine(area.x1,area.y1,area.x2,area.y1,0,255,0,0);
DrawLine(area.x2,area.y1,area.x2,area.y2,0,255,0,0);
DrawLine(area.x2,area.y2,area.x1,area.y2,0,255,0,0);
DrawLine(area.x1,area.y2,area.x1,area.y1,0,255,0,0);
}
}
#endif
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlatformTrigger::collidedWith(CThing *_thisThing)
{
2001-06-04 14:54:44 +02:00
switch( _thisThing->getThingType() )
{
case TYPE_PLAYER:
{
CPlayer *player = (CPlayer *) _thisThing;
ATTACK_STATE playerState = player->getAttackState();
2001-05-23 18:01:00 +02:00
2001-06-04 14:54:44 +02:00
if ( playerState == ATTACK_STATE__BUTT_BOUNCE )
{
m_platform->trigger();
}
2001-05-23 18:01:00 +02:00
2001-06-04 14:54:44 +02:00
break;
}
default:
break;
2001-05-23 18:01:00 +02:00
}
}
/*===========================================================================
end */