diff --git a/src/alien.cpp b/src/alien.cpp
index a58723d..f4f5f54 100644
--- a/src/alien.cpp
+++ b/src/alien.cpp
@@ -42,8 +42,8 @@ along with this program. If not, see .
Object alien_defs[CD_MAX];
Object aliens[ALIEN_MAX];
-static const int nChrisKillMessage = 15;
-static const char *chrisKillMessage[nChrisKillMessage] = {
+#define NMSG_CHRIS_KILL 15
+static const char *chrisKillMessage[NMSG_CHRIS_KILL] = {
"Take that, robot oppressors!",
"Come on, WEAPCO, give me a challenge already!",
"Is that all you've got?",
@@ -61,8 +61,8 @@ static const char *chrisKillMessage[nChrisKillMessage] = {
"Maybe you should change your name to WEEPCO!"
};
-static const int nPhoebeKillMessage = 11;
-static const char *phoebeKillMessage[nPhoebeKillMessage] = {
+#define NMSG_PHOEBE_KILL 11
+static const char *phoebeKillMessage[NMSG_PHOEBE_KILL] = {
"I got another one!",
"Target destroyed!",
"One more for me!",
@@ -76,8 +76,8 @@ static const char *phoebeKillMessage[nPhoebeKillMessage] = {
"I got it!"
};
-static const int nUrsulaKillMessage = 14;
-static const char *ursulaKillMessage[nUrsulaKillMessage] = {
+#define NMSG_URSULA_KILL 14
+static const char *ursulaKillMessage[NMSG_URSULA_KILL] = {
"Kicked your ass!",
"You ain't so tough!",
"I was always a better WEAPCO pilot than you!",
@@ -1788,7 +1788,7 @@ void alien_destroy(Object *alien, Object *attacker)
if (CHANCE(1 / 16.) && (alien->flags & FL_WEAPCO) &&
(!(alien->flags & FL_NOBANTER)))
{
- r = rand() % nChrisKillMessage;
+ r = rand() % NMSG_CHRIS_KILL;
radio_setMessage(FS_CHRIS, chrisKillMessage[r], 0);
}
}
@@ -1798,7 +1798,7 @@ void alien_destroy(Object *alien, Object *attacker)
if (CHANCE(1 / 8.) && (alien-> flags & FL_WEAPCO) &&
(!(alien->flags & FL_NOBANTER)))
{
- r = rand() % nPhoebeKillMessage;
+ r = rand() % NMSG_PHOEBE_KILL;
radio_setMessage(FS_PHOEBE, phoebeKillMessage[r], 0);
}
}
@@ -1808,7 +1808,7 @@ void alien_destroy(Object *alien, Object *attacker)
if (CHANCE(1 / 8.) && (alien-> flags & FL_WEAPCO) &&
(!(alien->flags & FL_NOBANTER)))
{
- r = rand() % nUrsulaKillMessage;
+ r = rand() % NMSG_URSULA_KILL;
radio_setMessage(FS_URSULA, ursulaKillMessage[r], 0);
}
}
@@ -1943,3 +1943,7 @@ void alien_hurt(Object *alien, Object *attacker, int damage, int ion)
alien->systemPower = alien->maxShield;
}
}
+
+#undef NMSG_CHRIS_KILL
+#undef NMSG_PHOEBE_KILL
+#undef NMSG_URSULA_KILL
diff --git a/src/defs.h b/src/defs.h
index d634689..d68e940 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -62,14 +62,13 @@ along with this program. If not, see .
#define DEFAULT_SCREEN_WIDTH MAX(SCREEN_WIDTH, 640)
#define DEFAULT_SCREEN_HEIGHT MAX(SCREEN_HEIGHT, 480)
#define STARS_NUM 200
-const int xViewBorder = 100;
-const int yViewBorder = 100;
-const float cameraMaxSpeed = 3.;
-const int maxHoming = 20;
-const int maxDoubleHoming = 15;
-const int maxMicroHoming = 10;
-
-const int rayDamageDelay = 10;
+#define X_VIEW_BORDER 100
+#define Y_VIEW_BORDER 100
+#define CAMERA_MAX_SPEED 3.
+#define MAX_HOMING 20
+#define MAX_DOUBLE_HOMING 15
+#define MAX_MICRO_HOMING 10
+#define RAY_DAMAGE_DELAY 10
// Object Flags
#define FL_WEAPCO 1
diff --git a/src/event.cpp b/src/event.cpp
index 6dbdc86..f84cfcf 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -31,7 +31,9 @@ along with this program. If not, see .
#include "radio.h"
static Event events[MAX_EVENTS];
-static const char *klineGreeting[] = {
+
+#define NMSG_KLINE_GREETING 4
+static const char *klineGreeting[NMSG_KLINE_GREETING] = {
"How nice to see you again, Bainfield!",
"It all ends here, rebel!",
"I hope you won't disappoint me this time...",
@@ -57,7 +59,7 @@ void events_init()
{
events[0].time = 2;
events[0].face = FS_KLINE;
- strcpy(events[0].message, klineGreeting[rand() % 4]);
+ strcpy(events[0].message, klineGreeting[rand() % NMSG_KLINE_GREETING]);
}
break;
@@ -385,3 +387,5 @@ void events_sync()
}
}
}
+
+#undef NMSG_KLINE_GREETING
diff --git a/src/game.cpp b/src/game.cpp
index 3859065..84ceb27 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -63,39 +63,39 @@ static Star stars[STARS_NUM];
static Uint32 frameLimit = 0;
static int thirds = 0;
-static const int nKlineInsult = 3;
-static const char *klineInsult[nKlineInsult] = {
+#define NMSG_KLINE_INSULT 3
+static const char *klineInsult[NMSG_KLINE_INSULT] = {
"Pathetic.", "How very disappointing...", "Heroic. And stupid."
};
-static const int nKlineVenusInsult = 2;
-static const char *klineVenusInsult[nKlineVenusInsult] = {
+#define NMSG_KLINE_VENUS_INSULT 2
+static const char *klineVenusInsult[NMSG_KLINE_VENUS_INSULT] = {
"Fool.", "And now you're nothing but a DEAD hero."
};
-static const int nPhoebePlayerHitMessage = 3;
-static const char *phoebePlayerHitMessage[nPhoebePlayerHitMessage] = {
+#define NMSG_PHOEBE_PLAYER_HIT 3
+static const char *phoebePlayerHitMessage[NMSG_PHOEBE_PLAYER_HIT] = {
"Oops! Sorry!",
"Whoops! Are you OK, Chris?",
"Oh, sorry! I didn't see you there!"
};
-static const int nUrsulaPlayerHitMessage = 3;
-static const char *ursulaPlayerHitMessage[nUrsulaPlayerHitMessage] = {
+#define NMSG_URSULA_PLAYER_HIT 3
+static const char *ursulaPlayerHitMessage[NMSG_URSULA_PLAYER_HIT] = {
"Get out of the way!",
"Don't fly into my missiles!",
"Dammit, Chris, you made me miss!"
};
-static const int nPlayerPhoebeHitMessage = 3;
-static const char *playerPhoebeHitMessage[nPlayerPhoebeHitMessage] = {
+#define NMSG_PLAYER_PHOEBE_HIT 3
+static const char *playerPhoebeHitMessage[NMSG_PLAYER_PHOEBE_HIT] = {
"OW! I hope that was an accident!",
"Chris, please be more careful!",
"Ouch! What are you shooting at me for?"
};
-static const int nPlayerUrsulaHitMessage = 5;
-static const char *playerUrsulaHitMessage[nPlayerUrsulaHitMessage] = {
+#define NMSG_PLAYER_URSULA_HIT 5
+static const char *playerUrsulaHitMessage[NMSG_PLAYER_URSULA_HIT] = {
"I am NOT your enemy!",
"Hey! Watch it!",
"What are you doing?! Shoot THEM!",
@@ -727,9 +727,9 @@ static void game_doBullets()
{
game.hits++;
if (aliens[i].classDef == CD_PHOEBE)
- radio_setMessage(FS_PHOEBE, playerPhoebeHitMessage[rand() % nPlayerPhoebeHitMessage], 0);
+ radio_setMessage(FS_PHOEBE, playerPhoebeHitMessage[rand() % NMSG_PLAYER_PHOEBE_HIT], 0);
else if (aliens[i].classDef == CD_URSULA)
- radio_setMessage(FS_URSULA, playerUrsulaHitMessage[rand() % nPlayerUrsulaHitMessage], 0);
+ radio_setMessage(FS_URSULA, playerUrsulaHitMessage[rand() % NMSG_PLAYER_URSULA_HIT], 0);
}
if (!(aliens[i].flags & FL_IMMORTAL))
@@ -790,11 +790,11 @@ static void game_doBullets()
{
if (bullet->owner->classDef == CD_PHOEBE)
{
- radio_setMessage(FS_PHOEBE, phoebePlayerHitMessage[rand() % nPhoebePlayerHitMessage], 0);
+ radio_setMessage(FS_PHOEBE, phoebePlayerHitMessage[rand() % NMSG_PHOEBE_PLAYER_HIT], 0);
}
else if (bullet->owner->classDef == CD_URSULA)
{
- radio_setMessage(FS_URSULA, ursulaPlayerHitMessage[rand() % nUrsulaPlayerHitMessage], 0);
+ radio_setMessage(FS_URSULA, ursulaPlayerHitMessage[rand() % NMSG_URSULA_PLAYER_HIT], 0);
}
}
@@ -1439,15 +1439,15 @@ static void game_doPlayer()
{
if (xmoved)
{
- if (player.x < xViewBorder)
+ if (player.x < X_VIEW_BORDER)
{
- engine.smx += xViewBorder - player.x;
- player.x = xViewBorder;
+ engine.smx += X_VIEW_BORDER - player.x;
+ player.x = X_VIEW_BORDER;
}
- else if (player.x > screen->w - xViewBorder)
+ else if (player.x > screen->w - X_VIEW_BORDER)
{
- engine.smx += (screen->w - xViewBorder) - player.x;
- player.x = screen->w - xViewBorder;
+ engine.smx += (screen->w - X_VIEW_BORDER) - player.x;
+ player.x = screen->w - X_VIEW_BORDER;
}
}
else if (game.difficulty != DIFFICULTY_ORIGINAL)
@@ -1455,13 +1455,13 @@ static void game_doPlayer()
cd = player.x - screen->w / 2;
if (cd < 0)
{
- cc = MAX(cd / 10, MAX(0, engine.ssx) - cameraMaxSpeed);
+ cc = MAX(cd / 10, MAX(0, engine.ssx) - CAMERA_MAX_SPEED);
player.x -= cc;
engine.smx -= cc;
}
else if (cd > 0)
{
- cc = MIN(cd / 10, cameraMaxSpeed + MIN(0, engine.ssx));
+ cc = MIN(cd / 10, CAMERA_MAX_SPEED + MIN(0, engine.ssx));
player.x -= cc;
engine.smx -= cc;
}
@@ -1469,15 +1469,15 @@ static void game_doPlayer()
if (ymoved)
{
- if (player.y < yViewBorder)
+ if (player.y < Y_VIEW_BORDER)
{
- engine.smy += yViewBorder - player.y;
- player.y = yViewBorder;
+ engine.smy += Y_VIEW_BORDER - player.y;
+ player.y = Y_VIEW_BORDER;
}
- else if (player.y > screen->h - yViewBorder)
+ else if (player.y > screen->h - Y_VIEW_BORDER)
{
- engine.smy += (screen->h - yViewBorder) - player.y;
- player.y = screen->h - yViewBorder;
+ engine.smy += (screen->h - Y_VIEW_BORDER) - player.y;
+ player.y = screen->h - Y_VIEW_BORDER;
}
}
else if (game.difficulty != DIFFICULTY_ORIGINAL)
@@ -1485,13 +1485,13 @@ static void game_doPlayer()
cd = player.y - screen->h / 2;
if (cd < 0)
{
- cc = MAX(cd / 10, MAX(0, engine.ssy) - cameraMaxSpeed);
+ cc = MAX(cd / 10, MAX(0, engine.ssy) - CAMERA_MAX_SPEED);
player.y -= cc;
engine.smy -= cc;
}
else if (cd > 0)
{
- cc = MIN(cd / 10, cameraMaxSpeed + MIN(0, engine.ssy));
+ cc = MIN(cd / 10, CAMERA_MAX_SPEED + MIN(0, engine.ssy));
player.y -= cc;
engine.smy -= cc;
}
@@ -1499,8 +1499,8 @@ static void game_doPlayer()
}
else
{
- LIMIT(player.x, xViewBorder, screen->w - xViewBorder);
- LIMIT(player.y, yViewBorder, screen->h - yViewBorder);
+ LIMIT(player.x, X_VIEW_BORDER, screen->w - X_VIEW_BORDER);
+ LIMIT(player.y, Y_VIEW_BORDER, screen->h - Y_VIEW_BORDER);
}
}
@@ -1531,9 +1531,9 @@ static void game_doPlayer()
if (aliens[ALIEN_KLINE].active)
{
if (game.area == MISN_VENUS)
- radio_setMessage(FS_KLINE, klineVenusInsult[rand() % nKlineVenusInsult], 1);
+ radio_setMessage(FS_KLINE, klineVenusInsult[rand() % NMSG_KLINE_VENUS_INSULT], 1);
else
- radio_setMessage(FS_KLINE, klineInsult[rand() % nKlineInsult], 1);
+ radio_setMessage(FS_KLINE, klineInsult[rand() % NMSG_KLINE_INSULT], 1);
}
else if ((aliens[ALIEN_BOSS].active) && (aliens[ALIEN_BOSS].classDef == CD_KRASS))
{
@@ -1560,8 +1560,8 @@ static void game_doPlayer()
}
}
- LIMIT(engine.ssx, -cameraMaxSpeed, cameraMaxSpeed);
- LIMIT(engine.ssy, -cameraMaxSpeed, cameraMaxSpeed);
+ LIMIT(engine.ssx, -CAMERA_MAX_SPEED, CAMERA_MAX_SPEED);
+ LIMIT(engine.ssy, -CAMERA_MAX_SPEED, CAMERA_MAX_SPEED);
// Specific for the mission were you have to chase the Executive Transport
if (((game.area == MISN_ELLESH) && (player.shield > 0)) ||
@@ -2580,3 +2580,10 @@ int game_mainLoop()
return rtn;
}
+
+#undef NMSG_KLINE_INSULT
+#undef NMSG_KLINE_VENUS_INSULT
+#undef NMSG_PHOEBE_PLAYER_HIT
+#undef NMSG_URSULA_PLAYER_HIT
+#undef NMSG_PLAYER_PHOEBE_HIT
+#undef NMSG_PLAYER_URSULA_HIT
diff --git a/src/intermission.cpp b/src/intermission.cpp
index 1c9cc66..8c60875 100644
--- a/src/intermission.cpp
+++ b/src/intermission.cpp
@@ -1492,7 +1492,7 @@ int intermission()
case 3:
x = screen->w / 2 - savesSurface->w / 2;
- y = intermission_ycenter - savesSurface->h / 2;
+ y = INTERMISSION_YCENTER - savesSurface->h / 2;
screen_blit(savesSurface, x, y);
saveSlot = save_showSlots(savesSurface, saveSlot, x, y);
break;
@@ -1503,14 +1503,14 @@ int intermission()
case 5:
x = screen->w / 2 - commsSurface->w / 2;
- y = intermission_ycenter - commsSurface->h / 2;
+ y = INTERMISSION_YCENTER - commsSurface->h / 2;
screen_blit(commsSurface, x, y);
intermission_doComms(commsSurface, x, y);
break;
case 6:
x = screen->w / 2 - optionsSurface->w / 2;
- y = intermission_ycenter - optionsSurface->h / 2;
+ y = INTERMISSION_YCENTER - optionsSurface->h / 2;
screen_blit(optionsSurface, x, y);
intermission_doOptions(optionsSurface, x, y);
break;
diff --git a/src/intermission.h b/src/intermission.h
index f08571d..ca8625a 100644
--- a/src/intermission.h
+++ b/src/intermission.h
@@ -25,7 +25,7 @@ along with this program. If not, see .
extern Planet intermission_planets[MAX_PLANETS];
-const int intermission_ycenter = 50 + (DEFAULT_SCREEN_HEIGHT - 150) / 2;
+#define INTERMISSION_YCENTER (50 + (screen->h - 150) / 2)
void intermission_initPlanets(int system);
void intermission_unlockPlanets();
diff --git a/src/ship.cpp b/src/ship.cpp
index 1d9d5f7..811dfd2 100644
--- a/src/ship.cpp
+++ b/src/ship.cpp
@@ -176,7 +176,7 @@ void ship_fireRay(Object *ship)
player.image[0]->h, ray.x, ray.y, ray.w, ray.h) &&
(!engine.cheatShield) && (engine.missionCompleteTimer == 0))
{
- player_damage(1, rayDamageDelay);
+ player_damage(1, RAY_DAMAGE_DELAY);
explosion_add(player.x, player.y, SP_SMALL_EXPLOSION);
audio_playSound(SFX_HIT, player.x, player.y);
diff --git a/src/shop.cpp b/src/shop.cpp
index 1e1af8d..6f44a44 100644
--- a/src/shop.cpp
+++ b/src/shop.cpp
@@ -31,6 +31,7 @@ along with this program. If not, see .
#include "player.h"
#include "save.h"
#include "screen.h"
+#include "shop.h"
#include "weapons.h"
typedef struct ShopItem_ {
@@ -43,11 +44,6 @@ typedef struct ShopItem_ {
} ShopItem;
-static const int shop_w = 600;
-static const int shop_x = DEFAULT_SCREEN_WIDTH / 2 - shop_w / 2;
-static const int shop_h = 336;
-static const int shop_y = intermission_ycenter - shop_h / 2;
-
static ShopItem shopItems[SHOP_MAX];
static int shopSelectedItem;
@@ -265,8 +261,8 @@ static void drawShop()
for (int i = 0 ; i < icons ; i++)
{
- gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x + 10 - shop_x,
- shopItems[i].y - shop_y - 48, gfx_shopSprites[SHOP_S_CATALOG]);
+ gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x + 10 - SHOP_X,
+ shopItems[i].y - SHOP_Y - 48, gfx_shopSprites[SHOP_S_CATALOG]);
}
sprintf(description, "Shield : %d", player.maxShield);
@@ -437,7 +433,7 @@ void shop_init()
shopItems[SHOP_HOMING_MISSILE].price = 7500;
strcpy(shopItems[SHOP_HOMING_MISSILE].name, "Homing Missile Launcher");
sprintf(shopItems[SHOP_HOMING_MISSILE].description,
- "Fires homing missile (max %i missiles)", maxHoming);
+ "Fires homing missile (max %i missiles)", MAX_HOMING);
shopItems[SHOP_HOMING_MISSILE].image = 22;
shopItems[SHOP_CHARGER].price = 10000;
@@ -449,66 +445,66 @@ void shop_init()
strcpy(shopItems[SHOP_DOUBLE_HOMING_MISSILES].name,
"Dual Homing Missile Launcher");
sprintf(shopItems[SHOP_DOUBLE_HOMING_MISSILES].description,
- "Fires two homing missiles (max %i missiles)", maxDoubleHoming);
+ "Fires two homing missiles (max %i missiles)", MAX_DOUBLE_HOMING);
shopItems[SHOP_DOUBLE_HOMING_MISSILES].image = 24;
shopItems[SHOP_MICRO_HOMING_MISSILES].price = 15000;
strcpy(shopItems[SHOP_MICRO_HOMING_MISSILES].name,
"Homing Micro Missile Launcher");
sprintf(shopItems[SHOP_MICRO_HOMING_MISSILES].description,
- "Fires several small homing missiles (max %i missiles)", maxMicroHoming);
+ "Fires several small homing missiles (max %i missiles)", MAX_MICRO_HOMING);
shopItems[SHOP_MICRO_HOMING_MISSILES].image = 25;
- shopItems[SHOP_PLASMA_MAX_OUTPUT].x = shop_x;
- shopItems[SHOP_PLASMA_MAX_OUTPUT].y = shop_y + 70;
+ 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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;
+ shopItems[SHOP_MICRO_HOMING_MISSILES].x = SHOP_X + 550;
+ shopItems[SHOP_MICRO_HOMING_MISSILES].y = SHOP_Y + 130;
shopSelectedItem = -1;
@@ -609,19 +605,19 @@ static void buy(int i)
return;
}
if ((player.weaponType[1] == W_HOMING_MISSILE) &&
- (player.ammo[1] >= maxHoming))
+ (player.ammo[1] >= MAX_HOMING))
{
shopSelectedItem = -9;
return;
}
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) &&
- (player.ammo[1] >= maxDoubleHoming))
+ (player.ammo[1] >= MAX_DOUBLE_HOMING))
{
shopSelectedItem = -9;
return;
}
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) &&
- (player.ammo[1] >= maxMicroHoming))
+ (player.ammo[1] >= MAX_MICRO_HOMING))
{
shopSelectedItem = -9;
return;
@@ -679,19 +675,19 @@ static void buy(int i)
return;
}
if ((player.weaponType[1] == W_HOMING_MISSILE) &&
- (game.maxRocketAmmo >= maxHoming))
+ (game.maxRocketAmmo >= MAX_HOMING))
{
shopSelectedItem = -9;
return;
}
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) &&
- (game.maxRocketAmmo >= maxDoubleHoming))
+ (game.maxRocketAmmo >= MAX_DOUBLE_HOMING))
{
shopSelectedItem = -9;
return;
}
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) &&
- (game.maxRocketAmmo >= maxMicroHoming))
+ (game.maxRocketAmmo >= MAX_MICRO_HOMING))
{
shopSelectedItem = -9;
return;
@@ -757,10 +753,10 @@ static void buy(int i)
shop_sellSecondaryWeapon();
player.weaponType[1] = W_HOMING_MISSILE;
- while (game.maxRocketAmmo > maxHoming)
+ while (game.maxRocketAmmo > MAX_HOMING)
sell(SHOP_ROCKET_MAX_AMMO);
- LIMIT(game.maxRocketAmmo, 5, maxHoming);
+ LIMIT(game.maxRocketAmmo, 5, MAX_HOMING);
shopSelectedItem = -1;
break;
@@ -793,10 +789,10 @@ static void buy(int i)
shop_sellSecondaryWeapon();
player.weaponType[1] = W_DOUBLE_HOMING_MISSILES;
- while (game.maxRocketAmmo > maxDoubleHoming)
+ while (game.maxRocketAmmo > MAX_DOUBLE_HOMING)
sell(SHOP_ROCKET_MAX_AMMO);
- LIMIT(game.maxRocketAmmo, 5, maxDoubleHoming);
+ LIMIT(game.maxRocketAmmo, 5, MAX_DOUBLE_HOMING);
shopSelectedItem = -1;
break;
@@ -809,10 +805,10 @@ static void buy(int i)
shop_sellSecondaryWeapon();
player.weaponType[1] = W_MICRO_HOMING_MISSILES;
- while (game.maxRocketAmmo > maxMicroHoming)
+ while (game.maxRocketAmmo > MAX_MICRO_HOMING)
sell(SHOP_ROCKET_MAX_AMMO);
- LIMIT(game.maxRocketAmmo, 5, maxMicroHoming);
+ LIMIT(game.maxRocketAmmo, 5, MAX_MICRO_HOMING);
shopSelectedItem = -1;
break;
}
@@ -1048,17 +1044,17 @@ static void sell(int i)
void shop_show()
{
int icons = SHOP_MAX;
- int sell_x = shop_x + shop_w - gfx_sprites[SP_SELL]->w - 2;
- int sell_y = shop_y + 183;
+ int sell_x = SHOP_X + SHOP_WIDTH - gfx_sprites[SP_SELL]->w - 2;
+ int sell_y = SHOP_Y + 183;
int buy_x = sell_x - gfx_sprites[SP_BUY]->w - 5;
- int buy_y = shop_y + 183;
+ int buy_y = SHOP_Y + 183;
- 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);
+ 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);
if (shopSelectedItem > -1)
{
@@ -1066,7 +1062,7 @@ void shop_show()
screen_blit(gfx_sprites[SP_SELL], sell_x, sell_y);
}
- screen_blit(gfx_sprites[SP_FIREFLY], shop_x + 280, shop_y + 15);
+ screen_blit(gfx_sprites[SP_FIREFLY], SHOP_X + 280, SHOP_Y + 15);
if (game.system == 0)
icons = SHOP_DOUBLE_ROCKETS + 1;
diff --git a/src/shop.h b/src/shop.h
index a381777..a4ec30d 100644
--- a/src/shop.h
+++ b/src/shop.h
@@ -23,6 +23,11 @@ along with this program. If not, see .
#include "defs.h"
#include "structs.h"
+#define SHOP_WIDTH 600
+#define SHOP_HEIGHT 336
+#define SHOP_X (screen->w / 2 - SHOP_WIDTH / 2)
+#define SHOP_Y (INTERMISSION_YCENTER - SHOP_HEIGHT / 2)
+
void shop_init();
void shop_show();