mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-11 11:33: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;
|
||||
|
||||
core->globalScale -= Vector(ANIM_EDIT_ZOOM, ANIM_EDIT_ZOOM);
|
||||
core->globalScaleChanged();
|
||||
}
|
||||
|
||||
void AnimationEditor::zoomIn()
|
||||
|
@ -600,6 +601,7 @@ void AnimationEditor::zoomIn()
|
|||
if (dsq->isNested()) return;
|
||||
|
||||
core->globalScale += Vector(ANIM_EDIT_ZOOM, ANIM_EDIT_ZOOM);
|
||||
core->globalScaleChanged();
|
||||
}
|
||||
|
||||
void AnimationEditor::reorderKeys()
|
||||
|
|
|
@ -2508,6 +2508,7 @@ void Avatar::formAbility(int ability)
|
|||
dsq->shakeCamera(25, 2);
|
||||
|
||||
core->globalScale = Vector(0.4, 0.4);
|
||||
core->globalScaleChanged();
|
||||
myZoom = Vector(0.4, 0.4);
|
||||
|
||||
/*
|
||||
|
@ -4214,20 +4215,6 @@ void Avatar::destroy()
|
|||
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()
|
||||
{
|
||||
if (boneLock.on) return;
|
||||
|
@ -6887,6 +6874,7 @@ void Avatar::onUpdate(float dt)
|
|||
core->globalScale.x = myZoom.x;
|
||||
core->globalScale.y = myZoom.y;
|
||||
}
|
||||
core->globalScaleChanged();
|
||||
|
||||
}
|
||||
|
||||
|
@ -7200,10 +7188,10 @@ bool Avatar::checkWarpAreas()
|
|||
{
|
||||
bool warp = false;
|
||||
Path *p = dsq->game->getPath(i);
|
||||
if (!p->nodes.empty())
|
||||
if (p && p->active && !p->nodes.empty())
|
||||
{
|
||||
PathNode *n = &p->nodes[0];
|
||||
if (p && n)
|
||||
if (n)
|
||||
{
|
||||
Vector backPos;
|
||||
if (!p->vox.empty())
|
||||
|
|
|
@ -442,7 +442,6 @@ protected:
|
|||
int getBeamWidth();
|
||||
Vector getWallNormal(TileVector t);
|
||||
bool checkWarpAreas();
|
||||
void toggleZoom();
|
||||
|
||||
float splashDelay;
|
||||
//Hair *hair;
|
||||
|
|
|
@ -357,28 +357,6 @@ ElementEffect DSQ::getElementEffectByIndex(int e)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -703,7 +681,7 @@ void DSQ::debugMenu()
|
|||
Entity *e = dsq->getEntityByNameNoCase(entityName);
|
||||
if (e)
|
||||
{
|
||||
dsq->cameraPos = e->position;
|
||||
dsq->cameraPos = game->getCameraPositionFor(e->position);
|
||||
}
|
||||
}
|
||||
else if (c == 'C')
|
||||
|
|
|
@ -1360,7 +1360,6 @@ public:
|
|||
std::string getEntityFlagName(Entity *e);
|
||||
std::string getUserInputString(std::string label, std::string t="", bool allowNonLowerCase=false);
|
||||
Vector getUserInputDirection(std::string label);
|
||||
Vector getCameraCenter();
|
||||
bool onPickedSaveSlot(AquariaSaveSlot *slot);
|
||||
void doSaveSlotMenu(SaveSlotMode ssm, const Vector &position = Vector(0,0,0));
|
||||
void doModSelect();
|
||||
|
@ -1377,7 +1376,6 @@ public:
|
|||
std::string getDialogueFilename(const std::string &f);
|
||||
|
||||
bool isShakingCamera();
|
||||
//Element *getSolidElementNear(Vector pos, int rad);
|
||||
|
||||
std::string languagePack;
|
||||
|
||||
|
|
|
@ -2193,7 +2193,7 @@ bool Entity::isUnderWater(const Vector &override)
|
|||
|
||||
|
||||
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;
|
||||
return true;
|
||||
|
|
|
@ -5736,7 +5736,7 @@ int game_collideParticle(Vector pos)
|
|||
if (!aboveWaterLine)
|
||||
{
|
||||
Path *p = dsq->game->getNearestPath(pos, PATH_WATERBUBBLE);
|
||||
if (p)
|
||||
if (p && p->active)
|
||||
{
|
||||
if (p->isCoordinateInside(pos))
|
||||
{
|
||||
|
@ -6175,6 +6175,7 @@ void Game::applyState()
|
|||
backgroundImageRepeat = 1;
|
||||
grad = 0;
|
||||
maxZoom = -1;
|
||||
maxLookDistance = 600;
|
||||
saveFile = 0;
|
||||
deathTimer = 0.9;
|
||||
runGameOverScript = false;
|
||||
|
@ -6670,13 +6671,13 @@ void Game::applyState()
|
|||
|
||||
core->cacheRender();
|
||||
|
||||
core->cameraPos.stop();
|
||||
cameraInterp.stop();
|
||||
|
||||
core->globalScale = dsq->continuity.zoom;
|
||||
//core->globalScaleChanged();
|
||||
avatar->myZoom = dsq->continuity.zoom;
|
||||
|
||||
cameraInterp = getCameraPositionFor(avatar->position);
|
||||
cameraInterp = avatar->position;
|
||||
core->cameraPos = getCameraPositionFor(avatar->position);
|
||||
|
||||
core->sort();
|
||||
|
@ -7450,7 +7451,9 @@ void Game::overrideZoom(float sz, float t)
|
|||
else
|
||||
{
|
||||
dsq->game->toggleOverrideZoom(true);
|
||||
dsq->globalScale.stop();
|
||||
dsq->globalScale.interpolateTo(Vector(sz, sz), t);
|
||||
dsq->globalScaleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8535,13 +8538,7 @@ void Game::toggleGridRender()
|
|||
|
||||
Vector Game::getCameraPositionFor(const Vector &pos)
|
||||
{
|
||||
Vector dest = pos;
|
||||
|
||||
Vector v;
|
||||
dest += v + Vector(-400/core->globalScale.x,-300/core->globalScale.y);
|
||||
dest.z = 0;
|
||||
|
||||
return dest;
|
||||
return Vector(pos.x - 400 * core->invGlobalScale, pos.y - 300 * core->invGlobalScale, 0);
|
||||
}
|
||||
|
||||
void Game::setParallaxTextureCoordinates(Quad *q, float speed)
|
||||
|
@ -10296,16 +10293,16 @@ void Game::update(float dt)
|
|||
{
|
||||
if (!isPaused())
|
||||
waterLevel.update(dt);
|
||||
cameraInterp.update(dt);
|
||||
|
||||
if (cameraFollow)
|
||||
{
|
||||
Vector dest = getCameraPositionFor(*cameraFollow);
|
||||
Vector dest = *cameraFollow;
|
||||
|
||||
if (avatar)
|
||||
{
|
||||
if (avatar->looking && !dsq->game->isPaused()) {
|
||||
Vector diff = avatar->getAim();//dsq->getGameCursorPosition() - avatar->position;
|
||||
diff.capLength2D(600);
|
||||
diff.capLength2D(maxLookDistance);
|
||||
dest += diff;
|
||||
}
|
||||
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)
|
||||
{
|
||||
//cameraLerpDelay = 0.15;
|
||||
cameraLerpDelay = vars->defaultCameraLerpDelay;
|
||||
}
|
||||
Vector oldCamPos = dsq->cameraPos;
|
||||
cameraInterp.stop();
|
||||
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
||||
|
||||
dsq->cameraPos.x = cameraInterp.x;
|
||||
dsq->cameraPos.y = cameraInterp.y;
|
||||
|
||||
// constrainCamera
|
||||
dsq->cameraPos = getCameraPositionFor(cameraInterp);
|
||||
constrainCamera();
|
||||
/*
|
||||
if (cam_region)
|
||||
ConstrainToRegion(&ek->cameraPos, cam_region, core->getVirtualWidth()*(core->globalScale.x), core->getVirtualHeight()*(core->globalScale.y));
|
||||
*/
|
||||
|
||||
float dd = (dsq->cameraPos - oldCamPos).getLength2D();
|
||||
}
|
||||
|
||||
cameraInterp.update(dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10484,20 +10459,14 @@ void Game::warpCameraTo(RenderObject *r)
|
|||
void Game::warpCameraTo(Vector position)
|
||||
{
|
||||
cameraInterp.stop();
|
||||
cameraInterp = getCameraPositionFor(position);
|
||||
dsq->cameraPos.x = cameraInterp.x;
|
||||
dsq->cameraPos.y = cameraInterp.y;
|
||||
cameraInterp = position;
|
||||
dsq->cameraPos = getCameraPositionFor(position);
|
||||
}
|
||||
|
||||
void Game::snapCam()
|
||||
{
|
||||
if (cameraFollow)
|
||||
{
|
||||
Vector p = getCameraPositionFor(*cameraFollow);
|
||||
cameraInterp.interpolateTo(p,0);
|
||||
cameraInterp = p;
|
||||
core->cameraPos = p;
|
||||
}
|
||||
warpCameraTo(*cameraFollow);
|
||||
}
|
||||
|
||||
ElementTemplate Game::getElementTemplateForLetter(int i)
|
||||
|
@ -10758,6 +10727,7 @@ void Game::removeState()
|
|||
|
||||
dsq->game->avatar->myZoom = Vector(1,1);
|
||||
dsq->globalScale = Vector(1,1);
|
||||
core->globalScaleChanged();
|
||||
|
||||
for (int i = 0; i < getNumPaths(); i++)
|
||||
{
|
||||
|
|
|
@ -708,6 +708,7 @@ public:
|
|||
void resetFromTitle();
|
||||
|
||||
float maxZoom;
|
||||
float maxLookDistance;
|
||||
|
||||
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)
|
||||
{
|
||||
if (p->isCoordinateInside(dsq->game->avatar->position))
|
||||
if (p->active && p->isCoordinateInside(dsq->game->avatar->position))
|
||||
{
|
||||
radarHide = true;
|
||||
break;
|
||||
|
|
|
@ -25,7 +25,6 @@ Path::Path()
|
|||
{
|
||||
addType(SCO_PATH);
|
||||
localWarpType = LOCALWARP_NONE;
|
||||
effectOn = true;
|
||||
time = 0;
|
||||
naijaIn = false;
|
||||
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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -90,8 +90,6 @@ public:
|
|||
void setActive(bool v);
|
||||
bool action(int id, int state);
|
||||
|
||||
void setEffectOn(bool on) { effectOn = on; }
|
||||
|
||||
PathNode *getPathNode(int idx);
|
||||
bool isCoordinateInside(const Vector &pos, int rad=0);
|
||||
|
||||
|
@ -142,7 +140,6 @@ public:
|
|||
|
||||
std::string gem;
|
||||
|
||||
bool effectOn;
|
||||
bool spiritFreeze;
|
||||
bool pauseFreeze;
|
||||
|
||||
|
|
|
@ -2960,6 +2960,7 @@ void SceneEditor::toggle(bool on)
|
|||
core->cameraPos.x += cameraOffset * core->getVirtualWidth()/2;
|
||||
core->cameraPos.y += cameraOffset * core->getVirtualHeight()/2;
|
||||
core->globalScale = zoom;
|
||||
core->globalScaleChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3230,6 +3231,7 @@ void SceneEditor::update(float dt)
|
|||
if (zoom.x < 0.04f)
|
||||
zoom.x = zoom.y = 0.04f;
|
||||
core->globalScale = zoom;
|
||||
core->globalScaleChanged();
|
||||
if (zoom.x != oldZoom.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 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 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;
|
||||
|
||||
// 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 ease = getBool(L, 6);
|
||||
|
||||
Vector p = dsq->game->getCameraPositionFor(Vector(x,y));
|
||||
Vector p(x,y);
|
||||
|
||||
dsq->game->cameraInterp.stop();
|
||||
dsq->game->cameraInterp.interpolateTo(p, time, loopType, pingPong, ease);
|
||||
|
||||
dsq->cameraPos = p;
|
||||
dsq->cameraPos = dsq->game->getCameraPositionFor(dsq->game->cameraInterp);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
@ -4754,6 +4755,12 @@ luaFunc(node_setActive)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(node_isActive)
|
||||
{
|
||||
Path *p = path(L);
|
||||
luaReturnBool(p ? p->active : false);
|
||||
}
|
||||
|
||||
luaFunc(node_setCursorActivation)
|
||||
{
|
||||
Path *p = path(L);
|
||||
|
@ -5516,7 +5523,7 @@ luaFunc(entity_isInRect)
|
|||
{
|
||||
Entity *e = entity(L);
|
||||
bool v= false;
|
||||
int x1, y1, x2, y2;
|
||||
float x1, y1, x2, y2;
|
||||
x1 = lua_tonumber(L, 2);
|
||||
y1 = lua_tonumber(L, 3);
|
||||
x2 = lua_tonumber(L, 4);
|
||||
|
@ -5957,12 +5964,24 @@ luaFunc(overrideZoom)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(getZoom)
|
||||
{
|
||||
luaReturnNum(dsq->globalScale.x);
|
||||
}
|
||||
|
||||
luaFunc(disableOverrideZoom)
|
||||
{
|
||||
dsq->game->toggleOverrideZoom(false);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(setMaxLookDistance)
|
||||
{
|
||||
dsq->game->maxLookDistance = lua_tonumber(L, 1);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
||||
// dt, range, mod
|
||||
luaFunc(entity_doSpellAvoidance)
|
||||
{
|
||||
|
@ -7203,20 +7222,6 @@ luaFunc(getEntityByID)
|
|||
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)
|
||||
{
|
||||
Path *p = path(L);
|
||||
|
@ -7503,7 +7508,7 @@ luaFunc(toggleSteam)
|
|||
bool on = getBool(L, 1);
|
||||
for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType)
|
||||
{
|
||||
p->setEffectOn(on);
|
||||
p->setActive(on);
|
||||
}
|
||||
luaReturnBool(on);
|
||||
}
|
||||
|
@ -8610,6 +8615,11 @@ luaFunc(getUserInputString)
|
|||
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)
|
||||
{
|
||||
|
@ -9426,6 +9436,7 @@ static const struct {
|
|||
luaRegister(findPath),
|
||||
luaRegister(castLine),
|
||||
luaRegister(getUserInputString),
|
||||
luaRegister(getMaxCameraValues),
|
||||
|
||||
luaRegister(isFlag),
|
||||
|
||||
|
@ -9640,8 +9651,6 @@ static const struct {
|
|||
luaRegister(node_getContent),
|
||||
luaRegister(node_getAmount),
|
||||
luaRegister(node_getSize),
|
||||
luaRegister(node_setEffectOn),
|
||||
luaRegister(node_isEffectOn),
|
||||
luaRegister(node_getShape),
|
||||
|
||||
luaRegister(toggleSteam),
|
||||
|
@ -9674,6 +9683,7 @@ static const struct {
|
|||
luaRegister(entity_changeHealth),
|
||||
|
||||
luaRegister(node_setActive),
|
||||
luaRegister(node_isActive),
|
||||
|
||||
|
||||
luaRegister(setSceneColor),
|
||||
|
@ -9715,6 +9725,8 @@ static const struct {
|
|||
|
||||
luaRegister(overrideZoom),
|
||||
luaRegister(disableOverrideZoom),
|
||||
luaRegister(getZoom),
|
||||
luaRegister(setMaxLookDistance),
|
||||
|
||||
|
||||
|
||||
|
@ -9885,6 +9897,9 @@ static const struct {
|
|||
|
||||
{"bone_setColor", l_bone_color},
|
||||
|
||||
{"node_setEffectOn", l_node_setActive},
|
||||
{"node_isEffectOn", l_node_isActive},
|
||||
|
||||
};
|
||||
|
||||
//============================================================================================
|
||||
|
|
|
@ -59,6 +59,7 @@ ShotData::ShotData()
|
|||
homingMax = 0;
|
||||
homingIncr = 0;
|
||||
dieOnHit = 1;
|
||||
dieOnKill = false;
|
||||
hitEnts = 1;
|
||||
wallHitRadius = 0;
|
||||
rotateToVel = 1;
|
||||
|
@ -241,6 +242,8 @@ void ShotData::bankLoad(const std::string &file, const std::string &path)
|
|||
inf >> dieOnHit;
|
||||
else if (token == "IgnoreShield")
|
||||
inf >> ignoreShield;
|
||||
else if (token == "DieOnKill")
|
||||
inf >> dieOnKill;
|
||||
else
|
||||
{
|
||||
// if having weirdness, check for these
|
||||
|
@ -595,7 +598,7 @@ void Shot::hitEntity(Entity *e, Bone *b, bool isValid)
|
|||
|
||||
if (e->isEntityDead())
|
||||
{
|
||||
die = false;
|
||||
die = shotData ? shotData->dieOnKill : false;
|
||||
}
|
||||
|
||||
if (firer)
|
||||
|
|
|
@ -43,6 +43,7 @@ struct ShotData
|
|||
Vector scale;
|
||||
|
||||
bool ignoreShield;
|
||||
bool dieOnKill;
|
||||
|
||||
float effectTime;
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ void GameOver::applyState()
|
|||
//core->sound->fadeOut(transTime);
|
||||
StateObject::applyState();
|
||||
core->globalScale = Vector(1,1);
|
||||
core->cameraPos.stop();
|
||||
core->globalScaleChanged();
|
||||
core->cameraPos = Vector(0,0,0);
|
||||
|
||||
core->sound->playSfx("Death");
|
||||
|
|
|
@ -46,7 +46,7 @@ void SteamRender::onRender()
|
|||
|
||||
for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType)
|
||||
{
|
||||
if (p->effectOn)
|
||||
if (p->active)
|
||||
{
|
||||
|
||||
int w2 = p->rect.getWidth()/2;
|
||||
|
|
|
@ -1319,12 +1319,12 @@ bool Core::initSoundLibrary(const std::string &defaultDevice)
|
|||
|
||||
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)
|
||||
{
|
||||
return core->cameraPos + (v * Vector(1/core->globalScale.x, 1/core->globalScale.y, 1));
|
||||
return cameraPos + (v * invGlobalScale);
|
||||
}
|
||||
|
||||
bool Core::getMouseButtonState(int m)
|
||||
|
@ -1795,8 +1795,8 @@ void Core::onUpdate(float dt)
|
|||
|
||||
//script.update(dt);
|
||||
|
||||
cameraPos.update(dt);
|
||||
globalScale.update(dt);
|
||||
core->globalScaleChanged();
|
||||
|
||||
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()
|
||||
{
|
||||
return clearColor;
|
||||
|
@ -2412,7 +2418,7 @@ void Core::setPixelScale(int pixelScaleX, int pixelScaleY)
|
|||
virtualWidth = pixelScaleX;
|
||||
//MAX(virtualWidth, 800);
|
||||
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;
|
||||
os << "virtual(" << virtualWidth << ", " << virtualHeight << ")";
|
||||
|
@ -3290,7 +3296,7 @@ void Core::setMouseConstraint(bool on)
|
|||
mouseConstraint = on;
|
||||
}
|
||||
|
||||
void Core::setMouseConstraintCircle(int circle)
|
||||
void Core::setMouseConstraintCircle(float circle)
|
||||
{
|
||||
mouseConstraint = true;
|
||||
mouseCircle = circle;
|
||||
|
@ -4051,20 +4057,9 @@ void Core::cacheRender()
|
|||
|
||||
void Core::updateCullData()
|
||||
{
|
||||
// update cull data
|
||||
//this->cullRadius = int((getVirtualWidth())*invGlobalScale);
|
||||
this->cullRadius = baseCullRadius * 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);
|
||||
cullRadius = baseCullRadius * invGlobalScale;
|
||||
cullRadiusSqr = cullRadius * cullRadius;
|
||||
screenCenter = cullCenter = cameraPos + Vector(400.0f*invGlobalScale,300.0f*invGlobalScale);
|
||||
}
|
||||
|
||||
void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
||||
|
@ -4079,12 +4074,11 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
|||
endLayer = overrideEndLayer;
|
||||
}
|
||||
|
||||
globalScaleChanged();
|
||||
|
||||
if (core->minimized) return;
|
||||
onRender();
|
||||
|
||||
invGlobalScale = 1.0f/globalScale.x;
|
||||
invGlobalScaleSqr = invGlobalScale * invGlobalScale;
|
||||
|
||||
RenderObject::lastTextureApplied = 0;
|
||||
|
||||
updateCullData();
|
||||
|
|
13
BBGE/Core.h
13
BBGE/Core.h
|
@ -1037,7 +1037,7 @@ public:
|
|||
void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT);
|
||||
|
||||
void setMouseConstraint(bool on);
|
||||
void setMouseConstraintCircle(int mouseCircle);
|
||||
void setMouseConstraintCircle(float mouseCircle);
|
||||
|
||||
void setReentryInputGrab(int on);
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ public:
|
|||
|
||||
virtual void onPlayedVoice(const std::string &name){}
|
||||
|
||||
InterpolatedVector cameraPos;
|
||||
Vector cameraPos;
|
||||
|
||||
int fps;
|
||||
bool loopDone;
|
||||
|
@ -1174,13 +1174,14 @@ public:
|
|||
|
||||
bool minimized;
|
||||
std::string getEnqueuedJumpState();
|
||||
int cullRadius;
|
||||
float cullRadius;
|
||||
float cullRadiusSqr;
|
||||
Vector cullCenter;
|
||||
int screenCullX1, screenCullY1, screenCullX2, screenCullY2;
|
||||
unsigned int renderObjectCount, processedRenderObjectCount, totalRenderObjectCount;
|
||||
float invGlobalScale, invGlobalScaleSqr;
|
||||
|
||||
void globalScaleChanged();
|
||||
|
||||
void screenshot();
|
||||
|
||||
void clearRenderObjects();
|
||||
|
@ -1348,13 +1349,13 @@ protected:
|
|||
|
||||
std::string appName;
|
||||
bool mouseConstraint;
|
||||
int mouseCircle;
|
||||
float mouseCircle;
|
||||
|
||||
bool doMouseConstraint();
|
||||
|
||||
virtual void onMouseInput(){}
|
||||
bool doScreenshot;
|
||||
int baseCullRadius;
|
||||
float baseCullRadius;
|
||||
bool initSoundLibrary(const std::string &defaultDevice);
|
||||
bool initInputLibrary();
|
||||
bool initJoystickLibrary(int numSticks=1);
|
||||
|
|
Loading…
Add table
Reference in a new issue