diff --git a/code/bullets.cpp b/code/bullets.cpp index 61f4971..f2ea64f 100644 --- a/code/bullets.cpp +++ b/code/bullets.cpp @@ -218,8 +218,9 @@ void fireBullet(object *attacker, int weaponType) player.ammo[0]--; if (player.ammo[0] == 0) { - player.weaponType[0] = W_PLAYER_WEAPON; - weapon[W_PLAYER_WEAPON2] = weapon[W_PLAYER_WEAPON]; // reset to weapon 1 defaults + weapon[0].ammo[0] = currentGame.minPlasmaOutput; + weapon[0].damage = currentGame.minPlasmaDamage; + weapon[0].reload[0] = rate2reload[currentGame.minPlasmaRate]; } } } diff --git a/code/collectable.cpp b/code/collectable.cpp index 2f71d06..8e07f12 100644 --- a/code/collectable.cpp +++ b/code/collectable.cpp @@ -284,65 +284,62 @@ void doCollectables() break; case P_PLASMA_RATE: - limitCharAdd(&weapon[1].reload[0], -2, currentGame.maxPlasmaRate, 15); - player.weaponType[0] = 1; if (player.ammo[0] < 50) player.ammo[0] = 50; - limitChar(&(player.ammo[0]), 0, currentGame.maxPlasmaAmmo); - if (weapon[1].reload[0] == currentGame.maxPlasmaRate) - sprintf(temp, "Firing Rate at Maximum"); + if (weapon[0].reload[0] <= rate2reload[currentGame.maxPlasmaRate]) + sprintf(temp, "Firing Rate already at Maximum"); else + { + weapon[0].reload[0] -= 2; sprintf(temp, "Firing rate increased"); + } currentGame.powerups++; break; case P_PLASMA_SHOT: - limitCharAdd(&weapon[1].ammo[0], 1, 1, currentGame.maxPlasmaOutput); if (player.ammo[0] < 50) player.ammo[0] = 50; - limitChar(&(player.ammo[0]), 0, currentGame.maxPlasmaAmmo); - if (weapon[1].ammo[0] == currentGame.maxPlasmaOutput) - sprintf(temp, "Plasma output at Maximum"); + if (weapon[0].ammo[0] >= currentGame.maxPlasmaOutput) + sprintf(temp, "Plasma output already at Maximum"); else + { + weapon[0].ammo[0]++; sprintf(temp, "Plasma output increased"); - player.weaponType[0] = 1; + } currentGame.powerups++; break; case P_PLASMA_DAMAGE: - limitCharAdd(&weapon[1].damage, 1, 1, currentGame.maxPlasmaDamage); if (player.ammo[0] < 50) player.ammo[0] = 50; - limitChar(&(player.ammo[0]), 0, currentGame.maxPlasmaAmmo); - if (weapon[1].damage == currentGame.maxPlasmaDamage) - sprintf(temp, "Plasma damage at Maximum"); - else + if (weapon[0].damage >= currentGame.maxPlasmaDamage) + sprintf(temp, "Plasma damage already at Maximum"); + else { + weapon[0].damage++; sprintf(temp, "Plasma damage increased"); - player.weaponType[0] = 1; + } currentGame.powerups++; break; case P_SUPER: - weapon[1].ammo[0] = 5; - weapon[1].damage = 5; - weapon[1].reload[0] = 7; - - weapon[1].flags |= WF_SPREAD; + weapon[0].ammo[0] = 5; + weapon[0].damage = 5; + weapon[0].reload[0] = rate2reload[5]; + weapon[0].flags |= WF_SPREAD; sprintf(temp, "Picked up a Super Charge!!"); if (player.ammo[0] < 50) player.ammo[0] = 50; - player.weaponType[0] = 1; currentGame.powerups++; break; case P_PLASMA_AMMO: - limitCharAdd(&player.ammo[0], collectable->value, 0, currentGame.maxPlasmaAmmo); - if (player.ammo[0] == currentGame.maxPlasmaAmmo) - sprintf(temp, "Plasma cells at Maximum"); + if (player.ammo[0] >= currentGame.maxPlasmaAmmo) + sprintf(temp, "Plasma cells already at Maximum"); else { + limitCharAdd(&player.ammo[0], collectable->value, 0, currentGame.maxPlasmaAmmo); if (collectable->value > 1) { sprintf(temp, "Got %d plasma cells", collectable->value); @@ -354,7 +351,6 @@ void doCollectables() sprintf(temp, "Got one whole plasma cell (wahoo!)"); } } - player.weaponType[0] = 1; currentGame.cellPickups += collectable->value; break; @@ -393,8 +389,9 @@ void doCollectables() // stop people from exploiting a weapon check condition if (player.ammo[0] == 0) { - player.weaponType[0] = 0; - weapon[1] = weapon[0]; // reset to weapon 1 defaults + weapon[0].ammo[0] = currentGame.minPlasmaOutput; + weapon[0].damage = currentGame.minPlasmaDamage; + weapon[0].reload[0] = rate2reload[currentGame.minPlasmaRate]; } } diff --git a/code/defs.h b/code/defs.h index 91c18fe..13a592f 100644 --- a/code/defs.h +++ b/code/defs.h @@ -300,13 +300,15 @@ enum { PAK_S3M }; -const char systemNames[][15] = {"Spirit", "Eyananth", "Mordor", "Sol"}; +static const char systemNames[][15] = {"Spirit", "Eyananth", "Mordor", "Sol"}; -const char faces[][12] = { +static const char faces[][12] = { "FACE_CHRIS", "FACE_SID", "FACE_KRASS", "FACE_KLINE", "FACE_PHOEBE", "FACE_URSULA", "FACE_CREW"}; -const char systemBackground[][20] = { +static const char systemBackground[][20] = { "gfx/spirit.jpg", "gfx/eyananth.jpg", "gfx/mordor.jpg", "gfx/sol.jpg"}; + +static const signed char rate2reload[6] = {15, 15, 13, 11, 9, 7}; diff --git a/code/game.cpp b/code/game.cpp index 4387ff5..d7a24d6 100644 --- a/code/game.cpp +++ b/code/game.cpp @@ -61,7 +61,10 @@ void newGame() currentGame.missionCompleted[i] = 0; currentGame.distanceCovered = 0; - currentGame.maxPlasmaRate = 13; + currentGame.minPlasmaRate = 1; + currentGame.minPlasmaOutput = 1; + currentGame.minPlasmaDamage = 1; + currentGame.maxPlasmaRate = 2; currentGame.maxPlasmaOutput = 2; currentGame.maxPlasmaDamage = 2; currentGame.maxPlasmaAmmo = 100; diff --git a/code/loadSave.cpp b/code/loadSave.cpp index c61789c..07aba9b 100644 --- a/code/loadSave.cpp +++ b/code/loadSave.cpp @@ -102,7 +102,6 @@ bool loadGame(int slot) fclose(fp); weapon[0] = currentGame.playerWeapon; - weapon[1] = currentGame.playerWeapon2; player = currentGame.thePlayer; // Re-init all the planets in this system... @@ -129,7 +128,6 @@ void saveGame(int slot) fp = fopen(fileName, "wb"); currentGame.playerWeapon = weapon[0]; - currentGame.playerWeapon2 = weapon[1]; currentGame.thePlayer = player; for (int i = 0 ; i < 10 ; i++) currentGame.missionCompleted[i] = systemPlanet[i].missionCompleted; diff --git a/code/misc.cpp b/code/misc.cpp index 0eaf4b3..ddeaa32 100644 --- a/code/misc.cpp +++ b/code/misc.cpp @@ -149,7 +149,7 @@ void doInfo() char text[25]; addBuffer(0, 20, 800, 25); - addBuffer(0, 545, 800, 25); + addBuffer(0, 550, 800, 34); if (engine.minutes > -1) { @@ -332,15 +332,17 @@ void doInfo() bar.h = 12; bar.x = 80; bar.y = 571; - SDL_FillRect(screen, &bar, green); - for (int i = 1 ; i < currentGame.maxPlasmaDamage ; i++) + for (int i = 1 ; i <= 5 ; i++) { - bar.x += 30; - if (weapon[1].damage >= (i + 1)) - SDL_FillRect(screen, &bar, green); - else + if (weapon[0].damage >= i) { + if(i <= currentGame.maxPlasmaDamage || (SDL_GetTicks() % 1000 > (unsigned)i * 100)) + { + SDL_FillRect(screen, &bar, green); + } + } else if (i <= currentGame.maxPlasmaDamage) SDL_FillRect(screen, &bar, darkGreen); + bar.x += 30; } blitText(12); @@ -351,13 +353,17 @@ void doInfo() bar.y = 571; SDL_FillRect(screen, &bar, yellow); - for (int i = 1 ; i < currentGame.maxPlasmaDamage ; i++) + for (int i = 1 ; i <= 5 ; i++) { - bar.x += 30; - if (weapon[1].ammo[0] >= (i + 1)) - SDL_FillRect(screen, &bar, yellow); - else + if (weapon[0].ammo[0] >= i) { + if(i <= currentGame.maxPlasmaOutput || (SDL_GetTicks() % 1000 > (unsigned)i * 100)) + { + SDL_FillRect(screen, &bar, yellow); + } + } + else if (i <= currentGame.maxPlasmaDamage) SDL_FillRect(screen, &bar, darkYellow); + bar.x += 30; } blitText(13); @@ -367,11 +373,15 @@ void doInfo() bar.x = 550; bar.y = 571; - for (int i = 15 ; i > (currentGame.maxPlasmaRate - 1) ; i -= 2) + for (int i = 1 ; i <= 5 ; i++) { - if (weapon[1].reload[0] <= i) - SDL_FillRect(screen, &bar, blue); - else + if (weapon[0].reload[0] <= rate2reload[i]) { + if(i <= currentGame.maxPlasmaRate || (SDL_GetTicks() % 1000 > (unsigned)i * 100)) + { + SDL_FillRect(screen, &bar, blue); + } + } + else if (i <= currentGame.maxPlasmaRate) SDL_FillRect(screen, &bar, darkerBlue); bar.x += 30; } diff --git a/code/player.cpp b/code/player.cpp index 353ee0d..6a740a4 100644 --- a/code/player.cpp +++ b/code/player.cpp @@ -46,15 +46,12 @@ void initPlayer() player.weaponType[0] = W_PLAYER_WEAPON; - if (player.ammo[0] > 0) - { - player.weaponType[0] = W_PLAYER_WEAPON2; - } - else - { - player.weaponType[0] = W_PLAYER_WEAPON; - weapon[1] = weapon[0]; // reset to weapon 1 defaults - } + if(weapon[0].ammo[0] < currentGame.minPlasmaOutput) + weapon[0].ammo[0] = currentGame.minPlasmaOutput; + if(weapon[0].damage < currentGame.minPlasmaDamage) + weapon[0].damage = currentGame.minPlasmaDamage; + if(weapon[0].reload[0] > rate2reload[currentGame.minPlasmaRate]) + weapon[0].reload[0] = rate2reload[currentGame.minPlasmaRate]; player.hit = 0; @@ -130,13 +127,11 @@ void doPlayer() if ((engine.keyState[SDLK_LSHIFT]) || (engine.keyState[SDLK_RSHIFT])) { - int w = player.ammo[0] > 0; - - if(weapon[w].ammo[0] >= 3) + if(weapon[0].ammo[0] >= 3 && weapon[0].ammo[0] <= currentGame.maxPlasmaOutput) { - weapon[w].flags ^= WF_SPREAD; + weapon[0].flags ^= WF_SPREAD; - if(weapon[w].flags & WF_SPREAD) + if(weapon[0].flags & WF_SPREAD) { setInfoLine("Weapon set to Spread", FONT_WHITE); } diff --git a/code/shop.cpp b/code/shop.cpp index 808844e..91afdb1 100644 --- a/code/shop.cpp +++ b/code/shop.cpp @@ -73,31 +73,31 @@ static void adjustShopPrices() { shopItems[0].price = (500 * currentGame.maxPlasmaOutput); shopItems[1].price = (500 * currentGame.maxPlasmaDamage); - shopItems[2].price = (500 * (16 - currentGame.maxPlasmaRate)); + shopItems[2].price = (500 * (currentGame.maxPlasmaRate * 2 - 1)); - shopItems[5].price = (2000 * weapon[0].ammo[0]); - shopItems[6].price = (2000 * weapon[0].damage); - shopItems[7].price = (2000 * (16 - weapon[0].reload[0])); + shopItems[5].price = (2000 * currentGame.minPlasmaOutput); + shopItems[6].price = (2000 * currentGame.minPlasmaDamage); + shopItems[7].price = (2000 * (currentGame.minPlasmaRate * 2 - 1)); shopItems[8].price = (5 * currentGame.maxPlasmaAmmo); shopItems[9].price = (25 * currentGame.maxRocketAmmo); - if (currentGame.maxPlasmaOutput == 5) + if (currentGame.maxPlasmaOutput >= 5) shopItems[0].price = 0; - if (currentGame.maxPlasmaDamage == 5) + if (currentGame.maxPlasmaDamage >= 5) shopItems[1].price = 0; - if (currentGame.maxPlasmaRate == 7) + if (currentGame.maxPlasmaRate >= 5) shopItems[2].price = 0; - if (weapon[0].ammo[0] == 3) + if (currentGame.minPlasmaOutput >= 3) shopItems[5].price = 0; - if (weapon[0].damage == 3) + if (currentGame.minPlasmaDamage >= 3) shopItems[6].price = 0; - if (weapon[0].reload[0] == 11) + if (currentGame.minPlasmaRate >= 3) shopItems[7].price = 0; } @@ -161,11 +161,11 @@ static void drawShop() strcpy(description, ""); drawString("Primary Weapon", 10, 3, FONT_WHITE, shopSurface[0]); - sprintf(description, "Plasma Cannons : %d", weapon[0].ammo[0]); + sprintf(description, "Plasma Cannons : %d", currentGame.minPlasmaOutput); drawString(description, 10, 22, FONT_WHITE, shopSurface[0]); - sprintf(description, "Plasma Power : Stage %d", weapon[0].damage); + sprintf(description, "Plasma Power : Stage %d", currentGame.minPlasmaDamage); drawString(description, 10, 37, FONT_WHITE, shopSurface[0]); - sprintf(description, "Cooler : Stage %d", ((15 - weapon[0].reload[0]) / 2) + 1); + sprintf(description, "Cooler : Stage %d", currentGame.minPlasmaRate); drawString(description, 10, 52, FONT_WHITE, shopSurface[0]); drawString("Powerup Weapon", 10, 3, FONT_WHITE, shopSurface[1]); @@ -173,7 +173,7 @@ static void drawShop() drawString(description, 10, 22, FONT_WHITE, shopSurface[1]); sprintf(description, "Plasma Condensor : Stage %d", currentGame.maxPlasmaDamage); drawString(description, 10, 37, FONT_WHITE, shopSurface[1]); - sprintf(description, "Liquid Nitrogen : Stage %d", ((15 - currentGame.maxPlasmaRate) / 2) + 1); + sprintf(description, "Liquid Nitrogen : Stage %d", currentGame.maxPlasmaRate); drawString(description, 10, 52, FONT_WHITE, shopSurface[1]); sprintf(description, "Plasma Capacity : %d", currentGame.maxPlasmaAmmo); drawString(description, 10, 67, FONT_WHITE, shopSurface[1]); @@ -490,22 +490,22 @@ static void buy(int i) switch(i) { case 0: - if (currentGame.maxPlasmaOutput == 5) + if (currentGame.maxPlasmaOutput >= 5) {shopSelectedItem = -3; return;} currentGame.maxPlasmaOutput++; break; case 1: - if (currentGame.maxPlasmaDamage == 5) + if (currentGame.maxPlasmaDamage >= 5) {shopSelectedItem = -3; return;} currentGame.maxPlasmaDamage++; break; case 2: - if (currentGame.maxPlasmaRate == 7) + if (currentGame.maxPlasmaRate >= 5) {shopSelectedItem = -3; return;} - currentGame.maxPlasmaRate -= 2; + currentGame.maxPlasmaRate++; break; case 3: - if (player.ammo[0] == currentGame.maxPlasmaAmmo) + if (player.ammo[0] >= currentGame.maxPlasmaAmmo) {shopSelectedItem = -4; return;} limitCharAdd(&player.ammo[0], 10, 0, currentGame.maxPlasmaAmmo); break; @@ -523,28 +523,28 @@ static void buy(int i) player.ammo[1]++; break; case 5: - if (weapon[0].ammo[0] == 3) + if (currentGame.minPlasmaOutput >= 3) {shopSelectedItem = -3; return;} - weapon[0].ammo[0]++; - if (currentGame.maxPlasmaOutput < weapon[0].ammo[0]) - currentGame.maxPlasmaOutput = weapon[0].ammo[0]; + currentGame.minPlasmaOutput++; + if (currentGame.maxPlasmaOutput < currentGame.minPlasmaOutput) + currentGame.maxPlasmaOutput = currentGame.minPlasmaOutput; break; case 6: - if (weapon[0].damage == 3) + if (currentGame.minPlasmaDamage >= 3) {shopSelectedItem = -3; return;} - weapon[0].damage++; - if (currentGame.maxPlasmaDamage < weapon[0].damage) - currentGame.maxPlasmaDamage = weapon[0].damage; + currentGame.minPlasmaDamage++; + if (currentGame.maxPlasmaDamage < currentGame.minPlasmaDamage) + currentGame.maxPlasmaDamage = currentGame.minPlasmaDamage; break; case 7: - if (weapon[0].reload[0] == 11) + if (currentGame.minPlasmaRate >= 3) {shopSelectedItem = -3; return;} - weapon[0].reload[0] -= 2; - if (currentGame.maxPlasmaRate > weapon[0].reload[0]) - currentGame.maxPlasmaRate = weapon[0].reload[0]; + currentGame.minPlasmaRate++; + if (currentGame.maxPlasmaRate < currentGame.minPlasmaRate) + currentGame.maxPlasmaRate = currentGame.minPlasmaRate; break; case 8: - if (currentGame.maxPlasmaAmmo == 250) + if (currentGame.maxPlasmaAmmo >= 250) {shopSelectedItem = -3; return;} limitCharAdd(¤tGame.maxPlasmaAmmo, 10, 0, 250); break; @@ -626,22 +626,22 @@ static void sell(int i) switch (i) { case 0: - if (currentGame.maxPlasmaOutput == 2) + if (currentGame.maxPlasmaOutput <= 2) {shopSelectedItem = -5; return;} currentGame.maxPlasmaOutput--; break; case 1: - if (currentGame.maxPlasmaDamage == 2) + if (currentGame.maxPlasmaDamage <= 2) {shopSelectedItem = -5; return;} currentGame.maxPlasmaDamage--; break; case 2: - if (currentGame.maxPlasmaRate == 13) + if (currentGame.maxPlasmaRate <= 2) {shopSelectedItem = -5; return;} - currentGame.maxPlasmaRate += 2; + currentGame.maxPlasmaRate--; break; case 3: - if (player.ammo[0] == 0) + if (player.ammo[0] <= 0) {shopSelectedItem = -6; return;} if (player.ammo[0] > 9) limitCharAdd(&player.ammo[0], -10, 0, currentGame.maxPlasmaAmmo); @@ -649,33 +649,33 @@ static void sell(int i) player.ammo[0] = 0; break; case 4: - if (player.ammo[1] == 0) + if (player.ammo[1] <= 0) {shopSelectedItem = -6; return;} player.ammo[1]--; break; case 5: - if (weapon[0].ammo[0] == 1) + if (currentGame.minPlasmaOutput <= 1) {shopSelectedItem = -5; return;} - weapon[0].ammo[0]--; + currentGame.minPlasmaOutput--; break; case 6: - if (weapon[0].damage == 1) + if (currentGame.minPlasmaDamage <= 1) {shopSelectedItem = -5; return;} - weapon[0].damage--; + currentGame.minPlasmaDamage--; break; case 7: - if (weapon[0].reload[0] == 15) + if (currentGame.minPlasmaRate <= 1) {shopSelectedItem = -5; return;} - weapon[0].reload[0] += 2; + currentGame.minPlasmaRate--; break; case 8: - if (currentGame.maxPlasmaAmmo == 100) + if (currentGame.maxPlasmaAmmo <= 100) {shopSelectedItem = -1; return;} currentGame.maxPlasmaAmmo -= 10; limitChar(&player.ammo[0], 0, currentGame.maxPlasmaAmmo); break; case 9: - if (currentGame.maxRocketAmmo == 0) + if (currentGame.maxRocketAmmo <= 0) {shopSelectedItem = -1; return;} currentGame.maxRocketAmmo -= 5; limitChar(&player.ammo[1], 0, currentGame.maxRocketAmmo); diff --git a/code/structs.h b/code/structs.h index 28b5f64..3af75db 100644 --- a/code/structs.h +++ b/code/structs.h @@ -123,7 +123,6 @@ struct Game { object thePlayer; object playerWeapon; - object playerWeapon2; unsigned char system; unsigned char area; @@ -166,6 +165,9 @@ struct Game { char destinationName[20]; int distanceCovered; + unsigned char minPlasmaRate; + unsigned char minPlasmaDamage; + unsigned char minPlasmaOutput; unsigned char maxPlasmaRate; unsigned char maxPlasmaDamage; unsigned char maxPlasmaOutput; diff --git a/code/weapons.cpp b/code/weapons.cpp index f1ea76e..a6e8830 100644 --- a/code/weapons.cpp +++ b/code/weapons.cpp @@ -116,9 +116,6 @@ void initWeapons() weapon[W_PLAYER_WEAPON].imageIndex[1] = 0; weapon[W_PLAYER_WEAPON].flags = 0; - // Nor is this one! - weapon[W_PLAYER_WEAPON2] = weapon[W_PLAYER_WEAPON]; - // Single Shot weapon[W_SINGLE_SHOT].id = WT_PLASMA; weapon[W_SINGLE_SHOT].ammo[0] = 1;