mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 06:24:32 +00:00
Replace spaces with tabs (future self: i'm sorry)
In most places, that is. Left some files unchanges because they are a mess.
This commit is contained in:
parent
dcd21b57bd
commit
8af953cb63
42 changed files with 691 additions and 706 deletions
|
@ -1111,8 +1111,7 @@ void AnimationEditor::flipRot()
|
||||||
{
|
{
|
||||||
BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (bcur)
|
if (bcur)
|
||||||
{
|
{
|
||||||
// int rotdiff = editingBone->rotation.z - bcur->rot;
|
|
||||||
if (!core->getCtrlState())
|
if (!core->getCtrlState())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
#ifndef BBGE_SKIP_CONFIG_HEADERS
|
#ifndef BBGE_SKIP_CONFIG_HEADERS
|
||||||
|
|
||||||
|
|
||||||
#define AQUARIA_BUILD_CONSOLE 1
|
#define AQUARIA_BUILD_CONSOLE 1
|
||||||
#define AQUARIA_BUILD_SCENEEDITOR 1
|
#define AQUARIA_BUILD_SCENEEDITOR 1
|
||||||
|
|
||||||
#define AQUARIA_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__)
|
#define AQUARIA_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__)
|
||||||
|
|
||||||
// If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen.
|
// If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen.
|
||||||
//#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.001"
|
//#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.001"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -695,8 +695,8 @@ void AquariaKeyConfig::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INPUTSET_NONE:
|
case INPUTSET_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -861,17 +861,17 @@ std::string Avatar::getIdleAnimName()
|
||||||
{
|
{
|
||||||
case FORM_ENERGY:
|
case FORM_ENERGY:
|
||||||
ret="energyidle";
|
ret="energyidle";
|
||||||
break;
|
break;
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_BEAST:
|
case FORM_BEAST:
|
||||||
case FORM_NATURE:
|
case FORM_NATURE:
|
||||||
case FORM_SPIRIT:
|
case FORM_SPIRIT:
|
||||||
case FORM_DUAL:
|
case FORM_DUAL:
|
||||||
case FORM_FISH:
|
case FORM_FISH:
|
||||||
case FORM_SUN:
|
case FORM_SUN:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1241,11 +1241,11 @@ void Avatar::entityDied(Entity *e)
|
||||||
{
|
{
|
||||||
dsq->continuity.eatBeast(e->eatData);
|
dsq->continuity.eatBeast(e->eatData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EAT_DEFAULT:
|
case EAT_DEFAULT:
|
||||||
case EAT_MAX:
|
case EAT_MAX:
|
||||||
case EAT_NONE:
|
case EAT_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1596,9 +1596,9 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
|
||||||
case FORM_DUAL:
|
case FORM_DUAL:
|
||||||
core->sound->playSfx("DualForm");
|
core->sound->playSfx("DualForm");
|
||||||
break;
|
break;
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2836,10 +2836,10 @@ void Avatar::formAbility(int ability)
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3000,7 +3000,7 @@ void Avatar::doShock(const std::string &shotName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// Vector d = e->position - position;
|
// Vector d = e->position - position;
|
||||||
/*
|
/*
|
||||||
float a = float(float(i)/float(sz))*PI*2;
|
float a = float(float(i)/float(sz))*PI*2;
|
||||||
Vector aim(sinf(a), cosf(a));
|
Vector aim(sinf(a), cosf(a));
|
||||||
|
@ -3055,17 +3055,17 @@ void Avatar::formAbilityUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_ENERGY:
|
case FORM_ENERGY:
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_BEAST:
|
case FORM_BEAST:
|
||||||
case FORM_NATURE:
|
case FORM_NATURE:
|
||||||
case FORM_SPIRIT:
|
case FORM_SPIRIT:
|
||||||
case FORM_DUAL:
|
case FORM_DUAL:
|
||||||
case FORM_SUN:
|
case FORM_SUN:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Avatar::isMouseInputEnabled()
|
bool Avatar::isMouseInputEnabled()
|
||||||
|
@ -3155,13 +3155,13 @@ bool Avatar::canCharge(int ability)
|
||||||
break;
|
break;
|
||||||
case FORM_SUN:
|
case FORM_SUN:
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_SPIRIT:
|
case FORM_SPIRIT:
|
||||||
case FORM_FISH:
|
case FORM_FISH:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4753,11 +4753,11 @@ void Avatar::updateAura(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AURA_THING:
|
case AURA_THING:
|
||||||
case AURA_HEAL:
|
case AURA_HEAL:
|
||||||
case AURA_NONE:
|
case AURA_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auraTimer -= dt;
|
auraTimer -= dt;
|
||||||
|
@ -4901,15 +4901,15 @@ void Avatar::updateFormVisualEffects(float dt)
|
||||||
case FORM_SPIRIT:
|
case FORM_SPIRIT:
|
||||||
skeletalSprite.update(dt);
|
skeletalSprite.update(dt);
|
||||||
skeletalSprite.position = bodyPosition;
|
skeletalSprite.position = bodyPosition;
|
||||||
break;
|
break;
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_BEAST:
|
case FORM_BEAST:
|
||||||
case FORM_NATURE:
|
case FORM_NATURE:
|
||||||
case FORM_DUAL:
|
case FORM_DUAL:
|
||||||
case FORM_FISH:
|
case FORM_FISH:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6020,7 +6020,7 @@ void Avatar::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
if (state.spellCharge > 1.5f && chargeLevelAttained <1)
|
if (state.spellCharge > 1.5f && chargeLevelAttained <1)
|
||||||
{
|
{
|
||||||
chargeLevelAttained = 1;
|
chargeLevelAttained = 1;
|
||||||
core->sound->playSfx("PowerUp");
|
core->sound->playSfx("PowerUp");
|
||||||
chargingEmitter->load("ChargingEnergy2");
|
chargingEmitter->load("ChargingEnergy2");
|
||||||
}
|
}
|
||||||
|
@ -6071,14 +6071,14 @@ void Avatar::onUpdate(float dt)
|
||||||
chargingEmitter->start();
|
chargingEmitter->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_BEAST:
|
case FORM_BEAST:
|
||||||
case FORM_SPIRIT:
|
case FORM_SPIRIT:
|
||||||
case FORM_FISH:
|
case FORM_FISH:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -93,8 +93,8 @@ void CollideEntity::bounce(float ba)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BOUNCE_NONE:
|
case BOUNCE_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -607,10 +607,10 @@ std::string Continuity::getIEString(IngredientData *data, int i)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IET_NONE:
|
case IET_NONE:
|
||||||
case IET_RANDOM:
|
case IET_RANDOM:
|
||||||
case IET_MAX:
|
case IET_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -1245,9 +1245,9 @@ std::string Continuity::getInternalFormName()
|
||||||
return "sun";
|
return "sun";
|
||||||
case FORM_DUAL:
|
case FORM_DUAL:
|
||||||
return "dual";
|
return "dual";
|
||||||
case FORM_NONE:
|
case FORM_NONE:
|
||||||
case FORM_MAX:
|
case FORM_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -1641,12 +1641,12 @@ void Continuity::castSong(int num)
|
||||||
case SONG_FISHFORM:
|
case SONG_FISHFORM:
|
||||||
dsq->game->avatar->changeForm(FORM_FISH);
|
dsq->game->avatar->changeForm(FORM_FISH);
|
||||||
break;
|
break;
|
||||||
case SONG_SONGDOOR1:
|
case SONG_SONGDOOR1:
|
||||||
case SONG_SONGDOOR2:
|
case SONG_SONGDOOR2:
|
||||||
case SONG_ANIMA:
|
case SONG_ANIMA:
|
||||||
case SONG_NONE:
|
case SONG_NONE:
|
||||||
case SONG_MAX:
|
case SONG_MAX:
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
134
Aquaria/DSQ.cpp
134
Aquaria/DSQ.cpp
|
@ -57,74 +57,74 @@ static void Linux_CopyTree(const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
if (stat(src, &statbuf) == -1)
|
if (stat(src, &statbuf) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (S_ISDIR(statbuf.st_mode))
|
if (S_ISDIR(statbuf.st_mode))
|
||||||
{
|
{
|
||||||
createDir(dst); // don't care if this fails.
|
createDir(dst); // don't care if this fails.
|
||||||
DIR *dirp = opendir(src);
|
DIR *dirp = opendir(src);
|
||||||
if (dirp == NULL)
|
if (dirp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
while ((dent = readdir(dirp)) != NULL)
|
while ((dent = readdir(dirp)) != NULL)
|
||||||
{
|
{
|
||||||
if ((strcmp(dent->d_name, ".") == 0) || (strcmp(dent->d_name, "..") == 0))
|
if ((strcmp(dent->d_name, ".") == 0) || (strcmp(dent->d_name, "..") == 0))
|
||||||
continue;
|
continue;
|
||||||
const size_t srclen = strlen(src) + strlen(dent->d_name) + 2;
|
const size_t srclen = strlen(src) + strlen(dent->d_name) + 2;
|
||||||
char *subsrc = new char[srclen];
|
char *subsrc = new char[srclen];
|
||||||
snprintf(subsrc, srclen, "%s/%s", src, dent->d_name);
|
snprintf(subsrc, srclen, "%s/%s", src, dent->d_name);
|
||||||
const size_t dstlen = strlen(dst) + strlen(dent->d_name) + 2;
|
const size_t dstlen = strlen(dst) + strlen(dent->d_name) + 2;
|
||||||
char *subdst = new char[dstlen];
|
char *subdst = new char[dstlen];
|
||||||
snprintf(subdst, dstlen, "%s/%s", dst, dent->d_name);
|
snprintf(subdst, dstlen, "%s/%s", dst, dent->d_name);
|
||||||
Linux_CopyTree(subsrc, subdst);
|
Linux_CopyTree(subsrc, subdst);
|
||||||
delete[] subdst;
|
delete[] subdst;
|
||||||
delete[] subsrc;
|
delete[] subsrc;
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (S_ISREG(statbuf.st_mode))
|
else if (S_ISREG(statbuf.st_mode))
|
||||||
{
|
{
|
||||||
const int in = open(src, O_RDONLY);
|
const int in = open(src, O_RDONLY);
|
||||||
if (in == -1)
|
if (in == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fail if it already exists. That's okay in this case.
|
// fail if it already exists. That's okay in this case.
|
||||||
const int out = open(dst, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
const int out = open(dst, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||||
if (out == -1)
|
if (out == -1)
|
||||||
{
|
{
|
||||||
close(in);
|
close(in);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t buflen = 256 * 1024;
|
const size_t buflen = 256 * 1024;
|
||||||
char *buf = new char[buflen];
|
char *buf = new char[buflen];
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
ssize_t br = 0;
|
ssize_t br = 0;
|
||||||
while ( (!failed) && ((br = read(in, buf, buflen)) > 0) )
|
while ( (!failed) && ((br = read(in, buf, buflen)) > 0) )
|
||||||
failed = (write(out, buf, br) != br);
|
failed = (write(out, buf, br) != br);
|
||||||
|
|
||||||
if (br < 0)
|
if (br < 0)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
|
|
||||||
if (close(out) < 0)
|
if (close(out) < 0)
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
close(in);
|
close(in);
|
||||||
|
|
||||||
if (failed)
|
if (failed)
|
||||||
unlink(dst);
|
unlink(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "WARNING: we should have copied %s to %s, but it's not a dir or file! Skipped it.\n", src, dst);
|
fprintf(stderr, "WARNING: we should have copied %s to %s, but it's not a dir or file! Skipped it.\n", src, dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -800,11 +800,11 @@ static bool sdlVideoModeOK(const int w, const int h, const int bpp)
|
||||||
const int modecount = SDL_GetNumDisplayModes(0);
|
const int modecount = SDL_GetNumDisplayModes(0);
|
||||||
for (int i = 0; i < modecount; i++) {
|
for (int i = 0; i < modecount; i++) {
|
||||||
SDL_GetDisplayMode(0, i, &mode);
|
SDL_GetDisplayMode(0, i, &mode);
|
||||||
if (!mode.w || !mode.h || (w >= mode.w && h >= mode.h)) {
|
if (!mode.w || !mode.h || (w >= mode.w && h >= mode.h)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return SDL_VideoModeOK(w, h, bpp, SDL_OPENGL | SDL_FULLSCREEN);
|
return SDL_VideoModeOK(w, h, bpp, SDL_OPENGL | SDL_FULLSCREEN);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1782,8 +1782,8 @@ void DSQ::toggleInputMode()
|
||||||
case INPUT_JOYSTICK:
|
case INPUT_JOYSTICK:
|
||||||
setInputMode(INPUT_MOUSE);
|
setInputMode(INPUT_MOUSE);
|
||||||
break;
|
break;
|
||||||
case INPUT_KEYBOARD:
|
case INPUT_KEYBOARD:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1801,8 +1801,8 @@ void DSQ::setInputMode(InputMode mode)
|
||||||
core->joystickAsMouse = false;
|
core->joystickAsMouse = false;
|
||||||
updateCursorFromMouse = true;
|
updateCursorFromMouse = true;
|
||||||
break;
|
break;
|
||||||
case INPUT_KEYBOARD:
|
case INPUT_KEYBOARD:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4095,8 +4095,8 @@ void DSQ::onUpdate(float dt)
|
||||||
case INPUT_JOYSTICK:
|
case INPUT_JOYSTICK:
|
||||||
os << "joystick";
|
os << "joystick";
|
||||||
break;
|
break;
|
||||||
case INPUT_KEYBOARD:
|
case INPUT_KEYBOARD:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
Bone *b = dsq->game->avatar->skeletalSprite.getBoneByIdx(1);
|
Bone *b = dsq->game->avatar->skeletalSprite.getBoneByIdx(1);
|
||||||
|
|
|
@ -683,7 +683,7 @@ enum FoodSortType
|
||||||
|
|
||||||
struct IngredientEffect
|
struct IngredientEffect
|
||||||
{
|
{
|
||||||
IngredientEffect() : magnitude(0), type(IET_NONE) {}
|
IngredientEffect() : magnitude(0), type(IET_NONE) {}
|
||||||
float magnitude;
|
float magnitude;
|
||||||
IngredientEffectType type;
|
IngredientEffectType type;
|
||||||
std::string string;
|
std::string string;
|
||||||
|
|
|
@ -22,18 +22,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
ElementEffectData::ElementEffectData()
|
ElementEffectData::ElementEffectData()
|
||||||
: elementEffectType(EFX_NONE)
|
: elementEffectType(EFX_NONE)
|
||||||
, wavyAngleOffset(0)
|
, wavyAngleOffset(0)
|
||||||
, wavyMagnitude(0)
|
, wavyMagnitude(0)
|
||||||
, wavyLerpIn(0)
|
, wavyLerpIn(0)
|
||||||
, wavyMin(0)
|
, wavyMin(0)
|
||||||
, wavyMax(0)
|
, wavyMax(0)
|
||||||
, hitPerc(0)
|
, hitPerc(0)
|
||||||
, effectMult(0)
|
, effectMult(0)
|
||||||
, wavyWaving(false)
|
, wavyWaving(false)
|
||||||
, wavyFlip(false)
|
, wavyFlip(false)
|
||||||
, touching(false)
|
, touching(false)
|
||||||
, elementEffectIndex(-1)
|
, elementEffectIndex(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2244,7 +2244,6 @@ float Game::getCoverage(Vector pos, int sampleArea)
|
||||||
{
|
{
|
||||||
if (x == t.x && y == t.y) continue;
|
if (x == t.x && y == t.y) continue;
|
||||||
TileVector ct(x,y);
|
TileVector ct(x,y);
|
||||||
//Vector vt = ct.worldVector();
|
|
||||||
if (isObstructed(ct))
|
if (isObstructed(ct))
|
||||||
{
|
{
|
||||||
covered++;
|
covered++;
|
||||||
|
@ -2531,7 +2530,7 @@ void Game::loadEntityTypeList()
|
||||||
//
|
//
|
||||||
entityGroups.push_back(newGroup);
|
entityGroups.push_back(newGroup);
|
||||||
curGroup = entityGroups.size()-1;
|
curGroup = entityGroups.size()-1;
|
||||||
}
|
}
|
||||||
else if (!line.empty())
|
else if (!line.empty())
|
||||||
{
|
{
|
||||||
EntityGroupEntity ent;
|
EntityGroupEntity ent;
|
||||||
|
@ -5461,7 +5460,7 @@ bool Game::saveScene(std::string scene)
|
||||||
{
|
{
|
||||||
std::ostringstream& SE_rs = simpleElements_repeatScale[e->bgLayer];
|
std::ostringstream& SE_rs = simpleElements_repeatScale[e->bgLayer];
|
||||||
SE_rs << e->repeatToFillScale.x << " "
|
SE_rs << e->repeatToFillScale.x << " "
|
||||||
<< e->repeatToFillScale.y << " ";
|
<< e->repeatToFillScale.y << " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5757,10 +5756,10 @@ void Game::switchBgLoop(int v)
|
||||||
case 0:
|
case 0:
|
||||||
if (!bgSfxLoop.empty())
|
if (!bgSfxLoop.empty())
|
||||||
{
|
{
|
||||||
PlaySfx sfx;
|
PlaySfx sfx;
|
||||||
sfx.name = bgSfxLoop;
|
sfx.name = bgSfxLoop;
|
||||||
sfx.vol = bgSfxVol;
|
sfx.vol = bgSfxVol;
|
||||||
sfx.loops = -1;
|
sfx.loops = -1;
|
||||||
sfx.priority = 0.8;
|
sfx.priority = 0.8;
|
||||||
dsq->loops.bg = core->sound->playSfx(sfx);
|
dsq->loops.bg = core->sound->playSfx(sfx);
|
||||||
}
|
}
|
||||||
|
@ -5768,10 +5767,10 @@ void Game::switchBgLoop(int v)
|
||||||
case 1:
|
case 1:
|
||||||
if (!airSfxLoop.empty())
|
if (!airSfxLoop.empty())
|
||||||
{
|
{
|
||||||
PlaySfx sfx;
|
PlaySfx sfx;
|
||||||
sfx.name = airSfxLoop;
|
sfx.name = airSfxLoop;
|
||||||
sfx.vol = bgSfxVol;
|
sfx.vol = bgSfxVol;
|
||||||
sfx.loops = -1;
|
sfx.loops = -1;
|
||||||
sfx.priority = 0.8;
|
sfx.priority = 0.8;
|
||||||
dsq->loops.bg = core->sound->playSfx(sfx);
|
dsq->loops.bg = core->sound->playSfx(sfx);
|
||||||
}
|
}
|
||||||
|
@ -8250,9 +8249,9 @@ void Game::playBurstSound(bool wallJump)
|
||||||
sound->playSfx("Burst", 1);
|
sound->playSfx("Burst", 1);
|
||||||
if (chance(50))
|
if (chance(50))
|
||||||
{
|
{
|
||||||
if (dsq->continuity.form == FORM_BEAST)
|
if (dsq->continuity.form == FORM_BEAST)
|
||||||
{
|
{
|
||||||
sound->playSfx("BeastBurst", (128+rand()%64)/256.0f);
|
sound->playSfx("BeastBurst", (128+rand()%64)/256.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8691,7 +8690,7 @@ void Game::updateCurrentVisuals(float dt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (dsq->game->getPath(i)->name == "CURRENT" && dsq->game->getPath(i)->nodes.size() >= 2)
|
if (dsq->game->getPath(i)->name == "CURRENT" && dsq->game->getPath(i)->nodes.size() >= 2)
|
||||||
{
|
{
|
||||||
Vector dir = dsq->game->getPath(i)->nodes[1].position - dsq->game->getPath(i)->nodes[0].position;
|
Vector dir = dsq->game->getPath(i)->nodes[1].position - dsq->game->getPath(i)->nodes[0].position;
|
||||||
dir.setLength2D(800);
|
dir.setLength2D(800);
|
||||||
|
@ -10401,8 +10400,6 @@ void Game::update(float dt)
|
||||||
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
||||||
dsq->cameraPos = getCameraPositionFor(cameraInterp);
|
dsq->cameraPos = getCameraPositionFor(cameraInterp);
|
||||||
constrainCamera();
|
constrainCamera();
|
||||||
|
|
||||||
//float dd = (dsq->cameraPos - oldCamPos).getLength2D();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraInterp.update(dt);
|
cameraInterp.update(dt);
|
||||||
|
@ -10582,7 +10579,7 @@ ElementTemplate Game::getElementTemplateForLetter(int i)
|
||||||
void Game::loadElementTemplates(std::string pack)
|
void Game::loadElementTemplates(std::string pack)
|
||||||
{
|
{
|
||||||
|
|
||||||
stringToLower(pack);
|
stringToLower(pack);
|
||||||
/*
|
/*
|
||||||
std::string fn = ("data/"+pack+".xml");
|
std::string fn = ("data/"+pack+".xml");
|
||||||
if (!exists(fn))
|
if (!exists(fn))
|
||||||
|
|
|
@ -363,7 +363,7 @@ class EntityClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EntityClass(std::string name, bool script=false, int idx=-1, std::string prevGfx="", float prevScale=1)
|
EntityClass(std::string name, bool script=false, int idx=-1, std::string prevGfx="", float prevScale=1)
|
||||||
: name(name), prevScale(prevScale), prevGfx(prevGfx), script(script), idx(idx) {}
|
: name(name), prevScale(prevScale), prevGfx(prevGfx), script(script), idx(idx) {}
|
||||||
std::string name;
|
std::string name;
|
||||||
float prevScale;
|
float prevScale;
|
||||||
std::string prevGfx;
|
std::string prevGfx;
|
||||||
|
|
|
@ -22,15 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
|
|
||||||
IngredientData::IngredientData(const std::string &name, const std::string &gfx, IngredientType type)
|
IngredientData::IngredientData(const std::string &name, const std::string &gfx, IngredientType type)
|
||||||
: name(name)
|
: name(name)
|
||||||
, gfx(gfx)
|
, gfx(gfx)
|
||||||
, displayName(dsq->continuity.getIngredientDisplayName(name))
|
, displayName(dsq->continuity.getIngredientDisplayName(name))
|
||||||
, type(type)
|
, type(type)
|
||||||
, amount(0)
|
, amount(0)
|
||||||
, maxAmount(MAX_INGREDIENT_AMOUNT)
|
, maxAmount(MAX_INGREDIENT_AMOUNT)
|
||||||
, held(0)
|
, held(0)
|
||||||
, marked(0)
|
, marked(0)
|
||||||
, rotKind(!(type == IT_OIL || type == IT_EGG))
|
, rotKind(!(type == IT_OIL || type == IT_EGG))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ bool IngredientData::hasIET(IngredientEffectType iet)
|
||||||
}
|
}
|
||||||
|
|
||||||
Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount)
|
Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount)
|
||||||
: Entity()
|
: Entity()
|
||||||
, data(data)
|
, data(data)
|
||||||
, used(false)
|
, used(false)
|
||||||
, gone(false)
|
, gone(false)
|
||||||
, amount(amount)
|
, amount(amount)
|
||||||
{
|
{
|
||||||
addType(SCO_INGREDIENT);
|
addType(SCO_INGREDIENT);
|
||||||
entityType = ET_INGREDIENT;
|
entityType = ET_INGREDIENT;
|
||||||
|
|
|
@ -30,38 +30,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
static void MakeRan(void)
|
static void MakeRan(void)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
std::ofstream out("ran");
|
std::ofstream out("ran");
|
||||||
if(out)
|
if(out)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
out << rand()%1000;
|
out << rand()%1000;
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartAQConfig()
|
static void StartAQConfig()
|
||||||
{
|
{
|
||||||
#if defined(BBGE_BUILD_WINDOWS)
|
#if defined(BBGE_BUILD_WINDOWS)
|
||||||
if (!exists("ran", false, true))
|
if (!exists("ran", false, true))
|
||||||
{
|
{
|
||||||
MakeRan();
|
MakeRan();
|
||||||
if(exists("AQConfig.exe", false, true))
|
if(exists("AQConfig.exe", false, true))
|
||||||
{
|
{
|
||||||
ShellExecute(NULL, "open", "AQConfig.exe", NULL, NULL, SW_SHOWNORMAL);
|
ShellExecute(NULL, "open", "AQConfig.exe", NULL, NULL, SW_SHOWNORMAL);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
remove("ran");
|
remove("ran");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckConfig(void)
|
static void CheckConfig(void)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
bool hasCfg = exists("usersettings.xml", false, true);
|
bool hasCfg = exists("usersettings.xml", false, true);
|
||||||
if(!hasCfg)
|
if(!hasCfg)
|
||||||
StartAQConfig();
|
StartAQConfig();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,16 +89,16 @@ static void CheckConfig(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
CheckConfig();
|
CheckConfig();
|
||||||
|
|
||||||
{
|
{
|
||||||
DSQ dsql(dsqParam, extraDataDir);
|
DSQ dsql(dsqParam, extraDataDir);
|
||||||
dsql.init();
|
dsql.init();
|
||||||
dsql.main();
|
dsql.main();
|
||||||
dsql.shutdown();
|
dsql.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeRan();
|
MakeRan();
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,12 +285,12 @@ void MiniMapRender::toggle(int t)
|
||||||
|
|
||||||
float MiniMapRender::getMiniMapWidth() const
|
float MiniMapRender::getMiniMapWidth() const
|
||||||
{
|
{
|
||||||
return scale.x * miniMapSize;
|
return scale.x * miniMapSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
float MiniMapRender::getMiniMapHeight() const
|
float MiniMapRender::getMiniMapHeight() const
|
||||||
{
|
{
|
||||||
return scale.y * miniMapSize;
|
return scale.y * miniMapSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniMapRender::onUpdate(float dt)
|
void MiniMapRender::onUpdate(float dt)
|
||||||
|
@ -611,8 +611,8 @@ void MiniMapRender::onRender()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render)
|
if (render)
|
||||||
{
|
{
|
||||||
renderIcon(p->minimapIcon, p->nodes[0].position);
|
renderIcon(p->minimapIcon, p->nodes[0].position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,12 @@ static bool _modname_cmp(const ModIcon *a, const ModIcon *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
ModSelectorScreen::ModSelectorScreen()
|
ModSelectorScreen::ModSelectorScreen()
|
||||||
: Quad()
|
: Quad()
|
||||||
, ActionMapper()
|
, ActionMapper()
|
||||||
, dlText(&dsq->smallFont)
|
, dlText(&dsq->smallFont)
|
||||||
, gotServerList(false)
|
, gotServerList(false)
|
||||||
, currentPanel(-1)
|
, currentPanel(-1)
|
||||||
, subtext(&dsq->subsFont)
|
, subtext(&dsq->subsFont)
|
||||||
{
|
{
|
||||||
followCamera = 1;
|
followCamera = 1;
|
||||||
shareAlphaWithChildren = false;
|
shareAlphaWithChildren = false;
|
||||||
|
@ -136,7 +136,7 @@ void ModSelectorScreen::showPanel(int id)
|
||||||
if(id == currentPanel)
|
if(id == currentPanel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//const float t = 0.2f;
|
//const float t = 0.2f;
|
||||||
IconGridPanel *newgrid = panels[id];
|
IconGridPanel *newgrid = panels[id];
|
||||||
|
|
||||||
// fade in selected panel
|
// fade in selected panel
|
||||||
|
@ -484,10 +484,10 @@ void BasicIcon::onClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuIcon::MenuIcon(int id)
|
MenuIcon::MenuIcon(int id)
|
||||||
: SubtitleIcon()
|
: SubtitleIcon()
|
||||||
, cb(0)
|
, cb(0)
|
||||||
, cb_data(0)
|
, cb_data(0)
|
||||||
, iconId(id)
|
, iconId(id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,13 +623,13 @@ void ModIcon::updateStatus()
|
||||||
|
|
||||||
|
|
||||||
ModIconOnline::ModIconOnline()
|
ModIconOnline::ModIconOnline()
|
||||||
: SubtitleIcon()
|
: SubtitleIcon()
|
||||||
, pb(0)
|
, pb(0)
|
||||||
, extraIcon(0)
|
, extraIcon(0)
|
||||||
, statusIcon(0)
|
, statusIcon(0)
|
||||||
, pkgtype(MPT_MOD)
|
, pkgtype(MPT_MOD)
|
||||||
, clickable(true)
|
, clickable(true)
|
||||||
, hasUpdate(false)
|
, hasUpdate(false)
|
||||||
{
|
{
|
||||||
label = desc;
|
label = desc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ protected:
|
||||||
|
|
||||||
minihttp::HttpSocket::_OnOpen();
|
minihttp::HttpSocket::_OnOpen();
|
||||||
|
|
||||||
//const Request& r = GetCurrentRequest();
|
//const Request& r = GetCurrentRequest();
|
||||||
// TODO ??
|
// TODO ??
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -587,9 +587,6 @@ void Path::update(float dt)
|
||||||
Vector start = nodes[0].position;
|
Vector start = nodes[0].position;
|
||||||
Vector end = nodes[1].position;
|
Vector end = nodes[1].position;
|
||||||
Vector v = end - start;
|
Vector v = end - start;
|
||||||
//Vector left = v.getPerpendicularLeft();
|
|
||||||
//Vector right = v.getPerpendicularRight();
|
|
||||||
//Vector mid = (end-start) + start;
|
|
||||||
FOR_ENTITIES(i)
|
FOR_ENTITIES(i)
|
||||||
{
|
{
|
||||||
Entity *e = *i;
|
Entity *e = *i;
|
||||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
class SearchGridRaw
|
class SearchGridRaw
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SearchGridRaw(ObsType blocking) : blockingObsBits(blocking), game(dsq->game) {}
|
SearchGridRaw(ObsType blocking) : blockingObsBits(blocking), game(dsq->game) {}
|
||||||
inline bool operator()(unsigned x, unsigned y) const
|
inline bool operator()(unsigned x, unsigned y) const
|
||||||
{
|
{
|
||||||
return (game->getGridRaw(TileVector(x, y)) & blockingObsBits) == OT_EMPTY;
|
return (game->getGridRaw(TileVector(x, y)) & blockingObsBits) == OT_EMPTY;
|
||||||
|
@ -79,8 +79,7 @@ void PathFinding::molestPath(VectorPath &path)
|
||||||
{
|
{
|
||||||
Vector node = path.getPathNode(i)->value;
|
Vector node = path.getPathNode(i)->value;
|
||||||
float dist;
|
float dist;
|
||||||
int sample = 20;
|
const int sample = 20;
|
||||||
//float maxDist = sample * TILE_SIZE;
|
|
||||||
{
|
{
|
||||||
Vector n = dsq->game->getWallNormal(node, sample, &dist);
|
Vector n = dsq->game->getWallNormal(node, sample, &dist);
|
||||||
if (dist != -1 && (n.x != 0 || n.y != 0))
|
if (dist != -1 && (n.x != 0 || n.y != 0))
|
||||||
|
|
|
@ -460,28 +460,28 @@ void SceneEditor::openMainMenu()
|
||||||
core->main(FRAME_TIME);
|
core->main(FRAME_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
addMainMenuItem("LOAD LEVEL... (SHIFT-F1)", 100);
|
addMainMenuItem("LOAD LEVEL... (SHIFT-F1)", 100);
|
||||||
addMainMenuItem("RELOAD LEVEL (F1)", 101);
|
addMainMenuItem("RELOAD LEVEL (F1)", 101);
|
||||||
addMainMenuItem("SAVE LEVEL (F2)", 102);
|
addMainMenuItem("SAVE LEVEL (F2)", 102);
|
||||||
addMainMenuItem("EDIT TILES (F5)", 106);
|
addMainMenuItem("EDIT TILES (F5)", 106);
|
||||||
addMainMenuItem("EDIT ENTITIES (F6)", 107);
|
addMainMenuItem("EDIT ENTITIES (F6)", 107);
|
||||||
addMainMenuItem("EDIT NODES (F7)", 108);
|
addMainMenuItem("EDIT NODES (F7)", 108);
|
||||||
addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103);
|
addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103);
|
||||||
addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130);
|
addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130);
|
||||||
|
|
||||||
addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116);
|
addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116);
|
||||||
|
|
||||||
addMainMenuItem("SET BG GRADIENT", 110);
|
addMainMenuItem("SET BG GRADIENT", 110);
|
||||||
addMainMenuItem("SET MUSIC", 111);
|
addMainMenuItem("SET MUSIC", 111);
|
||||||
addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112);
|
addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112);
|
||||||
if (dsq->game->gridRender)
|
if (dsq->game->gridRender)
|
||||||
addMainMenuItem(std::string("TOGGLE TILE COLLISION RENDER ") + ((dsq->game->gridRender->alpha!=0) ? "OFF" : "ON ") + std::string(" (F9)"), 113);
|
addMainMenuItem(std::string("TOGGLE TILE COLLISION RENDER ") + ((dsq->game->gridRender->alpha!=0) ? "OFF" : "ON ") + std::string(" (F9)"), 113);
|
||||||
addMainMenuItem("SCREENSHOT ", 114);
|
addMainMenuItem("SCREENSHOT ", 114);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
addMainMenuItem("PARTICLE VIEWER ", 120);
|
addMainMenuItem("PARTICLE VIEWER ", 120);
|
||||||
addMainMenuItem("ANIMATION EDITOR ", 115);
|
addMainMenuItem("ANIMATION EDITOR ", 115);
|
||||||
|
|
||||||
while (1 && !core->getKeyState(KEY_TAB))
|
while (1 && !core->getKeyState(KEY_TAB))
|
||||||
{
|
{
|
||||||
|
@ -868,11 +868,11 @@ void SceneEditor::toggleWarpAreaRender()
|
||||||
|
|
||||||
void SceneEditor::setGridPattern(int gi)
|
void SceneEditor::setGridPattern(int gi)
|
||||||
{
|
{
|
||||||
if (selectedElements.size())
|
if (selectedElements.size())
|
||||||
for (int i = 0; i < selectedElements.size(); ++i)
|
for (int i = 0; i < selectedElements.size(); ++i)
|
||||||
selectedElements[i]->setElementEffectByIndex(gi);
|
selectedElements[i]->setElementEffectByIndex(gi);
|
||||||
else if (editingElement)
|
else if (editingElement)
|
||||||
editingElement->setElementEffectByIndex(gi);
|
editingElement->setElementEffectByIndex(gi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditor::setGridPattern0()
|
void SceneEditor::setGridPattern0()
|
||||||
|
@ -2863,9 +2863,9 @@ void SceneEditor::updateText()
|
||||||
if (getSelectedPath())
|
if (getSelectedPath())
|
||||||
os << " name: " << getSelectedPath()->name;
|
os << " name: " << getSelectedPath()->name;
|
||||||
break;
|
break;
|
||||||
case ET_SELECTENTITY:
|
case ET_SELECTENTITY:
|
||||||
case ET_MAX:
|
case ET_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
text->setText(os.str());
|
text->setText(os.str());
|
||||||
}
|
}
|
||||||
|
@ -2995,10 +2995,10 @@ void SceneEditor::update(float dt)
|
||||||
else
|
else
|
||||||
placer->alpha = 0.5;
|
placer->alpha = 0.5;
|
||||||
break;
|
break;
|
||||||
case ET_PATHS:
|
case ET_PATHS:
|
||||||
case ET_SELECTENTITY:
|
case ET_SELECTENTITY:
|
||||||
case ET_MAX:
|
case ET_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateText();
|
updateText();
|
||||||
|
@ -3106,9 +3106,9 @@ void SceneEditor::update(float dt)
|
||||||
if (selectedIdx >= 0)
|
if (selectedIdx >= 0)
|
||||||
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
||||||
break;
|
break;
|
||||||
case ES_ROTATING:
|
case ES_ROTATING:
|
||||||
case ES_MAX:
|
case ES_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (editType == ET_ENTITIES)
|
else if (editType == ET_ENTITIES)
|
||||||
|
@ -3136,11 +3136,11 @@ void SceneEditor::update(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ES_SELECTING:
|
case ES_SELECTING:
|
||||||
case ES_SCALING:
|
case ES_SCALING:
|
||||||
case ES_MAX:
|
case ES_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (editType == ET_ELEMENTS)
|
else if (editType == ET_ELEMENTS)
|
||||||
|
@ -3208,7 +3208,7 @@ void SceneEditor::update(float dt)
|
||||||
else if (cursorOffset.x < oldPosition.x-10)
|
else if (cursorOffset.x < oldPosition.x-10)
|
||||||
right = false;
|
right = false;
|
||||||
else
|
else
|
||||||
noSide = true;
|
noSide = true;
|
||||||
if (cursorOffset.y > oldPosition.y+10)
|
if (cursorOffset.y > oldPosition.y+10)
|
||||||
down = true;
|
down = true;
|
||||||
else if (cursorOffset.y < oldPosition.y-10)
|
else if (cursorOffset.y < oldPosition.y-10)
|
||||||
|
@ -3306,8 +3306,8 @@ void SceneEditor::update(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ES_MAX:
|
case ES_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,12 +317,12 @@ void SchoolFish::applySeparation(Vector &accumulator)
|
||||||
if (!change.isZero())
|
if (!change.isZero())
|
||||||
{
|
{
|
||||||
change.setLength2D(-ratio);
|
change.setLength2D(-ratio);
|
||||||
accumulator += change;
|
accumulator += change;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Are we too far from nearest flockmate? Then Move Closer
|
// Are we too far from nearest flockmate? Then Move Closer
|
||||||
/*
|
/*
|
||||||
else if (dist > separationDistance)
|
else if (dist > separationDistance)
|
||||||
change |= ratio;
|
change |= ratio;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -777,7 +777,7 @@ void StatsAndAchievements::UnlockAchievement( Achievement &achievement )
|
||||||
achievement.iconImage = 0;
|
achievement.iconImage = 0;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL
|
#ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL
|
||||||
unlockedToBeDisplayed.push( std::string(achievement.name) );
|
unlockedToBeDisplayed.push( std::string(achievement.name) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Store stats end of frame
|
// Store stats end of frame
|
||||||
|
|
|
@ -155,7 +155,7 @@ private:
|
||||||
// Should we store stats this frame?
|
// Should we store stats this frame?
|
||||||
bool storeStats;
|
bool storeStats;
|
||||||
|
|
||||||
// PlayStats playStats;
|
// PlayStats playStats;
|
||||||
|
|
||||||
// Current Stat details
|
// Current Stat details
|
||||||
//float m_flGameFeetTraveled;
|
//float m_flGameFeetTraveled;
|
||||||
|
|
|
@ -264,10 +264,6 @@ void AfterEffectManager::renderGrid()
|
||||||
if (activeShader)
|
if (activeShader)
|
||||||
activeShader->unbind();
|
activeShader->unbind();
|
||||||
|
|
||||||
//float width2 = float(vw)/2;
|
|
||||||
//float height2 = float(vh)/2;
|
|
||||||
|
|
||||||
|
|
||||||
if(firstShader != lastShader)
|
if(firstShader != lastShader)
|
||||||
{
|
{
|
||||||
// From here on: secondary shader passes.
|
// From here on: secondary shader passes.
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Effect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Effect();
|
Effect();
|
||||||
virtual ~Effect(){};
|
virtual ~Effect(){};
|
||||||
virtual void go(){}
|
virtual void go(){}
|
||||||
virtual void update(float dt, Vector ** drawGrid, int xDivs, int yDivs){}
|
virtual void update(float dt, Vector ** drawGrid, int xDivs, int yDivs){}
|
||||||
bool done;
|
bool done;
|
||||||
|
|
438
BBGE/Base.cpp
438
BBGE/Base.cpp
|
@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifdef BBGE_BUILD_VFS
|
#ifdef BBGE_BUILD_VFS
|
||||||
# include "ttvfs.h"
|
# include "ttvfs.h"
|
||||||
# ifndef VFS_IGNORE_CASE
|
# ifndef VFS_IGNORE_CASE
|
||||||
# error Must define VFS_IGNORE_CASE, see VFSDefines.h
|
# error Must define VFS_IGNORE_CASE, see VFSDefines.h
|
||||||
# endif
|
# endif
|
||||||
ttvfs::Root vfs; // extern
|
ttvfs::Root vfs; // extern
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,13 +67,13 @@ Vector getDirVector(Direction dir)
|
||||||
case DIR_RIGHT:
|
case DIR_RIGHT:
|
||||||
return Vector(1, 0);
|
return Vector(1, 0);
|
||||||
break;
|
break;
|
||||||
case DIR_UPLEFT:
|
case DIR_UPLEFT:
|
||||||
case DIR_UPRIGHT:
|
case DIR_UPRIGHT:
|
||||||
case DIR_DOWNLEFT:
|
case DIR_DOWNLEFT:
|
||||||
case DIR_DOWNRIGHT:
|
case DIR_DOWNRIGHT:
|
||||||
case DIR_MAX:
|
case DIR_MAX:
|
||||||
case DIR_NONE:
|
case DIR_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return Vector(0,0);
|
return Vector(0,0);
|
||||||
}
|
}
|
||||||
|
@ -94,13 +94,13 @@ Direction getOppositeDir(Direction dir)
|
||||||
case DIR_RIGHT:
|
case DIR_RIGHT:
|
||||||
return DIR_LEFT;
|
return DIR_LEFT;
|
||||||
break;
|
break;
|
||||||
case DIR_UPLEFT:
|
case DIR_UPLEFT:
|
||||||
case DIR_UPRIGHT:
|
case DIR_UPRIGHT:
|
||||||
case DIR_DOWNLEFT:
|
case DIR_DOWNLEFT:
|
||||||
case DIR_DOWNRIGHT:
|
case DIR_DOWNRIGHT:
|
||||||
case DIR_MAX:
|
case DIR_MAX:
|
||||||
case DIR_NONE:
|
case DIR_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DIR_NONE;
|
return DIR_NONE;
|
||||||
|
@ -122,13 +122,13 @@ Direction getNextDirClockwise(Direction dir)
|
||||||
case DIR_RIGHT:
|
case DIR_RIGHT:
|
||||||
return DIR_DOWN;
|
return DIR_DOWN;
|
||||||
break;
|
break;
|
||||||
case DIR_UPLEFT:
|
case DIR_UPLEFT:
|
||||||
case DIR_UPRIGHT:
|
case DIR_UPRIGHT:
|
||||||
case DIR_DOWNLEFT:
|
case DIR_DOWNLEFT:
|
||||||
case DIR_DOWNRIGHT:
|
case DIR_DOWNRIGHT:
|
||||||
case DIR_MAX:
|
case DIR_MAX:
|
||||||
case DIR_NONE:
|
case DIR_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return DIR_NONE;
|
return DIR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -173,12 +173,12 @@ std::string removeSpaces(const std::string &input)
|
||||||
|
|
||||||
unsigned hash(const std::string &string)
|
unsigned hash(const std::string &string)
|
||||||
{
|
{
|
||||||
unsigned hash = 5381;
|
unsigned hash = 5381;
|
||||||
|
|
||||||
for (int i = 0; i < string.size(); i++)
|
for (int i = 0; i < string.size(); i++)
|
||||||
hash = ((hash << 5) + hash) + (unsigned char)string[i];
|
hash = ((hash << 5) + hash) + (unsigned char)string[i];
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,8 +298,8 @@ void stringToLowerUserData(std::string &s)
|
||||||
const std::string userdata = core->getUserDataFolder();
|
const std::string userdata = core->getUserDataFolder();
|
||||||
const size_t len = userdata.length();
|
const size_t len = userdata.length();
|
||||||
const bool match = (s.length() > len) &&
|
const bool match = (s.length() > len) &&
|
||||||
((s[len] == '/') || (s[len] == '\\')) &&
|
((s[len] == '/') || (s[len] == '\\')) &&
|
||||||
!strncmp(userdata.c_str(), s.c_str(), len);
|
!strncmp(userdata.c_str(), s.c_str(), len);
|
||||||
if (!match)
|
if (!match)
|
||||||
stringToLower(s);
|
stringToLower(s);
|
||||||
else
|
else
|
||||||
|
@ -319,18 +319,18 @@ int nocasecmp(const std::string &s1, const std::string &s2)
|
||||||
//stop when either string's end has been reached
|
//stop when either string's end has been reached
|
||||||
while ( *it1 && *it2 )
|
while ( *it1 && *it2 )
|
||||||
{
|
{
|
||||||
if(charToUpper(*it1) != charToUpper(*it2)) //letters differ?
|
if(charToUpper(*it1) != charToUpper(*it2)) //letters differ?
|
||||||
// return -1 to indicate smaller than, 1 otherwise
|
// return -1 to indicate smaller than, 1 otherwise
|
||||||
return (charToUpper(*it1) < charToUpper(*it2)) ? -1 : 1;
|
return (charToUpper(*it1) < charToUpper(*it2)) ? -1 : 1;
|
||||||
//proceed to the next character in each string
|
//proceed to the next character in each string
|
||||||
++it1;
|
++it1;
|
||||||
++it2;
|
++it2;
|
||||||
}
|
}
|
||||||
size_t size1=s1.size(), size2=s2.size();// cache lengths
|
size_t size1=s1.size(), size2=s2.size();// cache lengths
|
||||||
//return -1,0 or 1 according to strings' lengths
|
//return -1,0 or 1 according to strings' lengths
|
||||||
if (size1==size2)
|
if (size1==size2)
|
||||||
return 0;
|
return 0;
|
||||||
return (size1<size2) ? -1 : 1;
|
return (size1<size2) ? -1 : 1;
|
||||||
}
|
}
|
||||||
#endif // #if !HAVE_STRCASECMP
|
#endif // #if !HAVE_STRCASECMP
|
||||||
|
|
||||||
|
@ -553,22 +553,22 @@ std::string stripEndlineForUnix(const std::string &in)
|
||||||
|
|
||||||
struct vfscallback_s
|
struct vfscallback_s
|
||||||
{
|
{
|
||||||
std::string *path;
|
std::string *path;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
intptr_t param;
|
intptr_t param;
|
||||||
void (*callback)(const std::string &filename, intptr_t param);
|
void (*callback)(const std::string &filename, intptr_t param);
|
||||||
};
|
};
|
||||||
|
|
||||||
void forEachFile_vfscallback(VFILE *vf, void *user)
|
void forEachFile_vfscallback(VFILE *vf, void *user)
|
||||||
{
|
{
|
||||||
vfscallback_s *d = (vfscallback_s*)user;
|
vfscallback_s *d = (vfscallback_s*)user;
|
||||||
if(d->ext)
|
if(d->ext)
|
||||||
{
|
{
|
||||||
const char *e = strrchr(vf->name(), '.');
|
const char *e = strrchr(vf->name(), '.');
|
||||||
if(e && nocasecmp(d->ext, e))
|
if(e && nocasecmp(d->ext, e))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
d->callback(*(d->path) + vf->name(), d->param);
|
d->callback(*(d->path) + vf->name(), d->param);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -604,45 +604,45 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
|
||||||
dir = opendir(path.c_str());
|
dir = opendir(path.c_str());
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
dirent *file=0;
|
dirent *file=0;
|
||||||
while ( (file=readdir(dir)) != NULL )
|
while ( (file=readdir(dir)) != NULL )
|
||||||
{
|
{
|
||||||
if (strlen(file->d_name) > 4)
|
if (strlen(file->d_name) > 4)
|
||||||
{
|
{
|
||||||
debugLog(file->d_name);
|
debugLog(file->d_name);
|
||||||
char *extension=strrchr(file->d_name,'.');
|
char *extension=strrchr(file->d_name,'.');
|
||||||
if (extension)
|
if (extension)
|
||||||
{
|
{
|
||||||
debugLog(extension);
|
debugLog(extension);
|
||||||
if (extension!=NULL)
|
if (extension!=NULL)
|
||||||
{
|
{
|
||||||
if (strcasecmp(extension,type.c_str())==0)
|
if (strcasecmp(extension,type.c_str())==0)
|
||||||
{
|
{
|
||||||
callback(path + std::string(file->d_name), param);
|
callback(path + std::string(file->d_name), param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debugLog("FAILED TO OPEN DIR");
|
debugLog("FAILED TO OPEN DIR");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
BOOL fFinished;
|
BOOL fFinished;
|
||||||
HANDLE hList;
|
HANDLE hList;
|
||||||
TCHAR szDir[MAX_PATH+1];
|
TCHAR szDir[MAX_PATH+1];
|
||||||
WIN32_FIND_DATA FileData;
|
WIN32_FIND_DATA FileData;
|
||||||
|
|
||||||
int end = path.size()-1;
|
int end = path.size()-1;
|
||||||
if (path[end] != '/')
|
if (path[end] != '/')
|
||||||
path[end] += '/';
|
path[end] += '/';
|
||||||
|
|
||||||
// Get the proper directory path
|
// Get the proper directory path
|
||||||
// \\ %s\\*
|
// \\ %s\\*
|
||||||
|
|
||||||
|
|
||||||
|
@ -658,21 +658,21 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
|
||||||
|
|
||||||
stringToUpper(type);
|
stringToUpper(type);
|
||||||
|
|
||||||
// Get the first file
|
// Get the first file
|
||||||
hList = FindFirstFile(szDir, &FileData);
|
hList = FindFirstFile(szDir, &FileData);
|
||||||
if (hList == INVALID_HANDLE_VALUE)
|
if (hList == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
|
||||||
debugLog("No files of type " + type + " found in path " + path);
|
debugLog("No files of type " + type + " found in path " + path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Traverse through the directory structure
|
// Traverse through the directory structure
|
||||||
fFinished = FALSE;
|
fFinished = FALSE;
|
||||||
while (!fFinished)
|
while (!fFinished)
|
||||||
{
|
{
|
||||||
// Check the object is a directory or not
|
// Check the object is a directory or not
|
||||||
//printf("%*s%s\n", indent, "", FileData.cFileName);
|
//printf("%*s%s\n", indent, "", FileData.cFileName);
|
||||||
std::string filename = FileData.cFileName;
|
std::string filename = FileData.cFileName;
|
||||||
|
|
||||||
if (filename.size()>4)
|
if (filename.size()>4)
|
||||||
|
@ -688,15 +688,15 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!FindNextFile(hList, &FileData))
|
if (!FindNextFile(hList, &FileData))
|
||||||
{
|
{
|
||||||
|
|
||||||
fFinished = TRUE;
|
fFinished = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FindClose(hList);
|
FindClose(hList);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,29 +705,29 @@ std::vector<std::string> getFileList(std::string path, std::string type, int par
|
||||||
std::vector<std::string> list;
|
std::vector<std::string> list;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
BOOL fFinished;
|
BOOL fFinished;
|
||||||
HANDLE hList;
|
HANDLE hList;
|
||||||
TCHAR szDir[MAX_PATH+1];
|
TCHAR szDir[MAX_PATH+1];
|
||||||
WIN32_FIND_DATA FileData;
|
WIN32_FIND_DATA FileData;
|
||||||
|
|
||||||
// Get the proper directory path
|
// Get the proper directory path
|
||||||
sprintf(szDir, "%s\\*", path.c_str());
|
sprintf(szDir, "%s\\*", path.c_str());
|
||||||
|
|
||||||
|
|
||||||
// Get the first file
|
// Get the first file
|
||||||
hList = FindFirstFile(szDir, &FileData);
|
hList = FindFirstFile(szDir, &FileData);
|
||||||
if (hList == INVALID_HANDLE_VALUE)
|
if (hList == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
printf("No files found\n\n");
|
printf("No files found\n\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Traverse through the directory structure
|
// Traverse through the directory structure
|
||||||
fFinished = FALSE;
|
fFinished = FALSE;
|
||||||
while (!fFinished)
|
while (!fFinished)
|
||||||
{
|
{
|
||||||
// Check the object is a directory or not
|
// Check the object is a directory or not
|
||||||
//printf("%*s%s\n", indent, "", FileData.cFileName);
|
//printf("%*s%s\n", indent, "", FileData.cFileName);
|
||||||
std::string filename = FileData.cFileName;
|
std::string filename = FileData.cFileName;
|
||||||
if (filename.size()>4 && filename.substr(filename.size()-4, filename.size())==type)
|
if (filename.size()>4 && filename.substr(filename.size()-4, filename.size())==type)
|
||||||
{
|
{
|
||||||
|
@ -736,15 +736,15 @@ std::vector<std::string> getFileList(std::string path, std::string type, int par
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!FindNextFile(hList, &FileData))
|
if (!FindNextFile(hList, &FileData))
|
||||||
{
|
{
|
||||||
|
|
||||||
fFinished = TRUE;
|
fFinished = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FindClose(hList);
|
FindClose(hList);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -757,7 +757,7 @@ void cocoaMessageBox(const std::string &title, const std::string &msg);
|
||||||
void messageBox(const std::string& title, const std::string &msg)
|
void messageBox(const std::string& title, const std::string &msg)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
MessageBox (0,msg.c_str(),title.c_str(),MB_OK);
|
MessageBox (0,msg.c_str(),title.c_str(),MB_OK);
|
||||||
#elif SDL_VERSION_ATLEAST(2,0,0)
|
#elif SDL_VERSION_ATLEAST(2,0,0)
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, title.c_str(),
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, title.c_str(),
|
||||||
msg.c_str(), NULL);
|
msg.c_str(), NULL);
|
||||||
|
@ -803,24 +803,24 @@ Vector getNearestPointOnLine(Vector a, Vector b, Vector c)
|
||||||
|
|
||||||
bool isTouchingLine(Vector lineStart, Vector lineEnd, Vector point, int radius, Vector *closestP)
|
bool isTouchingLine(Vector lineStart, Vector lineEnd, Vector point, int radius, Vector *closestP)
|
||||||
{
|
{
|
||||||
Vector dir = lineEnd - lineStart;
|
Vector dir = lineEnd - lineStart;
|
||||||
Vector diff = point - lineStart;
|
Vector diff = point - lineStart;
|
||||||
Vector closest;
|
Vector closest;
|
||||||
if (!dir.isZero()) {
|
if (!dir.isZero()) {
|
||||||
float t = diff.dot2D(dir) / dir.dot2D(dir);
|
float t = diff.dot2D(dir) / dir.dot2D(dir);
|
||||||
if (t < 0.0f)
|
if (t < 0.0f)
|
||||||
t = 0.0f;
|
t = 0.0f;
|
||||||
if (t > 1.0f)
|
if (t > 1.0f)
|
||||||
t = 1.0f;
|
t = 1.0f;
|
||||||
closest = lineStart + t * dir;
|
closest = lineStart + t * dir;
|
||||||
} else {
|
} else {
|
||||||
closest = lineStart;
|
closest = lineStart;
|
||||||
}
|
}
|
||||||
Vector d = point - closest;
|
Vector d = point - closest;
|
||||||
float distsqr = d.dot2D(d);
|
float distsqr = d.dot2D(d);
|
||||||
if (closestP)
|
if (closestP)
|
||||||
(*closestP) = closest;
|
(*closestP) = closest;
|
||||||
return distsqr <= radius*radius;
|
return distsqr <= radius*radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -899,56 +899,56 @@ int packFile(const std::string &sourcef, const std::string &destf, int level)
|
||||||
if (!source || !dest)
|
if (!source || !dest)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int ret, flush;
|
int ret, flush;
|
||||||
unsigned have;
|
unsigned have;
|
||||||
z_stream strm;
|
z_stream strm;
|
||||||
unsigned char in[CHUNK];
|
unsigned char in[CHUNK];
|
||||||
unsigned char out[CHUNK];
|
unsigned char out[CHUNK];
|
||||||
|
|
||||||
/* allocate deflate state */
|
/* allocate deflate state */
|
||||||
strm.zalloc = Z_NULL;
|
strm.zalloc = Z_NULL;
|
||||||
strm.zfree = Z_NULL;
|
strm.zfree = Z_NULL;
|
||||||
strm.opaque = Z_NULL;
|
strm.opaque = Z_NULL;
|
||||||
ret = deflateInit(&strm, level);
|
ret = deflateInit(&strm, level);
|
||||||
if (ret != Z_OK)
|
if (ret != Z_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* compress until end of file */
|
/* compress until end of file */
|
||||||
do {
|
do {
|
||||||
strm.avail_in = fread(in, 1, CHUNK, source);
|
strm.avail_in = fread(in, 1, CHUNK, source);
|
||||||
if (ferror(source)) {
|
if (ferror(source)) {
|
||||||
(void)deflateEnd(&strm);
|
(void)deflateEnd(&strm);
|
||||||
return Z_ERRNO;
|
return Z_ERRNO;
|
||||||
}
|
}
|
||||||
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
|
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
|
||||||
strm.next_in = in;
|
strm.next_in = in;
|
||||||
|
|
||||||
/* run deflate() on input until output buffer not full, finish
|
/* run deflate() on input until output buffer not full, finish
|
||||||
compression if all of source has been read in */
|
compression if all of source has been read in */
|
||||||
do {
|
do {
|
||||||
strm.avail_out = CHUNK;
|
strm.avail_out = CHUNK;
|
||||||
strm.next_out = out;
|
strm.next_out = out;
|
||||||
ret = deflate(&strm, flush); /* no bad return value */
|
ret = deflate(&strm, flush); /* no bad return value */
|
||||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||||
have = CHUNK - strm.avail_out;
|
have = CHUNK - strm.avail_out;
|
||||||
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
||||||
(void)deflateEnd(&strm);
|
(void)deflateEnd(&strm);
|
||||||
return Z_ERRNO;
|
return Z_ERRNO;
|
||||||
}
|
}
|
||||||
} while (strm.avail_out == 0);
|
} while (strm.avail_out == 0);
|
||||||
assert(strm.avail_in == 0); /* all input will be used */
|
assert(strm.avail_in == 0); /* all input will be used */
|
||||||
|
|
||||||
/* done when last data in file processed */
|
/* done when last data in file processed */
|
||||||
} while (flush != Z_FINISH);
|
} while (flush != Z_FINISH);
|
||||||
assert(ret == Z_STREAM_END); /* stream will be complete */
|
assert(ret == Z_STREAM_END); /* stream will be complete */
|
||||||
|
|
||||||
/* clean up and return */
|
/* clean up and return */
|
||||||
(void)deflateEnd(&strm);
|
(void)deflateEnd(&strm);
|
||||||
|
|
||||||
fclose(source);
|
fclose(source);
|
||||||
fclose(dest);
|
fclose(dest);
|
||||||
|
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decompress from file source to file dest until stream ends or EOF.
|
/* Decompress from file source to file dest until stream ends or EOF.
|
||||||
|
@ -965,64 +965,64 @@ int unpackFile(const std::string &sourcef, const std::string &destf)
|
||||||
if (!source || !dest)
|
if (!source || !dest)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
unsigned have;
|
unsigned have;
|
||||||
z_stream strm;
|
z_stream strm;
|
||||||
unsigned char in[CHUNK];
|
unsigned char in[CHUNK];
|
||||||
unsigned char out[CHUNK];
|
unsigned char out[CHUNK];
|
||||||
|
|
||||||
/* allocate inflate state */
|
/* allocate inflate state */
|
||||||
strm.zalloc = Z_NULL;
|
strm.zalloc = Z_NULL;
|
||||||
strm.zfree = Z_NULL;
|
strm.zfree = Z_NULL;
|
||||||
strm.opaque = Z_NULL;
|
strm.opaque = Z_NULL;
|
||||||
strm.avail_in = 0;
|
strm.avail_in = 0;
|
||||||
strm.next_in = Z_NULL;
|
strm.next_in = Z_NULL;
|
||||||
ret = inflateInit(&strm);
|
ret = inflateInit(&strm);
|
||||||
if (ret != Z_OK)
|
if (ret != Z_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* decompress until deflate stream ends or end of file */
|
/* decompress until deflate stream ends or end of file */
|
||||||
do {
|
do {
|
||||||
strm.avail_in = fread(in, 1, CHUNK, source);
|
strm.avail_in = fread(in, 1, CHUNK, source);
|
||||||
if (ferror(source)) {
|
if (ferror(source)) {
|
||||||
(void)inflateEnd(&strm);
|
(void)inflateEnd(&strm);
|
||||||
return Z_ERRNO;
|
return Z_ERRNO;
|
||||||
}
|
}
|
||||||
if (strm.avail_in == 0)
|
if (strm.avail_in == 0)
|
||||||
break;
|
break;
|
||||||
strm.next_in = in;
|
strm.next_in = in;
|
||||||
|
|
||||||
/* run inflate() on input until output buffer not full */
|
/* run inflate() on input until output buffer not full */
|
||||||
do {
|
do {
|
||||||
strm.avail_out = CHUNK;
|
strm.avail_out = CHUNK;
|
||||||
strm.next_out = out;
|
strm.next_out = out;
|
||||||
ret = inflate(&strm, Z_NO_FLUSH);
|
ret = inflate(&strm, Z_NO_FLUSH);
|
||||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case Z_NEED_DICT:
|
case Z_NEED_DICT:
|
||||||
ret = Z_DATA_ERROR; /* and fall through */
|
ret = Z_DATA_ERROR; /* and fall through */
|
||||||
case Z_DATA_ERROR:
|
case Z_DATA_ERROR:
|
||||||
case Z_MEM_ERROR:
|
case Z_MEM_ERROR:
|
||||||
(void)inflateEnd(&strm);
|
(void)inflateEnd(&strm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
have = CHUNK - strm.avail_out;
|
have = CHUNK - strm.avail_out;
|
||||||
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
||||||
(void)inflateEnd(&strm);
|
(void)inflateEnd(&strm);
|
||||||
return Z_ERRNO;
|
return Z_ERRNO;
|
||||||
}
|
}
|
||||||
} while (strm.avail_out == 0);
|
} while (strm.avail_out == 0);
|
||||||
|
|
||||||
/* done when inflate() says it's done */
|
/* done when inflate() says it's done */
|
||||||
} while (ret != Z_STREAM_END);
|
} while (ret != Z_STREAM_END);
|
||||||
|
|
||||||
/* clean up and return */
|
/* clean up and return */
|
||||||
(void)inflateEnd(&strm);
|
(void)inflateEnd(&strm);
|
||||||
|
|
||||||
fclose(source);
|
fclose(source);
|
||||||
fclose(dest);
|
fclose(dest);
|
||||||
|
|
||||||
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
|
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#undef min
|
#undef min
|
||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define strtof (float)strtod
|
#define strtof (float)strtod
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "BBGECompileConfig.h"
|
#include "BBGECompileConfig.h"
|
||||||
|
|
|
@ -337,7 +337,7 @@ Core::Core(const std::string &filesystem, const std::string& extraDataDir, int n
|
||||||
#if defined(BBGE_BUILD_UNIX)
|
#if defined(BBGE_BUILD_UNIX)
|
||||||
const char *envr = getenv("HOME");
|
const char *envr = getenv("HOME");
|
||||||
if (envr == NULL)
|
if (envr == NULL)
|
||||||
envr = "."; // oh well.
|
envr = "."; // oh well.
|
||||||
const std::string home(envr);
|
const std::string home(envr);
|
||||||
|
|
||||||
createDir(home); // just in case.
|
createDir(home); // just in case.
|
||||||
|
@ -626,7 +626,7 @@ std::string Core::adjustFilenameCase(const char *_buf)
|
||||||
if (strcmp(_buf, buf) != 0)
|
if (strcmp(_buf, buf) != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Corrected filename case: '%s' => '%s (%s)'\n",
|
fprintf(stderr, "Corrected filename case: '%s' => '%s (%s)'\n",
|
||||||
_buf, buf, rc ? "found" : "not found");
|
_buf, buf, rc ? "found" : "not found");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -918,10 +918,10 @@ unsigned int Core::dbg_numRenderCalls = 0;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
|
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
|
||||||
#define GL_FUNC(ret,fn,params,call,rt) \
|
#define GL_FUNC(ret,fn,params,call,rt) \
|
||||||
extern "C" { \
|
extern "C" { \
|
||||||
static ret (GLAPIENTRY *p##fn) params = NULL; \
|
static ret (GLAPIENTRY *p##fn) params = NULL; \
|
||||||
ret GLAPIENTRY fn params { ++Core::dbg_numRenderCalls; rt p##fn call; } \
|
ret GLAPIENTRY fn params { ++Core::dbg_numRenderCalls; rt p##fn call; } \
|
||||||
}
|
}
|
||||||
#include "OpenGLStubs.h"
|
#include "OpenGLStubs.h"
|
||||||
#undef GL_FUNC
|
#undef GL_FUNC
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ bool Core::initGraphicsLibrary(int width, int height, bool fullscreen, int vsync
|
||||||
setWindowCaption(appName, appName);
|
setWindowCaption(appName, appName);
|
||||||
|
|
||||||
initIcon();
|
initIcon();
|
||||||
// Create window
|
// Create window
|
||||||
|
|
||||||
setSDLGLAttributes();
|
setSDLGLAttributes();
|
||||||
|
|
||||||
|
@ -1242,22 +1242,22 @@ void Core::applyState(const std::string &state)
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
void centerWindow(HWND hwnd)
|
void centerWindow(HWND hwnd)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
HWND hwndDeskTop;
|
HWND hwndDeskTop;
|
||||||
RECT rcWnd, rcDeskTop;
|
RECT rcWnd, rcDeskTop;
|
||||||
// Get a handle to the desktop window
|
// Get a handle to the desktop window
|
||||||
hwndDeskTop = ::GetDesktopWindow();
|
hwndDeskTop = ::GetDesktopWindow();
|
||||||
// Get dimension of desktop in a rect
|
// Get dimension of desktop in a rect
|
||||||
::GetWindowRect(hwndDeskTop, &rcDeskTop);
|
::GetWindowRect(hwndDeskTop, &rcDeskTop);
|
||||||
// Get dimension of main window in a rect
|
// Get dimension of main window in a rect
|
||||||
::GetWindowRect(hwnd, &rcWnd);
|
::GetWindowRect(hwnd, &rcWnd);
|
||||||
// Find center of desktop
|
// Find center of desktop
|
||||||
x = (rcDeskTop.right - rcDeskTop.left)/2;
|
x = (rcDeskTop.right - rcDeskTop.left)/2;
|
||||||
y = (rcDeskTop.bottom - rcDeskTop.top)/2;
|
y = (rcDeskTop.bottom - rcDeskTop.top)/2;
|
||||||
x -= (rcWnd.right - rcWnd.left)/2;
|
x -= (rcWnd.right - rcWnd.left)/2;
|
||||||
y -= (rcWnd.bottom - rcWnd.top)/2;
|
y -= (rcWnd.bottom - rcWnd.top)/2;
|
||||||
// Set top and left to center main window on desktop
|
// Set top and left to center main window on desktop
|
||||||
::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
|
::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1277,7 +1277,7 @@ bool Core::createWindow(int width, int height, int bits, bool fullscreen, std::s
|
||||||
|
|
||||||
// No longer part of C/C++ standard
|
// No longer part of C/C++ standard
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Core::setPixelScale(int pixelScaleX, int pixelScaleY)
|
void Core::setPixelScale(int pixelScaleX, int pixelScaleY)
|
||||||
|
@ -1337,7 +1337,7 @@ void Core::enable2DWide(int rx, int ry)
|
||||||
|
|
||||||
static void bbgeOrtho2D(float left, float right, float bottom, float top)
|
static void bbgeOrtho2D(float left, float right, float bottom, float top)
|
||||||
{
|
{
|
||||||
glOrtho(left, right, bottom, top, -1.0, 1.0);
|
glOrtho(left, right, bottom, top, -1.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale)
|
void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale)
|
||||||
|
@ -1345,12 +1345,12 @@ void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GLint viewPort[4];
|
GLint viewPort[4];
|
||||||
glGetIntegerv(GL_VIEWPORT, viewPort);
|
glGetIntegerv(GL_VIEWPORT, viewPort);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
float vw=0,vh=0;
|
float vw=0,vh=0;
|
||||||
|
|
||||||
|
@ -1377,9 +1377,9 @@ void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
setupRenderPositionAndScale();
|
setupRenderPositionAndScale();
|
||||||
|
|
||||||
|
@ -1482,7 +1482,7 @@ std::string getScreenshotFilename()
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << core->getUserDataFolder() << "/screenshots/screen" << screenshotNum << ".tga";
|
os << core->getUserDataFolder() << "/screenshots/screen" << screenshotNum << ".tga";
|
||||||
screenshotNum ++;
|
screenshotNum ++;
|
||||||
std::string str(os.str());
|
std::string str(os.str());
|
||||||
if (!core->exists(str)) // keep going until we hit an unused filename.
|
if (!core->exists(str)) // keep going until we hit an unused filename.
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -1535,7 +1535,7 @@ void Core::main(float runTime)
|
||||||
|
|
||||||
float dt;
|
float dt;
|
||||||
float counter = 0;
|
float counter = 0;
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
|
|
||||||
|
|
||||||
#if (!defined(_DEBUG) || defined(BBGE_BUILD_UNIX)) && defined(BBGE_BUILD_SDL)
|
#if (!defined(_DEBUG) || defined(BBGE_BUILD_UNIX)) && defined(BBGE_BUILD_SDL)
|
||||||
|
@ -2729,9 +2729,9 @@ void Core::shutdown()
|
||||||
|
|
||||||
void Core::instantQuit()
|
void Core::instantQuit()
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_QUIT;
|
event.type = SDL_QUIT;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::exists(const std::string &filename)
|
bool Core::exists(const std::string &filename)
|
||||||
|
|
52
BBGE/Core.h
52
BBGE/Core.h
|
@ -126,17 +126,17 @@ enum GameKeys
|
||||||
KEY_RBRACKET,
|
KEY_RBRACKET,
|
||||||
|
|
||||||
KEY_TILDE,
|
KEY_TILDE,
|
||||||
KEY_0,
|
KEY_0,
|
||||||
KEY_1,
|
KEY_1,
|
||||||
KEY_2,
|
KEY_2,
|
||||||
KEY_3,
|
KEY_3,
|
||||||
KEY_4,
|
KEY_4,
|
||||||
KEY_5,
|
KEY_5,
|
||||||
KEY_6,
|
KEY_6,
|
||||||
KEY_7,
|
KEY_7,
|
||||||
KEY_8,
|
KEY_8,
|
||||||
KEY_9,
|
KEY_9,
|
||||||
KEY_A,
|
KEY_A,
|
||||||
KEY_B,
|
KEY_B,
|
||||||
KEY_C,
|
KEY_C,
|
||||||
KEY_D,
|
KEY_D,
|
||||||
|
@ -188,21 +188,21 @@ enum GameKeys
|
||||||
KEY_END,
|
KEY_END,
|
||||||
KEY_COMMA,
|
KEY_COMMA,
|
||||||
KEY_SLASH,
|
KEY_SLASH,
|
||||||
KEY_F1,
|
KEY_F1,
|
||||||
KEY_F2,
|
KEY_F2,
|
||||||
KEY_F3,
|
KEY_F3,
|
||||||
KEY_F4,
|
KEY_F4,
|
||||||
KEY_F5,
|
KEY_F5,
|
||||||
KEY_F6,
|
KEY_F6,
|
||||||
KEY_F7,
|
KEY_F7,
|
||||||
KEY_F8,
|
KEY_F8,
|
||||||
KEY_F9,
|
KEY_F9,
|
||||||
KEY_F10,
|
KEY_F10,
|
||||||
KEY_F11,
|
KEY_F11,
|
||||||
KEY_F12,
|
KEY_F12,
|
||||||
KEY_F13,
|
KEY_F13,
|
||||||
KEY_F14,
|
KEY_F14,
|
||||||
KEY_F15,
|
KEY_F15,
|
||||||
KEY_ESCAPE,
|
KEY_ESCAPE,
|
||||||
KEY_ANYKEY,
|
KEY_ANYKEY,
|
||||||
KEY_MAXARRAY
|
KEY_MAXARRAY
|
||||||
|
|
|
@ -162,12 +162,12 @@ void DebugFont::setAlign(Align align)
|
||||||
#include "../BBGE/Quad.h"
|
#include "../BBGE/Quad.h"
|
||||||
|
|
||||||
DebugButton::DebugButton(int buttonID, DebugButtonReceiver *receiver, int bgWidth, int fsize, bool quitMain)
|
DebugButton::DebugButton(int buttonID, DebugButtonReceiver *receiver, int bgWidth, int fsize, bool quitMain)
|
||||||
: RenderObject()
|
: RenderObject()
|
||||||
, label(0)
|
, label(0)
|
||||||
, quitMain(quitMain)
|
, quitMain(quitMain)
|
||||||
, buttonID(buttonID)
|
, buttonID(buttonID)
|
||||||
, highlight(0)
|
, highlight(0)
|
||||||
, receiver(receiver)
|
, receiver(receiver)
|
||||||
{
|
{
|
||||||
if (bgWidth == 0)
|
if (bgWidth == 0)
|
||||||
bgWidth = 150;
|
bgWidth = 150;
|
||||||
|
|
|
@ -80,10 +80,8 @@ void PostProcessingFX::render()
|
||||||
FXTypes type = (FXTypes)i;
|
FXTypes type = (FXTypes)i;
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case FTX_NONE:
|
case FXT_MAX:
|
||||||
break;
|
break;
|
||||||
case FXT_MAX:
|
|
||||||
break;
|
|
||||||
case FXT_RADIALBLUR:
|
case FXT_RADIALBLUR:
|
||||||
|
|
||||||
float windowW = core->getWindowWidth();
|
float windowW = core->getWindowWidth();
|
||||||
|
@ -152,7 +150,7 @@ void PostProcessingFX::render()
|
||||||
RenderObject::lastTextureApplied = 0;
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
enum FXTypes
|
enum FXTypes
|
||||||
{
|
{
|
||||||
FTX_NONE =-1,
|
|
||||||
FXT_RADIALBLUR =0,
|
FXT_RADIALBLUR =0,
|
||||||
FXT_MAX
|
FXT_MAX
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T *callee;
|
T *callee;
|
||||||
void (T::*callback)(void);
|
void (T::*callback)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T *callee;
|
T *callee;
|
||||||
void (T::*callback)(Event *e);
|
void (T::*callback)(Event *e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define EVENT(x,y) class x : public Event { public: void act(); }; x y;
|
#define EVENT(x,y) class x : public Event { public: void act(); }; x y;
|
||||||
|
|
|
@ -185,7 +185,7 @@ protected:
|
||||||
struct ParticleInfluence
|
struct ParticleInfluence
|
||||||
{
|
{
|
||||||
ParticleInfluence(Vector pos, float spd, float size, bool pull)
|
ParticleInfluence(Vector pos, float spd, float size, bool pull)
|
||||||
: pos(pos), size(size), spd(spd), pull(pull)
|
: pos(pos), size(size), spd(spd), pull(pull)
|
||||||
{}
|
{}
|
||||||
ParticleInfluence() : size(0), spd(0), pull(false) {}
|
ParticleInfluence() : size(0), spd(0), pull(false) {}
|
||||||
Vector pos;
|
Vector pos;
|
||||||
|
|
|
@ -141,7 +141,7 @@ void Precacher::precacheList(const std::string &list, void progressCallback())
|
||||||
t = t.substr(0,t.size()-1);
|
t = t.substr(0,t.size()-1);
|
||||||
debugLog("precache["+t+"]");
|
debugLog("precache["+t+"]");
|
||||||
#endif
|
#endif
|
||||||
stringToLower(t);
|
stringToLower(t);
|
||||||
precacheTex(t);
|
precacheTex(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
QuadTrail::QuadTrail(int maxPoints, float pointDist)
|
QuadTrail::QuadTrail(int maxPoints, float pointDist)
|
||||||
: RenderObject()
|
: RenderObject()
|
||||||
, numPoints(0)
|
, numPoints(0)
|
||||||
, maxPoints(maxPoints)
|
, maxPoints(maxPoints)
|
||||||
, pointDist(pointDist)
|
, pointDist(pointDist)
|
||||||
{
|
{
|
||||||
quadTrailAlphaEffect = QTAE_NORMAL;
|
quadTrailAlphaEffect = QTAE_NORMAL;
|
||||||
cull = false;
|
cull = false;
|
||||||
|
|
|
@ -25,25 +25,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
#ifdef BBGE_BUILD_SHADERS
|
||||||
// GL_ARB_shader_objects
|
// GL_ARB_shader_objects
|
||||||
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
|
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
|
||||||
PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
|
PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
|
||||||
PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
|
PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
|
||||||
PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
|
PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
|
||||||
PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
|
PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
|
||||||
PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
|
PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
|
||||||
PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL;
|
PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL;
|
||||||
PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
|
PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
|
||||||
PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL;
|
PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL;
|
||||||
PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
|
PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
|
||||||
PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
|
PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
|
||||||
PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL;
|
PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL;
|
||||||
PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL;
|
PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL;
|
||||||
PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL;
|
PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL;
|
||||||
PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL;
|
PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL;
|
||||||
PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;
|
PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;
|
||||||
PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL;
|
PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL;
|
||||||
PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL;
|
PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL;
|
||||||
PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL;
|
PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL;
|
||||||
PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL;
|
PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void Shader::staticInit()
|
||||||
_useShaders = true;
|
_useShaders = true;
|
||||||
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_useShaders)
|
if (_useShaders)
|
||||||
|
@ -228,7 +228,7 @@ void Shader::load(const std::string &file, const std::string &fragFile)
|
||||||
this->vertFile = file;
|
this->vertFile = file;
|
||||||
this->fragFile = fragFile;
|
this->fragFile = fragFile;
|
||||||
|
|
||||||
char *vertCode = file.length() ? readFile(file) : NULL;
|
char *vertCode = file.length() ? readFile(file) : NULL;
|
||||||
char *fragCode = fragFile.length() ? readFile(fragFile) : NULL;
|
char *fragCode = fragFile.length() ? readFile(fragFile) : NULL;
|
||||||
|
|
||||||
loadSrc(vertCode, fragCode);
|
loadSrc(vertCode, fragCode);
|
||||||
|
@ -329,14 +329,14 @@ void Shader::_setUniform(Uniform *u)
|
||||||
{
|
{
|
||||||
switch(u->type)
|
switch(u->type)
|
||||||
{
|
{
|
||||||
case GL_FLOAT: glUniform1fvARB(u->location, 1, u->data.f.f); break;
|
case GL_FLOAT: glUniform1fvARB(u->location, 1, u->data.f.f); break;
|
||||||
case GL_FLOAT_VEC2_ARB: glUniform2fvARB(u->location, 1, u->data.f.f); break;
|
case GL_FLOAT_VEC2_ARB: glUniform2fvARB(u->location, 1, u->data.f.f); break;
|
||||||
case GL_FLOAT_VEC3_ARB: glUniform3fvARB(u->location, 1, u->data.f.f); break;
|
case GL_FLOAT_VEC3_ARB: glUniform3fvARB(u->location, 1, u->data.f.f); break;
|
||||||
case GL_FLOAT_VEC4_ARB: glUniform4fvARB(u->location, 1, u->data.f.f); break;
|
case GL_FLOAT_VEC4_ARB: glUniform4fvARB(u->location, 1, u->data.f.f); break;
|
||||||
case GL_INT: glUniform1ivARB(u->location, 1, u->data.i.i); break;
|
case GL_INT: glUniform1ivARB(u->location, 1, u->data.i.i); break;
|
||||||
case GL_INT_VEC2_ARB: glUniform2ivARB(u->location, 1, u->data.i.i); break;
|
case GL_INT_VEC2_ARB: glUniform2ivARB(u->location, 1, u->data.i.i); break;
|
||||||
case GL_INT_VEC3_ARB: glUniform3ivARB(u->location, 1, u->data.i.i); break;
|
case GL_INT_VEC3_ARB: glUniform3ivARB(u->location, 1, u->data.i.i); break;
|
||||||
case GL_INT_VEC4_ARB: glUniform4ivARB(u->location, 1, u->data.i.i); break;
|
case GL_INT_VEC4_ARB: glUniform4ivARB(u->location, 1, u->data.i.i); break;
|
||||||
}
|
}
|
||||||
u->dirty = false;
|
u->dirty = false;
|
||||||
}
|
}
|
||||||
|
@ -432,10 +432,10 @@ void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, i
|
||||||
if(unsigned(idx) >= uniforms.size())
|
if(unsigned(idx) >= uniforms.size())
|
||||||
return;
|
return;
|
||||||
Uniform& u = uniforms[idx];
|
Uniform& u = uniforms[idx];
|
||||||
u.data.i.i[0] = x;
|
u.data.i.i[0] = x;
|
||||||
u.data.i.i[1] = y;
|
u.data.i.i[1] = y;
|
||||||
u.data.i.i[2] = z;
|
u.data.i.i[2] = z;
|
||||||
u.data.i.i[3] = w;
|
u.data.i.i[3] = w;
|
||||||
u.dirty = true;
|
u.dirty = true;
|
||||||
uniformsDirty = true;
|
uniformsDirty = true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -450,10 +450,10 @@ void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* =
|
||||||
if(unsigned(idx) >= uniforms.size())
|
if(unsigned(idx) >= uniforms.size())
|
||||||
return;
|
return;
|
||||||
Uniform& u = uniforms[idx];
|
Uniform& u = uniforms[idx];
|
||||||
u.data.f.f[0] = x;
|
u.data.f.f[0] = x;
|
||||||
u.data.f.f[1] = y;
|
u.data.f.f[1] = y;
|
||||||
u.data.f.f[2] = z;
|
u.data.f.f[2] = z;
|
||||||
u.data.f.f[3] = w;
|
u.data.f.f[3] = w;
|
||||||
u.dirty = true;
|
u.dirty = true;
|
||||||
uniformsDirty = true;
|
uniformsDirty = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,14 +62,14 @@ private:
|
||||||
bool dirty; // need to flush if true
|
bool dirty; // need to flush if true
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct si
|
struct si
|
||||||
{
|
{
|
||||||
int i[4];
|
int i[4];
|
||||||
} i;
|
} i;
|
||||||
struct sf
|
struct sf
|
||||||
{
|
{
|
||||||
float f[4];
|
float f[4];
|
||||||
} f;
|
} f;
|
||||||
} data;
|
} data;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
|
|
|
@ -365,16 +365,16 @@ void BoneCommand::run()
|
||||||
if (e)
|
if (e)
|
||||||
e->stop();
|
e->stop();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AC_SET_PASS:
|
case AC_SET_PASS:
|
||||||
b->setRenderPass(slot);
|
b->setRenderPass(slot);
|
||||||
break;
|
break;
|
||||||
case AC_RESET_PASS:
|
case AC_RESET_PASS:
|
||||||
b->setRenderPass(b->originalRenderPass);
|
b->setRenderPass(b->originalRenderPass);
|
||||||
break;
|
break;
|
||||||
case AC_SEGS_START:
|
case AC_SEGS_START:
|
||||||
case AC_SEGS_STOP:
|
case AC_SEGS_STOP:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,8 +407,8 @@ void AnimationLayer::playCurrentAnimation(int loop)
|
||||||
|
|
||||||
void AnimationLayer::animate(const std::string &a, int loop)
|
void AnimationLayer::animate(const std::string &a, int loop)
|
||||||
{
|
{
|
||||||
std::string animation = a;
|
std::string animation = a;
|
||||||
stringToLower(animation);
|
stringToLower(animation);
|
||||||
|
|
||||||
bool played = false;
|
bool played = false;
|
||||||
for (int i = 0; i < s->animations.size(); i++)
|
for (int i = 0; i < s->animations.size(); i++)
|
||||||
|
@ -456,7 +456,7 @@ void AnimationLayer::enqueueAnimation(const std::string& anim, int loop)
|
||||||
|
|
||||||
float AnimationLayer::transitionAnimate(std::string anim, float time, int loop)
|
float AnimationLayer::transitionAnimate(std::string anim, float time, int loop)
|
||||||
{
|
{
|
||||||
stringToLower(anim);
|
stringToLower(anim);
|
||||||
float totalTime =0;
|
float totalTime =0;
|
||||||
if (createTransitionAnimation(anim, time))
|
if (createTransitionAnimation(anim, time))
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
class BoneKeyframe
|
class BoneKeyframe
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {}
|
BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {}
|
||||||
int idx, x, y, rot;
|
int idx, x, y, rot;
|
||||||
float sx, sy;
|
float sx, sy;
|
||||||
bool doScale;
|
bool doScale;
|
||||||
|
|
|
@ -24,13 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
|
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
|
||||||
#include "FmodOpenALBridge.h"
|
#include "FmodOpenALBridge.h"
|
||||||
#else
|
#else
|
||||||
#include <fmod.h>
|
#include <fmod.h>
|
||||||
#include <fmod.hpp>
|
#include <fmod.hpp>
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
#pragma comment(lib, "fmodex_vc.lib")
|
#pragma comment(lib, "fmodex_vc.lib")
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ namespace SoundCore
|
||||||
struct FadeCh
|
struct FadeCh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FadeCh() : c(0), v(1), s(1), to(0), d(-1) {}
|
FadeCh() : c(0), v(1), s(1), to(0), d(-1) {}
|
||||||
FMOD::Channel *c;
|
FMOD::Channel *c;
|
||||||
float v,s,to;
|
float v,s,to;
|
||||||
int d;
|
int d;
|
||||||
|
@ -111,17 +111,17 @@ using namespace SoundCore;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TIPS:
|
TIPS:
|
||||||
|
|
||||||
1. use F_CALLBACK. Do NOT force cast your own function to fmod's callback type.
|
1. use F_CALLBACK. Do NOT force cast your own function to fmod's callback type.
|
||||||
2. return FMOD_ERR_FILE_NOTFOUND in open as required.
|
2. return FMOD_ERR_FILE_NOTFOUND in open as required.
|
||||||
3. return number of bytes read in read callback. Do not get the size and count
|
3. return number of bytes read in read callback. Do not get the size and count
|
||||||
around the wrong way in fread for example, this would return 1 instead of the number of bytes read.
|
around the wrong way in fread for example, this would return 1 instead of the number of bytes read.
|
||||||
|
|
||||||
QUESTIONS:
|
QUESTIONS:
|
||||||
|
|
||||||
1. Why does fmod seek to the end and read? Because it is looking for ID3V1 tags.
|
1. Why does fmod seek to the end and read? Because it is looking for ID3V1 tags.
|
||||||
Use FMOD_IGNORETAGS in System::createSound / System::createStream if you don't like this behaviour.
|
Use FMOD_IGNORETAGS in System::createSound / System::createStream if you don't like this behaviour.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -278,54 +278,54 @@ SoundManager::SoundManager(const std::string &defaultDevice)
|
||||||
|
|
||||||
int channels = 128;
|
int channels = 128;
|
||||||
|
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
FMOD_SPEAKERMODE speakermode;
|
FMOD_SPEAKERMODE speakermode;
|
||||||
FMOD_CAPS caps;
|
FMOD_CAPS caps;
|
||||||
|
|
||||||
debugLog("system::create");
|
debugLog("system::create");
|
||||||
result = FMOD::System_Create(&SoundCore::system);
|
result = FMOD::System_Create(&SoundCore::system);
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
debugLog("getVersion");
|
debugLog("getVersion");
|
||||||
result = SoundCore::system->getVersion(&version);
|
result = SoundCore::system->getVersion(&version);
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
if (version < FMOD_VERSION)
|
if (version < FMOD_VERSION)
|
||||||
{
|
{
|
||||||
char str[256];
|
char str[256];
|
||||||
sprintf(str, "Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
|
sprintf(str, "Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
|
||||||
debugLog(str);
|
debugLog(str);
|
||||||
goto get_out;
|
goto get_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog("driver caps");
|
debugLog("driver caps");
|
||||||
result = SoundCore::system->getDriverCaps(0, &caps, 0, 0, &speakermode);
|
result = SoundCore::system->getDriverCaps(0, &caps, 0, 0, &speakermode);
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
debugLog("set speaker mode");
|
debugLog("set speaker mode");
|
||||||
result = SoundCore::system->setSpeakerMode(speakermode); /* Set the user selected speaker mode. */
|
result = SoundCore::system->setSpeakerMode(speakermode); /* Set the user selected speaker mode. */
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
debugLog("check caps");
|
debugLog("check caps");
|
||||||
if (caps & FMOD_CAPS_HARDWARE_EMULATED) /* The user has the 'Acceleration' slider set to off! This is really bad for latency!. */
|
if (caps & FMOD_CAPS_HARDWARE_EMULATED) /* The user has the 'Acceleration' slider set to off! This is really bad for latency!. */
|
||||||
{ /* You might want to warn the user about this. */
|
{ /* You might want to warn the user about this. */
|
||||||
debugLog("acceleration slider is off");
|
debugLog("acceleration slider is off");
|
||||||
result = SoundCore::system->setDSPBufferSize(1024, 10); /* At 48khz, the latency between issuing an fmod command and hearing it will now be about 213ms. */
|
result = SoundCore::system->setDSPBufferSize(1024, 10); /* At 48khz, the latency between issuing an fmod command and hearing it will now be about 213ms. */
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog("init");
|
debugLog("init");
|
||||||
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* 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... */
|
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");
|
debugLog("err_output_createbuffer, speaker mode");
|
||||||
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
|
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
debugLog("init 2");
|
debugLog("init 2");
|
||||||
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* 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;
|
if (checkError()) goto get_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
|
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
|
||||||
SoundCore::system->getNumChannels(&channels);
|
SoundCore::system->getNumChannels(&channels);
|
||||||
|
@ -335,7 +335,7 @@ SoundManager::SoundManager(const std::string &defaultDevice)
|
||||||
|
|
||||||
debugLog("set file system");
|
debugLog("set file system");
|
||||||
result = SoundCore::system->setFileSystem(myopen, myclose, myread, myseek, 2048);
|
result = SoundCore::system->setFileSystem(myopen, myclose, myread, myseek, 2048);
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
debugLog("create channel group vox");
|
debugLog("create channel group vox");
|
||||||
result = SoundCore::system->createChannelGroup("vox", &group_vox);
|
result = SoundCore::system->createChannelGroup("vox", &group_vox);
|
||||||
|
@ -410,9 +410,9 @@ void SoundManager::toggleEffectMusic(SoundEffectType effect, bool on)
|
||||||
dspFlange->remove();
|
dspFlange->remove();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SFX_NONE:
|
case SFX_NONE:
|
||||||
case SFX_MAX:
|
case SFX_MAX:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,8 @@ enum SoundLoadType
|
||||||
|
|
||||||
struct PlaySfx
|
struct PlaySfx
|
||||||
{
|
{
|
||||||
PlaySfx() : handle(0), vol(1), time(0), freq(1), loops(0), priority(0.5),
|
PlaySfx() : handle(0), vol(1), time(0), freq(1), loops(0), priority(0.5),
|
||||||
maxdist(0), fade(SFT_NONE), x(0), y(0), relative(true), positional(false) {}
|
maxdist(0), fade(SFT_NONE), x(0), y(0), relative(true), positional(false) {}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
intptr_t handle;
|
intptr_t handle;
|
||||||
|
|
|
@ -230,7 +230,7 @@ bool Texture::load(std::string file)
|
||||||
|
|
||||||
size_t pos = file.find_last_of('.');
|
size_t pos = file.find_last_of('.');
|
||||||
|
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
// make sure this didn't catch the '.' in /home/username/.Aquaria/* --ryan.
|
// make sure this didn't catch the '.' in /home/username/.Aquaria/* --ryan.
|
||||||
const std::string userdata = core->getUserDataFolder();
|
const std::string userdata = core->getUserDataFolder();
|
||||||
|
@ -526,8 +526,8 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size)
|
||||||
// files are stored as BGR instead of RGB (or use GL_BGR_EXT verses GL_RGB)
|
// files are stored as BGR instead of RGB (or use GL_BGR_EXT verses GL_RGB)
|
||||||
for(i = 0; i < stride; i += channels)
|
for(i = 0; i < stride; i += channels)
|
||||||
{
|
{
|
||||||
int temp = pLine[i];
|
int temp = pLine[i];
|
||||||
pLine[i] = pLine[i + 2];
|
pLine[i] = pLine[i + 2];
|
||||||
pLine[i + 2] = temp;
|
pLine[i + 2] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -679,8 +679,8 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size)
|
||||||
|
|
||||||
// Fill in our tImageTGA structure to pass back
|
// Fill in our tImageTGA structure to pass back
|
||||||
pImageData->channels = channels;
|
pImageData->channels = channels;
|
||||||
pImageData->sizeX = width;
|
pImageData->sizeX = width;
|
||||||
pImageData->sizeY = height;
|
pImageData->sizeY = height;
|
||||||
|
|
||||||
// Return the TGA data (remember, you must free this data after you are done)
|
// Return the TGA data (remember, you must free this data after you are done)
|
||||||
return pImageData;
|
return pImageData;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue