clean some properties
[exterlulz-kokogems.git] / src / GameController.h
blobd6833dcf02fb13501bf282edcd07e9333b16cf4a
1 /* ----====----====----====----====----====----====----====----====----====----
2 GameController.h (jeweltoy)
4 JewelToy is a simple game played against the clock.
5 Copyright (C) 2001 Giles Williams
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 ----====----====----====----====----====----====----====----====----====---- */
22 #import <Cocoa/Cocoa.h>
24 #define GAMESTATE_GAMEOVER 1
25 #define GAMESTATE_AWAITINGFIRSTCLICK 2
26 #define GAMESTATE_AWAITINGSECONDCLICK 3
27 #define GAMESTATE_FRACULATING 4
28 #define GAMESTATE_SWAPPING 5
29 #define GAMESTATE_FADING 6
30 #define GAMESTATE_FALLING 7
31 #define GAMESTATE_UNSWAPPING 8
32 #define GAMESTATE_EXPLODING 9
33 #define GAMESTATE_FINISHEDFRACULATING 10
35 #define GEM_GRAPHIC_SIZE 48
36 #define GEM_MOVE_SPEED 6
38 #define GEMS_FOR_BONUS 100.0
39 #define SPEED_LIMIT 5000
41 #define TIMER_INTERVAL 0.04
43 @class Game, GameView, TimerView;
45 @interface GameController : NSObject
47 IBOutlet NSPanel *aboutPanel, *prefsPanel;
48 IBOutlet GameView *gameView;
49 IBOutlet NSButton *prefsStandardGraphicsButton, *prefsAlternateGraphicsButton;
50 IBOutlet NSImageView *prefsAlternateGraphicsImageView;
51 IBOutlet NSButton *prefsCustomBackgroundCheckbox, *prefsSelectFolderButton;
52 IBOutlet NSTextField *prefsCustomBackgroundFolderTextField;
53 IBOutlet NSImageView *iv1, *iv2, *iv3, *iv4, *iv5, *iv6, *iv7;
54 IBOutlet NSButton *easyGameButton, *hardGameButton, *toughGameButton;
55 IBOutlet NSMenuItem *easyGameMenuItem, *hardGameMenuItem, *toughGameMenuItem;
56 IBOutlet NSButton *abortGameButton, *pauseGameButton, *muteButton;
57 IBOutlet NSMenuItem *abortGameMenuItem, *pauseGameMenuItem, *muteMenuItem;
58 IBOutlet NSMenuItem *freePlayMenuItem, *showHighScoresMenuItem, *resetHighScoresMenuItem;
59 IBOutlet NSTextField *scoreTextField, *bonusTextField;
60 IBOutlet TimerView *timerView;
61 IBOutlet NSWindow *gameWindow;
62 IBOutlet NSPanel *hiScorePanel;
63 IBOutlet NSTextField *hiScorePanelScoreTextField, *hiScorePanelNameTextField;
65 NSLock *animationTimerLock;
67 NSArray *hiScores;
68 NSMutableArray *gameScores, *gameNames;
70 int *hintTimeSeconds;
72 NSString *noMoreMovesString, *jeweltoyStartString, *gameOverString;
73 NSImage *titleImage;
75 BOOL abortGame;
76 NSTimer *timer;
77 Game *game;
78 int gameLevel;
79 float gameSpeed;
80 float gameTime;
81 int gemMoveSpeed, gemMoveSteps, gemMoveSize;
83 BOOL useAlternateGraphics, useImportedGraphics, useCustomBackgrounds;
84 BOOL paused, freePlay, muted, animationStatus;
86 NSString *customBackgroundFolderPath;
88 int _gameState, gemsSoFar, chx1, chy1, chx2, chy2;
89 SEL whatNext;
92 @property (readonly) int gameState;
94 @property (readonly) NSPoint crossHair1Position;
95 @property (readonly) NSPoint crossHair2Position;
97 - (id)init;
98 - (void)dealloc;
100 - (void)awakeFromNib;
102 - (void)windowWillClose:(NSNotification *)aNotification;
103 - (IBAction)prefsGraphicDropAction;
104 - (IBAction)prefsCustomBackgroundCheckboxAction:(id)sender;
105 - (IBAction)prefsSelectFolderButtonAction;
107 - (BOOL)validateMenuItem: (NSMenuItem*) aMenuItem;
109 - (IBAction)startNewGame:(id)sender;
110 - (IBAction)abortGame;
111 - (IBAction)receiveHiScoreName;
112 - (IBAction)togglePauseMode:(id)sender;
113 - (IBAction)toggleMute:(id)sender;
114 - (IBAction)orderFrontAboutPanel;
115 - (IBAction)orderFrontPreferencesPanel;
116 - (IBAction)showHighScores;
117 - (IBAction)resetHighScores;
119 - (NSArray *)makeBlankHiScoresWith:(NSArray *)oldScores;
121 - (void)runOutOfTime;
122 - (void)checkHiScores;
123 - (void)bonusAwarded;
125 - (void)startAnimation:(SEL)andThenSelector;
126 - (void)animationEnded;
128 - (void)waitForNewGame;
129 - (void)newBoard1;
130 - (void)newBoard2;
131 - (void)waitForFirstClick;
132 - (void)receiveClickAt:(int)x:(int)y;
133 - (void)tryMoveSwapping:(int)x1:(int)y1 and:(int)x2:(int)y2;
134 // test for threes
135 - (void)testForThrees;
136 // if there are threes:
138 //// repeat: remove threes
139 - (void)removeThreesAndReplaceGems;
140 //// replace gems
141 - (void)testForThreesAgain;
142 //// test for threes
143 //// until there are no threes
144 - (void)unSwap;
145 // else swap them back
147 - (BOOL) gameIsPaused;
148 - (BOOL) useCustomBackgrounds;
150 @end