// 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
//
#include "globals.h"
#include "player.h"
+texture_type img_bullet;
+texture_type img_golden_herring;
+bitmask* bm_bullet;
+
void create_special_bitmasks()
{
bm_bullet = bitmask_create_SDL(img_bullet.sdl_surface);
{
pbullet->base.width = 4;
pbullet->base.height = 4;
- pbullet->base.updated = SDL_GetTicks();
pbullet->base.alive = YES;
if (dir == RIGHT)
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;
pupgrade->base.xm = 2;
pupgrade->base.ym = -2;
pupgrade->base.height = 0;
- pupgrade->base.updated = SDL_GetTicks();
}
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
{
pupgrade->base.x = pupgrade->base.x + pupgrade->base.xm * frame_ratio;
pupgrade->base.y = pupgrade->base.y + pupgrade->base.ym * frame_ratio;
- if (issolid(pupgrade->base.x, pupgrade->base.y + 31) ||
- issolid(pupgrade->base.x + 31, pupgrade->base.y + 31))
+ if (issolid(pupgrade->base.x, pupgrade->base.y + 31.) ||
+ issolid(pupgrade->base.x + 31., pupgrade->base.y + 31.))
{
if (pupgrade->base.ym > 0)
{
}
else if (pupgrade->kind == UPGRADE_HERRING)
{
- pupgrade->base.ym = -24;
+ pupgrade->base.ym = -8;
}
pupgrade->base.y = (int)(pupgrade->base.y / 32) * 32;
else
pupgrade->base.ym = pupgrade->base.ym + GRAVITY;
- if (issolid(pupgrade->base.x, pupgrade->base.y))
- {
- pupgrade->base.xm = -pupgrade->base.xm;
- }
+ if (issolid(pupgrade->base.x - 1, (int) pupgrade->base.y))
+ {
+ if(pupgrade->base.xm < 0)
+ pupgrade->base.xm = -pupgrade->base.xm;
+ }
+ else if (issolid(pupgrade->base.x + pupgrade->base.width-1, (int) pupgrade->base.y))
+ {
+ if(pupgrade->base.xm > 0)
+ pupgrade->base.xm = -pupgrade->base.xm;
+ }
}
/* Off the screen? Kill it! */
- if (pupgrade->base.x < scroll_x)
+ if (pupgrade->base.x < scroll_x - pupgrade->base.width)
pupgrade->base.alive = NO;
}
void upgrade_draw(upgrade_type* pupgrade)
{
+SDL_Rect dest;
if (pupgrade->base.alive)
{
if (pupgrade->base.height < 32)
{
/* Rising up... */
- dest.x = pupgrade->base.x - scroll_x;
- dest.y = pupgrade->base.y + 32 - pupgrade->base.height;
+ dest.x = (int)(pupgrade->base.x - scroll_x);
+ dest.y = (int)(pupgrade->base.y + 32 - pupgrade->base.height);
dest.w = 32;
- dest.h = pupgrade->base.height;
-
- src.x = 0;
- src.y = 0;
- src.w = 32;
- src.h = pupgrade->base.height;
+ dest.h = (int)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
{
/* Remove the upgrade: */
/* p_c_object is CO_PLAYER, so assign it to pplayer */
- pplayer = p_c_object;
+ pplayer = (player_type*) p_c_object;
pupgrade->base.alive = NO;
{
play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
pplayer->size = BIG;
+ pplayer->base.height = 64;
timer_start(&super_bkgd_timer, 350);
}
else if (pupgrade->kind == UPGRADE_COFFEE)
else if (pupgrade->kind == UPGRADE_HERRING)
{
play_sound(sounds[SND_HERRING], SOUND_CENTER_SPEAKER);
- timer_start(&tux.invincible_timer,TUX_INVINCIBLE_TIME);
+ timer_start(&pplayer->invincible_timer,TUX_INVINCIBLE_TIME);
timer_start(&super_bkgd_timer, 250);
/* play the herring song ^^ */
if (current_music != HURRYUP_MUSIC)