-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split objecthazard into smaller files
- Loading branch information
Showing
18 changed files
with
1,130 additions
and
1,015 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,173 +1,10 @@ | ||
#ifndef OBJECTHAZARD_H | ||
#define OBJECTHAZARD_H | ||
#pragma once | ||
|
||
#include "gfx.h" | ||
#include "object.h" | ||
#include "PlayerKillStyles.h" | ||
|
||
class CPlayer; | ||
class IO_MovingObject; | ||
|
||
class OMO_OrbitHazard : public IO_OverMapObject | ||
{ | ||
public: | ||
OMO_OrbitHazard(gfxSprite *nspr, short x, short y, float radius, float vel, float angle, short iNumSpr, short aniSpeed, short iCollisionWidth, short iCollisionHeight, short iCollisionOffsetX, short iCollisionOffsetY, short iAnimationOffsetX, short iAnimationOffsetY, short iAnimationHeight, short iAnimationWidth); | ||
~OMO_OrbitHazard() {} | ||
|
||
void update(); | ||
|
||
bool collide(CPlayer *); | ||
|
||
private: | ||
void CalculatePosition(); | ||
|
||
float dAngle, dVel, dRadius; | ||
float dCenterX, dCenterY; | ||
}; | ||
|
||
class OMO_StraightPathHazard : public IO_OverMapObject | ||
{ | ||
public: | ||
OMO_StraightPathHazard(gfxSprite *nspr, short x, short y, float angle, float vel, short iNumSpr, short aniSpeed, short iCollisionWidth, short iCollisionHeight, short iCollisionOffsetX, short iCollisionOffsetY, short iAnimationOffsetX, short iAnimationOffsetY, short iAnimationHeight, short iAnimationWidth); | ||
~OMO_StraightPathHazard() {} | ||
|
||
void update(); | ||
|
||
bool collide(CPlayer *); | ||
|
||
private: | ||
|
||
float dAngle, dVel; | ||
}; | ||
|
||
class MO_BulletBill : public IO_MovingObject | ||
{ | ||
public: | ||
MO_BulletBill(gfxSprite *nspr, gfxSprite *nsprdead, short x, short y, float nspeed, short playerID, bool isspawned); | ||
~MO_BulletBill(){}; | ||
|
||
void update(); | ||
void draw(); | ||
void draw(short iOffsetX, short iOffsetY); | ||
bool collide(CPlayer * player); | ||
void collide(IO_MovingObject * object); | ||
|
||
bool hittop(CPlayer * player); | ||
bool hitother(CPlayer * player); | ||
|
||
void Die(); | ||
void SetDirectionOffset(); | ||
|
||
private: | ||
gfxSprite * spr_dead; | ||
|
||
short iColorID; | ||
|
||
short iColorOffsetY; | ||
short iDirectionOffsetY; | ||
|
||
bool fIsSpawned; | ||
short iHiddenDirection; | ||
short iHiddenPlane; | ||
|
||
friend class MO_Podobo; | ||
}; | ||
|
||
class IO_BulletBillCannon : public CObject | ||
{ | ||
public: | ||
IO_BulletBillCannon(short x, short y, short freq, float vel, bool preview); | ||
~IO_BulletBillCannon() {} | ||
|
||
void draw() {} | ||
void update(); | ||
|
||
bool collide(CPlayer *) { | ||
return false; | ||
} | ||
void collide(IO_MovingObject *) {} | ||
|
||
private: | ||
void SetNewTimer(); | ||
|
||
short iFreq, iTimer; | ||
float dVel; | ||
bool fPreview; | ||
}; | ||
|
||
|
||
class MO_Explosion : public IO_MovingObject | ||
{ | ||
public: | ||
MO_Explosion(gfxSprite *nspr, short x, short y, short iNumSpr, short aniSpeed, short id, short iTeamID, KillStyle style); | ||
~MO_Explosion(){}; | ||
|
||
void update(); | ||
bool collide(CPlayer * player); | ||
|
||
private: | ||
|
||
short timer; | ||
KillStyle iStyle; | ||
}; | ||
|
||
|
||
class IO_FlameCannon : public CObject | ||
{ | ||
public: | ||
IO_FlameCannon(short x, short y, short freq, short direction); | ||
~IO_FlameCannon() {} | ||
|
||
void draw(); | ||
void draw(short iOffsetX, short iOffsetY); | ||
void update(); | ||
|
||
bool collide(CPlayer * player); | ||
void collide(IO_MovingObject *) {} | ||
|
||
private: | ||
void SetNewTimer(); | ||
|
||
short iFreq, iTimer, iCycle; | ||
short iFrame; | ||
|
||
short iDirection; | ||
|
||
friend class CPlayerAI; | ||
}; | ||
|
||
|
||
class MO_PirhanaPlant : public IO_MovingObject | ||
{ | ||
public: | ||
MO_PirhanaPlant(short x, short y, short type, short freq, short direction, bool preview); | ||
~MO_PirhanaPlant() {} | ||
|
||
void draw(); | ||
void draw(short iOffsetX, short iOffsetY); | ||
void update(); | ||
|
||
bool collide(CPlayer * player); | ||
void collide(IO_MovingObject *); | ||
|
||
void KillPlant(); | ||
|
||
private: | ||
void SetNewTimer(); | ||
|
||
float GetFireballAngle(); | ||
|
||
short iType, iDirection; | ||
short iFreq, iTimer; | ||
//short iHiddenPlane, iHiddenDirection; | ||
//short iSrcX, iSrcY; | ||
short iAnimationTimer; | ||
short iFrame; | ||
short iActionTimer; | ||
|
||
bool fPreview; | ||
|
||
friend class CPlayerAI; | ||
}; | ||
|
||
#endif // OBJECTHAZARD_H | ||
#include "objects/IO_BulletBillCannon.h" | ||
#include "objects/IO_FlameCannon.h" | ||
#include "objects/moving/MO_BulletBill.h" | ||
#include "objects/moving/MO_Explosion.h" | ||
#include "objects/moving/MO_PirhanaPlant.h" | ||
#include "objects/overmap/WO_OrbitHazard.h" | ||
#include "objects/overmap/WO_StraightPathHazard.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "IO_BulletBillCannon.h" | ||
|
||
#include "GameValues.h" | ||
#include "ObjectContainer.h" | ||
#include "RandomNumberGenerator.h" | ||
#include "ResourceManager.h" | ||
#include "objects/moving/MO_BulletBill.h" | ||
|
||
extern CObjectContainer objectcontainer[3]; | ||
extern CResourceManager* rm; | ||
|
||
//------------------------------------------------------------------------------ | ||
// class IO_BulletBillCannon - gets update calls and shoots bullet bills based on timer | ||
//------------------------------------------------------------------------------ | ||
|
||
IO_BulletBillCannon::IO_BulletBillCannon(short x, short y, short freq, float vel, bool preview) : | ||
CObject(NULL, x, y) | ||
{ | ||
iFreq = freq; | ||
dVel = vel; | ||
fPreview = preview; | ||
|
||
objectType = object_bulletbillcannon; | ||
|
||
SetNewTimer(); | ||
} | ||
|
||
void IO_BulletBillCannon::update() | ||
{ | ||
if (--iTimer <= 0) { | ||
SetNewTimer(); | ||
|
||
objectcontainer[1].add(new MO_BulletBill(&rm->spr_hazard_bulletbill[fPreview ? 1 : 0], &rm->spr_hazard_bulletbilldead, ix + (dVel < 0.0f ? 32 : -32), iy, dVel, 0, true)); | ||
ifSoundOnPlay(rm->sfx_bulletbillsound); | ||
} | ||
} | ||
|
||
void IO_BulletBillCannon::SetNewTimer() | ||
{ | ||
iTimer = iFreq + RANDOM_INT(iFreq); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include "object.h" | ||
|
||
|
||
class IO_BulletBillCannon : public CObject | ||
{ | ||
public: | ||
IO_BulletBillCannon(short x, short y, short freq, float vel, bool preview); | ||
~IO_BulletBillCannon() {} | ||
|
||
void draw() {} | ||
void update(); | ||
|
||
bool collide(CPlayer *) { | ||
return false; | ||
} | ||
void collide(IO_MovingObject *) {} | ||
|
||
private: | ||
void SetNewTimer(); | ||
|
||
short iFreq, iTimer; | ||
float dVel; | ||
bool fPreview; | ||
}; | ||
|
||
|
Oops, something went wrong.