Fix for the problem that SDL applications exited
[AROS-Contrib.git] / Games / lbreakout2 / client / extras.c
blob209d60f0b37eed34b5bf3a3fd414716383f330dd
1 /***************************************************************************
2 extras.c - description
3 -------------------
4 begin : Sun Sep 9 2001
5 copyright : (C) 2001 by Michael Speck
6 email : kulkanie@gmx.net
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #include "lbreakout.h"
19 #include "../game/game.h"
20 #include "bricks.h"
21 #include "shrapnells.h"
22 #include "player.h"
23 #include "paddle.h"
24 #include "frame.h"
26 extern Player *cur_player;
27 extern SDL_Surface *stk_display;
28 extern SDL_Rect stk_drect;
29 extern SDL_Surface *offscreen;
30 extern SDL_Surface *bkgnd; /* background + frame */
31 extern SDL_Surface *offscreen_backup;
32 extern int ball_w, ball_dia;
33 extern SDL_Surface *brick_pic;
34 extern Brick bricks[MAP_WIDTH][MAP_HEIGHT];
35 extern SDL_Surface *extra_pic; /* graphics */
36 extern SDL_Surface *extra_shadow;
37 extern SDL_Surface *paddle_pic, *weapon_pic;
38 extern SDL_Surface *ball_pic;
39 extern SDL_Surface *shot_pic;
40 extern StkFont *display_font;
41 extern SDL_Surface *wall_pic;
42 extern int shadow_size;
43 #ifdef AUDIO_ENABLED
44 extern StkSound *wav_score, *wav_metal, *wav_std, *wav_wall, *wav_joker;
45 extern StkSound *wav_goldshower, *wav_life_up;
46 extern StkSound *wav_speedup, *wav_speeddown;
47 extern StkSound *wav_chaos, *wav_darkness, *wav_ghost;
48 extern StkSound *wav_timeadd, *wav_expl_ball, *wav_weak_ball;
49 extern StkSound *wav_bonus_magnet, *wav_malus_magnet, *wav_disable;
50 extern StkSound *wav_attach; /* handled by balls.c */
51 extern StkSound *wav_expand, *wav_shrink, *wav_frozen;
52 #endif
53 extern Game *game; /* client game context */
54 extern int paddle_ch;
55 extern int ball_pic_x_offset;
58 ====================================================================
59 Locals
60 ====================================================================
64 ====================================================================
65 Public
66 ====================================================================
69 /* Play sounds and handle graphical effects. */
70 void client_handle_collected_extra( Paddle *paddle, int extra_type )
72 int i, j;
73 #ifdef AUDIO_ENABLED
74 int px = paddle->x+(paddle->w>>1);
75 #endif
76 Extra *ex;
78 switch (extra_type) {
79 case EX_JOKER:
80 #ifdef AUDIO_ENABLED
81 stk_sound_play_x( px, wav_joker );
82 #endif
83 list_reset( game->extras );
84 while ( ( ex = list_next( game->extras ) ) ) {
85 stk_display_store_rect( &ex->update_rect );
86 list_delete_current( game->extras );
88 break;
89 case EX_SCORE200:
90 case EX_SCORE500:
91 case EX_SCORE1000:
92 case EX_SCORE2000:
93 case EX_SCORE5000:
94 case EX_SCORE10000:
95 #ifdef AUDIO_ENABLED
96 stk_sound_play_x( px, wav_score );
97 #endif
98 break;
99 case EX_GOLDSHOWER:
100 paddle->extra_time[EX_GOLDSHOWER] += TIME_GOLDSHOWER;
101 paddle->extra_active[EX_GOLDSHOWER] = 1;
102 #ifdef AUDIO_ENABLED
103 stk_sound_play_x( px, wav_goldshower );
104 #endif
105 break;
106 case EX_LIFE:
107 if ( game->game_type == GT_LOCAL ) {
108 if ( paddle->player->lives < game->diff->max_lives ) {
109 paddle->player->lives++;
110 frame_add_life();
113 break;
114 case EX_SHORTEN:
115 #ifdef AUDIO_ENABLED
116 stk_sound_play_x( px, wav_shrink );
117 #endif
118 paddle_init_resize( paddle, -1);
119 break;
120 case EX_LENGTHEN:
121 #ifdef AUDIO_ENABLED
122 stk_sound_play_x( px, wav_expand );
123 #endif
124 paddle_init_resize( paddle, 1);
125 break;
126 case EX_BALL:
127 #ifdef AUDIO_ENABLED
128 stk_sound_play_x( px, wav_std );
129 #endif
130 break;
131 case EX_WALL:
132 paddle->extra_time[EX_WALL] += TIME_WALL;
133 if ( paddle->extra_active[EX_WALL] ) {
134 #ifdef AUDIO_ENABLED
135 stk_sound_play_x( px, wav_std );
136 #endif
137 break;
139 paddle->extra_active[extra_type] = 1;
140 paddle->wall_alpha = 0;
141 #ifdef AUDIO_ENABLED
142 stk_sound_play_x( px, wav_wall );
143 #endif
144 break;
145 case EX_METAL:
146 game->extra_time[EX_METAL] += TIME_METAL;
147 game->extra_active[extra_type] = 1;
148 ball_pic_x_offset = ball_w;
149 #ifdef AUDIO_ENABLED
150 stk_sound_play_x( px, wav_metal );
151 #endif
152 /* other ball extras are disabled */
153 if ( game->extra_active[EX_EXPL_BALL] ) {
154 game->extra_active[EX_EXPL_BALL] = 0;
155 game->extra_time[EX_EXPL_BALL] = 0;
157 if ( game->extra_active[EX_WEAK_BALL] ) {
158 game->extra_active[EX_WEAK_BALL] = 0;
159 game->extra_time[EX_WEAK_BALL] = 0;
161 break;
162 case EX_FROZEN:
163 paddle->extra_time[EX_FROZEN] = TIME_FROZEN;
164 paddle->extra_active[extra_type] = 1;
165 paddle->pic_y_offset = paddle_ch*2;
166 paddle->frozen = 1; /* the server sided paddle is blocked
167 so does the same with the local copy */
168 #ifdef AUDIO_ENABLED
169 stk_sound_play_x( px, wav_frozen );
170 #endif
171 break;
172 case EX_WEAPON:
173 paddle->extra_time[EX_WEAPON] += TIME_WEAPON;
174 paddle->extra_active[extra_type] = 1;
175 weapon_install( paddle, 1 );
176 #ifdef AUDIO_ENABLED
177 stk_sound_play_x( px, wav_std );
178 #endif
179 break;
180 case EX_SLIME:
181 paddle->extra_time[EX_SLIME] += TIME_SLIME;
182 paddle->extra_active[extra_type] = 1;
183 if ( !paddle->frozen )
184 paddle->pic_y_offset = paddle_ch;
185 #ifdef AUDIO_ENABLED
186 stk_sound_play_x( px, wav_attach );
187 #endif
188 break;
189 case EX_FAST:
190 #ifdef AUDIO_ENABLED
191 stk_sound_play_x( px, wav_speedup );
192 #endif
193 if ( game->extra_active[EX_SLOW] ) {
194 game->extra_time[EX_SLOW] = 0;
195 game->extra_active[EX_SLOW] = 0;
197 game->extra_time[EX_FAST] += TIME_FAST;
198 game->extra_active[extra_type] = 1;
199 break;
200 case EX_SLOW:
201 #ifdef AUDIO_ENABLED
202 stk_sound_play_x( px, wav_speeddown );
203 #endif
204 if ( game->extra_active[EX_FAST] ) {
205 game->extra_time[EX_FAST] = 0;
206 game->extra_active[EX_FAST] = 0;
208 game->extra_time[EX_SLOW] += TIME_SLOW;
209 game->extra_active[extra_type] = 1;
210 break;
211 case EX_CHAOS:
212 #ifdef AUDIO_ENABLED
213 stk_sound_play_x( px, wav_chaos );
214 #endif
215 game->extra_time[EX_CHAOS] += TIME_CHAOS;
216 game->extra_active[extra_type] = 1;
217 break;
218 case EX_DARKNESS:
219 #ifdef AUDIO_ENABLED
220 stk_sound_play_x( px, wav_darkness );
221 #endif
222 game->extra_time[EX_DARKNESS] += TIME_DARKNESS;
223 if ( game->extra_active[EX_DARKNESS] ) break;
224 /* backup offscreen and turn it black */
225 stk_surface_fill( offscreen, 0,0,-1,-1, 0x0 );
226 stk_surface_fill( stk_display, 0,0,-1,-1, 0x0 );
227 stk_display_store_rect( 0 );
228 /* set alpha keys to 128 */
229 SDL_SetAlpha( paddle_pic, SDL_SRCALPHA, 128 );
230 SDL_SetAlpha( weapon_pic, SDL_SRCALPHA, 128 );
231 SDL_SetAlpha( extra_pic, SDL_SRCALPHA, 128 );
232 SDL_SetAlpha( ball_pic, SDL_SRCALPHA, 128 );
233 SDL_SetAlpha( shot_pic, SDL_SRCALPHA, 128 );
234 SDL_SetAlpha( display_font->surface, SDL_SRCALPHA, 128 );
235 /* use dark explosions */
236 exps_set_dark( 1 );
237 game->extra_active[extra_type] = 1;
238 break;
239 case EX_GHOST_PADDLE:
240 #ifdef AUDIO_ENABLED
241 stk_sound_play_x( px, wav_ghost );
242 #endif
243 paddle->extra_time[EX_GHOST_PADDLE] += TIME_GHOST_PADDLE;
244 paddle->extra_active[extra_type] = 1;
245 paddle_set_invis( paddle, 1 );
246 break;
247 case EX_TIME_ADD:
248 #ifdef AUDIO_ENABLED
249 stk_sound_play_x( px, wav_timeadd );
250 #endif
251 for ( i = 0; i < EX_NUMBER; i++ )
252 if ( game->extra_time[i] )
253 game->extra_time[i] += 7000;
254 for ( i = 0; i < EX_NUMBER; i++ ) {
255 for ( j = 0; j < game->paddle_count; j++ )
256 if ( game->paddles[j]->extra_time[i] )
257 game->paddles[j]->extra_time[i] += 7000;
259 break;
260 case EX_EXPL_BALL:
261 #ifdef AUDIO_ENABLED
262 stk_sound_play_x( px, wav_expl_ball );
263 #endif
264 ball_pic_x_offset = ball_w*2;
265 game->extra_time[EX_EXPL_BALL] += TIME_EXPL_BALL;
266 game->extra_active[extra_type] = 1;
267 /* other ball extras are disabled */
268 if ( game->extra_active[EX_METAL] ) {
269 game->extra_active[EX_METAL] = 0;
270 game->extra_time[EX_METAL] = 0;
272 if ( game->extra_active[EX_WEAK_BALL] ) {
273 game->extra_active[EX_WEAK_BALL] = 0;
274 game->extra_time[EX_WEAK_BALL] = 0;
276 break;
277 case EX_WEAK_BALL:
278 #ifdef AUDIO_ENABLED
279 stk_sound_play_x( px, wav_weak_ball );
280 #endif
281 ball_pic_x_offset = ball_w*3;
282 game->extra_time[EX_WEAK_BALL] += TIME_WEAK_BALL;
283 game->extra_active[extra_type] = 1;
284 /* other ball extras are disabled */
285 if ( game->extra_active[EX_METAL] ) {
286 game->extra_active[EX_METAL] = 0;
287 game->extra_time[EX_METAL] = 0;
289 if ( game->extra_active[EX_EXPL_BALL] ) {
290 game->extra_active[EX_EXPL_BALL] = 0;
291 game->extra_time[EX_EXPL_BALL] = 0;
293 break;
294 case EX_BONUS_MAGNET:
295 #ifdef AUDIO_ENABLED
296 stk_sound_play_x( px, wav_bonus_magnet );
297 #endif
298 paddle_set_attract( paddle, ATTRACT_BONUS );
299 paddle->extra_time[EX_BONUS_MAGNET] += TIME_BONUS_MAGNET;
300 paddle->extra_active[extra_type] = 1;
301 if ( paddle->extra_active[EX_MALUS_MAGNET] ) {
302 paddle->extra_active[EX_MALUS_MAGNET] = 0;
303 paddle->extra_time[EX_MALUS_MAGNET] = 0;
305 break;
306 case EX_MALUS_MAGNET:
307 #ifdef AUDIO_ENABLED
308 stk_sound_play_x( px, wav_malus_magnet );
309 #endif
310 paddle_set_attract( paddle, ATTRACT_MALUS );
311 paddle->extra_time[EX_MALUS_MAGNET] += TIME_MALUS_MAGNET;
312 paddle->extra_active[extra_type] = 1;
313 if ( paddle->extra_active[EX_BONUS_MAGNET] ) {
314 paddle->extra_active[EX_BONUS_MAGNET] = 0;
315 paddle->extra_time[EX_BONUS_MAGNET] = 0;
317 break;
318 case EX_DISABLE:
319 #ifdef AUDIO_ENABLED
320 stk_sound_play_x( px, wav_disable );
321 #endif
322 /* set all active extra times to 1 so they will expire next
323 prog cycle */
324 for ( i = 0; i < EX_NUMBER; i++ )
325 if ( game->extra_time[i] )
326 game->extra_time[i] = 1;
327 for ( i = 0; i < EX_NUMBER; i++ ) {
328 for ( j = 0; j < game->paddle_count; j++ )
329 if ( game->paddles[j]->extra_time[i] )
330 game->paddles[j]->extra_time[i] = 1;
332 break;
336 ====================================================================
337 Show, hide extras
338 ====================================================================
340 void extras_hide()
342 ListEntry *entry = game->extras->head->next;
343 Extra *ex;
344 while ( entry != game->extras->tail ) {
345 ex = entry->item;
346 entry = entry->next;
347 stk_surface_blit( offscreen,
348 (int)ex->x, (int)ex->y,
349 BRICK_WIDTH + shadow_size, BRICK_HEIGHT + shadow_size,
350 stk_display, (int)ex->x, (int)ex->y );
351 ex->update_rect = stk_drect;
352 stk_display_store_rect( &ex->update_rect );
355 void extras_show_shadow()
357 ListEntry *entry = game->extras->head->next;
358 Extra *extra;
359 while ( entry != game->extras->tail ) {
360 extra = entry->item;
361 stk_surface_clip( stk_display, 0,0,
362 stk_display->w - BRICK_WIDTH, stk_display->h );
363 stk_surface_alpha_blit(
364 extra_shadow, extra->type * BRICK_WIDTH, 0,
365 BRICK_WIDTH, BRICK_HEIGHT,
366 stk_display, (int)extra->x + shadow_size, (int)extra->y + shadow_size,
367 ((int)extra->alpha)>>1 );
368 stk_surface_clip( stk_display, 0,0,-1,-1 );
369 entry = entry->next;
372 void extras_show()
374 ListEntry *entry = game->extras->head->next;
375 Extra *ex;
376 int x, y;
377 while ( entry != game->extras->tail ) {
378 ex = entry->item;
379 entry = entry->next;
380 x = (int)ex->x; y = (int)ex->y;
381 stk_surface_alpha_blit( extra_pic, ex->offset, 0,
382 BRICK_WIDTH, BRICK_HEIGHT, stk_display, x, y, ex->alpha );
383 #if 0
384 if ( x < ex->update_rect.x ) {
385 /* movement to left */
386 ex->update_rect.w += ex->update_rect.x - x;
387 ex->update_rect.x = x;
389 else
390 /* movement to right */
391 ex->update_rect.w += x - ex->update_rect.x;
392 if ( ex->dir == -1 ) {
393 /* movement up */
394 ex->update_rect.h += ex->update_rect.y - y;
395 ex->update_rect.y = y;
396 if ( ex->update_rect.y < 0 ) {
397 ex->update_rect.h += ex->update_rect.y;
398 ex->update_rect.y = 0;
401 else {
402 /* movement down */
403 ex->update_rect.h += y - ex->update_rect.y;
404 if ( ex->update_rect.y + ex->update_rect.h >= stk_display->h )
405 ex->update_rect.h = stk_display->h - ex->update_rect.y;
407 stk_display_store_rect( &ex->update_rect );
408 #endif
409 ex->update_rect.x = x;
410 ex->update_rect.y = y;
411 ex->update_rect.w = BRICK_WIDTH + shadow_size;
412 ex->update_rect.h = BRICK_HEIGHT + shadow_size;
413 stk_display_store_rect( &ex->update_rect );
416 void extras_alphashow( int alpha )
418 ListEntry *entry = game->extras->head->next;
419 Extra *ex;
420 int x, y;
421 while ( entry != game->extras->tail ) {
422 ex = entry->item;
423 x = (int)ex->x;
424 y = (int)ex->y;
425 stk_surface_alpha_blit( extra_pic, ex->type * BRICK_WIDTH, 0,
426 BRICK_WIDTH, BRICK_HEIGHT, stk_display, x, y, alpha );
427 stk_display_store_rect( &ex->update_rect );
428 entry = entry->next;
432 /* move the extras as in extras_update but do not collect them */
433 void client_extras_update( int ms )
435 Extra *ex;
436 int i, j;
437 int magnets;
438 Paddle *magnet;
440 /* check extra_time of limited extras */
441 /* general extras */
442 for ( i = 0; i < EX_NUMBER; i++ )
443 if ( game->extra_time[i] ) {
444 if ( (game->extra_time[i] -= ms) <= 0 ) {
445 game->extra_time[i] = 0;
446 /* expired */
447 switch ( i ) {
448 case EX_EXPL_BALL:
449 case EX_WEAK_BALL:
450 case EX_METAL:
451 ball_pic_x_offset = 0;
452 break;
453 case EX_DARKNESS:
454 /* restore offscreen */
455 stk_surface_blit( bkgnd, 0,0,-1,-1, offscreen, 0,0 );
456 bricks_draw();
457 if ( game->game_type == GT_LOCAL )
458 frame_draw_lives( cur_player->lives,
459 game->diff->max_lives );
460 /* back to screen */
461 stk_surface_blit(
462 offscreen, 0,0,-1,-1,
463 stk_display, 0,0 );
464 stk_display_store_rect( 0 );
465 /* set alpha keys to OPAQUE */
466 SDL_SetAlpha( paddle_pic, 0,0 );
467 SDL_SetAlpha( extra_pic, 0,0 );
468 SDL_SetAlpha( ball_pic, 0,0 );
469 SDL_SetAlpha( shot_pic, 0,0 );
470 SDL_SetAlpha( display_font->surface, 0,0 );
471 /* use bright explosions */
472 exps_set_dark( 0 );
473 break;
475 /* set deactivated */
476 game->extra_active[i] = 0;
479 /* paddlized extras */
480 for ( j = 0; j < game->paddle_count; j++ )
481 for ( i = 0; i < EX_NUMBER; i++ )
482 /* extra_time of wall is updated in client_walls_update() */
483 if ( game->paddles[j]->extra_time[i] && i != EX_WALL )
484 if ( (game->paddles[j]->extra_time[i] -= ms) <= 0 ) {
485 game->paddles[j]->extra_time[i] = 0;
486 /* expired */
487 switch ( i ) {
488 case EX_FROZEN:
489 case EX_SLIME:
490 if ( game->paddles[j]->extra_time[EX_SLIME] > 0 )
491 game->paddles[j]->pic_y_offset = paddle_ch;
492 else
493 game->paddles[j]->pic_y_offset = 0;
494 game->paddles[j]->frozen = 0;
495 break;
496 case EX_WEAPON:
497 weapon_install( game->paddles[j], 0 );
498 break;
499 case EX_GHOST_PADDLE:
500 paddle_set_invis( game->paddles[j], 0 );
501 break;
502 case EX_BONUS_MAGNET:
503 case EX_MALUS_MAGNET:
504 paddle_set_attract( game->paddles[j], ATTRACT_NONE );
505 break;
507 /* set deactivated */
508 game->paddles[j]->extra_active[i] = 0; /* wall is handled in wall_...() */
511 /* move extras and check if paddle was hit */
512 list_reset( game->extras );
513 while ( ( ex = list_next( game->extras ) ) ) {
514 /* if only one paddle has a magnet active all extras will
515 * be attracted by this paddle else the extras 'dir' is used
517 magnets = 0; magnet = 0;
518 for ( i = 0; i < game->paddle_count; i++ )
519 if ( paddle_check_attract( game->paddles[i], ex->type ) ) {
520 magnets++;
521 magnet = game->paddles[i]; /* last magnet */
523 if ( magnets != 1 ) {
524 /* either no or more than one magnet so use default */
525 if ( ex->dir > 0 )
526 ex->y += 0.05 * ms;
527 else
528 ex->y -= 0.05 * ms;
530 else {
531 /* 'magnet' is the paddle that will attract this extra */
532 if ( magnet->type == PADDLE_TOP )
533 ex->y -= 0.05 * ms;
534 else
535 ex->y += 0.05 * ms;
536 if ( ex->x + ( BRICK_WIDTH >> 1 ) < magnet->x + ( magnet->w >> 1 ) ) {
537 ex->x += 0.05 * ms;
538 if ( ex->x + ( BRICK_WIDTH >> 1 ) > magnet->x + ( magnet->w >> 1 ) )
539 ex->x = magnet->x + ( magnet->w >> 1 ) - ( BRICK_WIDTH >> 1 );
541 else {
542 ex->x -= 0.05 * ms;
543 if ( ex->x + ( BRICK_WIDTH >> 1 ) < magnet->x + ( magnet->w >> 1 ) )
544 ex->x = magnet->x + ( magnet->w >> 1 ) - ( BRICK_WIDTH >> 1 );
547 if ( !game->extra_active[EX_DARKNESS] ) {
548 if ( ex->alpha < 255 ) {
549 ex->alpha += 0.25 * ms;
550 if (ex->alpha > 255)
551 ex->alpha = 255;
554 else {
555 if ( ex->alpha < 128 ) {
556 ex->alpha += 0.25 * ms;
557 if (ex->alpha > 128)
558 ex->alpha = 128;
561 /* if out of screen forget this extra */
562 if ( ex->y >= stk_display->h || ex->y + BRICK_HEIGHT < 0 ) {
563 stk_display_store_rect( &ex->update_rect );
564 list_delete_current( game->extras );
565 continue;
567 for ( j = 0; j < game->paddle_count; j++ ) {
568 /* contact with paddle core ? */
569 if ( paddle_solid( game->paddles[j] ) )
570 if ( ex->x + BRICK_WIDTH > game->paddles[j]->x )
571 if ( ex->x < game->paddles[j]->x + game->paddles[j]->w - 1 )
572 if ( ex->y + BRICK_HEIGHT > game->paddles[j]->y )
573 if ( ex->y < game->paddles[j]->y + game->paddles[j]->h ) {
574 /* remove extra but don't handle it */
575 stk_display_store_rect( &ex->update_rect );
576 list_delete_current( game->extras );
582 /* wall */
583 void walls_hide()
585 int j;
586 for ( j = 0; j < game->paddle_count; j++ )
587 if ( game->paddles[j]->extra_active[EX_WALL] ) {
588 stk_surface_blit( offscreen, BRICK_WIDTH, game->paddles[j]->wall_y,
589 wall_pic->w, wall_pic->h,
590 stk_display, BRICK_WIDTH, game->paddles[j]->wall_y );
591 stk_display_store_drect();
594 void walls_show()
596 int j;
597 for ( j = 0; j < game->paddle_count; j++ )
598 if ( game->paddles[j]->extra_active[EX_WALL] )
599 stk_surface_alpha_blit( wall_pic, 0,0,
600 wall_pic->w, wall_pic->h,
601 stk_display, BRICK_WIDTH, game->paddles[j]->wall_y,
602 (int)game->paddles[j]->wall_alpha );
604 void walls_alphashow( int alpha )
606 int j;
607 for ( j = 0; j < game->paddle_count; j++ )
608 if ( game->paddles[j]->extra_active[EX_WALL] )
609 stk_surface_alpha_blit( wall_pic, 0,0,
610 wall_pic->w, wall_pic->h,
611 stk_display, BRICK_WIDTH, game->paddles[j]->wall_y,
612 alpha );
614 void client_walls_update( int ms )
616 int j;
618 for ( j = 0; j < game->paddle_count; j++ )
619 if ( game->paddles[j]->extra_active[EX_WALL] ) {
620 if ( game->paddles[j]->extra_time[EX_WALL] > 0 ) {
621 if ( (game->paddles[j]->extra_time[EX_WALL] -= ms) < 0 )
622 game->paddles[j]->extra_time[EX_WALL] = 0;
623 /* still appearing? */
624 if (game->paddles[j]->wall_alpha < 255)
625 if ( (game->paddles[j]->wall_alpha += 0.25 * ms) > 255 )
626 game->paddles[j]->wall_alpha = 255;
628 else
629 if ( (game->paddles[j]->wall_alpha -= 0.25 * ms) < 0 ) {
630 game->paddles[j]->wall_alpha = 0;
631 game->paddles[j]->extra_active[EX_WALL] = 0;