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
49 /* static */ class X
{
51 static void gameStart ( );
52 static void timeStep ( );
53 static void modifyHeadlightColor ( GLfloat headlight_color
[3] );
54 static void notifyImpact ( Garbage
&garbage
);
55 static void notifyShatter ( Garbage
&garbage
);
57 static inline bool reverseControls ( )
59 return reverse_controls
!= 0;
62 static inline bool invisibleSwapper ( )
64 return swapper_alpha
!= GC_INVISIBLE_MAX_ALPHA
;
67 static inline bool needDrawSwapper ( )
69 return swapper_alpha
> 0;
72 static inline GLfloat
swapperAlpha ( )
74 assert(needDrawSwapper());
75 return swapper_alpha
* (1.0f
/ (float) GC_INVISIBLE_MAX_ALPHA
);
78 static inline bool crazyLights ( )
80 return light_mode
!= -1 && (light_mode
& (1 << 0));
83 static inline bool wildActive ( )
85 return wild_count
!= 0;
88 static inline bool wildAllowed ( )
90 return wild_count
!= GC_MAX_WILD_NUMBER
;
93 static inline void activateWild ( Block
&block
)
95 assert(wildAllowed());
98 for (n
= 0; wilds
[n
].active
; n
++);
102 wilds
[n
].active
= true;
103 wilds
[n
].block
= &block
;
104 wilds
[n
].flavor
= Random::number(BF_WILD
+ 1);
105 wilds
[n
].alarm
= 180;
110 static inline int wildFlavor ( Block
&block
)
112 assert(block
.flavor
== BF_WILD
);
114 if (wilds
[block
.X
].alarm
>= GC_WILD_POLYMORPH_PERIOD
)
115 return wilds
[block
.X
].flavor
;
120 static inline Wild
&wild ( Block
&block
)
122 assert(block
.flavor
== BF_WILD
);
124 return wilds
[block
.X
];
127 static inline void deactivateWild ( Block
&block
)
129 assert(block
.flavor
== BF_WILD
);
131 wilds
[block
.X
].active
= false;
135 static inline bool specialColorActive ( )
137 return special_color_count
!= 0;
140 static inline bool specialColorAllowed ( )
142 return special_color_count
!= GC_MAX_SPECIAL_COLOR_NUMBER
;
145 static inline void activateSpecialColor ( Block
&block
)
147 assert(specialColorAllowed());
149 // sloppy but effective way of insuring each special color block's gleam
151 block
.X
= Random::number2((1 << 20));
152 special_color_count
++;
155 static inline void deactivateSpecialColor ( )
157 special_color_count
--;
160 static int reverse_controls
;
161 static int invisible_swapper
;
162 static int crazy_lights
;
164 static int swapper_alpha
;
166 static int light_mode
;
167 static int light_alarm
;
168 static const GLfloat light_level_map
[6][3];
170 static int wild_count
;
171 static Wild wilds
[GC_MAX_WILD_NUMBER
];
173 static int special_color_count
;