-void add_upgrade(float x, float y, int dir, int kind)
-{
- int i, found;
-
- found = -1;
-
- for (i = 0; i < num_upgrades && found == -1; i++)
- {
- if (!upgrades[i].base.alive)
- found = i;
- }
-
- if (found == -1)
- {
- ++num_upgrades;
- upgrades = (upgrade_type*) realloc(upgrades,num_upgrades*sizeof(upgrade_type));
- found = num_upgrades - 1;
- }
-
- if (found != -1)
- {
- upgrade_init(&upgrades[found], x, y, dir, kind);
- }
-}
-
-/* Add a bullet: */
-
-void add_bullet(float x, float y, float xm, int dir)
-{
- int i, found;
-
- found = -1;
-
- for (i = 0; i < num_bullets && found == -1; i++)
- {
- if (!bullets[i].base.alive)
- found = i;
- }
-
- if (found == -1)
- {
- ++num_bullets;
- bullets = (bullet_type*) realloc(bullets,num_bullets*sizeof(bullet_type));
- found = num_bullets - 1;
- }
-
- if (found != -1)
- {
- bullet_init(&bullets[found], x, y, xm, dir);
-
- play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER);
- }
-}