mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 01:33:49 +00:00
sync with icculus repo
This commit is contained in:
parent
3b39173397
commit
e64fb75f84
48 changed files with 21570 additions and 521 deletions
|
@ -44,20 +44,15 @@ Bone *lastSelectedBone = 0;
|
|||
void AnimationEditor::constrainMouse()
|
||||
{
|
||||
Vector mp=core->mouse.position;
|
||||
bool doit = false;
|
||||
if (mp.x < 200) { mp.x = 200; doit = true; }
|
||||
if (mp.x > 600) { mp.x = 600; doit = true; }
|
||||
if (mp.y < 100) { mp.y = 100; doit = true; }
|
||||
if (mp.y > 500) { mp.y = 500; doit = true; }
|
||||
if (mp.x < 200) mp.x = 200;
|
||||
if (mp.x > 600) mp.x = 600;
|
||||
if (mp.y < 100) mp.y = 100;
|
||||
if (mp.y > 500) mp.y = 500;
|
||||
core->setMousePosition(mp);
|
||||
|
||||
if(doit)
|
||||
{
|
||||
core->setMousePosition(mp);
|
||||
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
}
|
||||
|
||||
KeyframeWidget::KeyframeWidget(int key) : Quad()
|
||||
|
@ -412,11 +407,6 @@ void AnimationEditor::applyState()
|
|||
text->setFontSize(6);
|
||||
addRenderObject(text, LR_HUD);
|
||||
|
||||
text2 = new DebugFont();
|
||||
text2->position = Vector(200,510);
|
||||
text2->setFontSize(6);
|
||||
addRenderObject(text2, LR_HUD);
|
||||
|
||||
editSprite->setSelectedBone(0);
|
||||
|
||||
dsq->overlay->alpha.interpolateTo(0, 0.5);
|
||||
|
@ -666,24 +656,13 @@ void AnimationEditor::update(float dt)
|
|||
os << " keyTime: " << k->t;
|
||||
}
|
||||
|
||||
Vector ebdata;
|
||||
|
||||
if (editingBone)
|
||||
{
|
||||
os << " bone: " << editingBone->name;
|
||||
ebdata.x = editingBone->position.x;
|
||||
ebdata.y = editingBone->position.y;
|
||||
ebdata.z = editingBone->rotation.z;
|
||||
|
||||
}
|
||||
text->setText(os.str());
|
||||
|
||||
char t2buf[256];
|
||||
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f, idx: %d", ebdata.x, ebdata.y,
|
||||
ebdata.z, editSprite->getSelectedBoneIdx());
|
||||
text2->setText(t2buf);
|
||||
|
||||
|
||||
|
||||
if (core->mouse.buttons.middle)
|
||||
{
|
||||
editSprite->position += core->mouse.change;
|
||||
|
@ -758,7 +737,7 @@ void AnimationEditor::update(float dt)
|
|||
}
|
||||
if (editingBone && boneEdit == 1)
|
||||
{
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset;
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset + core->getVirtualOffX();
|
||||
constrainMouse();
|
||||
}
|
||||
if (editingBone && boneEdit == 2)
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../BBGE/BitmapFont.h"
|
||||
#include "../BBGE/Quad.h"
|
||||
#include "../BBGE/ActionMapper.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "../BBGE/Slider.h"
|
||||
#include "../BBGE/DebugFont.h"
|
||||
#include "../BBGE/TTFFont.h"
|
||||
|
|
|
@ -517,10 +517,10 @@ void SongIcon::onUpdate(float dt)
|
|||
rippleTimer = 0.5f - (note/7.0f)*0.4f;
|
||||
|
||||
if (core->afterEffectManager)
|
||||
{
|
||||
{
|
||||
core->afterEffectManager->addEffect(new ShockEffect(position - Vector(400, 300) + Vector(core->width/2, core->height/2),
|
||||
core->screenCenter,0.009f,0.015f,18,0.2f, 0.9f + (note*0.08f) ));
|
||||
}
|
||||
core->screenCenter,0.009f,0.015f,18,0.2f, 0.9f + (note*0.08f) ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4557,7 +4557,7 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
|||
pullTarget = 0;
|
||||
revertTimer = 0;
|
||||
currentSongIdx = -1;
|
||||
leaches = 0;
|
||||
leaches = 0;
|
||||
|
||||
|
||||
debugLog("Avatar vars->");
|
||||
|
|
|
@ -354,7 +354,7 @@ public:
|
|||
|
||||
void revert();
|
||||
|
||||
int leaches;
|
||||
int leaches;
|
||||
|
||||
protected:
|
||||
void setSongIconPositions();
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "AutoMap.h"
|
||||
#include "GridRender.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
|
||||
#define MAX_EATS 8
|
||||
|
||||
|
@ -1982,14 +1982,14 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
|
|||
if (type == WT_SPIRIT)
|
||||
{
|
||||
|
||||
if(dsq->user.video.blur)
|
||||
{
|
||||
core->postProcessingFx.blendType = 1;
|
||||
core->postProcessingFx.intensity = 0.2f;
|
||||
core->postProcessingFx.layer = LR_AFTER_EFFECTS;//LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.renderLayer = LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.enable(FXT_RADIALBLUR);
|
||||
}
|
||||
if(dsq->user.video.blur)
|
||||
{
|
||||
core->postProcessingFx.blendType = 1;
|
||||
core->postProcessingFx.intensity = 0.2f;
|
||||
core->postProcessingFx.layer = LR_AFTER_EFFECTS;//LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.renderLayer = LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.enable(FXT_RADIALBLUR);
|
||||
}
|
||||
|
||||
dsq->game->avatar->canWarp = false;
|
||||
|
||||
|
@ -2886,7 +2886,7 @@ void Continuity::loadFile(int slot)
|
|||
//dsq->game->transitionToScene();
|
||||
}
|
||||
|
||||
loadSongBank();
|
||||
loadSongBank();
|
||||
}
|
||||
|
||||
void Continuity::setNaijaModel(std::string model)
|
||||
|
@ -3207,12 +3207,12 @@ void Continuity::reset()
|
|||
|
||||
loadTreasureData();
|
||||
|
||||
stringBank.load();
|
||||
stringBank.load("data/stringbank.txt");
|
||||
|
||||
gems.clear();
|
||||
beacons.clear();
|
||||
|
||||
worldMap.load();
|
||||
worldMap.load("data/worldmap.txt");
|
||||
|
||||
ingredients.clear();
|
||||
|
||||
|
@ -3227,7 +3227,7 @@ void Continuity::reset()
|
|||
if(dsq->mod.isActive())
|
||||
{
|
||||
//load mod ingredients
|
||||
loadIngredientData(dsq->mod.getPath() + "ingredients.txt");
|
||||
loadIngredientData(dsq->mod.getPath() + "data/ingredients.txt");
|
||||
}
|
||||
|
||||
//load ingredients for the main game
|
||||
|
|
|
@ -1241,9 +1241,9 @@ This build is not yet final, and as such there are a couple things lacking. They
|
|||
dsq->darkLayer.toggle(0);
|
||||
debugLog("done");
|
||||
|
||||
debugLog("post FX init");
|
||||
dsq->postProcessingFx.init();
|
||||
debugLog("done");
|
||||
debugLog("post FX init");
|
||||
dsq->postProcessingFx.init();
|
||||
debugLog("done");
|
||||
|
||||
|
||||
#ifdef AQUARIA_BUILD_CONSOLE
|
||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../BBGE/BitmapFont.h"
|
||||
#include "../BBGE/ScreenTransition.h"
|
||||
#include "../BBGE/Precacher.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "AquariaMenuItem.h"
|
||||
#include "ScriptInterface.h"
|
||||
|
||||
|
@ -206,11 +206,10 @@ class StringBank
|
|||
{
|
||||
public:
|
||||
StringBank();
|
||||
void load();
|
||||
void load(const std::string &file);
|
||||
|
||||
std::string get(int idx);
|
||||
protected:
|
||||
void _load(const std::string &file);
|
||||
|
||||
typedef std::map<int, std::string> StringMap;
|
||||
StringMap stringMap;
|
||||
|
@ -261,7 +260,6 @@ public:
|
|||
|
||||
bool isActive();
|
||||
bool isDebugMenu();
|
||||
bool hasWorldMap();
|
||||
|
||||
std::string getPath();
|
||||
std::string getName();
|
||||
|
@ -271,7 +269,6 @@ public:
|
|||
protected:
|
||||
bool shuttingDown;
|
||||
bool active;
|
||||
bool hasMap;
|
||||
int doRecache;
|
||||
int debugMenu;
|
||||
int enqueueModStart;
|
||||
|
@ -584,8 +581,8 @@ protected:
|
|||
struct WorldMap
|
||||
{
|
||||
WorldMap();
|
||||
void load();
|
||||
void save();
|
||||
void load(const std::string &file);
|
||||
void save(const std::string &file);
|
||||
void hideMap();
|
||||
void revealMap(const std::string &name);
|
||||
WorldMapTile *getWorldMapTile(const std::string &name);
|
||||
|
@ -598,9 +595,6 @@ struct WorldMap
|
|||
int gw, gh;
|
||||
typedef std::vector<WorldMapTile> WorldMapTiles;
|
||||
WorldMapTiles worldMapTiles;
|
||||
|
||||
private:
|
||||
void _load(const std::string &file);
|
||||
};
|
||||
|
||||
class Path;
|
||||
|
|
|
@ -1723,10 +1723,10 @@ void Entity::clearDamageTargets()
|
|||
|
||||
void Entity::setDamageTarget(DamageType dt, bool v)
|
||||
{
|
||||
if (v)
|
||||
disabledDamageTypes.erase(dt);
|
||||
else
|
||||
disabledDamageTypes.insert(dt);
|
||||
if (v)
|
||||
disabledDamageTypes.erase(dt);
|
||||
else
|
||||
disabledDamageTypes.insert(dt);
|
||||
}
|
||||
|
||||
void Entity::setEatType(EatType et, const std::string &file)
|
||||
|
@ -1742,17 +1742,17 @@ void Entity::setEatType(EatType et, const std::string &file)
|
|||
|
||||
void Entity::setAllDamageTargets(bool v)
|
||||
{
|
||||
if (v)
|
||||
clearDamageTargets(); // clear all disabled -> all allowed now
|
||||
else
|
||||
{
|
||||
for (int i = DT_ENEMY; i < DT_ENEMY_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR; i < DT_AVATAR_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
}
|
||||
if (v)
|
||||
clearDamageTargets(); // clear all disabled -> all allowed now
|
||||
else
|
||||
{
|
||||
for (int i = DT_ENEMY; i < DT_ENEMY_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR; i < DT_AVATAR_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::isDamageTarget(DamageType dt)
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../BBGE/DFSprite.h"
|
||||
#include "../BBGE/StateMachine.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "../BBGE/SkeletalSprite.h"
|
||||
|
||||
#include "DSQ.h"
|
||||
|
|
|
@ -6983,10 +6983,8 @@ void Game::applyState()
|
|||
|
||||
core->sort();
|
||||
|
||||
if (dsq->mod.isActive())
|
||||
dsq->runScript(dsq->mod.getPath() + "scripts/premap_" + sceneName + ".lua", "init", true);
|
||||
else
|
||||
dsq->runScript("scripts/maps/premap_"+sceneName+".lua", "init", true);
|
||||
|
||||
dsq->runScript("scripts/maps/premap_"+sceneName+".lua", "init", true);
|
||||
|
||||
std::string musicToPlay = this->musicToPlay;
|
||||
if (!overrideMusic.empty())
|
||||
|
@ -7078,10 +7076,7 @@ void Game::applyState()
|
|||
dsq->subtitlePlayer.show(0.25);
|
||||
|
||||
if (verbose) debugLog("loading map init script");
|
||||
if (dsq->mod.isActive())
|
||||
dsq->runScript(dsq->mod.getPath() + "scripts/map_" + sceneName + ".lua", "init", true);
|
||||
else
|
||||
dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init", true);
|
||||
dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init", true);
|
||||
|
||||
if (!dsq->doScreenTrans && (dsq->overlay->alpha != 0 && !dsq->overlay->alpha.isInterpolating()))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "../BBGE/DebugFont.h"
|
||||
#include "../ExternalLibs/glpng.h"
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@ protected:
|
|||
unsigned char *savedTexData;
|
||||
bool mb;
|
||||
Vector lastMousePosition; // See FIXME in WorldMapRender.cpp --achurch
|
||||
void updateEditor();
|
||||
};
|
||||
|
||||
class PathRender : public RenderObject
|
||||
|
|
|
@ -243,7 +243,7 @@ void MiniMapRender::onUpdate(float dt)
|
|||
RenderObject::onUpdate(dt);
|
||||
|
||||
position.x = core->getVirtualWidth() - core->getVirtualOffX() - getMiniMapWidth()/2;
|
||||
position.y = core->getVirtualHeight() - getMiniMapHeight()/2;
|
||||
position.y = 600 - getMiniMapHeight()/2;
|
||||
position.z = 2.9;
|
||||
|
||||
waterSin += dt * (bitSizeLookupPeriod / (2*PI));
|
||||
|
@ -359,7 +359,7 @@ void MiniMapRender::onUpdate(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
if (!btn && !radarHide && (!dsq->mod.isActive() || dsq->mod.hasWorldMap()))
|
||||
if (!btn && !dsq->mod.isActive() && !radarHide)
|
||||
{
|
||||
if (dsq->game->worldMapRender->isOn())
|
||||
{
|
||||
|
|
|
@ -58,7 +58,6 @@ void Mod::clear()
|
|||
active = false;
|
||||
doRecache = 0;
|
||||
debugMenu = false;
|
||||
hasMap = false;
|
||||
}
|
||||
|
||||
bool Mod::isDebugMenu()
|
||||
|
@ -66,11 +65,6 @@ bool Mod::isDebugMenu()
|
|||
return debugMenu;
|
||||
}
|
||||
|
||||
bool Mod::hasWorldMap()
|
||||
{
|
||||
return hasMap;
|
||||
}
|
||||
|
||||
void Mod::loadModXML(TiXmlDocument *d, std::string modName)
|
||||
{
|
||||
d->LoadFile(baseModPath + modName + ".xml");
|
||||
|
@ -118,12 +112,6 @@ void Mod::load(const std::string &p)
|
|||
if (props->Attribute("debugMenu")) {
|
||||
props->Attribute("debugMenu", &debugMenu);
|
||||
}
|
||||
|
||||
if (props->Attribute("hasWorldMap")) {
|
||||
int t;
|
||||
props->Attribute("hasWorldMap", &t);
|
||||
hasMap = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
void songNoteDone(int note, float len);
|
||||
bool hasScript();
|
||||
std::string name; // full node string
|
||||
std::string label; // first part only (the actual node name)
|
||||
std::string label; // first part only (the actual node name)
|
||||
std::vector<PathNode>nodes;
|
||||
void removeNode(int idx);
|
||||
void addNode(int idx);
|
||||
|
|
|
@ -2429,15 +2429,19 @@ void SceneEditor::moveElementToLayer(Element *e, int bgLayer)
|
|||
{
|
||||
Element *e = selectedElements[i];
|
||||
core->removeRenderObject(e, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
dsq->removeElement(e);
|
||||
e->bgLayer = bgLayer;
|
||||
dsq->addElement(e);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
}
|
||||
}
|
||||
else if (e)
|
||||
{
|
||||
core->removeRenderObject(e, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
dsq->removeElement(e);
|
||||
e->bgLayer = bgLayer;
|
||||
dsq->addElement(e);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2998,8 +3002,8 @@ void SceneEditor::doPrevElement()
|
|||
if (curElement < 0)
|
||||
curElement = dsq->game->elementTemplates.size()-1;
|
||||
|
||||
if(curElement < 0)
|
||||
return;
|
||||
if (curElement < 0)
|
||||
return;
|
||||
|
||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||
{
|
||||
|
|
|
@ -280,10 +280,10 @@ static const char * const interfaceFunctions[] = {
|
|||
|
||||
static void scriptError(const std::string& msg)
|
||||
{
|
||||
if(loudScriptErrors)
|
||||
errorLog(msg);
|
||||
else
|
||||
debugLog(msg);
|
||||
if(loudScriptErrors)
|
||||
errorLog(msg);
|
||||
else
|
||||
debugLog(msg);
|
||||
}
|
||||
|
||||
static void luaErrorMsg(lua_State *L, const char *msg)
|
||||
|
@ -489,10 +489,10 @@ static SkeletalSprite *getSkeletalSprite(Entity *e)
|
|||
|
||||
static bool looksLikeGlobal(const char *s)
|
||||
{
|
||||
for( ; *s; ++s)
|
||||
if( !((*s >= 'A' && *s <= 'Z') || *s == '_' || (*s >= '0' && *s <= '9')) ) // accept any uppercase, number, and _ char
|
||||
return false;
|
||||
return true;
|
||||
for( ; *s; ++s)
|
||||
if( !((*s >= 'A' && *s <= 'Z') || *s == '_' || (*s >= '0' && *s <= '9')) ) // accept any uppercase, number, and _ char
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------//
|
||||
|
@ -634,31 +634,31 @@ luaFunc(indexWarnInstance)
|
|||
|
||||
static int dofile_helper(lua_State *L, const char *fname)
|
||||
{
|
||||
int n = lua_gettop(L);
|
||||
if (luaL_loadfile(L, fname) != 0) lua_error(L);
|
||||
lua_call(L, 0, LUA_MULTRET);
|
||||
return lua_gettop(L) - n;
|
||||
int n = lua_gettop(L);
|
||||
if (luaL_loadfile(L, fname) != 0) lua_error(L);
|
||||
lua_call(L, 0, LUA_MULTRET);
|
||||
return lua_gettop(L) - n;
|
||||
}
|
||||
|
||||
luaFunc(dofile_caseinsensitive)
|
||||
{
|
||||
// This is Lua's dofile(), with some tweaks. --ryan.
|
||||
const char *rawname = luaL_checkstring(L, 1);
|
||||
const char *rawname = luaL_checkstring(L, 1);
|
||||
std::string fname;
|
||||
|
||||
if (dsq->mod.isActive())
|
||||
{
|
||||
fname += dsq->mod.getPath();
|
||||
fname += '/';
|
||||
fname += rawname;
|
||||
fname = core->adjustFilenameCase(fname);
|
||||
if (exists(fname))
|
||||
return dofile_helper(L, fname.c_str());
|
||||
}
|
||||
if (dsq->mod.isActive())
|
||||
{
|
||||
fname += dsq->mod.getPath();
|
||||
fname += '/';
|
||||
fname += rawname;
|
||||
fname = core->adjustFilenameCase(fname);
|
||||
if (exists(fname))
|
||||
return dofile_helper(L, fname.c_str());
|
||||
}
|
||||
|
||||
// try absolute path
|
||||
fname = core->adjustFilenameCase(rawname);
|
||||
return dofile_helper(L, fname.c_str());
|
||||
// try absolute path
|
||||
fname = core->adjustFilenameCase(rawname);
|
||||
return dofile_helper(L, fname.c_str());
|
||||
}
|
||||
|
||||
luaFunc(randRange)
|
||||
|
@ -1039,8 +1039,8 @@ luaFunc(entity_setBoneLock)
|
|||
Entity *e = entity(L);
|
||||
Entity *e2 = entity(L, 2);
|
||||
Bone *b = 0;
|
||||
if (lua_isuserdata(L, 3))
|
||||
b = bone(L, 3);
|
||||
if (lua_isuserdata(L, 3))
|
||||
b = bone(L, 3);
|
||||
bool ret = false;
|
||||
if (e)
|
||||
{
|
||||
|
@ -2297,9 +2297,9 @@ luaFunc(entity_setColor)
|
|||
if (e)
|
||||
{
|
||||
//e->color = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4));
|
||||
e->color.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4)),
|
||||
lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
e->color.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4)),
|
||||
lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
luaReturnInt(0);
|
||||
}
|
||||
|
||||
|
@ -3289,13 +3289,13 @@ luaFunc(node_getName)
|
|||
|
||||
luaFunc(node_getLabel)
|
||||
{
|
||||
Path *p = path(L);
|
||||
const char *s = "";
|
||||
if (p)
|
||||
{
|
||||
s = p->label.c_str();
|
||||
}
|
||||
luaReturnStr(s);
|
||||
Path *p = path(L);
|
||||
const char *s = "";
|
||||
if (p)
|
||||
{
|
||||
s = p->label.c_str();
|
||||
}
|
||||
luaReturnStr(s);
|
||||
}
|
||||
|
||||
luaFunc(node_getPathPosition)
|
||||
|
@ -3575,7 +3575,7 @@ luaFunc(avatar_incrLeaches)
|
|||
luaFunc(avatar_decrLeaches)
|
||||
{
|
||||
if(dsq->game->avatar->leaches)
|
||||
dsq->game->avatar->leaches--;
|
||||
dsq->game->avatar->leaches--;
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5079,8 +5079,8 @@ luaFunc(updateMusic)
|
|||
luaFunc(entity_grabTarget)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
e->attachEntity(e->getTargetEntity(), Vector(lua_tointeger(L, 2), lua_tointeger(L, 3)));
|
||||
if (e)
|
||||
e->attachEntity(e->getTargetEntity(), Vector(lua_tointeger(L, 2), lua_tointeger(L, 3)));
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5116,8 +5116,8 @@ luaFunc(entity_checkSurface)
|
|||
luaFunc(entity_switchSurfaceDirection)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (!e)
|
||||
luaReturnNum(0);
|
||||
if (!e)
|
||||
luaReturnNum(0);
|
||||
|
||||
int n = -1;
|
||||
if (lua_isnumber(L, 2))
|
||||
|
@ -5337,8 +5337,8 @@ luaFunc(entity_rotateToSurfaceNormal)
|
|||
luaFunc(entity_releaseTarget)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
e->detachEntity(e->getTargetEntity());
|
||||
if (e)
|
||||
e->detachEntity(e->getTargetEntity());
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5356,9 +5356,9 @@ luaFunc(egetv)
|
|||
{
|
||||
Entity *e = entity(L);
|
||||
EV ev = (EV)lua_tointeger(L, 2);
|
||||
int v = 0;
|
||||
if (e)
|
||||
v = e->getv(ev);
|
||||
int v = 0;
|
||||
if (e)
|
||||
v = e->getv(ev);
|
||||
luaReturnNum(v);
|
||||
}
|
||||
|
||||
|
@ -5375,13 +5375,13 @@ luaFunc(esetvf)
|
|||
luaFunc(egetvf)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
float vf = 0;
|
||||
if (e)
|
||||
{
|
||||
EV ev = (EV)lua_tointeger(L, 2);
|
||||
vf = e->getvf(ev);
|
||||
}
|
||||
luaReturnNum(vf);
|
||||
float vf = 0;
|
||||
if (e)
|
||||
{
|
||||
EV ev = (EV)lua_tointeger(L, 2);
|
||||
vf = e->getvf(ev);
|
||||
}
|
||||
luaReturnNum(vf);
|
||||
}
|
||||
|
||||
luaFunc(eisv)
|
||||
|
@ -5658,15 +5658,15 @@ luaFunc(entity_setActivation)
|
|||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
int type = lua_tonumber(L, 2);
|
||||
// cursor radius
|
||||
int activationRadius = lua_tonumber(L, 3);
|
||||
int range = lua_tonumber(L, 4);
|
||||
e->activationType = (Entity::ActivationType)type;
|
||||
e->activationRange = range;
|
||||
e->activationRadius = activationRadius;
|
||||
}
|
||||
{
|
||||
int type = lua_tonumber(L, 2);
|
||||
// cursor radius
|
||||
int activationRadius = lua_tonumber(L, 3);
|
||||
int range = lua_tonumber(L, 4);
|
||||
e->activationType = (Entity::ActivationType)type;
|
||||
e->activationRange = range;
|
||||
e->activationRadius = activationRadius;
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -5684,8 +5684,8 @@ luaFunc(entity_setCullRadius)
|
|||
luaFunc(entity_setActivationType)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
e->activationType = (Entity::ActivationType)lua_tointeger(L, 2);
|
||||
if (e)
|
||||
e->activationType = (Entity::ActivationType)lua_tointeger(L, 2);
|
||||
|
||||
luaReturnInt(0);
|
||||
}
|
||||
|
@ -5837,11 +5837,11 @@ luaFunc(entity_setVelLen)
|
|||
|
||||
luaFunc(entity_getVel)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
Vector v;
|
||||
if (e)
|
||||
v = e->vel;
|
||||
luaReturnVec2(v.x, v.y);
|
||||
Entity *e = entity(L);
|
||||
Vector v;
|
||||
if (e)
|
||||
v = e->vel;
|
||||
luaReturnVec2(v.x, v.y);
|
||||
}
|
||||
|
||||
// entity dt speed dir
|
||||
|
@ -5973,8 +5973,8 @@ luaFunc(getEntityByID)
|
|||
luaFunc(node_setEffectOn)
|
||||
{
|
||||
Path *p = path(L, 1);
|
||||
if (p)
|
||||
p->setEffectOn(getBool(L, 2));
|
||||
if (p)
|
||||
p->setEffectOn(getBool(L, 2));
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5994,19 +5994,19 @@ luaFunc(node_activate)
|
|||
luaFunc(node_setElementsInLayerActive)
|
||||
{
|
||||
Path *p = path(L);
|
||||
if (p)
|
||||
{
|
||||
int l = lua_tonumber(L, 2);
|
||||
bool v = getBool(L, 3);
|
||||
for (Element *e = dsq->getFirstElementOnLayer(l); e; e = e->bgLayerNext)
|
||||
{
|
||||
if (e && p->isCoordinateInside(e->position))
|
||||
{
|
||||
debugLog("setting an element to the value");
|
||||
e->setElementActive(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p)
|
||||
{
|
||||
int l = lua_tonumber(L, 2);
|
||||
bool v = getBool(L, 3);
|
||||
for (Element *e = dsq->getFirstElementOnLayer(l); e; e = e->bgLayerNext)
|
||||
{
|
||||
if (e && p->isCoordinateInside(e->position))
|
||||
{
|
||||
debugLog("setting an element to the value");
|
||||
e->setElementActive(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -6055,11 +6055,11 @@ luaFunc(node_getNearestEntity)
|
|||
|
||||
Vector pos = p->nodes[0].position;
|
||||
std::string name;
|
||||
Entity *ignore = 0;
|
||||
Entity *ignore = 0;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
if (lua_isuserdata(L, 3))
|
||||
ignore = entity(L, 3);
|
||||
if (lua_isuserdata(L, 3))
|
||||
ignore = entity(L, 3);
|
||||
|
||||
float smallestDist = HUGE_VALF;
|
||||
FOR_ENTITIES(i)
|
||||
|
@ -6091,7 +6091,7 @@ luaFunc(node_getNearestNode)
|
|||
std::string name;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
Path *ignore = path(L, 3);
|
||||
Path *ignore = path(L, 3);
|
||||
closest = dsq->game->getNearestPath(p->nodes[0].position, name, ignore);
|
||||
}
|
||||
luaReturnPtr(closest);
|
||||
|
@ -6122,15 +6122,15 @@ luaFunc(entity_getNearestBoneToPosition)
|
|||
luaFunc(entity_getNearestNode)
|
||||
{
|
||||
Entity *me = entity(L);
|
||||
Path *closest = 0;
|
||||
if (me)
|
||||
{
|
||||
std::string name;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
Path *ignore = path(L, 3);
|
||||
closest = dsq->game->getNearestPath(me->position, name, ignore);
|
||||
}
|
||||
Path *closest = 0;
|
||||
if (me)
|
||||
{
|
||||
std::string name;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
Path *ignore = path(L, 3);
|
||||
closest = dsq->game->getNearestPath(me->position, name, ignore);
|
||||
}
|
||||
luaReturnPtr(closest);
|
||||
}
|
||||
|
||||
|
@ -6144,8 +6144,8 @@ luaFunc(ing_hasIET)
|
|||
luaFunc(entity_getNearestEntity)
|
||||
{
|
||||
Entity *me = entity(L);
|
||||
if (!me)
|
||||
luaReturnPtr(0);
|
||||
if (!me)
|
||||
luaReturnPtr(0);
|
||||
|
||||
const char *name = 0;
|
||||
if (lua_isstring(L, 2))
|
||||
|
@ -6166,9 +6166,9 @@ luaFunc(entity_getNearestEntity)
|
|||
int type = lua_tointeger(L, 4);
|
||||
int damageTarget = lua_tointeger(L, 5);
|
||||
Entity *closest = 0;
|
||||
Entity *ignore = 0;
|
||||
if (lua_isuserdata(L, 6))
|
||||
ignore = entity(L, 6);
|
||||
Entity *ignore = 0;
|
||||
if (lua_isuserdata(L, 6))
|
||||
ignore = entity(L, 6);
|
||||
|
||||
float smallestDist = range ? sqr(range) : HUGE_VALF;
|
||||
FOR_ENTITIES(i)
|
||||
|
@ -6303,17 +6303,17 @@ luaFunc(entity_alpha)
|
|||
luaFunc(entity_partAlpha)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
float start = lua_tonumber(L, 3);
|
||||
if (start != -1)
|
||||
r->alpha = start;
|
||||
r->alpha.interpolateTo(lua_tonumber(L, 4), lua_tonumber(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
}
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
float start = lua_tonumber(L, 3);
|
||||
if (start != -1)
|
||||
r->alpha = start;
|
||||
r->alpha.interpolateTo(lua_tonumber(L, 4), lua_tonumber(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -6321,22 +6321,22 @@ luaFunc(entity_partAlpha)
|
|||
luaFunc(entity_partBlendType)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
e->partMap[lua_tostring(L, 2)]->setBlendType(lua_tointeger(L, 3));
|
||||
if (e)
|
||||
e->partMap[lua_tostring(L, 2)]->setBlendType(lua_tointeger(L, 3));
|
||||
luaReturnInt(0);
|
||||
}
|
||||
|
||||
luaFunc(entity_partRotate)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
r->rotation.interpolateTo(Vector(0,0,lua_tointeger(L, 3)), lua_tonumber(L, 4), lua_tointeger(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7));
|
||||
}
|
||||
}
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
r->rotation.interpolateTo(Vector(0,0,lua_tointeger(L, 3)), lua_tonumber(L, 4), lua_tointeger(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7));
|
||||
}
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -6376,30 +6376,30 @@ luaFunc(entity_offsetUpdate)
|
|||
luaFunc(entity_scale)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
{
|
||||
float time = lua_tonumber(L, 4);
|
||||
//e->scale = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3));
|
||||
e->scale.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), 0), time, lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tonumber(L, 7));
|
||||
}
|
||||
luaReturnNum(0);
|
||||
if (e)
|
||||
{
|
||||
float time = lua_tonumber(L, 4);
|
||||
//e->scale = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3));
|
||||
e->scale.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), 0), time, lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tonumber(L, 7));
|
||||
}
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
luaFunc(entity_switchLayer)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
{
|
||||
int lcode = lua_tonumber(L, 2);
|
||||
int toLayer = LR_ENTITIES;
|
||||
if (e)
|
||||
{
|
||||
int lcode = lua_tonumber(L, 2);
|
||||
int toLayer = LR_ENTITIES;
|
||||
|
||||
toLayer = dsq->getEntityLayerToLayer(lcode);
|
||||
toLayer = dsq->getEntityLayerToLayer(lcode);
|
||||
|
||||
if (e->getEntityType() == ET_AVATAR)
|
||||
toLayer = LR_ENTITIES;
|
||||
if (e->getEntityType() == ET_AVATAR)
|
||||
toLayer = LR_ENTITIES;
|
||||
|
||||
core->switchRenderObjectLayer(e, toLayer);
|
||||
}
|
||||
core->switchRenderObjectLayer(e, toLayer);
|
||||
}
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -6508,24 +6508,24 @@ luaFunc(entity_initPart)
|
|||
|
||||
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
Quad *q = new Quad;
|
||||
q->setTexture(partTex);
|
||||
q->renderBeforeParent = !renderAfter;
|
||||
if (e)
|
||||
{
|
||||
Quad *q = new Quad;
|
||||
q->setTexture(partTex);
|
||||
q->renderBeforeParent = !renderAfter;
|
||||
|
||||
|
||||
q->position = partPosition;
|
||||
if (offsetInterpolateTo.x != 0 || offsetInterpolateTo.y != 0)
|
||||
q->offset.interpolateTo(offsetInterpolateTo, offsetInterpolateTime, -1, 1, 1);
|
||||
if (partFlipH)
|
||||
q->flipHorizontal();
|
||||
if (partFlipV)
|
||||
q->flipVertical();
|
||||
q->position = partPosition;
|
||||
if (offsetInterpolateTo.x != 0 || offsetInterpolateTo.y != 0)
|
||||
q->offset.interpolateTo(offsetInterpolateTo, offsetInterpolateTime, -1, 1, 1);
|
||||
if (partFlipH)
|
||||
q->flipHorizontal();
|
||||
if (partFlipV)
|
||||
q->flipVertical();
|
||||
|
||||
e->addChild(q, PM_POINTER);
|
||||
e->registerNewPart(q, partName);
|
||||
}
|
||||
e->addChild(q, PM_POINTER);
|
||||
e->registerNewPart(q, partName);
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -7105,14 +7105,14 @@ luaFunc(entity_setFlag)
|
|||
|
||||
luaFunc(entity_getFlag)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
int v = lua_tonumber(L, 2);
|
||||
int ret = 0;
|
||||
if (e)
|
||||
{
|
||||
ret = dsq->continuity.getEntityFlag(dsq->game->sceneName, e->getID());
|
||||
}
|
||||
luaReturnNum(ret);
|
||||
Entity *e = entity(L);
|
||||
int v = lua_tonumber(L, 2);
|
||||
int ret = 0;
|
||||
if (e)
|
||||
{
|
||||
ret = dsq->continuity.getEntityFlag(dsq->game->sceneName, e->getID());
|
||||
}
|
||||
luaReturnNum(ret);
|
||||
}
|
||||
|
||||
luaFunc(isFlag)
|
||||
|
@ -7639,7 +7639,7 @@ static const struct {
|
|||
luaRegister(entity_moveAround),
|
||||
|
||||
luaRegister(entity_setVelLen),
|
||||
luaRegister(entity_getVel),
|
||||
luaRegister(entity_getVel),
|
||||
|
||||
luaRegister(entity_setMaxSpeed),
|
||||
luaRegister(entity_getMaxSpeed),
|
||||
|
@ -7828,7 +7828,7 @@ static const struct {
|
|||
|
||||
luaRegister(entity_isFlag),
|
||||
luaRegister(entity_setFlag),
|
||||
luaRegister(entity_getFlag),
|
||||
luaRegister(entity_getFlag),
|
||||
|
||||
luaRegister(node_isFlag),
|
||||
luaRegister(node_setFlag),
|
||||
|
@ -8002,7 +8002,7 @@ static const struct {
|
|||
|
||||
luaRegister(node_activate),
|
||||
luaRegister(node_getName),
|
||||
luaRegister(node_getLabel),
|
||||
luaRegister(node_getLabel),
|
||||
luaRegister(node_getPathPosition),
|
||||
luaRegister(node_getPosition),
|
||||
luaRegister(node_setPosition),
|
||||
|
@ -8175,10 +8175,10 @@ static const struct {
|
|||
luaRegister(getLastCollidePosition),
|
||||
|
||||
|
||||
// -- deprecated/compatibility related functions below here --
|
||||
// -- deprecated/compatibility related functions below here --
|
||||
|
||||
{"entity_incrTargetLeaches", l_avatar_incrLeaches},
|
||||
{"entity_decrTargetLeaches", l_avatar_decrLeaches},
|
||||
{"entity_incrTargetLeaches", l_avatar_incrLeaches},
|
||||
{"entity_decrTargetLeaches", l_avatar_decrLeaches},
|
||||
};
|
||||
|
||||
//============================================================================================
|
||||
|
@ -9039,9 +9039,9 @@ Script *ScriptInterface::openScript(const std::string &file, bool ignoremissing
|
|||
int result = luaL_loadfile(baseState, realFile.c_str());
|
||||
if (result != 0)
|
||||
{
|
||||
if(result != LUA_ERRFILE || (result == LUA_ERRFILE && !ignoremissing))
|
||||
scriptError("Error loading script [" + realFile + "]: " + lua_tostring(baseState, -1));
|
||||
lua_pop(baseState, 2);
|
||||
if(result != LUA_ERRFILE || (result == LUA_ERRFILE && !ignoremissing))
|
||||
scriptError("Error loading script [" + realFile + "]: " + lua_tostring(baseState, -1));
|
||||
lua_pop(baseState, 2);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
SkeletalSprite *editSprite;
|
||||
Bone *editingBone;
|
||||
int boneEdit;
|
||||
DebugFont *text, *text2;
|
||||
DebugFont *text;
|
||||
int ignoreBone;
|
||||
|
||||
void ignoreBone0();
|
||||
|
|
|
@ -24,18 +24,10 @@ StringBank::StringBank()
|
|||
{
|
||||
}
|
||||
|
||||
void StringBank::load()
|
||||
{
|
||||
stringMap.clear();
|
||||
|
||||
_load("data/stringbank.txt");
|
||||
if (dsq->mod.isActive())
|
||||
_load(dsq->mod.getPath() + "stringbank.txt");
|
||||
}
|
||||
|
||||
void StringBank::_load(const std::string &file)
|
||||
void StringBank::load(const std::string &file)
|
||||
{
|
||||
//debugLog("StringBank::load("+file+")");
|
||||
stringMap.clear();
|
||||
|
||||
std::ifstream in(file.c_str());
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "Game.h"
|
||||
#include "Avatar.h"
|
||||
#else
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#endif
|
||||
|
||||
#ifdef BBGE_BUILD_WINDOWS
|
||||
|
|
|
@ -1029,61 +1029,59 @@ void WorldMapRender::onUpdate(float dt)
|
|||
internalOffset += mouseChange / scale.x;
|
||||
}
|
||||
|
||||
if(!editorActive)
|
||||
{
|
||||
float scrollSpeed = 2.0f;
|
||||
float amt = (400*dt)/scale.x;
|
||||
if (isActing(ACTION_SWIMLEFT))
|
||||
{
|
||||
internalOffset += Vector(amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMRIGHT))
|
||||
{
|
||||
internalOffset += Vector(-amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMDOWN))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale -= Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, -amt);
|
||||
}
|
||||
}
|
||||
if (isActing(ACTION_SWIMUP))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale += Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, amt);
|
||||
}
|
||||
}
|
||||
|
||||
float scrollSpeed = 2.0f;
|
||||
float amt = (400*dt)/scale.x;
|
||||
if (isActing(ACTION_SWIMLEFT))
|
||||
{
|
||||
internalOffset += Vector(amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMRIGHT))
|
||||
{
|
||||
internalOffset += Vector(-amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMDOWN))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale -= Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, -amt);
|
||||
}
|
||||
}
|
||||
if (isActing(ACTION_SWIMUP))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale += Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, amt);
|
||||
}
|
||||
}
|
||||
|
||||
if (core->joystickEnabled)
|
||||
{
|
||||
if (isActing(ACTION_SECONDARY))
|
||||
{
|
||||
if (core->joystick.position.y >= 0.6f)
|
||||
scale.interpolateTo(scale / 1.2f, 0.1f);
|
||||
else if (core->joystick.position.y <= -0.6f)
|
||||
scale.interpolateTo(scale * 1.2f, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The negative multiplier is deliberate -- it makes the
|
||||
// map scroll as though the joystick was controlling the
|
||||
// cursor (which is fixed in the center of the screen).
|
||||
internalOffset += core->joystick.position * (-400*dt / scale.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (core->joystickEnabled)
|
||||
{
|
||||
if (isActing(ACTION_SECONDARY))
|
||||
{
|
||||
if (core->joystick.position.y >= 0.6f)
|
||||
scale.interpolateTo(scale / 1.2f, 0.1f);
|
||||
else if (core->joystick.position.y <= -0.6f)
|
||||
scale.interpolateTo(scale * 1.2f, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The negative multiplier is deliberate -- it makes the
|
||||
// map scroll as though the joystick was controlling the
|
||||
// cursor (which is fixed in the center of the screen).
|
||||
internalOffset += core->joystick.position * (-400*dt / scale.x);
|
||||
}
|
||||
}
|
||||
|
||||
if (activeTile && activeTile->layer == 1)
|
||||
{
|
||||
|
@ -1138,22 +1136,11 @@ void WorldMapRender::onUpdate(float dt)
|
|||
|
||||
if (core->getShiftState())
|
||||
{
|
||||
if (core->getCtrlState())
|
||||
a2 *= 10.0f;
|
||||
if (core->getKeyState(KEY_UP))
|
||||
activeTile->scale2 += -a2;
|
||||
if (core->getKeyState(KEY_DOWN))
|
||||
activeTile->scale2 += a2;
|
||||
}
|
||||
else if (core->getAltState())
|
||||
{
|
||||
if (core->getCtrlState())
|
||||
a2 *= 10.0f;
|
||||
if (core->getKeyState(KEY_UP))
|
||||
activeTile->scale += -a2;
|
||||
if (core->getKeyState(KEY_DOWN))
|
||||
activeTile->scale += a2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (core->getCtrlState())
|
||||
|
@ -1172,23 +1159,19 @@ void WorldMapRender::onUpdate(float dt)
|
|||
|
||||
if (core->getKeyState(KEY_F2))
|
||||
{
|
||||
dsq->continuity.worldMap.save();
|
||||
dsq->continuity.worldMap.save("data/WorldMap.txt");
|
||||
}
|
||||
|
||||
activeQuad->position = activeTile->gridPos;
|
||||
activeQuad->scale = Vector(0.25f*activeTile->scale2, 0.25f*activeTile->scale2);
|
||||
if(activeQuad->texture)
|
||||
activeQuad->setWidthHeight(activeQuad->texture->width*activeTile->scale, // FG: HACK force resize proper
|
||||
activeQuad->texture->height*activeTile->scale);
|
||||
}
|
||||
updateEditor();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef AQUARIA_BUILD_MAPVIS
|
||||
if (!dsq->isInCutscene() && dsq->game->avatar && activeTile && !dsq->game->sceneEditor.isOn())
|
||||
if (!dsq->isInCutscene() && dsq->game->avatar && activeTile)
|
||||
{
|
||||
const float screenWidth = core->getVirtualWidth() * core->invGlobalScale;
|
||||
const float screenHeight = core->getVirtualHeight() * core->invGlobalScale;
|
||||
|
@ -1248,16 +1231,11 @@ Vector WorldMapRender::getAvatarWorldMapPosition()
|
|||
|
||||
Vector WorldMapRender::getWorldToTile(WorldMapTile *tile, Vector position, bool fromCenter, bool tilePos)
|
||||
{
|
||||
const float sizew = (float)tile->q->texture->width;
|
||||
const float halfw = sizew / 2.0f;
|
||||
const float sizeh = (float)tile->q->texture->height;
|
||||
const float halfh = sizeh / 2.0f;
|
||||
Vector p;
|
||||
p = Vector((position.x/TILE_SIZE) / (sizew*tile->scale), (position.y/TILE_SIZE) / (sizeh*tile->scale));
|
||||
p.x *= sizew*tile->scale*0.25f*tile->scale2;
|
||||
p.y *= sizeh*tile->scale*0.25f*tile->scale2;
|
||||
p = (position/TILE_SIZE) / (256*tile->scale);
|
||||
p *= 256*tile->scale*0.25f*tile->scale2;
|
||||
if (fromCenter)
|
||||
p -= Vector((halfw*tile->scale)*(0.25f*tile->scale2), (halfh*tile->scale)*(0.25f*tile->scale2));
|
||||
p -= Vector((128*tile->scale)*(0.25f*tile->scale2), (128*tile->scale)*(0.25f*tile->scale2));
|
||||
if (tilePos)
|
||||
p += tile->gridPos;
|
||||
return p;
|
||||
|
@ -1320,7 +1298,7 @@ void WorldMapRender::toggle(bool turnON)
|
|||
if (dsq->game->miniMapRender->isRadarHide()) return;
|
||||
if (alpha.isInterpolating()) return;
|
||||
|
||||
if (dsq->mod.isActive() && !dsq->mod.hasWorldMap()) return;
|
||||
if (dsq->mod.isActive()) return;
|
||||
|
||||
if (dsq->isNested()) return;
|
||||
|
||||
|
@ -1511,18 +1489,6 @@ void WorldMapRender::createGemHint(const std::string &gfx)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldMapRender::updateEditor()
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "EDITING... ";
|
||||
if(activeTile)
|
||||
{
|
||||
os << "x=" << activeTile->gridPos.x << "; y=" << activeTile->gridPos.y << std::endl;
|
||||
os << "scale=" << activeTile->scale << "; scale2=" << activeTile->scale2;
|
||||
}
|
||||
areaLabel->setText(os.str());
|
||||
}
|
||||
|
||||
void WorldMapRender::action (int id, int state)
|
||||
{
|
||||
if (isOn())
|
||||
|
@ -1539,7 +1505,7 @@ void WorldMapRender::action (int id, int state)
|
|||
|
||||
if (editorActive)
|
||||
{
|
||||
updateEditor();
|
||||
areaLabel->setText("EDITING...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,21 +240,13 @@ WorldMap::WorldMap()
|
|||
gw=gh=0;
|
||||
}
|
||||
|
||||
void WorldMap::load()
|
||||
{
|
||||
if (!dsq->mod.isActive())
|
||||
_load("data/worldmap.txt");
|
||||
else
|
||||
_load(dsq->mod.getPath() + "worldmap.txt");
|
||||
}
|
||||
|
||||
void WorldMap::_load(const std::string &file)
|
||||
void WorldMap::load(const std::string &file)
|
||||
{
|
||||
worldMapTiles.clear();
|
||||
|
||||
std::string line;
|
||||
|
||||
std::ifstream in(file.c_str());
|
||||
std::ifstream in(file.c_str());
|
||||
|
||||
while (std::getline(in, line))
|
||||
{
|
||||
|
@ -267,30 +259,15 @@ void WorldMap::_load(const std::string &file)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldMap::save()
|
||||
void WorldMap::save(const std::string &file)
|
||||
{
|
||||
std::string fn;
|
||||
|
||||
if (dsq->mod.isActive())
|
||||
fn = dsq->mod.getPath() + "worldmap.txt";
|
||||
else
|
||||
fn = "data/worldmap.txt";
|
||||
|
||||
std::ofstream out(fn.c_str());
|
||||
|
||||
if (out)
|
||||
{
|
||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
||||
{
|
||||
WorldMapTile *t = &worldMapTiles[i];
|
||||
out << t->index << " " << t->stringIndex << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
||||
}
|
||||
dsq->screenMessage("Saved worldmap data to " + fn);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsq->screenMessage("Unable to save worldmap to " + fn);
|
||||
}
|
||||
std::ofstream out(file.c_str());
|
||||
|
||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
||||
{
|
||||
WorldMapTile *t = &worldMapTiles[i];
|
||||
out << t->index << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldMap::revealMap(const std::string &name)
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//#include "DrawText.h"
|
||||
#include "RenderObject.h"
|
||||
|
||||
#include "glfont2.h"
|
||||
#include "../ExternalLibs/glfont2/glfont2.h"
|
||||
|
||||
enum BitmapFontEffect
|
||||
{
|
||||
|
|
|
@ -3947,14 +3947,14 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
|||
afterEffectManager->render();
|
||||
}
|
||||
|
||||
if (i == postProcessingFx.layer)
|
||||
{
|
||||
postProcessingFx.preRender();
|
||||
}
|
||||
if (i == postProcessingFx.renderLayer)
|
||||
{
|
||||
postProcessingFx.render();
|
||||
}
|
||||
if (i == postProcessingFx.layer)
|
||||
{
|
||||
postProcessingFx.preRender();
|
||||
}
|
||||
if (i == postProcessingFx.renderLayer)
|
||||
{
|
||||
postProcessingFx.render();
|
||||
}
|
||||
|
||||
if (darkLayer.isUsed() )
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ PostProcessingFX::PostProcessingFX()
|
|||
blendType = 0;
|
||||
layer = renderLayer = 0;
|
||||
intensity = 0.1;
|
||||
blurTimes = 12;
|
||||
blurTimes = 12;
|
||||
radialBlurColor = Vector(1,1,1);
|
||||
for (int i = 0; i < FXT_MAX; i++)
|
||||
enabled[i] = false;
|
||||
|
@ -69,8 +69,8 @@ void PostProcessingFX::disable(FXTypes type)
|
|||
|
||||
void PostProcessingFX::render()
|
||||
{
|
||||
if(!core->frameBuffer.isEnabled())
|
||||
return;
|
||||
if(!core->frameBuffer.isEnabled())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < FXT_MAX; i++)
|
||||
{
|
||||
|
@ -83,39 +83,39 @@ void PostProcessingFX::render()
|
|||
{
|
||||
case FXT_RADIALBLUR:
|
||||
|
||||
float windowW = core->getWindowWidth();
|
||||
float windowH = core->getWindowHeight();
|
||||
float textureW = core->frameBuffer.getWidth();
|
||||
float textureH = core->frameBuffer.getHeight();
|
||||
float windowW = core->getWindowWidth();
|
||||
float windowH = core->getWindowHeight();
|
||||
float textureW = core->frameBuffer.getWidth();
|
||||
float textureH = core->frameBuffer.getHeight();
|
||||
|
||||
float alpha = intensity;
|
||||
float alpha = intensity;
|
||||
|
||||
float offX = -(core->getVirtualOffX() * windowW / core->getVirtualWidth());
|
||||
float offY = -(core->getVirtualOffY() * windowH / core->getVirtualHeight());
|
||||
float offX = -(core->getVirtualOffX() * windowW / core->getVirtualWidth());
|
||||
float offY = -(core->getVirtualOffY() * windowH / core->getVirtualHeight());
|
||||
|
||||
float width2 = windowW / 2;
|
||||
float height2 = windowH / 2;
|
||||
float width2 = windowW / 2;
|
||||
float height2 = windowH / 2;
|
||||
|
||||
float pw = float(windowW)/float(textureW);
|
||||
float ph = float(windowH)/float(textureH);
|
||||
float pw = float(windowW)/float(textureW);
|
||||
float ph = float(windowH)/float(textureH);
|
||||
|
||||
glLoadIdentity();
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
glTranslatef(width2 + offX, height2 + offY, 0);
|
||||
glTranslatef(width2 + offX, height2 + offY, 0);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
core->frameBuffer.bindTexture();
|
||||
core->frameBuffer.bindTexture();
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if (blendType == 1)
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
||||
else
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
if (blendType == 1)
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
||||
else
|
||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float percentX = pw, percentY = ph;
|
||||
float percentX = pw, percentY = ph;
|
||||
|
||||
float inc = 0.01;
|
||||
float spost = 0.0f; // Starting Texture Coordinate Offset
|
||||
|
@ -126,17 +126,17 @@ void PostProcessingFX::render()
|
|||
{
|
||||
glColor4f(radialBlurColor.x, radialBlurColor.y, radialBlurColor.z, alpha); // Set The Alpha Value (Starts At 0.2)
|
||||
|
||||
glTexCoord2d(spost, spost);
|
||||
glVertex3f(-width2, height2, 0.0);
|
||||
glTexCoord2d(spost, spost);
|
||||
glVertex3f(-width2, height2, 0.0);
|
||||
|
||||
glTexCoord2d(percentX-spost, spost);
|
||||
glVertex3f( width2, height2, 0.0);
|
||||
glTexCoord2d(percentX-spost, spost);
|
||||
glVertex3f( width2, height2, 0.0);
|
||||
|
||||
glTexCoord2d(percentX-spost, percentY-spost);
|
||||
glVertex3f( width2, -height2, 0.0);
|
||||
glTexCoord2d(percentX-spost, percentY-spost);
|
||||
glVertex3f( width2, -height2, 0.0);
|
||||
|
||||
glTexCoord2d(spost, percentY-spost);
|
||||
glVertex3f(-width2, -height2, 0.0);
|
||||
glTexCoord2d(spost, percentY-spost);
|
||||
glVertex3f(-width2, -height2, 0.0);
|
||||
|
||||
spost += inc; // Gradually Increase spost (Zooming Closer To Texture Center)
|
||||
alpha -= alphadec; // Gradually Decrease alpha (Gradually Fading Image Out)
|
||||
|
@ -144,9 +144,9 @@ void PostProcessingFX::render()
|
|||
glEnd();
|
||||
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
RenderObject::lastTextureApplied = 0;
|
||||
glColor4f(1,1,1,1);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
RenderObject::lastTextureApplied = 0;
|
||||
|
||||
|
||||
break;
|
||||
|
|
|
@ -34,7 +34,7 @@ class PostProcessingFX
|
|||
{
|
||||
public:
|
||||
PostProcessingFX();
|
||||
void init();
|
||||
void init();
|
||||
void update(float dt);
|
||||
void preRender();
|
||||
void render();
|
||||
|
@ -45,9 +45,9 @@ public:
|
|||
|
||||
// blur
|
||||
Vector radialBlurColor;
|
||||
int blurTimes;
|
||||
int blurTimes;
|
||||
|
||||
/// misc
|
||||
/// misc
|
||||
int renderLayer;
|
||||
int layer;
|
||||
float intensity;
|
||||
|
|
|
@ -980,7 +980,7 @@ class OpenALSystem
|
|||
public:
|
||||
OpenALSystem();
|
||||
~OpenALSystem();
|
||||
FMOD_RESULT init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata, std::string defaultDevice);
|
||||
FMOD_RESULT init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata);
|
||||
FMOD_RESULT update();
|
||||
FMOD_RESULT release();
|
||||
FMOD_RESULT getVersion(unsigned int *version);
|
||||
|
@ -1130,25 +1130,12 @@ FMOD_RESULT OpenALSystem::getVersion(unsigned int *version)
|
|||
return FMOD_OK;
|
||||
}
|
||||
|
||||
ALBRIDGE(System,init,(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata, std::string defaultDevice),(maxchannels,flags,extradriverdata, defaultDevice))
|
||||
FMOD_RESULT OpenALSystem::init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata, std::string defaultDevice)
|
||||
ALBRIDGE(System,init,(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata),(maxchannels,flags,extradriverdata))
|
||||
FMOD_RESULT OpenALSystem::init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata)
|
||||
{
|
||||
ALCdevice *dev = NULL;
|
||||
|
||||
if (!defaultDevice.empty())
|
||||
{
|
||||
dev = alcOpenDevice(defaultDevice.c_str()); // Try to use device specified in user config
|
||||
}
|
||||
|
||||
if (!dev)
|
||||
{
|
||||
dev = alcOpenDevice(NULL); // Fall back to system default device
|
||||
}
|
||||
|
||||
ALCdevice *dev = alcOpenDevice(NULL);
|
||||
if (!dev)
|
||||
{
|
||||
return FMOD_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
// OpenAL doesn't provide a way to request sources that can be either
|
||||
// mono or stereo, so we need to request both separately (thus allocating
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace FMOD
|
|||
FMOD_RESULT getDriverCaps(int id, FMOD_CAPS *caps, int *minfrequency, int *maxfrequency, FMOD_SPEAKERMODE *controlpanelspeakermode);
|
||||
FMOD_RESULT getMasterChannelGroup(ChannelGroup **channelgroup);
|
||||
FMOD_RESULT getVersion(unsigned int *version);
|
||||
FMOD_RESULT init(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata, std::string defaultDevice);
|
||||
FMOD_RESULT init(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata);
|
||||
FMOD_RESULT playSound(FMOD_CHANNELINDEX channelid, Sound *sound, bool paused, Channel **channel);
|
||||
FMOD_RESULT setDSPBufferSize(unsigned int bufferlength, int numbuffers);
|
||||
FMOD_RESULT setFileSystem(FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek, int blockalign);
|
||||
|
|
1646
BBGE/GL/gl.h
Normal file
1646
BBGE/GL/gl.h
Normal file
File diff suppressed because it is too large
Load diff
14
BBGE/GL/gles.h
Normal file
14
BBGE/GL/gles.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* OpenGL ES-specific. --ryan. */
|
||||
/* I should probably put an official GLES header in here instead. Oh well. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
void glClearDepthf(GLclampf depth);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
7204
BBGE/GL/glext.h
Normal file
7204
BBGE/GL/glext.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -229,8 +229,8 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
|||
renderObjects[curIdx] = 0;
|
||||
renderObjects[newIdx] = r;
|
||||
r->setIdx(newIdx);
|
||||
if (firstFreeIdx == newIdx)
|
||||
firstFreeIdx++;
|
||||
if (firstFreeIdx > curIdx)
|
||||
firstFreeIdx = curIdx;
|
||||
}
|
||||
else if (objectCount == size)
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
|||
r->setIdx(size);
|
||||
for (int i = size+1; i < newSize; i++)
|
||||
renderObjects[i] = 0;
|
||||
firstFreeIdx = size+1;
|
||||
firstFreeIdx = curIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -254,18 +254,20 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
|||
if (!renderObjects[lastFree])
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = lastFree + 1; i <= lastUsed; i++)
|
||||
{
|
||||
renderObjects[i-1] = renderObjects[i];
|
||||
if(renderObjects[i-1])
|
||||
renderObjects[i-1]->setIdx(i-1);
|
||||
renderObjects[i-1]->setIdx(i-1); // Known to be non-NULL.
|
||||
}
|
||||
|
||||
renderObjects[lastUsed] = r;
|
||||
r->setIdx(lastUsed);
|
||||
if (firstFreeIdx == lastFree)
|
||||
firstFreeIdx = lastUsed + 1;
|
||||
firstFreeIdx = curIdx;
|
||||
while (renderObjects[firstFreeIdx])
|
||||
{
|
||||
firstFreeIdx++;
|
||||
if(firstFreeIdx >= size)
|
||||
firstFreeIdx = 0;
|
||||
}
|
||||
}
|
||||
#endif // RLT_FIXED
|
||||
#ifdef RLT_DYNAMIC
|
||||
|
@ -298,7 +300,9 @@ void RenderObjectLayer::moveToBack(RenderObject *r)
|
|||
renderObjects[curIdx] = 0;
|
||||
renderObjects[newIdx] = r;
|
||||
r->setIdx(newIdx);
|
||||
if (firstFreeIdx == newIdx)
|
||||
// firstFreeIdx must be 0 here; if we filled slot 0, then
|
||||
// scan forward for the next empty element.
|
||||
while (renderObjects[firstFreeIdx])
|
||||
firstFreeIdx++;
|
||||
}
|
||||
else if (objectCount == size)
|
||||
|
@ -312,8 +316,7 @@ void RenderObjectLayer::moveToBack(RenderObject *r)
|
|||
for (int i = newSize - 1; i >= sizeDiff; i--)
|
||||
{
|
||||
renderObjects[i] = renderObjects[i - sizeDiff];
|
||||
if(renderObjects[i])
|
||||
renderObjects[i]->setIdx(i);
|
||||
renderObjects[i]->setIdx(i); // Known to be non-NULL.
|
||||
}
|
||||
for (int i = 0; i < newIdx; i++)
|
||||
renderObjects[i] = 0;
|
||||
|
@ -329,8 +332,7 @@ void RenderObjectLayer::moveToBack(RenderObject *r)
|
|||
for (int i = firstFreeIdx; i > 0; i--)
|
||||
{
|
||||
renderObjects[i] = renderObjects[i-1];
|
||||
if(renderObjects[i])
|
||||
renderObjects[i]->setIdx(i);
|
||||
renderObjects[i]->setIdx(i); // Known to be non-NULL.
|
||||
}
|
||||
renderObjects[0] = r;
|
||||
r->setIdx(0);
|
||||
|
|
|
@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "SkeletalSprite.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "Core.h"
|
||||
#include "Particles.h"
|
||||
#include "MathFunctions.h"
|
||||
|
|
|
@ -326,15 +326,15 @@ SoundManager::SoundManager(const std::string &defaultDevice)
|
|||
}
|
||||
|
||||
debugLog("init");
|
||||
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0, defaultDevice); /* Replace with whatever channel count and flags you use! */
|
||||
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */
|
||||
if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) /* Ok, the speaker mode selected isn't supported by this soundcard. Switch it back to stereo... */
|
||||
{
|
||||
debugLog("err_output_createbuffer, speaker mode");
|
||||
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
|
||||
if (checkError()) goto get_out;
|
||||
|
||||
|
||||
debugLog("init 2");
|
||||
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0, defaultDevice); /* Replace with whatever channel count and flags you use! */
|
||||
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */
|
||||
if (checkError()) goto get_out;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,17 @@ void initInputCodeMap()
|
|||
inputCodeMap["KEY_9"] = KEY_9;
|
||||
inputCodeMap["KEY_0"] = KEY_0;
|
||||
|
||||
inputCodeMap["KEY_NUMPAD1"] = KEY_NUMPAD1;
|
||||
inputCodeMap["KEY_NUMPAD2"] = KEY_NUMPAD2;
|
||||
inputCodeMap["KEY_NUMPAD3"] = KEY_NUMPAD3;
|
||||
inputCodeMap["KEY_NUMPAD4"] = KEY_NUMPAD4;
|
||||
inputCodeMap["KEY_NUMPAD5"] = KEY_NUMPAD5;
|
||||
inputCodeMap["KEY_NUMPAD6"] = KEY_NUMPAD6;
|
||||
inputCodeMap["KEY_NUMPAD7"] = KEY_NUMPAD7;
|
||||
inputCodeMap["KEY_NUMPAD8"] = KEY_NUMPAD8;
|
||||
inputCodeMap["KEY_NUMPAD9"] = KEY_NUMPAD9;
|
||||
inputCodeMap["KEY_NUMPAD0"] = KEY_NUMPAD0;
|
||||
|
||||
inputCodeMap["KEY_F1"] = KEY_F1;
|
||||
inputCodeMap["KEY_F2"] = KEY_F2;
|
||||
inputCodeMap["KEY_F3"] = KEY_F3;
|
||||
|
|
6496
BBGE/glext/glext.h
Normal file
6496
BBGE/glext/glext.h
Normal file
File diff suppressed because it is too large
Load diff
319
ExternalLibs/glfont2/glfont2.cpp
Normal file
319
ExternalLibs/glfont2/glfont2.cpp
Normal file
|
@ -0,0 +1,319 @@
|
|||
//*******************************************************************
|
||||
//glfont2.cpp -- glFont Version 2.0 implementation
|
||||
//Copyright (c) 1998-2002 Brad Fish
|
||||
//See glfont.html for terms of use
|
||||
//May 14, 2002
|
||||
//*******************************************************************
|
||||
|
||||
//STL headers
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
//OpenGL headers
|
||||
/*
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <OpenGL/gl.h>
|
||||
*/
|
||||
#include "Base.h"
|
||||
|
||||
#include "SDL_endian.h"
|
||||
|
||||
//glFont header
|
||||
#include "glfont2.h"
|
||||
using namespace glfont;
|
||||
|
||||
static int read_int(ifstream &input)
|
||||
{
|
||||
int buffer;
|
||||
|
||||
input.read((char *)&buffer, 4);
|
||||
return SDL_SwapLE32(buffer);
|
||||
}
|
||||
|
||||
static float read_float(ifstream &input)
|
||||
{
|
||||
union
|
||||
{
|
||||
int i;
|
||||
float f;
|
||||
} buffer;
|
||||
|
||||
input.read((char *)&buffer.i, 4);
|
||||
buffer.i = SDL_SwapLE32(buffer.i);
|
||||
return buffer.f;
|
||||
}
|
||||
|
||||
//*******************************************************************
|
||||
//GLFont Class Implementation
|
||||
//*******************************************************************
|
||||
GLFont::GLFont ()
|
||||
{
|
||||
//Initialize header to safe state
|
||||
header.tex = -1;
|
||||
header.tex_width = 0;
|
||||
header.tex_height = 0;
|
||||
header.start_char = 0;
|
||||
header.end_char = 0;
|
||||
header.chars = NULL;
|
||||
}
|
||||
//*******************************************************************
|
||||
GLFont::~GLFont ()
|
||||
{
|
||||
//Destroy the font
|
||||
Destroy();
|
||||
}
|
||||
//*******************************************************************
|
||||
bool GLFont::Create (const char *file_name, int tex, bool loadTexture)
|
||||
{
|
||||
ifstream input;
|
||||
int num_chars, num_tex_bytes;
|
||||
char *tex_bytes;
|
||||
|
||||
//Destroy the old font if there was one, just to be safe
|
||||
Destroy();
|
||||
|
||||
//Open input file
|
||||
input.open(file_name, ios::in | ios::binary);
|
||||
if (!input)
|
||||
return false;
|
||||
|
||||
// Read the header from file
|
||||
header.tex = tex;
|
||||
input.seekg(4, ios::cur); // skip tex field
|
||||
header.tex_width = read_int(input);
|
||||
header.tex_height = read_int(input);
|
||||
header.start_char = read_int(input);
|
||||
header.end_char = read_int(input);
|
||||
input.seekg(4, ios::cur); // skip chars field
|
||||
|
||||
std::ostringstream os;
|
||||
os << "tex_width: " << header.tex_width << " tex_height: " << header.tex_height;
|
||||
debugLog(os.str());
|
||||
|
||||
//Allocate space for character array
|
||||
num_chars = header.end_char - header.start_char + 1;
|
||||
if ((header.chars = new GLFontChar[num_chars]) == NULL)
|
||||
return false;
|
||||
|
||||
//Read character array
|
||||
for (int i = 0; i < num_chars; i++)
|
||||
{
|
||||
header.chars[i].dx = read_float(input);
|
||||
header.chars[i].dy = read_float(input);
|
||||
header.chars[i].tx1 = read_float(input);
|
||||
header.chars[i].ty1 = read_float(input);
|
||||
header.chars[i].tx2 = read_float(input);
|
||||
header.chars[i].ty2 = read_float(input);
|
||||
}
|
||||
|
||||
//Read texture pixel data
|
||||
num_tex_bytes = header.tex_width * header.tex_height * 2;
|
||||
tex_bytes = new char[num_tex_bytes];
|
||||
input.read(tex_bytes, num_tex_bytes);
|
||||
|
||||
|
||||
//Build2DMipmaps(3, header.tex_width, header.tex_height, GL_UNSIGNED_BYTE, tex_bytes, 1);
|
||||
|
||||
if (loadTexture)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 2, header.tex_width,
|
||||
header.tex_height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
(void *)tex_bytes);
|
||||
//gluBuild2DMipmaps(GL_TEXTURE_2D, 2, header.tex_width, header.tex_height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (void*)tex_bytes);
|
||||
//Build2DMipmaps(3, header.tex_width, header.tex_height, GL_LUMINANCE_ALPHA, tex_bytes, 1);
|
||||
//Create OpenGL texture
|
||||
/*
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
//Free texture pixels memory
|
||||
delete[] tex_bytes;
|
||||
|
||||
//Close input file
|
||||
input.close();
|
||||
|
||||
//Return successfully
|
||||
return true;
|
||||
}
|
||||
//*******************************************************************
|
||||
bool GLFont::Create (const std::string &file_name, int tex, bool loadTexture)
|
||||
{
|
||||
return Create(file_name.c_str(), tex);
|
||||
}
|
||||
//*******************************************************************
|
||||
void GLFont::Destroy (void)
|
||||
{
|
||||
//Delete the character array if necessary
|
||||
if (header.chars)
|
||||
{
|
||||
delete[] header.chars;
|
||||
header.chars = NULL;
|
||||
}
|
||||
}
|
||||
//*******************************************************************
|
||||
void GLFont::GetTexSize (std::pair<int, int> *size)
|
||||
{
|
||||
//Retrieve texture size
|
||||
size->first = header.tex_width;
|
||||
size->second = header.tex_height;
|
||||
}
|
||||
//*******************************************************************
|
||||
int GLFont::GetTexWidth (void)
|
||||
{
|
||||
//Return texture width
|
||||
return header.tex_width;
|
||||
}
|
||||
//*******************************************************************
|
||||
int GLFont::GetTexHeight (void)
|
||||
{
|
||||
//Return texture height
|
||||
return header.tex_height;
|
||||
}
|
||||
//*******************************************************************
|
||||
void GLFont::GetCharInterval (std::pair<int, int> *interval)
|
||||
{
|
||||
//Retrieve character interval
|
||||
interval->first = header.start_char;
|
||||
interval->second = header.end_char;
|
||||
}
|
||||
//*******************************************************************
|
||||
int GLFont::GetStartChar (void)
|
||||
{
|
||||
//Return start character
|
||||
return header.start_char;
|
||||
}
|
||||
//*******************************************************************
|
||||
int GLFont::GetEndChar (void)
|
||||
{
|
||||
//Return end character
|
||||
return header.end_char;
|
||||
}
|
||||
//*******************************************************************
|
||||
void GLFont::GetCharSize (int c, std::pair<int, int> *size)
|
||||
{
|
||||
//Make sure character is in range
|
||||
if (c < header.start_char || c > header.end_char)
|
||||
{
|
||||
//Not a valid character, so it obviously has no size
|
||||
size->first = 0;
|
||||
size->second = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GLFontChar *glfont_char;
|
||||
|
||||
//Retrieve character size
|
||||
glfont_char = &header.chars[c - header.start_char];
|
||||
size->first = (int)(glfont_char->dx * header.tex_width);
|
||||
size->second = (int)(glfont_char->dy *
|
||||
header.tex_height);
|
||||
}
|
||||
}
|
||||
//*******************************************************************
|
||||
int GLFont::GetCharWidth (int c)
|
||||
{
|
||||
//Make sure in range
|
||||
if (c < header.start_char || c > header.end_char)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
GLFontChar *glfont_char;
|
||||
|
||||
//Retrieve character width
|
||||
glfont_char = &header.chars[c - header.start_char];
|
||||
|
||||
// hack to fix empty spaces
|
||||
if (c == ' ' && glfont_char->dx <= 0)
|
||||
{
|
||||
GLFontChar *glfont_a = &header.chars['a' - header.start_char];
|
||||
glfont_char->dx = glfont_a->dx*0.75;
|
||||
glfont_char->dy = glfont_a->dy;
|
||||
}
|
||||
|
||||
return (int)(glfont_char->dx * header.tex_width);
|
||||
}
|
||||
}
|
||||
//*******************************************************************
|
||||
int GLFont::GetCharHeight (int c)
|
||||
{
|
||||
//Make sure in range
|
||||
if (c < header.start_char || c > header.end_char)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
GLFontChar *glfont_char;
|
||||
|
||||
//Retrieve character height
|
||||
glfont_char = &header.chars[c - header.start_char];
|
||||
return (int)(glfont_char->dy * header.tex_height);
|
||||
}
|
||||
}
|
||||
//*******************************************************************
|
||||
void GLFont::Begin (void)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
//Bind to font texture
|
||||
glBindTexture(GL_TEXTURE_2D, header.tex);
|
||||
#endif
|
||||
}
|
||||
//*******************************************************************
|
||||
void GLFont::GetStringSize (const std::string &text, std::pair<int, int> *size)
|
||||
{
|
||||
unsigned int i;
|
||||
char c;
|
||||
GLFontChar *glfont_char;
|
||||
float width;
|
||||
|
||||
//debugLog("size->second");
|
||||
//Height is the same for now...might change in future
|
||||
size->second = (int)(header.chars[header.start_char].dy *
|
||||
header.tex_height);
|
||||
|
||||
//Calculate width of string
|
||||
width = 0.0F;
|
||||
for (i = 0; i < text.size(); i++)
|
||||
{
|
||||
//Make sure character is in range
|
||||
c = (char)text[i];
|
||||
|
||||
if (c < header.start_char || c > header.end_char)
|
||||
continue;
|
||||
|
||||
//Get pointer to glFont character
|
||||
glfont_char = &header.chars[c - header.start_char];
|
||||
|
||||
//Get width and height
|
||||
width += glfont_char->dx * header.tex_width;
|
||||
}
|
||||
|
||||
//Save width
|
||||
//debugLog("size first");
|
||||
size->first = (int)width;
|
||||
|
||||
//debugLog("done");
|
||||
}
|
||||
|
||||
//End of file
|
||||
|
||||
|
146
ExternalLibs/glfont2/glfont2.h
Normal file
146
ExternalLibs/glfont2/glfont2.h
Normal file
|
@ -0,0 +1,146 @@
|
|||
//*******************************************************************
|
||||
//glfont2.h -- Header for glfont2.cpp
|
||||
//Copyright (c) 1998-2002 Brad Fish
|
||||
//See glfont.html for terms of use
|
||||
//May 14, 2002
|
||||
//*******************************************************************
|
||||
|
||||
#ifndef GLFONT2_H
|
||||
#define GLFONT2_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
//*******************************************************************
|
||||
//GLFont Interface
|
||||
//*******************************************************************
|
||||
|
||||
//glFont namespace
|
||||
namespace glfont
|
||||
{
|
||||
class GLFont;
|
||||
}
|
||||
|
||||
//glFont class
|
||||
class glfont::GLFont
|
||||
{
|
||||
private:
|
||||
|
||||
//glFont character structure
|
||||
typedef struct
|
||||
{
|
||||
float dx, dy;
|
||||
float tx1, ty1;
|
||||
float tx2, ty2;
|
||||
} GLFontChar;
|
||||
|
||||
//glFont header structure
|
||||
struct
|
||||
{
|
||||
int tex;
|
||||
int tex_width, tex_height;
|
||||
int start_char, end_char;
|
||||
GLFontChar *chars;
|
||||
} header;
|
||||
|
||||
public:
|
||||
|
||||
//Constructor
|
||||
GLFont ();
|
||||
|
||||
//Destructor
|
||||
~GLFont ();
|
||||
|
||||
public:
|
||||
|
||||
//Creates the glFont
|
||||
bool Create (const char *file_name, int tex, bool loadTexture=true);
|
||||
bool Create (const std::string &file_name, int tex, bool loadTexture=true);
|
||||
|
||||
//Destroys the glFont
|
||||
void Destroy (void);
|
||||
|
||||
//Texture size retrieval methods
|
||||
void GetTexSize (std::pair<int, int> *size);
|
||||
int GetTexWidth (void);
|
||||
int GetTexHeight (void);
|
||||
|
||||
//Character interval retrieval methods
|
||||
void GetCharInterval (std::pair<int, int> *interval);
|
||||
int GetStartChar (void);
|
||||
int GetEndChar (void);
|
||||
|
||||
//Character size retrieval methods
|
||||
void GetCharSize (int c, std::pair<int, int> *size);
|
||||
int GetCharWidth (int c);
|
||||
int GetCharHeight (int c);
|
||||
|
||||
void GetStringSize (const std::string &text, std::pair<int, int> *size);
|
||||
|
||||
|
||||
//Begins text output with this font
|
||||
void Begin (void);
|
||||
|
||||
//Template function to output a scaled, colored std::basic_string
|
||||
template<class T> void DrawString (
|
||||
const std::basic_string<T> &text, float scalar, float x,
|
||||
float y, const float *top_color, const float *bottom_color, float alpha, float lastAlpha)
|
||||
{
|
||||
unsigned int i;
|
||||
T c;
|
||||
GLFontChar *glfont_char;
|
||||
float width, height;
|
||||
|
||||
//Begin rendering quads
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
int sz = text.size();
|
||||
|
||||
float a = 0;
|
||||
//Loop through characters
|
||||
for (i = 0; i < sz; i++)
|
||||
{
|
||||
//Make sure character is in range
|
||||
c = text[i];
|
||||
if (c < header.start_char || c > header.end_char)
|
||||
continue;
|
||||
|
||||
//Get pointer to glFont character
|
||||
glfont_char = &header.chars[c - header.start_char];
|
||||
|
||||
//Get width and height
|
||||
width = (glfont_char->dx * header.tex_width) * scalar;
|
||||
height = (glfont_char->dy * header.tex_height) * scalar;
|
||||
|
||||
if (i == (sz-1))
|
||||
a = alpha*lastAlpha;
|
||||
else
|
||||
a = alpha;
|
||||
|
||||
//Specify colors, vertices, and texture coordinates
|
||||
glColor4f(top_color[0], top_color[1], top_color[2], a);
|
||||
glTexCoord2f(glfont_char->tx1, glfont_char->ty1);
|
||||
glVertex3f(x, y, 0.0F);
|
||||
glTexCoord2f(glfont_char->tx2, glfont_char->ty1);
|
||||
glVertex3f(x + width, y, 0.0F);
|
||||
glColor4f(bottom_color[0], bottom_color[1], bottom_color[2], a);
|
||||
glTexCoord2f(glfont_char->tx2, glfont_char->ty2);
|
||||
glVertex3f(x + width, y + height, 0.0F);
|
||||
glTexCoord2f(glfont_char->tx1, glfont_char->ty2);
|
||||
glVertex3f(x, y + height, 0.0F);
|
||||
|
||||
//Move to next character
|
||||
x += width;
|
||||
}
|
||||
|
||||
//Stop rendering quads
|
||||
glEnd();
|
||||
}
|
||||
};
|
||||
|
||||
//*******************************************************************
|
||||
|
||||
#endif
|
||||
|
||||
//End of file
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ extern "C" {
|
|||
|
||||
/* Transparency parameters */
|
||||
#define PNG_LUMINANCEALPHA -4
|
||||
#define PNG_CALLBACK -3 /* Call the callback function to generate alpha */
|
||||
#define PNG_CALLBACKT -3 /* Call the callback function to generate alpha */
|
||||
#define PNG_ALPHA -2 /* Use alpha channel in PNG file, if there is one */
|
||||
#define PNG_SOLID -1 /* No transparency */
|
||||
#define PNG_STENCIL 0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "gl.h"
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "png/png.h"
|
||||
#include <png.h>
|
||||
|
||||
/* Used to decide if GL/gl.h supports the paletted extension */
|
||||
#ifdef GL_COLOR_INDEX1_EXT
|
||||
|
@ -114,8 +114,6 @@ static void Resize(int components, const png_bytep d1, int w1, int h1, png_bytep
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SUPPORTS_PALETTE_EXT
|
||||
#ifdef _WIN32
|
||||
static int ExtSupported(const char *x) {
|
||||
static const GLubyte *ext = NULL;
|
||||
const char *c;
|
||||
|
@ -132,8 +130,6 @@ static int ExtSupported(const char *x) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define GET(o) ((int)*(data + (o)))
|
||||
|
||||
|
@ -281,7 +277,11 @@ int APIENTRY pngLoadRawF(FILE *fp, pngRawInfo *pinfo) {
|
|||
endinfo = png_create_info_struct(png);
|
||||
|
||||
// DH: added following lines
|
||||
#ifdef LIBPNG_NEW_API
|
||||
if (setjmp(png_jmpbuf(png)))
|
||||
#else
|
||||
if (setjmp(png->jmpbuf))
|
||||
#endif
|
||||
{
|
||||
png_destroy_read_struct(&png, &info, &endinfo);
|
||||
return 0;
|
||||
|
@ -385,7 +385,11 @@ int APIENTRY pngLoadF(FILE *fp, int mipmap, int trans, pngInfo *pinfo) {
|
|||
endinfo = png_create_info_struct(png);
|
||||
|
||||
// DH: added following lines
|
||||
#ifdef LIBPNG_NEW_API
|
||||
if (setjmp(png_jmpbuf(png)))
|
||||
#else
|
||||
if (setjmp(png->jmpbuf))
|
||||
#endif
|
||||
{
|
||||
png_destroy_read_struct(&png, &info, &endinfo);
|
||||
return 0;
|
||||
|
@ -567,7 +571,7 @@ int APIENTRY pngLoadF(FILE *fp, int mipmap, int trans, pngInfo *pinfo) {
|
|||
#define ALPHA *q
|
||||
|
||||
switch (trans) {
|
||||
case PNG_CALLBACK:
|
||||
case PNG_CALLBACKT:
|
||||
FORSTART
|
||||
ALPHA = AlphaCallback((unsigned char) r, (unsigned char) g, (unsigned char) b);
|
||||
FOREND
|
||||
|
@ -623,14 +627,11 @@ int APIENTRY pngLoadF(FILE *fp, int mipmap, int trans, pngInfo *pinfo) {
|
|||
FOREND
|
||||
break;
|
||||
|
||||
//HACK: disabling this for now
|
||||
/*
|
||||
case PNG_BLEND7:
|
||||
FORSTART
|
||||
a = r*r+g*g+b*b;
|
||||
if (a > 255*255) ALPHA = 255; else ALPHA = (int) (sqrt(float(a)));
|
||||
if (a > 255*255) ALPHA = 255; else ALPHA = (int) sqrt(a);
|
||||
FOREND
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
1839
ExternalLibs/tinyxml.cpp
Normal file
1839
ExternalLibs/tinyxml.cpp
Normal file
File diff suppressed because it is too large
Load diff
1799
ExternalLibs/tinyxml.h
Normal file
1799
ExternalLibs/tinyxml.h
Normal file
File diff suppressed because it is too large
Load diff
52
ExternalLibs/tinyxmlerror.cpp
Normal file
52
ExternalLibs/tinyxmlerror.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
// The goal of the seperate error file is to make the first
|
||||
// step towards localization. tinyxml (currently) only supports
|
||||
// english error messages, but the could now be translated.
|
||||
//
|
||||
// It also cleans up the code a bit.
|
||||
//
|
||||
|
||||
const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
|
||||
{
|
||||
"No error",
|
||||
"Error",
|
||||
"Failed to open file",
|
||||
"Error parsing Element.",
|
||||
"Failed to read Element name",
|
||||
"Error reading Element value.",
|
||||
"Error reading Attributes.",
|
||||
"Error: empty tag.",
|
||||
"Error reading end tag.",
|
||||
"Error parsing Unknown.",
|
||||
"Error parsing Comment.",
|
||||
"Error parsing Declaration.",
|
||||
"Error document empty.",
|
||||
"Error null (0) or unexpected EOF found in input stream.",
|
||||
"Error parsing CDATA.",
|
||||
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
|
||||
};
|
1635
ExternalLibs/tinyxmlparser.cpp
Normal file
1635
ExternalLibs/tinyxmlparser.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -35,6 +35,7 @@ function v.commonInit(me, tex, snd, sz, flipDir)
|
|||
setupEntity(me, tex, -2)
|
||||
entity_scale(me, sz, sz)
|
||||
entity_setActivationType(me, AT_NONE)
|
||||
entity_setAllDamageTargets(me, false)
|
||||
entity_setFillGrid(me, true)
|
||||
v.sound = snd
|
||||
loadSound(v.sound)
|
||||
|
|
|
@ -28,6 +28,7 @@ v.savedOrb = false
|
|||
function init(me)
|
||||
setupEntity(me, "OrbHolder", -2)
|
||||
entity_setActivationType(me, AT_NONE)
|
||||
entity_setAllDamageTargets(me, false)
|
||||
end
|
||||
|
||||
function update(me, dt)
|
||||
|
|
|
@ -566,13 +566,13 @@ function exitState(me)
|
|||
end
|
||||
|
||||
function shiftWorlds(me, old, new)
|
||||
if v.riding then
|
||||
if new == WT_SPIRIT then
|
||||
entity_setRiding(v.n, 0)
|
||||
cam_toEntity(v.n)
|
||||
elseif new == WT_NORMAL then
|
||||
entity_setRiding(v.n, me)
|
||||
cam_toEntity(me)
|
||||
end
|
||||
end
|
||||
if v.riding then
|
||||
if new == WT_SPIRIT then
|
||||
entity_setRiding(v.n, 0)
|
||||
cam_toEntity(v.n)
|
||||
elseif new == WT_NORMAL then
|
||||
entity_setRiding(v.n, me)
|
||||
cam_toEntity(me)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -90,6 +90,8 @@ function v.commonInit(me, id)
|
|||
entity_setState(me, STATE_IDLE)
|
||||
|
||||
entity_setEntityLayer(me, -1)
|
||||
|
||||
entity_setAllDamageTargets(me, false)
|
||||
end
|
||||
|
||||
function postInit(me)
|
||||
|
|
Loading…
Reference in a new issue