From b28effb17de47732bed61934c79429c61e4bb8b2 Mon Sep 17 00:00:00 2001 From: onpon4 Date: Mon, 23 Mar 2015 21:33:15 -0400 Subject: [PATCH] Tweaked handling of powerups. Now, rather than powerups being replaced with ammo, their collection effect has been changed from "make the plasma ammo at least 50" to "add the powerup's amount to the plasma ammo" (i.e. powerups are also treated as plasma ammo). This left the initial ammo of a powerup a little low, so to compensate, I increased the collectValue of the transport ship from 30 to 40. Additionally, transport ships now show up in interceptions again, but powerups, when collected, do *not* increase ammo. If you have no ammo at the time, the powerup does nothing. If this happens with the Super Charge, you get a humorous message. --- src/alien.cpp | 9 +-- src/collectable.cpp | 134 ++++++++++++++++++++++++-------------------- 2 files changed, 75 insertions(+), 68 deletions(-) diff --git a/src/alien.cpp b/src/alien.cpp index 0b0f3d2..7b9f263 100644 --- a/src/alien.cpp +++ b/src/alien.cpp @@ -173,7 +173,7 @@ void alien_defs_init() alien_defs[CD_TRANSPORTSHIP].chance[1] = 0; alien_defs[CD_TRANSPORTSHIP].collectChance = 100; alien_defs[CD_TRANSPORTSHIP].collectType = P_WEAPONS; - alien_defs[CD_TRANSPORTSHIP].collectValue = 30; + alien_defs[CD_TRANSPORTSHIP].collectValue = 40; alien_defs[CD_TRANSPORTSHIP].flags = FL_WEAPCO | FL_NOFIRE; // Cargo ship @@ -794,11 +794,8 @@ bool alien_add() randEnemy = CD_SLAVETRANSPORT; } - if (currentGame.area != MAX_MISSIONS - 1) - { - if ((rand() % 6) == 0) - randEnemy = CD_TRANSPORTSHIP; - } + if ((rand() % 6) == 0) + randEnemy = CD_TRANSPORTSHIP; } delete[] alienArray; diff --git a/src/collectable.cpp b/src/collectable.cpp index 7c361b4..eaeab3c 100644 --- a/src/collectable.cpp +++ b/src/collectable.cpp @@ -77,33 +77,6 @@ void addCollectable(float x, float y, int type, int value, int life) if (value == 0) return; // don't bother! - // If plasma rate is at max, convert plasma rate powerup to ammo. - if (type == P_PLASMA_RATE) - { - if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[currentGame.maxPlasmaRate]) - { - type = P_PLASMA_AMMO; - } - } - - // If plasma output is at max, convert plasma output powerup to ammo. - if (type == P_PLASMA_SHOT) - { - if (weapon[W_PLAYER_WEAPON].ammo[0] >= currentGame.maxPlasmaOutput) - { - type = P_PLASMA_AMMO; - } - } - - // If plasma damage is at max, convert plasma damage powerup to ammo. - if (type == P_PLASMA_DAMAGE) - { - if (weapon[W_PLAYER_WEAPON].damage >= currentGame.maxPlasmaDamage) - { - type = P_PLASMA_AMMO; - } - } - // No point in giving the player plasma ammo if the weapons aren't // upgraded! Give them money instead. if (type == P_PLASMA_AMMO) @@ -136,12 +109,10 @@ void addCollectable(float x, float y, int type, int value, int life) } /* - No cash, powerups, or ammo on interceptions. Stops point leeching(!) + No cash or ammo on interceptions. Stops point leeching(!) */ if ((currentGame.area == MAX_MISSIONS - 1) && - ((type == P_CASH) || (type == P_PLASMA_AMMO) || (type == P_ROCKET) || - (type == P_PLASMA_DAMAGE) || (type == P_PLASMA_SHOT) || - (type == P_PLASMA_RATE) || (type == P_SUPER))) + ((type == P_CASH) || (type == P_PLASMA_AMMO) || (type == P_ROCKET))) { return; } @@ -350,54 +321,93 @@ void doCollectables() break; case P_PLASMA_RATE: - if (player.ammo[0] < 50) - player.ammo[0] = 50; - if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[currentGame.maxPlasmaRate]) - sprintf(temp, "Firing Rate already at Maximum"); + currentGame.powerups++; + if ((currentGame.area != MAX_MISSIONS - 1) || + (player.ammo[0] > 0)) + { + if (currentGame.area != MAX_MISSIONS - 1) + LIMIT_ADD(player.ammo[0], collectable->value, + 0, currentGame.maxPlasmaAmmo); + + if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[currentGame.maxPlasmaRate]) + sprintf(temp, "Firing rate already at maximum"); + else + { + weapon[W_PLAYER_WEAPON].reload[0] -= 2; + sprintf(temp, "Firing rate increased"); + } + } else { - weapon[W_PLAYER_WEAPON].reload[0] -= 2; - sprintf(temp, "Firing rate increased"); + sprintf(temp, "Plasma ammo unavailable"); } - currentGame.powerups++; break; case P_PLASMA_SHOT: - if (player.ammo[0] < 50) - player.ammo[0] = 50; - if (weapon[W_PLAYER_WEAPON].ammo[0] >= currentGame.maxPlasmaOutput) - sprintf(temp, "Plasma output already at Maximum"); + currentGame.powerups++; + if ((currentGame.area != MAX_MISSIONS - 1) || + (player.ammo[0] > 0)) + { + if (currentGame.area != MAX_MISSIONS - 1) + LIMIT_ADD(player.ammo[0], collectable->value, + 0, currentGame.maxPlasmaAmmo); + + if (weapon[W_PLAYER_WEAPON].ammo[0] >= currentGame.maxPlasmaOutput) + sprintf(temp, "Plasma output already at maximum"); + else + { + weapon[W_PLAYER_WEAPON].ammo[0]++; + sprintf(temp, "Plasma output increased"); + } + } else { - weapon[W_PLAYER_WEAPON].ammo[0]++; - sprintf(temp, "Plasma output increased"); + sprintf(temp, "Plasma ammo unavailable"); } - currentGame.powerups++; break; case P_PLASMA_DAMAGE: - if (player.ammo[0] < 50) - player.ammo[0] = 50; - if (weapon[W_PLAYER_WEAPON].damage >= currentGame.maxPlasmaDamage) - sprintf(temp, "Plasma damage already at Maximum"); - else { - weapon[W_PLAYER_WEAPON].damage++; - sprintf(temp, "Plasma damage increased"); - } currentGame.powerups++; + if ((currentGame.area != MAX_MISSIONS - 1) || + (player.ammo[0] > 0)) + { + if (currentGame.area != MAX_MISSIONS - 1) + LIMIT_ADD(player.ammo[0], collectable->value, + 0, currentGame.maxPlasmaAmmo); + + if (weapon[W_PLAYER_WEAPON].damage >= currentGame.maxPlasmaDamage) + sprintf(temp, "Plasma damage already at maximum"); + else { + weapon[W_PLAYER_WEAPON].damage++; + sprintf(temp, "Plasma damage increased"); + } + } + else + { + sprintf(temp, "Plasma ammo unavailable"); + } break; case P_SUPER: - weapon[W_PLAYER_WEAPON].ammo[0] = 5; - weapon[W_PLAYER_WEAPON].damage = 5; - weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[5]; - weapon[W_PLAYER_WEAPON].flags |= WF_SPREAD; - - sprintf(temp, "Picked up a Super Charge!!"); - - if (player.ammo[0] < 50) - player.ammo[0] = 50; currentGame.powerups++; + if ((currentGame.area != MAX_MISSIONS - 1) || + (player.ammo[0] > 0)) + { + if (currentGame.area != MAX_MISSIONS - 1) + LIMIT_ADD(player.ammo[0], collectable->value, + 0, currentGame.maxPlasmaAmmo); + + weapon[W_PLAYER_WEAPON].ammo[0] = 5; + weapon[W_PLAYER_WEAPON].damage = 5; + weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[5]; + weapon[W_PLAYER_WEAPON].flags |= WF_SPREAD; + + sprintf(temp, "Picked up a Super Charge!!"); + } + else + { + sprintf(temp, "Plasma ammo unavailable (damn!)"); + } break; case P_PLASMA_AMMO: