Use bitwise operations for flags.

This commit is contained in:
Guus Sliepen 2011-09-04 14:23:31 +02:00
parent 4d747db620
commit 8bbe48b4bd
7 changed files with 67 additions and 102 deletions

View File

@ -112,7 +112,7 @@ void setKlineAttackMethod(object *theEnemy)
{ {
theEnemy->maxShield -= 500; theEnemy->maxShield -= 500;
if (theEnemy->maxShield == 0) if (theEnemy->maxShield == 0)
theEnemy->flags -= FL_CANNOTDIE; theEnemy->flags &= ~FL_CANNOTDIE;
if (theEnemy->maxShield == 1000) if (theEnemy->maxShield == 1000)
{ {
@ -127,14 +127,14 @@ void setKlineAttackMethod(object *theEnemy)
theEnemy->weaponType[1] = W_DIRSHOCKMISSILE; theEnemy->weaponType[1] = W_DIRSHOCKMISSILE;
theEnemy->chance[0] = 2; theEnemy->chance[0] = 2;
theEnemy->chance[1] = 2; theEnemy->chance[1] = 2;
theEnemy->flags += FL_AIMS; theEnemy->flags |= FL_AIMS;
} }
else if (theEnemy->maxShield == 0) else if (theEnemy->maxShield == 0)
{ {
setRadioMessage(FACE_KLINE, "ENOUGH!! THIS ENDS NOW!!!", 1); setRadioMessage(FACE_KLINE, "ENOUGH!! THIS ENDS NOW!!!", 1);
theEnemy->weaponType[0] = W_AIMED_SHOT; theEnemy->weaponType[0] = W_AIMED_SHOT;
theEnemy->weaponType[1] = W_MICRO_HOMING_MISSILES; theEnemy->weaponType[1] = W_MICRO_HOMING_MISSILES;
theEnemy->flags += FL_CANCLOAK; theEnemy->flags |= FL_CANCLOAK;
theEnemy->chance[0] = 100; theEnemy->chance[0] = 100;
theEnemy->chance[1] = 2; theEnemy->chance[1] = 2;
} }
@ -152,8 +152,7 @@ void setKlineAI(object *theEnemy)
{ {
if (currentGame.area != 26) if (currentGame.area != 26)
{ {
if (theEnemy->flags & FL_AIMS) theEnemy->flags &= ~FL_AIMS;
theEnemy->flags -= FL_AIMS;
switch(rand() % 2) switch(rand() % 2)
{ {
@ -162,24 +161,19 @@ void setKlineAI(object *theEnemy)
break; break;
case 1: case 1:
theEnemy->weaponType[0] = W_AIMED_SHOT; theEnemy->weaponType[0] = W_AIMED_SHOT;
theEnemy->flags += FL_AIMS; theEnemy->flags |= FL_AIMS;
break; break;
} }
} }
} }
if (theEnemy->flags & FL_CIRCLES) theEnemy->flags &= ~(FL_CIRCLES | FL_CONTINUOUS_FIRE | FL_DROPMINES);
theEnemy->flags -= FL_CIRCLES;
if (theEnemy->flags & FL_CONTINUOUS_FIRE)
theEnemy->flags -= FL_CONTINUOUS_FIRE;
if (theEnemy->flags & FL_DROPMINES)
theEnemy->flags -= FL_DROPMINES;
switch(rand() % 10) switch(rand() % 10)
{ {
case 0: case 0:
if ((theEnemy->weaponType[0] != W_DIRSHOCKMISSILE) && (theEnemy->weaponType[1] != W_MICRO_HOMING_MISSILES)) if ((theEnemy->weaponType[0] != W_DIRSHOCKMISSILE) && (theEnemy->weaponType[1] != W_MICRO_HOMING_MISSILES))
theEnemy->flags += FL_CONTINUOUS_FIRE; theEnemy->flags |= FL_CONTINUOUS_FIRE;
theEnemy->dx = ((theEnemy->x - theEnemy->target->x) / ((300 / theEnemy->speed) + rand() % 100)); theEnemy->dx = ((theEnemy->x - theEnemy->target->x) / ((300 / theEnemy->speed) + rand() % 100));
theEnemy->dy = ((theEnemy->y - theEnemy->target->y) / ((300 / theEnemy->speed) + rand() % 100)); theEnemy->dy = ((theEnemy->y - theEnemy->target->y) / ((300 / theEnemy->speed) + rand() % 100));
break; break;
@ -187,11 +181,11 @@ void setKlineAI(object *theEnemy)
case 2: case 2:
// Kline only attacks then he is ready! // Kline only attacks then he is ready!
if ((!(theEnemy->flags & FL_NOFIRE)) && (currentGame.area == 11)) if ((!(theEnemy->flags & FL_NOFIRE)) && (currentGame.area == 11))
theEnemy->flags += FL_DROPMINES; theEnemy->flags |= FL_DROPMINES;
break; break;
case 3: case 3:
case 4: case 4:
theEnemy->flags += FL_CIRCLES; theEnemy->flags |= FL_CIRCLES;
break; break;
default: default:
setEnemyAI(theEnemy); setEnemyAI(theEnemy);

View File

@ -278,7 +278,7 @@ bool addAlien()
enemy[index].ammo[0] = 0; enemy[index].ammo[0] = 0;
if (currentGame.area == 18) if (currentGame.area == 18)
enemy[index].flags += FL_HASMINIMUMSPEED; enemy[index].flags |= FL_HASMINIMUMSPEED;
return true; return true;
} }
@ -351,7 +351,7 @@ static void getPreDefinedAliens()
{ {
enemy[index].active = false; enemy[index].active = false;
enemy[index].maxShield = enemy[index].shield = 400; enemy[index].maxShield = enemy[index].shield = 400;
enemy[index].flags -= FL_RUNSAWAY; enemy[index].flags &= ~FL_RUNSAWAY;
enemy[index].speed = 3; enemy[index].speed = 3;
} }
@ -375,11 +375,11 @@ static void getPreDefinedAliens()
if ((currentGame.area == 17) && (enemy[index].classDef == CD_BOSS)) if ((currentGame.area == 17) && (enemy[index].classDef == CD_BOSS))
{ {
enemy[index].imageIndex[1] = 29; enemy[index].imageIndex[1] = 29;
enemy[index].flags += FL_IMMORTAL; enemy[index].flags |= FL_IMMORTAL;
} }
if (currentGame.area == 18) if (currentGame.area == 18)
enemy[index].flags += FL_HASMINIMUMSPEED; enemy[index].flags |= FL_HASMINIMUMSPEED;
if (currentGame.area == 23) if (currentGame.area == 23)
{ {
@ -492,7 +492,7 @@ static void addFriendly(int type)
// For the sake of it being the final battle :) // For the sake of it being the final battle :)
if (currentGame.area == 25) if (currentGame.area == 25)
enemy[type].flags += FL_IMMORTAL; enemy[type].flags |= FL_IMMORTAL;
} }
void setTarget(int index) void setTarget(int index)
@ -594,9 +594,7 @@ void initAliens()
if (currentGame.area == 26) if (currentGame.area == 26)
{ {
enemy[WC_KLINE].flags += FL_IMMORTAL; enemy[WC_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE | FL_NOMOVE;
enemy[WC_KLINE].flags += FL_NOFIRE;
enemy[WC_KLINE].flags += FL_NOMOVE;
enemy[WC_KLINE].x = 600; enemy[WC_KLINE].x = 600;
enemy[WC_KLINE].y = 300; enemy[WC_KLINE].y = 300;
@ -980,7 +978,7 @@ void doAliens()
} }
else else
{ {
theEnemy->flags -= FL_IMMORTAL; theEnemy->flags &= ~FL_IMMORTAL;
theEnemy->owner = theEnemy; theEnemy->owner = theEnemy;
theEnemy->chance[0] = 25; theEnemy->chance[0] = 25;
} }
@ -1463,7 +1461,7 @@ void defineAliens()
defEnemy[CD_FRIGATE_WING1].collectChance = 100; defEnemy[CD_FRIGATE_WING1].collectChance = 100;
defEnemy[CD_FRIGATE_WING1].collectType = P_ANYTHING; defEnemy[CD_FRIGATE_WING1].collectType = P_ANYTHING;
defEnemy[CD_FRIGATE_WING1].collectValue = 250; defEnemy[CD_FRIGATE_WING1].collectValue = 250;
defEnemy[CD_FRIGATE_WING1].flags = FL_WEAPCO + FL_DAMAGEOWNER; defEnemy[CD_FRIGATE_WING1].flags = FL_WEAPCO | FL_DAMAGEOWNER;
defEnemy[CD_FRIGATE_WING2].classDef = CD_FRIGATE_WING2; defEnemy[CD_FRIGATE_WING2].classDef = CD_FRIGATE_WING2;
defEnemy[CD_FRIGATE_WING2].AIType = AI_NORMAL; defEnemy[CD_FRIGATE_WING2].AIType = AI_NORMAL;
@ -1480,7 +1478,7 @@ void defineAliens()
defEnemy[CD_FRIGATE_WING2].collectChance = 100; defEnemy[CD_FRIGATE_WING2].collectChance = 100;
defEnemy[CD_FRIGATE_WING2].collectType = P_ANYTHING; defEnemy[CD_FRIGATE_WING2].collectType = P_ANYTHING;
defEnemy[CD_FRIGATE_WING2].collectValue = 250; defEnemy[CD_FRIGATE_WING2].collectValue = 250;
defEnemy[CD_FRIGATE_WING2].flags = FL_WEAPCO + FL_DAMAGEOWNER; defEnemy[CD_FRIGATE_WING2].flags = FL_WEAPCO | FL_DAMAGEOWNER;
// Transport ship // Transport ship
defEnemy[CD_TRANSPORTSHIP].classDef = CD_TRANSPORTSHIP; defEnemy[CD_TRANSPORTSHIP].classDef = CD_TRANSPORTSHIP;
@ -1498,7 +1496,7 @@ void defineAliens()
defEnemy[CD_TRANSPORTSHIP].collectChance = 100; defEnemy[CD_TRANSPORTSHIP].collectChance = 100;
defEnemy[CD_TRANSPORTSHIP].collectType = P_WEAPONS; defEnemy[CD_TRANSPORTSHIP].collectType = P_WEAPONS;
defEnemy[CD_TRANSPORTSHIP].collectValue = 30; defEnemy[CD_TRANSPORTSHIP].collectValue = 30;
defEnemy[CD_TRANSPORTSHIP].flags = FL_WEAPCO + FL_NOFIRE; defEnemy[CD_TRANSPORTSHIP].flags = FL_WEAPCO | FL_NOFIRE;
// Cargo ship // Cargo ship
defEnemy[CD_CARGOSHIP].classDef = CD_CARGOSHIP; defEnemy[CD_CARGOSHIP].classDef = CD_CARGOSHIP;
@ -1516,7 +1514,7 @@ void defineAliens()
defEnemy[CD_CARGOSHIP].collectChance = 50; defEnemy[CD_CARGOSHIP].collectChance = 50;
defEnemy[CD_CARGOSHIP].collectType = P_ANYTHING; defEnemy[CD_CARGOSHIP].collectType = P_ANYTHING;
defEnemy[CD_CARGOSHIP].collectValue = 100; defEnemy[CD_CARGOSHIP].collectValue = 100;
defEnemy[CD_CARGOSHIP].flags = FL_WEAPCO + FL_NOFIRE; defEnemy[CD_CARGOSHIP].flags = FL_WEAPCO | FL_NOFIRE;
// Weapco Miner // Weapco Miner
defEnemy[CD_MINER].classDef = CD_MINER; defEnemy[CD_MINER].classDef = CD_MINER;
@ -1534,7 +1532,7 @@ void defineAliens()
defEnemy[CD_MINER].collectChance = 100; defEnemy[CD_MINER].collectChance = 100;
defEnemy[CD_MINER].collectType = P_ANYTHING; defEnemy[CD_MINER].collectType = P_ANYTHING;
defEnemy[CD_MINER].collectValue = 30; defEnemy[CD_MINER].collectValue = 30;
defEnemy[CD_MINER].flags = FL_WEAPCO + FL_NOFIRE + FL_DROPMINES; defEnemy[CD_MINER].flags = FL_WEAPCO | FL_NOFIRE | FL_DROPMINES;
// Kline // Kline
defEnemy[CD_KLINE].classDef = CD_KLINE; defEnemy[CD_KLINE].classDef = CD_KLINE;
@ -1552,7 +1550,7 @@ void defineAliens()
defEnemy[CD_KLINE].collectChance = 0; defEnemy[CD_KLINE].collectChance = 0;
defEnemy[CD_KLINE].collectType = P_ANYTHING; defEnemy[CD_KLINE].collectType = P_ANYTHING;
defEnemy[CD_KLINE].collectValue = 0; defEnemy[CD_KLINE].collectValue = 0;
defEnemy[CD_KLINE].flags = FL_WEAPCO + FL_CANNOTDIE + FL_ALWAYSFACE + FL_CIRCLES; defEnemy[CD_KLINE].flags = FL_WEAPCO | FL_CANNOTDIE | FL_ALWAYSFACE | FL_CIRCLES;
// Aim Fighter // Aim Fighter
defEnemy[CD_AIMFIGHTER].classDef = CD_AIMFIGHTER; defEnemy[CD_AIMFIGHTER].classDef = CD_AIMFIGHTER;
@ -1570,7 +1568,7 @@ void defineAliens()
defEnemy[CD_AIMFIGHTER].collectChance = 75; defEnemy[CD_AIMFIGHTER].collectChance = 75;
defEnemy[CD_AIMFIGHTER].collectType = P_ANYTHING; defEnemy[CD_AIMFIGHTER].collectType = P_ANYTHING;
defEnemy[CD_AIMFIGHTER].collectValue = 100; defEnemy[CD_AIMFIGHTER].collectValue = 100;
defEnemy[CD_AIMFIGHTER].flags = FL_WEAPCO + FL_AIMS; defEnemy[CD_AIMFIGHTER].flags = FL_WEAPCO | FL_AIMS;
// Slave ship // Slave ship
defEnemy[CD_SLAVETRANSPORT].classDef = CD_SLAVETRANSPORT; defEnemy[CD_SLAVETRANSPORT].classDef = CD_SLAVETRANSPORT;
@ -1588,7 +1586,7 @@ void defineAliens()
defEnemy[CD_SLAVETRANSPORT].collectChance = 100; defEnemy[CD_SLAVETRANSPORT].collectChance = 100;
defEnemy[CD_SLAVETRANSPORT].collectType = P_SLAVES; defEnemy[CD_SLAVETRANSPORT].collectType = P_SLAVES;
defEnemy[CD_SLAVETRANSPORT].collectValue = 25; defEnemy[CD_SLAVETRANSPORT].collectValue = 25;
defEnemy[CD_SLAVETRANSPORT].flags = FL_WEAPCO + FL_NOFIRE; defEnemy[CD_SLAVETRANSPORT].flags = FL_WEAPCO | FL_NOFIRE;
// Good Transport // Good Transport
defEnemy[CD_GOODTRANSPORT].classDef = CD_GOODTRANSPORT; defEnemy[CD_GOODTRANSPORT].classDef = CD_GOODTRANSPORT;
@ -1606,7 +1604,7 @@ void defineAliens()
defEnemy[CD_GOODTRANSPORT].collectChance = 0; defEnemy[CD_GOODTRANSPORT].collectChance = 0;
defEnemy[CD_GOODTRANSPORT].collectType = P_ANYTHING; defEnemy[CD_GOODTRANSPORT].collectType = P_ANYTHING;
defEnemy[CD_GOODTRANSPORT].collectValue = 0; defEnemy[CD_GOODTRANSPORT].collectValue = 0;
defEnemy[CD_GOODTRANSPORT].flags = FL_FRIEND + FL_NOFIRE + FL_AIMS; defEnemy[CD_GOODTRANSPORT].flags = FL_FRIEND | FL_NOFIRE | FL_AIMS;
// Sid Wilson // Sid Wilson
defEnemy[CD_SID].classDef = CD_SID; defEnemy[CD_SID].classDef = CD_SID;
@ -1624,7 +1622,7 @@ void defineAliens()
defEnemy[CD_SID].collectChance = 0; defEnemy[CD_SID].collectChance = 0;
defEnemy[CD_SID].collectType = P_ANYTHING; defEnemy[CD_SID].collectType = P_ANYTHING;
defEnemy[CD_SID].collectValue = 0; defEnemy[CD_SID].collectValue = 0;
defEnemy[CD_SID].flags = FL_FRIEND + FL_AIMS; defEnemy[CD_SID].flags = FL_FRIEND | FL_AIMS;
// Mining Vessel Boss // Mining Vessel Boss
defEnemy[CD_MINEBOSS].classDef = CD_BOSS; defEnemy[CD_MINEBOSS].classDef = CD_BOSS;
@ -1642,7 +1640,7 @@ void defineAliens()
defEnemy[CD_MINEBOSS].collectChance = 100; defEnemy[CD_MINEBOSS].collectChance = 100;
defEnemy[CD_MINEBOSS].collectType = P_ANYTHING; defEnemy[CD_MINEBOSS].collectType = P_ANYTHING;
defEnemy[CD_MINEBOSS].collectValue = 255; defEnemy[CD_MINEBOSS].collectValue = 255;
defEnemy[CD_MINEBOSS].flags = FL_WEAPCO + FL_IMMORTAL; defEnemy[CD_MINEBOSS].flags = FL_WEAPCO | FL_IMMORTAL;
defEnemy[CD_BOSS2_WING1].classDef = CD_BOSS2_WING1; defEnemy[CD_BOSS2_WING1].classDef = CD_BOSS2_WING1;
defEnemy[CD_BOSS2_WING1].AIType = AI_NORMAL; defEnemy[CD_BOSS2_WING1].AIType = AI_NORMAL;
@ -1659,7 +1657,7 @@ void defineAliens()
defEnemy[CD_BOSS2_WING1].collectChance = 100; defEnemy[CD_BOSS2_WING1].collectChance = 100;
defEnemy[CD_BOSS2_WING1].collectType = P_ANYTHING; defEnemy[CD_BOSS2_WING1].collectType = P_ANYTHING;
defEnemy[CD_BOSS2_WING1].collectValue = 255; defEnemy[CD_BOSS2_WING1].collectValue = 255;
defEnemy[CD_BOSS2_WING1].flags = FL_WEAPCO + FL_DAMAGEOWNER; defEnemy[CD_BOSS2_WING1].flags = FL_WEAPCO | FL_DAMAGEOWNER;
defEnemy[CD_BOSS2_WING2].classDef = CD_BOSS2_WING2; defEnemy[CD_BOSS2_WING2].classDef = CD_BOSS2_WING2;
defEnemy[CD_BOSS2_WING2].AIType = AI_NORMAL; defEnemy[CD_BOSS2_WING2].AIType = AI_NORMAL;
@ -1676,7 +1674,7 @@ void defineAliens()
defEnemy[CD_BOSS2_WING2].collectChance = 100; defEnemy[CD_BOSS2_WING2].collectChance = 100;
defEnemy[CD_BOSS2_WING2].collectType = P_ANYTHING; defEnemy[CD_BOSS2_WING2].collectType = P_ANYTHING;
defEnemy[CD_BOSS2_WING2].collectValue = 255; defEnemy[CD_BOSS2_WING2].collectValue = 255;
defEnemy[CD_BOSS2_WING2].flags = FL_WEAPCO + FL_DEPLOYDRONES + FL_DAMAGEOWNER; defEnemy[CD_BOSS2_WING2].flags = FL_WEAPCO | FL_DEPLOYDRONES | FL_DAMAGEOWNER;
defEnemy[CD_BOSS2_WING3].classDef = CD_BOSS2_WING3; defEnemy[CD_BOSS2_WING3].classDef = CD_BOSS2_WING3;
defEnemy[CD_BOSS2_WING3].AIType = AI_NORMAL; defEnemy[CD_BOSS2_WING3].AIType = AI_NORMAL;
@ -1693,7 +1691,7 @@ void defineAliens()
defEnemy[CD_BOSS2_WING3].collectChance = 100; defEnemy[CD_BOSS2_WING3].collectChance = 100;
defEnemy[CD_BOSS2_WING3].collectType = P_ANYTHING; defEnemy[CD_BOSS2_WING3].collectType = P_ANYTHING;
defEnemy[CD_BOSS2_WING3].collectValue = 255; defEnemy[CD_BOSS2_WING3].collectValue = 255;
defEnemy[CD_BOSS2_WING3].flags = FL_WEAPCO + FL_DEPLOYDRONES + FL_DAMAGEOWNER; defEnemy[CD_BOSS2_WING3].flags = FL_WEAPCO | FL_DEPLOYDRONES | FL_DAMAGEOWNER;
defEnemy[CD_BOSS2_WING4].classDef = CD_BOSS2_WING4; defEnemy[CD_BOSS2_WING4].classDef = CD_BOSS2_WING4;
defEnemy[CD_BOSS2_WING4].AIType = AI_NORMAL; defEnemy[CD_BOSS2_WING4].AIType = AI_NORMAL;
@ -1710,7 +1708,7 @@ void defineAliens()
defEnemy[CD_BOSS2_WING4].collectChance = 100; defEnemy[CD_BOSS2_WING4].collectChance = 100;
defEnemy[CD_BOSS2_WING4].collectType = P_ANYTHING; defEnemy[CD_BOSS2_WING4].collectType = P_ANYTHING;
defEnemy[CD_BOSS2_WING4].collectValue = 255; defEnemy[CD_BOSS2_WING4].collectValue = 255;
defEnemy[CD_BOSS2_WING4].flags = FL_WEAPCO + FL_DAMAGEOWNER; defEnemy[CD_BOSS2_WING4].flags = FL_WEAPCO | FL_DAMAGEOWNER;
// Drone // Drone
defEnemy[CD_DRONE].classDef = CD_DRONE; defEnemy[CD_DRONE].classDef = CD_DRONE;
@ -1746,7 +1744,7 @@ void defineAliens()
defEnemy[CD_CLOAKFIGHTER].collectChance = 100; defEnemy[CD_CLOAKFIGHTER].collectChance = 100;
defEnemy[CD_CLOAKFIGHTER].collectType = P_CASH; defEnemy[CD_CLOAKFIGHTER].collectType = P_CASH;
defEnemy[CD_CLOAKFIGHTER].collectValue = 255; defEnemy[CD_CLOAKFIGHTER].collectValue = 255;
defEnemy[CD_CLOAKFIGHTER].flags = FL_WEAPCO + FL_CANCLOAK + FL_RUNSAWAY; defEnemy[CD_CLOAKFIGHTER].flags = FL_WEAPCO | FL_CANCLOAK | FL_RUNSAWAY;
// Evil Ursula // Evil Ursula
defEnemy[CD_EVILURSULA].classDef = CD_EVILURSULA; defEnemy[CD_EVILURSULA].classDef = CD_EVILURSULA;
@ -1782,7 +1780,7 @@ void defineAliens()
defEnemy[CD_KRASS].collectChance = 100; defEnemy[CD_KRASS].collectChance = 100;
defEnemy[CD_KRASS].collectType = P_ANYTHING; defEnemy[CD_KRASS].collectType = P_ANYTHING;
defEnemy[CD_KRASS].collectValue = 255; defEnemy[CD_KRASS].collectValue = 255;
defEnemy[CD_KRASS].flags = FL_FRIEND + FL_IMMORTAL; defEnemy[CD_KRASS].flags = FL_FRIEND | FL_IMMORTAL;
// Executive Transport // Executive Transport
defEnemy[CD_EXEC].classDef = CD_BOSS; defEnemy[CD_EXEC].classDef = CD_BOSS;
@ -1800,7 +1798,7 @@ void defineAliens()
defEnemy[CD_EXEC].collectChance = 0; defEnemy[CD_EXEC].collectChance = 0;
defEnemy[CD_EXEC].collectType = P_ANYTHING; defEnemy[CD_EXEC].collectType = P_ANYTHING;
defEnemy[CD_EXEC].collectValue = 0; defEnemy[CD_EXEC].collectValue = 0;
defEnemy[CD_EXEC].flags = FL_WEAPCO + FL_NOFIRE; defEnemy[CD_EXEC].flags = FL_WEAPCO | FL_NOFIRE;
// Asteroid // Asteroid
defEnemy[CD_ASTEROID].classDef = CD_ASTEROID; defEnemy[CD_ASTEROID].classDef = CD_ASTEROID;
@ -1925,7 +1923,7 @@ void defineAliens()
defEnemy[CD_BARRIER].collectChance = 100; defEnemy[CD_BARRIER].collectChance = 100;
defEnemy[CD_BARRIER].collectType = P_ANYTHING; defEnemy[CD_BARRIER].collectType = P_ANYTHING;
defEnemy[CD_BARRIER].collectValue = 25; defEnemy[CD_BARRIER].collectValue = 25;
defEnemy[CD_BARRIER].flags = FL_WEAPCO + FL_NOFIRE; defEnemy[CD_BARRIER].flags = FL_WEAPCO | FL_NOFIRE;
// Neptune Boss // Neptune Boss
defEnemy[CD_NEPTUNEBOSS].classDef = CD_NEPTUNEBOSS; defEnemy[CD_NEPTUNEBOSS].classDef = CD_NEPTUNEBOSS;
@ -1961,7 +1959,7 @@ void defineAliens()
defEnemy[CD_MOBILESHIELD].collectChance = 100; defEnemy[CD_MOBILESHIELD].collectChance = 100;
defEnemy[CD_MOBILESHIELD].collectType = P_ANYTHING; defEnemy[CD_MOBILESHIELD].collectType = P_ANYTHING;
defEnemy[CD_MOBILESHIELD].collectValue = 25; defEnemy[CD_MOBILESHIELD].collectValue = 25;
defEnemy[CD_MOBILESHIELD].flags = FL_WEAPCO + FL_NOFIRE; defEnemy[CD_MOBILESHIELD].flags = FL_WEAPCO | FL_NOFIRE;
// Firefly // Firefly
defEnemy[CD_FIREFLY].classDef = CD_FIREFLY; defEnemy[CD_FIREFLY].classDef = CD_FIREFLY;
@ -2015,7 +2013,7 @@ void defineAliens()
defEnemy[CD_URANUSBOSSWING1].collectChance = 100; defEnemy[CD_URANUSBOSSWING1].collectChance = 100;
defEnemy[CD_URANUSBOSSWING1].collectType = P_ANYTHING; defEnemy[CD_URANUSBOSSWING1].collectType = P_ANYTHING;
defEnemy[CD_URANUSBOSSWING1].collectValue = 250; defEnemy[CD_URANUSBOSSWING1].collectValue = 250;
defEnemy[CD_URANUSBOSSWING1].flags = FL_WEAPCO + FL_IMMORTAL; defEnemy[CD_URANUSBOSSWING1].flags = FL_WEAPCO | FL_IMMORTAL;
// Uranus Boss Wing 2 // Uranus Boss Wing 2
defEnemy[CD_URANUSBOSSWING2].classDef = CD_URANUSBOSSWING2; defEnemy[CD_URANUSBOSSWING2].classDef = CD_URANUSBOSSWING2;
@ -2033,7 +2031,7 @@ void defineAliens()
defEnemy[CD_URANUSBOSSWING2].collectChance = 100; defEnemy[CD_URANUSBOSSWING2].collectChance = 100;
defEnemy[CD_URANUSBOSSWING2].collectType = P_ANYTHING; defEnemy[CD_URANUSBOSSWING2].collectType = P_ANYTHING;
defEnemy[CD_URANUSBOSSWING2].collectValue = 250; defEnemy[CD_URANUSBOSSWING2].collectValue = 250;
defEnemy[CD_URANUSBOSSWING2].flags = FL_WEAPCO + FL_IMMORTAL; defEnemy[CD_URANUSBOSSWING2].flags = FL_WEAPCO | FL_IMMORTAL;
saveAliens(); saveAliens();
} }

View File

@ -71,9 +71,9 @@ void addBullet(object *theWeapon, object *attacker, int y, int dy)
} }
if (attacker->flags & FL_WEAPCO) if (attacker->flags & FL_WEAPCO)
bullet->flags += WF_WEAPCO; bullet->flags |= WF_WEAPCO;
else else
bullet->flags += WF_FRIEND; bullet->flags |= WF_FRIEND;
bullet->owner = attacker->owner; bullet->owner = attacker->owner;
@ -489,7 +489,7 @@ void fireRay(object *attacker)
attacker->ammo[0]--; attacker->ammo[0]--;
if (attacker->ammo[0] < 1) if (attacker->ammo[0] < 1)
attacker->flags -= FL_FIRERAY; attacker->flags &= ~FL_FIRERAY;
} }
/* /*
@ -630,9 +630,8 @@ void doBullets()
{ {
if (!(theEnemy->flags & FL_LEAVESECTOR)) if (!(theEnemy->flags & FL_LEAVESECTOR))
{ {
theEnemy->flags += FL_LEAVESECTOR; theEnemy->flags |= FL_LEAVESECTOR;
if (theEnemy->flags & FL_CIRCLES) theEnemy->flags &= ~FL_CIRCLES;
theEnemy->flags -= FL_CIRCLES;
if (currentGame.area == 11) if (currentGame.area == 11)
setRadioMessage(FACE_KLINE, "Seems I underestimated you, Bainfield! We'll meet again!", 1); setRadioMessage(FACE_KLINE, "Seems I underestimated you, Bainfield! We'll meet again!", 1);
else if (currentGame.area == 25) else if (currentGame.area == 25)
@ -648,8 +647,7 @@ void doBullets()
if ((theEnemy->flags & FL_RUNSAWAY) && ((rand() % 50) == 0)) if ((theEnemy->flags & FL_RUNSAWAY) && ((rand() % 50) == 0))
{ {
if (!(theEnemy->flags & FL_LEAVESECTOR)) theEnemy->flags |= FL_LEAVESECTOR;
theEnemy->flags += FL_LEAVESECTOR;
} }
if (bullet->id != WT_CHARGER) if (bullet->id != WT_CHARGER)

View File

@ -327,15 +327,9 @@ void doCollectables()
weapon[1].damage = 5; weapon[1].damage = 5;
weapon[1].reload[0] = 7; weapon[1].reload[0] = 7;
if (weapon[1].flags & WF_STRAIGHT) weapon[1].flags &= ~(WF_STRAIGHT | WF_THIN_SPREAD);
weapon[1].flags -= WF_STRAIGHT; weapon[1].flags |= WF_WIDE_SPREAD;
if (weapon[1].flags & WF_THIN_SPREAD)
weapon[1].flags -= WF_THIN_SPREAD;
if (!(weapon[1].flags & WF_WIDE_SPREAD))
weapon[1].flags += WF_WIDE_SPREAD;
sprintf(temp, "Picked up a Super Charge!!"); sprintf(temp, "Picked up a Super Charge!!");
if (player.ammo[0] < 50) if (player.ammo[0] < 50)

View File

@ -504,7 +504,7 @@ static char revealHiddenObjectives()
enemy[WC_KLINE].active = true; enemy[WC_KLINE].active = true;
enemy[WC_KLINE].x = player.x + 1000; enemy[WC_KLINE].x = player.x + 1000;
enemy[WC_KLINE].y = player.y; enemy[WC_KLINE].y = player.y;
enemy[WC_KLINE].flags += FL_IMMORTAL + FL_NOFIRE; enemy[WC_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE;
setTarget(WC_KLINE); setTarget(WC_KLINE);
loadMusic("music/TranceGeneration.mod"); loadMusic("music/TranceGeneration.mod");
Mix_PlayMusic(engine.music, -1); Mix_PlayMusic(engine.music, -1);

View File

@ -136,47 +136,32 @@ void doPlayer()
{ {
if (weapon[0].flags & WF_THIN_SPREAD) if (weapon[0].flags & WF_THIN_SPREAD)
{ {
weapon[0].flags -= WF_THIN_SPREAD; weapon[0].flags &= ~WF_THIN_SPREAD;
weapon[0].flags += WF_STRAIGHT; weapon[0].flags |= WF_STRAIGHT;
setInfoLine("Weapon set to Concentrate", FONT_WHITE); setInfoLine("Weapon set to Concentrate", FONT_WHITE);
} }
else else
{ {
weapon[0].flags -= WF_STRAIGHT; weapon[0].flags &= ~WF_STRAIGHT;
weapon[0].flags += WF_THIN_SPREAD; weapon[0].flags |= WF_THIN_SPREAD;
setInfoLine("Weapon set to Spread", FONT_WHITE); setInfoLine("Weapon set to Spread", FONT_WHITE);
} }
} }
} }
else else
{ {
if (weapon[1].ammo[0] == 3) if (weapon[1].ammo[0] == 3 || weapon[1].ammo[0] == 4)
{ {
if (weapon[1].flags & WF_THIN_SPREAD) if (weapon[1].flags & WF_THIN_SPREAD)
{ {
weapon[1].flags -= WF_THIN_SPREAD; weapon[1].flags &= ~WF_THIN_SPREAD;
weapon[1].flags += WF_STRAIGHT; weapon[1].flags |= WF_STRAIGHT;
setInfoLine("Weapon set to Concentrate", FONT_WHITE); setInfoLine("Weapon set to Concentrate", FONT_WHITE);
} }
else else
{ {
weapon[1].flags -= WF_STRAIGHT; weapon[1].flags &= ~WF_STRAIGHT;
weapon[1].flags += WF_THIN_SPREAD; weapon[1].flags |= WF_THIN_SPREAD;
setInfoLine("Weapon set to Spread", FONT_WHITE);
}
}
else if (weapon[1].ammo[0] == 4)
{
if (weapon[1].flags & WF_THIN_SPREAD)
{
weapon[1].flags -= WF_THIN_SPREAD;
weapon[1].flags += WF_STRAIGHT;
setInfoLine("Weapon set to Concentrate", FONT_WHITE);
}
else
{
weapon[1].flags -= WF_STRAIGHT;
weapon[1].flags += WF_THIN_SPREAD;
setInfoLine("Weapon set to Spread", FONT_WHITE); setInfoLine("Weapon set to Spread", FONT_WHITE);
} }
} }
@ -184,18 +169,14 @@ void doPlayer()
{ {
if (weapon[1].flags & WF_WIDE_SPREAD) if (weapon[1].flags & WF_WIDE_SPREAD)
{ {
if (weapon[1].flags & WF_THIN_SPREAD) weapon[1].flags &= ~(WF_THIN_SPREAD | WF_WIDE_SPREAD);
weapon[1].flags -= WF_THIN_SPREAD; weapon[1].flags |= WF_STRAIGHT;
weapon[1].flags -= WF_WIDE_SPREAD;
weapon[1].flags += WF_STRAIGHT;
setInfoLine("Weapon set to Concentrate", FONT_WHITE); setInfoLine("Weapon set to Concentrate", FONT_WHITE);
} }
else else
{ {
if (weapon[1].flags & WF_THIN_SPREAD) weapon[1].flags &= (WF_THIN_SPREAD | WF_STRAIGHT);
weapon[1].flags -= WF_THIN_SPREAD; weapon[1].flags |= WF_WIDE_SPREAD;
weapon[1].flags -= WF_STRAIGHT;
weapon[1].flags += WF_WIDE_SPREAD;
setInfoLine("Weapon set to Spread", FONT_WHITE); setInfoLine("Weapon set to Spread", FONT_WHITE);
} }
} }
@ -308,7 +289,7 @@ void doPlayer()
if (currentGame.area == 18) if (currentGame.area == 18)
{ {
for (int i = 0 ; i < MAX_ALIENS ; i++) for (int i = 0 ; i < MAX_ALIENS ; i++)
enemy[i].flags += FL_LEAVESECTOR; enemy[i].flags |= FL_LEAVESECTOR;
} }
playSound(SFX_DEATH); playSound(SFX_DEATH);

View File

@ -158,7 +158,7 @@ void initWeapons()
weapon[W_MICRO_ROCKETS].damage = 3; weapon[W_MICRO_ROCKETS].damage = 3;
weapon[W_MICRO_ROCKETS].reload[0] = 30; weapon[W_MICRO_ROCKETS].reload[0] = 30;
weapon[W_MICRO_ROCKETS].speed = 15; weapon[W_MICRO_ROCKETS].speed = 15;
weapon[W_MICRO_ROCKETS].flags = WF_STRAIGHT + WF_VARIABLE_SPEED; weapon[W_MICRO_ROCKETS].flags = WF_STRAIGHT | WF_VARIABLE_SPEED;
weapon[W_MICRO_ROCKETS].imageIndex[0] = 2; weapon[W_MICRO_ROCKETS].imageIndex[0] = 2;
weapon[W_MICRO_ROCKETS].imageIndex[1] = 3; weapon[W_MICRO_ROCKETS].imageIndex[1] = 3;
@ -196,7 +196,7 @@ void initWeapons()
weapon[W_HOMING_MISSILE].damage = 15; weapon[W_HOMING_MISSILE].damage = 15;
weapon[W_HOMING_MISSILE].reload[0] = 35; weapon[W_HOMING_MISSILE].reload[0] = 35;
weapon[W_HOMING_MISSILE].speed = 10; weapon[W_HOMING_MISSILE].speed = 10;
weapon[W_HOMING_MISSILE].flags = WF_STRAIGHT + WF_HOMING; weapon[W_HOMING_MISSILE].flags = WF_STRAIGHT | WF_HOMING;
weapon[W_HOMING_MISSILE].imageIndex[0] = 4; weapon[W_HOMING_MISSILE].imageIndex[0] = 4;
weapon[W_HOMING_MISSILE].imageIndex[1] = 4; weapon[W_HOMING_MISSILE].imageIndex[1] = 4;
@ -213,7 +213,7 @@ void initWeapons()
weapon[W_MICRO_HOMING_MISSILES].damage = 12; weapon[W_MICRO_HOMING_MISSILES].damage = 12;
weapon[W_MICRO_HOMING_MISSILES].reload[0] = 65; weapon[W_MICRO_HOMING_MISSILES].reload[0] = 65;
weapon[W_MICRO_HOMING_MISSILES].speed = 3; weapon[W_MICRO_HOMING_MISSILES].speed = 3;
weapon[W_MICRO_HOMING_MISSILES].flags = WF_STRAIGHT + WF_HOMING; weapon[W_MICRO_HOMING_MISSILES].flags = WF_STRAIGHT | WF_HOMING;
weapon[W_MICRO_HOMING_MISSILES].imageIndex[0] = 4; weapon[W_MICRO_HOMING_MISSILES].imageIndex[0] = 4;
weapon[W_MICRO_HOMING_MISSILES].imageIndex[1] = 4; weapon[W_MICRO_HOMING_MISSILES].imageIndex[1] = 4;
@ -223,7 +223,7 @@ void initWeapons()
weapon[W_AIMED_SHOT].damage = 2; weapon[W_AIMED_SHOT].damage = 2;
weapon[W_AIMED_SHOT].reload[0] = 15; weapon[W_AIMED_SHOT].reload[0] = 15;
weapon[W_AIMED_SHOT].speed = 0; weapon[W_AIMED_SHOT].speed = 0;
weapon[W_AIMED_SHOT].flags = WF_STRAIGHT + WF_AIMED; weapon[W_AIMED_SHOT].flags = WF_STRAIGHT | WF_AIMED;
weapon[W_AIMED_SHOT].imageIndex[0] = 33; weapon[W_AIMED_SHOT].imageIndex[0] = 33;
weapon[W_AIMED_SHOT].imageIndex[1] = 34; weapon[W_AIMED_SHOT].imageIndex[1] = 34;
@ -243,7 +243,7 @@ void initWeapons()
weapon[W_IONCANNON].damage = 1; weapon[W_IONCANNON].damage = 1;
weapon[W_IONCANNON].reload[0] = 2; weapon[W_IONCANNON].reload[0] = 2;
weapon[W_IONCANNON].speed = 10; weapon[W_IONCANNON].speed = 10;
weapon[W_IONCANNON].flags = WF_STRAIGHT + WF_DISABLE + WF_AIMED; weapon[W_IONCANNON].flags = WF_STRAIGHT | WF_DISABLE | WF_AIMED;
weapon[W_IONCANNON].imageIndex[0] = 35; weapon[W_IONCANNON].imageIndex[0] = 35;
weapon[W_IONCANNON].imageIndex[1] = 35; weapon[W_IONCANNON].imageIndex[1] = 35;
@ -253,7 +253,7 @@ void initWeapons()
weapon[W_DIRSHOCKMISSILE].damage = 20; weapon[W_DIRSHOCKMISSILE].damage = 20;
weapon[W_DIRSHOCKMISSILE].reload[0] = 60; weapon[W_DIRSHOCKMISSILE].reload[0] = 60;
weapon[W_DIRSHOCKMISSILE].speed = 0; weapon[W_DIRSHOCKMISSILE].speed = 0;
weapon[W_DIRSHOCKMISSILE].flags = WF_STRAIGHT + WF_AIMED + WF_TIMEDEXPLOSION; weapon[W_DIRSHOCKMISSILE].flags = WF_STRAIGHT | WF_AIMED | WF_TIMEDEXPLOSION;
weapon[W_DIRSHOCKMISSILE].imageIndex[0] = 4; weapon[W_DIRSHOCKMISSILE].imageIndex[0] = 4;
weapon[W_DIRSHOCKMISSILE].imageIndex[1] = 4; weapon[W_DIRSHOCKMISSILE].imageIndex[1] = 4;