Started getting rid of magic numbers on the intermission screen.
This commit is contained in:
parent
5acc9f37f3
commit
73af622c54
48
src/defs.h
48
src/defs.h
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011, 2012 Guus Sliepen
|
Copyright (C) 2011, 2012 Guus Sliepen
|
||||||
Copyright (C) 2012, 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2012, 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -104,7 +104,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MAX_WEAPONS 20
|
#define MAX_WEAPONS 20
|
||||||
#define MAX_SPRITES 100
|
#define MAX_SPRITES 100
|
||||||
#define MAX_FONTSPRITES 6
|
#define MAX_FONTSPRITES 6
|
||||||
#define MAX_SHOPSPRITES 6
|
|
||||||
#define MAX_CARGO 20
|
#define MAX_CARGO 20
|
||||||
#define MAX_INFOLINES 3
|
#define MAX_INFOLINES 3
|
||||||
#define MAX_EVENTS 20
|
#define MAX_EVENTS 20
|
||||||
|
@ -280,6 +279,42 @@ enum {
|
||||||
|
|
||||||
// Sprites
|
// Sprites
|
||||||
enum {
|
enum {
|
||||||
|
SP_CURSOR,
|
||||||
|
SP_START_MISSION,
|
||||||
|
SP_MAP,
|
||||||
|
SP_STATUS,
|
||||||
|
SP_SAVE,
|
||||||
|
SP_SHOP,
|
||||||
|
SP_COMM,
|
||||||
|
SP_OPTIONS,
|
||||||
|
SP_EXIT,
|
||||||
|
SP_PLASMA_MAX_OUTPUT,
|
||||||
|
SP_PLASMA_MAX_POWER,
|
||||||
|
SP_PLASMA_MAX_RATE,
|
||||||
|
SP_PLASMA_AMMO,
|
||||||
|
SP_ROCKET_AMMO,
|
||||||
|
SP_PLASMA_MIN_OUTPUT,
|
||||||
|
SP_PLASMA_MIN_POWER,
|
||||||
|
SP_PLASMA_MIN_RATE,
|
||||||
|
SP_PLASMA_MAX_AMMO,
|
||||||
|
SP_ROCKET_MAX_AMMO,
|
||||||
|
SP_DOUBLE_ROCKETS,
|
||||||
|
SP_MICRO_ROCKETS,
|
||||||
|
SP_LASER,
|
||||||
|
SP_HOMING_MISSILE,
|
||||||
|
SP_CHARGER,
|
||||||
|
SP_DOUBLE_HOMING_MISSILES,
|
||||||
|
SP_MICRO_HOMING_MISSILES,
|
||||||
|
SP_GOTO,
|
||||||
|
SP_BUY,
|
||||||
|
SP_SELL,
|
||||||
|
SP_FIREFLY,
|
||||||
|
SP_SUN,
|
||||||
|
SP_PLANET_GREEN,
|
||||||
|
SP_PLANET_BLUE,
|
||||||
|
SP_PLANET_RED,
|
||||||
|
SP_PLANET_ORANGE,
|
||||||
|
SP_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
// Face sprites
|
// Face sprites
|
||||||
|
@ -374,6 +409,13 @@ enum {
|
||||||
|
|
||||||
// Shop sprites
|
// Shop sprites
|
||||||
enum {
|
enum {
|
||||||
|
SHOP_S_PRIMARY,
|
||||||
|
SHOP_S_POWERUP,
|
||||||
|
SHOP_S_SECONDARY,
|
||||||
|
SHOP_S_CATALOG,
|
||||||
|
SHOP_S_SHIP_INFO,
|
||||||
|
SHOP_S_ITEM_INFO,
|
||||||
|
SHOP_S_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
// Text sprites (main menu)
|
// Text sprites (main menu)
|
||||||
|
@ -494,7 +536,7 @@ enum {
|
||||||
SHOP_CHARGER,
|
SHOP_CHARGER,
|
||||||
SHOP_DOUBLE_HOMING_MISSILES,
|
SHOP_DOUBLE_HOMING_MISSILES,
|
||||||
SHOP_MICRO_HOMING_MISSILES,
|
SHOP_MICRO_HOMING_MISSILES,
|
||||||
MAX_SHOPITEMS
|
SHOP_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
// Font Colors
|
// Font Colors
|
||||||
|
|
|
@ -26,7 +26,7 @@ SDL_Surface *gfx_sprites[MAX_SPRITES];
|
||||||
SDL_Surface *gfx_faceSprites[FS_MAX];
|
SDL_Surface *gfx_faceSprites[FS_MAX];
|
||||||
SDL_Surface *gfx_shipSprites[SS_MAX];
|
SDL_Surface *gfx_shipSprites[SS_MAX];
|
||||||
SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
|
SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
|
||||||
SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];
|
SDL_Surface *gfx_shopSprites[SHOP_S_MAX];
|
||||||
textObject gfx_textSprites[TS_MAX];
|
textObject gfx_textSprites[TS_MAX];
|
||||||
SDL_Surface *gfx_messageBox;
|
SDL_Surface *gfx_messageBox;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void gfx_init()
|
||||||
for (int i = 0 ; i < TS_MAX ; i++)
|
for (int i = 0 ; i < TS_MAX ; i++)
|
||||||
gfx_textSprites[i].image = NULL;
|
gfx_textSprites[i].image = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
|
for (int i = 0 ; i < SHOP_S_MAX ; i++)
|
||||||
gfx_shopSprites[i] = NULL;
|
gfx_shopSprites[i] = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
|
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
|
||||||
|
@ -480,7 +480,7 @@ void gfx_free()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
|
for (int i = 0 ; i < SHOP_S_MAX ; i++)
|
||||||
{
|
{
|
||||||
if (gfx_shopSprites[i] != NULL)
|
if (gfx_shopSprites[i] != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ extern SDL_Surface *gfx_sprites[MAX_SPRITES];
|
||||||
extern SDL_Surface *gfx_faceSprites[FS_MAX];
|
extern SDL_Surface *gfx_faceSprites[FS_MAX];
|
||||||
extern SDL_Surface *gfx_shipSprites[SS_MAX];
|
extern SDL_Surface *gfx_shipSprites[SS_MAX];
|
||||||
extern SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
|
extern SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
|
||||||
extern SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];
|
extern SDL_Surface *gfx_shopSprites[SHOP_S_MAX];
|
||||||
extern textObject gfx_textSprites[TS_MAX];
|
extern textObject gfx_textSprites[TS_MAX];
|
||||||
extern SDL_Surface *gfx_messageBox;
|
extern SDL_Surface *gfx_messageBox;
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ static void intermission_doCursor()
|
||||||
{
|
{
|
||||||
getPlayerInput();
|
getPlayerInput();
|
||||||
|
|
||||||
LIMIT(engine.cursor_x, 10, screen->w - 10 - gfx_sprites[0]->w);
|
LIMIT(engine.cursor_x, 10, screen->w - 10 - gfx_sprites[SP_CURSOR]->w);
|
||||||
LIMIT(engine.cursor_y, 10, screen->h - 10 - gfx_sprites[0]->h);
|
LIMIT(engine.cursor_y, 10, screen->h - 10 - gfx_sprites[SP_CURSOR]->h);
|
||||||
screen_blit(gfx_sprites[0], engine.cursor_x, engine.cursor_y);
|
screen_blit(gfx_sprites[SP_CURSOR], engine.cursor_x, engine.cursor_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -230,7 +230,7 @@ static bool intermission_showSystem(float x, float y, bool selectable)
|
||||||
bool rtn = false;
|
bool rtn = false;
|
||||||
|
|
||||||
// Blit the sun
|
// Blit the sun
|
||||||
screen_blit(gfx_sprites[30], 370, 220);
|
screen_blit(gfx_sprites[SP_SUN], 370, 220);
|
||||||
|
|
||||||
for (int i = 50 ; i < 300 ; i+= planetSpace)
|
for (int i = 50 ; i < 300 ; i+= planetSpace)
|
||||||
{
|
{
|
||||||
|
@ -575,7 +575,7 @@ int intermission()
|
||||||
|
|
||||||
engine.cursor_x = screen->w / 2;
|
engine.cursor_x = screen->w / 2;
|
||||||
engine.cursor_y = screen->h / 2;
|
engine.cursor_y = screen->h / 2;
|
||||||
gfx_sprites[0] = gfx_loadImage("gfx/cursor.png");
|
gfx_sprites[SP_CURSOR] = gfx_loadImage("gfx/cursor.png");
|
||||||
|
|
||||||
// Icons 1 - 29
|
// Icons 1 - 29
|
||||||
for (int i = 0 ; i < 26 ; i++)
|
for (int i = 0 ; i < 26 ; i++)
|
||||||
|
@ -584,16 +584,16 @@ int intermission()
|
||||||
gfx_sprites[i + 1] = gfx_loadImage(string);
|
gfx_sprites[i + 1] = gfx_loadImage(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_sprites[27] = gfx_loadImage("gfx/buyIcon.png");
|
gfx_sprites[SP_BUY] = gfx_loadImage("gfx/buyIcon.png");
|
||||||
gfx_sprites[28] = gfx_loadImage("gfx/sellIcon.png");
|
gfx_sprites[SP_SELL] = gfx_loadImage("gfx/sellIcon.png");
|
||||||
gfx_sprites[29] = gfx_loadImage("gfx/firefly1.png");
|
gfx_sprites[SP_FIREFLY] = gfx_loadImage("gfx/firefly1.png");
|
||||||
|
|
||||||
// Planets 30 - 39
|
// Planets 30 - 39
|
||||||
gfx_sprites[30] = gfx_loadImage("gfx/planet_sun.png");
|
gfx_sprites[SP_SUN] = gfx_loadImage("gfx/planet_sun.png");
|
||||||
gfx_sprites[31] = gfx_loadImage("gfx/planet_green.png");
|
gfx_sprites[SP_PLANET_GREEN] = gfx_loadImage("gfx/planet_green.png");
|
||||||
gfx_sprites[32] = gfx_loadImage("gfx/planet_blue.png");
|
gfx_sprites[SP_PLANET_BLUE] = gfx_loadImage("gfx/planet_blue.png");
|
||||||
gfx_sprites[33] = gfx_loadImage("gfx/planet_red.png");
|
gfx_sprites[SP_PLANET_RED] = gfx_loadImage("gfx/planet_red.png");
|
||||||
gfx_sprites[34] = gfx_loadImage("gfx/planet_orange.png");
|
gfx_sprites[SP_PLANET_ORANGE] = gfx_loadImage("gfx/planet_orange.png");
|
||||||
|
|
||||||
// Faces
|
// Faces
|
||||||
gfx_faceSprites[FS_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
gfx_faceSprites[FS_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
||||||
|
@ -888,9 +888,9 @@ int intermission()
|
||||||
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
|
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
|
||||||
continue;
|
continue;
|
||||||
else if (game.stationedPlanet == game.destinationPlanet)
|
else if (game.stationedPlanet == game.destinationPlanet)
|
||||||
screen_blit(gfx_sprites[1], 80 + (i * 90), 500);
|
screen_blit(gfx_sprites[SP_START_MISSION], 80 + (i * 90), 500);
|
||||||
else if (game.stationedPlanet != game.destinationPlanet)
|
else if (game.stationedPlanet != game.destinationPlanet)
|
||||||
screen_blit(gfx_sprites[26], 80 + (i * 90), 500);
|
screen_blit(gfx_sprites[SP_GOTO], 80 + (i * 90), 500);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,9 +41,6 @@ void loadGameGraphics()
|
||||||
|
|
||||||
gfx_free();
|
gfx_free();
|
||||||
|
|
||||||
gfx_shipSprites[0] = gfx_loadImage("gfx/firefly1.png");
|
|
||||||
gfx_shipSprites[1] = gfx_loadImage("gfx/firefly2.png");
|
|
||||||
|
|
||||||
// Faces
|
// Faces
|
||||||
gfx_faceSprites[FS_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
gfx_faceSprites[FS_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
||||||
gfx_faceSprites[FS_SID] = gfx_loadImage("gfx/face_sid.png");
|
gfx_faceSprites[FS_SID] = gfx_loadImage("gfx/face_sid.png");
|
||||||
|
|
142
src/shop.cpp
142
src/shop.cpp
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
static ShopItem shopItems[MAX_SHOPITEMS];
|
static ShopItem shopItems[SHOP_MAX];
|
||||||
static signed char shopSelectedItem;
|
static signed char shopSelectedItem;
|
||||||
|
|
||||||
static void sell(int i);
|
static void sell(int i);
|
||||||
|
@ -144,7 +144,7 @@ static void drawShop()
|
||||||
{
|
{
|
||||||
adjustShopPrices();
|
adjustShopPrices();
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
|
for (int i = 0 ; i < SHOP_S_MAX ; i++)
|
||||||
{
|
{
|
||||||
if (gfx_shopSprites[i] != NULL)
|
if (gfx_shopSprites[i] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -152,17 +152,19 @@ static void drawShop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
gfx_shopSprites[SHOP_S_PRIMARY] = gfx_createSurface(246, 91);
|
||||||
gfx_shopSprites[i] = gfx_createSurface(246, 91);
|
gfx_shopSprites[SHOP_S_POWERUP] = gfx_createSurface(246, 91);
|
||||||
|
gfx_shopSprites[SHOP_S_SECONDARY] = gfx_createSurface(246, 91);
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 245, 90, 0x00, 0x00, 0x55);
|
||||||
{
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
||||||
gfx_drawRect(gfx_shopSprites[i], 0, 0, 245, 90, 0x00, 0x00, 0x55);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 245, 90, 0x00, 0x00, 0x55);
|
||||||
gfx_drawRect(gfx_shopSprites[i], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
||||||
}
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 245, 90, 0x00, 0x00, 0x55);
|
||||||
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
||||||
|
|
||||||
gfx_shopSprites[4] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
|
gfx_shopSprites[SHOP_S_SHIP_INFO] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
|
||||||
gfx_drawRect(gfx_shopSprites[4], 0, 0, 600, 100, 0x00, 0x00, 0x33);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SHIP_INFO], 0, 0, 600, 100, 0x00, 0x00, 0x33);
|
||||||
|
|
||||||
switch (shopSelectedItem)
|
switch (shopSelectedItem)
|
||||||
{
|
{
|
||||||
|
@ -173,69 +175,69 @@ static void drawShop()
|
||||||
case -5:
|
case -5:
|
||||||
case -6:
|
case -6:
|
||||||
break;
|
break;
|
||||||
case 0:
|
case SHOP_PLASMA_MAX_OUTPUT:
|
||||||
case 1:
|
case SHOP_PLASMA_MAX_DAMAGE:
|
||||||
case 2:
|
case SHOP_PLASMA_MAX_RATE:
|
||||||
case 8:
|
case SHOP_PLASMA_MAX_AMMO:
|
||||||
gfx_drawRect(gfx_shopSprites[1], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
||||||
gfx_drawRect(gfx_shopSprites[1], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_POWERUP], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case SHOP_PLASMA_MIN_OUTPUT:
|
||||||
case 4:
|
case SHOP_PLASMA_MIN_DAMAGE:
|
||||||
gfx_drawRect(gfx_shopSprites[4], 0, 0, 600, 100, 0x33, 0x00, 0x00);
|
case SHOP_PLASMA_MIN_RATE:
|
||||||
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
||||||
|
gfx_drawRect(gfx_shopSprites[SHOP_S_PRIMARY], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case SHOP_PLASMA_AMMO:
|
||||||
case 6:
|
case SHOP_ROCKET_AMMO:
|
||||||
case 7:
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SHIP_INFO], 0, 0, 600, 100, 0x33, 0x00, 0x00);
|
||||||
gfx_drawRect(gfx_shopSprites[0], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
|
||||||
gfx_drawRect(gfx_shopSprites[0], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gfx_drawRect(gfx_shopSprites[2], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
||||||
gfx_drawRect(gfx_shopSprites[2], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_SECONDARY], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char description[100];
|
char description[100];
|
||||||
strcpy(description, "");
|
strcpy(description, "");
|
||||||
|
|
||||||
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[0]);
|
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
||||||
sprintf(description, "Plasma Cannons : %d", game.minPlasmaOutput);
|
sprintf(description, "Plasma Cannons : %d", game.minPlasmaOutput);
|
||||||
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[0]);
|
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
||||||
sprintf(description, "Plasma Power : Stage %d",
|
sprintf(description, "Plasma Power : Stage %d",
|
||||||
game.minPlasmaDamage);
|
game.minPlasmaDamage);
|
||||||
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[0]);
|
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
||||||
sprintf(description, "Cooler : Stage %d",
|
sprintf(description, "Cooler : Stage %d",
|
||||||
game.minPlasmaRate);
|
game.minPlasmaRate);
|
||||||
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[0]);
|
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
||||||
|
|
||||||
gfx_renderString("Powerup Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[1]);
|
gfx_renderString("Powerup Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
||||||
sprintf(description, "Plasma Output : Stage %d",
|
sprintf(description, "Plasma Output : Stage %d",
|
||||||
game.maxPlasmaOutput);
|
game.maxPlasmaOutput);
|
||||||
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[1]);
|
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
||||||
sprintf(description, "Plasma Condensor : Stage %d",
|
sprintf(description, "Plasma Condensor : Stage %d",
|
||||||
game.maxPlasmaDamage);
|
game.maxPlasmaDamage);
|
||||||
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[1]);
|
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
||||||
sprintf(description, "Liquid Nitrogen : Stage %d",
|
sprintf(description, "Liquid Nitrogen : Stage %d",
|
||||||
game.maxPlasmaRate);
|
game.maxPlasmaRate);
|
||||||
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[1]);
|
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
||||||
sprintf(description, "Plasma Capacity : %d", game.maxPlasmaAmmo);
|
sprintf(description, "Plasma Capacity : %d", game.maxPlasmaAmmo);
|
||||||
gfx_renderString(description, 10, 67, FONT_WHITE, 0, gfx_shopSprites[1]);
|
gfx_renderString(description, 10, 67, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_POWERUP]);
|
||||||
|
|
||||||
drawSecondaryWeaponSurface();
|
drawSecondaryWeaponSurface();
|
||||||
|
|
||||||
gfx_shopSprites[3] = gfx_createSurface(601, 121);
|
gfx_shopSprites[SHOP_S_CATALOG] = gfx_createSurface(601, 121);
|
||||||
|
|
||||||
gfx_drawRect(gfx_shopSprites[3], 0, 0, 600, 120, 0x00, 0x00, 0x22);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_CATALOG], 0, 0, 600, 120, 0x00, 0x00, 0x22);
|
||||||
|
|
||||||
gfx_renderString("Temporary Weapons", 10, 2, FONT_WHITE, 0, gfx_shopSprites[3]);
|
gfx_renderString("Temporary Weapons", 10, 2, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
||||||
gfx_renderString("Ammo and Storage", 260, 2, FONT_WHITE, 0, gfx_shopSprites[3]);
|
gfx_renderString("Ammo and Storage", 260, 2, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
||||||
|
|
||||||
gfx_renderString("Primary Weapons", 10, 62, FONT_WHITE, 0, gfx_shopSprites[3]);
|
gfx_renderString("Primary Weapons", 10, 62, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
||||||
|
|
||||||
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, gfx_shopSprites[3]);
|
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
||||||
|
|
||||||
signed char icons = MAX_SHOPITEMS;
|
signed char icons = SHOP_MAX;
|
||||||
|
|
||||||
if (game.system == 0)
|
if (game.system == 0)
|
||||||
icons = SHOP_DOUBLE_ROCKETS + 1;
|
icons = SHOP_DOUBLE_ROCKETS + 1;
|
||||||
|
@ -247,21 +249,21 @@ static void drawShop()
|
||||||
for (int i = 0 ; i < icons ; i++)
|
for (int i = 0 ; i < icons ; i++)
|
||||||
{
|
{
|
||||||
gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x - 90,
|
gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x - 90,
|
||||||
shopItems[i].y - 178, gfx_shopSprites[3]);
|
shopItems[i].y - 178, gfx_shopSprites[SHOP_S_CATALOG]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(description, "Shield Units : %d", player.maxShield);
|
sprintf(description, "Shield Units : %d", player.maxShield);
|
||||||
gfx_renderString(description, 10, 4, FONT_WHITE, 0, gfx_shopSprites[4]);
|
gfx_renderString(description, 10, 4, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
||||||
sprintf(description, "Cash : $%d", game.cash);
|
sprintf(description, "Cash : $%d", game.cash);
|
||||||
gfx_renderString(description, 10, 80, FONT_WHITE, 0, gfx_shopSprites[4]);
|
gfx_renderString(description, 10, 80, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
||||||
sprintf(description, "Plasma Cells : %.3d", player.ammo[0]);
|
sprintf(description, "Plasma Cells : %.3d", player.ammo[0]);
|
||||||
gfx_renderString(description, 430, 4, FONT_WHITE, 0, gfx_shopSprites[4]);
|
gfx_renderString(description, 430, 4, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
||||||
sprintf(description, "Rockets : %.3d", player.ammo[1]);
|
sprintf(description, "Rockets : %.3d", player.ammo[1]);
|
||||||
gfx_renderString(description, 475, 80, FONT_WHITE, 0, gfx_shopSprites[4]);
|
gfx_renderString(description, 475, 80, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_SHIP_INFO]);
|
||||||
|
|
||||||
gfx_shopSprites[5] = gfx_createSurface(601, 56);
|
gfx_shopSprites[SHOP_S_ITEM_INFO] = gfx_createSurface(601, 56);
|
||||||
gfx_drawRect(gfx_shopSprites[5], 0, 0, 600, 35, 0x00, 0x99, 0x00);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_ITEM_INFO], 0, 0, 600, 35, 0x00, 0x99, 0x00);
|
||||||
gfx_drawRect(gfx_shopSprites[5], 0, 20, 600, 35, 0x00, 0x33, 0x00);
|
gfx_drawRect(gfx_shopSprites[SHOP_S_ITEM_INFO], 0, 20, 600, 35, 0x00, 0x33, 0x00);
|
||||||
gfx_renderString("Information", 5, 4, FONT_WHITE, 0, gfx_shopSprites[5]);
|
gfx_renderString("Information", 5, 4, FONT_WHITE, 0, gfx_shopSprites[5]);
|
||||||
|
|
||||||
switch (shopSelectedItem)
|
switch (shopSelectedItem)
|
||||||
|
@ -270,37 +272,37 @@ static void drawShop()
|
||||||
break;
|
break;
|
||||||
case -2:
|
case -2:
|
||||||
gfx_renderString("You don't have enough money", 20, 30, FONT_WHITE,
|
gfx_renderString("You don't have enough money", 20, 30, FONT_WHITE,
|
||||||
0, gfx_shopSprites[5]);
|
0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -3:
|
case -3:
|
||||||
gfx_renderString("Cannot upgrade ship", 5, 22, FONT_WHITE, 0,
|
gfx_renderString("Cannot upgrade ship", 5, 22, FONT_WHITE, 0,
|
||||||
gfx_shopSprites[5]);
|
gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
gfx_renderString("Hardware capacity has been reached", 20, 38,
|
gfx_renderString("Hardware capacity has been reached", 20, 38,
|
||||||
FONT_CYAN, 0, gfx_shopSprites[5]);
|
FONT_CYAN, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -4:
|
case -4:
|
||||||
gfx_renderString("Ammunition limit reached", 20, 30, FONT_WHITE, 0,
|
gfx_renderString("Ammunition limit reached", 20, 30, FONT_WHITE, 0,
|
||||||
gfx_shopSprites[5]);
|
gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -5:
|
case -5:
|
||||||
gfx_renderString("You cannot sell that item", 20, 30, FONT_WHITE,
|
gfx_renderString("You cannot sell that item", 20, 30, FONT_WHITE,
|
||||||
0, gfx_shopSprites[5]);
|
0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -6:
|
case -6:
|
||||||
gfx_renderString("Nothing to sell", 20, 30, FONT_WHITE, 0,
|
gfx_renderString("Nothing to sell", 20, 30, FONT_WHITE, 0,
|
||||||
gfx_shopSprites[5]);
|
gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -7:
|
case -7:
|
||||||
gfx_renderString("Rockets cannot be bought for Laser or Charger Cannon",
|
gfx_renderString("Rockets cannot be bought for Laser or Charger Cannon",
|
||||||
5, 30, FONT_WHITE, 0, gfx_shopSprites[5]);
|
5, 30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -8:
|
case -8:
|
||||||
gfx_renderString("You already have that weapon", 20, 30,
|
gfx_renderString("You already have that weapon", 20, 30,
|
||||||
FONT_WHITE, 0, gfx_shopSprites[5]);
|
FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
case -9:
|
case -9:
|
||||||
gfx_renderString("This weapon's ammo limit has been reached", 20,
|
gfx_renderString("This weapon's ammo limit has been reached", 20,
|
||||||
30, FONT_WHITE, 0, gfx_shopSprites[5]);
|
30, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (shopItems[shopSelectedItem].price != 0)
|
if (shopItems[shopSelectedItem].price != 0)
|
||||||
|
@ -315,8 +317,8 @@ static void drawShop()
|
||||||
shopItems[shopSelectedItem].description);
|
shopItems[shopSelectedItem].description);
|
||||||
}
|
}
|
||||||
gfx_renderString(shopItems[shopSelectedItem].name, 5, 22,
|
gfx_renderString(shopItems[shopSelectedItem].name, 5, 22,
|
||||||
FONT_WHITE, 0, gfx_shopSprites[5]);
|
FONT_WHITE, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
gfx_renderString(description, 20, 38, FONT_CYAN, 0, gfx_shopSprites[5]);
|
gfx_renderString(description, 20, 38, FONT_CYAN, 0, gfx_shopSprites[SHOP_S_ITEM_INFO]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +487,7 @@ void initShop()
|
||||||
|
|
||||||
shopSelectedItem = -1;
|
shopSelectedItem = -1;
|
||||||
|
|
||||||
player.image[0] = gfx_sprites[0];
|
player.image[0] = gfx_shipSprites[SS_FIREFLY];
|
||||||
player.x = 380;
|
player.x = 380;
|
||||||
player.y = 95;
|
player.y = 95;
|
||||||
|
|
||||||
|
@ -1018,12 +1020,12 @@ static void sell(int i)
|
||||||
|
|
||||||
void showShop()
|
void showShop()
|
||||||
{
|
{
|
||||||
screen_blit(gfx_shopSprites[0], 20, 395);
|
screen_blit(gfx_shopSprites[SHOP_S_PRIMARY], 20, 395);
|
||||||
screen_blit(gfx_shopSprites[1], 275, 395);
|
screen_blit(gfx_shopSprites[SHOP_S_POWERUP], 275, 395);
|
||||||
screen_blit(gfx_shopSprites[2], 530, 395);
|
screen_blit(gfx_shopSprites[SHOP_S_SECONDARY], 530, 395);
|
||||||
screen_blit(gfx_shopSprites[3], 100, 180);
|
screen_blit(gfx_shopSprites[SHOP_S_CATALOG], 100, 180);
|
||||||
screen_blit(gfx_shopSprites[4], 100, 50);
|
screen_blit(gfx_shopSprites[SHOP_S_SHIP_INFO], 100, 50);
|
||||||
screen_blit(gfx_shopSprites[5], 100, 320);
|
screen_blit(gfx_shopSprites[SHOP_S_ITEM_INFO], 100, 320);
|
||||||
|
|
||||||
if (shopSelectedItem > -1)
|
if (shopSelectedItem > -1)
|
||||||
{
|
{
|
||||||
|
@ -1033,7 +1035,7 @@ void showShop()
|
||||||
|
|
||||||
screen_blit(gfx_sprites[29], (int)player.x, (int)player.y);
|
screen_blit(gfx_sprites[29], (int)player.x, (int)player.y);
|
||||||
|
|
||||||
signed char icons = MAX_SHOPITEMS;
|
signed char icons = SHOP_MAX;
|
||||||
|
|
||||||
if (game.system == 0)
|
if (game.system == 0)
|
||||||
icons = SHOP_DOUBLE_ROCKETS + 1;
|
icons = SHOP_DOUBLE_ROCKETS + 1;
|
||||||
|
|
Loading…
Reference in New Issue