Lots of cleanup done on how weapons are handled.

I did one structural change to the way ship_fireBullet works. It
previously had two separate places for reducing ammo from the player.
I changed this so that it removes ammo in the same place regardless
of which weapon it is, but then performs the plasma "out of ammo"
action afterwards. It seems to work properly.

Also fixed a flaw in the saving which would in some cases cause
the stationed planet to not get saved properly.
This commit is contained in:
onpon4 2016-11-25 13:47:12 -05:00
parent 3400ff180c
commit 1be0fd1164
11 changed files with 196 additions and 209 deletions

View File

@ -1247,7 +1247,7 @@ void alien_addSmallAsteroid(Object *hostAlien)
int debris = RANDRANGE(1, 10);
for (int i = 0 ; i < debris ; i++)
bullet_add(&weapon[W_ROCKETS], hostAlien, 0, 0);
bullet_add(&weapons[W_ROCKETS], hostAlien, 0, 0);
for (int i = 0 ; i <= ALIEN_NORMAL_LAST ; i++)
if (!aliens[i].active)

View File

@ -84,9 +84,9 @@ void collectable_add(float x, float y, int type, int value, int life)
// upgraded! Give them money instead.
if (type == P_PLASMA_AMMO)
{
if ((weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.minPlasmaRate]) &&
(weapon[W_PLAYER_WEAPON].ammo[0] <= game.minPlasmaOutput) &&
(weapon[W_PLAYER_WEAPON].damage <= game.minPlasmaDamage))
if ((weapons[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.minPlasmaRate]) &&
(weapons[W_PLAYER_WEAPON].ammo[0] <= game.minPlasmaOutput) &&
(weapons[W_PLAYER_WEAPON].damage <= game.minPlasmaDamage))
{
type = P_CASH;
}

View File

