1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-23 14:35:02 +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:
fgenesis 2012-01-31 19:25:13 +01:00
parent 52881c97a3
commit f2d112b693
7 changed files with 50 additions and 106 deletions

View file

@ -1250,7 +1250,7 @@ This build is not yet final, and as such there are a couple things lacking. They
console = new DebugFont;
//(&dsq->smallFont);
{
console->position = Vector(10,400);
console->position = Vector(10 - virtualOffX,400);
console->followCamera = 1;
console->alpha = 0;
//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(500,350);
cmDebug->position = Vector(50,50);
cmDebug->position = Vector(20 - virtualOffX,50);
cmDebug->followCamera = 1;
cmDebug->alpha = 0;
//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->setFontSize(6);
//fpsText->position = Vector(10,15+200);
fpsText->position = Vector(10,560);
fpsText->position = Vector(10 - virtualOffX,580);
fpsText->position.z = 5;
//fpsText->position += Vector(0,-200);
//fpsText->setAlign(ALIGN_LEFT);
fpsText->setText("FPS");
fpsText->alphaMod = 0; // 0.5
fpsText->alpha= 0;
//fpsText->followCamera = 1;
}
addRenderObject(fpsText, LR_DEBUG_TEXT);
if (isDeveloperKeys())
{
fpsText->alpha = 1;
}
else
{
fpsText->alpha = 0;
}
precacher.precacheList("data/precache.txt", loadBitForTexPrecache);
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("visionwakeup");
*/
#if defined(AQUARIA_FULL) || defined(AQUARIA_DEMO)
float trans = 0.5;
overlay->alpha.interpolateTo(1, trans);
core->main(trans);
#endif
removeRenderObject(loading);
loading = 0;
removeRenderObject(sidel);
@ -1603,8 +1594,11 @@ This build is not yet final, and as such there are a couple things lacking. They
bindInput();
//title();
#if defined(AQUARIA_FULL) || defined(AQUARIA_DEMO)
enqueueJumpState("BitBlotLogo");
#else
title();
#endif
}
void DSQ::recreateBlackBars()
@ -2030,6 +2024,7 @@ void DSQ::toggleConsole()
{
console->alpha.interpolateTo(1, 0.1);
cmDebug->alpha.interpolateTo(1, 0.1);
fpsText->alpha.interpolateTo(1, 0.1);
if (profRender)
profRender->alpha.interpolateTo(1, 0.1);
RenderObject::renderPaths = true;
@ -2038,6 +2033,7 @@ void DSQ::toggleConsole()
{
console->alpha.interpolateTo(0, 0.1);
cmDebug->alpha.interpolateTo(0, 0.1);
fpsText->alpha.interpolateTo(0, 0.1);
if (profRender)
profRender->alpha.interpolateTo(0, 0.1);
RenderObject::renderPaths = false;
@ -4462,12 +4458,12 @@ void DSQ::onUpdate(float dt)
os << " ca: " << ca << " ma: " << ma << std::endl;
os << dsq->sound->getVolumeString() << std::endl;
os << core->globalResolutionScale.x << ", " << core->globalResolutionScale.y << std::endl;
os << "Lua mem: " << scriptInterface.gcGetStats() << " KB" << std::endl;
cmDebug->setText(os.str());
}
if (isDeveloperKeys() && fpsText)
if (isDeveloperKeys() && fpsText && cmDebug && cmDebug->alpha == 1)
{
std::ostringstream os;
os << "FPS: " << core->fps << " | ROC: " << core->renderObjectCount;
@ -4798,9 +4794,14 @@ void DSQ::modifyDt(float &dt)
if (isDeveloperKeys())
{
if (core->getKeyState(KEY_G))
dt = 0.075f;
dt *= 4;
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))
dt = FRAME_TIME;
else

View file

@ -1503,16 +1503,6 @@ luaFunc(entity_setFillGrid)
luaReturnNum(0);
}
luaFunc(entity_setTouchDamage)
{
Entity *e = entity(L);
if (e)
{
e->touchDamage = lua_tonumber(L, 2);
}
luaReturnNum(0);
}
luaFunc(entity_setCollideRadius)
{
Entity *e = entity(L);
@ -4621,16 +4611,6 @@ luaFunc(bone_setTexture)
luaReturnNum(0);
}
luaFunc(bone_setTouchDamage)
{
Bone *b = bone(L);
if (b)
{
b->touchDamage = lua_tonumber(L, 2);
}
luaReturnNum(0);
}
luaFunc(bone_getIndex)
{
Bone *b = bone(L);
@ -8064,7 +8044,6 @@ static const struct {
luaRegister(entity_setCollideRadius),
luaRegister(entity_getCollideRadius),
luaRegister(entity_setTouchDamage),
luaRegister(entity_isEntityInRange),
luaRegister(entity_isPositionInRange),
@ -8125,7 +8104,6 @@ static const struct {
luaRegister(bone_alpha),
luaRegister(bone_setTouchDamage),
luaRegister(bone_getNormal),
luaRegister(bone_getPosition),
luaRegister(bone_getScale),
@ -9025,6 +9003,11 @@ void ScriptInterface::collectGarbage()
lua_gc(baseState, LUA_GCCOLLECT, 0);
}
int ScriptInterface::gcGetStats()
{
return lua_gc(baseState, LUA_GCCOUNT, 0);
}
void ScriptInterface::shutdown()
{
destroyLuaVM(baseState);

View file

@ -81,6 +81,7 @@ public:
void init();
void reset();
void collectGarbage();
int gcGetStats();
void shutdown();
Script *openScript(const std::string &file, bool ignoremissing = false);

View file

@ -58,41 +58,5 @@ namespace MathFunctions
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;
*/
}
};

View file

@ -318,16 +318,19 @@ void Quad::destroy()
bool Quad::isCoordinateInside(Vector coord, int minSize)
{
int hw = fabsf((width)*getRealScale().x)*0.5f;
int hh = fabsf((height)*getRealScale().y)*0.5f;
Vector realscale = getRealScale();
int hw = fabsf((width)*realscale.x)*0.5f;
int hh = fabsf((height)*realscale.y)*0.5f;
if (hw < minSize)
hw = minSize;
if (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;
}

View file

@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <assert.h>
bool RenderObject::renderCollisionShape = false;
bool RenderObject::integerizePositionForRender = false;
int RenderObject::lastTextureApplied = 0;
bool RenderObject::lastTextureRepeat = false;
bool RenderObject::renderPaths = false;
@ -35,8 +34,6 @@ const bool RENDEROBJECT_FASTTRANSFORM = false;
RenderObjectLayer *RenderObject::rlayer = 0;
InterpolatedVector RenderObject::savePosition;
void RenderObject::toggleAlpha(float t)
{
if (alpha.x < 0.5f)
@ -176,7 +173,6 @@ RenderObject::RenderObject()
motionBlurFrameOffset = 0;
motionBlur = false;
idx = -1;
renderBorders = false;
#ifdef BBGE_BUILD_DIRECTX
useDXTransform = false;
#endif
@ -218,7 +214,6 @@ RenderObject::RenderObject()
colorIsSaved = false;
shareAlphaWithChildren = false;
shareColorWithChildren = false;
touchDamage = 0;
motionBlurTransitionTimer = 0;
}
@ -496,18 +491,26 @@ void RenderObject::disableMotionBlur()
bool RenderObject::isfhr()
{
if (parent)
return parent->isfhr();
else
return this->isfh();
RenderObject *p = this;
bool fh = false;
do
if (p->isfh())
fh = !fh;
while ((p = p->parent));
return fh;
}
bool RenderObject::isfvr()
{
if (parent)
return parent->isfvr();
else
return this->isfv();
RenderObject *p = this;
bool fv = false;
do
if (p->isfv())
fv = !fv;
while ((p = p->parent));
return fv;
}
bool RenderObject::hasRenderPass(const int pass)
@ -888,11 +891,6 @@ void RenderObject::renderCall()
position -= offset;
if (integerizePositionForRender)
{
position = savePosition;
}
}
void RenderObject::renderCollision()

View file

@ -233,7 +233,6 @@ public:
//-------------------------------- Methods above, fields below
static bool renderCollisionShape;
static bool integerizePositionForRender;
static bool renderPaths;
static int lastTextureApplied;
static bool lastTextureRepeat;
@ -274,8 +273,6 @@ public:
bool shareAlphaWithChildren;
bool shareColorWithChildren;
bool renderBorders;
bool cull;
int updateCull;
int layer;
@ -302,7 +299,6 @@ public:
CollideRects collisionRects;
int collisionMaskRadius;
int touchDamage;
float alphaMod;
@ -370,8 +366,6 @@ protected:
StateData *stateData;
float decayRate;
float maxLife;
static InterpolatedVector savePosition;
};
#endif