Skip to content

Commit

Permalink
Completely reworked how traps worked, and fixed/added the concussion …
Browse files Browse the repository at this point in the history
…rule and controller glitch
  • Loading branch information
bgradin committed Mar 7, 2014
1 parent 7452e31 commit bfe72b9
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 145 deletions.
47 changes: 11 additions & 36 deletions Chips Challenge/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class direction
class Player
{
public:
Player() { canMove = true; movedRecently = false; }

POINT location;
int lastMove;
bool canMove, notForward, movedRecently;
Expand All @@ -107,7 +109,7 @@ class Player
class Monster : public Player
{
public:
Monster() { location.x = location.y = type = canMove = notForward = 0; }
Monster() { location.x = location.y = type = notForward = 0; canMove = true; }
Monster(POINT newLocation, int newType) : type(newType / 4)
{
location.x = newLocation.x;
Expand All @@ -126,7 +128,10 @@ class Monster : public Player
class Chip: public Player
{
public:
Chip() {} // Chip's location must be specified by each level
Chip()
{
canMove = true;
} // Chip's location must be specified by each level

bool lastMoveWasForced;
bool isDead;
Expand All @@ -143,23 +148,6 @@ class Chip: public Player
int yellowKeys;
};

class Trap
{
public:
Trap(COMPARABLE_POINT buttonLocation, COMPARABLE_POINT trapLocation, bool open) : m_buttonLocation(buttonLocation), m_trapLocation(trapLocation), isOpen(open) {}

COMPARABLE_POINT getButtonLocation() { return m_buttonLocation; }
COMPARABLE_POINT getTrapLocation() { return m_trapLocation; }
bool isOpen;

void openTrap() { isOpen = true; }
void closeTrap() { isOpen = false; }

private:
COMPARABLE_POINT m_buttonLocation;
COMPARABLE_POINT m_trapLocation;
};

typedef deque<pair<POINT, direction>>::iterator blockIterator;

class Game
Expand Down Expand Up @@ -262,20 +250,6 @@ class Game
//
bool chipHasHitMonster();

//
// FUNCTION: isOpen(int, int)
//
// PURPOSE: Returns whether or not the trap at the specified location is open
//
bool isOpen(POINT);

//
// FUNCTION: toggleOpen(int, int, bool)
//
// PURPOSE: Allow specification of whether or not the trap at the location is open
//
void toggleOpen(POINT, bool);

//
// FUNCTION: moveChip(int, int, bool)
//
Expand All @@ -292,7 +266,7 @@ class Game
// - Always called from handle_monsters()
// - Takes x and y change parameters, and a reference to the current monster
//
void moveMonster(POINT_CHANGE, deque<Monster>::iterator&, int&);
void moveMonster(POINT_CHANGE, vector<Monster>::iterator&, int&);

//
// FUNCTION: moveBlock(int, int, deque<pair<pair<int, int>, direction>>::iterator&)
Expand Down Expand Up @@ -393,12 +367,13 @@ class Game
//// General game and sound objects ////

Chip chip;
deque<Monster> monsters;
vector<Monster> monsters;
MIDI backgroundMusic;
map<COMPARABLE_POINT, COMPARABLE_POINT> cloners;
map<COMPARABLE_POINT, COMPARABLE_POINT> traps;
map<COMPARABLE_POINT, int> trapOpen;
map<string, wav> soundEffects;
Map map;
list<Trap> traps;
deque<pair<POINT, direction>> movingBlocks;
INI saveData;

Expand Down
Loading

0 comments on commit bfe72b9

Please sign in to comment.