1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-26 14:45:48 +00:00

Respect more nodes' active status: PATH_STEAM, PATH_WARP, PATH_RADARHIDE, PATH_WATERBUBBLE, PATH_ZOOM.

These nodes will no longer do their thing if active is set to false.
node_[is|set]EffectOn() is now an alias for the node_[is|set]Active() functions.

Also add getMaxCameraValues() Lua function.
This commit is contained in:
fgenesis 2014-03-06 22:31:22 +01:00
parent 429f612065
commit b501ba67e3
8 changed files with 27 additions and 30 deletions

View file

@ -7200,10 +7200,10 @@ bool Avatar::checkWarpAreas()
{ {
bool warp = false; bool warp = false;
Path *p = dsq->game->getPath(i); Path *p = dsq->game->getPath(i);
if (!p->nodes.empty()) if (p && p->active && !p->nodes.empty())
{ {
PathNode *n = &p->nodes[0]; PathNode *n = &p->nodes[0];
if (p && n) if (n)
{ {
Vector backPos; Vector backPos;
if (!p->vox.empty()) if (!p->vox.empty())

View file

@ -2193,7 +2193,7 @@ bool Entity::isUnderWater(const Vector &override)
Path *p = dsq->game->getNearestPath(position, PATH_WATERBUBBLE); Path *p = dsq->game->getNearestPath(position, PATH_WATERBUBBLE);
if (p != 0 && p->isCoordinateInside(position, collideRadius)) if (p && p->active && p->isCoordinateInside(position, collideRadius))
{ {
waterBubble = p; waterBubble = p;
return true; return true;

View file

@ -5736,7 +5736,7 @@ int game_collideParticle(Vector pos)
if (!aboveWaterLine) if (!aboveWaterLine)
{ {
Path *p = dsq->game->getNearestPath(pos, PATH_WATERBUBBLE); Path *p = dsq->game->getNearestPath(pos, PATH_WATERBUBBLE);
if (p) if (p && p->active)
{ {
if (p->isCoordinateInside(pos)) if (p->isCoordinateInside(pos))
{ {

View file

@ -273,7 +273,7 @@ void MiniMapRender::onUpdate(float dt)
{ {
for (Path *p = dsq->game->getFirstPathOfType(PATH_RADARHIDE); p; p = p->nextOfType) for (Path *p = dsq->game->getFirstPathOfType(PATH_RADARHIDE); p; p = p->nextOfType)
{ {
if (p->isCoordinateInside(dsq->game->avatar->position)) if (p->active && p->isCoordinateInside(dsq->game->avatar->position))
{ {
radarHide = true; radarHide = true;
break; break;

View file

@ -25,7 +25,6 @@ Path::Path()
{ {
addType(SCO_PATH); addType(SCO_PATH);
localWarpType = LOCALWARP_NONE; localWarpType = LOCALWARP_NONE;
effectOn = true;
time = 0; time = 0;
naijaIn = false; naijaIn = false;
amount = 0; amount = 0;
@ -538,7 +537,7 @@ void Path::update(float dt)
} }
} }
} }
if (pathType == PATH_ZOOM && dsq->game->avatar) if (active && pathType == PATH_ZOOM && dsq->game->avatar)
{ {
if (isCoordinateInside(dsq->game->avatar->position)) if (isCoordinateInside(dsq->game->avatar->position))
{ {
@ -555,7 +554,7 @@ void Path::update(float dt)
} }
} }
if (pathType == PATH_STEAM && !dsq->game->isWorldPaused() && effectOn) if (active && pathType == PATH_STEAM && !dsq->game->isWorldPaused())
{ {
animOffset -= 1000*0.00002f; animOffset -= 1000*0.00002f;

View file

@ -90,8 +90,6 @@ public:
void setActive(bool v); void setActive(bool v);
bool action(int id, int state); bool action(int id, int state);
void setEffectOn(bool on) { effectOn = on; }
PathNode *getPathNode(int idx); PathNode *getPathNode(int idx);
bool isCoordinateInside(const Vector &pos, int rad=0); bool isCoordinateInside(const Vector &pos, int rad=0);
@ -142,7 +140,6 @@ public:
std::string gem; std::string gem;
bool effectOn;
bool spiritFreeze; bool spiritFreeze;
bool pauseFreeze; bool pauseFreeze;

View file

@ -693,6 +693,7 @@ static void safePath(lua_State *L, const std::string& path)
#define luaReturnStr(str) do {lua_pushstring(L, (str)); return 1;} while(0) #define luaReturnStr(str) do {lua_pushstring(L, (str)); return 1;} while(0)
#define luaReturnVec2(x,y) do {lua_pushnumber(L, (x)); lua_pushnumber(L, (y)); return 2;} while(0) #define luaReturnVec2(x,y) do {lua_pushnumber(L, (x)); lua_pushnumber(L, (y)); return 2;} while(0)
#define luaReturnVec3(x,y,z) do {lua_pushnumber(L, (x)); lua_pushnumber(L, (y)); lua_pushnumber(L, (z)); return 3;} while(0) #define luaReturnVec3(x,y,z) do {lua_pushnumber(L, (x)); lua_pushnumber(L, (y)); lua_pushnumber(L, (z)); return 3;} while(0)
#define luaReturnVec4(x,y,z,w) do {lua_pushnumber(L, (x)); lua_pushnumber(L, (y)); lua_pushnumber(L, (z)); lua_pushnumber(L, (w)); return 4;} while(0)
#define luaReturnNil() return 0; #define luaReturnNil() return 0;
// Set the global "v" to the instance's local variable table. Must be // Set the global "v" to the instance's local variable table. Must be
@ -4754,6 +4755,12 @@ luaFunc(node_setActive)
luaReturnNil(); luaReturnNil();
} }
luaFunc(node_isActive)
{
Path *p = path(L);
luaReturnBool(p ? p->active : false);
}
luaFunc(node_setCursorActivation) luaFunc(node_setCursorActivation)
{ {
Path *p = path(L); Path *p = path(L);
@ -5516,7 +5523,7 @@ luaFunc(entity_isInRect)
{ {
Entity *e = entity(L); Entity *e = entity(L);
bool v= false; bool v= false;
int x1, y1, x2, y2; float x1, y1, x2, y2;
x1 = lua_tonumber(L, 2); x1 = lua_tonumber(L, 2);
y1 = lua_tonumber(L, 3); y1 = lua_tonumber(L, 3);
x2 = lua_tonumber(L, 4); x2 = lua_tonumber(L, 4);
@ -7203,20 +7210,6 @@ luaFunc(getEntityByID)
luaReturnPtr(found); luaReturnPtr(found);
} }
luaFunc(node_setEffectOn)
{
Path *p = path(L, 1);
if (p)
p->setEffectOn(getBool(L, 2));
luaReturnNil();
}
luaFunc(node_isEffectOn)
{
Path *p = path(L, 1);
luaReturnBool(p ? p->effectOn : false);
}
luaFunc(node_activate) luaFunc(node_activate)
{ {
Path *p = path(L); Path *p = path(L);
@ -7503,7 +7496,7 @@ luaFunc(toggleSteam)
bool on = getBool(L, 1); bool on = getBool(L, 1);
for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType) for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType)
{ {
p->setEffectOn(on); p->setActive(on);
} }
luaReturnBool(on); luaReturnBool(on);
} }
@ -8610,6 +8603,11 @@ luaFunc(getUserInputString)
luaReturnStr(dsq->getUserInputString(getString(L, 1), getString(L, 2), true).c_str()); luaReturnStr(dsq->getUserInputString(getString(L, 1), getString(L, 2), true).c_str());
} }
luaFunc(getMaxCameraValues)
{
luaReturnVec4(dsq->game->cameraMin.x, dsq->game->cameraMin.y, dsq->game->cameraMax.x, dsq->game->cameraMax.y);
}
luaFunc(inv_isFull) luaFunc(inv_isFull)
{ {
@ -9426,6 +9424,7 @@ static const struct {
luaRegister(findPath), luaRegister(findPath),
luaRegister(castLine), luaRegister(castLine),
luaRegister(getUserInputString), luaRegister(getUserInputString),
luaRegister(getMaxCameraValues),
luaRegister(isFlag), luaRegister(isFlag),
@ -9640,8 +9639,6 @@ static const struct {
luaRegister(node_getContent), luaRegister(node_getContent),
luaRegister(node_getAmount), luaRegister(node_getAmount),
luaRegister(node_getSize), luaRegister(node_getSize),
luaRegister(node_setEffectOn),
luaRegister(node_isEffectOn),
luaRegister(node_getShape), luaRegister(node_getShape),
luaRegister(toggleSteam), luaRegister(toggleSteam),
@ -9674,6 +9671,7 @@ static const struct {
luaRegister(entity_changeHealth), luaRegister(entity_changeHealth),
luaRegister(node_setActive), luaRegister(node_setActive),
luaRegister(node_isActive),
luaRegister(setSceneColor), luaRegister(setSceneColor),
@ -9885,6 +9883,9 @@ static const struct {
{"bone_setColor", l_bone_color}, {"bone_setColor", l_bone_color},
{"node_setEffectOn", l_node_setActive},
{"node_isEffectOn", l_node_isActive},
}; };
//============================================================================================ //============================================================================================

View file

@ -46,7 +46,7 @@ void SteamRender::onRender()
for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType) for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType)
{ {
if (p->effectOn) if (p->active)
{ {
int w2 = p->rect.getWidth()/2; int w2 = p->rect.getWidth()/2;