Fixes for datatype size on amd64.
[crack-attack.git] / src / Swapper.h
blobb6ed61a18f7b916df55852cacbe1128b82f21a16
1 /*
2 * Swapper.h
3 * Daniel Nelson - 8/24/0
5 * Copyright (C) 2000 Daniel Nelson
6 *
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
22 * 174 W. 18th Ave.
23 * Columbus, OH 43210
26 #ifndef SWAPPER_H
27 #define SWAPPER_H
30 #include "BlockManager.h"
32 #define SS_SWAPPING (1 << 0)
33 #define SS_MOVE_PAUSE (1 << 1)
34 #define SS_MOVE_UP (1 << 2)
35 #define SS_MOVE_DOWN (1 << 3)
36 #define SS_MOVE_LEFT (1 << 4)
37 #define SS_MOVE_RIGHT (1 << 5)
38 #define SS_MOVE_MASK (SS_MOVE_UP | SS_MOVE_DOWN \
39 | SS_MOVE_LEFT | SS_MOVE_RIGHT)
41 #define SA_LEFT (1 << 0)
42 #define SA_RIGHT (1 << 1)
43 #define SA_DISALLOWED (1 << 2)
45 /* static */ class Swapper {
46 public:
47 static void gameStart ( );
48 static void timeStep ( );
50 static inline void shiftUp ( )
51 { y++; }
53 static inline void notifyLanding ( int _x, int _y, Block &block,
54 ComboTabulator *combo )
56 if (!(state & SS_SWAPPING)) return;
57 if (_y - 1 != y) return;
58 if (_x == x && (swap & SA_RIGHT)
59 && BlockManager::flavorMatch(block, *right_block))
60 right_block->beginComboInvolvement(combo);
61 else if (_x == x + 1 && (swap & SA_LEFT)
62 && BlockManager::flavorMatch(block, *left_block))
63 left_block->beginComboInvolvement(combo);
66 // the location of our left half
67 static int x, y;
69 // goes off when we're allowed move again
70 static int move_pause_alarm;
72 // goes off when a swap in complete
73 static int swap_alarm;
75 // swapper's state
76 static int state;
78 // factor of swap complete
79 static float swap_factor;
81 // the swapper's color;
82 static int color;
84 private:
85 // type of swap we're executing, if any
86 static int swap;
88 // the swapping blocks
89 static Block *left_block, *right_block;
91 // insures that the player releases a button look for another command; makes
92 // the control more crisp
93 static int button_down_move;
94 static bool button_down_swap;
96 // allows the user to queue up the next command before completion of
97 // the current command
98 static int queued_move;
99 static bool queued_swap;
102 #endif