1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 22:25:46 +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()
{
disabledDamageTypes.reset();
disabledDamageTypes.clear();
}
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)
@ -1640,17 +1643,17 @@ void Entity::setAllDamageTargets(bool v)
else
{
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++)
disabledDamageTypes.set(DamageType(i));
disabledDamageTypes.insert(DamageType(i));
for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++)
disabledDamageTypes.set(DamageType(i));
disabledDamageTypes.insert(DamageType(i));
}
}
bool Entity::isDamageTarget(DamageType dt)
{
return disabledDamageTypes.test(dt);
return disabledDamageTypes.find(dt) == disabledDamageTypes.end();
}
float Entity::getHealthPerc()

View file

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

View file

@ -6297,9 +6297,9 @@ luaFunc(entity_getNearestEntity)
Entity *e = *i;
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))
{