1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-27 07:06:00 +00:00

Revert "Changed a bunch of enums in Entity.h"

This reverts commit 8b67ece907.
This commit is contained in:
fgenesis 2012-12-15 22:46:39 +01:00
parent 0f13f08357
commit ad4bc9bd21
3 changed files with 72 additions and 71 deletions

View file

@ -1614,12 +1614,15 @@ void Entity::moveOutOfWall()
void Entity::clearDamageTargets() void Entity::clearDamageTargets()
{ {
disabledDamageTypes.reset(); disabledDamageTypes.clear();
} }
void Entity::setDamageTarget(DamageType dt, bool v) void Entity::setDamageTarget(DamageType dt, bool v)
{ {
disabledDamageTypes.set(dt, !v); if (v)
disabledDamageTypes.erase(dt);
else
disabledDamageTypes.insert(dt);
} }
void Entity::setEatType(EatType et, const std::string &file) void Entity::setEatType(EatType et, const std::string &file)
@ -1640,17 +1643,17 @@ void Entity::setAllDamageTargets(bool v)
else else
{ {
for (int i = DT_ENEMY; i < DT_ENEMY_REALMAX; i++) for (int i = DT_ENEMY; i < DT_ENEMY_REALMAX; i++)
disabledDamageTypes.set(DamageType(i)); disabledDamageTypes.insert(DamageType(i));
for (int i = DT_AVATAR; i < DT_AVATAR_REALMAX; i++) for (int i = DT_AVATAR; i < DT_AVATAR_REALMAX; i++)
disabledDamageTypes.set(DamageType(i)); disabledDamageTypes.insert(DamageType(i));
for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++) for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++)
disabledDamageTypes.set(DamageType(i)); disabledDamageTypes.insert(DamageType(i));
} }
} }
bool Entity::isDamageTarget(DamageType dt) bool Entity::isDamageTarget(DamageType dt)
{ {
return disabledDamageTypes.test(dt); return disabledDamageTypes.find(dt) == disabledDamageTypes.end();
} }
float Entity::getHealthPerc() float Entity::getHealthPerc()

View file

@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef ENTITY_H #ifndef ENTITY_H
#define ENTITY_H #define ENTITY_H
#include <bitset>
#include "../BBGE/StateMachine.h" #include "../BBGE/StateMachine.h"
#include "../ExternalLibs/tinyxml.h" #include "../ExternalLibs/tinyxml.h"
#include "../BBGE/SkeletalSprite.h" #include "../BBGE/SkeletalSprite.h"
@ -77,70 +75,70 @@ enum EV
enum DamageType enum DamageType
{ {
DT_NONE, DT_NONE = -1,
DT_ENEMY, DT_ENEMY = 0,
DT_ENEMY_ENERGYBLAST, DT_ENEMY_ENERGYBLAST = 1,
DT_ENEMY_SHOCK, DT_ENEMY_SHOCK = 2,
DT_ENEMY_BITE, DT_ENEMY_BITE = 3,
DT_ENEMY_TRAP, DT_ENEMY_TRAP = 4,
DT_ENEMY_WEB, DT_ENEMY_WEB = 5,
DT_ENEMY_BEAM, DT_ENEMY_BEAM = 6,
DT_ENEMY_GAS, DT_ENEMY_GAS = 7,
DT_ENEMY_INK, DT_ENEMY_INK = 8,
DT_ENEMY_POISON, DT_ENEMY_POISON = 9,
DT_ENEMY_ACTIVEPOISON, DT_ENEMY_ACTIVEPOISON = 10,
DT_ENEMY_CREATOR, DT_ENEMY_CREATOR = 11,
DT_ENEMY_MANTISBOMB, DT_ENEMY_MANTISBOMB = 12,
DT_ENEMY_REALMAX , DT_ENEMY_REALMAX ,
DT_ENEMY_MAX, DT_ENEMY_MAX = 13,
DT_AVATAR, DT_AVATAR = 1000,
DT_AVATAR_ENERGYBLAST, DT_AVATAR_ENERGYBLAST = 1001,
DT_AVATAR_SHOCK, DT_AVATAR_SHOCK = 1002,
DT_AVATAR_BITE, DT_AVATAR_BITE = 1003,
DT_AVATAR_VOMIT, DT_AVATAR_VOMIT = 1004,
DT_AVATAR_ACID, DT_AVATAR_ACID = 1005,
DT_AVATAR_SPORECHILD, DT_AVATAR_SPORECHILD = 1006,
DT_AVATAR_LIZAP, DT_AVATAR_LIZAP = 1007,
DT_AVATAR_NATURE, DT_AVATAR_NATURE = 1008,
DT_AVATAR_ENERGYROLL, DT_AVATAR_ENERGYROLL = 1009,
DT_AVATAR_VINE, DT_AVATAR_VINE = 1010,
DT_AVATAR_EAT, DT_AVATAR_EAT = 1011,
DT_AVATAR_EAT_BASICSHOT, DT_AVATAR_EAT_BASICSHOT = 1011,
DT_AVATAR_EAT_MAX, DT_AVATAR_EAT_MAX = 1012,
DT_AVATAR_LANCEATTACH, DT_AVATAR_LANCEATTACH = 1013,
DT_AVATAR_LANCE, DT_AVATAR_LANCE = 1014,
DT_AVATAR_CREATORSHOT, DT_AVATAR_CREATORSHOT = 1015,
DT_AVATAR_DUALFORMLI, DT_AVATAR_DUALFORMLI = 1016,
DT_AVATAR_DUALFORMNAIJA, DT_AVATAR_DUALFORMNAIJA = 1017,
DT_AVATAR_BUBBLE, DT_AVATAR_BUBBLE = 1018,
DT_AVATAR_SEED, DT_AVATAR_SEED = 1019,
DT_AVATAR_PET, DT_AVATAR_PET = 1020,
DT_AVATAR_PETNAUTILUS, DT_AVATAR_PETNAUTILUS = 1021,
DT_AVATAR_PETBITE, DT_AVATAR_PETBITE = 1022,
DT_AVATAR_REALMAX , DT_AVATAR_REALMAX ,
DT_AVATAR_MAX, DT_AVATAR_MAX = 1030,
DT_TOUCH, DT_TOUCH = 1031,
DT_CRUSH, DT_CRUSH = 1032,
DT_SPIKES, DT_SPIKES = 1033,
DT_STEAM, DT_STEAM = 1034,
DT_REALMAX DT_REALMAX
}; };
enum EatType enum EatType
{ {
EAT_NONE, EAT_NONE = -1,
EAT_DEFAULT, EAT_DEFAULT = 0,
EAT_FILE, EAT_FILE = 1,
EAT_MAX EAT_MAX
}; };
enum ObsCheck enum ObsCheck
{ {
OBSCHECK_RANGE, OBSCHECK_RANGE = 0,
OBSCHECK_4DIR, OBSCHECK_4DIR = 1,
OBSCHECK_DOWN, OBSCHECK_DOWN = 2,
OBSCHECK_8DIR, OBSCHECK_8DIR = 3
}; };
class Shot; class Shot;
@ -171,13 +169,13 @@ struct DamageData
enum EntityType enum EntityType
{ {
ET_NOTYPE, ET_NOTYPE =-1,
ET_AVATAR, ET_AVATAR =0,
ET_ENEMY, ET_ENEMY =1,
ET_PET, ET_PET =2,
ET_FLOCK, ET_FLOCK =3,
ET_NEUTRAL, ET_NEUTRAL =4,
ET_INGREDIENT, ET_INGREDIENT =5
}; };
enum EntityProperty enum EntityProperty
@ -404,7 +402,7 @@ public:
void setDamageTarget(DamageType dt, bool v); void setDamageTarget(DamageType dt, bool v);
bool isDamageTarget(DamageType dt); bool isDamageTarget(DamageType dt);
typedef std::bitset<DT_REALMAX> DisabledDamageTypes; typedef std::set<DamageType> DisabledDamageTypes;
int targetRange; int targetRange;
int getTargetRange() { return targetRange; } int getTargetRange() { return targetRange; }

View file

@ -6297,9 +6297,9 @@ luaFunc(entity_getNearestEntity)
Entity *e = *i; Entity *e = *i;
if (e != me && e != ignore && e->isPresent() && e->isNormalLayer()) if (e != me && e != ignore && e->isPresent() && e->isNormalLayer())
{ {
if (type == ET_NOTYPE || e->getEntityType() == type) if (type == 0 || e->getEntityType() == type)
{ {
if (damageTarget == DT_NONE || e->isDamageTarget((DamageType)damageTarget)) if (damageTarget == 0 || e->isDamageTarget((DamageType)damageTarget))
{ {
if (!name || ((nocasecmp(e->name, name)==0) == nameCheck)) if (!name || ((nocasecmp(e->name, name)==0) == nameCheck))
{ {