From 5c1f9c0ffee6de40cc2f71884d3e59ec71e0f59f Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 10 May 2001 21:13:40 +0000 Subject: [PATCH] --- source/enemy/nsj2back.cpp | 109 ++++++++++++++++++++++++++++++++++++++ source/enemy/nsj2back.h | 27 ++++++++++ 2 files changed, 136 insertions(+) create mode 100644 source/enemy/nsj2back.cpp create mode 100644 source/enemy/nsj2back.h diff --git a/source/enemy/nsj2back.cpp b/source/enemy/nsj2back.cpp new file mode 100644 index 000000000..1d0beffdb --- /dev/null +++ b/source/enemy/nsj2back.cpp @@ -0,0 +1,109 @@ +/*========================================================================= + + nsj2back.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __ENEMY_NSJ2BACK_H__ +#include "enemy\nsj2back.h" +#endif + +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + +#ifndef __GAME_GAME_H__ +#include "game\game.h" +#endif + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSmallJellyfish2BackgroundEnemy::render() +{ + CPlayer *player = GameScene.getPlayer(); + + if ( player->isWearingGlasses() ) + { + SprFrame = NULL; + + if ( m_isActive ) + { + CEnemyThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR origRenderPos; + DVECTOR offset = CLevel::getCameraPos(); + int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 ); + int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 ); + + renderPos.vx = Pos.vx - offset.vx; + origRenderPos.vx = renderPos.vx; + renderPos.vx += m_drawOffset.vx; + + renderPos.vy = Pos.vy - offset.vy; + origRenderPos.vy = renderPos.vy; + renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 ); + + 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_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,15); + setRGB0( SprFrame, 128, 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 (XMaxx1) XMax=SprFrame->x1; + if (XMaxx2) XMax=SprFrame->x2; + if (XMaxx3) 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 (YMaxy1) YMax=SprFrame->y1; + if (YMaxy2) YMax=SprFrame->y2; + if (YMaxy3) YMax=SprFrame->y3; + + XMax -= origRenderPos.vx; + XMin -= origRenderPos.vx; + YMax -= origRenderPos.vy; + YMin -= origRenderPos.vy; + + setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); + setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); + } + } + } + } +} diff --git a/source/enemy/nsj2back.h b/source/enemy/nsj2back.h new file mode 100644 index 000000000..c672d086b --- /dev/null +++ b/source/enemy/nsj2back.h @@ -0,0 +1,27 @@ +/*========================================================================= + + nsj2back.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __ENEMY_NSJ2BACK_H__ +#define __ENEMY_NSJ2BACK_H__ + +#ifndef __ENEMY_NSJBACK_H__ +#include "enemy\nsjback.h" +#endif + +class CNpcSmallJellyfish2BackgroundEnemy : public CNpcSmallJellyfishBackgroundEnemy +{ +public: + virtual void render(); +}; + +#endif