- Tile* tile = gettile(x,y);
- if (!tile->fullbox)
- return;
-
- // according to the collision side, set the upgrade direction
- if(col_side == LEFT)
- col_side = RIGHT;
- else
- col_side = LEFT;
-
- int posx = ((int)(x+1) / 32) * 32;
- int posy = (int)(y/32) * 32 - 32;
- switch(tile->data)
- {
- case 1: // Box with a distro!
- add_bouncy_distro(Vector(posx, posy));
- play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
- player_status.score = player_status.score + SCORE_DISTRO;
- player_status.distros++;
- break;
-
- case 2: // Add a fire flower upgrade!
- if (tux.size == SMALL) /* Tux is small, add mints! */
- add_upgrade(posx, posy, col_side, UPGRADE_GROWUP);
- else /* Tux is big, add a fireflower: */
- add_upgrade(posx, posy, col_side, UPGRADE_FIREFLOWER);
- play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER);
- break;
-
- case 5: // Add an ice flower upgrade!
- if (tux.size == SMALL) /* Tux is small, add mints! */
- add_upgrade(posx, posy, col_side, UPGRADE_GROWUP);
- else /* Tux is big, add an iceflower: */
- add_upgrade(posx, posy, col_side, UPGRADE_ICEFLOWER);
- play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER);
- break;
-
- case 3: // Add a golden herring
- add_upgrade(posx, posy, col_side, UPGRADE_HERRING);
- break;
-
- case 4: // Add a 1up extra
- add_upgrade(posx, posy, col_side, UPGRADE_1UP);
- break;
- default:
- break;
- }
-
- /* Empty the box: */
- level->change(x, y, TM_IA, tile->next_tile);
-}
-
-/* Try to grab a distro: */
-void
-World::trygrabdistro(float x, float y, int bounciness)
-{
- Tile* tile = gettile(x, y);
- if (tile && tile->distro)
- {
- level->change(x, y, TM_IA, tile->next_tile);
- play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
-
- if (bounciness == BOUNCE)
- {
- add_bouncy_distro(Vector(((int)(x + 1) / 32) * 32,
- (int)(y / 32) * 32));
- }
-
- player_status.score = player_status.score + SCORE_DISTRO;
- player_status.distros++;
- }
-}
-
-/* Try to bump a bad guy from below: */
-void
-World::trybumpbadguy(float x, float y)
-{
- // Bad guys:
- for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i)
- {
- if ((*i)->base.x >= x - 32 && (*i)->base.x <= x + 32 &&
- (*i)->base.y >= y - 16 && (*i)->base.y <= y + 16)
- {
- (*i)->collision(&tux, CO_PLAYER, COLLISION_BUMP);
- }
- }
-
- // Upgrades:
- for (unsigned int i = 0; i < upgrades.size(); i++)
- {
- if (upgrades[i].base.height == 32 &&
- upgrades[i].base.x >= x - 32 && upgrades[i].base.x <= x + 32 &&
- upgrades[i].base.y >= y - 16 && upgrades[i].base.y <= y + 16)
- {
- upgrades[i].collision(&tux, CO_PLAYER, COLLISION_BUMP);
- }
- }