// Description:
//
//
-// Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
+// Author: Tobias Glaesser <tobi.web@gmx.de> & Bill Kendrick, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
bm_bullet = bitmask_create_SDL(img_bullet.sdl_surface);
}
-void bullet_init(bullet_type* pbullet)
+void bullet_init(bullet_type* pbullet, float x, float y, float xm, int dir)
{
pbullet->base.width = 4;
pbullet->base.height = 4;
- pbullet->base.updated = SDL_GetTicks();
- pbullet->base.alive = NO;
+ pbullet->base.alive = YES;
+
+ if (dir == RIGHT)
+ {
+ pbullet->base.x = x + 32;
+ pbullet->base.xm = BULLET_XM + xm;
+ }
+ else
+ {
+ pbullet->base.x = x;
+ pbullet->base.xm = -BULLET_XM + xm;
+ }
+
+ pbullet->base.y = y;
+ pbullet->base.ym = BULLET_STARTING_YM;
}
void bullet_action(bullet_type* pbullet)
{
-
- double frame_ratio = get_frame_ratio(&pbullet->base);
-
if (pbullet->base.alive)
{
pbullet->base.x = pbullet->base.x + pbullet->base.xm * frame_ratio;
}
-void upgrade_init(upgrade_type *pupgrade)
+void upgrade_init(upgrade_type *pupgrade, float x, float y, int kind)
{
pupgrade->base.width = 32;
pupgrade->base.height = 0;
- pupgrade->base.updated = SDL_GetTicks();
- pupgrade->base.alive = NO;
+ pupgrade->base.alive = YES;
+ pupgrade->kind = kind;
+ pupgrade->base.x = x;
+ pupgrade->base.y = y;
+ pupgrade->base.xm = 2;
+ pupgrade->base.ym = -2;
+ pupgrade->base.height = 0;
}
void upgrade_action(upgrade_type *pupgrade)
{
- double frame_ratio = get_frame_ratio(&pupgrade->base);
if (pupgrade->base.alive)
{
{
/* Rise up! */
- pupgrade->base.height++;
+ pupgrade->base.height = pupgrade->base.height + 0.7 * frame_ratio;
+ if(pupgrade->base.height > 32)
+ pupgrade->base.height = 32;
}
else
{
}
else if (pupgrade->kind == UPGRADE_HERRING)
{
- pupgrade->base.ym = -24;
+ pupgrade->base.ym = -8;
}
pupgrade->base.y = (int)(pupgrade->base.y / 32) * 32;
/* Off the screen? Kill it! */
- if (pupgrade->base.x < scroll_x)
+ if (pupgrade->base.x < scroll_x - pupgrade->base.width)
pupgrade->base.alive = NO;
-
- }
+
+ }
}
}
dest.w = 32;
dest.h = pupgrade->base.height;
- src.x = 0;
- src.y = 0;
- src.w = 32;
- src.h = pupgrade->base.height;
-
if (pupgrade->kind == UPGRADE_MINTS)
- SDL_BlitSurface(img_mints.sdl_surface, &src, screen, &dest);
+ texture_draw_part(&img_mints,0,0,dest.x,dest.y,dest.w,dest.h,NO_UPDATE);
else if (pupgrade->kind == UPGRADE_COFFEE)
- SDL_BlitSurface(img_coffee.sdl_surface, &src, screen, &dest);
+ texture_draw_part(&img_coffee,0,0,dest.x,dest.y,dest.w,dest.h,NO_UPDATE);
else if (pupgrade->kind == UPGRADE_HERRING)
- SDL_BlitSurface(img_golden_herring.sdl_surface, &src, screen, &dest);
+ texture_draw_part(&img_golden_herring,0,0,dest.x,dest.y,dest.w,dest.h,NO_UPDATE);
}
else
{
void upgrade_collision(upgrade_type* pupgrade, void* p_c_object, int c_object)
{
-player_type* pplayer = NULL;
+ player_type* pplayer = NULL;
switch (c_object)
{
/* p_c_object is CO_PLAYER, so assign it to pplayer */
pplayer = p_c_object;
-
+
pupgrade->base.alive = NO;
/* Affect the player: */
{
play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
pplayer->size = BIG;
- super_bkgd_time = 8;
+ timer_start(&super_bkgd_timer, 350);
}
else if (pupgrade->kind == UPGRADE_COFFEE)
{
play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
pplayer->got_coffee = YES;
- super_bkgd_time = 4;
+ timer_start(&super_bkgd_timer, 250);
}
else if (pupgrade->kind == UPGRADE_HERRING)
{
play_sound(sounds[SND_HERRING], SOUND_CENTER_SPEAKER);
- timer_start(&tux.invincible_timer,TUX_INVINCIBLE_TIME);
- super_bkgd_time = 4;
+ timer_start(&pplayer->invincible_timer,TUX_INVINCIBLE_TIME);
+ timer_start(&super_bkgd_timer, 250);
/* play the herring song ^^ */
if (current_music != HURRYUP_MUSIC)
{