2011-08-24 14:14:44 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2003 Parallel Realities
|
2015-03-01 21:37:32 +01:00
|
|
|
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
2019-05-22 00:47:32 +02:00
|
|
|
Copyright (C) 2015-2019 Julie Marchant <onpon4@riseup.net>
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
2015-02-26 17:20:36 +01:00
|
|
|
as published by the Free Software Foundation; either version 3
|
2011-08-24 14:14:44 +02:00
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-02-26 17:20:36 +01:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2015-02-26 17:20:36 +01:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-24 14:14:44 +02:00
|
|
|
*/
|
|
|
|
|
2019-06-06 04:13:48 +02:00
|
|
|
#include <libintl.h>
|
2017-01-25 16:48:29 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "SDL.h"
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-26 00:21:31 +01:00
|
|
|
#include "defs.h"
|
|
|
|
#include "structs.h"
|
|
|
|
|
2017-01-25 16:48:29 +01:00
|
|
|
#include "engine.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "gfx.h"
|
2017-02-05 18:14:28 +01:00
|
|
|
#include "intermission.h"
|
2017-01-25 16:48:29 +01:00
|
|
|
#include "player.h"
|
|
|
|
#include "save.h"
|
|
|
|
#include "screen.h"
|
2019-05-21 07:51:39 +02:00
|
|
|
#include "shop.h"
|
2017-01-25 16:48:29 +01:00
|
|
|
#include "weapons.h"
|
|
|
|
|
2016-11-26 00:35:25 +01:00
|
|
|
typedef struct ShopItem_ {
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
int price;
|
2019-06-12 16:57:16 +02:00
|
|
|
char name[STRMAX_SHORT];
|
2019-06-02 17:28:26 +02:00
|
|
|
char description[STRMAX];
|
2016-11-26 00:35:25 +01:00
|
|
|
int image;
|
|
|
|
|
|
|
|
} ShopItem;
|
|
|
|
|
2016-01-05 04:25:00 +01:00
|
|
|
static ShopItem shopItems[SHOP_MAX];
|
2016-01-07 02:35:37 +01:00
|
|
|
static int shopSelectedItem;
|
2011-08-26 21:29:04 +02:00
|
|
|
|
2015-03-07 01:50:36 +01:00
|
|
|
static void sell(int i);
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void drawSecondaryWeaponSurface()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2012-03-11 15:16:19 +01:00
|
|
|
char description[50] = "";
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Secondary Weapon"), 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SECONDARY]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
switch (player.weaponType[1])
|
|
|
|
{
|
|
|
|
case W_NONE:
|
2019-06-09 22:08:30 +02:00
|
|
|
/// Used to indicate that there is not Secondary Weapon.
|
|
|
|
strcpy(description, _("Uninstalled"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_ROCKETS:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Rockets"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_DOUBLE_ROCKETS:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Dbl Rockets"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_MICRO_ROCKETS:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Micro Rockets"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_LASER:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Laser"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_CHARGER:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Charger"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_HOMING_MISSILE:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Homing Missile"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_DOUBLE_HOMING_MISSILES:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Dbl Homing Missiles"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
case W_MICRO_HOMING_MISSILES:
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(description, _("Mcr Homing Missiles"));
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
}
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SECONDARY]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
if ((player.weaponType[1] != W_LASER) &&
|
|
|
|
(player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_NONE))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2019-06-07 06:18:24 +02:00
|
|
|
/// Retain "%d" as-is. It is replaced with the rocket capacity of the Firefly.
|
|
|
|
sprintf(description, _("Capacity : %d"), game.maxRocketAmmo);
|
|
|
|
gfx_renderUnicode(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SECONDARY]);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void adjustShopPrices()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
2015-03-29 00:52:03 +01:00
|
|
|
{
|
2016-01-08 17:27:28 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = 500 * game.maxPlasmaOutput;
|
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 500 * game.maxPlasmaDamage;
|
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].price = 500 * (game.maxPlasmaRate * 2 - 1);
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
|
2016-01-08 17:27:28 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 2000 * game.minPlasmaOutput;
|
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 2000 * game.minPlasmaDamage;
|
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].price = 2000 * (game.minPlasmaRate * 2 - 1);
|
2015-03-29 00:52:03 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-08 17:27:28 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = 1000 * (game.maxPlasmaOutput + 1);
|
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 1000 * (game.maxPlasmaDamage + 1);
|
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].price = 1000 * (game.maxPlasmaRate + 1);
|
2015-03-29 00:52:03 +01:00
|
|
|
|
2016-01-08 17:27:28 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 1500 * (game.minPlasmaOutput + 1);
|
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 1500 * (game.minPlasmaDamage + 1);
|
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].price = 1500 * (game.minPlasmaRate + 1);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-11-28 05:24:03 +01:00
|
|
|
if (game.maxPlasmaOutput <= game.minPlasmaOutput)
|
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].price += shopItems[SHOP_PLASMA_MAX_OUTPUT].price;
|
|
|
|
if (game.maxPlasmaDamage <= game.minPlasmaDamage)
|
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].price += shopItems[SHOP_PLASMA_MAX_DAMAGE].price;
|
|
|
|
if (game.maxPlasmaRate <= game.minPlasmaRate)
|
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].price += shopItems[SHOP_PLASMA_MAX_RATE].price;
|
|
|
|
}
|
2015-03-06 17:48:45 +01:00
|
|
|
|
2019-05-21 19:17:07 +02:00
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].price = (5 * game.maxPlasmaAmmo);
|
|
|
|
else
|
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].price = (10 * (game.maxPlasmaAmmo - 75));
|
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
shopItems[SHOP_ROCKET_MAX_AMMO].price = (25 * game.maxRocketAmmo);
|
2019-06-06 04:13:48 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaOutput >= game.maxPlasmaOutputLimit)
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaDamage >= game.maxPlasmaDamageLimit)
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaRate >= game.maxPlasmaRateLimit)
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].price = 0;
|
2019-06-06 04:13:48 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaOutput >= game.minPlasmaOutputLimit)
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaDamage >= game.minPlasmaDamageLimit)
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaRate >= game.minPlasmaRateLimit)
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].price = 0;
|
2015-03-07 21:34:47 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaAmmo >= game.maxPlasmaAmmoLimit)
|
2015-03-07 21:34:47 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].price = 0;
|
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxRocketAmmo >= game.maxRocketAmmoLimit)
|
2015-03-07 21:34:47 +01:00
|
|
|
shopItems[SHOP_ROCKET_MAX_AMMO].price = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void drawShop()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2019-06-12 16:57:16 +02:00
|
|
|
char description[STRMAX];
|
2016-01-07 02:35:37 +01:00
|
|
|
int icons = SHOP_MAX;
|
|
|
|
|
2011-08-24 14:14:44 +02:00
|
|
|
adjustShopPrices();
|
|
|
|
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].x = SHOP_X;
|
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].x = SHOP_X + 50;
|
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].x = SHOP_X + 100;
|
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].x = SHOP_X;
|
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].x = SHOP_X + 50;
|
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].x = SHOP_X + 100;
|
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_AMMO].x = SHOP_X + 250;
|
|
|
|
shopItems[SHOP_PLASMA_AMMO].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_ROCKET_AMMO].x = SHOP_X + 300;
|
|
|
|
shopItems[SHOP_ROCKET_AMMO].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].x = SHOP_X + 350;
|
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_ROCKET_MAX_AMMO].x = SHOP_X + 400;
|
|
|
|
shopItems[SHOP_ROCKET_MAX_AMMO].y = SHOP_Y + 70;
|
|
|
|
|
|
|
|
shopItems[SHOP_DOUBLE_ROCKETS].x = SHOP_X + 250;
|
|
|
|
shopItems[SHOP_DOUBLE_ROCKETS].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_MICRO_ROCKETS].x = SHOP_X + 300;
|
|
|
|
shopItems[SHOP_MICRO_ROCKETS].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_LASER].x = SHOP_X + 350;
|
|
|
|
shopItems[SHOP_LASER].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_HOMING_MISSILE].x = SHOP_X + 400;
|
|
|
|
shopItems[SHOP_HOMING_MISSILE].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_CHARGER].x = SHOP_X + 450;
|
|
|
|
shopItems[SHOP_CHARGER].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_DOUBLE_HOMING_MISSILES].x = SHOP_X + 500;
|
|
|
|
shopItems[SHOP_DOUBLE_HOMING_MISSILES].y = SHOP_Y + 130;
|
|
|
|
|
|
|
|
shopItems[SHOP_MICRO_HOMING_MISSILES].x = SHOP_X + 550;
|
|
|
|
shopItems[SHOP_MICRO_HOMING_MISSILES].y = SHOP_Y + 130;
|
|
|
|
|
2016-01-05 04:25:00 +01:00
|
|
|
for (int i = 0 ; i < SHOP_S_MAX ; i++)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
if (gfx_shopSprites[i] != NULL)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
SDL_FreeSurface(gfx_shopSprites[i]);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-04 23:12:16 +01:00
|
|
|
gfx_shopSprites[SHOP_S_PRIMARY] = gfx_createSurface(190, 91);
|
|
|
|
gfx_shopSprites[SHOP_S_POWERUP] = gfx_createSurface(190, 91);
|
|
|
|
gfx_shopSprites[SHOP_S_SECONDARY] = gfx_createSurface(190, 91);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2017-02-04 23:12:16 +01:00
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 189, 90, 0x00, 0x00, 0x55);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 189, 20, 0x00, 0x00, 0x99);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 189, 90, 0x00, 0x00, 0x55);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 189, 20, 0x00, 0x00, 0x99);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 189, 90, 0x00, 0x00, 0x55);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 189, 20, 0x00, 0x00, 0x99);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_shopSprites[SHOP_S_SHIP_INFO] = gfx_createAlphaRect(SHOP_WIDTH + 1, 41, 0x00, 0x00, 0x00);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SHIP_INFO], 0, 0, SHOP_WIDTH, 40, 0x00, 0x00, 0x33);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
switch (shopSelectedItem)
|
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
case SHOP_NOTHING:
|
|
|
|
case SHOP_ERROR_INSUFFICIENT_FUNDS:
|
|
|
|
case SHOP_ERROR_CANNOT_UPGRADE:
|
|
|
|
case SHOP_ERROR_AMMO_LIMIT:
|
|
|
|
case SHOP_ERROR_CANNOT_SELL:
|
|
|
|
case SHOP_ERROR_NOTHING_TO_SELL:
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2016-01-05 04:25:00 +01:00
|
|
|
case SHOP_PLASMA_MAX_OUTPUT:
|
|
|
|
case SHOP_PLASMA_MAX_DAMAGE:
|
|
|
|
case SHOP_PLASMA_MAX_RATE:
|
|
|
|
case SHOP_PLASMA_MAX_AMMO:
|
2017-02-04 23:12:16 +01:00
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 189, 90, 0x55, 0x00, 0x00);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 189, 20, 0x99, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2016-01-05 04:25:00 +01:00
|
|
|
case SHOP_PLASMA_MIN_OUTPUT:
|
|
|
|
case SHOP_PLASMA_MIN_DAMAGE:
|
|
|
|
case SHOP_PLASMA_MIN_RATE:
|
2017-02-04 23:12:16 +01:00
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 189, 90, 0x55, 0x00, 0x00);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 189, 20, 0x99, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2016-01-05 04:25:00 +01:00
|
|
|
case SHOP_PLASMA_AMMO:
|
|
|
|
case SHOP_ROCKET_AMMO:
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SHIP_INFO], 0, 0, SHOP_WIDTH, 40, 0x33, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
default:
|
2017-02-04 23:12:16 +01:00
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 189, 90, 0x55, 0x00, 0x00);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 189, 20, 0x99, 0x00, 0x00);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(description, "");
|
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Primary Weapon"), 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the min plasma output.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Cannons: %d"), game.minPlasmaOutput);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the min plasma damage.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Power: Stage %d"),
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaDamage);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the min plasma cooling.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Cooling: Stage %d"),
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaRate);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Powerup Weapon"), 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the max plasma output.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Splitter: Stage %d"),
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaOutput);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the max plasma damage.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Condensor: Stage %d"),
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaDamage);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the max plasma cooling.
|
|
|
|
sprintf(description, _("L.Nitrogen: Stage %d"),
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaRate);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the Firefly's plasma ammo capacity.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Capacity: %d"), game.maxPlasmaAmmo);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 67, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
drawSecondaryWeaponSurface();
|
|
|
|
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_shopSprites[SHOP_S_CATALOG] = gfx_createSurface(SHOP_WIDTH + 1, 121);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_CATALOG], 0, 0, SHOP_WIDTH, 120, 0x00, 0x00, 0x22);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Temporary Weapons"), 10, 2, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
|
|
|
gfx_renderUnicode(_("Ammo and Storage"), 260, 2, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Primary Weapons"), 10, 62, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Secondary Weapons"), 260, 62, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.system == 0)
|
2015-03-06 21:22:10 +01:00
|
|
|
icons = SHOP_DOUBLE_ROCKETS + 1;
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.system == 1)
|
2015-03-06 21:22:10 +01:00
|
|
|
icons = SHOP_LASER + 1;
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.system == 2)
|
2015-03-06 21:22:10 +01:00
|
|
|
icons = SHOP_CHARGER + 1;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
for (int i = 0 ; i < icons ; i++)
|
2015-03-06 22:25:12 +01:00
|
|
|
{
|
2019-05-21 07:51:39 +02:00
|
|
|
gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x + 10 - SHOP_X,
|
|
|
|
shopItems[i].y - SHOP_Y - 48, gfx_shopSprites[SHOP_S_CATALOG]);
|
2015-03-06 22:25:12 +01:00
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
/// Retain "%d" as-is. It is replaced with the Firefly's max shield.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Shield: %d"), player.maxShield);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 6, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
|
|
|
/// Retain "%d" as-is. It is replaced with the player's current cash.
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Cash: $%d"), game.cash);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
|
|
|
/// Retain "%.3d". It is replaced with the ship's current number of plasma cells.
|
|
|
|
/// "%.3d" can be changed to "%d" if you wish to not fill in space with zeroes,
|
|
|
|
/// e.g. render the number 5 as "5" rather than "005".
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Plasma Cells: %.3d"), player.ammo[0]);
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_renderUnicode(description, SHOP_WIDTH - gfx_unicodeWidth(description) - 10, 6, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
2019-06-07 06:18:24 +02:00
|
|
|
/// Retain "%.2d". It is replaced with the ship's current number of rockets.
|
|
|
|
/// "%.2d" can be changed to "%d" if you wish to not fill in space with zeroes,
|
|
|
|
/// e.g. render the number 3 as "3" rather than "03".
|
2019-06-12 02:08:29 +02:00
|
|
|
sprintf(description, _("Rockets: %.2d"), player.ammo[1]);
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_renderUnicode(description, SHOP_WIDTH - gfx_unicodeWidth(description) - 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-12 16:57:16 +02:00
|
|
|
gfx_shopSprites[SHOP_S_ITEM_INFO] = gfx_createSurface(SHOP_WIDTH + 1, 56);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_ITEM_INFO], 0, 0, SHOP_WIDTH, 35, 0x00, 0x99, 0x00);
|
|
|
|
gfx_drawRect(gfx_shopSprites[SHOP_S_ITEM_INFO], 0, 20, SHOP_WIDTH, 35, 0x00, 0x33, 0x00);
|
2019-06-07 06:18:24 +02:00
|
|
|
gfx_renderUnicode(_("Information"), 5, 4, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
switch (shopSelectedItem)
|
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
case SHOP_NOTHING:
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_INSUFFICIENT_FUNDS:
|
|
|
|
/// For when the player attempts to buy something they can't afford.
|
|
|
|
gfx_renderUnicode(_("You don't have enough money"), 20, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_CANNOT_UPGRADE:
|
|
|
|
/// For when the player attempts an upgrade beyond the maximum (line 1 of 2).
|
|
|
|
gfx_renderUnicode(_("Cannot upgrade ship"), 5, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
|
|
|
|
/// For when the player attempts an upgrade beyond the maximum (line 2 of 2).
|
|
|
|
gfx_renderUnicode(_("Hardware capacity has been reached"), 20, 38, FONT_CYAN, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_AMMO_LIMIT:
|
|
|
|
/// For when the player attempts to buy more ammo than the ship can hold.
|
|
|
|
gfx_renderUnicode(_("Ammunition limit reached"), 20, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_CANNOT_SELL:
|
|
|
|
/// For when the player attempts to sell an item they aren't allowed to sell.
|
|
|
|
gfx_renderUnicode(_("You cannot sell that item"), 20, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_NOTHING_TO_SELL:
|
|
|
|
/// For when the player attempts to sell an item they don't have any of.
|
|
|
|
gfx_renderUnicode(_("Nothing to sell"), 20, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_IS_NOT_ROCKETS:
|
|
|
|
/// For when the player attempts to buy rockets or rocket capacity
|
|
|
|
/// while secondary weapon is either laser or charge cannon.
|
|
|
|
gfx_renderUnicode(_("Rockets cannot be bought for Laser or Charger Cannon"), 5, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_ALREADY_OWNED:
|
|
|
|
/// For when the player attempts to buy a weapon they already have.
|
|
|
|
gfx_renderUnicode(_("You already have that weapon"), 20, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
|
|
|
break;
|
|
|
|
case SHOP_ERROR_WEAPON_CAPACITY:
|
|
|
|
/// For when the player attempts to increase rocket capacity beyond
|
|
|
|
/// what is allowed for the weapon (used for homing missiles).
|
|
|
|
gfx_renderUnicode(_("This weapon's ammo limit has been reached"), 20, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (shopItems[shopSelectedItem].price != 0)
|
|
|
|
{
|
2019-06-07 06:18:24 +02:00
|
|
|
/// Used to put a shop item's name next to its price.
|
|
|
|
/// "%s" is replaced with the item name, and "%d" is replaced
|
|
|
|
/// with the item price.
|
|
|
|
sprintf(description, _("%s ($%d)"),
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[shopSelectedItem].description,
|
|
|
|
shopItems[shopSelectedItem].price);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-06-07 06:18:24 +02:00
|
|
|
/// Used for shop items that cannot be bought.
|
|
|
|
/// "%s" is replaced with the item name.
|
|
|
|
sprintf(description, _("%s (N/A)"),
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[shopSelectedItem].description);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
2019-06-06 04:13:48 +02:00
|
|
|
gfx_renderUnicode(shopItems[shopSelectedItem].name, 5, 22,
|
2016-01-05 04:25:00 +01:00
|
|
|
FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
2019-06-05 01:10:24 +02:00
|
|
|
gfx_renderUnicode(description, 20, 38, FONT_CYAN, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-26 00:01:36 +01:00
|
|
|
void shop_init()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
/* ----------- Temporary Items ----------- */
|
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_OUTPUT].name, _("Plasma Channel Splitter"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Plasma Channel Splitter (PLASMA_MAX_OUTPUT)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_OUTPUT].description, _("Improves poweredup plasma output"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MAX_OUTPUT].image = SP_PLASMA_MAX_OUTPUT;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_DAMAGE].name, _("Plasma Capacity Condensor"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Plasma Capacity Condensor (PLASMA_MAX_DAMAGE)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_DAMAGE].description, _("Increases poweredup plasma damage"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MAX_DAMAGE].image = SP_PLASMA_MAX_POWER;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_RATE].name, _("Liquid Nitrogen Capsules"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Liquid Nitrogen Capsules (PLASMA_MAX_RATE)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_RATE].description, _("Increases plasma firing rate"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MAX_RATE].image = SP_PLASMA_MAX_RATE;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-01-08 17:13:56 +01:00
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
|
|
|
shopItems[SHOP_PLASMA_AMMO].price = 50;
|
|
|
|
else
|
|
|
|
shopItems[SHOP_PLASMA_AMMO].price = 1;
|
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_AMMO].name, _("Plasma Cells"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Plasma Cells
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_AMMO].description, _("Plasma ammunition (10 cells each)"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_AMMO].image = SP_PLASMA_AMMO;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-01-08 17:13:56 +01:00
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
|
|
|
shopItems[SHOP_ROCKET_AMMO].price = 50;
|
|
|
|
else
|
|
|
|
shopItems[SHOP_ROCKET_AMMO].price = 1;
|
|
|
|
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_ROCKET_AMMO].name, _("Rocket Ammo"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Rocket Ammo
|
|
|
|
strcpy(shopItems[SHOP_ROCKET_AMMO].description, _("High velocity dumb fire rocket"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_ROCKET_AMMO].image = SP_ROCKET_AMMO;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
/* ----------- Permanent Items ----------- */
|
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MIN_OUTPUT].name, _("Additional Plasma Cannon"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Additional Plasma Cannon (PLASMA_MIN_OUTPUT)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MIN_OUTPUT].description, _("Adds an extra plasma cannon to the Firefly"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MIN_OUTPUT].image = SP_PLASMA_MIN_OUTPUT;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MIN_DAMAGE].name, _("Plasma Power Booster"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Plasma Power Booster (PLASMA_MIN_DAMAGE)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MIN_DAMAGE].description, _("Increases power of plasma shots"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MIN_DAMAGE].image = SP_PLASMA_MIN_POWER;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MIN_RATE].name, _("Plasma Cooling Booster"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Plasma Cooling Booster (PLASMA_MIN_RATE)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MIN_RATE].description, _("Permanently increases firing rate"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MIN_RATE].image = SP_PLASMA_MIN_RATE;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
/* ----------- Ammo Items -------------- */
|
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_AMMO].name, _("Plasma Compressor"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Plasma Compressor (PLASMA_MAX_AMMO)
|
|
|
|
strcpy(shopItems[SHOP_PLASMA_MAX_AMMO].description, _("Increases plasma ammo capacity"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_PLASMA_MAX_AMMO].image = SP_PLASMA_MAX_AMMO;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-07 15:42:24 +01:00
|
|
|
shopItems[SHOP_ROCKET_MAX_AMMO].price = 0; // Overwritten later
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_ROCKET_MAX_AMMO].name, _("Rocket Pod"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Rocket Pod (ROCKET_MAX_AMMO)
|
|
|
|
strcpy(shopItems[SHOP_ROCKET_MAX_AMMO].description, _("Allows for an additional 5 rockets to be carried"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_ROCKET_MAX_AMMO].image = SP_ROCKET_MAX_AMMO;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
/* ---------- Weaponary --------------- */
|
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_DOUBLE_ROCKETS].price = 2000;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_DOUBLE_ROCKETS].name, _("Dual Rocket Launcher"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Dual Rocket Launcher
|
|
|
|
strcpy(shopItems[SHOP_DOUBLE_ROCKETS].description, _("Launches two rockets at once"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_DOUBLE_ROCKETS].image = SP_DOUBLE_ROCKETS;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_MICRO_ROCKETS].price = 2500;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_MICRO_ROCKETS].name, _("Micro Rocket Launcher"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Micro Rocket Launcher
|
|
|
|
strcpy(shopItems[SHOP_MICRO_ROCKETS].description, _("Launches several less powerful rockets at once"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_MICRO_ROCKETS].image = SP_MICRO_ROCKETS;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_LASER].price = 5000;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_LASER].name, _("Laser Cannon"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Laser Cannon
|
|
|
|
strcpy(shopItems[SHOP_LASER].description, _("Fires a continuous stream of energy particles"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_LASER].image = SP_LASER;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_HOMING_MISSILE].price = 7500;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_HOMING_MISSILE].name, _("Homing Missile Launcher"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Homing Missile Launcher
|
|
|
|
/// %i must be retained. It is replaced by the maximum missile
|
|
|
|
/// capacity of the weapon.
|
2019-06-07 06:18:24 +02:00
|
|
|
sprintf(shopItems[SHOP_HOMING_MISSILE].description, _("Fires homing missile (max %i missiles)"), MAX_HOMING);
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_HOMING_MISSILE].image = SP_HOMING_MISSILE;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_CHARGER].price = 10000;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_CHARGER].name, _("Charge Cannon"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Charge Cannon
|
|
|
|
strcpy(shopItems[SHOP_CHARGER].description, _("Compacts plasma into clusters for greater damage"));
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_CHARGER].image = SP_CHARGER;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_DOUBLE_HOMING_MISSILES].price = 10000;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_DOUBLE_HOMING_MISSILES].name, _("Dual Homing Missile Launcher"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Dual Homing Missile Launcher
|
|
|
|
/// %i must be retained. It is replaced by the maximum missile
|
|
|
|
/// capacity of the weapon.
|
|
|
|
sprintf(shopItems[SHOP_DOUBLE_HOMING_MISSILES].description, _("Fires two homing missiles (max %i missiles)"), MAX_DOUBLE_HOMING);
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_DOUBLE_HOMING_MISSILES].image = SP_DOUBLE_HOMING_MISSILES;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
shopItems[SHOP_MICRO_HOMING_MISSILES].price = 15000;
|
2019-06-07 06:18:24 +02:00
|
|
|
strcpy(shopItems[SHOP_MICRO_HOMING_MISSILES].name, _("Micro Homing Missile Launcher"));
|
2019-06-06 04:13:48 +02:00
|
|
|
/// Shop item description: Micro Homing Missile Launcher
|
|
|
|
/// %i must be retained. It is replaced by the maximum missile
|
|
|
|
/// capacity of the weapon.
|
|
|
|
sprintf(shopItems[SHOP_MICRO_HOMING_MISSILES].description, _("Fires several small homing missiles (max %i missiles)"), MAX_MICRO_HOMING);
|
2019-06-01 04:33:28 +02:00
|
|
|
shopItems[SHOP_MICRO_HOMING_MISSILES].image = SP_MICRO_HOMING_MISSILES;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
drawShop();
|
|
|
|
}
|
|
|
|
|
2015-03-07 01:50:36 +01:00
|
|
|
static void shop_sellSecondaryWeapon()
|
|
|
|
{
|
|
|
|
switch (player.weaponType[1])
|
|
|
|
{
|
|
|
|
case W_DOUBLE_ROCKETS:
|
2015-03-18 00:20:04 +01:00
|
|
|
sell(SHOP_DOUBLE_ROCKETS);
|
2015-03-07 01:50:36 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case W_MICRO_ROCKETS:
|
|
|
|
sell(SHOP_MICRO_ROCKETS);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case W_LASER:
|
|
|
|
sell(SHOP_LASER);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case W_HOMING_MISSILE:
|
|
|
|
sell(SHOP_HOMING_MISSILE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case W_CHARGER:
|
|
|
|
sell(SHOP_CHARGER);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case W_DOUBLE_HOMING_MISSILES:
|
|
|
|
sell(SHOP_DOUBLE_HOMING_MISSILES);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case W_MICRO_HOMING_MISSILES:
|
|
|
|
sell(SHOP_MICRO_HOMING_MISSILES);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void buy(int i)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-05-21 01:41:43 +02:00
|
|
|
if ((game.cash < shopItems[i].price) && (!engine.cheatCash))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_INSUFFICIENT_FUNDS;
|
2011-08-24 14:14:44 +02:00
|
|
|
drawShop();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
switch (i)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_OUTPUT:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaOutput >= game.maxPlasmaOutputLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaOutput++;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_DAMAGE:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaDamage >= game.maxPlasmaDamageLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaDamage++;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_RATE:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaRate >= game.maxPlasmaRateLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaRate++;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_AMMO:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (player.ammo[0] >= game.maxPlasmaAmmo)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_AMMO_LIMIT;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
LIMIT_ADD(player.ammo[0], 10, 0, game.maxPlasmaAmmo);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_ROCKET_AMMO:
|
2015-03-06 18:36:02 +01:00
|
|
|
if ((player.weaponType[1] == W_CHARGER) ||
|
|
|
|
(player.weaponType[1] == W_LASER))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_IS_NOT_ROCKETS;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
if (player.ammo[1] == game.maxRocketAmmo)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_AMMO_LIMIT;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((player.weaponType[1] == W_HOMING_MISSILE) &&
|
2019-05-21 07:51:39 +02:00
|
|
|
(player.ammo[1] >= MAX_HOMING))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) &&
|
2019-05-21 07:51:39 +02:00
|
|
|
(player.ammo[1] >= MAX_DOUBLE_HOMING))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) &&
|
2019-05-21 07:51:39 +02:00
|
|
|
(player.ammo[1] >= MAX_MICRO_HOMING))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
player.ammo[1]++;
|
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MIN_OUTPUT:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaOutput >= game.minPlasmaOutputLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaOutput++;
|
|
|
|
if (game.maxPlasmaOutput < game.minPlasmaOutput)
|
|
|
|
game.maxPlasmaOutput = game.minPlasmaOutput;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MIN_DAMAGE:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaDamage >= game.minPlasmaDamageLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaDamage++;
|
|
|
|
if (game.maxPlasmaDamage < game.minPlasmaDamage)
|
|
|
|
game.maxPlasmaDamage = game.minPlasmaDamage;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MIN_RATE:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaRate >= game.minPlasmaRateLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaRate++;
|
|
|
|
if (game.maxPlasmaRate < game.minPlasmaRate)
|
|
|
|
game.maxPlasmaRate = game.minPlasmaRate;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_AMMO:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaAmmo >= game.maxPlasmaAmmoLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_UPGRADE;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-21 19:17:07 +02:00
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
|
|
|
game.maxPlasmaAmmo += 10;
|
|
|
|
else
|
|
|
|
game.maxPlasmaAmmo += 25;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_ROCKET_MAX_AMMO:
|
2015-03-06 18:36:02 +01:00
|
|
|
if ((player.weaponType[1] == W_CHARGER) ||
|
|
|
|
(player.weaponType[1] == W_LASER))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_IS_NOT_ROCKETS;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-06 18:36:02 +01:00
|
|
|
if ((player.weaponType[1] == W_HOMING_MISSILE) &&
|
2019-05-21 07:51:39 +02:00
|
|
|
(game.maxRocketAmmo >= MAX_HOMING))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-06 18:36:02 +01:00
|
|
|
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) &&
|
2019-05-21 07:51:39 +02:00
|
|
|
(game.maxRocketAmmo >= MAX_DOUBLE_HOMING))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-06 18:36:02 +01:00
|
|
|
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) &&
|
2019-05-21 07:51:39 +02:00
|
|
|
(game.maxRocketAmmo >= MAX_MICRO_HOMING))
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxRocketAmmo >= game.maxRocketAmmoLimit)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_WEAPON_CAPACITY;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxRocketAmmo += 5;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_DOUBLE_ROCKETS:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_DOUBLE_ROCKETS)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_DOUBLE_ROCKETS;
|
2015-05-21 01:41:43 +02:00
|
|
|
LIMIT(game.maxRocketAmmo, 5, 50);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_MICRO_ROCKETS:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_MICRO_ROCKETS)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_MICRO_ROCKETS;
|
2015-05-21 01:41:43 +02:00
|
|
|
LIMIT(game.maxRocketAmmo, 5, 50);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_LASER:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_LASER)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_LASER;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2016-11-26 19:12:15 +01:00
|
|
|
if (game.difficulty != DIFFICULTY_ORIGINAL)
|
|
|
|
{
|
|
|
|
while (game.maxRocketAmmo > 5)
|
|
|
|
sell(SHOP_ROCKET_MAX_AMMO);
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
while (player.ammo[1] > 0)
|
|
|
|
sell(SHOP_ROCKET_AMMO);
|
|
|
|
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_HOMING_MISSILE:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_HOMING_MISSILE)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_HOMING_MISSILE;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
while (game.maxRocketAmmo > MAX_HOMING)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_ROCKET_MAX_AMMO);
|
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
LIMIT(game.maxRocketAmmo, 5, MAX_HOMING);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_CHARGER:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_CHARGER)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_CHARGER;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2016-11-26 19:12:15 +01:00
|
|
|
if (game.difficulty != DIFFICULTY_ORIGINAL)
|
|
|
|
{
|
|
|
|
while (game.maxRocketAmmo > 5)
|
|
|
|
sell(SHOP_ROCKET_MAX_AMMO);
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
while (player.ammo[1] > 0)
|
|
|
|
sell(SHOP_ROCKET_AMMO);
|
|
|
|
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_DOUBLE_HOMING_MISSILES:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_DOUBLE_HOMING_MISSILES)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_DOUBLE_HOMING_MISSILES;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
while (game.maxRocketAmmo > MAX_DOUBLE_HOMING)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_ROCKET_MAX_AMMO);
|
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
LIMIT(game.maxRocketAmmo, 5, MAX_DOUBLE_HOMING);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_MICRO_HOMING_MISSILES:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] == W_MICRO_HOMING_MISSILES)
|
2015-03-03 15:25:32 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_ALREADY_OWNED;
|
2015-03-03 15:25:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
shop_sellSecondaryWeapon();
|
2011-08-24 14:14:44 +02:00
|
|
|
player.weaponType[1] = W_MICRO_HOMING_MISSILES;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
while (game.maxRocketAmmo > MAX_MICRO_HOMING)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_ROCKET_MAX_AMMO);
|
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
LIMIT(game.maxRocketAmmo, 5, MAX_MICRO_HOMING);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!engine.cheatCash)
|
2015-05-21 01:41:43 +02:00
|
|
|
game.cash -= shopItems[i].price;
|
2016-11-17 01:43:03 +01:00
|
|
|
save(0);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
static void sell(int i)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
switch (i)
|
|
|
|
{
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_OUTPUT:
|
2016-11-28 05:46:36 +01:00
|
|
|
if (game.maxPlasmaOutput <= ((game.difficulty != DIFFICULTY_ORIGINAL) ? 1 : 2))
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
while (game.minPlasmaOutput >= game.maxPlasmaOutput)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_PLASMA_MIN_OUTPUT);
|
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaOutput--;
|
2016-11-25 19:47:12 +01:00
|
|
|
if (weapons[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput + 1)
|
|
|
|
weapons[W_PLAYER_WEAPON].ammo[0] = MIN(
|
|
|
|
weapons[W_PLAYER_WEAPON].ammo[0],
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaOutput);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_DAMAGE:
|
2016-11-28 05:46:36 +01:00
|
|
|
if (game.maxPlasmaDamage <= ((game.difficulty != DIFFICULTY_ORIGINAL) ? 1 : 2))
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
while (game.minPlasmaDamage >= game.maxPlasmaDamage)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_PLASMA_MIN_DAMAGE);
|
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaDamage--;
|
2016-11-25 19:47:12 +01:00
|
|
|
if (weapons[W_PLAYER_WEAPON].damage <= game.maxPlasmaDamage + 1)
|
|
|
|
weapons[W_PLAYER_WEAPON].damage = MIN(
|
|
|
|
weapons[W_PLAYER_WEAPON].damage,
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaDamage);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_RATE:
|
2016-11-28 05:46:36 +01:00
|
|
|
if (game.maxPlasmaRate <= ((game.difficulty != DIFFICULTY_ORIGINAL) ? 1 : 2))
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
while (game.minPlasmaRate >= game.maxPlasmaRate)
|
2015-03-29 14:58:03 +02:00
|
|
|
sell(SHOP_PLASMA_MIN_RATE);
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxPlasmaRate--;
|
2016-11-25 19:47:12 +01:00
|
|
|
if (weapons[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.maxPlasmaRate + 1])
|
|
|
|
weapons[W_PLAYER_WEAPON].reload[0] = MAX(
|
|
|
|
weapons[W_PLAYER_WEAPON].reload[0],
|
2015-05-21 01:41:43 +02:00
|
|
|
rate2reload[game.maxPlasmaRate]);
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MIN_OUTPUT:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaOutput <= 1)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaOutput--;
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
if (player.ammo[0] <= 0)
|
2016-11-25 19:47:12 +01:00
|
|
|
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MIN_DAMAGE:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaDamage <= 1)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaDamage--;
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
if (player.ammo[0] <= 0)
|
2016-11-25 19:47:12 +01:00
|
|
|
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MIN_RATE:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.minPlasmaRate <= 1)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.minPlasmaRate--;
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
if (player.ammo[0] <= 0)
|
2016-11-25 19:47:12 +01:00
|
|
|
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
|
|
|
case SHOP_PLASMA_AMMO:
|
|
|
|
if (player.ammo[0] <= 0)
|
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-07 01:50:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (player.ammo[0] > 10)
|
|
|
|
player.ammo[0] -= 10;
|
|
|
|
else
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
{
|
2015-03-07 01:50:36 +01:00
|
|
|
player.ammo[0] = 0;
|
2016-11-25 19:47:12 +01:00
|
|
|
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
|
|
|
|
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
|
|
|
|
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
|
Several adjustments for difficulty purposes.
Started out adjusting prices, then ended up doing other things
while testing. Committing this now before I start doing other
random stuff!
But all of the changes are related to balancing difficulty, mostly
with prices, except for a couple bugfixes in the shop. Most notably:
* Ammo now costs $10, not $50. You no longer have to worry about
saving ammo quite as much as a result.
* Plasma upgrades' cost is now calculated differently, and the result
is slightly lower prices than before.
* Easy mode now grants the player more max ammo than other difficulties.
* Increasing max plasma ammo now costs less at the start, and increases
in cost faster.
* You increase max plasma ammo by 25 at a time, not 10. (10 was just too
small of a number.)
* Destroying enemy ships no longer gives you money. I found that, even
in hard mode, I had *way* too much money coming in, and this cuts it
down substantially. It also makes the shield bonus at the end of missions
much more significant. To compensate for the loss of massive bonuses
bosses used to give, these bosses now drop a lot more stuff.
* Kline has decreased health in his first encounter, and increased health
in his last two encounters (the numbers have been reversed).
2015-03-07 18:19:35 +01:00
|
|
|
}
|
2015-03-07 01:50:36 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOP_ROCKET_AMMO:
|
|
|
|
if (player.ammo[1] <= 0)
|
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-07 01:50:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
player.ammo[1]--;
|
|
|
|
break;
|
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_PLASMA_MAX_AMMO:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxPlasmaAmmo <= 100)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-21 19:17:07 +02:00
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
|
|
|
game.maxPlasmaAmmo -= 10;
|
|
|
|
else
|
|
|
|
game.maxPlasmaAmmo -= 25;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
while (player.ammo[0] > game.maxPlasmaAmmo)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_PLASMA_AMMO);
|
|
|
|
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_ROCKET_MAX_AMMO:
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.maxRocketAmmo <= 5)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_CANNOT_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-21 01:41:43 +02:00
|
|
|
game.maxRocketAmmo -= 5;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
while (player.ammo[1] > game.maxRocketAmmo)
|
2015-03-07 01:50:36 +01:00
|
|
|
sell(SHOP_ROCKET_AMMO);
|
|
|
|
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_DOUBLE_ROCKETS:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_DOUBLE_ROCKETS)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_MICRO_ROCKETS:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_MICRO_ROCKETS)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_LASER:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_LASER)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2011-08-24 14:14:44 +02:00
|
|
|
player.ammo[1] = 0;
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_HOMING_MISSILE:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_HOMING_MISSILE)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_CHARGER:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_CHARGER)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2011-08-24 14:14:44 +02:00
|
|
|
player.ammo[1] = 0;
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_DOUBLE_HOMING_MISSILES:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_DOUBLE_HOMING_MISSILES)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
2015-03-07 01:50:36 +01:00
|
|
|
|
2015-03-06 21:22:10 +01:00
|
|
|
case SHOP_MICRO_HOMING_MISSILES:
|
2011-08-24 14:14:44 +02:00
|
|
|
if (player.weaponType[1] != W_MICRO_HOMING_MISSILES)
|
2015-03-06 18:36:02 +01:00
|
|
|
{
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_ERROR_NOTHING_TO_SELL;
|
2015-03-06 18:36:02 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 02:31:34 +02:00
|
|
|
player.weaponType[1] = (game.difficulty == DIFFICULTY_ORIGINAL ? W_NONE : W_ROCKETS);
|
2019-06-06 04:13:48 +02:00
|
|
|
shopSelectedItem = SHOP_NOTHING;
|
2011-08-24 14:14:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-08-26 15:35:03 +02:00
|
|
|
adjustShopPrices();
|
2015-06-08 04:51:16 +02:00
|
|
|
|
|
|
|
if (game.difficulty == DIFFICULTY_ORIGINAL)
|
|
|
|
game.cash += shopItems[i].price / 2;
|
|
|
|
else
|
|
|
|
game.cash += shopItems[i].price;
|
|
|
|
|
2016-11-17 01:43:03 +01:00
|
|
|
save(0);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2016-11-26 00:01:36 +01:00
|
|
|
void shop_show()
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2017-02-04 23:12:16 +01:00
|
|
|
int icons = SHOP_MAX;
|
2019-05-21 07:51:39 +02:00
|
|
|
int sell_x = SHOP_X + SHOP_WIDTH - gfx_sprites[SP_SELL]->w - 2;
|
|
|
|
int sell_y = SHOP_Y + 183;
|
2017-02-04 23:12:16 +01:00
|
|
|
int buy_x = sell_x - gfx_sprites[SP_BUY]->w - 5;
|
2019-05-21 07:51:39 +02:00
|
|
|
int buy_y = SHOP_Y + 183;
|
2016-01-07 02:35:37 +01:00
|
|
|
|
2019-06-01 04:33:28 +02:00
|
|
|
drawShop();
|
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
screen_blit(gfx_shopSprites[SHOP_S_SHIP_INFO], SHOP_X, SHOP_Y);
|
|
|
|
screen_blit(gfx_shopSprites[SHOP_S_CATALOG], SHOP_X, SHOP_Y + 50);
|
|
|
|
screen_blit(gfx_shopSprites[SHOP_S_ITEM_INFO], SHOP_X, SHOP_Y + 180);
|
|
|
|
screen_blit(gfx_shopSprites[SHOP_S_PRIMARY], SHOP_X, SHOP_Y + 245);
|
|
|
|
screen_blit(gfx_shopSprites[SHOP_S_POWERUP], SHOP_X + 203, SHOP_Y + 245);
|
|
|
|
screen_blit(gfx_shopSprites[SHOP_S_SECONDARY], SHOP_X + 406, SHOP_Y + 245);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2019-06-06 04:13:48 +02:00
|
|
|
if (shopSelectedItem > SHOP_NOTHING)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2017-02-05 18:59:26 +01:00
|
|
|
screen_blit(gfx_sprites[SP_BUY], buy_x, buy_y);
|
|
|
|
screen_blit(gfx_sprites[SP_SELL], sell_x, sell_y);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2019-05-21 07:51:39 +02:00
|
|
|
screen_blit(gfx_sprites[SP_FIREFLY], SHOP_X + 280, SHOP_Y + 15);
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2015-05-21 01:41:43 +02:00
|
|
|
if (game.system == 0)
|
2015-03-06 21:22:10 +01:00
|
|
|
icons = SHOP_DOUBLE_ROCKETS + 1;
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.system == 1)
|
2015-03-06 21:22:10 +01:00
|
|
|
icons = SHOP_LASER + 1;
|
2015-05-21 01:41:43 +02:00
|
|
|
else if (game.system == 2)
|
2015-03-06 21:22:10 +01:00
|
|
|
icons = SHOP_CHARGER + 1;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2013-09-30 16:52:43 +02:00
|
|
|
if ((engine.keyState[KEY_FIRE]))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
for (int i = 0 ; i < icons ; i++)
|
|
|
|
{
|
2015-09-25 22:28:09 +02:00
|
|
|
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
|
2015-03-06 22:25:12 +01:00
|
|
|
shopItems[i].x, shopItems[i].y, 32, 25))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
shopSelectedItem = i;
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
drawShop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-06 04:13:48 +02:00
|
|
|
if (shopSelectedItem > SHOP_NOTHING)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2017-02-05 18:59:26 +01:00
|
|
|
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, buy_x, buy_y, 24, 16))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
buy(shopSelectedItem);
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
drawShop();
|
|
|
|
}
|
|
|
|
|
2017-02-05 18:59:26 +01:00
|
|
|
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, sell_x, sell_y, 24, 16))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
sell(shopSelectedItem);
|
2013-09-30 16:52:43 +02:00
|
|
|
engine.keyState[KEY_FIRE] = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
drawShop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|