2001-05-11 00:19:02 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
nbuttfly.cpp
|
|
|
|
|
|
|
|
Author: CRB
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __ENEMY_NBUTTFLY_H__
|
|
|
|
#include "enemy\nbuttfly.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __VID_HEADER_
|
|
|
|
#include "system\vid.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcButterflyBackgroundEnemy::processMovementModifier(int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange)
|
|
|
|
{
|
|
|
|
Pos.vx += distX;
|
|
|
|
Pos.vy += distY;
|
|
|
|
|
2001-05-11 00:35:10 +02:00
|
|
|
if ( !m_animPlaying )
|
2001-05-11 00:19:02 +02:00
|
|
|
{
|
2001-05-11 00:35:10 +02:00
|
|
|
m_animPlaying = true;
|
2001-05-11 00:19:02 +02:00
|
|
|
m_frame = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcButterflyBackgroundEnemy::render()
|
|
|
|
{
|
|
|
|
SprFrame = NULL;
|
|
|
|
|
|
|
|
if ( m_isActive )
|
|
|
|
{
|
|
|
|
CEnemyThing::render();
|
|
|
|
|
2001-05-14 23:08:03 +02:00
|
|
|
if (canRender())
|
2001-05-11 00:19:02 +02:00
|
|
|
{
|
2001-05-14 23:08:03 +02:00
|
|
|
DVECTOR &renderPos=getRenderPos();
|
|
|
|
|
|
|
|
SprFrame = m_spriteBank->printFT4(FRM_BUTTERFLY_FLAP01 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,!m_reversed,0,15);
|
|
|
|
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
|
|
|
|
|
|
|
|
// get xmax, xmin, ymax, ymin
|
|
|
|
|
|
|
|
s32 XMax;
|
|
|
|
s32 XMin;
|
|
|
|
|
|
|
|
s32 YMax;
|
|
|
|
s32 YMin;
|
|
|
|
|
|
|
|
XMin=SprFrame->x0;
|
|
|
|
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
|
|
|
|
if (XMin>SprFrame->x2) XMin=SprFrame->x2;
|
|
|
|
if (XMin>SprFrame->x3) XMin=SprFrame->x3;
|
|
|
|
XMax=SprFrame->x0;
|
|
|
|
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
|
|
|
|
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
|
|
|
|
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
|
|
|
|
YMin=SprFrame->y0;
|
|
|
|
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
|
|
|
|
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
|
|
|
|
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
|
|
|
|
YMax=SprFrame->y0;
|
|
|
|
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
|
|
|
|
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
|
|
|
|
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
|
|
|
|
|
|
|
|
XMax -= renderPos.vx;
|
|
|
|
XMin -= renderPos.vx;
|
|
|
|
YMax -= renderPos.vy;
|
|
|
|
YMin -= renderPos.vy;
|
|
|
|
|
|
|
|
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
|
|
|
|
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
|
2001-05-11 00:19:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|