Removed missiles types. Now only homing missiles, and rockets for bombers.

This commit is contained in:
Steve 2015-11-21 23:45:22 +00:00
parent 94e0259953
commit 597f6f5cb7
27 changed files with 52 additions and 101 deletions

View File

@ -59,8 +59,5 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -18,8 +18,5 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 2
}
"missiles" : 2
}

View File

@ -24,8 +24,5 @@
}
],
"combinedGuns" : 1,
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 3
}
"missiles" : 3
}

View File

@ -16,11 +16,13 @@
"type" : "BT_PLASMA",
"x" : 12,
"y" : 0
},
{
"type" : "BT_ROCKET",
"x" : 0,
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 60
},
"missiles" : 6,
"aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE"
}

View File

@ -28,8 +28,5 @@
"y" : -12
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -28,8 +28,5 @@
"y" : -12
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -18,8 +18,5 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 3
}
"missiles" : 3
}

View File

@ -21,11 +21,13 @@
"type" : "BT_PLASMA",
"x" : 0,
"y" : 0
},
{
"type" : "BT_ROCKET",
"x" : 0,
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 80
},
"missiles" : 8,
"aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE"
}

View File

@ -28,8 +28,5 @@
"y" : -12
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -23,8 +23,5 @@
"y" : -16
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 3
}
"missiles" : 3
}

View File

@ -29,8 +29,5 @@
}
],
"combinedGuns" : 1,
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 6
}
"missiles" : 6
}

View File

@ -18,8 +18,5 @@
"y" : -2
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 3
}
"missiles" : 3
}

View File

@ -28,8 +28,5 @@
"y" : -12
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -28,8 +28,5 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -23,9 +23,6 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 8
},
"missiles" : 8,
"aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE"
}

View File

@ -18,8 +18,5 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 2
}
"missiles" : 2
}

View File

@ -28,8 +28,5 @@
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 2
}
"missiles" : 2
}

View File

@ -18,8 +18,5 @@
"y" : -12
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -34,8 +34,5 @@
}
],
"combinedGuns" : 1,
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 4
}
"missiles" : 4
}

View File

@ -375,11 +375,11 @@ static void preAttack(void)
/* force weapon selection, otherwise we'll keep using lasers / mag */
canAttack(self->target);
if (self->guns[0].type && (self->missiles.ammo == 0 || rand() % 50 > 0))
if (self->guns[0].type && (self->missiles == 0 || rand() % 50 > 0))
{
fireGuns(self);
}
else if (self->missiles.ammo)
else if (self->missiles)
{
fireMissile(self);
}

View File

@ -73,7 +73,11 @@ void doBullets(void)
b->x += b->dx;
b->y += b->dy;
if (b->type == BT_MISSILE)
if (b->type == BT_ROCKET)
{
addMissileEngineEffect(b);
}
else if (b->type == BT_MISSILE)
{
addMissileEngineEffect(b);
@ -315,15 +319,24 @@ void fireGuns(Entity *owner)
playBattleSound(b->sound, owner->x, owner->y);
}
void fireRocket(Entity *owner)
{
Bullet *b;
b = createBullet(BT_ROCKET, owner->x, owner->y, owner);
playBattleSound(b->sound, owner->x, owner->y);
}
void fireMissile(Entity *owner)
{
Bullet *b;
b = createBullet(BT_ROCKET + owner->missiles.type, owner->x, owner->y, owner);
b = createBullet(BT_MISSILE, owner->x, owner->y, owner);
b->life = FPS * 30;
owner->missiles.ammo--;
owner->missiles--;
if (owner == player)
{

View File

@ -116,7 +116,7 @@ static void randomizeDart(Entity *dart)
randomizeDartGuns(dart);
dart->missiles.ammo = rand() % 3;
dart->missiles = rand() % 3;
sprintf(textureName, "gfx/fighters/dart0%d.png", 1 + rand() % 7);
@ -666,10 +666,7 @@ static void loadFighterDef(char *filename)
if (cJSON_GetObjectItem(root, "missiles"))
{
node = cJSON_GetObjectItem(root, "missiles");
f->missiles.type = lookup(cJSON_GetObjectItem(node, "type")->valuestring);
f->missiles.ammo = f->missiles.maxAmmo = cJSON_GetObjectItem(node, "ammo")->valueint;
f->missiles = cJSON_GetObjectItem(root, "missiles")->valueint;
}
if (cJSON_GetObjectItem(root, "flags"))

View File

@ -259,7 +259,7 @@ static void drawBoostECMBar(int current, int max, int x, int y, int r, int g, in
static void drawWeaponInfo(void)
{
drawText(10, 70, 14, TA_LEFT, colors.white, (player->selectedGunType != -1) ? gunName[player->selectedGunType] : "(None)");
drawText(260, 70, 14, TA_RIGHT, colors.white, "Missiles (%d)", player->missiles.ammo);
drawText(260, 70, 14, TA_RIGHT, colors.white, "Missiles (%d)", player->missiles);
}
static void drawPlayerTargeter(void)

View File

@ -113,7 +113,7 @@ void doPlayer(void)
app.keyboard[SDL_SCANCODE_LSHIFT] = 0;
}
if (app.keyboard[SDL_SCANCODE_RETURN] && player->missiles.ammo && player->target)
if (app.keyboard[SDL_SCANCODE_RETURN] && player->missiles && player->target)
{
if (getDistance(player->x, player->y, player->target->x, player->target->y) <= SCREEN_WIDTH)
{

View File

@ -140,14 +140,6 @@ enum
BT_MAX
};
enum
{
MISSILE_ROCKET,
MISSILE_MISSILE,
MISSILE_FF,
MISSILE_MAX
};
enum
{
EFFECT_LINE,

View File

@ -106,7 +106,7 @@ struct Entity {
int aiAggression;
int separationRadius;
Weapon guns[MAX_FIGHTER_GUNS];
Weapon missiles;
int missiles;
long flags;
long aiFlags;
SDL_Point targetLocation;

View File

@ -90,10 +90,6 @@ void initLookups(void)
addLookup("BF_SHIELD_DAMAGE", BF_SHIELD_DAMAGE);
addLookup("BF_EXPLODES", BF_EXPLODES);
addLookup("MISSILE_ROCKET", MISSILE_ROCKET);
addLookup("MISSILE_MISSILE", MISSILE_MISSILE);
addLookup("MISSILE_FF", MISSILE_FF);
addLookup("CHALLENGE_ARMOUR", CHALLENGE_ARMOUR);
addLookup("CHALLENGE_TIME", CHALLENGE_TIME);
addLookup("CHALLENGE_ACCURACY", CHALLENGE_ACCURACY);