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
48 /* static */ class X
{
50 static void gameStart ( );
51 static void timeStep ( );
52 static void modifyHeadlightColor ( GLfloat headlight_color
[3] );
53 static void notifyImpact ( Garbage
&garbage
);
54 static void notifyShatter ( Garbage
&garbage
);
56 static inline bool reverseControls ( )
58 return reverse_controls
!= 0;
61 static inline bool invisibleSwapper ( )
63 return swapper_alpha
!= GC_INVISIBLE_MAX_ALPHA
;
66 static inline bool needDrawSwapper ( )
68 return swapper_alpha
> 0;
71 static inline GLfloat
swapperAlpha ( )
73 assert(needDrawSwapper());
74 return swapper_alpha
* (1.0f
/ (float) GC_INVISIBLE_MAX_ALPHA
);
77 static inline bool crazyLights ( )
79 return light_mode
!= -1 && (light_mode
& (1 << 0));
82 static inline bool wildActive ( )
84 return wild_count
!= 0;
87 static inline bool wildAllowed ( )
89 return wild_count
!= GC_MAX_WILD_NUMBER
;
92 static inline void activateWild ( Block
&block
)
94 assert(wildAllowed());
97 for (n
= 0; wilds
[n
].active
; n
++);
101 wilds
[n
].active
= true;
102 wilds
[n
].block
= &block
;
103 wilds
[n
].flavor
= Random::number(BF_WILD
+ 1);
104 wilds
[n
].alarm
= 180;
109 static inline int wildFlavor ( Block
&block
)
111 assert(block
.flavor
== BF_WILD
);
113 if (wilds
[block
.X
].alarm
>= GC_WILD_POLYMORPH_PERIOD
)
114 return wilds
[block
.X
].flavor
;
119 static inline Wild
&wild ( Block
&block
)
121 assert(block
.flavor
== BF_WILD
);
123 return wilds
[block
.X
];
126 static inline void deactivateWild ( Block
&block
)
128 assert(block
.flavor
== BF_WILD
);
130 wilds
[block
.X
].active
= false;
134 static inline bool specialColorActive ( )
136 return special_color_count
!= 0;
139 static inline bool specialColorAllowed ( )
141 return special_color_count
!= GC_MAX_SPECIAL_COLOR_NUMBER
;
144 static inline void activateSpecialColor ( Block
&block
)
146 assert(specialColorAllowed());
148 // sloppy but effective way of insuring each special color block's gleam
150 block
.X
= Random::number2((1 << 20));
151 special_color_count
++;
154 static inline void deactivateSpecialColor ( )
156 special_color_count
--;
159 static int reverse_controls
;
160 static int invisible_swapper
;
161 static int crazy_lights
;
163 static int swapper_alpha
;
165 static int light_mode
;
166 static int light_alarm
;
167 static const GLfloat light_level_map
[6][3];
169 static int wild_count
;
170 static Wild wilds
[GC_MAX_WILD_NUMBER
];
172 static int special_color_count
;