mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +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(doit)
|
||||
{
|
||||
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);
|
||||
|
||||
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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,9 +6983,7 @@ 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);
|
||||
|
||||
std::string musicToPlay = this->musicToPlay;
|
||||
|
@ -7078,9 +7076,6 @@ 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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,7 +3002,7 @@ void SceneEditor::doPrevElement()
|
|||
if (curElement < 0)
|
||||
curElement = dsq->game->elementTemplates.size()-1;
|
||||
|
||||
if(curElement < 0)
|
||||
if (curElement < 0)
|
||||
return;
|
||||
|
||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||
|
|
|
@ -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,8 +1029,7 @@ 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))
|
||||
|
@ -1083,7 +1082,6 @@ void WorldMapRender::onUpdate(float dt)
|
|||
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,15 +240,7 @@ 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();
|
||||
|
||||
|
@ -267,29 +259,14 @@ void WorldMap::_load(const std::string &file)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldMap::save()
|
||||
void WorldMap::save(const std::string &file)
|
||||
{
|
||||
std::string fn;
|
||||
std::ofstream out(file.c_str());
|
||||
|
||||
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);
|
||||
out << t->index << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
ALCdevice *dev = alcOpenDevice(NULL);
|
||||
if (!dev)
|
||||
{
|
||||
dev = alcOpenDevice(NULL); // Fall back to system default device
|
||||
}
|
||||
|
||||
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,7 +326,7 @@ 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");
|
||||
|
@ -334,7 +334,7 @@ SoundManager::SoundManager(const std::string &defaultDevice)
|
|||
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)
|
||||
|
|
|
@ -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