- if (pupgrade->kind == UPGRADE_MINTS ||
- pupgrade->kind == UPGRADE_HERRING)
- {
- pupgrade->base.x = pupgrade->base.x + pupgrade->base.xm * frame_ratio;
- pupgrade->base.y = pupgrade->base.y + pupgrade->base.ym * frame_ratio;
-
- collision_swept_object_map(&pupgrade->old_base,&pupgrade->base);
-
- /* Off the screen? Kill it! */
-
- if (pupgrade->base.x < scroll_x - pupgrade->base.width)
- upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
- if (pupgrade->base.y > screen->h)
- upgrades.erase(static_cast<std::vector<upgrade_type>::iterator>(pupgrade));
-
- if (issolid(pupgrade->base.x + 1, pupgrade->base.y + 32.) ||
- issolid(pupgrade->base.x + 31., pupgrade->base.y + 32.))
- {
- if (pupgrade->base.ym > 0)
- {
- if (pupgrade->kind == UPGRADE_MINTS)
- {
- pupgrade->base.ym = 0;
- }
- else if (pupgrade->kind == UPGRADE_HERRING)
- {
- pupgrade->base.ym = -8;
- }
-
- pupgrade->base.y = (int)(pupgrade->base.y / 32) * 32;
- }
- }
- else
- pupgrade->base.ym = pupgrade->base.ym + GRAVITY * frame_ratio;
-
- 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, (int) pupgrade->base.y))
- {
- if(pupgrade->base.xm > 0)
- pupgrade->base.xm = -pupgrade->base.xm;
- }
+ /* Move around? */
+ physic.apply(elapsed_time, base.x, base.y);
+ if(kind == UPGRADE_GROWUP) {
+ collision_swept_object_map(&old_base, &base);
+ }
+
+ // fall down?
+ if(kind == UPGRADE_GROWUP || kind == UPGRADE_HERRING) {
+ // falling?
+ if(physic.get_velocity_y() != 0) {
+ if(issolid(base.x, base.y + base.height)) {
+ base.y = int(base.y / 32) * 32;
+ old_base = base;
+ if(kind == UPGRADE_GROWUP) {
+ physic.enable_gravity(false);
+ physic.set_velocity(dir == LEFT ? -GROWUP_SPEED : GROWUP_SPEED, 0);
+ } else if(kind == UPGRADE_HERRING) {
+ physic.set_velocity(dir == LEFT ? -2 : 2, 3);