1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 22:19:07 +00:00

Add Lua functions: getZoom(), setMaxLookDistance()

This commit is contained in:
fgenesis 2014-03-08 02:17:20 +01:00
parent 2cec85fd05
commit b95dfee4c6
3 changed files with 17 additions and 1 deletions

View file

@ -6175,6 +6175,7 @@ void Game::applyState()
backgroundImageRepeat = 1; backgroundImageRepeat = 1;
grad = 0; grad = 0;
maxZoom = -1; maxZoom = -1;
maxLookDistance = 600;
saveFile = 0; saveFile = 0;
deathTimer = 0.9; deathTimer = 0.9;
runGameOverScript = false; runGameOverScript = false;
@ -10301,7 +10302,7 @@ void Game::update(float dt)
{ {
if (avatar->looking && !dsq->game->isPaused()) { if (avatar->looking && !dsq->game->isPaused()) {
Vector diff = avatar->getAim();//dsq->getGameCursorPosition() - avatar->position; Vector diff = avatar->getAim();//dsq->getGameCursorPosition() - avatar->position;
diff.capLength2D(600); diff.capLength2D(maxLookDistance);
dest += diff; dest += diff;
} }
else { else {

View file

@ -708,6 +708,7 @@ public:
void resetFromTitle(); void resetFromTitle();
float maxZoom; float maxZoom;
float maxLookDistance;
void setParallaxTextureCoordinates(Quad *q, float speed); void setParallaxTextureCoordinates(Quad *q, float speed);

View file

@ -5964,12 +5964,24 @@ luaFunc(overrideZoom)
luaReturnNil(); luaReturnNil();
} }
luaFunc(getZoom)
{
luaReturnNum(dsq->globalScale.x);
}
luaFunc(disableOverrideZoom) luaFunc(disableOverrideZoom)
{ {
dsq->game->toggleOverrideZoom(false); dsq->game->toggleOverrideZoom(false);
luaReturnNil(); luaReturnNil();
} }
luaFunc(setMaxLookDistance)
{
dsq->game->maxLookDistance = lua_tonumber(L, 1);
luaReturnNil();
}
// dt, range, mod // dt, range, mod
luaFunc(entity_doSpellAvoidance) luaFunc(entity_doSpellAvoidance)
{ {
@ -9713,6 +9725,8 @@ static const struct {
luaRegister(overrideZoom), luaRegister(overrideZoom),
luaRegister(disableOverrideZoom), luaRegister(disableOverrideZoom),
luaRegister(getZoom),
luaRegister(setMaxLookDistance),