2 // C Implementation: world
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
9 // Copyright: See COPYING file that comes with this distribution
21 void bouncy_distro_action(bouncy_distro_type* pbouncy_distro)
23 if (pbouncy_distro->base.alive)
25 pbouncy_distro->base.y = pbouncy_distro->base.y + pbouncy_distro->base.ym;
27 pbouncy_distro->base.ym++;
29 if (pbouncy_distro->base.ym >= 0)
30 pbouncy_distro->base.alive = NO;
34 void bouncy_distro_draw(bouncy_distro_type* pbouncy_distro)
36 if (pbouncy_distro->base.alive)
38 texture_draw(&img_distro[0],
39 pbouncy_distro->base.x - scroll_x,
40 pbouncy_distro->base.y,
45 void broken_brick_action(broken_brick_type* pbroken_brick)
47 if (pbroken_brick->base.alive)
49 pbroken_brick->base.x = pbroken_brick->base.x + pbroken_brick->base.xm;
50 pbroken_brick->base.y = pbroken_brick->base.y + pbroken_brick->base.ym;
52 pbroken_brick->base.ym++;
54 if (pbroken_brick->base.ym >= 0)
55 pbroken_brick->base.alive = NO;
59 void broken_brick_draw(broken_brick_type* pbroken_brick)
61 if (pbroken_brick->base.alive)
68 dest.x = pbroken_brick->base.x - scroll_x;
69 dest.y = pbroken_brick->base.y;
73 SDL_BlitSurface(img_brick[0].sdl_surface, &src, screen, &dest);
77 void bouncy_brick_action(bouncy_brick_type* pbouncy_brick)
79 if (pbouncy_brick->base.alive)
81 pbouncy_brick->offset = (pbouncy_brick->offset +
82 pbouncy_brick->offset_m);
86 if (pbouncy_brick->offset < -BOUNCY_BRICK_MAX_OFFSET)
87 pbouncy_brick->offset_m = BOUNCY_BRICK_SPEED;
92 if (pbouncy_brick->offset == 0)
93 pbouncy_brick->base.alive = NO;
97 void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick)
99 if (pbouncy_brick->base.alive)
101 if (pbouncy_brick->base.x >= scroll_x - 32 &&
102 pbouncy_brick->base.x <= scroll_x + screen->w)
104 dest.x = pbouncy_brick->base.x - scroll_x;
105 dest.y = pbouncy_brick->base.y;
109 SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format,
110 current_level.bkgd_red,
111 current_level.bkgd_green,
112 current_level.bkgd_blue));
114 drawshape(pbouncy_brick->base.x - scroll_x,
115 pbouncy_brick->base.y + pbouncy_brick->offset,
116 pbouncy_brick->shape);
121 void floating_score_init(floating_score_type* pfloating_score, int x, int y, int s)
123 pfloating_score->base.alive = YES;
124 pfloating_score->base.x = x;
125 pfloating_score->base.y = y - 16;
126 timer_start(&pfloating_score->timer,1000);
127 pfloating_score->value = s;
130 void floating_score_action(floating_score_type* pfloating_score)
132 if (pfloating_score->base.alive)
134 pfloating_score->base.y = pfloating_score->base.y - 2;
136 if(!timer_check(&pfloating_score->timer))
137 pfloating_score->base.alive = NO;
141 void floating_score_draw(floating_score_type* pfloating_score)
143 if (pfloating_score->base.alive)
146 sprintf(str, "%d", pfloating_score->value);
148 pfloating_score->base.x + 16 - strlen(str) * 8,
149 pfloating_score->base.y,
150 letters_gold, NO_UPDATE, 1);