-
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.
Replaced the raw block type with a modern enum
- Loading branch information
Showing
15 changed files
with
262 additions
and
302 deletions.
There are no files selected for viewing
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,19 +1,16 @@ | ||
#ifndef BLOCKTYPES_H | ||
#define BLOCKTYPES_H | ||
#pragma once | ||
|
||
enum BlockType { | ||
block_none, | ||
block_powerup, | ||
block_view, | ||
block_breakable, | ||
block_note, | ||
block_donut, | ||
block_flip, | ||
block_bounce, | ||
block_throw, | ||
block_onoff_switch, | ||
block_onoff, | ||
block_weaponbreakable | ||
enum class BlockType: unsigned char { | ||
None, | ||
Powerup, | ||
View, | ||
Breakable, | ||
Note, | ||
Donut, | ||
Flip, | ||
Bounce, | ||
Throw, | ||
OnOffSwitch, | ||
OnOff, | ||
WeaponBreakable, | ||
}; | ||
|
||
#endif // BLOCKTYPES_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
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 |
---|---|---|
@@ -1,31 +1,28 @@ | ||
#ifndef SMW_GAMEOBJECT_BLOCK_BOUNCE_H | ||
#define SMW_GAMEOBJECT_BLOCK_BOUNCE_H | ||
#pragma once | ||
|
||
#include "IO_Block.h" | ||
|
||
class B_BounceBlock : public IO_Block | ||
{ | ||
public: | ||
B_BounceBlock(gfxSprite *nspr, short x, short y, bool fHidden); | ||
~B_BounceBlock(){}; | ||
|
||
BlockType getBlockType() { | ||
return block_bounce; | ||
class B_BounceBlock : public IO_Block { | ||
public: | ||
B_BounceBlock(gfxSprite *nspr, short x, short y, bool fHidden); | ||
~B_BounceBlock(){}; | ||
|
||
BlockType getBlockType() const override { | ||
return BlockType::Bounce; | ||
} | ||
|
||
void update(); | ||
void draw(); | ||
void reset(); | ||
void update(); | ||
void draw(); | ||
void reset(); | ||
|
||
bool collide(CPlayer * player, short direction, bool useBehavior); | ||
bool collide(IO_MovingObject * object, short direction); | ||
bool collide(CPlayer * player, short direction, bool useBehavior); | ||
bool collide(IO_MovingObject * object, short direction); | ||
|
||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
|
||
bool hittop(IO_MovingObject * object); | ||
bool hittop(IO_MovingObject * object); | ||
|
||
void triggerBehavior(); | ||
void triggerBehavior(); | ||
}; | ||
|
||
#endif // SMW_GAMEOBJECT_BLOCK_BOUNCE_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,37 @@ | ||
#ifndef SMW_GAMEOBJECT_BLOCK_BREAKABLE_H | ||
#define SMW_GAMEOBJECT_BLOCK_BREAKABLE_H | ||
#pragma once | ||
|
||
#include "IO_Block.h" | ||
|
||
class gfxSprite; | ||
class CPlayer; | ||
class IO_MovingObject; | ||
|
||
class B_BreakableBlock : public IO_Block | ||
{ | ||
public: | ||
B_BreakableBlock(gfxSprite *nspr, short x, short y, short iNumSpr, short aniSpeed); | ||
~B_BreakableBlock(){}; | ||
|
||
BlockType getBlockType() { | ||
return block_breakable; | ||
class B_BreakableBlock : public IO_Block { | ||
public: | ||
B_BreakableBlock(gfxSprite *nspr, short x, short y, short iNumSpr, short aniSpeed); | ||
~B_BreakableBlock(){}; | ||
|
||
BlockType getBlockType() const override { | ||
return BlockType::Breakable; | ||
} | ||
|
||
void draw(); | ||
void update(); | ||
void draw(); | ||
void update(); | ||
|
||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
|
||
bool hittop(IO_MovingObject * object); | ||
bool hitright(IO_MovingObject * object); | ||
bool hitleft(IO_MovingObject * object); | ||
bool hittop(IO_MovingObject * object); | ||
bool hitright(IO_MovingObject * object); | ||
bool hitleft(IO_MovingObject * object); | ||
|
||
void triggerBehavior(); | ||
void triggerBehavior(); | ||
|
||
private: | ||
short iNumSprites; | ||
short animationSpeed; | ||
short drawFrame; | ||
short animationTimer; | ||
short animationWidth; | ||
private: | ||
short iNumSprites; | ||
short animationSpeed; | ||
short drawFrame; | ||
short animationTimer; | ||
short animationWidth; | ||
}; | ||
|
||
#endif // SMW_GAMEOBJECT_BLOCK_BREAKABLE_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
#ifndef SMW_GAMEOBJECT_BLOCK_B_DONUT_H | ||
#define SMW_GAMEOBJECT_BLOCK_B_DONUT_H | ||
#pragma once | ||
|
||
#include "IO_Block.h" | ||
|
||
class B_DonutBlock : public IO_Block | ||
{ | ||
public: | ||
B_DonutBlock(gfxSprite *nspr, short x, short y); | ||
~B_DonutBlock(){}; | ||
class B_DonutBlock : public IO_Block { | ||
public: | ||
B_DonutBlock(gfxSprite *nspr, short x, short y); | ||
~B_DonutBlock(){}; | ||
|
||
BlockType getBlockType() { | ||
return block_donut; | ||
BlockType getBlockType() const override { | ||
return BlockType::Donut; | ||
} | ||
|
||
void draw(); | ||
void update(); | ||
void draw(); | ||
void update(); | ||
|
||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hittop(CPlayer * player, bool useBehavior); | ||
|
||
void triggerBehavior(short iPlayerId); | ||
void triggerBehavior(short iPlayerId); | ||
|
||
private: | ||
short counter; | ||
short jigglex; | ||
short jigglecounter; | ||
private: | ||
short counter; | ||
short jigglex; | ||
short jigglecounter; | ||
}; | ||
|
||
#endif // SMW_GAMEOBJECT_BLOCK_B_DONUT_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,44 @@ | ||
#ifndef SMW_GAMEOBJECT_BLOCK_FLIP_H | ||
#define SMW_GAMEOBJECT_BLOCK_FLIP_H | ||
#pragma once | ||
|
||
#include "IO_Block.h" | ||
|
||
class B_FlipBlock : public IO_Block | ||
{ | ||
public: | ||
B_FlipBlock(gfxSprite *nspr, short x, short y, bool fHidden); | ||
~B_FlipBlock(){}; | ||
class B_FlipBlock : public IO_Block { | ||
public: | ||
B_FlipBlock(gfxSprite *nspr, short x, short y, bool fHidden); | ||
~B_FlipBlock(){}; | ||
|
||
BlockType getBlockType() { | ||
return block_flip; | ||
BlockType getBlockType() const override { | ||
return BlockType::Flip; | ||
} | ||
|
||
void draw(); | ||
void update(); | ||
void reset(); | ||
void draw(); | ||
void update(); | ||
void reset(); | ||
|
||
bool collide(CPlayer * player, short direction, bool useBehavior); | ||
bool collide(IO_MovingObject * object, short direction); | ||
bool collide(CPlayer * player, short direction, bool useBehavior); | ||
bool collide(IO_MovingObject * object, short direction); | ||
|
||
bool isTransparent() { | ||
return state == 1; | ||
} | ||
|
||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
bool hitright(CPlayer * player, bool useBehavior); | ||
bool hitleft(CPlayer * player, bool useBehavior); | ||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
bool hitright(CPlayer * player, bool useBehavior); | ||
bool hitleft(CPlayer * player, bool useBehavior); | ||
|
||
bool hittop(IO_MovingObject * object); | ||
bool hitbottom(IO_MovingObject * object); | ||
bool hitright(IO_MovingObject * object); | ||
bool hitleft(IO_MovingObject * object); | ||
bool hittop(IO_MovingObject * object); | ||
bool hitbottom(IO_MovingObject * object); | ||
bool hitright(IO_MovingObject * object); | ||
bool hitleft(IO_MovingObject * object); | ||
|
||
void triggerBehavior(); | ||
void triggerBehavior(); | ||
|
||
private: | ||
private: | ||
void explode(); | ||
|
||
void explode(); | ||
|
||
short counter; | ||
short frame; | ||
short timer; | ||
short animationWidth; | ||
short counter; | ||
short frame; | ||
short timer; | ||
short animationWidth; | ||
}; | ||
|
||
#endif // SMW_GAMEOBJECT_BLOCK_FLIP_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
#ifndef SMW_GAMEOBJECT_BLOCK_NOTE_H | ||
#define SMW_GAMEOBJECT_BLOCK_NOTE_H | ||
#pragma once | ||
|
||
#include "IO_Block.h" | ||
|
||
class B_NoteBlock : public IO_Block | ||
{ | ||
public: | ||
B_NoteBlock(gfxSprite *nspr, short x, short y, short iNumSpr, short aniSpeed, short type, bool fHidden); | ||
~B_NoteBlock(){}; | ||
class B_NoteBlock : public IO_Block { | ||
public: | ||
B_NoteBlock(gfxSprite *nspr, short x, short y, short iNumSpr, short aniSpeed, short type, bool fHidden); | ||
~B_NoteBlock(){}; | ||
|
||
BlockType getBlockType() { | ||
return block_note; | ||
BlockType getBlockType() const override { | ||
return BlockType::Note; | ||
} | ||
|
||
void draw(); | ||
void update(); | ||
void reset(); | ||
void draw(); | ||
void update(); | ||
void reset(); | ||
|
||
bool collide(CPlayer * player, short direction, bool useBehavior); | ||
bool collide(IO_MovingObject * object, short direction); | ||
bool collide(CPlayer * player, short direction, bool useBehavior); | ||
bool collide(IO_MovingObject * object, short direction); | ||
|
||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
bool hitright(CPlayer * player, bool useBehavior); | ||
bool hitleft(CPlayer * player, bool useBehavior); | ||
bool hittop(CPlayer * player, bool useBehavior); | ||
bool hitbottom(CPlayer * player, bool useBehavior); | ||
bool hitright(CPlayer * player, bool useBehavior); | ||
bool hitleft(CPlayer * player, bool useBehavior); | ||
|
||
bool hittop(IO_MovingObject * object); | ||
bool hittop(IO_MovingObject * object); | ||
|
||
private: | ||
short iNumSprites; | ||
short animationSpeed; | ||
short drawFrame; | ||
short animationTimer; | ||
short animationWidth; | ||
short iType; | ||
short iTypeOffsetY; | ||
private: | ||
short iNumSprites; | ||
short animationSpeed; | ||
short drawFrame; | ||
short animationTimer; | ||
short animationWidth; | ||
short iType; | ||
short iTypeOffsetY; | ||
}; | ||
|
||
#endif // SMW_GAMEOBJECT_BLOCK_NOTE_H |
Oops, something went wrong.