mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-25 15:33:57 +00:00
More extensions to script interface:
- obj_fadeAlphaWithLife() - obj_setOverrideRenderPass() - setLayerRenderPass() - debugBreak() - saveMenu() - setGemPosition() - removeGem()
This commit is contained in:
parent
51ee827d98
commit
0431932b2b
6 changed files with 131 additions and 3 deletions
|
@ -1496,8 +1496,7 @@ This build is not yet final, and as such there are a couple things lacking. They
|
|||
|
||||
loadBit(LOAD_TEXTURES);
|
||||
|
||||
renderObjectLayers[LR_ENTITIES].startPass = -2;
|
||||
renderObjectLayers[LR_ENTITIES].endPass = 5;
|
||||
resetLayerPasses();
|
||||
|
||||
renderObjectLayerOrder[LR_BACKGROUND_ELEMENTS1] = LR_ELEMENTS1;
|
||||
renderObjectLayerOrder[LR_BACKGROUND_ELEMENTS2] = LR_ELEMENTS2;
|
||||
|
@ -5139,3 +5138,13 @@ void DSQ::onBackgroundUpdate()
|
|||
Core::onBackgroundUpdate();
|
||||
}
|
||||
|
||||
void DSQ::resetLayerPasses()
|
||||
{
|
||||
for(size_t i = 0; i < renderObjectLayers.size(); ++i)
|
||||
{
|
||||
renderObjectLayers[i].startPass = 0;
|
||||
renderObjectLayers[i].endPass = 0;
|
||||
}
|
||||
renderObjectLayers[LR_ENTITIES].startPass = -2;
|
||||
renderObjectLayers[LR_ENTITIES].endPass = 5;
|
||||
}
|
||||
|
|
|
@ -1567,6 +1567,8 @@ public:
|
|||
|
||||
virtual void onBackgroundUpdate();
|
||||
|
||||
void resetLayerPasses();
|
||||
|
||||
protected:
|
||||
|
||||
Quad *cutscene_bg;
|
||||
|
|
|
@ -6127,6 +6127,8 @@ void Game::applyState()
|
|||
l->followCameraLock = 0;
|
||||
}
|
||||
|
||||
dsq->resetLayerPasses();
|
||||
|
||||
cameraLerpDelay = 0;
|
||||
playingSongInMenu = -1;
|
||||
sceneColor2 = Vector(1,1,1);
|
||||
|
|
|
@ -18,6 +18,7 @@ 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.
|
||||
*/
|
||||
|
||||
#include "ScriptInterface.h"
|
||||
#include "../BBGE/ScriptObject.h"
|
||||
extern "C"
|
||||
|
@ -1314,6 +1315,15 @@ luaFunc(obj_setRenderPass)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(obj_setOverrideRenderPass)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
int pass = lua_tointeger(L, 2);
|
||||
if (r)
|
||||
r->setOverrideRenderPass(pass);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(obj_fh)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
|
@ -1462,7 +1472,6 @@ luaFunc(obj_collideCircleVsLine)
|
|||
luaReturnBool(v);
|
||||
}
|
||||
|
||||
|
||||
luaFunc(obj_collideCircleVsLineAngle)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
|
@ -1476,6 +1485,14 @@ luaFunc(obj_collideCircleVsLineAngle)
|
|||
luaReturnBool(v);
|
||||
}
|
||||
|
||||
luaFunc(obj_fadeAlphaWithLife)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
if (r)
|
||||
r->fadeAlphaWithLife = getBool(L, 2);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
||||
// ----- end RenderObject common functions -----
|
||||
|
||||
|
@ -1612,6 +1629,7 @@ luaFunc(quad_setSegs)
|
|||
RO_FUNC(getter, prefix, setCullRadius ) \
|
||||
RO_FUNC(getter, prefix, setUpdateCull ) \
|
||||
RO_FUNC(getter, prefix, setRenderPass ) \
|
||||
RO_FUNC(getter, prefix, setOverrideRenderPass ) \
|
||||
RO_FUNC(getter, prefix, setPositionX ) \
|
||||
RO_FUNC(getter, prefix, setPositionY ) \
|
||||
RO_FUNC(getter, prefix, enableMotionBlur ) \
|
||||
|
@ -1619,6 +1637,7 @@ luaFunc(quad_setSegs)
|
|||
RO_FUNC(getter, prefix, collideCircleVsLine) \
|
||||
RO_FUNC(getter, prefix, collideCircleVsLineAngle) \
|
||||
RO_FUNC(getter, prefix, getVectorToObj ) \
|
||||
RO_FUNC(getter, prefix, fadeAlphaWithLife ) \
|
||||
MK_ALIAS(prefix, fh, flipHorizontal ) \
|
||||
MK_ALIAS(prefix, fv, flipVertical )
|
||||
|
||||
|
@ -1647,6 +1666,14 @@ luaFunc(quad_setSegs)
|
|||
EXPAND_FUNC_PROTOTYPES
|
||||
|
||||
|
||||
luaFunc(debugBreak)
|
||||
{
|
||||
debugLog("DEBUG BREAK");
|
||||
triggerBreakpoint();
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
||||
luaFunc(randRange)
|
||||
{
|
||||
int n1 = lua_tointeger(L, 1);
|
||||
|
@ -3910,6 +3937,12 @@ luaFunc(savePoint)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(saveMenu)
|
||||
{
|
||||
dsq->doSaveSlotMenu(SSM_SAVE);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(pause)
|
||||
{
|
||||
dsq->game->togglePause(1);
|
||||
|
@ -7443,6 +7476,52 @@ luaFunc(pickupGem)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(setGemPosition)
|
||||
{
|
||||
int gemId = lua_tointeger(L, 1);
|
||||
std::string mapname = getString(L, 4);
|
||||
if(mapname.empty())
|
||||
mapname = dsq->game->sceneName;
|
||||
Vector pos(lua_tonumber(L, 2), lua_tonumber(L, 3));
|
||||
|
||||
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(getString(L, 1));
|
||||
if(tile)
|
||||
{
|
||||
pos = dsq->game->worldMapRender->getWorldToTile(tile, pos, true, true);
|
||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
||||
{
|
||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||
std::advance(it, gemId);
|
||||
GemData& gem = *it;
|
||||
gem.pos = pos;
|
||||
gem.mapName = mapname;
|
||||
}
|
||||
else
|
||||
{
|
||||
debugLog("setGemPosition: invalid index");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugLog("setGemPosition: Map tile does not exist: " + mapname);
|
||||
}
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(removeGem)
|
||||
{
|
||||
int gemId = lua_tointeger(L, 1);
|
||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
||||
{
|
||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||
std::advance(it, gemId);
|
||||
dsq->continuity.removeGemData(&(*it));
|
||||
if(dsq->game->worldMapRender->isOn())
|
||||
dsq->game->worldMapRender->fixGems();
|
||||
}
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(beaconEffect)
|
||||
{
|
||||
int index = lua_tointeger(L, 1);
|
||||
|
@ -7504,6 +7583,19 @@ luaFunc(setCostume)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(setLayerRenderPass)
|
||||
{
|
||||
int layer = lua_tointeger(L, 1);
|
||||
int startPass = lua_tointeger(L, 2);
|
||||
int endPass = lua_tointeger(L, 3);
|
||||
if(layer >= 0 && layer < core->renderObjectLayers.size())
|
||||
{
|
||||
core->renderObjectLayers[layer].startPass = startPass;
|
||||
core->renderObjectLayers[layer].endPass = endPass;
|
||||
}
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(setElementLayerVisible)
|
||||
{
|
||||
int l = lua_tonumber(L, 1);
|
||||
|
@ -7951,6 +8043,8 @@ static const struct {
|
|||
{"dofile", l_dofile_caseinsensitive},
|
||||
{"loadfile", l_loadfile_caseinsensitive},
|
||||
|
||||
luaRegister(debugBreak),
|
||||
|
||||
luaRegister(shakeCamera),
|
||||
luaRegister(upgradeHealth),
|
||||
|
||||
|
@ -8397,6 +8491,7 @@ static const struct {
|
|||
|
||||
|
||||
luaRegister(savePoint),
|
||||
luaRegister(saveMenu),
|
||||
luaRegister(wait),
|
||||
luaRegister(watch),
|
||||
|
||||
|
@ -8408,6 +8503,7 @@ static const struct {
|
|||
luaRegister(centerText),
|
||||
luaRegister(watchForVoice),
|
||||
|
||||
luaRegister(setLayerRenderPass),
|
||||
luaRegister(setElementLayerVisible),
|
||||
luaRegister(isElementLayerVisible),
|
||||
|
||||
|
@ -8416,6 +8512,8 @@ static const struct {
|
|||
|
||||
|
||||
luaRegister(pickupGem),
|
||||
luaRegister(setGemPosition),
|
||||
luaRegister(removeGem),
|
||||
luaRegister(setBeacon),
|
||||
luaRegister(getBeacon),
|
||||
luaRegister(beaconEffect),
|
||||
|
|
|
@ -26,6 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(BBGE_BUILD_UNIX)
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
@ -1117,6 +1121,16 @@ std::string spacesToUnderscores(const std::string &str)
|
|||
return s;
|
||||
}
|
||||
|
||||
void triggerBreakpoint()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__debugbreak();
|
||||
#elif defined(__GNUC__) && ((__i386__) || (__x86_64__))
|
||||
__asm__ __volatile__ ( "int $3\n\t" );
|
||||
#else
|
||||
raise(SIGTRAP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#include "DeflateCompressor.h"
|
||||
|
|
|
@ -296,4 +296,7 @@ void openURL(const std::string &url);
|
|||
std::string underscoresToSpaces(const std::string &str);
|
||||
std::string spacesToUnderscores(const std::string &str);
|
||||
|
||||
void triggerBreakpoint();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue