desktop file ended up in the wrong place.
[crack-attack.git] / src / Block.h
blobdc3aad2b11b51f6e436465267f07a537b17cb1d5
1 /*
2 * Block.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 BLOCK_H
27 #define BLOCK_H
29 using namespace std;
31 #include "Game.h"
32 #include "ComboTabulator.h"
34 // states of blocks
35 #define BS_STATIC (1 << 0)
36 #define BS_SWAPPING (1 << 1)
37 #define BS_FALLING (1 << 2)
38 #define BS_DYING (1 << 3)
39 #define BS_AWAKING (1 << 4)
40 #define BS_SWAP_DIRECTION_MASK (1 << 5)
42 // pop directions
43 #define BR_DIRECTION_1 (1 << 0)
44 #define BR_DIRECTION_2 (1 << 1)
45 #define BR_DIRECTION_3 (1 << 2)
46 #define BR_DIRECTION_4 (1 << 3)
48 class Block {
49 public:
50 void initializeStatic ( int _x, int _y, int _flavor );
51 void initializeAwaking ( int _x, int _y, int _flavor, int pop_delay,
52 int awake_delay, ComboTabulator *combo, int _pop_color );
53 void timeStep ( );
54 void startFalling ( ComboTabulator *combo = null, bool no_hang = false );
55 void startDying ( ComboTabulator *combo, int spark_number );
56 void startSwapping ( int direction );
57 void finishSwapping ( int s_x );
59 inline void beginComboInvolvement ( ComboTabulator *new_combo )
61 if (current_combo)
62 current_combo->decrementInvolvement();
63 current_combo = new_combo;
64 current_combo->incrementInvolvement();
67 inline void endComboInvolvement ( ComboTabulator *old_combo )
69 if (current_combo && current_combo == old_combo) {
70 current_combo->decrementInvolvement();
71 current_combo = null;
75 // free store id
76 int id;
78 // block color
79 int flavor;
81 // grid position; if between grid locations, this is the location of our
82 // lowest and left most edge
83 int x, y;
85 // fine position control; GC_STEPS_PER_GRID number of increments per grid
86 int f_y;
88 // block state
89 int state;
91 // time until pop - also used for other random crap; should be renamed
92 int pop_alarm;
94 // current combo we're involved with, if any
95 ComboTabulator *current_combo;
97 // time until awakening
98 int alarm;
100 // death rotation axis
101 float axis_x, axis_y;
103 // direction of rotation upon popping
104 int pop_direction;
106 // the block color before popping
107 int pop_color;
109 // used by the extreme effects
110 int X;
113 #endif