1 // Brain Party 2 // Copyright (C) 2010 Paul Hudson (http://www.tuxradar.com/brainparty) 3 4 // Brain Party is free software; you can redistribute it and/or 5 // modify it under the terms of the GNU General Public License 6 // as published by the Free Software Foundation; either version 3 7 // of the License, or (at your option) any later version. 8 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 14 // You should have received a copy of the GNU General Public License 15 // along with this program; if not, write to the Free Software 16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 18 #ifndef __JEWELJAM_H__ 19 #define __JEWELJAM_H__ 20 21 #include "Minigame.h" 22 23 class BPMiniGame_JewelJam_Box { 24 public: 25 int X; 26 int Y; 27 int DestY; 28 int YSpeed; 29 int Colour; 30 int MatchTime; 31 BPMiniGame_JewelJam_Box()32 BPMiniGame_JewelJam_Box() { 33 X = Y = DestY = YSpeed = Colour = 0; 34 MatchTime = -1; 35 } 36 }; 37 38 class BPMiniGame_JewelJam : public BPMiniGame { 39 public: 40 BPMiniGame_JewelJam(BPGame* game); 41 ~BPMiniGame_JewelJam(); 42 void OnMouseMove(); 43 void OnMouseDown(); 44 void OnMouseUp(); 45 void Start(); 46 int GetWeight(); 47 void Render(); 48 void Tick(); 49 void CheckForMatches(); 50 int MatchBox(BPMiniGame_JewelJam_Box* box, int row, int col); 51 void SetMarathon(); 52 void SetScore(); 53 54 protected: 55 Texture* sfcBackground; 56 57 vector<vector<BPMiniGame_JewelJam_Box*>*> Boxes; 58 BPPList<Texture*> ColoursLo; 59 BPPList<Texture*> ColoursHi; 60 61 SpriteFont* sfcClock; 62 63 vector<BPMiniGame_JewelJam_Box*>* SelectedRow; 64 65 int DisappearTime; 66 BPPoint LastPos; 67 68 static const int BoxSize = 40; 69 static const int HalfBoxSize = 20; 70 71 bool Locked; // when true disallow movement 72 73 int TimeStarted; 74 75 int SuccessTime; 76 77 int Score; 78 SpriteFont* sfcScoreStr; 79 }; 80 81 #endif 82