@ -336,9 +336,9 @@ static void game_doCollectables()
if (game.difficulty == DIFFICULTY_ORIGINAL)
{
player.ammo[0] = MAX(player.ammo[0], 50);
weapon[W_PLAYER_WEAPON].reload[0] = MAX(
weapons[W_PLAYER_WEAPON].reload[0] = MAX(
rate2reload[game.maxPlasmaRate],
weapon[W_PLAYER_WEAPON].reload[0] - 2);
weapons[W_PLAYER_WEAPON].reload[0] - 2);
}
else if ((game.area != MISN_INTERCEPTION) ||
(player.ammo[0] > 0))
@ -347,11 +347,11 @@ static void game_doCollectables()
LIMIT_ADD(player.ammo[0], collectable->value,
0, game.maxPlasmaAmmo);
if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[game.maxPlasmaRate])
if (weapons[W_PLAYER_WEAPON].reload[0] <= rate2reload[game.maxPlasmaRate])
sprintf(temp, "Firing rate already at maximum");
else
{
weapon[W_PLAYER_WEAPON].reload[0] -= 2;
weapons[W_PLAYER_WEAPON].reload[0] -= 2;
sprintf(temp, "Firing rate increased");
}
}
@ -366,8 +366,8 @@ static void game_doCollectables()
if (game.difficulty == DIFFICULTY_ORIGINAL)
{
player.ammo[0] = MAX(player.ammo[0], 50);
weapon[W_PLAYER_WEAPON].ammo[0] = MIN(
game.maxPlasmaOutput, weapon[W_PLAYER_WEAPON].ammo[0] + 1);
weapons[W_PLAYER_WEAPON].ammo[0] = MIN(
game.maxPlasmaOutput, weapons[W_PLAYER_WEAPON].ammo[0] + 1);
}
else if ((game.area != MISN_INTERCEPTION) ||
(player.ammo[0] > 0))
@ -376,11 +376,11 @@ static void game_doCollectables()
LIMIT_ADD(player.ammo[0], collectable->value,
0, game.maxPlasmaAmmo);
if (weapon[W_PLAYER_WEAPON].ammo[0] >= game.maxPlasmaOutput)
if (weapons[W_PLAYER_WEAPON].ammo[0] >= game.maxPlasmaOutput)
sprintf(temp, "Plasma output already at maximum");
else
{
weapon[W_PLAYER_WEAPON].ammo[0]++;
weapons[W_PLAYER_WEAPON].ammo[0]++;
sprintf(temp, "Plasma output increased");
}
}
@ -395,8 +395,8 @@ static void game_doCollectables()
if (game.difficulty == DIFFICULTY_ORIGINAL)
{
player.ammo[0] = MAX(player.ammo[0], 50);
weapon[W_PLAYER_WEAPON].damage = MIN(
game.maxPlasmaDamage, weapon[W_PLAYER_WEAPON].damage + 1);
weapons[W_PLAYER_WEAPON].damage = MIN(
game.maxPlasmaDamage, weapons[W_PLAYER_WEAPON].damage + 1);
}
else if ((game.area != MISN_INTERCEPTION) ||
(player.ammo[0] > 0))
@ -405,11 +405,11 @@ static void game_doCollectables()
LIMIT_ADD(player.ammo[0], collectable->value,
0, game.maxPlasmaAmmo);
if (weapon[W_PLAYER_WEAPON].damage >= game.maxPlasmaDamage)
if (weapons[W_PLAYER_WEAPON].damage >= game.maxPlasmaDamage)
sprintf(temp, "Plasma damage already at maximum");
else
{
weapon[W_PLAYER_WEAPON].damage++;
weapons[W_PLAYER_WEAPON].damage++;
sprintf(temp, "Plasma damage increased");
}
}
@ -431,10 +431,10 @@ static void game_doCollectables()
LIMIT_ADD(player.ammo[0], collectable->value,
0, game.maxPlasmaAmmo);
weapon[W_PLAYER_WEAPON].ammo[0] = 5;
weapon[W_PLAYER_WEAPON].damage = 5;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[5];
weapon[W_PLAYER_WEAPON].flags |= WF_SPREAD;
weapons[W_PLAYER_WEAPON].ammo[0] = 5;
weapons[W_PLAYER_WEAPON].damage = 5;
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[5];
weapons[W_PLAYER_WEAPON].flags |= WF_SPREAD;
sprintf(temp, "Picked up a Super Charge!");
}
@ -501,9 +501,9 @@ static void game_doCollectables()
// stop people from exploiting a weapon check condition
if (player.ammo[0] == 0)
{
weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
}
}
@ -1303,12 +1303,12 @@ static void game_doPlayer()
if ((engine.keyState[KEY_SWITCH]))
{
if ((weapon[W_PLAYER_WEAPON].ammo[0] >= 3) &&
(weapon[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput))
if ((weapons[W_PLAYER_WEAPON].ammo[0] >= 3) &&
(weapons[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput))
{
weapon[W_PLAYER_WEAPON].flags ^= WF_SPREAD;
weapons[W_PLAYER_WEAPON].flags ^= WF_SPREAD;
if (weapon[W_PLAYER_WEAPON].flags & WF_SPREAD)
if (weapons[W_PLAYER_WEAPON].flags & WF_SPREAD)
{
info_setLine("Weapon set to Spread", FONT_WHITE);
}
@ -1926,7 +1926,7 @@ static void game_doHud()
for (int i = 1 ; i <= 5 ; i++)
{
if (weapon[W_PLAYER_WEAPON].damage >= i) {
if (weapons[W_PLAYER_WEAPON].damage >= i) {
if(i <= game.maxPlasmaDamage || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
{
SDL_FillRect(screen, &bar, green);
@ -1946,7 +1946,7 @@ static void game_doHud()
for (int i = 1 ; i <= 5 ; i++)
{
if (weapon[W_PLAYER_WEAPON].ammo[0] >= i) {
if (weapons[W_PLAYER_WEAPON].ammo[0] >= i) {
if(i <= game.maxPlasmaOutput || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
{
SDL_FillRect(screen, &bar, yellow);
@ -1966,7 +1966,7 @@ static void game_doHud()
for (int i = 1 ; i <= 5 ; i++)
{
if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[i]) {
if (weapons[W_PLAYER_WEAPON].reload[0] <= rate2reload[i]) {
if(i <= game.maxPlasmaRate || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
{
SDL_FillRect(screen, &bar, blue);

View File

@ -731,8 +731,8 @@ void gfx_loadSprites()
for (int i = 0 ; i < W_MAX ; i++)
{
weapon[i].image[0] = gfx_sprites[weapon[i].imageIndex[0]];
weapon[i].image[1] = gfx_sprites[weapon[i].imageIndex[1]];
weapons[i].image[0] = gfx_sprites[weapons[i].imageIndex[0]];
weapons[i].image[1] = gfx_sprites[weapons[i].imageIndex[1]];
}
}

View File

@ -153,7 +153,6 @@ void intermission_updateSystemStatus()
{
game.stationedPlanet = 0;
game.area = 1;
strcpy(game.stationedName, "Hail");
intermission_initPlanets(game.system);
}
else if (game.area == MISN_MOEBO)
@ -161,7 +160,6 @@ void intermission_updateSystemStatus()
game.stationedPlanet = 0;
game.system = 1;
game.area = MISN_RESCUESLAVES;
strcpy(game.stationedName, "Nerod");
intermission_initPlanets(game.system);
if (game.difficulty == DIFFICULTY_ORIGINAL)
@ -172,7 +170,6 @@ void intermission_updateSystemStatus()
game.stationedPlanet = 0;
game.system = 2;
game.area = MISN_CLOAKFIGHTER;
strcpy(game.stationedName, "Odeon");
intermission_initPlanets(game.system);
if (game.difficulty == DIFFICULTY_ORIGINAL)
@ -183,7 +180,6 @@ void intermission_updateSystemStatus()
game.stationedPlanet = 8;
game.system = 3;
game.area = MISN_PLUTO;
strcpy(game.stationedName, "Pluto");
intermission_initPlanets(game.system);
if (game.difficulty == DIFFICULTY_ORIGINAL)
@ -1366,12 +1362,12 @@ int intermission()
if ((game.difficulty != DIFFICULTY_EASY) &&
(game.difficulty != DIFFICULTY_ORIGINAL))
{
weapon[W_PLAYER_WEAPON].reload[0] = MAX(
weapon[W_PLAYER_WEAPON].reload[0],
weapons[W_PLAYER_WEAPON].reload[0] = MAX(
weapons[W_PLAYER_WEAPON].reload[0],
rate2reload[game.maxPlasmaRate]);
weapon[W_PLAYER_WEAPON].ammo[0] = MIN(weapon[W_PLAYER_WEAPON].ammo[0],
weapons[W_PLAYER_WEAPON].ammo[0] = MIN(weapons[W_PLAYER_WEAPON].ammo[0],
game.maxPlasmaOutput);
weapon[W_PLAYER_WEAPON].damage = MIN(weapon[W_PLAYER_WEAPON].damage,
weapons[W_PLAYER_WEAPON].damage = MIN(weapons[W_PLAYER_WEAPON].damage,
game.maxPlasmaDamage);
}
@ -1588,8 +1584,6 @@ int intermission()
player.shield = player.maxShield;
sprintf(string, "Stationed At: %s",
intermission_planets[game.stationedPlanet].name);
strcpy(game.stationedName,
intermission_planets[game.stationedPlanet].name);
gfx_createTextObject(TS_CURRENT_PLANET, string, 90, 450, FONT_WHITE);
intermission_updateCommsSurface(commsSurface);
section = 1;

View File

@ -45,12 +45,12 @@ void initPlayer()
player.weaponType[0] = W_PLAYER_WEAPON;
if (weapon[W_PLAYER_WEAPON].ammo[0] < game.minPlasmaOutput)
weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
if (weapon[W_PLAYER_WEAPON].damage < game.minPlasmaDamage)
weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
if (weapon[W_PLAYER_WEAPON].reload[0] > rate2reload[game.minPlasmaRate])
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
if (weapons[W_PLAYER_WEAPON].ammo[0] < game.minPlasmaOutput)
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
if (weapons[W_PLAYER_WEAPON].damage < game.minPlasmaDamage)
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
if (weapons[W_PLAYER_WEAPON].reload[0] > rate2reload[game.minPlasmaRate])
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
player.hit = 0;

View File

@ -173,9 +173,9 @@ int save_load(int slot)
(fscanf(fp, "%d %d %d %d%*c", &player.maxShield,
&player.ammo[0], &player.ammo[1], &player.weaponType[1]) < 4) ||
(fscanf(fp, "%d %d %d%*c",
&weapon[W_PLAYER_WEAPON].ammo[0],
&weapon[W_PLAYER_WEAPON].damage,
&weapon[W_PLAYER_WEAPON].reload[0]) < 3) ||
&weapons[W_PLAYER_WEAPON].ammo[0],
&weapons[W_PLAYER_WEAPON].damage,
&weapons[W_PLAYER_WEAPON].reload[0]) < 3) ||
(fscanf(fp, "%d %d %d %d %d %d %d %d%*c",
&game.minPlasmaRate, &game.minPlasmaDamage,
&game.minPlasmaOutput, &game.maxPlasmaRate,
@ -234,9 +234,9 @@ int save_load(int slot)
if (game.saveFormat < 2)
game.difficulty = DIFFICULTY_NORMAL;
weapon[W_PLAYER_WEAPON] = game.playerWeapon;
weapon[W_PLAYER_WEAPON].imageIndex[0] = SP_PLASMA_GREEN;
weapon[W_PLAYER_WEAPON].imageIndex[1] = SP_PLASMA_GREEN;
weapons[W_PLAYER_WEAPON] = game.playerWeapon;
weapons[W_PLAYER_WEAPON].imageIndex[0] = SP_PLASMA_GREEN;
weapons[W_PLAYER_WEAPON].imageIndex[1] = SP_PLASMA_GREEN;
player = game.thePlayer;
}
@ -300,15 +300,15 @@ void save(int slot)
game.system, game.area, game.stationedPlanet,
game.stationedName,
intermission_planets[game.stationedPlanet].name,
game.hasWingMate1, game.hasWingMate2,
player.maxShield, player.ammo[0], player.ammo[1],
player.weaponType[1],
weapon[W_PLAYER_WEAPON].ammo[0], weapon[W_PLAYER_WEAPON].damage,
weapon[W_PLAYER_WEAPON].reload[0],
weapons[W_PLAYER_WEAPON].ammo[0], weapons[W_PLAYER_WEAPON].damage,
weapons[W_PLAYER_WEAPON].reload[0],
game.minPlasmaRate, game.minPlasmaDamage, game.minPlasmaOutput,
game.maxPlasmaRate, game.maxPlasmaDamage, game.maxPlasmaOutput,

View File

@ -43,18 +43,18 @@ int ship_collision(Object *ship, Object *otherShip)
/*
Fill in later...
*/
void ship_fireBullet(Object *ship, int weaponType)
void ship_fireBullet(Object *ship, int weaponIndex)
{
if (ship->reload[weaponType] > 0)
if (ship->reload[weaponIndex] > 0)
return;
int y = (ship->image[0]->h) / 5;
// Remove some ammo from the player
if ((ship == &player) && (weaponType == 1) && (!engine.cheatAmmo))
player.ammo[1]--;
if ((ship == &player) && (player.ammo[weaponIndex] > 0) && (!engine.cheatAmmo))
player.ammo[weaponIndex]--;
Object *theWeapon = &weapon[ship->weaponType[weaponType]];
Object *theWeapon = &weapons[ship->weaponType[weaponIndex]];
switch(theWeapon->id)
{
@ -113,25 +113,18 @@ void ship_fireBullet(Object *ship, int weaponType)
// Reset the weapon reload time. Double it if it is not friendly or
// a boss or Kline
ship->reload[weaponType] = theWeapon->reload[0];
ship->reload[weaponIndex] = theWeapon->reload[0];
if ((ship->flags & FL_WEAPCO) && (ship != &aliens[ALIEN_BOSS]) &&
(ship != &aliens[ALIEN_KLINE]) && (theWeapon->id != W_LASER))
ship->reload[weaponType] *= 2;
ship->reload[weaponIndex] *= 2;
if ((engine.cheatAmmo) || (theWeapon->id == WT_LASER))
return;
if ((ship == &player) && (weaponType == 0))
if ((ship == &player) && (weaponIndex == 0))
{
if (player.ammo[0] > 0)
if (player.ammo[weaponIndex] <= 0)
{
player.ammo[0]--;
if (player.ammo[0] <= 0)
{
weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
}
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
}
}
}

View File

@ -802,9 +802,9 @@ static void sell(int i)
sell(SHOP_PLASMA_MIN_OUTPUT);
game.maxPlasmaOutput--;
if (weapon[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput + 1)
weapon[W_PLAYER_WEAPON].ammo[0] = MIN(
weapon[W_PLAYER_WEAPON].ammo[0],
if (weapons[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput + 1)
weapons[W_PLAYER_WEAPON].ammo[0] = MIN(
weapons[W_PLAYER_WEAPON].ammo[0],
game.maxPlasmaOutput);
break;
@ -819,9 +819,9 @@ static void sell(int i)
sell(SHOP_PLASMA_MIN_DAMAGE);
game.maxPlasmaDamage--;
if (weapon[W_PLAYER_WEAPON].damage <= game.maxPlasmaDamage + 1)
weapon[W_PLAYER_WEAPON].damage = MIN(
weapon[W_PLAYER_WEAPON].damage,
if (weapons[W_PLAYER_WEAPON].damage <= game.maxPlasmaDamage + 1)
weapons[W_PLAYER_WEAPON].damage = MIN(
weapons[W_PLAYER_WEAPON].damage,
game.maxPlasmaDamage);
break;
@ -836,9 +836,9 @@ static void sell(int i)
sell(SHOP_PLASMA_MIN_RATE);
game.maxPlasmaRate--;
if (weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.maxPlasmaRate + 1])
weapon[W_PLAYER_WEAPON].reload[0] = MAX(
weapon[W_PLAYER_WEAPON].reload[0],
if (weapons[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.maxPlasmaRate + 1])
weapons[W_PLAYER_WEAPON].reload[0] = MAX(
weapons[W_PLAYER_WEAPON].reload[0],
rate2reload[game.maxPlasmaRate]);
break;
@ -850,7 +850,7 @@ static void sell(int i)
}
game.minPlasmaOutput--;
if (player.ammo[0] <= 0)
weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
break;
case SHOP_PLASMA_MIN_DAMAGE:
@ -861,7 +861,7 @@ static void sell(int i)
}
game.minPlasmaDamage--;
if (player.ammo[0] <= 0)
weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
break;
case SHOP_PLASMA_MIN_RATE:
@ -872,7 +872,7 @@ static void sell(int i)
}
game.minPlasmaRate--;
if (player.ammo[0] <= 0)
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
break;
case SHOP_PLASMA_AMMO:
@ -886,9 +886,9 @@ static void sell(int i)
else
{
player.ammo[0] = 0;
weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
weapons[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapons[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapons[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
}
break;

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
Object weapon[W_MAX];
Object weapons[W_MAX];
/*
A list of predefined weaponary.
@ -27,152 +27,152 @@ A list of predefined weaponary.
void initWeapons()
{
// Player's weapon (this NEVER allocated to anything else)
weapon[W_PLAYER_WEAPON].id = WT_PLASMA;
weapon[W_PLAYER_WEAPON].ammo[0] = 1;
weapon[W_PLAYER_WEAPON].damage = 1;
weapon[W_PLAYER_WEAPON].reload[0] = 15;
weapon[W_PLAYER_WEAPON].speed = 10;
weapon[W_PLAYER_WEAPON].imageIndex[0] = SP_PLASMA_GREEN;
weapon[W_PLAYER_WEAPON].imageIndex[1] = SP_PLASMA_GREEN;
weapon[W_PLAYER_WEAPON].flags = WF_SPREAD;
weapons[W_PLAYER_WEAPON].id = WT_PLASMA;
weapons[W_PLAYER_WEAPON].ammo[0] = 1;
weapons[W_PLAYER_WEAPON].damage = 1;
weapons[W_PLAYER_WEAPON].reload[0] = 15;
weapons[W_PLAYER_WEAPON].speed = 10;
weapons[W_PLAYER_WEAPON].imageIndex[0] = SP_PLASMA_GREEN;
weapons[W_PLAYER_WEAPON].imageIndex[1] = SP_PLASMA_GREEN;
weapons[W_PLAYER_WEAPON].flags = WF_SPREAD;
// Single Shot
weapon[W_SINGLE_SHOT].id = WT_PLASMA;
weapon[W_SINGLE_SHOT].ammo[0] = 1;
weapon[W_SINGLE_SHOT].damage = 1;
weapon[W_SINGLE_SHOT].reload[0] = 15;
weapon[W_SINGLE_SHOT].speed = 10;
weapon[W_SINGLE_SHOT].imageIndex[0] = SP_PLASMA_GREEN;
weapon[W_SINGLE_SHOT].imageIndex[1] = SP_PLASMA_RED;
weapon[W_SINGLE_SHOT].flags = 0;
weapons[W_SINGLE_SHOT].id = WT_PLASMA;
weapons[W_SINGLE_SHOT].ammo[0] = 1;
weapons[W_SINGLE_SHOT].damage = 1;
weapons[W_SINGLE_SHOT].reload[0] = 15;
weapons[W_SINGLE_SHOT].speed = 10;
weapons[W_SINGLE_SHOT].imageIndex[0] = SP_PLASMA_GREEN;
weapons[W_SINGLE_SHOT].imageIndex[1] = SP_PLASMA_RED;
weapons[W_SINGLE_SHOT].flags = 0;
// Double Shot
weapon[W_DOUBLE_SHOT] = weapon[W_SINGLE_SHOT];
weapon[W_DOUBLE_SHOT].ammo[0] = 2;
weapons[W_DOUBLE_SHOT] = weapons[W_SINGLE_SHOT];
weapons[W_DOUBLE_SHOT].ammo[0] = 2;
// Triple Shot
weapon[W_TRIPLE_SHOT] = weapon[W_SINGLE_SHOT];
weapon[W_TRIPLE_SHOT].ammo[0] = 3;
weapons[W_TRIPLE_SHOT] = weapons[W_SINGLE_SHOT];
weapons[W_TRIPLE_SHOT].ammo[0] = 3;
// Rockets
weapon[W_ROCKETS].id = WT_ROCKET;
weapon[W_ROCKETS].ammo[0] = 1;
weapon[W_ROCKETS].damage = 15;
weapon[W_ROCKETS].reload[0] = 45;
weapon[W_ROCKETS].speed = 20;
weapon[W_ROCKETS].flags = 0;
weapon[W_ROCKETS].imageIndex[0] = SP_ROCKET;
weapon[W_ROCKETS].imageIndex[1] = SP_ROCKET_L;
weapons[W_ROCKETS].id = WT_ROCKET;
weapons[W_ROCKETS].ammo[0] = 1;
weapons[W_ROCKETS].damage = 15;
weapons[W_ROCKETS].reload[0] = 45;
weapons[W_ROCKETS].speed = 20;
weapons[W_ROCKETS].flags = 0;
weapons[W_ROCKETS].imageIndex[0] = SP_ROCKET;
weapons[W_ROCKETS].imageIndex[1] = SP_ROCKET_L;
// Double Rockets (uses ROCKETS as base)
weapon[W_DOUBLE_ROCKETS] = weapon[W_ROCKETS];
weapon[W_DOUBLE_ROCKETS].ammo[0] = 2;
weapon[W_DOUBLE_ROCKETS].reload[0] = 80;
weapons[W_DOUBLE_ROCKETS] = weapons[W_ROCKETS];
weapons[W_DOUBLE_ROCKETS].ammo[0] = 2;
weapons[W_DOUBLE_ROCKETS].reload[0] = 80;
// Micro Rockets
weapon[W_MICRO_ROCKETS].id = WT_ROCKET;
weapon[W_MICRO_ROCKETS].ammo[0] = 5;
weapon[W_MICRO_ROCKETS].damage = 6;
weapon[W_MICRO_ROCKETS].reload[0] = 30;
weapon[W_MICRO_ROCKETS].speed = 15;
weapon[W_MICRO_ROCKETS].flags = WF_VARIABLE_SPEED;
weapon[W_MICRO_ROCKETS].imageIndex[0] = SP_ROCKET;
weapon[W_MICRO_ROCKETS].imageIndex[1] = SP_ROCKET_L;
weapons[W_MICRO_ROCKETS].id = WT_ROCKET;
weapons[W_MICRO_ROCKETS].ammo[0] = 5;
weapons[W_MICRO_ROCKETS].damage = 6;
weapons[W_MICRO_ROCKETS].reload[0] = 30;
weapons[W_MICRO_ROCKETS].speed = 15;
weapons[W_MICRO_ROCKETS].flags = WF_VARIABLE_SPEED;
weapons[W_MICRO_ROCKETS].imageIndex[0] = SP_ROCKET;
weapons[W_MICRO_ROCKETS].imageIndex[1] = SP_ROCKET_L;
// Energy Ray
weapon[W_ENERGYRAY].id = WT_ENERGYRAY;
weapon[W_ENERGYRAY].ammo[0] = 255;
weapon[W_ENERGYRAY].damage = 1;
weapon[W_ENERGYRAY].reload[0] = 25; // reload for energy ray is never used
weapon[W_ENERGYRAY].speed = 15;
weapon[W_ENERGYRAY].imageIndex[0] = SP_PLASMA_RED;
weapon[W_ENERGYRAY].imageIndex[1] = SP_PLASMA_RED;
weapon[W_ENERGYRAY].flags = 0;
weapons[W_ENERGYRAY].id = WT_ENERGYRAY;
weapons[W_ENERGYRAY].ammo[0] = 255;
weapons[W_ENERGYRAY].damage = 1;
weapons[W_ENERGYRAY].reload[0] = 25; // reload for energy ray is never used
weapons[W_ENERGYRAY].speed = 15;
weapons[W_ENERGYRAY].imageIndex[0] = SP_PLASMA_RED;
weapons[W_ENERGYRAY].imageIndex[1] = SP_PLASMA_RED;
weapons[W_ENERGYRAY].flags = 0;
// Laser
weapon[W_LASER].id = WT_LASER;
weapon[W_LASER].ammo[0] = 1;
weapon[W_LASER].damage = 3;
weapon[W_LASER].reload[0] = 1;
weapon[W_LASER].speed = 10;
weapon[W_LASER].imageIndex[0] = SP_PLASMA_RED;
weapon[W_LASER].imageIndex[1] = SP_PLASMA_RED;
weapon[W_LASER].flags = 0;
weapons[W_LASER].id = WT_LASER;
weapons[W_LASER].ammo[0] = 1;
weapons[W_LASER].damage = 3;
weapons[W_LASER].reload[0] = 1;
weapons[W_LASER].speed = 10;
weapons[W_LASER].imageIndex[0] = SP_PLASMA_RED;
weapons[W_LASER].imageIndex[1] = SP_PLASMA_RED;
weapons[W_LASER].flags = 0;
// Beam up weapon
weapon[W_CHARGER].id = WT_CHARGER;
weapon[W_CHARGER].ammo[0] = 1;
weapon[W_CHARGER].damage = 1;
weapon[W_CHARGER].reload[0] = 0;
weapon[W_CHARGER].speed = 12;
weapon[W_CHARGER].flags = 0;
weapon[W_CHARGER].imageIndex[0] = SP_DIR_PLASMA_GREEN;
weapon[W_CHARGER].imageIndex[1] = SP_DIR_PLASMA_RED;
weapons[W_CHARGER].id = WT_CHARGER;
weapons[W_CHARGER].ammo[0] = 1;
weapons[W_CHARGER].damage = 1;
weapons[W_CHARGER].reload[0] = 0;
weapons[W_CHARGER].speed = 12;
weapons[W_CHARGER].flags = 0;
weapons[W_CHARGER].imageIndex[0] = SP_DIR_PLASMA_GREEN;
weapons[W_CHARGER].imageIndex[1] = SP_DIR_PLASMA_RED;
// Homing missile
weapon[W_HOMING_MISSILE].id = WT_ROCKET;
weapon[W_HOMING_MISSILE].ammo[0] = 1;
weapon[W_HOMING_MISSILE].damage = 15;
weapon[W_HOMING_MISSILE].reload[0] = 35;
weapon[W_HOMING_MISSILE].speed = 10;
weapon[W_HOMING_MISSILE].flags = WF_HOMING;
weapon[W_HOMING_MISSILE].imageIndex[0] = SP_SMALL_EXPLOSION;
weapon[W_HOMING_MISSILE].imageIndex[1] = SP_SMALL_EXPLOSION;
weapons[W_HOMING_MISSILE].id = WT_ROCKET;
weapons[W_HOMING_MISSILE].ammo[0] = 1;
weapons[W_HOMING_MISSILE].damage = 15;
weapons[W_HOMING_MISSILE].reload[0] = 35;
weapons[W_HOMING_MISSILE].speed = 10;
weapons[W_HOMING_MISSILE].flags = WF_HOMING;
weapons[W_HOMING_MISSILE].imageIndex[0] = SP_SMALL_EXPLOSION;
weapons[W_HOMING_MISSILE].imageIndex[1] = SP_SMALL_EXPLOSION;
// Double homing missile
weapon[W_DOUBLE_HOMING_MISSILES] = weapon[W_HOMING_MISSILE];
weapon[W_DOUBLE_HOMING_MISSILES].ammo[0] = 2;
weapon[W_DOUBLE_HOMING_MISSILES].reload[0] = 65;
weapon[W_DOUBLE_HOMING_MISSILES].imageIndex[0] = SP_SMALL_EXPLOSION;
weapon[W_DOUBLE_HOMING_MISSILES].imageIndex[1] = SP_SMALL_EXPLOSION;
weapons[W_DOUBLE_HOMING_MISSILES] = weapons[W_HOMING_MISSILE];
weapons[W_DOUBLE_HOMING_MISSILES].ammo[0] = 2;
weapons[W_DOUBLE_HOMING_MISSILES].reload[0] = 65;
weapons[W_DOUBLE_HOMING_MISSILES].imageIndex[0] = SP_SMALL_EXPLOSION;
weapons[W_DOUBLE_HOMING_MISSILES].imageIndex[1] = SP_SMALL_EXPLOSION;
// Micro homing missiles
weapon[W_MICRO_HOMING_MISSILES].id = WT_ROCKET;
weapon[W_MICRO_HOMING_MISSILES].ammo[0] = 5;
weapon[W_MICRO_HOMING_MISSILES].damage = 12;
weapon[W_MICRO_HOMING_MISSILES].reload[0] = 65;
weapon[W_MICRO_HOMING_MISSILES].speed = 3;
weapon[W_MICRO_HOMING_MISSILES].flags = WF_HOMING;
weapon[W_MICRO_HOMING_MISSILES].imageIndex[0] = SP_SMALL_EXPLOSION;
weapon[W_MICRO_HOMING_MISSILES].imageIndex[1] = SP_SMALL_EXPLOSION;
weapons[W_MICRO_HOMING_MISSILES].id = WT_ROCKET;
weapons[W_MICRO_HOMING_MISSILES].ammo[0] = 5;
weapons[W_MICRO_HOMING_MISSILES].damage = 12;
weapons[W_MICRO_HOMING_MISSILES].reload[0] = 65;
weapons[W_MICRO_HOMING_MISSILES].speed = 3;
weapons[W_MICRO_HOMING_MISSILES].flags = WF_HOMING;
weapons[W_MICRO_HOMING_MISSILES].imageIndex[0] = SP_SMALL_EXPLOSION;
weapons[W_MICRO_HOMING_MISSILES].imageIndex[1] = SP_SMALL_EXPLOSION;
// Aimed plasma bolt
weapon[W_AIMED_SHOT].id = WT_DIRECTIONAL;
weapon[W_AIMED_SHOT].ammo[0] = 1;
weapon[W_AIMED_SHOT].damage = 2;
weapon[W_AIMED_SHOT].reload[0] = 15;
weapon[W_AIMED_SHOT].speed = 0;
weapon[W_AIMED_SHOT].flags = WF_AIMED;
weapon[W_AIMED_SHOT].imageIndex[0] = SP_DIR_PLASMA_GREEN;
weapon[W_AIMED_SHOT].imageIndex[1] = SP_DIR_PLASMA_RED;
weapons[W_AIMED_SHOT].id = WT_DIRECTIONAL;
weapons[W_AIMED_SHOT].ammo[0] = 1;
weapons[W_AIMED_SHOT].damage = 2;
weapons[W_AIMED_SHOT].reload[0] = 15;
weapons[W_AIMED_SHOT].speed = 0;
weapons[W_AIMED_SHOT].flags = WF_AIMED;
weapons[W_AIMED_SHOT].imageIndex[0] = SP_DIR_PLASMA_GREEN;
weapons[W_AIMED_SHOT].imageIndex[1] = SP_DIR_PLASMA_RED;
// 3 way spread weapon
weapon[W_SPREADSHOT].id = WT_SPREAD;
weapon[W_SPREADSHOT].ammo[0] = 3;
weapon[W_SPREADSHOT].damage = 2;
weapon[W_SPREADSHOT].reload[0] = 10;
weapon[W_SPREADSHOT].speed = 10;
weapon[W_SPREADSHOT].flags = WF_SPREAD;
weapon[W_SPREADSHOT].imageIndex[0] = SP_PLASMA_GREEN;
weapon[W_SPREADSHOT].imageIndex[1] = SP_PLASMA_RED;
weapons[W_SPREADSHOT].id = WT_SPREAD;
weapons[W_SPREADSHOT].ammo[0] = 3;
weapons[W_SPREADSHOT].damage = 2;
weapons[W_SPREADSHOT].reload[0] = 10;
weapons[W_SPREADSHOT].speed = 10;
weapons[W_SPREADSHOT].flags = WF_SPREAD;
weapons[W_SPREADSHOT].imageIndex[0] = SP_PLASMA_GREEN;
weapons[W_SPREADSHOT].imageIndex[1] = SP_PLASMA_RED;
// Sid's ion cannon like weapon
weapon[W_IONCANNON].id = WT_PLASMA;
weapon[W_IONCANNON].ammo[0] = 1;
weapon[W_IONCANNON].damage = 1;
weapon[W_IONCANNON].reload[0] = 2;
weapon[W_IONCANNON].speed = 10;
weapon[W_IONCANNON].flags = WF_DISABLE | WF_AIMED;
weapon[W_IONCANNON].imageIndex[0] = SP_ION;
weapon[W_IONCANNON].imageIndex[1] = SP_ION;
weapons[W_IONCANNON].id = WT_PLASMA;
weapons[W_IONCANNON].ammo[0] = 1;
weapons[W_IONCANNON].damage = 1;
weapons[W_IONCANNON].reload[0] = 2;
weapons[W_IONCANNON].speed = 10;
weapons[W_IONCANNON].flags = WF_DISABLE | WF_AIMED;
weapons[W_IONCANNON].imageIndex[0] = SP_ION;
weapons[W_IONCANNON].imageIndex[1] = SP_ION;
// Directional Shock Missile - Used by Kline in final battle
weapon[W_DIRSHOCKMISSILE].id = WT_ROCKET;
weapon[W_DIRSHOCKMISSILE].ammo[0] = 5;
weapon[W_DIRSHOCKMISSILE].damage = 20;
weapon[W_DIRSHOCKMISSILE].reload[0] = 60;
weapon[W_DIRSHOCKMISSILE].speed = 0;
weapon[W_DIRSHOCKMISSILE].flags = WF_AIMED | WF_TIMEDEXPLOSION;
weapon[W_DIRSHOCKMISSILE].imageIndex[0] = SP_SMALL_EXPLOSION;
weapon[W_DIRSHOCKMISSILE].imageIndex[1] = SP_SMALL_EXPLOSION;
weapons[W_DIRSHOCKMISSILE].id = WT_ROCKET;
weapons[W_DIRSHOCKMISSILE].ammo[0] = 5;
weapons[W_DIRSHOCKMISSILE].damage = 20;
weapons[W_DIRSHOCKMISSILE].reload[0] = 60;
weapons[W_DIRSHOCKMISSILE].speed = 0;
weapons[W_DIRSHOCKMISSILE].flags = WF_AIMED | WF_TIMEDEXPLOSION;
weapons[W_DIRSHOCKMISSILE].imageIndex[0] = SP_SMALL_EXPLOSION;
weapons[W_DIRSHOCKMISSILE].imageIndex[1] = SP_SMALL_EXPLOSION;
}

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WEAPONS_H
#define WEAPONS_H
extern Object weapon[W_MAX];
extern Object weapons[W_MAX];
extern void initWeapons();