mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-12 12:03:56 +00:00
Merge branch 'experimental' of file:///Users/User/code/coding/Aquaria_fg_clean into experimental
This commit is contained in:
commit
fac96e3d51
19 changed files with 99 additions and 151 deletions
|
@ -593,6 +593,7 @@ void AnimationEditor::zoomOut()
|
||||||
if (dsq->isNested()) return;
|
if (dsq->isNested()) return;
|
||||||
|
|
||||||
core->globalScale -= Vector(ANIM_EDIT_ZOOM, ANIM_EDIT_ZOOM);
|
core->globalScale -= Vector(ANIM_EDIT_ZOOM, ANIM_EDIT_ZOOM);
|
||||||
|
core->globalScaleChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationEditor::zoomIn()
|
void AnimationEditor::zoomIn()
|
||||||
|
@ -600,6 +601,7 @@ void AnimationEditor::zoomIn()
|
||||||
if (dsq->isNested()) return;
|
if (dsq->isNested()) return;
|
||||||
|
|
||||||
core->globalScale += Vector(ANIM_EDIT_ZOOM, ANIM_EDIT_ZOOM);
|
core->globalScale += Vector(ANIM_EDIT_ZOOM, ANIM_EDIT_ZOOM);
|
||||||
|
core->globalScaleChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationEditor::reorderKeys()
|
void AnimationEditor::reorderKeys()
|
||||||
|
|
|
@ -2508,6 +2508,7 @@ void Avatar::formAbility(int ability)
|
||||||
dsq->shakeCamera(25, 2);
|
dsq->shakeCamera(25, 2);
|
||||||
|
|
||||||
core->globalScale = Vector(0.4, 0.4);
|
core->globalScale = Vector(0.4, 0.4);
|
||||||
|
core->globalScaleChanged();
|
||||||
myZoom = Vector(0.4, 0.4);
|
myZoom = Vector(0.4, 0.4);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4214,20 +4215,6 @@ void Avatar::destroy()
|
||||||
avatar = 0;
|
avatar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::toggleZoom()
|
|
||||||
{
|
|
||||||
if (core->globalScale.isInterpolating()) return;
|
|
||||||
if (core->globalScale.x == 1)
|
|
||||||
core->globalScale.interpolateTo(Vector(0.75,0.75),0.2);
|
|
||||||
else if (core->globalScale.x == 0.75)
|
|
||||||
core->globalScale.interpolateTo(Vector(0.5,0.5),0.2);
|
|
||||||
else if (core->globalScale.x == 0.5)
|
|
||||||
core->globalScale.interpolateTo(Vector(0.25,0.25),0.2);
|
|
||||||
else if (core->globalScale.x == 0.25)
|
|
||||||
core->globalScale.interpolateTo(Vector(1,1),0.2);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Avatar::startBackFlip()
|
void Avatar::startBackFlip()
|
||||||
{
|
{
|
||||||
if (boneLock.on) return;
|
if (boneLock.on) return;
|
||||||
|
@ -6887,6 +6874,7 @@ void Avatar::onUpdate(float dt)
|
||||||
core->globalScale.x = myZoom.x;
|
core->globalScale.x = myZoom.x;
|
||||||
core->globalScale.y = myZoom.y;
|
core->globalScale.y = myZoom.y;
|
||||||
}
|
}
|
||||||
|
core->globalScaleChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7200,10 +7188,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())
|
||||||
|
|
|
@ -442,7 +442,6 @@ protected:
|
||||||
int getBeamWidth();
|
int getBeamWidth();
|
||||||
Vector getWallNormal(TileVector t);
|
Vector getWallNormal(TileVector t);
|
||||||
bool checkWarpAreas();
|
bool checkWarpAreas();
|
||||||
void toggleZoom();
|
|
||||||
|
|
||||||
float splashDelay;
|
float splashDelay;
|
||||||
//Hair *hair;
|
//Hair *hair;
|
||||||
|
|
|
@ -357,28 +357,6 @@ ElementEffect DSQ::getElementEffectByIndex(int e)
|
||||||
|
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
Element *DSQ::getSolidElementNear(Vector pos, int rad)
|
|
||||||
{
|
|
||||||
Element *closestE = 0;
|
|
||||||
int closestDist = -1;
|
|
||||||
for (int i = 0; i < elements.size(); i++)
|
|
||||||
{
|
|
||||||
Element *e = elements[i];
|
|
||||||
int dist = (e->position - pos).getSquaredLength2D();
|
|
||||||
if (e->isElementActive() && e->elementFlag == EF_SOLID && dist < sqr(rad) && (dist < closestDist || closestDist==-1))
|
|
||||||
{
|
|
||||||
closestDist = dist;
|
|
||||||
closestE = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return closestE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Vector DSQ::getCameraCenter()
|
|
||||||
{
|
|
||||||
return cameraPos; //+ Vector(400*(1.0f/core->globalScale.x),300*(1.0f/core->globalScale.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSQ::centerMessage(const std::string &text, float y, int type)
|
void DSQ::centerMessage(const std::string &text, float y, int type)
|
||||||
{
|
{
|
||||||
|
@ -703,7 +681,7 @@ void DSQ::debugMenu()
|
||||||
Entity *e = dsq->getEntityByNameNoCase(entityName);
|
Entity *e = dsq->getEntityByNameNoCase(entityName);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
dsq->cameraPos = e->position;
|
dsq->cameraPos = game->getCameraPositionFor(e->position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == 'C')
|
else if (c == 'C')
|
||||||
|
|
|
@ -1360,7 +1360,6 @@ public:
|
||||||
std::string getEntityFlagName(Entity *e);
|
std::string getEntityFlagName(Entity *e);
|
||||||
std::string getUserInputString(std::string label, std::string t="", bool allowNonLowerCase=false);
|
std::string getUserInputString(std::string label, std::string t="", bool allowNonLowerCase=false);
|
||||||
Vector getUserInputDirection(std::string label);
|
Vector getUserInputDirection(std::string label);
|
||||||
Vector getCameraCenter();
|
|
||||||
bool onPickedSaveSlot(AquariaSaveSlot *slot);
|
bool onPickedSaveSlot(AquariaSaveSlot *slot);
|
||||||
void doSaveSlotMenu(SaveSlotMode ssm, const Vector &position = Vector(0,0,0));
|
void doSaveSlotMenu(SaveSlotMode ssm, const Vector &position = Vector(0,0,0));
|
||||||
void doModSelect();
|
void doModSelect();
|
||||||
|
@ -1377,7 +1376,6 @@ public:
|
||||||
std::string getDialogueFilename(const std::string &f);
|
std::string getDialogueFilename(const std::string &f);
|
||||||
|
|
||||||
bool isShakingCamera();
|
bool isShakingCamera();
|
||||||
//Element *getSolidElementNear(Vector pos, int rad);
|
|
||||||
|
|
||||||
std::string languagePack;
|
std::string languagePack;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
@ -6670,13 +6671,13 @@ void Game::applyState()
|
||||||
|
|
||||||
core->cacheRender();
|
core->cacheRender();
|
||||||
|
|
||||||
core->cameraPos.stop();
|
|
||||||
cameraInterp.stop();
|
cameraInterp.stop();
|
||||||
|
|
||||||
core->globalScale = dsq->continuity.zoom;
|
core->globalScale = dsq->continuity.zoom;
|
||||||
|
//core->globalScaleChanged();
|
||||||
avatar->myZoom = dsq->continuity.zoom;
|
avatar->myZoom = dsq->continuity.zoom;
|
||||||
|
|
||||||
cameraInterp = getCameraPositionFor(avatar->position);
|
cameraInterp = avatar->position;
|
||||||
core->cameraPos = getCameraPositionFor(avatar->position);
|
core->cameraPos = getCameraPositionFor(avatar->position);
|
||||||
|
|
||||||
core->sort();
|
core->sort();
|
||||||
|
@ -7450,7 +7451,9 @@ void Game::overrideZoom(float sz, float t)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dsq->game->toggleOverrideZoom(true);
|
dsq->game->toggleOverrideZoom(true);
|
||||||
|
dsq->globalScale.stop();
|
||||||
dsq->globalScale.interpolateTo(Vector(sz, sz), t);
|
dsq->globalScale.interpolateTo(Vector(sz, sz), t);
|
||||||
|
dsq->globalScaleChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8535,13 +8538,7 @@ void Game::toggleGridRender()
|
||||||
|
|
||||||
Vector Game::getCameraPositionFor(const Vector &pos)
|
Vector Game::getCameraPositionFor(const Vector &pos)
|
||||||
{
|
{
|
||||||
Vector dest = pos;
|
return Vector(pos.x - 400 * core->invGlobalScale, pos.y - 300 * core->invGlobalScale, 0);
|
||||||
|
|
||||||
Vector v;
|
|
||||||
dest += v + Vector(-400/core->globalScale.x,-300/core->globalScale.y);
|
|
||||||
dest.z = 0;
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::setParallaxTextureCoordinates(Quad *q, float speed)
|
void Game::setParallaxTextureCoordinates(Quad *q, float speed)
|
||||||
|
@ -10296,16 +10293,16 @@ void Game::update(float dt)
|
||||||
{
|
{
|
||||||
if (!isPaused())
|
if (!isPaused())
|
||||||
waterLevel.update(dt);
|
waterLevel.update(dt);
|
||||||
cameraInterp.update(dt);
|
|
||||||
if (cameraFollow)
|
if (cameraFollow)
|
||||||
{
|
{
|
||||||
Vector dest = getCameraPositionFor(*cameraFollow);
|
Vector dest = *cameraFollow;
|
||||||
|
|
||||||
if (avatar)
|
if (avatar)
|
||||||
{
|
{
|
||||||
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 {
|
||||||
|
@ -10313,43 +10310,21 @@ void Game::update(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (avatar)
|
|
||||||
{
|
|
||||||
if (!dsq->game->isPaused() && core->mouse.buttons.middle && !dsq->game->avatar->isSinging() && dsq->game->avatar->isInputEnabled())
|
|
||||||
{
|
|
||||||
Vector diff = avatar->getAim();//dsq->getGameCursorPosition() - avatar->position;
|
|
||||||
diff.capLength2D(600);
|
|
||||||
|
|
||||||
avatar->looking = 1;
|
|
||||||
dest += diff;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
avatar->looking = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if (cameraLerpDelay==0)
|
if (cameraLerpDelay==0)
|
||||||
{
|
{
|
||||||
//cameraLerpDelay = 0.15;
|
//cameraLerpDelay = 0.15;
|
||||||
cameraLerpDelay = vars->defaultCameraLerpDelay;
|
cameraLerpDelay = vars->defaultCameraLerpDelay;
|
||||||
}
|
}
|
||||||
|
Vector oldCamPos = dsq->cameraPos;
|
||||||
|
cameraInterp.stop();
|
||||||
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
||||||
|
dsq->cameraPos = getCameraPositionFor(cameraInterp);
|
||||||
dsq->cameraPos.x = cameraInterp.x;
|
|
||||||
dsq->cameraPos.y = cameraInterp.y;
|
|
||||||
|
|
||||||
// constrainCamera
|
|
||||||
constrainCamera();
|
constrainCamera();
|
||||||
/*
|
|
||||||
if (cam_region)
|
float dd = (dsq->cameraPos - oldCamPos).getLength2D();
|
||||||
ConstrainToRegion(&ek->cameraPos, cam_region, core->getVirtualWidth()*(core->globalScale.x), core->getVirtualHeight()*(core->globalScale.y));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cameraInterp.update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10484,20 +10459,14 @@ void Game::warpCameraTo(RenderObject *r)
|
||||||
void Game::warpCameraTo(Vector position)
|
void Game::warpCameraTo(Vector position)
|
||||||
{
|
{
|
||||||
cameraInterp.stop();
|
cameraInterp.stop();
|
||||||
cameraInterp = getCameraPositionFor(position);
|
cameraInterp = position;
|
||||||
dsq->cameraPos.x = cameraInterp.x;
|
dsq->cameraPos = getCameraPositionFor(position);
|
||||||
dsq->cameraPos.y = cameraInterp.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::snapCam()
|
void Game::snapCam()
|
||||||
{
|
{
|
||||||
if (cameraFollow)
|
if (cameraFollow)
|
||||||
{
|
warpCameraTo(*cameraFollow);
|
||||||
Vector p = getCameraPositionFor(*cameraFollow);
|
|
||||||
cameraInterp.interpolateTo(p,0);
|
|
||||||
cameraInterp = p;
|
|
||||||
core->cameraPos = p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementTemplate Game::getElementTemplateForLetter(int i)
|
ElementTemplate Game::getElementTemplateForLetter(int i)
|
||||||
|
@ -10758,6 +10727,7 @@ void Game::removeState()
|
||||||
|
|
||||||
dsq->game->avatar->myZoom = Vector(1,1);
|
dsq->game->avatar->myZoom = Vector(1,1);
|
||||||
dsq->globalScale = Vector(1,1);
|
dsq->globalScale = Vector(1,1);
|
||||||
|
core->globalScaleChanged();
|
||||||
|
|
||||||
for (int i = 0; i < getNumPaths(); i++)
|
for (int i = 0; i < getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -2960,6 +2960,7 @@ void SceneEditor::toggle(bool on)
|
||||||
core->cameraPos.x += cameraOffset * core->getVirtualWidth()/2;
|
core->cameraPos.x += cameraOffset * core->getVirtualWidth()/2;
|
||||||
core->cameraPos.y += cameraOffset * core->getVirtualHeight()/2;
|
core->cameraPos.y += cameraOffset * core->getVirtualHeight()/2;
|
||||||
core->globalScale = zoom;
|
core->globalScale = zoom;
|
||||||
|
core->globalScaleChanged();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3230,6 +3231,7 @@ void SceneEditor::update(float dt)
|
||||||
if (zoom.x < 0.04f)
|
if (zoom.x < 0.04f)
|
||||||
zoom.x = zoom.y = 0.04f;
|
zoom.x = zoom.y = 0.04f;
|
||||||
core->globalScale = zoom;
|
core->globalScale = zoom;
|
||||||
|
core->globalScaleChanged();
|
||||||
if (zoom.x != oldZoom.x)
|
if (zoom.x != oldZoom.x)
|
||||||
{
|
{
|
||||||
const float mouseX = core->mouse.position.x;
|
const float mouseX = core->mouse.position.x;
|
||||||
|
|
|
@ -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
|
||||||
|
@ -4024,12 +4025,12 @@ luaFunc(cam_setPosition)
|
||||||
bool pingPong = getBool(L, 5);
|
bool pingPong = getBool(L, 5);
|
||||||
bool ease = getBool(L, 6);
|
bool ease = getBool(L, 6);
|
||||||
|
|
||||||
Vector p = dsq->game->getCameraPositionFor(Vector(x,y));
|
Vector p(x,y);
|
||||||
|
|
||||||
dsq->game->cameraInterp.stop();
|
dsq->game->cameraInterp.stop();
|
||||||
dsq->game->cameraInterp.interpolateTo(p, time, loopType, pingPong, ease);
|
dsq->game->cameraInterp.interpolateTo(p, time, loopType, pingPong, ease);
|
||||||
|
|
||||||
dsq->cameraPos = p;
|
dsq->cameraPos = dsq->game->getCameraPositionFor(dsq->game->cameraInterp);
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -5957,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)
|
||||||
{
|
{
|
||||||
|
@ -7203,20 +7222,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 +7508,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 +8615,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 +9436,7 @@ static const struct {
|
||||||
luaRegister(findPath),
|
luaRegister(findPath),
|
||||||
luaRegister(castLine),
|
luaRegister(castLine),
|
||||||
luaRegister(getUserInputString),
|
luaRegister(getUserInputString),
|
||||||
|
luaRegister(getMaxCameraValues),
|
||||||
|
|
||||||
luaRegister(isFlag),
|
luaRegister(isFlag),
|
||||||
|
|
||||||
|
@ -9640,8 +9651,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 +9683,7 @@ static const struct {
|
||||||
luaRegister(entity_changeHealth),
|
luaRegister(entity_changeHealth),
|
||||||
|
|
||||||
luaRegister(node_setActive),
|
luaRegister(node_setActive),
|
||||||
|
luaRegister(node_isActive),
|
||||||
|
|
||||||
|
|
||||||
luaRegister(setSceneColor),
|
luaRegister(setSceneColor),
|
||||||
|
@ -9715,6 +9725,8 @@ static const struct {
|
||||||
|
|
||||||
luaRegister(overrideZoom),
|
luaRegister(overrideZoom),
|
||||||
luaRegister(disableOverrideZoom),
|
luaRegister(disableOverrideZoom),
|
||||||
|
luaRegister(getZoom),
|
||||||
|
luaRegister(setMaxLookDistance),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9885,6 +9897,9 @@ static const struct {
|
||||||
|
|
||||||
{"bone_setColor", l_bone_color},
|
{"bone_setColor", l_bone_color},
|
||||||
|
|
||||||
|
{"node_setEffectOn", l_node_setActive},
|
||||||
|
{"node_isEffectOn", l_node_isActive},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
|
|
|
@ -59,6 +59,7 @@ ShotData::ShotData()
|
||||||
homingMax = 0;
|
homingMax = 0;
|
||||||
homingIncr = 0;
|
homingIncr = 0;
|
||||||
dieOnHit = 1;
|
dieOnHit = 1;
|
||||||
|
dieOnKill = false;
|
||||||
hitEnts = 1;
|
hitEnts = 1;
|
||||||
wallHitRadius = 0;
|
wallHitRadius = 0;
|
||||||
rotateToVel = 1;
|
rotateToVel = 1;
|
||||||
|
@ -241,6 +242,8 @@ void ShotData::bankLoad(const std::string &file, const std::string &path)
|
||||||
inf >> dieOnHit;
|
inf >> dieOnHit;
|
||||||
else if (token == "IgnoreShield")
|
else if (token == "IgnoreShield")
|
||||||
inf >> ignoreShield;
|
inf >> ignoreShield;
|
||||||
|
else if (token == "DieOnKill")
|
||||||
|
inf >> dieOnKill;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if having weirdness, check for these
|
// if having weirdness, check for these
|
||||||
|
@ -595,7 +598,7 @@ void Shot::hitEntity(Entity *e, Bone *b, bool isValid)
|
||||||
|
|
||||||
if (e->isEntityDead())
|
if (e->isEntityDead())
|
||||||
{
|
{
|
||||||
die = false;
|
die = shotData ? shotData->dieOnKill : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firer)
|
if (firer)
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct ShotData
|
||||||
Vector scale;
|
Vector scale;
|
||||||
|
|
||||||
bool ignoreShield;
|
bool ignoreShield;
|
||||||
|
bool dieOnKill;
|
||||||
|
|
||||||
float effectTime;
|
float effectTime;
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ void GameOver::applyState()
|
||||||
//core->sound->fadeOut(transTime);
|
//core->sound->fadeOut(transTime);
|
||||||
StateObject::applyState();
|
StateObject::applyState();
|
||||||
core->globalScale = Vector(1,1);
|
core->globalScale = Vector(1,1);
|
||||||
core->cameraPos.stop();
|
core->globalScaleChanged();
|
||||||
core->cameraPos = Vector(0,0,0);
|
core->cameraPos = Vector(0,0,0);
|
||||||
|
|
||||||
core->sound->playSfx("Death");
|
core->sound->playSfx("Death");
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1319,12 +1319,12 @@ bool Core::initSoundLibrary(const std::string &defaultDevice)
|
||||||
|
|
||||||
Vector Core::getGameCursorPosition()
|
Vector Core::getGameCursorPosition()
|
||||||
{
|
{
|
||||||
return core->cameraPos + mouse.position * Vector(1/core->globalScale.x, 1/core->globalScale.y, 1);
|
return getGamePosition(mouse.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector Core::getGamePosition(const Vector &v)
|
Vector Core::getGamePosition(const Vector &v)
|
||||||
{
|
{
|
||||||
return core->cameraPos + (v * Vector(1/core->globalScale.x, 1/core->globalScale.y, 1));
|
return cameraPos + (v * invGlobalScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::getMouseButtonState(int m)
|
bool Core::getMouseButtonState(int m)
|
||||||
|
@ -1795,8 +1795,8 @@ void Core::onUpdate(float dt)
|
||||||
|
|
||||||
//script.update(dt);
|
//script.update(dt);
|
||||||
|
|
||||||
cameraPos.update(dt);
|
|
||||||
globalScale.update(dt);
|
globalScale.update(dt);
|
||||||
|
core->globalScaleChanged();
|
||||||
|
|
||||||
if (afterEffectManager)
|
if (afterEffectManager)
|
||||||
{
|
{
|
||||||
|
@ -1817,6 +1817,12 @@ void Core::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::globalScaleChanged()
|
||||||
|
{
|
||||||
|
invGlobalScale = 1.0f/globalScale.x;
|
||||||
|
invGlobalScaleSqr = invGlobalScale * invGlobalScale;
|
||||||
|
}
|
||||||
|
|
||||||
Vector Core::getClearColor()
|
Vector Core::getClearColor()
|
||||||
{
|
{
|
||||||
return clearColor;
|
return clearColor;
|
||||||
|
@ -2412,7 +2418,7 @@ void Core::setPixelScale(int pixelScaleX, int pixelScaleY)
|
||||||
virtualWidth = pixelScaleX;
|
virtualWidth = pixelScaleX;
|
||||||
//MAX(virtualWidth, 800);
|
//MAX(virtualWidth, 800);
|
||||||
virtualHeight = pixelScaleY;//int((pixelScale*aspectY)/aspectX); //assumes 4:3 aspect ratio
|
virtualHeight = pixelScaleY;//int((pixelScale*aspectY)/aspectX); //assumes 4:3 aspect ratio
|
||||||
this->baseCullRadius = sqrtf(sqr(getVirtualWidth()/2) + sqr(getVirtualHeight()/2));
|
this->baseCullRadius = 1.1f * sqrtf(sqr(getVirtualWidth()/2) + sqr(getVirtualHeight()/2));
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "virtual(" << virtualWidth << ", " << virtualHeight << ")";
|
os << "virtual(" << virtualWidth << ", " << virtualHeight << ")";
|
||||||
|
@ -3290,7 +3296,7 @@ void Core::setMouseConstraint(bool on)
|
||||||
mouseConstraint = on;
|
mouseConstraint = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::setMouseConstraintCircle(int circle)
|
void Core::setMouseConstraintCircle(float circle)
|
||||||
{
|
{
|
||||||
mouseConstraint = true;
|
mouseConstraint = true;
|
||||||
mouseCircle = circle;
|
mouseCircle = circle;
|
||||||
|
@ -4051,20 +4057,9 @@ void Core::cacheRender()
|
||||||
|
|
||||||
void Core::updateCullData()
|
void Core::updateCullData()
|
||||||
{
|
{
|
||||||
// update cull data
|
cullRadius = baseCullRadius * invGlobalScale;
|
||||||
//this->cullRadius = int((getVirtualWidth())*invGlobalScale);
|
cullRadiusSqr = cullRadius * cullRadius;
|
||||||
this->cullRadius = baseCullRadius * invGlobalScale;
|
screenCenter = cullCenter = cameraPos + Vector(400.0f*invGlobalScale,300.0f*invGlobalScale);
|
||||||
this->cullRadiusSqr = (float)this->cullRadius * (float)this->cullRadius;
|
|
||||||
this->cullCenter = cameraPos + Vector(400.0f*invGlobalScale,300.0f*invGlobalScale);
|
|
||||||
screenCullX1 = cameraPos.x;
|
|
||||||
screenCullX2 = cameraPos.x + 800*invGlobalScale;
|
|
||||||
screenCullY1 = cameraPos.y;
|
|
||||||
screenCullY2 = cameraPos.y + 600*invGlobalScale;
|
|
||||||
|
|
||||||
|
|
||||||
int cx = core->cameraPos.x + 400*invGlobalScale;
|
|
||||||
int cy = core->cameraPos.y + 300*invGlobalScale;
|
|
||||||
screenCenter = Vector(cx, cy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
||||||
|
@ -4079,12 +4074,11 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
||||||
endLayer = overrideEndLayer;
|
endLayer = overrideEndLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalScaleChanged();
|
||||||
|
|
||||||
if (core->minimized) return;
|
if (core->minimized) return;
|
||||||
onRender();
|
onRender();
|
||||||
|
|
||||||
invGlobalScale = 1.0f/globalScale.x;
|
|
||||||
invGlobalScaleSqr = invGlobalScale * invGlobalScale;
|
|
||||||
|
|
||||||
RenderObject::lastTextureApplied = 0;
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
|
||||||
updateCullData();
|
updateCullData();
|
||||||
|
|
13
BBGE/Core.h
13
BBGE/Core.h
|
@ -1037,7 +1037,7 @@ public:
|
||||||
void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT);
|
void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT);
|
||||||
|
|
||||||
void setMouseConstraint(bool on);
|
void setMouseConstraint(bool on);
|
||||||
void setMouseConstraintCircle(int mouseCircle);
|
void setMouseConstraintCircle(float mouseCircle);
|
||||||
|
|
||||||
void setReentryInputGrab(int on);
|
void setReentryInputGrab(int on);
|
||||||
|
|
||||||
|
@ -1130,7 +1130,7 @@ public:
|
||||||
|
|
||||||
virtual void onPlayedVoice(const std::string &name){}
|
virtual void onPlayedVoice(const std::string &name){}
|
||||||
|
|
||||||
InterpolatedVector cameraPos;
|
Vector cameraPos;
|
||||||
|
|
||||||
int fps;
|
int fps;
|
||||||
bool loopDone;
|
bool loopDone;
|
||||||
|
@ -1174,13 +1174,14 @@ public:
|
||||||
|
|
||||||
bool minimized;
|
bool minimized;
|
||||||
std::string getEnqueuedJumpState();
|
std::string getEnqueuedJumpState();
|
||||||
int cullRadius;
|
float cullRadius;
|
||||||
float cullRadiusSqr;
|
float cullRadiusSqr;
|
||||||
Vector cullCenter;
|
Vector cullCenter;
|
||||||
int screenCullX1, screenCullY1, screenCullX2, screenCullY2;
|
|
||||||
unsigned int renderObjectCount, processedRenderObjectCount, totalRenderObjectCount;
|
unsigned int renderObjectCount, processedRenderObjectCount, totalRenderObjectCount;
|
||||||
float invGlobalScale, invGlobalScaleSqr;
|
float invGlobalScale, invGlobalScaleSqr;
|
||||||
|
|
||||||
|
void globalScaleChanged();
|
||||||
|
|
||||||
void screenshot();
|
void screenshot();
|
||||||
|
|
||||||
void clearRenderObjects();
|
void clearRenderObjects();
|
||||||
|
@ -1348,13 +1349,13 @@ protected:
|
||||||
|
|
||||||
std::string appName;
|
std::string appName;
|
||||||
bool mouseConstraint;
|
bool mouseConstraint;
|
||||||
int mouseCircle;
|
float mouseCircle;
|
||||||
|
|
||||||
bool doMouseConstraint();
|
bool doMouseConstraint();
|
||||||
|
|
||||||
virtual void onMouseInput(){}
|
virtual void onMouseInput(){}
|
||||||
bool doScreenshot;
|
bool doScreenshot;
|
||||||
int baseCullRadius;
|
float baseCullRadius;
|
||||||
bool initSoundLibrary(const std::string &defaultDevice);
|
bool initSoundLibrary(const std::string &defaultDevice);
|
||||||
bool initInputLibrary();
|
bool initInputLibrary();
|
||||||
bool initJoystickLibrary(int numSticks=1);
|
bool initJoystickLibrary(int numSticks=1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue