This commit is contained in:
parent
615305eced
commit
46a6e47cde
2 changed files with 104 additions and 0 deletions
76
source/enemy/nmjback.cpp
Normal file
76
source/enemy/nmjback.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*=========================================================================
|
||||
|
||||
nmjback.cpp
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __ENEMY_NMJBACK_H__
|
||||
#include "enemy\nmjback.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VID_HEADER_
|
||||
#include "system\vid.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#include "fx\fx.h"
|
||||
#include "fx\fxjfish.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcMotherJellyfishBackground::postInit()
|
||||
{
|
||||
CNpcEnemy::postInit();
|
||||
|
||||
CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
|
||||
T->SetUp(128,4,8,16);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcMotherJellyfishBackground::render()
|
||||
{
|
||||
SprFrame = NULL;
|
||||
|
||||
if ( m_isActive )
|
||||
{
|
||||
CEnemyThing::render();
|
||||
|
||||
// Render
|
||||
DVECTOR renderPos;
|
||||
DVECTOR offset = CLevel::getCameraPos();
|
||||
|
||||
renderPos.vx = Pos.vx - offset.vx;
|
||||
renderPos.vy = Pos.vy - offset.vy;
|
||||
|
||||
CRECT collisionRect = getCollisionArea();
|
||||
collisionRect.x1 -= Pos.vx;
|
||||
collisionRect.x2 -= Pos.vx;
|
||||
collisionRect.y1 -= Pos.vy;
|
||||
collisionRect.y2 -= Pos.vy;
|
||||
|
||||
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
||||
{
|
||||
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
||||
{
|
||||
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
|
||||
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 8192, 8192 );
|
||||
|
||||
sBBox boundingBox = m_actorGfx->GetBBox();
|
||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
source/enemy/nmjback.h
Normal file
28
source/enemy/nmjback.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=========================================================================
|
||||
|
||||
nmjback.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __ENEMY_NMJBACK_H__
|
||||
#define __ENEMY_NMJBACK_H__
|
||||
|
||||
#ifndef __ENEMY_NPC_H__
|
||||
#include "enemy\npc.h"
|
||||
#endif
|
||||
|
||||
class CNpcMotherJellyfishBackground : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
void render();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue