3 * Daniel Nelson - 8/24/0
5 * Copyright (C) 2000 Daniel Nelson
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.
21 * Daniel Nelson - aluminumangel.org
31 #include "BlockManager.h"
33 #define SS_SWAPPING (1 << 0)
34 #define SS_MOVE_PAUSE (1 << 1)
35 #define SS_MOVE_UP (1 << 2)
36 #define SS_MOVE_DOWN (1 << 3)
37 #define SS_MOVE_LEFT (1 << 4)
38 #define SS_MOVE_RIGHT (1 << 5)
39 #define SS_MOVE_MASK (SS_MOVE_UP | SS_MOVE_DOWN \
40 | SS_MOVE_LEFT | SS_MOVE_RIGHT)
42 #define SA_LEFT (1 << 0)
43 #define SA_RIGHT (1 << 1)
44 #define SA_DISALLOWED (1 << 2)
46 /* static */ class Swapper
{
48 static void gameStart ( );
49 static void timeStep ( );
51 static inline void shiftUp ( )
54 static inline void notifyLanding ( int _x
, int _y
, Block
&block
,
55 ComboTabulator
*combo
)
57 if (!(state
& SS_SWAPPING
)) return;
58 if (_y
- 1 != y
) return;
59 if (_x
== x
&& (swap
& SA_RIGHT
)
60 && BlockManager::flavorMatch(block
, *right_block
))
61 right_block
->beginComboInvolvement(combo
);
62 else if (_x
== x
+ 1 && (swap
& SA_LEFT
)
63 && BlockManager::flavorMatch(block
, *left_block
))
64 left_block
->beginComboInvolvement(combo
);
67 // the location of our left half
70 // goes off when we're allowed move again
71 static int move_pause_alarm
;
73 // goes off when a swap in complete
74 static int swap_alarm
;
79 // factor of swap complete
80 static float swap_factor
;
82 // the swapper's color;
86 // type of swap we're executing, if any
89 // the swapping blocks
90 static Block
*left_block
, *right_block
;
92 // insures that the player releases a button look for another command; makes
93 // the control more crisp
94 static int button_down_move
;
95 static bool button_down_swap
;
97 // allows the user to queue up the next command before completion of
98 // the current command
99 static int queued_move
;
100 static bool queued_swap
;