pbad->base.y = pbad->base.y + pbad->base.ym * frame_ratio;
if (pbad->dying != FALLING)
- collision_swept_object_map(&pbad->old_base,&pbad->base);
+ collision_swept_object_map(&pbad->old_base,&pbad->base);
if (pbad->base.y > screen->h)
pbad->base.alive = NO;
else if (pbad->mode == HELD)
{ /* FIXME: The pbad object shouldn't know about pplayer objects. */
/* If we're holding the laptop */
- pbad->dir=tux.dir;
+ pbad->dir=tux.dir;
if(pbad->dir==RIGHT)
{
pbad->base.x = tux.base.x + 16;
pbad->base.x = tux.base.x - 16;
pbad->base.y = tux.base.y + tux.base.height/1.5 - pbad->base.height;
}
- if(collision_object_map(&pbad->base))
- {
- pbad->base.x = tux.base.x;
- pbad->base.y = tux.base.y + tux.base.height/1.5 - pbad->base.height;
- }
+ if(collision_object_map(&pbad->base))
+ {
+ pbad->base.x = tux.base.x;
+ pbad->base.y = tux.base.y + tux.base.height/1.5 - pbad->base.height;
+ }
if(tux.input.fire != DOWN) /* SHOOT! */
{
- if(pbad->dir = LEFT)
- pbad->base.x -= 24;
- else
- pbad->base.x += 24;
-
+ if(pbad->dir = LEFT)
+ pbad->base.x -= 24;
+ else
+ pbad->base.x += 24;
+
pbad->mode=KICK;
pbad->base.ym-=8;
play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER);
if(pbad->mode != HELD)
pbad->base.y = pbad->base.y + pbad->base.ym * frame_ratio;
-
+
if (pbad->dying != FALLING)
- collision_swept_object_map(&pbad->old_base,&pbad->base);
+ collision_swept_object_map(&pbad->old_base,&pbad->base);
if (pbad->base.y > screen->h)
pbad->base.alive = NO;
/* Bump into things horizontally: */
/* Move vertically: */
pbad->base.y = pbad->base.y + pbad->base.ym * frame_ratio;
-
+
if (pbad->dying != FALLING)
- collision_swept_object_map(&pbad->old_base,&pbad->base);
+ collision_swept_object_map(&pbad->old_base,&pbad->base);
if (pbad->base.y > screen->h)
pbad->base.alive = NO;
physic_set_state(&pbad->physic,PH_VT);
physic_set_start_vy(&pbad->physic,0.);
pbad->base.ym = physic_get_velocity(&pbad->physic);
- ++pbad->base.y;
+ ++pbad->base.y;
}
else
{
break;
case CO_PLAYER:
pplayer_c = (player_type*) p_c_object;
- if (pbad->kind == BAD_BSOD)
+ if(pbad->kind != BAD_MONEY)
{
- pbad->dying = SQUISHED;
- timer_start(&pbad->timer,4000);
- physic_set_state(&pplayer_c->vphysic,PH_VT);
- physic_set_start_vy(&pplayer_c->vphysic,2.);
-
- add_score(pbad->base.x - scroll_x, pbad->base.y,
- 50 * score_multiplier);
-
- play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
- }
- else if (pbad->kind == BAD_LAPTOP)
- {
-
- if (pbad->mode != KICK)
+ if (pbad->kind == BAD_BSOD)
{
- /* Flatten! */
-
- play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER);
- pbad->mode = FLAT;
- pbad->base.xm = 4;
-
- timer_start(&pbad->timer,10000);
-
+ pbad->dying = SQUISHED;
+ timer_start(&pbad->timer,4000);
physic_set_state(&pplayer_c->vphysic,PH_VT);
physic_set_start_vy(&pplayer_c->vphysic,2.);
+
+ add_score(pbad->base.x - scroll_x, pbad->base.y,
+ 50 * score_multiplier);
+
+ play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
}
- else
+ else if (pbad->kind == BAD_LAPTOP)
{
- /* Kick! */
- play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
+ if (pbad->mode != KICK)
+ {
+ /* Flatten! */
+
+ play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER);
+ pbad->mode = FLAT;
+ pbad->base.xm = 4;
- if (pplayer_c->base.x <= pbad->base.x)
- pbad->dir = RIGHT;
+ timer_start(&pbad->timer,10000);
+
+ physic_set_state(&pplayer_c->vphysic,PH_VT);
+ physic_set_start_vy(&pplayer_c->vphysic,2.);
+ }
else
- pbad->dir = LEFT;
+ {
+ /* Kick! */
- pbad->base.xm = 8;
+ play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
- timer_start(&pbad->timer,5000);
- }
+ if (pplayer_c->base.x <= pbad->base.x)
+ pbad->dir = RIGHT;
+ else
+ pbad->dir = LEFT;
- physic_set_state(&pplayer_c->vphysic,PH_VT);
- physic_set_start_vy(&pplayer_c->vphysic,2.);
+ pbad->base.xm = 8;
- add_score(pbad->base.x - scroll_x,
- pbad->base.y,
- 25 * score_multiplier);
+ timer_start(&pbad->timer,5000);
+ }
- /* play_sound(sounds[SND_SQUISH]); */
- }
+ physic_set_state(&pplayer_c->vphysic,PH_VT);
+ physic_set_start_vy(&pplayer_c->vphysic,2.);
+
+ add_score(pbad->base.x - scroll_x,
+ pbad->base.y,
+ 25 * score_multiplier);
+
+ /* play_sound(sounds[SND_SQUISH]); */
+ }
+ score_multiplier++;
+ }
break;
}
fwrite(&scroll_x,sizeof(float),1,fi);
fwrite(&tux,sizeof(player_type),1,fi);
timer_fwrite(&tux.invincible_timer,fi);
- printf("Time inv LEFT: %d\n",timer_get_left(&tux.invincible_timer));
timer_fwrite(&tux.skidding_timer,fi);
timer_fwrite(&tux.safe_timer,fi);
timer_fwrite(&tux.frame_timer,fi);
timer_fwrite(&time_left,fi);
- printf("Time LEFT: %d\n",timer_get_left(&time_left));
ui = st_get_ticks();
fwrite(&ui,sizeof(int),1,fi);
}
fread(&scroll_x,sizeof(float),1,fi);
fread(&tux,sizeof(player_type),1,fi);
timer_fread(&tux.invincible_timer,fi);
- printf("Time inv LEFT: %d - %d\n",timer_get_left(&tux.invincible_timer),tux.invincible_timer.time);
timer_fread(&tux.skidding_timer,fi);
timer_fread(&tux.safe_timer,fi);
timer_fread(&tux.frame_timer,fi);
timer_fread(&time_left,fi);
- printf("Time LEFT: %d\n",timer_get_left(&time_left));
fread(&ui,sizeof(int),1,fi);
tux.hphysic.start_time += st_get_ticks() - ui;
tux.vphysic.start_time += st_get_ticks() - ui;
}
physic_init(&pplayer->vphysic);
- }
+ /* Reset score multiplier (for multi-hits): */
+ score_multiplier = 1;
+ }
+
if(jumped_in_solid == YES)
{
}
}
- /* Reset score multiplier (for multi-hits): */
-
- if (pplayer->base.ym > 2)
- score_multiplier = 1;
-
}
timer_check(&pplayer->safe_timer);
else
{
pbad_c->dying = FALLING;
- physic_set_state(&pplayer->vphysic,PH_VT);
- physic_set_start_vy(&pplayer->vphysic,-2.);
play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
+ add_score(pbad_c->base.x - scroll_x,
+ pbad_c->base.y,
+ 25 * score_multiplier);
}
}
}
else
{
pbad_c->dying = FALLING;
- physic_set_state(&pplayer->vphysic,PH_VT);
- physic_set_start_vy(&pplayer->vphysic,-2.);
play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
+ add_score(pbad_c->base.x - scroll_x,
+ pbad_c->base.y,
+ 25 * score_multiplier);
}
}
score_multiplier++;