mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 17:42:05 +00:00
Merge branch 'experimental' into tile-optimization
# Conflicts: # Aquaria/ScriptInterface.cpp # BBGE/AfterEffect.cpp # BBGE/RenderGrid.cpp # BBGE/SkeletalSprite.cpp
This commit is contained in:
commit
d33e8f9116
17 changed files with 458 additions and 199 deletions
|
@ -209,6 +209,18 @@ void AnimationEditor::resetScaleOrSave()
|
||||||
|
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
saveFile();
|
saveFile();
|
||||||
|
else if(core->getAltState() && editingBone)
|
||||||
|
{
|
||||||
|
Vector scale(1,1);
|
||||||
|
Bone *b = editingBone;
|
||||||
|
do
|
||||||
|
scale *= b->scale;
|
||||||
|
while( (b = dynamic_cast<Bone*>(b->getParent())) ); // don't want to get entity scale; that's what the anim editor uses for zooming
|
||||||
|
std::ostringstream os;
|
||||||
|
os << scale.x;
|
||||||
|
if(!SDL_SetClipboardText(os.str().c_str()))
|
||||||
|
dsq->screenMessage("Scale copied to clipboard");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
editSprite->scale = Vector(1,1);
|
editSprite->scale = Vector(1,1);
|
||||||
}
|
}
|
||||||
|
@ -739,10 +751,16 @@ void AnimationEditor::update(float dt)
|
||||||
float spd = 1.0f;
|
float spd = 1.0f;
|
||||||
if (core->mouse.scrollWheelChange < 0)
|
if (core->mouse.scrollWheelChange < 0)
|
||||||
{
|
{
|
||||||
|
if(splinegrid && core->getShiftState())
|
||||||
|
splinegrid->setPointScale(std::max(splinegrid->getPointScale() / 1.12f, 0.05f));
|
||||||
|
else
|
||||||
ctrlSprite->scale.x /= 1.12f;
|
ctrlSprite->scale.x /= 1.12f;
|
||||||
}
|
}
|
||||||
else if (core->mouse.scrollWheelChange > 0)
|
else if (core->mouse.scrollWheelChange > 0)
|
||||||
{
|
{
|
||||||
|
if(splinegrid && core->getShiftState())
|
||||||
|
splinegrid->setPointScale(splinegrid->getPointScale() * 1.12f);
|
||||||
|
else
|
||||||
ctrlSprite->scale.x *= 1.12f;
|
ctrlSprite->scale.x *= 1.12f;
|
||||||
}
|
}
|
||||||
if (core->getKeyState(KEY_PGDN) && core->getShiftState())
|
if (core->getKeyState(KEY_PGDN) && core->getShiftState())
|
||||||
|
@ -768,6 +786,21 @@ void AnimationEditor::update(float dt)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (editingBone)
|
||||||
|
{
|
||||||
|
float m = 0.2f;
|
||||||
|
if(core->getKeyState(KEY_NUMPADSLASH))
|
||||||
|
{
|
||||||
|
editingBone->originalScale /= (1 + m*dt);
|
||||||
|
editingBone->scale = editingBone->originalScale;
|
||||||
|
}
|
||||||
|
if(core->getKeyState(KEY_NUMPADSTAR))
|
||||||
|
{
|
||||||
|
editingBone->originalScale *= (1 + m*dt);
|
||||||
|
editingBone->scale = editingBone->originalScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (editingBone && boneEdit == 1 && !splinegrid)
|
if (editingBone && boneEdit == 1 && !splinegrid)
|
||||||
{
|
{
|
||||||
Vector add = core->mouse.change;
|
Vector add = core->mouse.change;
|
||||||
|
|
|
@ -3063,11 +3063,6 @@ void Avatar::setBlockSinging(bool v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Avatar::canSetBoneLock()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Avatar::onSetBoneLock()
|
void Avatar::onSetBoneLock()
|
||||||
{
|
{
|
||||||
Entity::onSetBoneLock();
|
Entity::onSetBoneLock();
|
||||||
|
|
|
@ -300,8 +300,6 @@ public:
|
||||||
Web *web;
|
Web *web;
|
||||||
float rollDelay;
|
float rollDelay;
|
||||||
|
|
||||||
bool canSetBoneLock() OVERRIDE;
|
|
||||||
|
|
||||||
void revert();
|
void revert();
|
||||||
void doBindSong();
|
void doBindSong();
|
||||||
void doShieldSong();
|
void doShieldSong();
|
||||||
|
|
|
@ -29,6 +29,7 @@ SET(AQUARIA_SRCS
|
||||||
FlockEntity.h
|
FlockEntity.h
|
||||||
Game.cpp
|
Game.cpp
|
||||||
Game.h
|
Game.h
|
||||||
|
GameEnums.cpp
|
||||||
GameEnums.h
|
GameEnums.h
|
||||||
GameplayVariables.cpp
|
GameplayVariables.cpp
|
||||||
GameStructs.cpp
|
GameStructs.cpp
|
||||||
|
@ -57,7 +58,6 @@ SET(AQUARIA_SRCS
|
||||||
ModSelector.h
|
ModSelector.h
|
||||||
Network.cpp
|
Network.cpp
|
||||||
Network.h
|
Network.h
|
||||||
NotEntities.h
|
|
||||||
ParticleEditor.cpp
|
ParticleEditor.cpp
|
||||||
Path.cpp
|
Path.cpp
|
||||||
Path.h
|
Path.h
|
||||||
|
|
|
@ -61,17 +61,18 @@ void Entity::setIngredientData(const std::string &name)
|
||||||
void Entity::entityDied(Entity *e)
|
void Entity::entityDied(Entity *e)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
|
if(targets[i] == e)
|
||||||
|
targets[i] = NULL;
|
||||||
|
|
||||||
|
if (boneLock.on && boneLock.entity == e)
|
||||||
{
|
{
|
||||||
targets[i] = 0;
|
setBoneLock(BoneLock(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boneLock.on)
|
if(riding == e)
|
||||||
{
|
riding = NULL;
|
||||||
if (boneLock.entity == e)
|
if(ridingOnEntity == e)
|
||||||
{
|
ridingOnEntity = NULL;
|
||||||
setBoneLock(BoneLock());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::setBounceType(BounceType bt)
|
void Entity::setBounceType(BounceType bt)
|
||||||
|
@ -84,7 +85,7 @@ BounceType Entity::getBounceType()
|
||||||
return bounceType;
|
return bounceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::generateCollisionMask(int ovrCollideRadius)
|
void Entity::generateCollisionMask(float ovrCollideRadius)
|
||||||
{
|
{
|
||||||
if (this->skeletalSprite.isLoaded())
|
if (this->skeletalSprite.isLoaded())
|
||||||
{
|
{
|
||||||
|
@ -98,14 +99,13 @@ void Entity::generateCollisionMask(int ovrCollideRadius)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Entity::setBoneLock(const BoneLock &bl, bool force)
|
||||||
|
{
|
||||||
bool Entity::setBoneLock(const BoneLock &bl)
|
if(!force)
|
||||||
{
|
{
|
||||||
if (!canSetBoneLock()) return false;
|
|
||||||
|
|
||||||
if (bl.on && boneLockDelay > 0) return false;
|
if (bl.on && boneLockDelay > 0) return false;
|
||||||
if (boneLock.on && bl.on) return false;
|
if (boneLock.on && bl.on) return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (boneLock.on && !bl.on)
|
if (boneLock.on && !bl.on)
|
||||||
{
|
{
|
||||||
|
@ -138,11 +138,6 @@ bool Entity::setBoneLock(const BoneLock &bl)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::canSetBoneLock()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity::Entity()
|
Entity::Entity()
|
||||||
{
|
{
|
||||||
addType(SCO_ENTITY);
|
addType(SCO_ENTITY);
|
||||||
|
@ -211,7 +206,6 @@ Entity::Entity()
|
||||||
multColor = Vector(1,1,1);
|
multColor = Vector(1,1,1);
|
||||||
collideRadius = 24;
|
collideRadius = 24;
|
||||||
entityType = EntityType(0);
|
entityType = EntityType(0);
|
||||||
targets.resize(10);
|
|
||||||
|
|
||||||
frozenTimer = 0;
|
frozenTimer = 0;
|
||||||
canBeTargetedByAvatar = false;
|
canBeTargetedByAvatar = false;
|
||||||
|
@ -494,11 +488,8 @@ void Entity::stopFollowingPath()
|
||||||
position.stopPath();
|
position.stopPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::flipToTarget(Vector pos)
|
void Entity::flipToPos(Vector pos)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (pos.x > position.x)
|
if (pos.x > position.x)
|
||||||
{
|
{
|
||||||
if (!isfh())
|
if (!isfh())
|
||||||
|
@ -511,19 +502,25 @@ void Entity::flipToTarget(Vector pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity* Entity::getTargetEntity(int t)
|
Entity* Entity::getTargetEntity(size_t t) const
|
||||||
{
|
{
|
||||||
return targets[t];
|
return t < targets.size() ? targets[t] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::setTargetEntity(Entity *e, int t)
|
void Entity::setTargetEntity(Entity *e, size_t t)
|
||||||
|
{
|
||||||
|
if(t < targets.size())
|
||||||
{
|
{
|
||||||
targets[t] = e;
|
targets[t] = e;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::hasTarget(int t)
|
if(!e)
|
||||||
{
|
return;
|
||||||
return (targets[t]!=0);
|
|
||||||
|
if(targets.size() <= t)
|
||||||
|
targets.resize(t + 1);
|
||||||
|
targets[t] = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::destroy()
|
void Entity::destroy()
|
||||||
|
@ -1571,7 +1568,6 @@ void Entity::onUpdate(float dt)
|
||||||
Quad::onUpdate(dt);
|
Quad::onUpdate(dt);
|
||||||
|
|
||||||
Vector v = position - lastPos;
|
Vector v = position - lastPos;
|
||||||
lastMove = v;
|
|
||||||
if (position.isFollowingPath() && swimPath)
|
if (position.isFollowingPath() && swimPath)
|
||||||
{
|
{
|
||||||
movementDetails(v);
|
movementDetails(v);
|
||||||
|
@ -1866,25 +1862,21 @@ EntityType Entity::getEntityType()
|
||||||
return entityType;
|
return entityType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* types:
|
Entity *Entity::findTarget(int dist, int type, size_t t)
|
||||||
|
|
||||||
*/
|
|
||||||
Entity *Entity::findTarget(int dist, int type, int t)
|
|
||||||
{
|
{
|
||||||
targets[t] = 0;
|
Entity *target = NULL;
|
||||||
|
|
||||||
if (type == ET_AVATAR)
|
if (type == ET_AVATAR)
|
||||||
{
|
{
|
||||||
Vector d = game->avatar->position - this->position;
|
Vector d = game->avatar->position - this->position;
|
||||||
if (d.getSquaredLength2D() < sqr(dist))
|
if (d.getSquaredLength2D() < sqr(dist))
|
||||||
{
|
{
|
||||||
targets[t] = game->avatar;
|
target = game->avatar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int closestDist = -1;
|
int closestDist = -1;
|
||||||
Entity *target = 0;
|
|
||||||
FOR_ENTITIES(i)
|
FOR_ENTITIES(i)
|
||||||
{
|
{
|
||||||
Entity *e = *i;
|
Entity *e = *i;
|
||||||
|
@ -1898,12 +1890,10 @@ Entity *Entity::findTarget(int dist, int type, int t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target)
|
|
||||||
{
|
|
||||||
targets[t] = target;
|
|
||||||
}
|
}
|
||||||
}
|
setTargetEntity(target, t);
|
||||||
return targets[t];
|
|
||||||
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::moveTowards(Vector p, float dt, int spd)
|
void Entity::moveTowards(Vector p, float dt, int spd)
|
||||||
|
@ -1936,15 +1926,15 @@ void Entity::moveAroundAngle(int angle, float dt, int spd, int dir)
|
||||||
moveAround(p, dt, spd, dir);
|
moveAround(p, dt, spd, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::moveTowardsTarget(float dt, int spd, int t)
|
void Entity::moveTowardsTarget(float dt, int spd, size_t t)
|
||||||
{
|
{
|
||||||
if (!targets[t]) return;
|
if (t >= targets.size() || !targets[t]) return;
|
||||||
moveTowards(targets[t]->position, dt, spd);
|
moveTowards(targets[t]->position, dt, spd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::moveAroundTarget(float dt, int spd, int dir, int t)
|
void Entity::moveAroundTarget(float dt, int spd, int dir, size_t t)
|
||||||
{
|
{
|
||||||
if (!targets[t]) return;
|
if (t >= targets.size() || !targets[t]) return;
|
||||||
moveAround(targets[t]->position, dt, spd, dir);
|
moveAround(targets[t]->position, dt, spd, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
float health;
|
float health;
|
||||||
float maxHealth;
|
float maxHealth;
|
||||||
|
|
||||||
bool setBoneLock(const BoneLock &boneLock);
|
bool setBoneLock(const BoneLock &boneLock, bool force = false);
|
||||||
|
|
||||||
void heal(float a, int type=0);
|
void heal(float a, int type=0);
|
||||||
|
|
||||||
|
@ -134,7 +134,6 @@ public:
|
||||||
Entity *ridingOnEntity;
|
Entity *ridingOnEntity;
|
||||||
Vector startPos;
|
Vector startPos;
|
||||||
void rotateToVec(Vector addVec, float time, float offsetAngle=0);
|
void rotateToVec(Vector addVec, float time, float offsetAngle=0);
|
||||||
virtual void applyVariation(int variation){}
|
|
||||||
|
|
||||||
void popBubble();
|
void popBubble();
|
||||||
void sound(const std::string &sound, float freq=1, float fadeOut=0);
|
void sound(const std::string &sound, float freq=1, float fadeOut=0);
|
||||||
|
@ -167,7 +166,6 @@ public:
|
||||||
STATE_FOLLOW =23,
|
STATE_FOLLOW =23,
|
||||||
STATE_TITLE =24
|
STATE_TITLE =24
|
||||||
};
|
};
|
||||||
virtual void onNotify(Entity *notify){}
|
|
||||||
|
|
||||||
float followPath(Path *p, float speed, int dir, bool deleteOnEnd = false);
|
float followPath(Path *p, float speed, int dir, bool deleteOnEnd = false);
|
||||||
bool touchAvatarDamage(int radius, float dmg, const Vector &override=Vector(-1,-1,-1), float speed=0, float pushTime = 0, Vector collidePos = Vector(0,0,0));
|
bool touchAvatarDamage(int radius, float dmg, const Vector &override=Vector(-1,-1,-1), float speed=0, float pushTime = 0, Vector collidePos = Vector(0,0,0));
|
||||||
|
@ -178,8 +176,8 @@ public:
|
||||||
void moveTowardsAngle(int angle, float dt, int spd);
|
void moveTowardsAngle(int angle, float dt, int spd);
|
||||||
void moveAroundAngle(int angle, float dt, int spd, int dir);
|
void moveAroundAngle(int angle, float dt, int spd, int dir);
|
||||||
|
|
||||||
void moveTowardsTarget(float dt, int spd, int t=0);
|
void moveTowardsTarget(float dt, int spd, size_t t=0);
|
||||||
void moveAroundTarget(float dt, int spd, int d, int t=0);
|
void moveAroundTarget(float dt, int spd, int d, size_t t=0);
|
||||||
void moveAroundEntity(float dt, int spd, int d, Entity *e);
|
void moveAroundEntity(float dt, int spd, int d, Entity *e);
|
||||||
void moveTowardsGroupCenter(float dt, int spd);
|
void moveTowardsGroupCenter(float dt, int spd);
|
||||||
void moveTowardsGroupHeading(float dt, int spd);
|
void moveTowardsGroupHeading(float dt, int spd);
|
||||||
|
@ -187,13 +185,12 @@ public:
|
||||||
void doSpellAvoidance(float dt, int range, float mod);
|
void doSpellAvoidance(float dt, int range, float mod);
|
||||||
void doEntityAvoidance(float dt, int range, float mod, Entity *ignore =0);
|
void doEntityAvoidance(float dt, int range, float mod, Entity *ignore =0);
|
||||||
void setMaxSpeed(float ms);
|
void setMaxSpeed(float ms);
|
||||||
Entity *findTarget(int dist, int type, int t=0);
|
Entity *findTarget(int dist, int type, size_t t=0);
|
||||||
|
|
||||||
bool hasTarget(int t=0);
|
|
||||||
bool isTargetInRange(int range, size_t t=0);
|
bool isTargetInRange(int range, size_t t=0);
|
||||||
void doGlint(const Vector &position, const Vector &scale=Vector(2,2), const std::string &tex="Glint", BlendType bt=BLEND_DEFAULT);
|
void doGlint(const Vector &position, const Vector &scale=Vector(2,2), const std::string &tex="Glint", BlendType bt=BLEND_DEFAULT);
|
||||||
Entity *getTargetEntity(int t=0);
|
Entity *getTargetEntity(size_t t=0) const;
|
||||||
void setTargetEntity(Entity *e, int t=0);
|
void setTargetEntity(Entity *e, size_t t=0);
|
||||||
|
|
||||||
virtual void activate(Entity *by, int source){}
|
virtual void activate(Entity *by, int source){}
|
||||||
|
|
||||||
|
@ -201,11 +198,10 @@ public:
|
||||||
|
|
||||||
void setEntityType(EntityType et);
|
void setEntityType(EntityType et);
|
||||||
EntityType getEntityType();
|
EntityType getEntityType();
|
||||||
void flipToTarget(Vector pos);
|
void flipToPos(Vector pos);
|
||||||
bool isFollowingPath();
|
bool isFollowingPath();
|
||||||
void stopFollowingPath();
|
void stopFollowingPath();
|
||||||
void overideMaxSpeed(int ms, float time);
|
void overideMaxSpeed(int ms, float time);
|
||||||
void disableOverideMaxSpeed();
|
|
||||||
int currentEntityTarget;
|
int currentEntityTarget;
|
||||||
float moveToPos(Vector pos, float speed, int dieOnPathEnd=0, bool swim = false);
|
float moveToPos(Vector pos, float speed, int dieOnPathEnd=0, bool swim = false);
|
||||||
bool isHit();
|
bool isHit();
|
||||||
|
@ -220,7 +216,6 @@ public:
|
||||||
void idle();
|
void idle();
|
||||||
void slowToStopPath(float t);
|
void slowToStopPath(float t);
|
||||||
bool isSlowingToStopPath();
|
bool isSlowingToStopPath();
|
||||||
Vector lastMove;
|
|
||||||
float damageTime;
|
float damageTime;
|
||||||
|
|
||||||
void setEntityProperty(EntityProperty ep, bool value=true);
|
void setEntityProperty(EntityProperty ep, bool value=true);
|
||||||
|
@ -286,7 +281,7 @@ public:
|
||||||
float getHealthPerc();
|
float getHealthPerc();
|
||||||
void setDeathScene(bool v);
|
void setDeathScene(bool v);
|
||||||
bool isDeathScene() const { return deathScene; }
|
bool isDeathScene() const { return deathScene; }
|
||||||
void generateCollisionMask(int ovrCollideRadius=0);
|
void generateCollisionMask(float ovrCollideRadius=0);
|
||||||
DamageData lastDamage;
|
DamageData lastDamage;
|
||||||
bool checkSplash(const Vector &override=Vector(0,0,0));
|
bool checkSplash(const Vector &override=Vector(0,0,0));
|
||||||
EatData eatData;
|
EatData eatData;
|
||||||
|
@ -330,8 +325,6 @@ public:
|
||||||
void setPoison(float m, float t);
|
void setPoison(float m, float t);
|
||||||
inline float getPoison() const { return poison; }
|
inline float getPoison() const { return poison; }
|
||||||
|
|
||||||
virtual bool canSetBoneLock();
|
|
||||||
|
|
||||||
void initHair(int numSegments, float segmentLength, float width, const std::string &tex);
|
void initHair(int numSegments, float segmentLength, float width, const std::string &tex);
|
||||||
void updateHair(float dt);
|
void updateHair(float dt);
|
||||||
void setHairHeadPosition(const Vector &pos);
|
void setHairHeadPosition(const Vector &pos);
|
||||||
|
|
|
@ -2283,11 +2283,8 @@ void Game::entityDied(Entity *eDead)
|
||||||
FOR_ENTITIES(i)
|
FOR_ENTITIES(i)
|
||||||
{
|
{
|
||||||
e = *i;
|
e = *i;
|
||||||
if (e != eDead && e->isv(EV_ENTITYDIED,1))
|
|
||||||
{
|
|
||||||
e->entityDied(eDead);
|
e->entityDied(eDead);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dsq->continuity.entityDied(eDead);
|
dsq->continuity.entityDied(eDead);
|
||||||
}
|
}
|
||||||
|
|
189
Aquaria/GameEnums.cpp
Normal file
189
Aquaria/GameEnums.cpp
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
#include "GameEnums.h"
|
||||||
|
#include "Base.h"
|
||||||
|
|
||||||
|
// keep in sync with enum Layers
|
||||||
|
static const char *s_LayerNames[LR_MAX] =
|
||||||
|
{
|
||||||
|
"LR_ZERO",
|
||||||
|
"LR_BACKDROP",
|
||||||
|
"LR_BACKGROUND",
|
||||||
|
"LR_SCENEBACKGROUNDIMAGE",
|
||||||
|
"LR_BACKDROP_ELEMENTS1",
|
||||||
|
"LR_BACKDROP_ELEMENTS2",
|
||||||
|
"LR_ENTITIES_MINUS4_PLACEHOLDER",
|
||||||
|
"LR_BACKDROP_ELEMENTS3",
|
||||||
|
"LR_BACKDROP_ELEMENTS4",
|
||||||
|
"LR_BACKDROP_ELEMENTS5",
|
||||||
|
"LR_BACKDROP_ELEMENTS6",
|
||||||
|
"LR_BACKGROUND_ELEMENTS1",
|
||||||
|
"LR_BACKGROUND_ELEMENTS2",
|
||||||
|
"LR_ENTITIES_MINUS3_PLACEHOLDER",
|
||||||
|
"LR_BACKGROUND_ELEMENTS3",
|
||||||
|
"LR_ENTITIES_MINUS2_PLACEHOLDER",
|
||||||
|
"LR_BLACKGROUND",
|
||||||
|
"LR_UPDATE_ELEMENTS_BG",
|
||||||
|
"LR_ELEMENTS1",
|
||||||
|
"LR_ELEMENTS2",
|
||||||
|
"LR_ELEMENTS3",
|
||||||
|
"LR_ELEMENTS4",
|
||||||
|
"LR_ELEMENTS5",
|
||||||
|
"LR_ELEMENTS6",
|
||||||
|
"LR_ELEMENTS7",
|
||||||
|
"LR_ELEMENTS8",
|
||||||
|
"LR_ELEMENTS9",
|
||||||
|
"LR_ELEMENTS10",
|
||||||
|
"LR_ELEMENTS11",
|
||||||
|
"LR_ELEMENTS12",
|
||||||
|
"LR_ELEMENTS13",
|
||||||
|
"LR_ELEMENTS14",
|
||||||
|
"LR_ELEMENTS15",
|
||||||
|
"LR_ELEMENTS16",
|
||||||
|
"LR_UPDATE_ELEMENTS_FG",
|
||||||
|
"LR_ENTITIES_MINUS4",
|
||||||
|
"LR_ENTITIES_MINUS3",
|
||||||
|
"LR_ENTITIES_MINUS2",
|
||||||
|
"LR_ENTITIES00",
|
||||||
|
"LR_ENTITIES0",
|
||||||
|
"LR_ENTITIES",
|
||||||
|
"LR_ENTITIES2",
|
||||||
|
"LR_WATERSURFACE",
|
||||||
|
"LR_WATERSURFACE2",
|
||||||
|
"LR_DARK_LAYER",
|
||||||
|
"LR_PROJECTILES",
|
||||||
|
"LR_LIGHTING",
|
||||||
|
"LR_PARTICLES",
|
||||||
|
"LR_PARTICLES2",
|
||||||
|
"LR_FOREGROUND_ELEMENTS1",
|
||||||
|
"LR_FOREGROUND_ELEMENTS2",
|
||||||
|
"LR_PARTICLES_TOP",
|
||||||
|
"LR_AFTER_EFFECTS",
|
||||||
|
"LR_SCENE_COLOR",
|
||||||
|
"LR_MENU",
|
||||||
|
"LR_MENU2",
|
||||||
|
"LR_HUD",
|
||||||
|
"LR_HUD2",
|
||||||
|
"LR_HUD3",
|
||||||
|
"LR_HUDUNDERLAY",
|
||||||
|
"LR_MINIMAP",
|
||||||
|
"LR_RECIPES",
|
||||||
|
"LR_WORLDMAP",
|
||||||
|
"LR_WORLDMAPHUD",
|
||||||
|
"LR_REGISTER_TEXT",
|
||||||
|
"LR_DAMAGESPRITE",
|
||||||
|
"LR_HELP",
|
||||||
|
"LR_TRANSITION",
|
||||||
|
"LR_OVERLAY",
|
||||||
|
"LR_FILEMENU",
|
||||||
|
"LR_CONFIRM",
|
||||||
|
"LR_CURSOR",
|
||||||
|
"LR_SUBTITLES",
|
||||||
|
"LR_PROGRESS",
|
||||||
|
"LR_DEBUG_TEXT",
|
||||||
|
"LR_BLACKBARS"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *EnumName(Layers lr)
|
||||||
|
{
|
||||||
|
compile_assert(Countof(s_LayerNames) == LR_MAX);
|
||||||
|
|
||||||
|
return lr < Countof(s_LayerNames) ? s_LayerNames[lr] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *s_AquariaActionNames_0[ACTION_MAX] =
|
||||||
|
{
|
||||||
|
"ACTION_PRIMARY",
|
||||||
|
"ACTION_SECONDARY",
|
||||||
|
"ACTION_ESC",
|
||||||
|
"ACTION_TOGGLESCENEEDITO",
|
||||||
|
"ACTION_TOGGLEWORLDMAP",
|
||||||
|
"ACTION_TOGGLEGRID",
|
||||||
|
"ACTION_MENULEFT",
|
||||||
|
"ACTION_MENURIGHT",
|
||||||
|
"ACTION_MENUUP",
|
||||||
|
"ACTION_MENUDOWN",
|
||||||
|
"ACTION_PREVPAGE",
|
||||||
|
"ACTION_NEXTPAGE",
|
||||||
|
"ACTION_COOKFOOD",
|
||||||
|
"ACTION_FOODLEFT",
|
||||||
|
"ACTION_FOODRIGHT",
|
||||||
|
"ACTION_FOODDROP",
|
||||||
|
"ACTION_TOGGLEMENU"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *s_AquariaActionNames_100[ACTION_MAX] =
|
||||||
|
{
|
||||||
|
"ACTION_SWIMUP",
|
||||||
|
"ACTION_SWIMDOWN",
|
||||||
|
"ACTION_SWIMLEFT",
|
||||||
|
"ACTION_SWIMRIGHT",
|
||||||
|
"ACTION_SINGUP",
|
||||||
|
"ACTION_SINGDOWN",
|
||||||
|
"ACTION_SINGLEFT",
|
||||||
|
"ACTION_SINGRIGHT",
|
||||||
|
"ACTION_SONGSLOT1",
|
||||||
|
"ACTION_SONGSLOT2",
|
||||||
|
"ACTION_SONGSLOT3",
|
||||||
|
"ACTION_SONGSLOT4",
|
||||||
|
"ACTION_SONGSLOT5",
|
||||||
|
"ACTION_SONGSLOT6",
|
||||||
|
"ACTION_SONGSLOT7",
|
||||||
|
"ACTION_SONGSLOT8",
|
||||||
|
"ACTION_SONGSLOT9",
|
||||||
|
"ACTION_SONGSLOT10",
|
||||||
|
"ACTION_SONGSLOTEND",
|
||||||
|
"ACTION_ROLL",
|
||||||
|
"ACTION_SLOW",
|
||||||
|
"ACTION_REVERT"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *s_AquariaActionNames_200[ACTION_MAX] =
|
||||||
|
{
|
||||||
|
"ACTION_ZOOMIN",
|
||||||
|
"ACTION_ZOOMOUT",
|
||||||
|
"ACTION_CAMLEFT",
|
||||||
|
"ACTION_CAMRIGHT",
|
||||||
|
"ACTION_CAMUP",
|
||||||
|
"ACTION_CAMDOWN",
|
||||||
|
"ACTION_BONELEFT",
|
||||||
|
"ACTION_BONERIGHT",
|
||||||
|
"ACTION_BONEUP",
|
||||||
|
"ACTION_BONEDOWN",
|
||||||
|
"ACTION_BGLAYER1",
|
||||||
|
"ACTION_BGLAYER2",
|
||||||
|
"ACTION_BGLAYER3",
|
||||||
|
"ACTION_BGLAYER4",
|
||||||
|
"ACTION_BGLAYER5",
|
||||||
|
"ACTION_BGLAYER6",
|
||||||
|
"ACTION_BGLAYER7",
|
||||||
|
"ACTION_BGLAYER8",
|
||||||
|
"ACTION_BGLAYER9",
|
||||||
|
"ACTION_BGLAYER10",
|
||||||
|
"ACTION_BGLAYER11",
|
||||||
|
"ACTION_BGLAYER12",
|
||||||
|
"ACTION_BGLAYER13",
|
||||||
|
"ACTION_BGLAYER14",
|
||||||
|
"ACTION_BGLAYER15",
|
||||||
|
"ACTION_BGLAYER16",
|
||||||
|
"ACTION_BGLAYEREND",
|
||||||
|
"ACTION_MULTISELECT",
|
||||||
|
"ACTION_TOGGLEWORLDMAPEDITOR",
|
||||||
|
"ACTION_LOOK",
|
||||||
|
"ACTION_TOGGLEHELPSCREEN",
|
||||||
|
"ACTION_PLACE_AVATAR",
|
||||||
|
"ACTION_SCREENSHOT"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *EnumName(AquariaActions a)
|
||||||
|
{
|
||||||
|
unsigned i = a;
|
||||||
|
if(i < Countof(s_AquariaActionNames_0))
|
||||||
|
return s_AquariaActionNames_0[i];
|
||||||
|
i -= 100; // no problem if this underflows
|
||||||
|
if(i < Countof(s_AquariaActionNames_100))
|
||||||
|
return s_AquariaActionNames_100[i];
|
||||||
|
i -= 100;
|
||||||
|
if(i < Countof(s_AquariaActionNames_200))
|
||||||
|
return s_AquariaActionNames_200[i];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -52,21 +52,21 @@ enum CursorType
|
||||||
CURSOR_LOOK = 4
|
CURSOR_LOOK = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AquariaActions
|
enum AquariaActions // Keep in sync with GameEnums.cpp
|
||||||
{
|
{
|
||||||
ACTION_PRIMARY =0,
|
ACTION_PRIMARY,
|
||||||
ACTION_SECONDARY =1,
|
ACTION_SECONDARY,
|
||||||
ACTION_ESC =2,
|
ACTION_ESC,
|
||||||
ACTION_TOGGLESCENEEDITOR =3,
|
ACTION_TOGGLESCENEEDITOR,
|
||||||
ACTION_TOGGLEWORLDMAP =4,
|
ACTION_TOGGLEWORLDMAP,
|
||||||
|
|
||||||
ACTION_TOGGLEGRID =5,
|
ACTION_TOGGLEGRID,
|
||||||
|
|
||||||
// Automatically sent on either ACTION_SWIM* or sufficient analog controller input
|
// Automatically sent on either ACTION_SWIM* or sufficient analog controller input
|
||||||
ACTION_MENULEFT =6,
|
ACTION_MENULEFT,
|
||||||
ACTION_MENURIGHT =7,
|
ACTION_MENURIGHT,
|
||||||
ACTION_MENUUP =8,
|
ACTION_MENUUP,
|
||||||
ACTION_MENUDOWN =9,
|
ACTION_MENUDOWN,
|
||||||
|
|
||||||
ACTION_PREVPAGE,
|
ACTION_PREVPAGE,
|
||||||
ACTION_NEXTPAGE,
|
ACTION_NEXTPAGE,
|
||||||
|
@ -78,7 +78,7 @@ enum AquariaActions
|
||||||
ACTION_TOGGLEMENU,
|
ACTION_TOGGLEMENU,
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
ACTION_SWIMUP = 100,
|
ACTION_SWIMUP = 100,
|
||||||
ACTION_SWIMDOWN,
|
ACTION_SWIMDOWN,
|
||||||
ACTION_SWIMLEFT,
|
ACTION_SWIMLEFT,
|
||||||
|
@ -106,6 +106,7 @@ enum AquariaActions
|
||||||
ACTION_SLOW, // currently unused
|
ACTION_SLOW, // currently unused
|
||||||
ACTION_REVERT,
|
ACTION_REVERT,
|
||||||
|
|
||||||
|
// ------------------------
|
||||||
ACTION_ZOOMIN = 200,
|
ACTION_ZOOMIN = 200,
|
||||||
ACTION_ZOOMOUT,
|
ACTION_ZOOMOUT,
|
||||||
|
|
||||||
|
@ -144,8 +145,11 @@ enum AquariaActions
|
||||||
ACTION_LOOK ,
|
ACTION_LOOK ,
|
||||||
ACTION_TOGGLEHELPSCREEN,
|
ACTION_TOGGLEHELPSCREEN,
|
||||||
ACTION_PLACE_AVATAR,
|
ACTION_PLACE_AVATAR,
|
||||||
ACTION_SCREENSHOT
|
ACTION_SCREENSHOT,
|
||||||
|
|
||||||
|
ACTION_MAX
|
||||||
};
|
};
|
||||||
|
const char *EnumName(AquariaActions a);
|
||||||
|
|
||||||
enum AuraType
|
enum AuraType
|
||||||
{
|
{
|
||||||
|
@ -232,7 +236,7 @@ enum VisualEffectsType
|
||||||
VFX_MAX = 3
|
VFX_MAX = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Layers
|
enum Layers // keep in sync with GameEnums.cpp
|
||||||
{
|
{
|
||||||
// GAME WILL CLEAR THESE
|
// GAME WILL CLEAR THESE
|
||||||
LR_ZERO = 0,
|
LR_ZERO = 0,
|
||||||
|
@ -313,6 +317,7 @@ enum Layers
|
||||||
LR_BLACKBARS ,
|
LR_BLACKBARS ,
|
||||||
LR_MAX
|
LR_MAX
|
||||||
};
|
};
|
||||||
|
const char *EnumName(Layers lr);
|
||||||
|
|
||||||
|
|
||||||
enum IngredientType
|
enum IngredientType
|
||||||
|
|
|
@ -29,6 +29,7 @@ Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
|
||||||
{
|
{
|
||||||
this->segmentLength = segmentLength;
|
this->segmentLength = segmentLength;
|
||||||
this->hairWidth = hairWidth;
|
this->hairWidth = hairWidth;
|
||||||
|
this->_hairfh = false;
|
||||||
|
|
||||||
cull = false;
|
cull = false;
|
||||||
|
|
||||||
|
@ -41,22 +42,12 @@ Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
|
||||||
if (perc < 0)
|
if (perc < 0)
|
||||||
perc = 0;
|
perc = 0;
|
||||||
hairNodes[i].percent = 1.0f-perc;
|
hairNodes[i].percent = 1.0f-perc;
|
||||||
hairNodes[i].position = hairNodes[i].originalPosition = hairNodes[i].defaultPosition = Vector(0, i*segmentLength, 0);
|
Vector p(0, i*segmentLength, 0);
|
||||||
|
hairNodes[i].position = p;
|
||||||
|
hairNodes[i].defaultPosition = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hair::exertWave(float dt)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hair::exertGravityWave(float dt)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hair::setHeadPosition(const Vector &vec)
|
void Hair::setHeadPosition(const Vector &vec)
|
||||||
{
|
{
|
||||||
hairNodes[0].position = vec;
|
hairNodes[0].position = vec;
|
||||||
|
@ -75,46 +66,29 @@ HairNode *Hair::getHairNode(int idx)
|
||||||
|
|
||||||
void Hair::onRender(const RenderState& rs) const
|
void Hair::onRender(const RenderState& rs) const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
glBegin(GL_QUAD_STRIP);
|
glBegin(GL_QUAD_STRIP);
|
||||||
float texBits = 1.0f / (hairNodes.size()-1);
|
const float texBits = 1.0f / (hairNodes.size()-1);
|
||||||
|
const Vector mul = !_hairfh ? Vector(1, 1) : Vector(-1, -1);
|
||||||
|
|
||||||
Vector pl, pr;
|
Vector pl, pr;
|
||||||
for (size_t i = 0; i < hairNodes.size(); i++)
|
for (size_t i = 0; i < hairNodes.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (i != hairNodes.size()-1)
|
if (i != hairNodes.size()-1)
|
||||||
{
|
{
|
||||||
Vector diffVec = hairNodes[i+1].position - hairNodes[i].position;
|
Vector diffVec = hairNodes[i+1].position - hairNodes[i].position;
|
||||||
diffVec.setLength2D(hairWidth);
|
diffVec.setLength2D(hairWidth);
|
||||||
pl = diffVec.getPerpendicularLeft();
|
pl = diffVec.getPerpendicularLeft() * mul;
|
||||||
pr = diffVec.getPerpendicularRight();
|
pr = diffVec.getPerpendicularRight() * mul;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector p = hairNodes[i].position;
|
||||||
|
|
||||||
glTexCoord2f(0, texBits*i);
|
glTexCoord2f(0, texBits*i);
|
||||||
glVertex3f(hairNodes[i].position.x + pl.x, hairNodes[i].position.y + pl.y, 0);
|
glVertex3f(p.x + pl.x, p.y + pl.y, 0);
|
||||||
glTexCoord2f(1, texBits*i);
|
glTexCoord2f(1, texBits*i);
|
||||||
glVertex3f( hairNodes[i].position.x + pr.x, hairNodes[i].position.y + pr.y, 0);
|
glVertex3f(p.x + pr.x, p.y + pr.y, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hair::onUpdate(float dt)
|
|
||||||
{
|
|
||||||
RenderObject::onUpdate(dt);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hair::updatePositions()
|
void Hair::updatePositions()
|
||||||
|
@ -137,11 +111,7 @@ void Hair::updatePositions()
|
||||||
hairNodes[i].position = hairNodes[i-1].position + diff;
|
hairNodes[i].position = hairNodes[i-1].position + diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hair::returnToDefaultPositions(float dt)
|
void Hair::returnToDefaultPositions(float dt)
|
||||||
|
@ -162,23 +132,44 @@ void Hair::returnToDefaultPositions(float dt)
|
||||||
|
|
||||||
void Hair::exertForce(const Vector &force, float dt, int usePerc)
|
void Hair::exertForce(const Vector &force, float dt, int usePerc)
|
||||||
{
|
{
|
||||||
|
const Vector f = force * dt;
|
||||||
for (int i = hairNodes.size()-1; i >= 1; i--)
|
for (int i = hairNodes.size()-1; i >= 1; i--)
|
||||||
{
|
{
|
||||||
switch (usePerc)
|
switch (usePerc)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
hairNodes[i].position += force*dt*hairNodes[i].percent;
|
hairNodes[i].position += f * hairNodes[i].percent;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
hairNodes[i].position += force*dt*(1.0f-hairNodes[i].percent);
|
hairNodes[i].position += f * (1.0f-hairNodes[i].percent);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
hairNodes[i].position += force*dt;
|
hairNodes[i].position += f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hair::exertNodeForce(size_t i, const Vector& force, float dt, int usePerc)
|
||||||
|
{
|
||||||
|
const Vector f = force * dt;
|
||||||
|
if(i >= hairNodes.size())
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (usePerc)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
hairNodes[i].position += f * hairNodes[i].percent;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
hairNodes[i].position += f * (1.0f-hairNodes[i].percent);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
default:
|
||||||
|
hairNodes[i].position += f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
struct HairNode
|
struct HairNode
|
||||||
{
|
{
|
||||||
HairNode() : percent(0), problem(false), angleDiff(0)
|
HairNode() : percent(0)
|
||||||
{}
|
{}
|
||||||
float percent; // percent of how much force is affected on this node
|
float percent; // percent of how much force is affected on this node
|
||||||
Vector position; // position of the hair node
|
Vector position; // position of the hair node
|
||||||
Vector defaultPosition; // default position of the hair node
|
Vector defaultPosition; // default position of the hair node
|
||||||
Vector originalPosition;
|
|
||||||
bool problem;
|
|
||||||
float angleDiff;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Hair : public RenderObject
|
class Hair : public RenderObject
|
||||||
|
@ -41,8 +38,10 @@ public:
|
||||||
Hair(int nodes=40, float segmentLength=3, float width=18);
|
Hair(int nodes=40, float segmentLength=3, float width=18);
|
||||||
|
|
||||||
void exertForce(const Vector &force, float dt, int usePerc=0);
|
void exertForce(const Vector &force, float dt, int usePerc=0);
|
||||||
|
void exertNodeForce(size_t idx, const Vector &force, float dt, int usePerc=0);
|
||||||
void updatePositions();
|
void updatePositions();
|
||||||
void returnToDefaultPositions(float dt);
|
void returnToDefaultPositions(float dt);
|
||||||
|
void setTextureFlip(bool flip) { _hairfh = flip; }
|
||||||
|
|
||||||
float hairWidth;
|
float hairWidth;
|
||||||
|
|
||||||
|
@ -55,8 +54,8 @@ public:
|
||||||
HairNode *getHairNode(int idx);
|
HairNode *getHairNode(int idx);
|
||||||
protected:
|
protected:
|
||||||
float segmentLength;
|
float segmentLength;
|
||||||
void onUpdate(float dt) OVERRIDE;
|
|
||||||
void onRender(const RenderState& rs) const OVERRIDE;
|
void onRender(const RenderState& rs) const OVERRIDE;
|
||||||
|
bool _hairfh;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 2007, 2010 - Bit-Blot
|
|
||||||
|
|
||||||
This file is part of Aquaria.
|
|
||||||
|
|
||||||
Aquaria is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
|
@ -1633,6 +1633,15 @@ luaFunc(obj_setRenderPass)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(obj_getRenderPass)
|
||||||
|
{
|
||||||
|
RenderObject *r = robj(L);
|
||||||
|
int pass = 0;
|
||||||
|
if (r)
|
||||||
|
pass = r->getRenderPass();
|
||||||
|
luaReturnInt(pass);
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(obj_fh)
|
luaFunc(obj_fh)
|
||||||
{
|
{
|
||||||
RenderObject *r = robj(L);
|
RenderObject *r = robj(L);
|
||||||
|
@ -2060,6 +2069,7 @@ luaFunc(quad_getBorderAlpha)
|
||||||
RO_FUNC(getter, prefix, setUpdateCull ) \
|
RO_FUNC(getter, prefix, setUpdateCull ) \
|
||||||
RO_FUNC(getter, prefix, getUpdateCull ) \
|
RO_FUNC(getter, prefix, getUpdateCull ) \
|
||||||
RO_FUNC(getter, prefix, setRenderPass ) \
|
RO_FUNC(getter, prefix, setRenderPass ) \
|
||||||
|
RO_FUNC(getter, prefix, getRenderPass ) \
|
||||||
RO_FUNC(getter, prefix, setPositionX ) \
|
RO_FUNC(getter, prefix, setPositionX ) \
|
||||||
RO_FUNC(getter, prefix, setPositionY ) \
|
RO_FUNC(getter, prefix, setPositionY ) \
|
||||||
RO_FUNC(getter, prefix, enableMotionBlur ) \
|
RO_FUNC(getter, prefix, enableMotionBlur ) \
|
||||||
|
@ -5993,7 +6003,7 @@ luaFunc(entity_flipToEntity)
|
||||||
Entity *e2 = entity(L, 2);
|
Entity *e2 = entity(L, 2);
|
||||||
if (e && e2)
|
if (e && e2)
|
||||||
{
|
{
|
||||||
e->flipToTarget(e2->position);
|
e->flipToPos(e2->position);
|
||||||
}
|
}
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
@ -6005,7 +6015,7 @@ luaFunc(entity_flipToNode)
|
||||||
PathNode *n = &p->nodes[0];
|
PathNode *n = &p->nodes[0];
|
||||||
if (e && n)
|
if (e && n)
|
||||||
{
|
{
|
||||||
e->flipToTarget(n->position);
|
e->flipToPos(n->position);
|
||||||
}
|
}
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
@ -7416,21 +7426,19 @@ luaFunc(entity_setActivationType)
|
||||||
luaFunc(entity_hasTarget)
|
luaFunc(entity_hasTarget)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
if (e)
|
luaReturnBool(e && e->getTargetEntity(e->currentEntityTarget));
|
||||||
luaReturnBool(e->hasTarget(e->currentEntityTarget));
|
|
||||||
else
|
|
||||||
luaReturnBool(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
luaFunc(entity_hurtTarget)
|
luaFunc(entity_hurtTarget)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
if (e && e->getTargetEntity())
|
if (e)
|
||||||
|
if(Entity *t = e->getTargetEntity(e->currentEntityTarget))
|
||||||
{
|
{
|
||||||
DamageData d;
|
DamageData d;
|
||||||
d.attacker = e;
|
d.attacker = e;
|
||||||
d.damage = lua_tointeger(L, 2);
|
d.damage = lua_tointeger(L, 2);
|
||||||
e->getTargetEntity(e->currentEntityTarget)->damage(d);
|
t->damage(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
|
@ -7665,12 +7673,32 @@ luaFunc(node_setElementsInLayerActive)
|
||||||
|
|
||||||
static int pushTileData(lua_State *L, const TileData& t, unsigned layer)
|
static int pushTileData(lua_State *L, const TileData& t, unsigned layer)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, t.et->idx);
|
/* 1 */ lua_pushinteger(L, t.et->idx);
|
||||||
lua_pushstring(L, t.et->tex->name.c_str());
|
/* 2 */ lua_pushstring(L, t.et->gfx.c_str());
|
||||||
lua_pushboolean(L, t.isVisible());
|
/* 3 */ lua_pushboolean(L, t.isVisible());
|
||||||
lua_pushinteger(L, layer);
|
/* 4 */ lua_pushinteger(L, layer);
|
||||||
lua_pushinteger(L, t.tag);
|
/* 5 */ lua_pushinteger(L, t.tag);
|
||||||
return 5;
|
/* 6 */ lua_pushnumber(L, t.x);
|
||||||
|
/* 7 */ lua_pushnumber(L, t.y);
|
||||||
|
/* 8 */ lua_pushnumber(L, t.scalex);
|
||||||
|
/* 9 */ lua_pushnumber(L, t.scaley);
|
||||||
|
/* 10 */ lua_pushnumber(L, t.rotation);
|
||||||
|
/* 11 */ lua_pushboolean(L, !!(t.flags & TILEFLAG_FH));
|
||||||
|
/* 12 */ lua_pushboolean(L, !!(t.flags & TILEFLAG_FV));
|
||||||
|
|
||||||
|
// 13, 14
|
||||||
|
if((t.flags & TILEFLAG_REPEAT) && t.rep)
|
||||||
|
{
|
||||||
|
lua_pushnumber(L, t.rep->texscaleX);
|
||||||
|
lua_pushnumber(L, t.rep->texscaleY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lua_pushnil(L);
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (layer, func)
|
// (layer, func)
|
||||||
|
@ -8349,6 +8377,34 @@ luaFunc(entity_exertHairForce)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// entity idx x y dt
|
||||||
|
luaFunc(entity_exertHairSegmentForce)
|
||||||
|
{
|
||||||
|
ScriptedEntity *se = scriptedEntity(L);
|
||||||
|
if (se)
|
||||||
|
{
|
||||||
|
if (se->hair)
|
||||||
|
se->hair->exertNodeForce(lua_tointeger(L, 2), Vector(lua_tonumber(L, 3), lua_tonumber(L, 4)), lua_tonumber(L, 5), lua_tonumber(L, 6));
|
||||||
|
}
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_setHairTextureFlip)
|
||||||
|
{
|
||||||
|
ScriptedEntity *se = scriptedEntity(L);
|
||||||
|
if (se && se->hair)
|
||||||
|
se->hair->setTextureFlip(getBool(L, 2));
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_setHairWidth)
|
||||||
|
{
|
||||||
|
ScriptedEntity *se = scriptedEntity(L);
|
||||||
|
if (se && se->hair)
|
||||||
|
se->hair->hairWidth = lua_tonumber(L, 2);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(entity_initPart)
|
luaFunc(entity_initPart)
|
||||||
{
|
{
|
||||||
std::string partName(getString(L, 2));
|
std::string partName(getString(L, 2));
|
||||||
|
@ -10719,6 +10775,9 @@ static const struct {
|
||||||
luaRegister(entity_setHairHeadPosition),
|
luaRegister(entity_setHairHeadPosition),
|
||||||
luaRegister(entity_updateHair),
|
luaRegister(entity_updateHair),
|
||||||
luaRegister(entity_exertHairForce),
|
luaRegister(entity_exertHairForce),
|
||||||
|
luaRegister(entity_exertHairSegmentForce),
|
||||||
|
luaRegister(entity_setHairTextureFlip),
|
||||||
|
luaRegister(entity_setHairWidth),
|
||||||
|
|
||||||
luaRegister(entity_setName),
|
luaRegister(entity_setName),
|
||||||
|
|
||||||
|
@ -11738,6 +11797,20 @@ static const struct {
|
||||||
luaConstant(PATHSHAPE_CIRCLE),
|
luaConstant(PATHSHAPE_CIRCLE),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static void luaRegisterEnums(lua_State *L, T first, T last)
|
||||||
|
{
|
||||||
|
assert(first <= last);
|
||||||
|
for(T i = first; i <= last; i = T(i + 1))
|
||||||
|
{
|
||||||
|
if(const char *name = EnumName(i))
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, i);
|
||||||
|
lua_setglobal(L, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
// F U N C T I O N S
|
// F U N C T I O N S
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
|
@ -11826,6 +11899,8 @@ lua_State *ScriptInterface::createLuaVM()
|
||||||
lua_pushnumber(state, luaConstantTable[i].value);
|
lua_pushnumber(state, luaConstantTable[i].value);
|
||||||
lua_setglobal(state, luaConstantTable[i].name);
|
lua_setglobal(state, luaConstantTable[i].name);
|
||||||
}
|
}
|
||||||
|
luaRegisterEnums(state, LR_ZERO, LR_MAX);
|
||||||
|
luaRegisterEnums(state, ACTION_PRIMARY, ACTION_MAX);
|
||||||
|
|
||||||
// Add hooks to monitor global get/set operations if requested.
|
// Add hooks to monitor global get/set operations if requested.
|
||||||
if (complainOnGlobalVar)
|
if (complainOnGlobalVar)
|
||||||
|
|
|
@ -688,7 +688,7 @@ void ScriptedEntity::entityDied(Entity *e)
|
||||||
{
|
{
|
||||||
CollideEntity::entityDied(e);
|
CollideEntity::entityDied(e);
|
||||||
|
|
||||||
if (script)
|
if (script && e != this && isv(EV_ENTITYDIED,1))
|
||||||
{
|
{
|
||||||
script->call("entityDied", this, e);
|
script->call("entityDied", this, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "StatsAndAchievements.h"
|
#include "StatsAndAchievements.h"
|
||||||
#include "ttvfs_stdio.h"
|
#include "ttvfs_stdio.h"
|
||||||
|
|
||||||
#ifndef ARRAYSIZE
|
|
||||||
#define ARRAYSIZE(x) (sizeof (x) / sizeof ((x)[0]))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _ACH_ID( id, name ) { id, #id, name, "", 0, 0 }
|
#define _ACH_ID( id, name ) { id, #id, name, "", 0, 0 }
|
||||||
|
|
||||||
static Achievement g_rgAchievements[] =
|
static Achievement g_rgAchievements[] =
|
||||||
|
@ -153,7 +149,7 @@ void StatsAndAchievements::RunFrame()
|
||||||
{
|
{
|
||||||
requestedStats = true;
|
requestedStats = true;
|
||||||
|
|
||||||
const size_t max_achievements = ARRAYSIZE(g_rgAchievements);
|
const size_t max_achievements = Countof(g_rgAchievements);
|
||||||
VFILE *io = NULL;
|
VFILE *io = NULL;
|
||||||
|
|
||||||
// Get generic achievement data...
|
// Get generic achievement data...
|
||||||
|
@ -229,7 +225,7 @@ void StatsAndAchievements::RunFrame()
|
||||||
// but only if we're not in a mod
|
// but only if we're not in a mod
|
||||||
if (!dsq->mod.isActive())
|
if (!dsq->mod.isActive())
|
||||||
{
|
{
|
||||||
for (size_t iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
for (size_t iAch = 0; iAch < Countof( g_rgAchievements ); ++iAch )
|
||||||
{
|
{
|
||||||
EvaluateAchievement( g_rgAchievements[iAch] );
|
EvaluateAchievement( g_rgAchievements[iAch] );
|
||||||
}
|
}
|
||||||
|
@ -252,7 +248,7 @@ void StatsAndAchievements::appendStringData(std::string &data)
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
data += "Unlocked:\n\n";
|
data += "Unlocked:\n\n";
|
||||||
for (size_t iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
for (size_t iAch = 0; iAch < Countof( g_rgAchievements ); ++iAch )
|
||||||
{
|
{
|
||||||
const Achievement &ach = g_rgAchievements[iAch];
|
const Achievement &ach = g_rgAchievements[iAch];
|
||||||
if (!ach.achieved)
|
if (!ach.achieved)
|
||||||
|
@ -271,7 +267,7 @@ void StatsAndAchievements::appendStringData(std::string &data)
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
data += "Locked:\n\n";
|
data += "Locked:\n\n";
|
||||||
for (size_t iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
for (size_t iAch = 0; iAch < Countof( g_rgAchievements ); ++iAch )
|
||||||
{
|
{
|
||||||
const Achievement &ach = g_rgAchievements[iAch];
|
const Achievement &ach = g_rgAchievements[iAch];
|
||||||
if (ach.achieved)
|
if (ach.achieved)
|
||||||
|
@ -812,7 +808,7 @@ void StatsAndAchievements::StoreStatsIfNecessary()
|
||||||
if (io == NULL)
|
if (io == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const size_t max_achievements = ARRAYSIZE(g_rgAchievements);
|
const size_t max_achievements = Countof(g_rgAchievements);
|
||||||
unsigned char *buf = new unsigned char[max_achievements];
|
unsigned char *buf = new unsigned char[max_achievements];
|
||||||
|
|
||||||
for (size_t i = 0; i < max_achievements; i++)
|
for (size_t i = 0; i < max_achievements; i++)
|
||||||
|
@ -828,7 +824,7 @@ void StatsAndAchievements::StoreStatsIfNecessary()
|
||||||
char cruft[101];
|
char cruft[101];
|
||||||
for (size_t i = 0; i < sizeof (cruft); i++)
|
for (size_t i = 0; i < sizeof (cruft); i++)
|
||||||
cruft[i] = (char) rand();
|
cruft[i] = (char) rand();
|
||||||
if (fwrite(cruft, sizeof (cruft[0]), ARRAYSIZE(cruft), io) != ARRAYSIZE(cruft))
|
if (fwrite(cruft, sizeof (cruft[0]), Countof(cruft), io) != Countof(cruft))
|
||||||
debugLog("Failed to write achievements 2");
|
debugLog("Failed to write achievements 2");
|
||||||
|
|
||||||
fclose(io);
|
fclose(io);
|
||||||
|
|
|
@ -8,7 +8,11 @@ SplineGridCtrlPoint *SplineGridCtrlPoint::movingPoint;
|
||||||
SplineGridCtrlPoint::SplineGridCtrlPoint()
|
SplineGridCtrlPoint::SplineGridCtrlPoint()
|
||||||
{
|
{
|
||||||
setTexture("gui/open-menu");
|
setTexture("gui/open-menu");
|
||||||
setWidthHeight(16, 16);
|
setWidthHeight(8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
SplineGridCtrlPoint::~SplineGridCtrlPoint()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector SplineGridCtrlPoint::getSplinePosition() const
|
Vector SplineGridCtrlPoint::getSplinePosition() const
|
||||||
|
@ -70,7 +74,7 @@ void SplineGridCtrlPoint::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
SplineGrid::SplineGrid()
|
SplineGrid::SplineGrid()
|
||||||
: wasModified(false), deg(0)
|
: wasModified(false), deg(0), pointscale(1)
|
||||||
{
|
{
|
||||||
setWidthHeight(128, 128);
|
setWidthHeight(128, 128);
|
||||||
renderQuad = true;
|
renderQuad = true;
|
||||||
|
@ -165,6 +169,8 @@ SplineGridCtrlPoint* SplineGrid::createControlPoint(size_t x, size_t y)
|
||||||
const Vector pos01(float(x) / float(cpx-1), float(y) / float(cpy-1));
|
const Vector pos01(float(x) / float(cpx-1), float(y) / float(cpy-1));
|
||||||
SplineGridCtrlPoint *cp = new SplineGridCtrlPoint();
|
SplineGridCtrlPoint *cp = new SplineGridCtrlPoint();
|
||||||
cp->position = (pos01 - Vector(0.5f, 0.5f)) * wh;
|
cp->position = (pos01 - Vector(0.5f, 0.5f)) * wh;
|
||||||
|
cp->scale.x = pointscale;
|
||||||
|
cp->scale.y = pointscale;
|
||||||
this->addChild(cp, PM_POINTER);
|
this->addChild(cp, PM_POINTER);
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
@ -214,4 +220,12 @@ void SplineGrid::onRender(const RenderState& rs) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplineGrid::setPointScale(const float scale)
|
||||||
|
{
|
||||||
|
pointscale = scale;
|
||||||
|
for(size_t i = 0; i < ctrlp.size(); ++i)
|
||||||
|
{
|
||||||
|
ctrlp[i]->scale.x = scale;
|
||||||
|
ctrlp[i]->scale.y = scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ class SplineGridCtrlPoint : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SplineGridCtrlPoint();
|
SplineGridCtrlPoint();
|
||||||
|
virtual ~SplineGridCtrlPoint();
|
||||||
virtual void onUpdate(float dt) OVERRIDE;
|
virtual void onUpdate(float dt) OVERRIDE;
|
||||||
Vector getSplinePosition() const;
|
Vector getSplinePosition() const;
|
||||||
void setSplinePosition(Vector pos);
|
void setSplinePosition(Vector pos);
|
||||||
|
@ -30,7 +31,7 @@ public:
|
||||||
typedef Vector value_type;
|
typedef Vector value_type;
|
||||||
|
|
||||||
SplineGrid();
|
SplineGrid();
|
||||||
~SplineGrid();
|
virtual ~SplineGrid();
|
||||||
|
|
||||||
// # of control points on each axis
|
// # of control points on each axis
|
||||||
DynamicRenderGrid *resize(size_t w, size_t h, size_t xres, size_t yres, unsigned degx, unsigned degy);
|
DynamicRenderGrid *resize(size_t w, size_t h, size_t xres, size_t yres, unsigned degx, unsigned degy);
|
||||||
|
@ -39,6 +40,9 @@ public:
|
||||||
void importControlPoints(const Vector *controlpoints);
|
void importControlPoints(const Vector *controlpoints);
|
||||||
void resetControlPoints();
|
void resetControlPoints();
|
||||||
|
|
||||||
|
void setPointScale(const float scale);
|
||||||
|
float getPointScale() const { return pointscale; }
|
||||||
|
|
||||||
|
|
||||||
virtual void onRender(const RenderState& rs) const OVERRIDE;
|
virtual void onRender(const RenderState& rs) const OVERRIDE;
|
||||||
virtual void onUpdate(float dt) OVERRIDE;
|
virtual void onUpdate(float dt) OVERRIDE;
|
||||||
|
@ -55,6 +59,7 @@ private:
|
||||||
std::vector<SplineGridCtrlPoint*> ctrlp;
|
std::vector<SplineGridCtrlPoint*> ctrlp;
|
||||||
unsigned deg;
|
unsigned deg;
|
||||||
BSpline2DWithPoints bsp;
|
BSpline2DWithPoints bsp;
|
||||||
|
float pointscale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue