mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-11 03:23:50 +00:00
Minor debug improvements + misc
- Spend less time starting up when not compiled with AQUARIA_FULL/DEMO - removed entity_setTouchDamage and bone_setTouchDamage, the used variable was never read - repositioned debug overlay texts, that they are not in the way on wide resolutions - show used Lua memory in debug text - very slow slowmo on Shift+F devkey - fixed RenderObject::isfhr()/isfvr() to be really recursive (they were never used until the animation editor fixes - this rotates bones on one or more h.flipped parents in the same direction as never h.flipped ones) - removed some unused stuff
This commit is contained in:
parent
52881c97a3
commit
f2d112b693
7 changed files with 50 additions and 106 deletions
|
@ -1250,7 +1250,7 @@ This build is not yet final, and as such there are a couple things lacking. They
|
||||||
console = new DebugFont;
|
console = new DebugFont;
|
||||||
//(&dsq->smallFont);
|
//(&dsq->smallFont);
|
||||||
{
|
{
|
||||||
console->position = Vector(10,400);
|
console->position = Vector(10 - virtualOffX,400);
|
||||||
console->followCamera = 1;
|
console->followCamera = 1;
|
||||||
console->alpha = 0;
|
console->alpha = 0;
|
||||||
//console->setAlign(ALIGN_LEFT);
|
//console->setAlign(ALIGN_LEFT);
|
||||||
|
@ -1272,7 +1272,7 @@ This build is not yet final, and as such there are a couple things lacking. They
|
||||||
{
|
{
|
||||||
//cmDebug->position = Vector(450,250);
|
//cmDebug->position = Vector(450,250);
|
||||||
//cmDebug->position = Vector(500,350);
|
//cmDebug->position = Vector(500,350);
|
||||||
cmDebug->position = Vector(50,50);
|
cmDebug->position = Vector(20 - virtualOffX,50);
|
||||||
cmDebug->followCamera = 1;
|
cmDebug->followCamera = 1;
|
||||||
cmDebug->alpha = 0;
|
cmDebug->alpha = 0;
|
||||||
//cmDebug->setAlign(ALIGN_LEFT);
|
//cmDebug->setAlign(ALIGN_LEFT);
|
||||||
|
@ -1492,25 +1492,16 @@ This build is not yet final, and as such there are a couple things lacking. They
|
||||||
fpsText->color = Vector(1,1,1);
|
fpsText->color = Vector(1,1,1);
|
||||||
fpsText->setFontSize(6);
|
fpsText->setFontSize(6);
|
||||||
//fpsText->position = Vector(10,15+200);
|
//fpsText->position = Vector(10,15+200);
|
||||||
fpsText->position = Vector(10,560);
|
fpsText->position = Vector(10 - virtualOffX,580);
|
||||||
fpsText->position.z = 5;
|
fpsText->position.z = 5;
|
||||||
//fpsText->position += Vector(0,-200);
|
//fpsText->position += Vector(0,-200);
|
||||||
//fpsText->setAlign(ALIGN_LEFT);
|
//fpsText->setAlign(ALIGN_LEFT);
|
||||||
fpsText->setText("FPS");
|
fpsText->setText("FPS");
|
||||||
fpsText->alphaMod = 0; // 0.5
|
fpsText->alpha= 0;
|
||||||
//fpsText->followCamera = 1;
|
//fpsText->followCamera = 1;
|
||||||
}
|
}
|
||||||
addRenderObject(fpsText, LR_DEBUG_TEXT);
|
addRenderObject(fpsText, LR_DEBUG_TEXT);
|
||||||
|
|
||||||
if (isDeveloperKeys())
|
|
||||||
{
|
|
||||||
fpsText->alpha = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fpsText->alpha = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
precacher.precacheList("data/precache.txt", loadBitForTexPrecache);
|
precacher.precacheList("data/precache.txt", loadBitForTexPrecache);
|
||||||
|
|
||||||
setTexturePointers();
|
setTexturePointers();
|
||||||
|
@ -1577,11 +1568,11 @@ This build is not yet final, and as such there are a couple things lacking. They
|
||||||
sound->playSfx("defense", 0.5);
|
sound->playSfx("defense", 0.5);
|
||||||
sound->playSfx("visionwakeup");
|
sound->playSfx("visionwakeup");
|
||||||
*/
|
*/
|
||||||
|
#if defined(AQUARIA_FULL) || defined(AQUARIA_DEMO)
|
||||||
float trans = 0.5;
|
float trans = 0.5;
|
||||||
overlay->alpha.interpolateTo(1, trans);
|
overlay->alpha.interpolateTo(1, trans);
|
||||||
core->main(trans);
|
core->main(trans);
|
||||||
|
#endif
|
||||||
removeRenderObject(loading);
|
removeRenderObject(loading);
|
||||||
loading = 0;
|
loading = 0;
|
||||||
removeRenderObject(sidel);
|
removeRenderObject(sidel);
|
||||||
|
@ -1603,8 +1594,11 @@ This build is not yet final, and as such there are a couple things lacking. They
|
||||||
|
|
||||||
bindInput();
|
bindInput();
|
||||||
|
|
||||||
//title();
|
#if defined(AQUARIA_FULL) || defined(AQUARIA_DEMO)
|
||||||
enqueueJumpState("BitBlotLogo");
|
enqueueJumpState("BitBlotLogo");
|
||||||
|
#else
|
||||||
|
title();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSQ::recreateBlackBars()
|
void DSQ::recreateBlackBars()
|
||||||
|
@ -2030,6 +2024,7 @@ void DSQ::toggleConsole()
|
||||||
{
|
{
|
||||||
console->alpha.interpolateTo(1, 0.1);
|
console->alpha.interpolateTo(1, 0.1);
|
||||||
cmDebug->alpha.interpolateTo(1, 0.1);
|
cmDebug->alpha.interpolateTo(1, 0.1);
|
||||||
|
fpsText->alpha.interpolateTo(1, 0.1);
|
||||||
if (profRender)
|
if (profRender)
|
||||||
profRender->alpha.interpolateTo(1, 0.1);
|
profRender->alpha.interpolateTo(1, 0.1);
|
||||||
RenderObject::renderPaths = true;
|
RenderObject::renderPaths = true;
|
||||||
|
@ -2038,6 +2033,7 @@ void DSQ::toggleConsole()
|
||||||
{
|
{
|
||||||
console->alpha.interpolateTo(0, 0.1);
|
console->alpha.interpolateTo(0, 0.1);
|
||||||
cmDebug->alpha.interpolateTo(0, 0.1);
|
cmDebug->alpha.interpolateTo(0, 0.1);
|
||||||
|
fpsText->alpha.interpolateTo(0, 0.1);
|
||||||
if (profRender)
|
if (profRender)
|
||||||
profRender->alpha.interpolateTo(0, 0.1);
|
profRender->alpha.interpolateTo(0, 0.1);
|
||||||
RenderObject::renderPaths = false;
|
RenderObject::renderPaths = false;
|
||||||
|
@ -4462,12 +4458,12 @@ void DSQ::onUpdate(float dt)
|
||||||
os << " ca: " << ca << " ma: " << ma << std::endl;
|
os << " ca: " << ca << " ma: " << ma << std::endl;
|
||||||
os << dsq->sound->getVolumeString() << std::endl;
|
os << dsq->sound->getVolumeString() << std::endl;
|
||||||
os << core->globalResolutionScale.x << ", " << core->globalResolutionScale.y << std::endl;
|
os << core->globalResolutionScale.x << ", " << core->globalResolutionScale.y << std::endl;
|
||||||
|
os << "Lua mem: " << scriptInterface.gcGetStats() << " KB" << std::endl;
|
||||||
|
|
||||||
cmDebug->setText(os.str());
|
cmDebug->setText(os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDeveloperKeys() && fpsText)
|
if (isDeveloperKeys() && fpsText && cmDebug && cmDebug->alpha == 1)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "FPS: " << core->fps << " | ROC: " << core->renderObjectCount;
|
os << "FPS: " << core->fps << " | ROC: " << core->renderObjectCount;
|
||||||
|
@ -4798,9 +4794,14 @@ void DSQ::modifyDt(float &dt)
|
||||||
if (isDeveloperKeys())
|
if (isDeveloperKeys())
|
||||||
{
|
{
|
||||||
if (core->getKeyState(KEY_G))
|
if (core->getKeyState(KEY_G))
|
||||||
dt = 0.075f;
|
dt *= 4;
|
||||||
else if (core->getKeyState(KEY_F))
|
else if (core->getKeyState(KEY_F))
|
||||||
dt *= 0.6f;
|
{
|
||||||
|
if (core->getShiftState())
|
||||||
|
dt *= 0.1f;
|
||||||
|
else
|
||||||
|
dt *= 0.6;
|
||||||
|
}
|
||||||
else if (core->getKeyState(KEY_H))
|
else if (core->getKeyState(KEY_H))
|
||||||
dt = FRAME_TIME;
|
dt = FRAME_TIME;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1503,16 +1503,6 @@ luaFunc(entity_setFillGrid)
|
||||||
luaReturnNum(0);
|
luaReturnNum(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
luaFunc(entity_setTouchDamage)
|
|
||||||
{
|
|
||||||
Entity *e = entity(L);
|
|
||||||
if (e)
|
|
||||||
{
|
|
||||||
e->touchDamage = lua_tonumber(L, 2);
|
|
||||||
}
|
|
||||||
luaReturnNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
luaFunc(entity_setCollideRadius)
|
luaFunc(entity_setCollideRadius)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
|
@ -4621,16 +4611,6 @@ luaFunc(bone_setTexture)
|
||||||
luaReturnNum(0);
|
luaReturnNum(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
luaFunc(bone_setTouchDamage)
|
|
||||||
{
|
|
||||||
Bone *b = bone(L);
|
|
||||||
if (b)
|
|
||||||
{
|
|
||||||
b->touchDamage = lua_tonumber(L, 2);
|
|
||||||
}
|
|
||||||
luaReturnNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
luaFunc(bone_getIndex)
|
luaFunc(bone_getIndex)
|
||||||
{
|
{
|
||||||
Bone *b = bone(L);
|
Bone *b = bone(L);
|
||||||
|
@ -8064,7 +8044,6 @@ static const struct {
|
||||||
|
|
||||||
luaRegister(entity_setCollideRadius),
|
luaRegister(entity_setCollideRadius),
|
||||||
luaRegister(entity_getCollideRadius),
|
luaRegister(entity_getCollideRadius),
|
||||||
luaRegister(entity_setTouchDamage),
|
|
||||||
|
|
||||||
luaRegister(entity_isEntityInRange),
|
luaRegister(entity_isEntityInRange),
|
||||||
luaRegister(entity_isPositionInRange),
|
luaRegister(entity_isPositionInRange),
|
||||||
|
@ -8125,7 +8104,6 @@ static const struct {
|
||||||
|
|
||||||
luaRegister(bone_alpha),
|
luaRegister(bone_alpha),
|
||||||
|
|
||||||
luaRegister(bone_setTouchDamage),
|
|
||||||
luaRegister(bone_getNormal),
|
luaRegister(bone_getNormal),
|
||||||
luaRegister(bone_getPosition),
|
luaRegister(bone_getPosition),
|
||||||
luaRegister(bone_getScale),
|
luaRegister(bone_getScale),
|
||||||
|
@ -9025,6 +9003,11 @@ void ScriptInterface::collectGarbage()
|
||||||
lua_gc(baseState, LUA_GCCOLLECT, 0);
|
lua_gc(baseState, LUA_GCCOLLECT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScriptInterface::gcGetStats()
|
||||||
|
{
|
||||||
|
return lua_gc(baseState, LUA_GCCOUNT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptInterface::shutdown()
|
void ScriptInterface::shutdown()
|
||||||
{
|
{
|
||||||
destroyLuaVM(baseState);
|
destroyLuaVM(baseState);
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void reset();
|
void reset();
|
||||||
void collectGarbage();
|
void collectGarbage();
|
||||||
|
int gcGetStats();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
Script *openScript(const std::string &file, bool ignoremissing = false);
|
Script *openScript(const std::string &file, bool ignoremissing = false);
|
||||||
|
|
|
@ -58,41 +58,5 @@ namespace MathFunctions
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED static void calculateAngleBetweenVectorsInRadians(Vector vector1, Vector vector2, float &solutionAngle)
|
|
||||||
{
|
|
||||||
Vector dist = vector1 - vector2;
|
|
||||||
|
|
||||||
solutionAngle = atan2f(dist.y, fabsf(dist.x));
|
|
||||||
|
|
||||||
if (dist.x < 0)
|
|
||||||
solutionAngle = PI - solutionAngle;
|
|
||||||
/*
|
|
||||||
solutionAngle = -solutionAngle;
|
|
||||||
solutionAngle += PI/2;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (dist.x<0)
|
|
||||||
solutionAngle = PI - solutionAngle;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vector1.normalize2D();
|
|
||||||
vector2.normalize2D();
|
|
||||||
|
|
||||||
solutionAngle = cosf((vector1.x*vector2.x + vector2.y*vector2.y));
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//solutionAngle = acosf(vector1.dot(vector2) / (sqrt(vector1.dot(vector1) * vector2.dot(vector2))));
|
|
||||||
//solutionAngle = acosf(vector1.dot(vector2) / (vector1.getLength2D() * vector2.getLength2D()));
|
|
||||||
/*
|
|
||||||
solutionAngle = (solutionAngle /PI)*180;
|
|
||||||
if (dist.x < 0)
|
|
||||||
solutionAngle = 180-solutionAngle;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -318,16 +318,19 @@ void Quad::destroy()
|
||||||
|
|
||||||
bool Quad::isCoordinateInside(Vector coord, int minSize)
|
bool Quad::isCoordinateInside(Vector coord, int minSize)
|
||||||
{
|
{
|
||||||
int hw = fabsf((width)*getRealScale().x)*0.5f;
|
Vector realscale = getRealScale();
|
||||||
int hh = fabsf((height)*getRealScale().y)*0.5f;
|
int hw = fabsf((width)*realscale.x)*0.5f;
|
||||||
|
int hh = fabsf((height)*realscale.y)*0.5f;
|
||||||
if (hw < minSize)
|
if (hw < minSize)
|
||||||
hw = minSize;
|
hw = minSize;
|
||||||
if (hh < minSize)
|
if (hh < minSize)
|
||||||
hh = minSize;
|
hh = minSize;
|
||||||
|
|
||||||
if (coord.x >= getRealPosition().x - hw && coord.x <= getRealPosition().x + hw)
|
Vector pos = getRealPosition();
|
||||||
|
|
||||||
|
if (coord.x >= pos.x - hw && coord.x <= pos.x + hw)
|
||||||
{
|
{
|
||||||
if (coord.y >= getRealPosition().y - hh && coord.y <= getRealPosition().y + hh)
|
if (coord.y >= pos.y - hh && coord.y <= pos.y + hh)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
bool RenderObject::renderCollisionShape = false;
|
bool RenderObject::renderCollisionShape = false;
|
||||||
bool RenderObject::integerizePositionForRender = false;
|
|
||||||
int RenderObject::lastTextureApplied = 0;
|
int RenderObject::lastTextureApplied = 0;
|
||||||
bool RenderObject::lastTextureRepeat = false;
|
bool RenderObject::lastTextureRepeat = false;
|
||||||
bool RenderObject::renderPaths = false;
|
bool RenderObject::renderPaths = false;
|
||||||
|
@ -35,8 +34,6 @@ const bool RENDEROBJECT_FASTTRANSFORM = false;
|
||||||
|
|
||||||
RenderObjectLayer *RenderObject::rlayer = 0;
|
RenderObjectLayer *RenderObject::rlayer = 0;
|
||||||
|
|
||||||
InterpolatedVector RenderObject::savePosition;
|
|
||||||
|
|
||||||
void RenderObject::toggleAlpha(float t)
|
void RenderObject::toggleAlpha(float t)
|
||||||
{
|
{
|
||||||
if (alpha.x < 0.5f)
|
if (alpha.x < 0.5f)
|
||||||
|
@ -176,7 +173,6 @@ RenderObject::RenderObject()
|
||||||
motionBlurFrameOffset = 0;
|
motionBlurFrameOffset = 0;
|
||||||
motionBlur = false;
|
motionBlur = false;
|
||||||
idx = -1;
|
idx = -1;
|
||||||
renderBorders = false;
|
|
||||||
#ifdef BBGE_BUILD_DIRECTX
|
#ifdef BBGE_BUILD_DIRECTX
|
||||||
useDXTransform = false;
|
useDXTransform = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -218,7 +214,6 @@ RenderObject::RenderObject()
|
||||||
colorIsSaved = false;
|
colorIsSaved = false;
|
||||||
shareAlphaWithChildren = false;
|
shareAlphaWithChildren = false;
|
||||||
shareColorWithChildren = false;
|
shareColorWithChildren = false;
|
||||||
touchDamage = 0;
|
|
||||||
motionBlurTransitionTimer = 0;
|
motionBlurTransitionTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,18 +491,26 @@ void RenderObject::disableMotionBlur()
|
||||||
|
|
||||||
bool RenderObject::isfhr()
|
bool RenderObject::isfhr()
|
||||||
{
|
{
|
||||||
if (parent)
|
RenderObject *p = this;
|
||||||
return parent->isfhr();
|
bool fh = false;
|
||||||
else
|
do
|
||||||
return this->isfh();
|
if (p->isfh())
|
||||||
|
fh = !fh;
|
||||||
|
while ((p = p->parent));
|
||||||
|
return fh;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::isfvr()
|
bool RenderObject::isfvr()
|
||||||
{
|
{
|
||||||
if (parent)
|
RenderObject *p = this;
|
||||||
return parent->isfvr();
|
bool fv = false;
|
||||||
else
|
do
|
||||||
return this->isfv();
|
if (p->isfv())
|
||||||
|
fv = !fv;
|
||||||
|
while ((p = p->parent));
|
||||||
|
return fv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::hasRenderPass(const int pass)
|
bool RenderObject::hasRenderPass(const int pass)
|
||||||
|
@ -888,11 +891,6 @@ void RenderObject::renderCall()
|
||||||
|
|
||||||
|
|
||||||
position -= offset;
|
position -= offset;
|
||||||
|
|
||||||
if (integerizePositionForRender)
|
|
||||||
{
|
|
||||||
position = savePosition;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::renderCollision()
|
void RenderObject::renderCollision()
|
||||||
|
|
|
@ -233,7 +233,6 @@ public:
|
||||||
//-------------------------------- Methods above, fields below
|
//-------------------------------- Methods above, fields below
|
||||||
|
|
||||||
static bool renderCollisionShape;
|
static bool renderCollisionShape;
|
||||||
static bool integerizePositionForRender;
|
|
||||||
static bool renderPaths;
|
static bool renderPaths;
|
||||||
static int lastTextureApplied;
|
static int lastTextureApplied;
|
||||||
static bool lastTextureRepeat;
|
static bool lastTextureRepeat;
|
||||||
|
@ -274,8 +273,6 @@ public:
|
||||||
bool shareAlphaWithChildren;
|
bool shareAlphaWithChildren;
|
||||||
bool shareColorWithChildren;
|
bool shareColorWithChildren;
|
||||||
|
|
||||||
bool renderBorders;
|
|
||||||
|
|
||||||
bool cull;
|
bool cull;
|
||||||
int updateCull;
|
int updateCull;
|
||||||
int layer;
|
int layer;
|
||||||
|
@ -302,7 +299,6 @@ public:
|
||||||
|
|
||||||
CollideRects collisionRects;
|
CollideRects collisionRects;
|
||||||
int collisionMaskRadius;
|
int collisionMaskRadius;
|
||||||
int touchDamage;
|
|
||||||
|
|
||||||
float alphaMod;
|
float alphaMod;
|
||||||
|
|
||||||
|
@ -370,8 +366,6 @@ protected:
|
||||||
StateData *stateData;
|
StateData *stateData;
|
||||||
float decayRate;
|
float decayRate;
|
||||||
float maxLife;
|
float maxLife;
|
||||||
|
|
||||||
static InterpolatedVector savePosition;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue