X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fworld.c;h=7e7c4e6eaa7fc0b6a5ba9df63cfb5478409ba9d8;hb=416e3a38d49f534ba8b65a63723bdb33ec018c68;hp=0afcff486eeb01ec7d872e3f947c6f4b31c41fa1;hpb=15c2cb4042be5bbbf3e48bf1184d7fef62b1e9fa;p=supertux.git diff --git a/src/world.c b/src/world.c index 0afcff486..7e7c4e6ea 100644 --- a/src/world.c +++ b/src/world.c @@ -18,22 +18,23 @@ #include "defines.h" #include "world.h" +texture_type img_distro[4]; void bouncy_distro_init(bouncy_distro_type* pbouncy_distro, float x, float y) { pbouncy_distro->base.alive = YES; pbouncy_distro->base.x = x; pbouncy_distro->base.y = y; - pbouncy_distro->base.ym = -6; + pbouncy_distro->base.ym = -2; } void bouncy_distro_action(bouncy_distro_type* pbouncy_distro) { if (pbouncy_distro->base.alive) { - pbouncy_distro->base.y = pbouncy_distro->base.y + pbouncy_distro->base.ym; + pbouncy_distro->base.y = pbouncy_distro->base.y + pbouncy_distro->base.ym * frame_ratio; - pbouncy_distro->base.ym++; + pbouncy_distro->base.ym += 0.1 * frame_ratio; if (pbouncy_distro->base.ym >= 0) pbouncy_distro->base.alive = NO; @@ -58,6 +59,7 @@ void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float pbroken_brick->base.y = y; pbroken_brick->base.xm = xm; pbroken_brick->base.ym = ym; + timer_init(&pbroken_brick->timer,YES); timer_start(&pbroken_brick->timer,200); } @@ -75,6 +77,7 @@ void broken_brick_action(broken_brick_type* pbroken_brick) void broken_brick_draw(broken_brick_type* pbroken_brick) { +SDL_Rect src, dest; if (pbroken_brick->base.alive) { src.x = rand() % 16; @@ -82,8 +85,8 @@ void broken_brick_draw(broken_brick_type* pbroken_brick) src.w = 16; src.h = 16; - dest.x = pbroken_brick->base.x - scroll_x; - dest.y = pbroken_brick->base.y; + dest.x = (int)(pbroken_brick->base.x - scroll_x); + dest.y = (int)pbroken_brick->base.y; dest.w = 16; dest.h = 16; @@ -126,25 +129,26 @@ void bouncy_brick_action(bouncy_brick_type* pbouncy_brick) void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick) { int s; - + SDL_Rect dest; + if (pbouncy_brick->base.alive) { if (pbouncy_brick->base.x >= scroll_x - 32 && pbouncy_brick->base.x <= scroll_x + screen->w) { - dest.x = pbouncy_brick->base.x - scroll_x; - dest.y = pbouncy_brick->base.y; + dest.x = (int)(pbouncy_brick->base.x - scroll_x); + dest.y = (int)pbouncy_brick->base.y; dest.w = 32; dest.h = 32; if(current_level.bkgd_image[0] == '\0') { fillrect(pbouncy_brick->base.x - scroll_x,pbouncy_brick->base.y,32,32,current_level.bkgd_red,current_level.bkgd_green, - current_level.bkgd_blue); + current_level.bkgd_blue,0); } else { - s = scroll_x / 30; + s = (int)scroll_x / 30; texture_draw_part(&img_bkgd,dest.x + s,dest.y,dest.x,dest.y,dest.w,dest.h,NO_UPDATE); } @@ -160,6 +164,7 @@ void floating_score_init(floating_score_type* pfloating_score, float x, float y, pfloating_score->base.alive = YES; pfloating_score->base.x = x; pfloating_score->base.y = y - 16; + timer_init(&pfloating_score->timer,YES); timer_start(&pfloating_score->timer,1000); pfloating_score->value = s; } @@ -181,7 +186,7 @@ void floating_score_draw(floating_score_type* pfloating_score) { char str[10]; sprintf(str, "%d", pfloating_score->value); - text_draw(&gold_text, str, pfloating_score->base.x + 16 - strlen(str) * 8, pfloating_score->base.y, 1, NO_UPDATE); + text_draw(&gold_text, str, (int)pfloating_score->base.x + 16 - strlen(str) * 8, (int)pfloating_score->base.y, 1, NO_UPDATE); } }