add warnings to the project
[exterlulz-kokogems.git] / src / GameController.h
blobb81962756fbee766746c63e2b12d7c0320f91446
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 - (id) init;
93 - (void) dealloc;
95 - (void)awakeFromNib;
97 - (void)windowWillClose:(NSNotification *)aNotification;
98 - (IBAction)prefsGraphicDropAction:(id)sender;
99 - (IBAction)prefsCustomBackgroundCheckboxAction:(id)sender;
100 - (IBAction)prefsSelectFolderButtonAction:(id)sender;
102 - (BOOL) validateMenuItem: (NSMenuItem*) aMenuItem;
104 - (IBAction)startNewGame:(id)sender;
105 - (IBAction)abortGame:(id)sender;
106 - (IBAction)receiveHiScoreName:(id)sender;
107 - (IBAction)togglePauseMode:(id)sender;
108 - (IBAction)toggleMute:(id)sender;
109 - (IBAction)orderFrontAboutPanel:(id)sender;
110 - (IBAction)orderFrontPreferencesPanel:(id)sender;
111 - (IBAction)showHighScores:(id)sender;
112 - (IBAction)resetHighScores:(id)sender;
114 - (NSArray *)makeBlankHiScoresWith:(NSArray *)oldScores;
116 - (void)runOutOfTime;
117 - (void)checkHiScores;
118 - (void)bonusAwarded;
120 - (void)startAnimation:(SEL)andThenSelector;
121 - (void)animationEnded;
123 - (void)waitForNewGame;
124 - (void)newBoard1;
125 - (void)newBoard2;
126 - (void)waitForFirstClick;
127 - (void)receiveClickAt:(int)x:(int)y;
128 - (void)tryMoveSwapping:(int)x1:(int)y1 and:(int)x2:(int)y2;
129 // test for threes
130 - (void)testForThrees;
131 // if there are threes:
133 //// repeat: remove threes
134 - (void)removeThreesAndReplaceGems;
135 //// replace gems
136 - (void)testForThreesAgain;
137 //// test for threes
138 //// until there are no threes
139 - (void)unSwap;
140 // else swap them back
142 - (int) gameState;
143 - (BOOL) gameIsPaused;
144 - (BOOL) useCustomBackgrounds;
145 - (NSPoint) crossHair1Position;
146 - (NSPoint) crossHair2Position;
147 @end