1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 06:24:32 +00:00
This commit is contained in:
Dmitry Grigoryev 2021-01-02 01:50:48 +01:00
commit c6968454e6
1068 changed files with 155492 additions and 90661 deletions

1
.gitignore vendored
View file

@ -23,3 +23,4 @@ bin/*
*.diff
!.gitignore
!.travis.yml

52
.travis.yml Normal file
View file

@ -0,0 +1,52 @@
# http://docs.travis-ci.com/user/build-configuration/
language: cpp
sudo: false
compiler:
- gcc
- clang
os:
- linux
- osx
#matrix:
#branches:
# only:
# - master
addons:
apt:
packages:
- libopenal-dev
- libsdl-dev
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl openal-soft; fi
script:
# ALL THE BUILD COMMANDS HERE
- export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/usr/lib/x86_64-linux-gnu/"
- CMAKE_OPTIONS='-DCMAKE_PREFIX_PATH='"$CMAKE_PREFIX_PATH"' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DAQUARIA_INTERNAL_FREETYPE=OFF -DAQUARIA_INTERNAL_LUA=OFF -DAQUARIA_INTERNAL_OGGVORBIS=OFF -DAQUARIA_INTERNAL_OPENAL=OFF -DAQUARIA_INTERNAL_PNG=OFF -DAQUARIA_INTERNAL_SDL=OFF -DAQUARIA_INTERNAL_TINYXML2=OFF -DAQUARIA_INTERNAL_ZLIB=OFF'
- rm -rf cmake-build
- mkdir cmake-build
- cd cmake-build
- cmake $CMAKE_OPTIONS ..
- make -j 2
notifications:
irc:
channels:
- "irc.esper.net#bitblot"
skip_join: true
use_notice: true
on_success: change
template:
#- "[%{commit}: %{author}] %{message}"
#- "%{build_url}"
- "[%{repository_slug}#%{branch} @%{commit}] (%{author}): %{message}"
- "Diff: %{compare_url}"
- "Build: %{build_url}"

View file

@ -18,4 +18,3 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// moved

View file

@ -37,7 +37,6 @@ class TimelineRender : public RenderObject
{
void onRender()
{
#ifdef BBGE_BUILD_OPENGL
glLineWidth(1);
glBegin(GL_LINES);
glColor4f(1, 1, 1, 1);
@ -47,7 +46,6 @@ class TimelineRender : public RenderObject
glVertex3f(x, 5, 0);
}
glEnd();
#endif
}
};
@ -100,11 +98,7 @@ void KeyframeWidget::shiftRight()
void KeyframeWidget::onUpdate(float dt)
{
/*
if (this->key == ae->currentKey)
color = Vector(0.75, 0.75, 1);
else
*/
Quad::onUpdate(dt);
if (life != 1 || ae->editSprite->isAnimating()) return;
switch(ae->editSprite->getCurrentAnimation()->getKeyframe(this->key)->lerpType)
@ -139,7 +133,7 @@ void KeyframeWidget::onUpdate(float dt)
{
if (core->mouse.buttons.left)
{
//ae->selectionLocked = false;
movingWidget = this;
ae->currentKey = this->key;
}
@ -236,7 +230,7 @@ void AnimationEditor::applyState()
editSprite->cull = false;
editSprite->loadSkeletal(editingFile);
editSprite->position = Vector(400,300);
//editSprite->scale = Vector(0.5, 0.5);
addAction(MakeFunctionEvent(AnimationEditor, lmbu), ActionMapper::MOUSE_BUTTON_LEFT, 0);
addAction(MakeFunctionEvent(AnimationEditor, lmbd), ActionMapper::MOUSE_BUTTON_LEFT, 1);
@ -271,7 +265,7 @@ void AnimationEditor::applyState()
addAction(MakeFunctionEvent(AnimationEditor, undo), KEY_Z, 0);
addAction(MakeFunctionEvent(AnimationEditor, redo), KEY_Y, 0);
//addAction(MakeFunctionEvent(AnimationEditor, lockSelection), KEY_L, 0);
addAction(MakeFunctionEvent(AnimationEditor, cycleLerpType), KEY_L, 0);
addAction(MakeFunctionEvent(AnimationEditor, selectPrevBone), KEY_UP, 0);
@ -294,32 +288,12 @@ void AnimationEditor::applyState()
/*
addAction("mbl", KEY_A);
addAction("mbr", KEY_D);
addAction("mbu", KEY_W);
addAction("mbd", KEY_S);
*/
addAction(ACTION_SWIMLEFT, KEY_J);
addAction(ACTION_SWIMRIGHT, KEY_K);
addAction(ACTION_SWIMUP, KEY_UP);
addAction(ACTION_SWIMDOWN, KEY_DOWN);
/*
addAction(ACTION_BONELEFT, KEY_NUMPAD4);
addAction(ACTION_BONERIGHT, KEY_NUMPAD6);
addAction(ACTION_BONEUP, KEY_NUMPAD8);
addAction(ACTION_BONEDOWN, KEY_NUMPAD2);
*/
//addAction("", );
/*
addAction(MakeFunctionEvent(AnimationEditor, zoomOut), KEY_NUMPAD2, 0);
addAction(MakeFunctionEvent(AnimationEditor, zoomIn), KEY_NUMPAD8, 0);
*/
addRenderObject(editSprite, LR_ENTITIES);
@ -620,11 +594,11 @@ void AnimationEditor::rebuildKeyframeWidgets()
offx = keyframeWidgets[i]->offset.x;
}
keyframeWidgets.clear();
for (int i = 0; i < 1000; i++)
if (Animation *a = editSprite->getCurrentAnimation())
{
if (editSprite->getCurrentAnimation())
for (int i = 0; i < 1000; i++)
{
SkeletalKeyframe *key = editSprite->getCurrentAnimation()->getKeyframe(i);
SkeletalKeyframe *key = a->getKeyframe(i);
if (!key) break;
KeyframeWidget *k = new KeyframeWidget(i);
k->offset.x = offx;
@ -670,35 +644,9 @@ void AnimationEditor::moveBoneStripPoint(const Vector &mov)
b->strip[selectedStripPoint] = sel->changeStrip[selectedStripPoint] += mov*0.006f;
sel->setGridPoints(sel->stripVert, sel->strip);
/*
float sz = sel->getStripSegmentSize();
for (int i = selectedStripPoint; i > 0; i--)
{
Vector diff = sel->changeStrip[i] - sel->changeStrip[i-1];
if (!diff.isLength2DIn(sz))
{
diff.setLength2D(sz);
sel->changeStrip[i-1] = sel->changeStrip[i] - diff;
}
}
for (int i = selectedStripPoint; i < sel->changeStrip.size()-1; i++)
{
Vector diff = sel->changeStrip[i] - sel->changeStrip[i+1];
if (!diff.isLength2DIn(sz))
{
diff.setLength2D(sz);
sel->changeStrip[i+1] = sel->changeStrip[i] - diff;
}
}
b->strip = sel->changeStrip;
*/
//sel->setStrip(sel->changeStrip);
}
}
}
@ -710,7 +658,7 @@ void AnimationEditor::selectPrevBone()
if (editingStrip)
{
//moveBoneStripPoint(Vector(0, 1));
}
else
{
@ -724,7 +672,7 @@ void AnimationEditor::selectNextBone()
if (editingStrip)
{
//moveBoneStripPoint(Vector(0, -1));
}
else
{
@ -746,6 +694,8 @@ void AnimationEditor::update(float dt)
}
Vector ebdata;
int pass = 0;
int origpass = 0;
if (editingBone)
{
@ -753,17 +703,19 @@ void AnimationEditor::update(float dt)
ebdata.x = editingBone->position.x;
ebdata.y = editingBone->position.y;
ebdata.z = editingBone->rotation.z;
pass = editingBone->getRenderPass();
origpass = editingBone->originalRenderPass;
}
text->setText(os.str());
char t2buf[128];
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f strip: %d", ebdata.x, ebdata.y, ebdata.z, selectedStripPoint);
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f strip: %d pass: %d (%d)", ebdata.x, ebdata.y, ebdata.z, selectedStripPoint, pass, origpass);
text2->setText(t2buf);
if (core->mouse.buttons.middle)
{
editSprite->position += core->mouse.change;
//core->setMousePosition(Vector(400,300));
}
if (editingStrip)
@ -807,29 +759,7 @@ void AnimationEditor::update(float dt)
updateEditingBone();
if (editingBone)
{
/*
float amt = dt;
if (isActing("mbl"))
{
editingBone->position.x -= amt;
applyTranslation();
}
if (isActing("mbr"))
{
editingBone->position.x += amt;
applyTranslation();
}
if (isActing("mbu"))
{
editingBone->position.y -= amt;
applyTranslation();
}
if (isActing("mbd"))
{
editingBone->position.y += amt;
applyTranslation();
}
*/
}
}
if (editingBone && boneEdit == 1)
@ -1049,8 +979,8 @@ void AnimationEditor::lmbd()
{
pushUndo();
updateEditingBone();
if (editingBone /*&& (editSprite->position - core->mouse.position).isLength2DIn(400)*/
/*&& core->mouse.position.x > 200 && core->mouse.position.y < 560*/
if (editingBone
&& core->mouse.position.x > 400-200 && core->mouse.position.x < 400+200
&& core->mouse.position.y > 300-200 && core->mouse.position.y < 300+200
)
@ -1144,7 +1074,7 @@ void AnimationEditor::rmbd()
updateEditingBone();
if (editingBone)
{
//cursorOffset = editingBone->position + editSprite->position - core->mouse.position;
cursorOffset = core->mouse.position;
rotOffset = editingBone->rotation.z;
boneEdit = 2;
@ -1182,7 +1112,6 @@ void AnimationEditor::flipRot()
BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
if (bcur)
{
int rotdiff = editingBone->rotation.z - bcur->rot;
if (!core->getCtrlState())
{
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
@ -1303,8 +1232,8 @@ void AnimationEditor::rmbu()
void AnimationEditor::mmbd()
{
//editingBone = editSprite->getSelectedBone(ignoreBone);
//cloneBoneAhead();
}
void AnimationEditor::cloneBoneAhead()
@ -1425,8 +1354,8 @@ void AnimationEditor::loadSkin()
std::string file = dsq->getUserInputString("Enter skin file to load:");
if (file.empty()) return;
//this->editingFile = file;
//loadFile();
SkeletalSprite::clearCache();
editSprite->loadSkin(file);
}
@ -1449,7 +1378,7 @@ void AnimationEditor::moveNextWidgets(float dt)
s = 1;
}
}
}
void AnimationEditor::toggleRenderBorders()

View file

@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AquariaComboBox::AquariaComboBox(Vector textscale) : RenderObject()
{
//Quad *bar, *window, *scrollBtnUp, *scrollBtnDown, *scrollBar;
bar = new Quad("gui/combo-drop", Vector(0,0));
addChild(bar, PM_POINTER);
@ -120,7 +120,7 @@ void AquariaComboBox::onUpdate(float dt)
if (alpha.x < 1)
return;
//window->alpha.interpolateTo(1, 0.2);
if (enqueuedSelectItem != -1)
{
@ -375,7 +375,7 @@ void AquariaComboBoxItem::onUpdate(float dt)
{
color = selectedColor;
label->color = selectedColor;
//alphaMod = 1;
if (!mb && core->mouse.buttons.left)
{
mb = true;
@ -396,6 +396,6 @@ void AquariaComboBoxItem::onUpdate(float dt)
label->color = unselectedColor;
mb = false;
//alphaMod = 0.5;
}
}

View file

@ -5,14 +5,14 @@
// Define BBGE_SKIP_CONFIG_HEADERS to use CMake-only configuration.
#ifndef BBGE_SKIP_CONFIG_HEADERS
//#define AQUARIA_DEMO 1
#define AQUARIA_BUILD_CONSOLE 1
#define AQUARIA_BUILD_SCENEEDITOR 1
#define AQUARIA_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__)
#define AQUARIA_BUILD_CONSOLE 1
#define AQUARIA_BUILD_SCENEEDITOR 1
// 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_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__)
// If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen.
//#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.001"
#endif

View file

@ -77,7 +77,7 @@ void AquariaGuiElement::setCanDirMove(bool on)
void AquariaGuiElement::setFocus(bool v)
{
hasFocus = v;
if (v)
{
currentFocus = this;
@ -100,17 +100,11 @@ void AquariaGuiElement::setFocus(bool v)
void AquariaGuiElement::updateMovement(float dt)
{
//debugLog("in update movement");
if (hasFocus && isGuiVisible() && canDirMove && canDirMoveGlobal && hasInput())
{
//debugLog("has focus");
/*
if (alpha.x <= 0 || alphaMod <= 0)
{
setFocus(false);
return;
}
*/
if (guiMoveTimer > 0)
{
@ -162,14 +156,13 @@ void AquariaGuiElement::updateMovement(float dt)
if (gui)
{
gui->setFocus(true);
//this->setFocus(false);
guiMoveTimer = moveDelay;
}
}
if (!gui)
{
debugLog("updating closest");
@ -461,21 +454,12 @@ AquariaKeyConfig::AquariaKeyConfig(const std::string &actionInputName, InputSetT
bg->alphaMod = 0;
addChild(bg, PM_POINTER);
/*
label = new BitmapText(&dsq->smallFont);
label->setText("KeyConfig");
label->parentManagedPointer = 1;
label->position = Vector(0, -10);
label->scale = Vector(0.8, 0.8);
addChild(label);
*/
//keyConfigFont = new DebugFont(6, "keyConfig");
keyConfigFont = new TTFText(&dsq->fontArialSmallest);
keyConfigFont->setAlign(ALIGN_CENTER);
//keyConfigFont->position = Vector(0, -10);
addChild(keyConfigFont, PM_POINTER);
@ -523,16 +507,7 @@ void AquariaKeyConfig::toggleEnterKey(int on)
bg->alphaMod = 0.5;
bg->color = Vector(0.5, 0.5, 0.5);
}
/*
if (on)
{
label->scale = Vector(2, 2);
}
else
{
label->scale = Vector(1, 1);
}
*/
}
void AquariaKeyConfig::setLock(int lock)
@ -546,9 +521,7 @@ void AquariaKeyConfig::onUpdate(float dt)
if (inLoop) return;
AquariaGuiElement::updateMovement(dt);
@ -562,7 +535,7 @@ void AquariaKeyConfig::onUpdate(float dt)
int *k = 0;
ActionInput *ai = 0;
if (inputSetType != INPUTSET_OTHER)
{
ai = dsq->user.control.actionSet.getActionInputByName(actionInputName);
@ -640,15 +613,8 @@ void AquariaKeyConfig::onUpdate(float dt)
{
if (i != KEY_ESCAPE)
{
/*
if (i == KEY_DELETE || i == KEY_BACKSPACE)
else
{
*/
/*
if (i == KEY_0 || i == KEY_1 || i == KEY_2 || i == KEY_3 || i == KEY_4 || i == KEY_5 || i == KEY_6 || i == KEY_7
|| i == KEY_8 || i == KEY_9)
*/
if (i >= KEY_0 && i <= KEY_9)
{
*value = i-KEY_0;
@ -714,7 +680,7 @@ void AquariaKeyConfig::onUpdate(float dt)
if (dsq->game->getKeyState(i))
{
*k = i;
while (dsq->game->getKeyState(i))
{
dsq->main(0.1);
@ -729,6 +695,8 @@ void AquariaKeyConfig::onUpdate(float dt)
}
}
break;
case INPUTSET_NONE:
break;
}
}
@ -745,11 +713,11 @@ void AquariaKeyConfig::onUpdate(float dt)
}
if (!keyDown && (core->mouse.buttons.left || core->mouse.buttons.right/* || core->getKeyState(KEY_RETURN)*/))
if (!keyDown && (core->mouse.buttons.left || core->mouse.buttons.right))
{
keyDown = true;
}
else if (keyDown && (!core->mouse.buttons.left && !core->mouse.buttons.right /*&& !core->getKeyState(KEY_RETURN)*/))
else if (keyDown && (!core->mouse.buttons.left && !core->mouse.buttons.right ))
{
keyDown = false;
@ -805,18 +773,15 @@ AquariaMenuItem::AquariaMenuItem() : Quad(), ActionMapper(), AquariaGuiElement()
glowFont->position = Vector(0, -sz/2, 0);
glowFont->setBlendType(BLEND_ADD);
glowFont->alpha = 0;
//glowFont->scale.interpolateTo(Vector(1.1,1.1), 0.5, -1, 1, 1);
addChild(glowFont, PM_POINTER, RBP_OFF);
//setTexture("bubble");
//this->shareAlphaWithChildren = true;
width = 0;
height = 0;
highlighted = false;
/*
width = 256;
height = 64;
*/
cull = false;
followCamera = 1;
addAction(MakeFunctionEvent(AquariaMenuItem, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0);
@ -887,10 +852,9 @@ void AquariaMenuItem::onClick()
dsq->playMenuSelectSfx();
event.call();
//glowFont->scale.interpolateTo(Vector(4,4), 0.5, 1, 1);
//glowFont->alpha.interpolateTo(0, 0.5);
//scale.interpolateTo(Vector(4, 4), 3);
}
}
@ -899,7 +863,7 @@ void AquariaMenuItem::setLabel(const std::string &label)
font->setText(label);
glowFont->setText(label);
}
void AquariaMenuItem::toggleHighlight(bool state)
{
highlighted = state;
@ -913,7 +877,7 @@ void AquariaMenuItem::toggleHighlight(bool state)
{
glowFont->alpha.interpolateTo(0.3, 0.2);
}
//scale.interpolateTo(Vector(1.1, 1.1), 0.2);
}
else
{
@ -922,11 +886,11 @@ void AquariaMenuItem::toggleHighlight(bool state)
else
glowFont->alpha.interpolateTo(0, 0.2);
}
//scale.interpolateTo(Vector(1,1), 0.2);
}
void AquariaMenuItem::onUpdate(float dt)
{
{
AquariaGuiElement::updateMovement(dt);
if (font)
@ -951,16 +915,13 @@ void AquariaMenuItem::onUpdate(float dt)
quad->alpha.x = alpha.x;
}
/*
font->position = this->position;
font->alpha = this->alpha;
*/
if (hasInput())
{
if (alpha.x == 1)
{
bool on = true;
if (isCursorInMenuItem())
{
@ -969,9 +930,9 @@ void AquariaMenuItem::onUpdate(float dt)
}
else
on = false;
if (!on && highlighted)
toggleHighlight(false);
toggleHighlight(false);
}
else
{

View file

@ -84,7 +84,7 @@ public:
bool useQuad(const std::string &tex);
void useGlow(const std::string &tex, int w, int h);
void useSound(const std::string &tex);
virtual bool isCursorInMenuItem();
Vector getGuiPosition();
bool isGuiVisible();
@ -120,7 +120,7 @@ protected:
bool selected;
static bool closed;
bool done;
int slotIndex;
bool empty;
Quad *gfx;
@ -168,9 +168,9 @@ public:
bool isGuiVisible();
static AquariaKeyConfig *waitingForInput;
void setLock(int lock);
protected:
int locked;
void toggleEnterKey(int on);
@ -179,13 +179,13 @@ protected:
bool keyDown;
std::string actionInputName;
InputSetType inputSetType;
int inputIdx;
//BitmapText *label;
//DebugFont *keyConfigFont;
TTFText *keyConfigFont;
Quad *bg;
};
@ -247,18 +247,6 @@ protected:
std::vector<AquariaComboBoxItem*> shownItems;
};
/*
class SelectionList : public RenderObject
{
public:
SelectionList(std::string file, std::string font, int items);
void reload();
virtual void onSelect(int idx){}
protected:
void load();
std::vector<std::string> list;
};
*/
#endif

View file

@ -37,12 +37,8 @@ AquariaSaveSlot::AquariaSaveSlot(int slot) : AquariaGuiQuad()
box->setWidthHeight(450, 96);
box->alphaMod = 0;
addChild(box, PM_POINTER);
//setTexture("dialogue-bg");
//setTexture("HintBox");
//renderQuad = false;
//shareAlphaWithChildren = 1;
text1 = new BitmapText(&dsq->smallFont);
text1->setFontSize(14);
@ -65,12 +61,7 @@ AquariaSaveSlot::AquariaSaveSlot(int slot) : AquariaGuiQuad()
if (description.length() > 0)
{
std::ostringstream os;
os << dsq->continuity.stringBank.get(2002) << " ";
if (dsq->isDeveloperKeys())
os << slot;
else
os << (slot+1);
os << " - " << description;
os << dsq->continuity.stringBank.get(2002) << " " << (slot+1) << " - " << description;
text1->setText(os.str());
glowText->setText(os.str());
@ -127,7 +118,7 @@ AquariaSaveSlot::AquariaSaveSlot(int slot) : AquariaGuiQuad()
core->resetTimer();
screen->upperLeftTextureCoordinates = Vector(0, 1);
screen->lowerRightTextureCoordinates = Vector(1, 0.25);
//screen->scale = Vector(0.4, 0.3);
if (screen->getWidth() == 0)
screen->color = 0;
@ -136,7 +127,7 @@ AquariaSaveSlot::AquariaSaveSlot(int slot) : AquariaGuiQuad()
screen->position = Vector(-250, 0) + Vector(-1.5, -1.6);
addChild(screen, PM_POINTER);
closed = false;
closed = false;
selected = false;
}
@ -152,7 +143,7 @@ void AquariaSaveSlot::hide()
glowText->alpha.interpolateTo(0, 0.5);
box->alpha.interpolateTo(0, 0.5);
if (!selected)
{
{
screen->alpha.interpolateTo(0, 0.5);
}
}
@ -160,12 +151,12 @@ void AquariaSaveSlot::hide()
void AquariaSaveSlot::close(bool trans)
{
done = true;
if (trans)
{
screen->alpha.interpolateTo(0, 0.1);
text1->alpha.interpolateTo(0, 0.1);
setLife(1);
setDecayRate(10);
fadeAlphaWithLife = 1;
@ -176,7 +167,7 @@ void AquariaSaveSlot::close(bool trans)
setDecayRate(2);
fadeAlphaWithLife = 1;
}
//shareAlphaWithChildren = 1;
}
void AquariaSaveSlot::transition()
@ -209,10 +200,10 @@ void AquariaSaveSlot::onUpdate(float dt)
if (core->mouse.position.x < position.x + 150 && core->mouse.position.x > position.x - 300
&& core->mouse.position.y < position.y+32 && core->mouse.position.y > position.y-32)
{
//setBlendType(BLEND_ADD);
glowText->alpha.interpolateTo(0.5, 0.2);
screen->color.interpolateTo(Vector(1,1,1), 0.1);
//screen->scale.interpolateTo(Vector(1.2, 1.2), 0.2);
if ((core->mouse.buttons.left || core->mouse.buttons.right) && !mbDown)
{
mbDown = true;
@ -223,22 +214,22 @@ void AquariaSaveSlot::onUpdate(float dt)
if (!(empty && dsq->saveSlotMode == SSM_LOAD))
{
selected = true;
// pick this file
dsq->playMenuSelectSfx();
dsq->playMenuSelectSfx();
closed = true;
if (dsq->saveSlotMode == SSM_LOAD)
{
//dsq->clearSaveSlots();
dsq->hideSaveSlots();
this->moveToFront();
//screen->enableMotionBlur(10, 5);
screen->position.interpolateTo(Vector(400-position.x, 300-position.y), 1.0, 0, 0, 1);
dsq->tfader->alpha.interpolateTo(1, 1);
dsq->toggleCursor(false);
core->main(1);
//core->main(2);
}
bool didIt = dsq->onPickedSaveSlot(this);
@ -246,10 +237,9 @@ void AquariaSaveSlot::onUpdate(float dt)
if (didIt)
{
done = true;
//alpha = 0.9;
//setBlendType(BLEND_DEFAULT);
//glowText->alpha.interpolateTo(0, 0.2);
return;
}
else
@ -263,7 +253,7 @@ void AquariaSaveSlot::onUpdate(float dt)
else
{
glowText->alpha.interpolateTo(0, 0.2);
//screen->scale.interpolateTo(Vector(1, 1), 0.2);
screen->color.interpolateTo(Vector(0.7, 0.7, 1), 0.3);
}
if ((core->mouse.buttons.left || core->mouse.buttons.right) && !mbDown)
@ -282,36 +272,8 @@ void AquariaSaveSlot::onUpdate(float dt)
}
}
std::string AquariaSaveSlot::getSaveDescription(const XMLDocument &doc)
static std::string getPrettySceneName_internal(const XMLElement *startData)
{
const XMLElement *startData = doc.FirstChildElement("StartData");
if (!startData)
return "";
int hours, minutes, seconds;
hours = minutes = seconds = 0;
int exp = 0, money = 0, time = 0;
if (startData->Attribute("exp"))
exp = atoi(startData->Attribute("exp"));
if (startData->Attribute("money"))
money = atoi(startData->Attribute("money"));
if (startData->Attribute("seconds"))
{
std::istringstream is(startData->Attribute("seconds"));
is >> time;
}
float s = dsq->continuity.seconds;
dsq->continuity.seconds = time;
dsq->continuity.getHoursMinutesSeconds(&hours, &minutes, &seconds);
/*
std::ostringstream os;
os << "Slot: " << slot << " - " << startData->Attribute("scene") << " - exp: " << exp << " - wealth: " << money;
os << " Time: " << hours << ": " << minutes << ": " << seconds << " T: " << time;
*/
std::string location = startData->Attribute("scene");
stringToLower(location);
if (location.find("boilerroom")!=std::string::npos)
@ -415,6 +377,31 @@ std::string AquariaSaveSlot::getSaveDescription(const XMLDocument &doc)
{
location = dsq->continuity.stringBank.get(1029);
}
return location;
}
std::string AquariaSaveSlot::getSaveDescription(const XMLDocument &doc)
{
const XMLElement *startData = doc.FirstChildElement("StartData");
if (!startData)
return "";
int hours, minutes, seconds;
hours = minutes = seconds = 0;
int time = 0;
if (startData->Attribute("seconds"))
{
std::istringstream is(startData->Attribute("seconds"));
is >> time;
}
float s = dsq->continuity.seconds;
dsq->continuity.seconds = time;
dsq->continuity.getHoursMinutesSeconds(&hours, &minutes, &seconds);
const char *loccstr = startData->Attribute("sceneDisplayName");
std::string location = (loccstr && *loccstr) ? loccstr : getPrettySceneName_internal(startData);
std::string showLoc;
if (dsq->isDeveloperKeys())
@ -424,8 +411,8 @@ std::string AquariaSaveSlot::getSaveDescription(const XMLDocument &doc)
std::ostringstream os;
os << location << std::endl;
os << hours << ":" << numToZeroString(minutes, 2) << showLoc;
// << ": " << seconds;
//" T: " << time;
dsq->continuity.seconds = s;

View file

@ -25,11 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AUTOMAP_GRIDTILE 512
//#define FOR(ir,mx) for (int ir=0;ir<mx;ir++)
AutoMap::AutoMap() : RenderObject(), ActionMapper()
{
//texture = 0;
followCamera = 1;
scale = Vector(0.4, 0.4);
position = Vector(400,300);
@ -41,7 +41,7 @@ AutoMap::AutoMap() : RenderObject(), ActionMapper()
initedGrid = false;
//shadowTex = core->addTexture("particles/glow");
setTexture("particles/glow");
paintColor = Vector(1,1,1);
@ -52,17 +52,7 @@ AutoMap::AutoMap() : RenderObject(), ActionMapper()
shadowTex = 0;
}
/*
void AutoMap::create(const std::string &startMap)
{
bool done = false;
while (!done)
{
dsq->game->smallLoadXML("NAIJACAVE");
}
}
*/
void AutoMap::destroy()
{
@ -84,7 +74,7 @@ void AutoMap::toggle(bool on)
{
const float t = 0.2;
if (on)
{
{
autoMapMode = 0;
dsq->game->togglePause(true);
dsq->fade(1, t);
@ -93,50 +83,17 @@ void AutoMap::toggle(bool on)
core->overrideEndLayer = LR_MAX;
vis = true;
/*
for (Children::iterator i = children.begin(); i != children.end(); i++)
{
(*i)->safeKill();
}
Vector c(dsq->game->cameraMax.x/2, dsq->game->cameraMax.y/2);
int drawsz = AUTOMAP_GRIDTILE/TILE_SIZE;
int hsz = drawsz*0.5f;
c *= AUTOMAP_GRIDTILE;
c /= TILE_SIZE;
c += Vector(hsz, hsz);
FOR(x,MAX_AUTOMAP_GRID)
{
FOR(y,MAX_AUTOMAP_GRID)
{
if (grid[x][y])
{
Quad *q = new Quad;
q->setTexture("particles/WhiteGlow");
float rx = float(x * AUTOMAP_GRIDTILE)/float(TILE_SIZE) + hsz - c.x;
float ry = float(y * AUTOMAP_GRIDTILE)/float(TILE_SIZE) + hsz - c.y;
q->position = Vector(rx, ry);
q->color = Vector(0,0,0);
addChild(q);
}
}
}
*/
//alpha.interpolateTo(1, 0.5);
alpha = 1;
dsq->fade(0, t);
dsq->main(t);
dsq->main(t);
}
else
{
dsq->fade(1, t);
dsq->main(t);
dsq->main(t);
core->overrideStartLayer = 0;
core->overrideEndLayer = 0;
@ -161,7 +118,7 @@ void AutoMap::setGridFromWorld(Vector worldPos, int gridValue)
os << "AutoMap::setGridFromWorld - exceeded grid size";
os << "(" << gx <<", " << gy << ")";
debugLog(os.str());
return;
return;
}
grid[gx][gy] = gridValue;
@ -169,11 +126,8 @@ void AutoMap::setGridFromWorld(Vector worldPos, int gridValue)
void AutoMap::initGrid()
{
/*
int xsz = dsq->game->cameraMax.x/200;
int ysz = dsq->game->cameraMax.y/200;
*/
//std::vector<std::vector> grid
for (int x=0;x<MAX_AUTOMAP_GRID;x++)
{
for (int y=0;y<MAX_AUTOMAP_GRID;y++)
@ -205,45 +159,21 @@ void AutoMap::onUpdate(float dt)
initGrid();
}
if (dsq->game->avatar)
{
setGridFromWorld(dsq->game->avatar->position, 0);
}
if (vis && alpha.x == 1)
{
const float maxScale=1.25, minScale=0.5;
blip.update(dt);
/*
static Vector lastHeldPos;
if (core->mouse.buttons.left)
{
if (!lastHeldPos.isZero() && !(core->mouse.position - lastHeldPos).isLength2DIn(32))
{
Vector diff = core->mouse.position - lastHeldPos;
int len = diff.getLength2D();
for (int i = 0; i < len; i+=8)
{
paint(lastHeldPos + diff * i);
}
}
else
{
paint(core->mouse.position);
}
lastHeldPos = core->mouse.position;
}
else
{
lastHeldPos = Vector(0,0);
}
*/
//bool c=false;
Vector sTarget=scale;
Vector sTarget=scale;
float spd = 0.5;
if (core->mouse.scrollWheelChange < 0)
{
@ -261,7 +191,7 @@ void AutoMap::onUpdate(float dt)
{
offset += core->mouse.change*scale;
}
//scale.interpolateTo(sTarget, 0.1);
}
}
@ -275,39 +205,31 @@ void AutoMap::lmb()
void AutoMap::onRender()
{
// if (!doRender) return;
if (alpha.x == 0) return;
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0;
float alphaValue = alpha.x;
//int sz2 = 80;//80;
int ysz = dsq->game->cameraMax.y/TILE_SIZE;
int xsz = dsq->game->cameraMax.x/TILE_SIZE;
//TileVector t(dsq->game->avatar->position);
TileVector t(Vector(dsq->game->cameraMax.x/2, dsq->game->cameraMax.y/2));
int skip = 4;
glLineWidth(skip);
if (alphaValue > 0)
{
/*
if (core->getWindowHeight() == 600)
{
skip = 2;
}
*/
//for (int y = t.y-sz2; y < t.y+sz2; y+=skip)
for (int y = 0; y < ysz; y += skip)
{
float f = float(y)/float(ysz);
@ -317,12 +239,12 @@ void AutoMap::onRender()
glBegin(GL_LINES);
int rowStart = -1;
int x = 0;
//for (x = t.x-sz2; x < t.x+sz2; x++)
for (x = 0; x < xsz; x++)
{
if (dsq->game->getGrid(TileVector(x,y))!=OT_BLACK)
{
if (rowStart == -1)
if (rowStart == -1)
{
rowStart = x;
}
@ -345,45 +267,8 @@ void AutoMap::onRender()
glEnd();
}
/*
glColor4f(0,0,0,alphaValue);
glPointSize(8);
//shadowTex->apply();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
int rx=0,ry=0;
int sz = (AUTOMAP_GRIDTILE/TILE_SIZE)*0.5f;
for (int x = 0; x < MAX_AUTOMAP_GRID; x++)
{
for (int y = 0; y < MAX_AUTOMAP_GRID; y++)
{
if (grid[x][y])
{
rx = float(x * AUTOMAP_GRIDTILE)/float(TILE_SIZE) + TILE_SIZE/2 - t.x;
ry = float(y * AUTOMAP_GRIDTILE)/float(TILE_SIZE) + TILE_SIZE/2 - t.y;
//glVertex2f(rx, ry);
glTexCoord2f(0, 1.0);
glVertex3f(rx-sz, ry+sz, 0.0f);
glTexCoord2f(0, 1.0);
glVertex3f(rx+sz, ry+sz, 0.0f);
glTexCoord2f(1, 0);
glVertex3f(rx+sz, ry-sz, 0.0f);
glTexCoord2f(1, 0);
glVertex3f(rx-sz, ry-sz, 0.0f);
}
}
}
glEnd();
*/
/*
shadowTex->unbind();
glDisable(GL_TEXTURE_2D);
*/
//glDisable(GL_TEXTURE_2D);
}
TileVector nt(dsq->game->avatar->position);
@ -399,7 +284,6 @@ void AutoMap::onRender()
glColor4f(0.5,0.75,1, alphaValue*0.5f);
drawCircle(blip.x*16, 8);
#endif
}

View file

@ -26,23 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Shot.h"
#include "GridRender.h"
//#include "CommonEvents.h"
//#include <float.h>
//#define AQ_TEST_QUADTRAIL
#ifdef AQ_TEST_QUADTRAIL
#include "QuadTrail.h"
QuadTrail *quadTrail = 0;
#endif
Path *lastWaterBubble = 0;
bool lastJumpOutFromWaterBubble = false;
bool useSpiritDistance = true;
bool inSpiritWorld = false;
const float MULT_DMG_CRABCOSTUME = 0.75;
const float MULT_DMG_FISHFORM = 1.5;
@ -71,7 +54,7 @@ int SongIcon::notesOpen = 0;
Avatar *avatar = 0;
const Vector BLIND_COLOR = Vector(0.1, 0.1, 0.1);
const float ANIM_TRANSITION = 0.2;
const float MANA_RECHARGE_RATE = 1.0;
//const float MANA_RECHARGE_RATE = 1.0;
const int AURA_SHIELD_RADIUS = 64;
//const int TARGET_RANGE = 1024;
const int TARGET_RANGE = 1024; // 650
@ -86,7 +69,7 @@ const int BURST_DISTANCE = 200;
const int STOP_DISTANCE = 48;
const int maxMouse = BURST_DISTANCE;
//const int SHOCK_RANGE = 700;
const int SHOCK_RANGE = 1000;
//const int SHOCK_RANGE = 1000;
const int SPIRIT_RANGE = 2000;
const float QUICK_SONG_CAST_DELAY = 0.4;
@ -98,9 +81,9 @@ const float BURST_ACCEL = 4000; //2000 // 1000
// Minimum time between two splash effects (seconds).
const float SPLASH_INTERVAL = 0.2;
const float TUMMY_TIME = 6.0;
//const float TUMMY_TIME = 6.0;
const float chargeMax = 2.0;
//const float chargeMax = 2.0;
// Axis input distance (0.0-1.0) at which we start moving.
const float JOYSTICK_LOW_THRESHOLD = 0.2;
@ -127,16 +110,6 @@ const float COLLIDE_MOD_FISH = 0.1f;
const int requiredDualFormCharge = 3;
bool usingDigital = false;
Bone *bone_head = 0;
Bone *bone_dualFormGlow = 0;
bool _isUnderWater;
//HRECORD avatarRecord = 0;
Vector Target::getWorldPosition()
{
@ -181,7 +154,7 @@ void Avatar::bindInput()
dsq->user.control.actionSet.importAction(this, "SongSlot8", ACTION_SONGSLOT8);
dsq->user.control.actionSet.importAction(this, "SongSlot9", ACTION_SONGSLOT9);
dsq->user.control.actionSet.importAction(this, "SongSlot10", ACTION_SONGSLOT10);
dsq->user.control.actionSet.importAction(this, "Look", ACTION_LOOK);
/*
@ -190,7 +163,7 @@ void Avatar::bindInput()
dsq->user.control.actionSet.importAction(this, "SongSlot7", "f7");
dsq->user.control.actionSet.importAction(this, "SongSlot8", "f8");
*/
dsq->user.control.actionSet.importAction(this, "Roll", ACTION_ROLL);
/*
@ -207,11 +180,6 @@ void Avatar::bindInput()
}
int Avatar::getNotesOpen()
{
return SongIcon::notesOpen;
}
// note: z is set to 1.0 when we want the aim to be used as the shot direction
// otherwise the shot will head straight to the target
Vector Avatar::getAim()
@ -254,36 +222,11 @@ Vector Avatar::getForwardAim()
return aim;
}
void Avatar::postInit()
{
// post init isn't early enough
/*
Entity::postInit();
*/
}
void Avatar::onAnimationKeyPassed(int key)
{
Entity::onAnimationKeyPassed(key);
}
void Avatar::doBounce()
{
float ba = 0.75;
if (isRolling())
ba = 1.0;
float len = vel.getLength2D();
Vector I = vel/len;
Vector N = dsq->game->getWallNormal(position);
if (!N.isZero())
{
//2*(-I dot N)*N + I
vel = 2*(-I.dot(N))*N + I;
vel.setLength2D(len*ba);
}
}
Vector randCirclePos(Vector position, int radius)
{
float a = ((rand()%360)*(2*PI))/360.0f;
@ -919,6 +862,16 @@ std::string Avatar::getIdleAnimName()
case FORM_ENERGY:
ret="energyidle";
break;
case FORM_NORMAL:
case FORM_BEAST:
case FORM_NATURE:
case FORM_SPIRIT:
case FORM_DUAL:
case FORM_FISH:
case FORM_SUN:
case FORM_MAX:
case FORM_NONE:
break;
}
return ret;
}
@ -1006,11 +959,12 @@ void Avatar::updateHair(float dt)
void Avatar::updateDamageVisualEffects()
{
int damageThreshold = float(maxHealth/5.0f)*3.0f;
Quad *damageSprite = dsq->game->damageSprite;
if (health <= damageThreshold)
{
//dsq->game->damageSprite->alpha.interpolateTo(0.9, 0.5);
float a = ((damageThreshold - health)/float(damageThreshold))*1.0f;
dsq->game->damageSprite->alpha.interpolateTo(a, 0.3);
damageSprite->alpha.interpolateTo(a, 0.3);
/*
std::ostringstream os;
@ -1018,8 +972,11 @@ void Avatar::updateDamageVisualEffects()
debugLog(os.str());
*/
dsq->game->damageSprite->scale = Vector(1,1);
dsq->game->damageSprite->scale.interpolateTo(Vector(1.2, 1.2), 0.5, -1, 1);
if(!damageSprite->scale.isInterpolating())
{
damageSprite->scale = Vector(1,1);
damageSprite->scale.interpolateTo(Vector(1.2, 1.2), 0.5, -1, 1);
}
/*
if (health <= 0)
@ -1030,7 +987,7 @@ void Avatar::updateDamageVisualEffects()
}
else
{
dsq->game->damageSprite->alpha.interpolateTo(0, 0.3);
damageSprite->alpha.interpolateTo(0, 0.3);
}
}
@ -1136,7 +1093,7 @@ void Avatar::onDamage(DamageData &d)
core->sound->playSfx("Poison");
else
core->sound->playSfx("Pain");
setHeadTexture("Pain", 1);
@ -1196,7 +1153,7 @@ void Avatar::onDamage(DamageData &d)
dsq->emote.playSfx(EMOTE_NAIJALOW);
dsq->game->hasPlayedLow = 1;
}
dsq->gameSpeed.ensureData();
dsq->gameSpeed.data->path.clear();
@ -1235,54 +1192,9 @@ void Avatar::playHitSound()
core->sound->playSfx(os.str());
}
const int beatHealth = 3;
void Avatar::updateHeartbeatSfx(float t)
{
/*
if (heartbeat)
{
BASS_CHANNELINFO info;
BASS_ChannelGetInfo(heartbeat, &info);
int num = (beatHealth - health);
float wantFreq = 1000 + num*300;
float useFreq = ((wantFreq*info.freq)/1000.0f);
float vol = 75 + (num*25)*0.5f;
vol *= (core->sound->getUseSfxVol()/100.0f);
//int vol = 100;
BASS_ChannelSlideAttributes(heartbeat, useFreq, vol, -101, 1000.0f*t);
}
*/
}
void Avatar::onHealthChange(float change)
{
updateDamageVisualEffects();
if (health <= beatHealth && health > 0)
{
/*
if (!heartbeat)
{
//debugLog("starting heartbeat");
heartbeat = core->sound->playSfx("Heartbeat", 255, 0, 1000, 1);
//core->sound->playSfx("Heartbeat");
}
*/
updateHeartbeatSfx(0.5);
}
if (health > beatHealth)
{
/*
if (heartbeat)
{
//debugLog("stopping heartbeat");
BASS_CHANNELINFO info;
BASS_ChannelGetInfo(heartbeat, &info);
BASS_ChannelSlideAttributes(heartbeat, info.freq, -2, -101, 1000*2);
heartbeat = 0;
}
*/
}
}
void Avatar::revive()
@ -1330,6 +1242,10 @@ void Avatar::entityDied(Entity *e)
dsq->continuity.eatBeast(e->eatData);
}
break;
case EAT_DEFAULT:
case EAT_MAX:
case EAT_NONE:
break;
}
}
@ -1457,7 +1373,6 @@ void Avatar::closeSingingInterface()
if (singing)
{
core->setMouseConstraint(false);
usingDigital = false;
quickSongCastDelay = 1;
// HACK: this prevents being "locked" away from the seahorse... so naija can
@ -1681,6 +1596,9 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
case FORM_DUAL:
core->sound->playSfx("DualForm");
break;
case FORM_NONE:
case FORM_MAX:
break;
}
/*
@ -1730,7 +1648,7 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
refreshModel("FishForm", "");
//rotationOffset.interpolateTo(Vector(0,0,-90), 0.5);
//refreshModel("NaijaFish", "");
collideRadius = COLLIDE_RADIUS_FISH;
setCanLockToWall(false);
setCollisionAvoidanceData(COLLIDE_RANGE_FISH, COLLIDE_MOD_FISH);
@ -1790,8 +1708,6 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
{
skeletalSprite.alphaMod = 0;
canChangeForm = false;
useSpiritDistance = false;
inSpiritWorld = true;
}
/*
if (hair)
@ -1825,15 +1741,9 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
//}
}
int Avatar::getLastNote()
{
return lastNote;
}
void Avatar::singNote(int note)
{
currentSong.notes.push_back(note);
lastNote = note;
}
void Avatar::updateSingingInterface(float dt)
@ -2069,7 +1979,7 @@ void Avatar::updateTargets(float dt, bool override)
// crappy hack for now, assuming one target:
targets.clear();
Vector dir = getAim();
Vector checkPos = position + dir;
Vector distPos = position;
@ -2090,7 +2000,7 @@ void Avatar::updateTargets(float dt, bool override)
if (!override && core->mouse.buttons.right)
{
maxTargetDelay = 90;
dsq->spawnParticleEffect("TargetAquired", t.pos);
wasDown = true;
}
@ -2138,20 +2048,6 @@ void Avatar::updateTargets(float dt, bool override)
}
}
void Avatar::loseTargets()
{
for (int i = 0; i < targets.size(); i++)
{
Entity *e = targets[i].e;
if (e)
{
lostTarget(i, targets[i].e);
targets[i].e = 0;
targetUpdateDelay = maxTargetDelay;
}
}
}
void Avatar::updateTargetQuads(float dt)
{
@ -2161,7 +2057,7 @@ void Avatar::updateTargetQuads(float dt)
/*
for (int i = 0; i < targetQuads.size(); i++)
{
}
*/
@ -2217,7 +2113,7 @@ void Avatar::updateTargetQuads(float dt)
//targetQuads[i]->position.interpolateTo(dsq->getGameCursorPosition(),tt);
/*
std::ostringstream os;
os << "setting targetQuads[i] to game cursor, is running = " << targetQuads[i]->isRunning();
os << "setting targetQuads[i] to game cursor, is running = " << targetQuads[i]->isRunning();
debugLog(os.str());
*/
@ -2259,7 +2155,8 @@ bool Avatar::fireAtNearestValidEntity(const std::string &shot)
Vector dir;
Vector p = position;
p = boneLeftArm->getWorldPosition();
if(boneLeftArm)
p = boneLeftArm->getWorldPosition();
//&& !dsq->game->isObstructed(TileVector(position))
/*
if (dsq->inputMode == INPUT_MOUSE && state.lockedToWall )
@ -2402,7 +2299,7 @@ bool Avatar::fireAtNearestValidEntity(const std::string &shot)
{
checkUpgradeForShot(s);
skeletalSprite.transitionAnimate("fireBlast", 0.1, 0, ANIMLAYER_ARMOVERRIDE);
s->position = p;
@ -2424,18 +2321,6 @@ bool Avatar::fireAtNearestValidEntity(const std::string &shot)
return firedShot;
}
Vector Avatar::getFacing()
{
if (vel.isLength2DIn(2) && rotation.z == 0)
{
if (isfh())
return Vector(1,0);
else
return Vector(-1,0);
}
return getForward();
}
void Avatar::switchDualFormMode()
{
//debugLog("dualForm: changing");
@ -2495,9 +2380,9 @@ void Avatar::formAbility(int ability)
{
if (dsq->continuity.dualFormMode == Continuity::DUALFORM_NAIJA)
{
// ~~~~~~~~~~ SOUL SCREAM
if (chargeLevelAttained == 1)
{
if (dsq->continuity.dualFormCharge >= requiredDualFormCharge)
@ -2940,8 +2825,7 @@ void Avatar::formAbility(int ability)
Path *p = dsq->game->getNearestPath(position, PATH_SPIRITPORTAL);
if (p && p->isCoordinateInside(position))
{
if (inSpiritWorld)
changeForm(FORM_NORMAL);
changeForm(FORM_NORMAL);
dsq->game->warpToSceneFromNode(p);
}
}
@ -2952,6 +2836,10 @@ void Avatar::formAbility(int ability)
}
break;
case FORM_NORMAL:
case FORM_NONE:
case FORM_MAX:
break;
}
}
@ -2994,7 +2882,7 @@ int Avatar::getNumShots()
void Avatar::doShock(const std::string &shotName)
{
int c = 0;
//int maxHit = 2 + dsq->continuity.getSpellLevel(SPELL_SHOCK)*2;
@ -3075,7 +2963,6 @@ void Avatar::doShock(const std::string &shotName)
if (sz == 0)
{
for (int i = 0; i < thits; i++)
@ -3113,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;
Vector aim(sinf(a), cosf(a));
@ -3169,9 +3056,15 @@ void Avatar::formAbilityUpdate(float dt)
}
break;
case FORM_ENERGY:
{
}
break;
case FORM_NORMAL:
case FORM_BEAST:
case FORM_NATURE:
case FORM_SPIRIT:
case FORM_DUAL:
case FORM_SUN:
case FORM_MAX:
case FORM_NONE:
break;
}
}
@ -3263,6 +3156,12 @@ bool Avatar::canCharge(int ability)
case FORM_SUN:
return true;
break;
case FORM_NORMAL:
case FORM_SPIRIT:
case FORM_FISH:
case FORM_MAX:
case FORM_NONE:
break;
}
return false;
}
@ -3442,15 +3341,6 @@ Vector Avatar::getWallNormal(TileVector t)
return dsq->game->getWallNormal(t.worldVector(), 5)*-1;
}
int Avatar::getSingingInterfaceRadius()
{
return singingInterfaceRadius;
}
int Avatar::getOpenSingingInterfaceRadius()
{
return openSingingInterfaceRadius;
}
bool Avatar::isSwimming()
{
@ -3577,7 +3467,7 @@ void Avatar::lockToWall()
{
if (!dsq->mod.isActive() && !dsq->continuity.getFlag("lockedToWall"))
{
if (!dsq->game->isControlHint()){
dsq->continuity.setFlag("lockedToWall", 1);
dsq->game->setControlHint(dsq->continuity.stringBank.get(13), 1, 0, 0, 6, "", true);
@ -3783,20 +3673,24 @@ void Avatar::clearWeb()
Avatar::Avatar() : Entity(), ActionMapper()
{
canDie = true;
urchinDelay = 0;
jellyDelay = 0;
#ifdef AQ_TEST_QUADTRAIL
quadTrail = new QuadTrail(100, 32);
quadTrail->setTexture("Particles/QuadTrail");
quadTrail->setBlendType(BLEND_ADD);
dsq->game->addRenderObject(quadTrail, LR_PARTICLES);
#endif
curWebPoint = 0;
web = 0;
bone_dualFormGlow = 0;
bone_head = 0;
boneLeftHand = 0;
boneRightHand = 0;
boneLeftArm = 0;
boneFish2 = 0;
lastWaterBubble = 0;
lastJumpOutFromWaterBubble = false;
lastBurstType = BURST_NONE;
dsq->loops.shield = BBGE_AUDIO_NOCHANNEL;
leftHandEmitter = rightHandEmitter = 0;
@ -3806,7 +3700,6 @@ Avatar::Avatar() : Entity(), ActionMapper()
dsq->loops.charge = BBGE_AUDIO_NOCHANNEL;
//heartbeat = 0;
lastNote = -1;
headTextureTimer = 0;
bone_dualFormGlow = 0;
//dsq->continuity.dualFormCharge = 0;
@ -3823,6 +3716,7 @@ Avatar::Avatar() : Entity(), ActionMapper()
songInterfaceTimer = 0;
quickSongCastDelay = 0;
flourish = false;
_isUnderWater = false;
blockSinging = false;
singing = false;
@ -3966,18 +3860,18 @@ Avatar::Avatar() : Entity(), ActionMapper()
{
targetQuads[i] = new ParticleEffect;
/*
targetQuads[i]->setTexture("missingImage");
targetQuads[i]->setTexture("missingImage");
targetQuads[i]->alpha = 0;
*/
targetQuads[i]->load("EnergyBlastTarget");
// HACK: should have its own layer?
dsq->game->addRenderObject(targetQuads[i], LR_PARTICLES);
}
}
lightFormGlow = new Quad("Naija/LightFormGlow", 0);
lightFormGlow->alpha = 0;
lightFormGlow->scale.interpolateTo(Vector(5.5, 5.5), 0.4, -1, 1);
//lightFormGlow->positionSnapTo = &position;
dsq->game->addRenderObject(lightFormGlow, LR_ELEMENTS13);
@ -4152,15 +4046,16 @@ void Avatar::refreshModel(std::string file, const std::string &skin, bool forceI
if (file == "naija")
{
bone_head = skeletalSprite.getBoneByIdx(1);
boneRightFoot = skeletalSprite.getBoneByName("RightFoot");
boneLeftFoot = skeletalSprite.getBoneByName("LeftFoot");
boneRightArm = skeletalSprite.getBoneByName("RightArm");
boneLeftArm = skeletalSprite.getBoneByName("LeftArm");
boneFish2 = skeletalSprite.getBoneByName("Fish2");
boneFish2->alpha = 0;
if(boneFish2)
boneFish2->alpha = 0;
bone_dualFormGlow = skeletalSprite.getBoneByName("DualFormGlow");
bone_dualFormGlow->scale = 0;
bone_dualFormGlow->setBlendType(BLEND_ADD);
if (bone_dualFormGlow)
{
bone_dualFormGlow->scale = 0;
bone_dualFormGlow->setBlendType(BLEND_ADD);
}
boneLeftHand = skeletalSprite.getBoneByName("LeftArm");
boneRightHand = skeletalSprite.getBoneByName("RightArm");
@ -4169,7 +4064,7 @@ void Avatar::refreshModel(std::string file, const std::string &skin, bool forceI
{
bone_dualFormGlow = 0;
bone_head = 0;
boneRightFoot = boneLeftFoot = boneRightArm = boneLeftArm = boneFish2 = skeletalSprite.getBoneByIdx(0);
boneLeftArm = boneFish2 = 0;
boneLeftHand = boneRightHand = 0;
}
@ -4180,7 +4075,6 @@ void Avatar::refreshModel(std::string file, const std::string &skin, bool forceI
Avatar::~Avatar()
{
songIcons.clear();
}
void Avatar::destroy()
@ -4342,7 +4236,7 @@ void Avatar::startWallBurst(bool useCursor)
wallPushVec = wallNormal;
else
{
wallPushVec = (goDir*0.5f + wallNormal*0.5f);
wallPushVec = (goDir*0.5f + wallNormal*0.5f);
}
}
//wallPushVec = (goDir*0.9f + wallNormal*0.1f);
@ -4421,7 +4315,7 @@ Vector Avatar::getVectorToCursor(bool trueMouse)
{
//return getVectorToCursorFromScreenCentre();
Vector pos = dsq->getGameCursorPosition();
if (!trueMouse && dsq->inputMode != INPUT_MOUSE)
return getFakeCursorPosition();
@ -4663,50 +4557,6 @@ void Avatar::onRender()
Entity::onRender();
}
int Avatar::getBeamWidth()
{
const int MAX_BEAM_LEN = 50;
Vector mov = dsq->getGameCursorPosition() - this->position;
mov.setLength2D(1);
TileVector t(position);
Vector tile(t.x, t.y);
int c = 0;
while (c < MAX_BEAM_LEN)
{
bool hit = false;
tile += mov;
TileVector t;
t.x = int(tile.x);
t.y = int(tile.y);
if (dsq->game->isObstructed(t))
{
hit = true;
}
FOR_ENTITIES(i)
{
Entity *e = *i;
if (e != this)
{
TileVector et(e->position);
Vector t1(et.x, et.y);
Vector t2(tile.x, tile.y);
Vector diff = t1-t2;
if (diff.getSquaredLength2D() <= 1)
{
// HACK: replace damage function
//e->damage(1, 0, this);
hit = true;
}
}
}
if (hit)
break;
c++;
}
return c * TILE_SIZE;
}
void Avatar::onEnterState(int action)
{
Entity::onEnterState(action);
@ -4904,6 +4754,10 @@ void Avatar::updateAura(float dt)
}
}
break;
case AURA_THING:
case AURA_HEAL:
case AURA_NONE:
break;
}
auraTimer -= dt;
@ -4943,7 +4797,7 @@ void Avatar::setHeadTexture(const std::string &name, float time)
if (dsq->continuity.form == FORM_NORMAL /*&& dsq->continuity.costume.empty()*/)
{
if (!name.empty() && (nocasecmp(lastHeadTexture, "singing")==0)) return;
lastHeadTexture = name;
stringToUpper(lastHeadTexture);
std::string t = "Naija/";
@ -5048,6 +4902,14 @@ void Avatar::updateFormVisualEffects(float dt)
skeletalSprite.update(dt);
skeletalSprite.position = bodyPosition;
break;
case FORM_NORMAL:
case FORM_BEAST:
case FORM_NATURE:
case FORM_DUAL:
case FORM_FISH:
case FORM_MAX:
case FORM_NONE:
break;
}
}
@ -5212,7 +5074,7 @@ void Avatar::updateRoll(float dt)
stopRoll();
}
}
if (!_isUnderWater && isActing(ACTION_ROLL))
{
stopRoll();
@ -5258,7 +5120,7 @@ void Avatar::updateRoll(float dt)
if (rollDelay <= 0)
stopRoll();
}
if (isActing(ACTION_ROLL))
{
if (_isUnderWater)
@ -5277,7 +5139,7 @@ void Avatar::updateRoll(float dt)
rotation.z -= amt;
}
rotation.capRotZ360();
rollDelay = 1.0;
}
}
@ -5586,9 +5448,6 @@ void Avatar::onUpdate(float dt)
looking = 0;
#ifdef AQ_TEST_QUADTRAIL
quadTrail->addPoint(position);
#endif
if (lightFormGlow)
{
@ -5644,7 +5503,7 @@ void Avatar::onUpdate(float dt)
curWebPoint = web->addPoint(position);
}
}
if (!dsq->game->isPaused() && isActing(ACTION_LOOK) && !dsq->game->avatar->isSinging() && dsq->game->avatar->isInputEnabled() && !dsq->game->isInGameMenu())
{
looking = 1;
@ -5791,7 +5650,7 @@ void Avatar::onUpdate(float dt)
core->sound->playSfx("NaijaGasp");
core->main(0.75);
dsq->voiceOnce("Naija_VeilCrossing");
core->main(10*0.1f);
@ -5940,16 +5799,6 @@ void Avatar::onUpdate(float dt)
tripCount ++;
if (tripCount > 10)
{
/*
// hacktastic
EMOTE_NAIJAEVILLAUGH = 0
EMOTE_NAIJAGIGGLE = 1
EMOTE_NAIJALAUGH = 2
EMOTE_NAIJASADSIGH = 3
EMOTE_NAIJASIGH = 4
EMOTE_NAIJAWOW = 5
EMOTE_NAIJAUGH = 6
*/
float p = dsq->continuity.tripTimer.getPerc();
if (p > 0.6f)
{
@ -5968,9 +5817,9 @@ void Avatar::onUpdate(float dt)
if (chance(80))
{
if (chance(60))
dsq->emote.playSfx(2);
dsq->emote.playSfx(EMOTE_NAIJALAUGH);
else
dsq->emote.playSfx(0);
dsq->emote.playSfx(EMOTE_NAIJAEVILLAUGH);
}
}
else
@ -5981,7 +5830,7 @@ void Avatar::onUpdate(float dt)
dsq->shakeCamera(5, 4);
tripper->color.interpolateTo(Vector(1, 0.2, 0.2), 3);
if (chance(75))
dsq->emote.playSfx(6);
dsq->emote.playSfx(EMOTE_NAIJAUGH);
}
tripCount = 0;
@ -6039,14 +5888,11 @@ void Avatar::onUpdate(float dt)
if (dsq->continuity.form == FORM_SPIRIT)
{
if (useSpiritDistance)
if (formTimer > 1)
{
if (formTimer > 1)
if (!(bodyPosition - position).isLength2DIn(SPIRIT_RANGE))
{
if (!(bodyPosition - position).isLength2DIn(SPIRIT_RANGE))
{
changeForm(FORM_NORMAL);
}
changeForm(FORM_NORMAL);
}
}
// here
@ -6174,7 +6020,7 @@ void Avatar::onUpdate(float dt)
{
if (state.spellCharge > 1.5f && chargeLevelAttained <1)
{
chargeLevelAttained = 1.5;
chargeLevelAttained = 1;
core->sound->playSfx("PowerUp");
chargingEmitter->load("ChargingEnergy2");
}
@ -6226,6 +6072,13 @@ void Avatar::onUpdate(float dt)
}
}
break;
case FORM_NORMAL:
case FORM_BEAST:
case FORM_SPIRIT:
case FORM_FISH:
case FORM_MAX:
case FORM_NONE:
break;
}
}
/*
@ -6283,7 +6136,7 @@ void Avatar::onUpdate(float dt)
jellyDelay -= dt;
if (jellyDelay < 0)
{
jellyDelay = JELLYCOSTUME_HEALDELAY;
jellyDelay = JELLYCOSTUME_HEALDELAY;
Vector d;
if (!vel.isZero())
@ -6394,7 +6247,7 @@ void Avatar::onUpdate(float dt)
bool isMovingSlow = false;
float len = 0;
if (dsq->isMiniMapCursorOkay() && !isActing(ACTION_ROLL) &&
_isUnderWater && !riding && !boneLock.on &&
(movingOn || ((dsq->inputMode == INPUT_JOYSTICK || dsq->inputMode== INPUT_KEYBOARD) || (core->mouse.buttons.left || bursting))))
@ -6978,7 +6831,7 @@ void Avatar::onUpdate(float dt)
//debugLog("above water bounce");
Vector n = getWallNormal(TileVector(lastPosition));
n *= vel.getLength2D();
@ -6997,7 +6850,7 @@ void Avatar::onUpdate(float dt)
if (vel.y < 0)
{
//debugLog("Vel less than 0");
}
if (vel.y == 0)
{
@ -7008,14 +6861,14 @@ void Avatar::onUpdate(float dt)
if (vel.isLength2DIn(500))
vel.setLength2D(500);
vel.capLength2D(800);
position = lastPosition;
this->doCollisionAvoidance(1, 4, 0.5, 0, 500);
/*
vel = -vel;
if (vel.y < 0)

View file

@ -118,7 +118,7 @@ public:
bool blind;
bool wasUnderWater;
float shotDelay;
//Timer shockTimer;
Timer useItemDelay;
Timer lockToWallDelay;
float spellCharge;
@ -138,7 +138,6 @@ class Avatar : public Entity, public ActionMapper
{
public:
Avatar();
void postInit();
virtual ~Avatar();
void destroy();
void action(int actionID, int state);
@ -147,7 +146,7 @@ public:
float burstDelay;
bool bursting;
BurstType lastBurstType;
//void damage(int amount);
bool isCharging();
void setBlind(float time);
@ -169,8 +168,6 @@ public:
void toggleMovement(bool on);
Vector getFacing();
void refreshModel(std::string file, const std::string &skin, bool forceIdle=false);
void refreshDualFormModel();
void switchDualFormMode();
@ -180,17 +177,11 @@ public:
void clearTargets();
bool singing;
void doBounce();
Vector getKeyDir();
void startBurstCommon();
void updateJoystick(float dt);
int getNotesOpen();
int getLastNote();
int lastNote;
void openSingingInterface();
void closeSingingInterface();
void updateSingingInterface(float dt);
@ -253,8 +244,6 @@ public:
void fallOffWall();
float fireDelay;
int getSingingInterfaceRadius();
int getOpenSingingInterfaceRadius();
AuraType activeAura;
float auraTimer;
bool fireAtNearestValidEntity(const std::string &shot);
@ -276,10 +265,9 @@ public:
float songInterfaceTimer;
void removeEatData(int idx);
//std::list<Entity*>bittenEntities;
typedef std::list<Entity*> BittenEntities;
BittenEntities bittenEntities;
void updateHeartbeatSfx(float t = 0);
Target getNearestTarget(const Vector &checkPos, const Vector &distPos, Entity *source, DamageType dt, bool override=false, std::vector<Target> *ignore=0, EntityList *entityList=0);
void toggleCape(bool on);
@ -303,7 +291,7 @@ public:
Vector getHeadPosition();
Bone *boneRightFoot, *boneLeftFoot, *boneRightArm, *boneLeftArm, *boneFish2, *bone_head;
Bone *boneLeftArm, *boneFish2, *bone_head, *bone_dualFormGlow;
Bone *boneLeftHand, *boneRightHand;
void startFlourish();
@ -317,10 +305,8 @@ public:
Web *web;
float rollDelay;
void loseTargets();
bool canSetBoneLock();
void revert();
void doBindSong();
void doShieldSong();
@ -347,7 +333,7 @@ public:
float elementEffectMult;
bool blockBackFlip;
protected:
void setSongIconPositions();
@ -374,6 +360,9 @@ protected:
Vector bodyOffset;
bool flourish;
bool blockSinging;
bool _isUnderWater;
Path *lastWaterBubble;
bool lastJumpOutFromWaterBubble;
int spiritEnergyAbsorbed;
float formAbilityDelay;
Vector bodyPosition;
@ -397,7 +386,7 @@ protected:
void updateCursor(float dt);
bool rolling;
int rollDidOne;
void startRoll(int dir);
void stopRoll();
int getQuadrantDirection(int lastQuad, int quad);
@ -438,15 +427,13 @@ protected:
void removeBlindEffects();
float zoomVel;
// implement "bobbing" in a lower class
int getBeamWidth();
Vector getWallNormal(TileVector t);
bool checkWarpAreas();
float splashDelay;
//Hair *hair;
//Item *currentItem;
void onUpdate(float dt);
void onRender();

View file

@ -31,7 +31,7 @@ Beam::Beam(Vector pos, float angle) : Quad()
addType(SCO_BEAM);
cull = false;
trace();
//rotation.z = angle;
this->angle = angle;
position = pos;
@ -91,17 +91,13 @@ void Beam::killAllBeams()
void Beam::trace()
{
float angle = MathFunctions::toRadians(this->angle);
//(float(-this->angle)/180.0f)*PI;
//float angle = rotation.z;
Vector mov(sinf(angle), cosf(angle));
TileVector t(position);
Vector startTile(t.x, t.y);
/*
std::ostringstream os;
os << "rotation.z = " << rotation.z << " mov(" << mov.x << ", " << mov.y << ")";
debugLog(os.str());
*/
int moves = 0;
while (!dsq->game->isObstructed(TileVector(startTile.x, startTile.y)))
@ -114,38 +110,24 @@ void Beam::trace()
t = TileVector(startTile.x, startTile.y);
endPos = t.worldVector();
/*
offset = endPos - position;
offset /= 2;
offset *= -1;
*/
//width = (endPos - position).getLength2D();
}
void Beam::render()
{
/*
glLineWidth(4);
glColor4f(1,1,1,1);
glBegin(GL_LINES);
glVertex2f(position.x, position.y);
glVertex2f(endPos.x, endPos.y);
glEnd();
*/
Quad::render();
}
void Beam::onRender()
{
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
Vector diff = endPos - position;
Vector side = diff;
//side.normalize2D();
side.setLength2D(beamWidth*2);
Vector sideLeft = side.getPerpendicularLeft();
Vector sideRight = side.getPerpendicularRight();
@ -160,7 +142,6 @@ void Beam::onRender()
glTexCoord2f(0, 1);
glVertex2f(sideRight.x, sideRight.y);
glEnd();
#endif
}
void Beam::onUpdate(float dt)

View file

@ -32,39 +32,31 @@ bool BitBlotLogo::watchQuit(float time)
{
core->main(time);
return false;
/*
dsq->watch(time);
if (quitFlag > 0)
{
skipLogo();
return true;
}
return false;
*/
}
void BitBlotLogo::doShortBitBlot()
{
dsq->overlay->color = Vector(0,0,0);
dsq->overlay->alpha = 0;
dsq->overlay2->color = Vector(1,1,1);
dsq->overlay2->alpha = 1;
dsq->overlay2->alpha.interpolateTo(0, 0.25);
Quad *bg = new Quad;
bg->setWidthHeight(800, 600);
bg->position = Vector(400,300);
bg->followCamera = 1;
addRenderObject(bg, LR_HUD);
Quad *logo = new Quad("BitBlot/Logo.png", Vector(400,300));
logo->followCamera = 1;
logo->scale = Vector(0.6,0.6);
addRenderObject(logo, LR_HUD);
core->main(1.5);
dsq->overlay2->alpha.interpolateTo(1, 0.5);
core->main(0.5);
}
@ -78,7 +70,7 @@ void BitBlotLogo::skipLogo()
void BitBlotLogo::getOut()
{
//dsq->continuity.reset();
#ifdef AQUARIA_DEMO
dsq->title();
@ -91,17 +83,17 @@ void BitBlotLogo::getOut()
}
void BitBlotLogo::applyState()
{
{
StateObject::applyState();
quitFlag = 0;
logo = 0;
dsq->toggleCursor(0);
dsq->toggleBlackBars(1);
//dsq->setBlackBarsColor(Vector(1,1,1));
dsq->jiggleCursor();
dsq->forceInputGrabOff();
if (dsq->user.demo.shortLogos)
{
skipLogo();
@ -109,7 +101,7 @@ void BitBlotLogo::applyState()
}
logo = 1;
if (core->getKeyState(KEY_ESCAPE))
{
skipLogo();
@ -127,7 +119,7 @@ void BitBlotLogo::applyState()
landscape->followCamera = 1;
landscape->alpha = 1;
landscape->shareAlphaWithChildren = 1;
for (int i = 2; i < 5 + rand()%10; i++)
{
@ -143,7 +135,7 @@ void BitBlotLogo::applyState()
bird->update((rand()%100)*0.1f);
}
//if (true)
if (rand()%100 < 40)
{
SkeletalSprite *dragon = new SkeletalSprite();
@ -161,7 +153,7 @@ void BitBlotLogo::applyState()
}
std::vector<SkeletalSprite*> windmills;
int numWindmills = rand()%3;
int numWindmills = rand()%3;
for (int i = 0; i < numWindmills; i++)
{
SkeletalSprite *windmill = new SkeletalSprite();
@ -215,7 +207,7 @@ void BitBlotLogo::applyState()
logob->scale = Vector(0.6, 0.6);
logob->offset = Vector(-4, 0);
logob->offset.interpolateTo(Vector(4,0), 0.05, -1, 1);
addRenderObject(logob, LR_ENTITIES);
RenderObject *lines = new RenderObject();
@ -254,12 +246,12 @@ void BitBlotLogo::applyState()
dsq->overlay->alpha.interpolateTo(0, 1);
//sound->playSfx("BBSplash");
sound->playMusic("bblogo", SLT_NONE);
if (watchQuit(1.0)) return;
//sound->playSfx("normalform");
dsq->overlay2->color = Vector(1,1,1);
@ -272,23 +264,20 @@ void BitBlotLogo::applyState()
sound->playSfx("normalform");
//landscape->alpha.interpolateTo(1, 2);
white->alpha.interpolateTo(0, 2);
landscape->position.interpolateTo(Vector(400,400), 5);
/*
if (core->afterEffectManager)
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter, 0.1,0.03,30,0.2f, 0.5));
*/
landscape->scale.interpolateTo(Vector(1.1, 1.1), 5);
scanline->alpha.interpolateTo(0, 1);
//scanline->scale.interpolateTo(Vector(5, 5), 1);
logo->scale.interpolateTo(Vector(2, 2), 1);
//logo->offset.interpolateTo(Vector(0, -300), 1);
logo->alpha.interpolateTo(0, 1);
lines->alpha.interpolateTo(0, 4);
@ -300,36 +289,12 @@ void BitBlotLogo::applyState()
dsq->overlay2->alpha.interpolateTo(1, 2);
if (watchQuit(2.0)) return;
getOut();
/*
// BOING
dsq->toggleCursor(0);
Quad *logo = new Quad("BitBlot/Logo.png", Vector(400,300));
logo->followCamera = 1;
addRenderObject(logo);
//logo->scale = Vector(0.6, 0.6);
logo->scale = Vector(0, 0);
core->setClearColor(Vector(1,1,1));
dsq->overlay->alpha = 1;
dsq->overlay->alpha.interpolateTo(0, 1);
core->main(0.5);
logo->scale.path.addPathNode(Vector(0,0), 0);
logo->scale.path.addPathNode(Vector(0,0), 0.4);
logo->scale.path.addPathNode(Vector(1.2,1.2), 0.8);
logo->scale.path.addPathNode(Vector(1.0, 1.0), 0.85);
logo->scale.path.addPathNode(Vector(1.1, 1.1), 0.95);
logo->scale.path.addPathNode(Vector(1,1), 1.0);
logo->scale.startPath(1);
core->main(2);
dsq->overlay->alpha.interpolateTo(1, 1.5);
core->main(1.5);
*/
}
void BitBlotLogo::removeState()
@ -341,15 +306,7 @@ void BitBlotLogo::removeState()
void BitBlotLogo::update(float dt)
{
StateObject::update(dt);
/*
if (quitFlag == 0)
{
if (core->getKeyState(KEY_ESCAPE))
{
quitFlag = 1;
}
}
*/
}

View file

@ -1,59 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Element.h"
#include "../BBGE/Core.h"
BoxElement::BoxElement(int width, int height) : Element(BOX)
{
blendEnabled = false;
this->width = width;
this->height = height;
height+=2;
ww = width/2 + 2;
hh = height/2 + 10;
this->color = 0;
cull = true;
//cull = false;
}
/*
bool BoxElement::isOnScreen()
{
// HACK: biased towards being fast for rows
//if (alpha.x < 1.0f) return false;
//if (!cull) return true;
if (this->position.y + hh >= core->screenCullY1
&& this->position.y - hh <= core->screenCullY2)
{
if (this->position.x + ww >= core->screenCullX1
&& this->position.x - ww <= core->screenCullX2)
{
return true;
}
}
return false;
}
*/

View file

@ -1,56 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "GridRender.h"
BubbleRender::BubbleRender() : RenderObject()
{
bubble.setTexture("particles/bubble");
bubble.alpha = 0.5;
bubble.scale = Vector(0.5,0.5);
cull = false;
}
void BubbleRender::rebuild()
{
bubbles.clear();
for (int x = dsq->game->cameraMin.x; x < dsq->game->cameraMax.x; x+=64)
{
for (int y = dsq->game->cameraMin.y; y < dsq->game->cameraMax.y; y+=64)
{
bubbles.push_back(Vector(x,y) + Vector(rand()%16-32, rand()%16-32));
}
}
}
void BubbleRender::onRender()
{
for (int i = 0; i < bubbles.size(); i++)
{
if (bubbles[i].x > core->screenCullX1 && bubbles[i].x < core->screenCullX2)
{
if (bubbles[i].y > core->screenCullY1 && bubbles[i].y < core->screenCullY2)
{
bubble.position = bubbles[i];
bubble.render();
}
}
}
}

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "CollideEntity.h"
#include "DSQ.h"
#include "Game.h"
//#include "ParticleEffects.h"
CollideEntity::CollideEntity() : Entity()
{
@ -32,6 +32,10 @@ CollideEntity::CollideEntity() : Entity()
this->updateCull = 4000;
}
CollideEntity::~CollideEntity()
{
}
void CollideEntity::entityDied(Entity *e)
{
Entity::entityDied(e);
@ -47,7 +51,7 @@ void CollideEntity::bounce(float ba)
if (getState() == STATE_PUSH)
{
dsq->spawnParticleEffect("HitSurface", dsq->game->lastCollidePosition);
//dsq->effectCollisionSmoke(position);
sound("RockHit");
// HACK: replace damage function
//damage(pushDamage);
@ -60,13 +64,13 @@ void CollideEntity::bounce(float ba)
{
if (!vel.isZero())
{
float len = vel.getLength2D();
float len = vel.getLength2D();
Vector I = vel/len;
Vector N = dsq->game->getWallNormal(dsq->game->lastCollidePosition);
Vector N = dsq->game->getWallNormal(dsq->game->lastCollidePosition);
if (!N.isZero())
{
//2*(-I dot N)*N + I
vel = 2*(-I.dot(N))*N + I;
vel.setLength2D(len*ba);
}
@ -89,26 +93,22 @@ void CollideEntity::bounce(float ba)
}
}
break;
case BOUNCE_NONE:
break;
}
//mov.setLength2D(-len * ba);
onBounce();
}
void CollideEntity::updateMovement(float dt)
{
{
if (isEntityDead()) return;
if (position.isFollowingPath()) return;
vel.capLength2D(getMaxSpeed()*maxSpeedLerp.x);
/*
if (vel.getSquaredLength2D() > sqr(getMaxSpeed()))
{
vel.setLength2D(getMaxSpeed());
vel.z = 0;
}
*/
//Vector lastPos = pos;
updateVel2(dt);
@ -128,27 +128,13 @@ void CollideEntity::updateMovement(float dt)
{
position.y = dsq->game->getWaterLevel()+collideRadius;
}
}
}
/*
if (!canLeaveWater)
{
if (waterBubble)
{
}
else
{
if (position.y-collideRadius < dsq->game->getWaterLevel())
{
}
}
}
*/
bool collided = false;
if (vel.x != 0 || vel.y != 0)
{
@ -157,8 +143,8 @@ void CollideEntity::updateMovement(float dt)
if (isv(EV_COLLIDELEVEL,1))
{
bool doesFreeRange = !isPullable();
if (doesFreeRange)
@ -170,8 +156,8 @@ void CollideEntity::updateMovement(float dt)
}
}
}
//Vector lastPosition = lastPos;
Vector newPosition = position + (getMoveVel() * dt);
position = newPosition;
@ -187,7 +173,7 @@ void CollideEntity::updateMovement(float dt)
}
}
else
{
{
if (!freeRange && ((!canLeaveWater && !isUnderWater() && wasUnderWater) || dsq->game->collideCircleWithGrid(position, hw)))
{
position = lastPosition;
@ -207,7 +193,7 @@ void CollideEntity::updateMovement(float dt)
{
attachedEntities[i]->position = this->position + attachedEntitiesOffsets[i];
attachedEntities[i]->rotation = this->rotation;
}
}
wasUnderWater = underWater;
}

View file

@ -27,17 +27,18 @@ class CollideEntity : public Entity
{
public:
CollideEntity();
virtual ~CollideEntity();
float bounceAmount;
float weight;
void updateMovement(float dt);
void updateMovement(float dt);
void entityDied(Entity *e);
protected:
protected:
virtual void onHitWall(){}
void onUpdateFrozen(float dt);
virtual void onBounce() {}
void bounce(float ba);
};
#endif

View file

@ -304,11 +304,7 @@ void Continuity::sortFood()
switch (dsq->continuity.foodSortType)
{
/*
case FOODSORT_UNSORTED:
sortOrder = sortByUnsort;
break;
*/
case FOODSORT_BYTYPE:
sortOrder = sortByType;
break;
@ -321,8 +317,7 @@ void Continuity::sortFood()
}
//IngredientData *plantLeaf = dsq->continuity.getIngredientHeldByName("PlantLeaf");
//int oldHeld = plantLeaf->held;
if (doSort)
{
@ -391,11 +386,11 @@ void Continuity::sortFood()
ingredients.push_back(sort[i]);
}
sort.clear();
//dsq->continuity.ingredients = sort;
}
//IngredientData *plantLeaf2 = dsq->continuity.getIngredientHeldByName("PlantLeaf");
//int newHeld = plantLeaf2->held;
}
void Continuity::setRegen(float t)
@ -564,7 +559,7 @@ std::string Continuity::getIEString(IngredientData *data, int i)
os << dsq->continuity.stringBank.get(210);
os << " " << dsq->continuity.stringBank.get(205) << " " << (fx.magnitude*5) << " " << dsq->continuity.stringBank.get(203);
return os.str();
//return dsq->continuity.stringBank.get(210);
break;
case IET_ENERGY:
os << dsq->continuity.stringBank.get(211) << " " << fx.magnitude;
@ -612,6 +607,10 @@ std::string Continuity::getIEString(IngredientData *data, int i)
return ret;
}
break;
case IET_NONE:
case IET_RANDOM:
case IET_MAX:
break;
}
return "";
@ -829,7 +828,7 @@ bool Continuity::applyIngredientEffects(IngredientData *data)
dsq->centerMessage(getIEString(data, i), y);
dsq->continuity.setWeb(webTime);
//dsq->centerMessage(dsq->continuity.stringBank.get(216), y);
}
break;
case IET_ALLSTATUS:
@ -1246,6 +1245,9 @@ std::string Continuity::getInternalFormName()
return "sun";
case FORM_DUAL:
return "dual";
case FORM_NONE:
case FORM_MAX:
break;
}
return "";
}
@ -1477,8 +1479,8 @@ void Continuity::castSong(int num)
os << "Could not find song with index [" << num << "]";
debugLog(os.str());
}
//float et = 0.5;
//float et = 10;
float et = 0.5;
std::ostringstream os;
os << "Song/SongSlot-" << dsq->continuity.getSongSlotByType(num);
@ -1487,7 +1489,7 @@ void Continuity::castSong(int num)
effect->setTexture(os.str());
effect->position = selected->position + selected->offset;
effect->scale.interpolateTo(Vector(3,3), et);
//effect->setBlendType(RenderObject::BLEND_ADD);
effect->alpha.ensureData();
effect->alpha.data->path.addPathNode(0, 0);
effect->alpha.data->path.addPathNode(0.5, 0.1);
@ -1536,12 +1538,7 @@ void Continuity::castSong(int num)
sound->playSfx("Heal");
selected->heal(2);
/*
Wynia *wynia = new Wynia;
wynia->trackTo(selected);
wynia->position = selected->position;
core->getTopStateData()->addRenderObject(wynia, PROJECTILES);
*/
selected->skeletalSprite.animate("healSelf", 0, 1);
break;
case SONG_TIME:
@ -1575,7 +1572,7 @@ void Continuity::castSong(int num)
{
if (!dsq->game->avatar->isNearObstruction(2) && !dsq->game->avatar->state.lockedToWall && !(dsq->game->li->position - dsq->game->avatar->position).isLength2DIn(400))
{
//dsq->game->avatar->disableInput();
dsq->overlay->color = Vector(1,1,1);
dsq->fade(1, 0.3);
dsq->main(0.3);
@ -1583,7 +1580,7 @@ void Continuity::castSong(int num)
dsq->fade(0, 0.3);
dsq->main(0.3);
dsq->overlay->color = 0;
//dsq->game->avatar->enableInput();
}
else if ((dsq->game->li->position - dsq->game->avatar->position).isLength2DIn(500))
{
@ -1597,13 +1594,7 @@ void Continuity::castSong(int num)
{
core->sound->playSfx("Denied");
}
/*
}
else
{
core->sound->playSfx("SongFail");
}
*/
}
else
{
@ -1651,6 +1642,10 @@ void Continuity::castSong(int num)
dsq->game->avatar->changeForm(FORM_FISH);
break;
case SONG_SONGDOOR1:
case SONG_SONGDOOR2:
case SONG_ANIMA:
case SONG_NONE:
case SONG_MAX:
break;
#endif
}
@ -1785,12 +1780,8 @@ loop:
// make sure last note is more or less close
if (song.notes.size()-last < 2)
{
//rank += song.size()-last;
/*
std::ostringstream os;
os << "songCheck: " << songChecks[i].songIdx << " completed with rank " << rank;
debugLog(os.str());
*/
songChecks[i].pass = true;
songChecks[i].rank = rank;
@ -1813,11 +1804,7 @@ loop:
}
}
/*
std::ostringstream os;
os << "lowest rank: " << lowestRank;
debugLog(os.str());
*/
return songIdx;
}
@ -1835,7 +1822,7 @@ int Continuity::checkSong(const Song &song)
Song *s = &songBank[i];
if (s->notes.empty()) continue;
int j = 0;
//if (s->size() == song.size())
{
bool foundSong = false;
int currentNote = 0;
@ -1867,7 +1854,7 @@ int Continuity::checkSong(const Song &song)
}
}
if (j != song.notes.size()-1) foundSong = false;
//if (j == s->size())
if (foundSong)
{
return i;
@ -1910,7 +1897,7 @@ void Continuity::update(float dt)
statsAndAchievements->RunFrame();
}
if (dsq->game->isActive() && !dsq->game->isPaused() /*&& !(getWorldType() == WT_SPIRIT)*/)
if (dsq->game->isActive() && !dsq->game->isPaused() )
{
if (liPowerTimer.updateCheck(dt))
@ -2011,18 +1998,14 @@ void Continuity::update(float dt)
if (regenTimer.isActive())
{
/*
static float regenBit = 0;
regenBit += dt;
if (regenBit > 1)
*/
{
Avatar *a = dsq->game->avatar;
if (a)
{
a->heal(dt*0.5f);
}
//regenBit = 0;
}
}
}
@ -2104,17 +2087,14 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
{
core->postProcessingFx.blendType = 1;
core->postProcessingFx.intensity = 0.2f;
core->postProcessingFx.layer = LR_AFTER_EFFECTS;//LR_AFTER_EFFECTS;
core->postProcessingFx.layer = LR_AFTER_EFFECTS;
core->postProcessingFx.renderLayer = LR_AFTER_EFFECTS;
core->postProcessingFx.enable(FXT_RADIALBLUR);
}
dsq->game->avatar->canWarp = false;
/*
if (affectMusic)
dsq->sound->toggleEffects(1);
*/
dsq->game->backupSceneColor = dsq->game->sceneColor;
dsq->game->sceneColor.interpolateTo(Vector(0.4, 0.8, 0.9), time);
dsq->game->avatar->applyWorldEffects(type);
@ -2124,23 +2104,15 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
dsq->game->avatar->canWarp = true;
core->postProcessingFx.disable(FXT_RADIALBLUR);
//worldType = WT_SPIRIT;
/*
if (affectMusic)
dsq->sound->toggleEffects(0);
*/
//dsq->game->sceneColor.interpolateTo(dsq->game->backupSceneColor, time);
dsq->game->sceneColor.interpolateTo(Vector(1,1,1), time);
dsq->game->avatar->applyWorldEffects(type);
}
if (time > 0)
{
/*
dsq->game->avatar->slowToRest();
dsq->game->avatar->disableInput();
core->main(time);
dsq->game->avatar->enableInput();
*/
}
worldType = type;
}
@ -2291,12 +2263,7 @@ void Continuity::setFlag(std::string flag, int v)
flags[flag] = v;
}
/*
void Continuity::setActivePet(int flag)
{
setFlag(FLAG_ACTIVEPET, flag);
}
*/
void Continuity::loadPetData()
{
@ -2474,7 +2441,6 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
}
worldMap->SetAttribute("b", os.str().c_str());
#ifdef AQUARIA_BUILD_MAPVIS
if (dsq->game->worldMapRender)
{
std::ostringstream os;
@ -2487,7 +2453,6 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
}
worldMap->SetAttribute("va", os.str().c_str());
}
#endif
}
doc.InsertEndChild(worldMap);
@ -2552,6 +2517,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
startData->SetAttribute("x", int(position.x));
startData->SetAttribute("y", int(position.y));
startData->SetAttribute("scene", dsq->game->sceneName.c_str());
startData->SetAttribute("sceneDisplayName", dsq->game->sceneDisplayName.c_str());
startData->SetAttribute("exp", dsq->continuity.exp);
startData->SetAttribute("h", dsq->continuity.maxHealth);
startData->SetAttribute("ch", dsq->continuity.health);
@ -2788,20 +2754,7 @@ void Continuity::loadFile(int slot)
e = e->NextSiblingElement("Flag");
}
/*
if (debugEntityflags)
{
for (EntityFlags::iterator i = entityFlags.begin(); i != entityFlags.end(); i++)
{
if ((*i).first == name)
{
std::ostringstream os;
os << "Duplicate entity flag: " << name << " please report this error";
errorLog(os.str());
}
}
}
*/
XMLElement *efx = doc.FirstChildElement("EFX");
if (efx)
@ -3017,7 +2970,6 @@ void Continuity::loadFile(int slot)
}
#ifdef AQUARIA_BUILD_MAPVIS
if (worldMap->Attribute("va") && dsq->continuity.worldMap.getNumWorldMapTiles())
{
std::istringstream is(worldMap->Attribute("va"));
@ -3026,7 +2978,7 @@ void Continuity::loadFile(int slot)
int idx;
//worldMapTiles.clear();
while (is >> idx)
{
@ -3043,7 +2995,6 @@ void Continuity::loadFile(int slot)
tile->stringToData(is);
}
}
#endif
}
@ -3321,13 +3272,7 @@ void Continuity::loadFile(int slot)
void Continuity::setNaijaModel(std::string model)
{
/*
naijaModel = model;
if (dsq->game->avatar)
{
dsq->game->avatar->refreshModel();
}
*/
}
int Continuity::getFlag(int flag)
@ -3403,7 +3348,7 @@ public:
timer = 0;
//GemGet *q = this;
setTexture("Gems/" + gem);
@ -3423,11 +3368,7 @@ public:
setLife(timeScale+0.1f);
setDecayRate(1);
/*
q->position.path.addPathNode(Vector(400,400), 0.6);
q->position.path.addPathNode(dsq->game->miniMapRender->position, 0.9);
q->position.startPath(t);
*/
}
protected:
float timer;
@ -3495,26 +3436,7 @@ GemData *Continuity::pickupGem(std::string name, bool effects)
GemGet *gg = new GemGet(g.name);
dsq->game->addRenderObject(gg, LR_MINIMAP);
/*
Quad *q = new Quad;
q->setTexture("Gems/" + g.name);
q->followCamera = 1;
q->scale = Vector(0, 0);
q->scale.path.addPathNode(Vector(0,0), 0);
q->scale.path.addPathNode(Vector(1,1), 0.3);
q->scale.path.addPathNode(Vector(1,1), 0.6);
q->scale.path.addPathNode(Vector(0.5,0.5), 0.9);
q->scale.path.addPathNode(Vector(0.1,0.1), 1);
q->scale.startPath(t);
q->position = Vector(400,400);
q->position.path.addPathNode(Vector(400,400), 0.6);
q->position.path.addPathNode(dsq->game->miniMapRender->position, 0.9);
q->position.startPath(t);
dsq->game->addRenderObject(q, LR_MESSAGEBOX);
*/
if (!getFlag("tokenHint"))
@ -3522,8 +3444,8 @@ GemData *Continuity::pickupGem(std::string name, bool effects)
setFlag("tokenHint", 1);
dsq->game->setControlHint(dsq->continuity.stringBank.get(4), false, false, false, 8);
}
//dsq->watch(1);
//dsq->resetTimer();
}
// return the last one
@ -3579,7 +3501,7 @@ void Continuity::reset()
dsq->game->recipeMenu.currentPage = 0;
}
//worldMapTiles.clear();
speedMult = biteMult = fishPoison = defenseMult = 1;
speedMult2 = 1;
@ -3635,12 +3557,12 @@ void Continuity::reset()
loadEatBank();
dsq->loadElementEffects();
form = FORM_NORMAL;
//cm.reset();
naijaModel = "Naija";
costume = "";
dsq->emote.load("data/naijaemote.txt");
//learnSong(SONG_SONGDOOR1);
worldType = WT_NORMAL;
@ -3668,7 +3590,7 @@ void Continuity::reset()
inFile >> spd;
speedTypes.push_back(spd);
}
//selectedSpell = SpellType(0);
if (!dsq->mod.isActive())
{

View file

@ -32,7 +32,7 @@ namespace AQCredits
void watchSlide(int slide)
{
float t = 10;//15;
float t = 10;
if (!(slide >= 0 && slide < slides.size())) return;
@ -81,9 +81,9 @@ void Credits::applyState()
dsq->setCutscene(1,0);
core->resetCamera();
core->sound->stopMusic();
// load everything here:
bg1 = new Quad("particles/gas", Vector(400,300));
@ -185,12 +185,12 @@ void Credits::applyState()
{
core->main(1);
}
dsq->setCutscene(0);
dsq->game->transitionToScene("thirteenlair");
#endif
//dsq->title();
}
void Credits::removeState()

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CurrentRender::CurrentRender() : RenderObject()
{
cull = false;
//alpha = 0.2f;
setTexture("Particles/Current");
texture->repeat = true;
rippleDelay = 2;
@ -35,32 +35,12 @@ void CurrentRender::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
/*
rippleDelay -= dt;
if (rippleDelay < 0)
{
for (int i = 0; i < dsq->game->paths.size()-1; i++)
{
Path *p = dsq->game->paths[i];
for (int n = 0; n < p->nodes.size()-1; i++)
{
PathNode *n1 = &p->nodes[n];
PathNode *n2 = &p->nodes[n+1];
Vector diff = n2->position - n1->position;
Vector pos = n1->position + diff*p->animOffset;
// spawn effect at pos
if (core->afterEffectManager)
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),pos,0.04,0.06,15,0.2f));
}
}
rippleDelay = 1.0;
}
*/
}
void CurrentRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
// note: Leave cull_face disabled!?
//glDisable(GL_CULL_FACE);
//int qs = 0;
@ -69,86 +49,12 @@ void CurrentRender::onRender()
if (p->active)
{
/*
std::ostringstream os;
os << "animOffset: " << p->animOffset;
debugLog(os.str());
*/
int w2 = p->rect.getWidth()/2;
/*
if (false)
{
float offset = 0;
glBegin(GL_QUAD_STRIP);
int sz = p->nodes.size();
float len = 0;
float totalLength = 0;
for (int n = 0; n < sz-1; n++)
{
totalLength += (p->nodes[n+1].position - p->nodes[n].position).getLength2D();
}
float texScale = totalLength/256.0f;
Vector p1, p2, diff, pl, pr;
for (int n = 0; n < sz; n++)
{
PathNode *n1 = &p->nodes[n];
p1 = n1->position;
if (n == sz-1)
{
PathNode *n2 = &p->nodes[n-1];
p2 = n2->position;
diff = p1-p2;
}
else
{
PathNode *n2 = &p->nodes[n+1];
p2 = n2->position;
diff = p2-p1;
}
len = diff.getLength2D();
float add = len/totalLength;
//texScale = len/totalLength;
pl = diff.getPerpendicularLeft();
pr = diff.getPerpendicularRight();
pl.setLength2D(w2);
pr.setLength2D(w2);
Vector r1 = p1+pl;
Vector r4 = p1+pr;
if (n == 0 || n == sz-1)
{
glColor4f(1, 1, 1, 0);
}
else
{
glColor4f(1, 1, 1, 1);
}
//(0+p->animOffset)*texScale +
glTexCoord2f((offset)*texScale+p->animOffset, 0);
glVertex2f(r1.x, r1.y);
glTexCoord2f((offset)*texScale+p->animOffset, 1);
//(0+p->animOffset)*texScale +
glVertex2f(r4.x, r4.y);
offset += add;
}
glEnd();
}
else
*/
if (true)
{
int sz = p->nodes.size()-1;
@ -165,23 +71,7 @@ void CurrentRender::onRender()
p2 += d*0.75f;
diff = p2 - p1;
//bool edge = false;
/*
if (n == 0)
{
p1 -= diff*0.25f;
edge = true;
}
if (n == sz-1)
{
p2 += diff*0.25f;
edge = true;
}
diff = p2-p1;
*/
if (!diff.isZero())
{
@ -202,21 +92,12 @@ void CurrentRender::onRender()
Vector r8 = p2+pr;
float len = diff.getLength2D();
float texScale = len/256.0f;
//float texScale2 = texScale;
/*
if (edge)
texScale *= 2;
*/
/*
if (edge)
texScale2 *= 4;
*/
if (isTouchingLine(p1, p2, dsq->screenCenter, dsq->cullRadius+p->rect.getWidth()/2.0f))
{
//qs++;
glBegin(GL_QUAD_STRIP);
glColor4f(1,1,1,0);
@ -274,7 +155,7 @@ void CurrentRender::onRender()
if (isTouchingLine(p1, p2, dsq->screenCenter, dsq->cullRadius))
{
//qs++;
glBegin(GL_QUADS);
if (n==0)
glColor4f(1,1,1,0);
@ -305,18 +186,11 @@ void CurrentRender::onRender()
}
}
}
//glEnd();
}
//glEnable(GL_CULL_FACE);
/*
std::ostringstream os;
os << "current quads: " << qs;
debugLog(os.str());
*/
#endif
}

File diff suppressed because it is too large Load diff

View file

@ -161,7 +161,7 @@ enum AquariaActions
ACTION_MULTISELECT ,
ACTION_TOGGLEWORLDMAPEDITOR ,
ACTION_LOOK ,
ACTION_TOGGLEHELPSCREEN,
ACTION_PLACE_AVATAR,
@ -191,16 +191,7 @@ enum WorldMapRevealMethod
};
/*
class Title;
class GameOver;
class Logo;
class Entity;
class SCLogo;
class IntroText;
class AnimationEditor;
class Intro;
*/
struct SubLine
{
SubLine() { timeStamp = 0; }
@ -229,7 +220,7 @@ public:
void go(const std::string &subs);
void update(float dt);
void end();
void hide(float t = 0);
void show(float t = 0);
@ -268,11 +259,11 @@ public:
void start();
void stop();
void load(const std::string &path);
void update(float dt);
void recache();
const std::string& getBaseModPath() const;
bool isActive();
@ -282,7 +273,7 @@ public:
const std::string& getPath() const;
const std::string& getName() const;
void shutdown();
bool isShuttingDown();
@ -551,23 +542,7 @@ enum Layers
class Avatar;
/*
class GardenHoleData
{
public:
GardenHoleData();
float timePlanted, timeLastChecked, lastTimeGrown;
int plantedItem;
unsigned int state;
int slotsUsed;
};
class GardenData
{
public:
GardenHoleData holeData[256];
};
*/
#define MAPVIS_SUBDIV 64
@ -708,7 +683,7 @@ enum FoodSortType
struct IngredientEffect
{
IngredientEffect() : type(IET_NONE), magnitude(0) {}
IngredientEffect() : magnitude(0), type(IET_NONE) {}
float magnitude;
IngredientEffectType type;
std::string string;
@ -857,12 +832,7 @@ const int FLAG_SECRET03 = 236;
const int FLAG_COLLECTIBLE_START = 500;
const int FLAG_COLLECTIBLE_END = 600;
/*
const int FLAG_PET_NAUTILUS = 601;
const int FLAG_PET_DUMBO = 602;
const int FLAG_PET_BLASTER = 603;
const int FLAG_PET_PIRANHA = 604;
*/
struct PetData
{
@ -907,7 +877,7 @@ public:
void drop(int type);
void entityDied(Entity *eDead);
void achieve(const std::string &achievement);
void initFoodSort();
@ -1016,7 +986,7 @@ public:
Song *getSongByIndex(int idx);
bool hasSong(int song);
int getSongTypeBySlot(int slot);
int getSongSlotByType(int type);
@ -1037,7 +1007,7 @@ public:
typedef std::list<GemData> Gems;
Gems gems;
typedef std::list<BeaconData> Beacons;
Beacons beacons;
@ -1084,7 +1054,7 @@ public:
void removeEmptyIngredients();
void spawnAllIngredients(const Vector &position);
std::vector<std::string> unsortedOrder;
typedef std::vector<Recipe> Recipes;
@ -1149,10 +1119,10 @@ public:
enum { DUALFORM_NAIJA = 0, DUALFORM_LI = 1 };
int dualFormMode, dualFormCharge;
BeaconData *getBeaconByIndex(int index);
void setBeacon(int index, bool v, Vector pos=Vector(0,0,0), Vector color=Vector(1,1,1));
int foodSortType;
std::vector<FoodSortOrder> sortByType, sortByHeal, sortByIngredients, sortByUnsort;
@ -1250,7 +1220,7 @@ public:
void init();
void shutdown();
void toggleInputGrabPlat(bool on);
void toggleBlackBars(bool on, float t=0);
@ -1266,7 +1236,7 @@ public:
CountedPtr<Texture> texCursor, texCursorSwim, texCursorBurst, texCursorSing, texCursorLook;
void setBlackBarsColor(Vector color);
void toggleFullscreen();
void setTexturePointers();
@ -1293,7 +1263,7 @@ public:
Game *game;
bool isQuitFlag();
void jiggleCursor();
SFXLoops loops;
@ -1466,7 +1436,7 @@ public:
void setStory();
bool disableMiniMapOnNoInput;
std::string returnToScene;
Demo demo;
@ -1477,7 +1447,7 @@ public:
#endif
BitmapText *versionLabel;
ProfRender *profRender;
void setVersionLabelText();
float menuSelectDelay;
@ -1515,7 +1485,7 @@ public:
void loadFonts();
void instantQuit();
void centerText(const std::string &text);
@ -1548,13 +1518,13 @@ public:
};
Difficulty difficulty;
std::string getSaveDirectory();
void clickRingEffect(Vector position, int type=0, Vector color=Vector(1,1,1), float ut=0);
void bindInput();
void forceInputGrabOff();
int weird;

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "DSQ.h"
#include "Game.h"
#include "Avatar.h"
//const float key = 0.1;
Demo::Demo()
{
time = 0;
@ -38,11 +38,11 @@ void Demo::toggleRecord(bool on)
mode = DEMOMODE_RECORD;
time = 0;
timeDiff = 0;
frame = 0;
frame = 0;
}
else
{
mode = DEMOMODE_NONE;
mode = DEMOMODE_NONE;
}
}
@ -54,7 +54,7 @@ void Demo::togglePlayback(bool on)
mode = DEMOMODE_PLAYBACK;
time = 0;
timeDiff = 0;
frame = 0;
frame = 0;
}
else
{
@ -74,25 +74,11 @@ void Demo::save(const std::string &name)
{
togglePlayback(false);
toggleRecord(false);
std::string filename = "" + name + ".demo";
/*
XMLDocument doc;
// UNFINISHED
for (int i = 0; i < frames.size(); i++)
{
//DemoFrame *frame = &frames[i];
XMLElement *xmlDemoFrame = doc.NewElement("DemoFrame");
std::ostringstream os;
//os << frame->avatarPos.x << " " << frame->avatarPos.y << " " << frame->mouse;
//xmlDemoFrame->SetAttribute("a", os.str().c_str());
doc.InsertEndChild(xmlDemoFrame);
}
doc.SaveFile(filename.c_str());
*/
}
void Demo::load(const std::string &name)
@ -103,10 +89,8 @@ void Demo::load(const std::string &name)
// UNFINISHED
std::string filename = "" + name + ".demo";
//XMLDocument doc;
//doc.LoadFile(filename.c_str());
//doc.FirstChildElement("");
}
void Demo::clearRecordedFrames()
@ -124,7 +108,7 @@ void Demo::update(float dt)
if (core->getNestedMains() > 1) return;
if (mode == DEMOMODE_RECORD)
{
{
DemoFrame f;
f.avatarPos = dsq->game->avatar->position;
f.vel = dsq->game->avatar->vel;
@ -136,13 +120,7 @@ void Demo::update(float dt)
frames.push_back(f);
/*
timeDiff += dt;
if (timeDiff > key)
{
timeDiff -= key;
}
*/
time += dt;
if (getQuitKey())
@ -153,18 +131,18 @@ void Demo::update(float dt)
}
else if (mode == DEMOMODE_PLAYBACK)
{
//core->updateMouse = false;
while (frame < frames.size())
{
DemoFrame *f = &frames[frame];
if (f->t <= time) {
// temporarily deactivate for seahorse footage
dsq->game->avatar->vel = f->vel;
dsq->game->avatar->vel2 = f->vel2;
dsq->game->avatar->rotation.z = f->rot;
dsq->game->avatar->position = f->avatarPos;
core->mouse = f->mouse;
@ -174,18 +152,18 @@ void Demo::update(float dt)
{
break;
}
//
}
time += dt;
//core->updateMouse = true;
if (getQuitKey() || (!frames.empty() && frame >= frames.size())) {
if (getQuitKey() || (!frames.empty() && frame >= frames.size())) {
togglePlayback(false);
dsq->centerMessage(dsq->continuity.stringBank.get(2011));
}
}
}

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Game.h"
ElementEffectData::ElementEffectData()
: elementEffectIndex(-1)
: elementEffectType(EFX_NONE)
, wavyAngleOffset(0)
, wavyMagnitude(0)
, wavyLerpIn(0)
@ -33,7 +33,7 @@ ElementEffectData::ElementEffectData()
, wavyWaving(false)
, wavyFlip(false)
, touching(false)
, elementEffectType(EFX_NONE)
, elementEffectIndex(-1)
{
}
@ -100,7 +100,6 @@ void Element::updateEffects(float dt)
/// check player position
{
// if a big wavy doesn't work, this is probably why
//if ((position - ent->position).isLength2DIn(1024))
{
ElementEffectData *eff = this->eff;
@ -142,7 +141,7 @@ void Element::updateEffects(float dt)
eff->wavy[i].x = eff->wavy[i].x*eff->wavyLerpIn + (eff->wavySave[i].x*(1.0f-eff->wavyLerpIn));
}
}
if (eff->wavyLerpIn < 1)
{
eff->wavyLerpIn += dt*lerpSpd;
@ -163,9 +162,9 @@ void Element::updateEffects(float dt)
eff->wavyMagnitude = 0;
}
//std::cout << "setting grid from wav w/ wavyWaving\n";
setGridFromWavy();
}
else
{
@ -210,7 +209,7 @@ void Element::setGridFromWavy()
{
if (drawGrid)
{
//std::cout << "set grid from wavy (" << xDivs << ", " << yDivs << ")\n"
const float w = float(getWidth());
for (int x = 0; x < xDivs-1; x++)
{
@ -220,7 +219,7 @@ void Element::setGridFromWavy()
const float tmp = eff->wavy[wavy_y].x / w;
if (wavy_y < eff->wavy.size())
{
drawGrid[x][y].x = tmp - 0.5f;
drawGrid[x+1][y].x = tmp + 0.5f;
}
@ -262,11 +261,7 @@ void Element::setElementEffectByIndex(int eidx)
break;
case EFX_WAVY:
{
/*
char buf[256];
sprintf(buf, "setting wavy segsy: %d radius: %d min: %d max: %d", e.segsy, e.wavy_radius, e.wavy_min, e.wavy_max);
debugLog(buf);
*/
eff->wavy.resize(e.segsy);
float bity = float(getHeight())/float(e.segsy);
for (int i = 0; i < eff->wavy.size(); i++)
@ -287,7 +282,7 @@ void Element::setElementEffectByIndex(int eidx)
setStatic(true);
break;
}
if (eff)
{
eff->elementEffectIndex = eidx;
@ -317,10 +312,10 @@ void Element::render()
renderBorderColor = Vector(1,1,1);
}
renderBorder = true;
//errorLog("!^!^$");
}
#endif
Quad::render();
renderBorder = false;
@ -340,11 +335,11 @@ void Element::fillGrid()
}
else if (elementFlag == EF_SOLID2)
{
dsq->game->fillGridFromQuad(this, OT_INVISIBLE, false);
dsq->game->fillGridFromQuad(this, OT_INVISIBLE, false);
}
else if (elementFlag == EF_SOLID3)
{
dsq->game->fillGridFromQuad(this, OT_INVISIBLEIN, false);
dsq->game->fillGridFromQuad(this, OT_INVISIBLEIN, false);
}
}
}

View file

@ -43,7 +43,7 @@ enum ElementFlag
};
struct ElementEffectData
{
{
ElementEffectData();
int elementEffectType;

View file

@ -25,5 +25,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif

View file

@ -50,7 +50,7 @@ void Emote::playSfx(int index)
if (emoteTimer > 0) return;
int r = 0;
if (emotes[index].variations > 1)
{
r = (rand()%emotes[index].variations)+1;

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@ using namespace tinyxml2;
class ManaBall;
class Path;
struct MinimapIcon;
struct BoneLock
{
@ -202,6 +203,7 @@ class Entity : public Quad, public StateMachine, public SoundHolder
{
public:
Entity();
virtual ~Entity();
virtual void init(){}
virtual void postInit(){}
@ -215,7 +217,7 @@ public:
ACT_RANGE = 1
};
void destroy();
//void damage(int amount, Spell *spell=0, Entity *attacker=0);
bool isEntityDead() const {return entityDead;}
std::string name;
Vector vel;
@ -236,14 +238,13 @@ public:
void push(const Vector &vec, float time, float maxSpeed, float dmg);
bool canSetState(int state);
virtual void message(const std::string &msg, int v) {}
virtual int messageVariadic(lua_State *L, int nparams) { return 0; }
bool isUnderWater(const Vector &o=Vector());
//virtual void onHitBySpell(Spell *spell) {}
//virtual void onCollide(Entity *e);
virtual bool damage(const DamageData &d);
virtual bool canShotHit(const DamageData &d) { return true; }
@ -311,7 +312,7 @@ public:
STATE_TITLE =24
};
virtual void onNotify(Entity *notify){}
//void followPath(Path *p, int spd, int loop, bool deleteOnEnd = false);
float followPath(Path *p, float speed, int dir, bool deleteOnEnd = false);
Entity *attachedTo;
bool touchAvatarDamage(int radius, float dmg, const Vector &override=Vector(-1,-1,-1), float speed=0, float pushTime = 0, Vector collidePos = Vector(0,0,0));
@ -332,7 +333,7 @@ public:
void doEntityAvoidance(float dt, int range, float mod, Entity *ignore =0);
void setMaxSpeed(float ms);
Entity *findTarget(int dist, int type, int t=0);
//bool hasTarget() { return target != 0; }
bool hasTarget(int t=0);
bool isTargetInRange(int range, int t=0);
void doGlint(const Vector &position, const Vector &scale=Vector(2,2), const std::string &tex="Glint", RenderObject::BlendTypes bt=BLEND_DEFAULT);
@ -395,7 +396,7 @@ public:
InterpolatedVector maxSpeedLerp;
Hair *hair;
void assignUniqueID();
void assignUniqueID(bool temporary);
int entityID;
int getMaxSpeed();
std::string deathSound;
@ -417,10 +418,7 @@ public:
Vector ridingOnEntityOffset;
void moveOutOfWall();
bool isSittingOnInvisibleIn();
/*
void setCrawling(bool on) { crawling = on; }
bool isCrawling() { return crawling; }
*/
void flipToVel();
bool isInCurrent() { return inCurrent; }
void clearTargetPoints();
@ -454,10 +452,10 @@ public:
void clampToHit();
bool updateLocalWarpAreas(bool affectAvatar);
virtual void entityDied(Entity *e);
//bool registerEntityDied;
bool clampToSurface(int tcheck=0, Vector usePos=Vector(0,0), TileVector hitTile=TileVector(0,0));
bool checkSurface(int tcheck, int state, float statet);
//static Shader blurShader;
std::string naijaReaction;
Vector lookAtPoint;
Vector getLookAtPoint();
@ -502,6 +500,9 @@ public:
Vector getPushVec() const { return pushVec; }
float getPushDamage() const { return pushDamage; }
MinimapIcon *minimapIcon;
MinimapIcon *ensureMinimapIcon();
protected:
bool calledEntityDied;
Path *waterBubble;
@ -528,7 +529,7 @@ protected:
int lance;
Bone *lanceBone;
void updateLance(float dt);
//InterpolatedVector blurShaderAnim;
int fhScale, fvScale;
@ -550,9 +551,9 @@ protected:
Vector getMoveVel();
DisabledDamageTypes disabledDamageTypes;
//bool crawling;
//Vector backupPos, backupVel;
virtual void onIdle() {}
virtual void onHeal(int type){}
virtual void onDamage(DamageData &d){}
@ -573,7 +574,7 @@ protected:
virtual void onFreeze(){}
//Entity *target;
std::vector<Entity*>targets;
virtual void onAlwaysUpdate(float dt){}
virtual void onUpdateFrozen(float dt){}
@ -584,7 +585,7 @@ protected:
void onEnterState(int action);
void onExitState(int action);
//virtual bool onDamage(int amount, Spell *spell, Entity *attacker);
bool invincibleBreak;
bool entityDead;
@ -601,10 +602,10 @@ protected:
float pushMaxSpeed;
std::string currentAnim;
protected:
Timer poisonTimer, poisonBitTimer;
float poison;
private:

View file

@ -1,62 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "DSQ.h"
void FFTNotes::load()
{
data.clear();
std::ifstream in("data/FFTNotes.txt");
std::string read;
while (std::getline(in, read))
{
std::istringstream is(read);
int n=0, v=0;
is >> n;
while (is >> v)
{
data[v] = n+1;
}
}
in.close();
}
int FFTNotes::getNoteFromFFT(int fft, int octave)
{
if (fft == 0)
return -1;
int v = data[fft]-1;
/*
std::ostringstream os;
os << "fftv: " << v;
debugLog(os.str());
*/
if (v == (octave+1)*10)
{
v = 7;
}
if (v > (octave+1)*10 || v < octave*10)
{
v = -1;
}
if (v != -1)
v -= octave*10; // : )
return v;
}

View file

@ -156,7 +156,7 @@ void PetSlot::onUpdate(float dt)
}
}
FoodHolder::FoodHolder(int slot, bool trash) : Quad(), slot(slot), trash(trash)
FoodHolder::FoodHolder(int slot, bool trash) : Quad(), trash(trash), slot(slot)
{
foodHolderIngredient = 0;
buttonDown = false;
@ -212,6 +212,11 @@ bool FoodHolder::isEmpty()
return (foodHolderIngredient == 0);
}
bool FoodHolder::isValid()
{
return this->alpha.x > 0 && this->alphaMod > 0;
}
IngredientData *FoodHolder::getIngredient()
{
return foodHolderIngredient;
@ -251,7 +256,7 @@ void FoodHolder::setIngredient(IngredientData *i, bool effects)
if (effects)
{
core->sound->playSfx("Wok");
ing->scale.ensureData();
ing->scale.data->path.clear();
ing->scale.data->path.addPathNode(Vector(1,1),0);
@ -264,6 +269,10 @@ void FoodHolder::setIngredient(IngredientData *i, bool effects)
}
}
void FoodHolder::toggleValid(bool v) {
this->alpha = this->alphaMod = (float) v;
}
void Game::enqueuePreviewRecipe()
{
enqueuedPreviewRecipe = 1;
@ -477,7 +486,7 @@ void FoodSlot::moveRight()
for (int i = foodHolders.size()-1; i >= 0; i--)
{
if (foodHolders[i]->alpha.x > 0 && foodHolders[i]->alphaMod > 0 && foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash())
if (foodHolders[i]->isValid() && foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash())
{
foodHolders[i]->setIngredient(ingredient);
inCookSlot = true;
@ -560,11 +569,11 @@ void FoodSlot::onUpdate(float dt)
dsq->game->foodLabel->alpha.interpolateTo(0, 2);
dsq->game->foodDescription->alpha.interpolateTo(0, 2);
break;
//return;
}
else if (foodHolders[i]->isEmpty())
else if (foodHolders[i]->isEmpty() && foodHolders[i]->isValid())
{
foodHolders[i]->setIngredient(ingredient);
inCookSlot = true;
@ -814,7 +823,7 @@ void TreasureSlot::onUpdate(float dt)
if (doubleClickTimer > 0)
{
doubleClickTimer = 0;
dsq->game->onUseTreasure(flag);
}
else
@ -822,7 +831,7 @@ void TreasureSlot::onUpdate(float dt)
dsq->sound->playSfx("treasure-select", 0.5);
dsq->spawnParticleEffect("menu-switch", worldRightCenter, 0, 0, LR_HUD3, 1);
dsq->game->treasureLabel->setText(treasureName);
dsq->game->treasureLabel->alpha = 1;
@ -889,7 +898,7 @@ void TreasureSlot::refresh()
h = sz;
w = (width*sz)/height;
}
setWidthHeight(w*scl, h*scl);
std::string parse = dsq->continuity.stringBank.get(flag);
@ -1020,7 +1029,7 @@ public:
Vector menuBgScale;
const int ITEMS_PER_PAGE = 12;
//const int ITEMS_PER_PAGE = 12;
ObsRow::ObsRow(int tx, int ty, int len) : tx(tx), ty(ty), len(len)
{
@ -1122,7 +1131,7 @@ Ingredient *Game::spawnIngredient(const std::string &ing, const Vector &pos, int
Ingredient *i = 0;
for (int c = 0; c < times; c++)
{
//HACK:
//HACK:
if (nocasecmp(ing, "poultice")==0)
use = "LeafPoultice";
@ -1295,7 +1304,7 @@ void Game::showInGameMenu(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
if (avatar && core->getNestedMains()==1 && !avatar->isSinging() && (ignoreInput || avatar->isInputEnabled()))
{
//dsq->toggleInputGrabPlat(false);
dsq->game->clearControlHint();
selectedTreasureFlag = -1;
@ -1449,7 +1458,7 @@ void Game::showInGameMenu(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
useMenuPage = dsq->continuity.lastMenuPage;
}
}
switch(useMenuPage)
{
@ -1490,7 +1499,7 @@ void Game::showInGameMenu(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
}
}
}
if (!optionsOnly)
{
@ -1500,14 +1509,14 @@ void Game::showInGameMenu(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
menu[i]->alpha.interpolateTo(1, 0.15);
}
menuIconGlow->alpha.interpolateTo(1, 0.5);
}
menuOpenTimer = 0;
inGameMenu = true;
dsq->routeShoulder = false;
@ -1515,7 +1524,7 @@ void Game::showInGameMenu(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
dsq->screenTransition->transition(MENUPAGETRANSTIME);
if (optionsOnly)
{
@ -1553,7 +1562,7 @@ void Game::hideInGameMenu(bool effects, bool cancel)
resBox->close();
//dsq->toggleInputGrabPlat(true);
if (effects)
core->sound->playSfx("Menu-Close");
@ -1588,7 +1597,7 @@ void Game::hideInGameMenu(bool effects, bool cancel)
toggleMainMenu(false);
toggleKeyConfigMenu(false);
}
menuIconGlow->alpha = 0;
for (i = 0; i < menu.size(); i++)
@ -1614,8 +1623,8 @@ void Game::hideInGameMenu(bool effects, bool cancel)
menuBg->alpha.interpolateTo(0, t);
menuBg->scale.interpolateTo(menuBg->scale*0.5f, t);
menuBg2->alpha.interpolateTo(0, t);
if (menuSongs)
menuSongs->alpha.interpolateTo(0, t);
@ -1645,8 +1654,7 @@ void Game::hideInGameMenu(bool effects, bool cancel)
for (int i = 0; i < songTips.size(); i++)
songTips[i]->alpha = 0;
for (int i = 0; i < dropIngrNames.size(); i++)
@ -1654,7 +1662,7 @@ void Game::hideInGameMenu(bool effects, bool cancel)
dsq->game->spawnIngredient(dropIngrNames[i], avatar->position + Vector(0,-96), 1, 1);
}
dropIngrNames.clear();
if (effects)
dsq->quitNestedMain();
@ -1866,7 +1874,7 @@ void Game::transitionToScene(std::string scene)
}
sceneToLoad = scene;
stringToLower(sceneToLoad);
core->enqueueJumpState("Game", false);
}
@ -1949,7 +1957,6 @@ void Game::clearObsRows()
void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
{
#ifdef BBGE_BUILD_OPENGL
if (q->texture)
{
std::vector<TileVector> obs;
@ -2079,7 +2086,6 @@ void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
}
glPopMatrix();
}
#endif
}
std::string Game::getNoteName(int n, const std::string &pre)
@ -2099,14 +2105,14 @@ void Game::clearDynamicGrid(unsigned char maskbyte /* = OT_MASK_BLACK */)
{
// just to be sure in case the grid/type sizes change,
// otherwise there is a chance to write a few bytes over the end of the buffer -- FG
compile_assert(sizeof(grid) % sizeof(uint32) == 0);
compile_assert(sizeof(grid) % sizeof(unsigned) == 0);
unsigned char *gridstart = &grid[0][0];
uint32 *gridend = (uint32*)(gridstart + sizeof(grid));
uint32 *gridptr = (uint32*)gridstart;
unsigned *gridend = (unsigned*)(gridstart + sizeof(grid));
unsigned *gridptr = (unsigned*)gridstart;
// mask out specific bytes
// use full uint32 rounds instead of single-bytes to speed things up.
const uint32 mask = maskbyte | (maskbyte << 8) | (maskbyte << 16) | (maskbyte << 24);
const unsigned mask = maskbyte | (maskbyte << 8) | (maskbyte << 16) | (maskbyte << 24);
do
{
*gridptr &= mask;
@ -2247,7 +2253,6 @@ float Game::getCoverage(Vector pos, int sampleArea)
{
if (x == t.x && y == t.y) continue;
TileVector ct(x,y);
Vector vt = ct.worldVector();
if (isObstructed(ct))
{
covered++;
@ -2534,7 +2539,7 @@ void Game::loadEntityTypeList()
//
entityGroups.push_back(newGroup);
curGroup = entityGroups.size()-1;
}
}
else if (!line.empty())
{
EntityGroupEntity ent;
@ -2659,7 +2664,7 @@ Entity* Game::establishEntity(Entity *e, int id, Vector position, int rot, bool
}
else
{
e->assignUniqueID();
e->assignUniqueID(!createSaveData); // when entity is placed on map, give positive ID; otherwise, if script-spawned, give negative ID
}
}
@ -2718,19 +2723,6 @@ void Game::initEntities()
}
}
void Game::assignEntitiesUniqueIDs()
{
FOR_ENTITIES(i)
{
Entity *e = *i;
if (e && e->entityID == 0)
{
e->assignUniqueID();
}
}
}
EntitySaveData *Game::getEntitySaveDataForEntity(Entity *e, Vector pos)
{
@ -2777,10 +2769,8 @@ void Game::setTimerText(float time)
void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */)
{
#ifdef BBGE_BUILD_OPENGL
if (q->texture)
{
q->collidePosition = Vector(0,0,0);
if (overrideCollideRadius)
q->collideRadius = overrideCollideRadius;
else
@ -2882,7 +2872,6 @@ void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */)
rot += 360;
*/
}
#endif
}
void Game::addPath(Path *p)
@ -3231,10 +3220,10 @@ void Game::sortFood()
dsq->continuity.sortByUnsort.push_back(FoodSortOrder(IT_NONE, IET_NONE, dsq->continuity.ingredients[i].name));
}
*/
std::vector<std::string> foodHolderNames;
foodHolderNames.resize(foodHolders.size());
for (int i = 0; i < foodHolders.size(); i++) {
IngredientData *ing = foodHolders[i]->getIngredient();
if (ing) {
@ -3247,22 +3236,22 @@ void Game::sortFood()
dsq->continuity.foodSortType++;
if (dsq->continuity.foodSortType >= MAX_FOODSORT)
dsq->continuity.foodSortType = 0;
dsq->continuity.sortFood();
// rebuild the page
refreshFoodSlots(false);
/*
toggleFoodMenu(false);
toggleFoodMenu(true);
*/
dsq->sound->playSfx("shuffle");
dsq->sound->playSfx("menu-switch", 0.5);
dsq->spawnParticleEffect("menu-switch", worldLeftCenter, 0, 0, LR_HUD3, 1);
for (int i = 0; i < foodHolders.size(); i++) {
if (!foodHolderNames[i].empty()) {
IngredientData *ing = dsq->continuity.getIngredientHeldByName(foodHolderNames[i]);
@ -3350,7 +3339,7 @@ void Game::createInGameMenu()
int h = controllabels->getHeight();
controllabels->position = Vector(checkx-16-w/2.0f, checky + h/2.0f - 14);
options->addChild(controllabels, PM_POINTER);
int scheckx=270;
@ -3485,7 +3474,7 @@ void Game::createInGameMenu()
// Vector(575,250);
songLabel = new BitmapText(&dsq->smallFont);
{
@ -3500,7 +3489,6 @@ void Game::createInGameMenu()
ToolTip *tip = 0;
foodTips.clear();
@ -3593,24 +3581,24 @@ void Game::createInGameMenu()
int offy = -20;
#define SB(x) dsq->continuity.stringBank.get(x)
TTFText *header_action = new TTFText(&dsq->fontArialSmall);
header_action->setText(SB(2101));
header_action->position = Vector(140, 80+offy);
group_keyConfig->addChild(header_action, PM_POINTER);
TTFText *header_key1 = new TTFText(&dsq->fontArialSmall);
header_key1->setText(SB(2102));
header_key1->position = Vector(350, 80+offy);
header_key1->setAlign(ALIGN_CENTER);
group_keyConfig->addChild(header_key1, PM_POINTER);
TTFText *header_key2 = new TTFText(&dsq->fontArialSmall);
header_key2->setText(SB(2103));
header_key2->position = Vector(475, 80+offy);
header_key2->setAlign(ALIGN_CENTER);
group_keyConfig->addChild(header_key2, PM_POINTER);
TTFText *header_joy = new TTFText(&dsq->fontArialSmall);
header_joy->setText(SB(2104));
header_joy->position = Vector(600, 80+offy);
@ -3634,7 +3622,7 @@ void Game::createInGameMenu()
AquariaKeyConfig* s1y = addAxesConfigLine(group_keyConfig, SB(2118), "s1ay", 340+offy, 130);
AquariaKeyConfig* s2x = addAxesConfigLine(group_keyConfig, SB(2119), "s2ax", 340+offy, 260);
AquariaKeyConfig* s2y = addAxesConfigLine(group_keyConfig, SB(2120), "s2ay", 340+offy, 380);
s1x->setDirMove(DIR_LEFT, s1x);
s1x->setDirMove(DIR_RIGHT, s1y);
@ -3648,7 +3636,7 @@ void Game::createInGameMenu()
s2y->setDirMove(DIR_RIGHT, s2y);
offy += 20;
addKeyConfigLine(group_keyConfig, SB(2121), "PrevPage", 340+offy);
addKeyConfigLine(group_keyConfig, SB(2122), "NextPage", 360+offy);
addKeyConfigLine(group_keyConfig, SB(2123), "CookFood", 380+offy);
@ -3657,7 +3645,7 @@ void Game::createInGameMenu()
addKeyConfigLine(group_keyConfig, SB(2126), "FoodDrop", 440+offy);
addKeyConfigLine(group_keyConfig, SB(2127), "Look", 460+offy);
addKeyConfigLine(group_keyConfig, SB(2128), "ToggleHelp", 480+offy);
#undef SB
@ -3670,7 +3658,7 @@ void Game::createInGameMenu()
group_keyConfig->position = Vector(0, -40);
addRenderObject(group_keyConfig, LR_OVERLAY);
cook = new AquariaMenuItem;
cook->useQuad("Gui/cook-button");
@ -3766,7 +3754,7 @@ void Game::createInGameMenu()
for (i = 0; i < foodHolders.size(); i++)
{
foodHolders[i] = new FoodHolder(i);
foodHolders[i]->alpha = 0;
foodHolders[i]->toggleValid(false);
float angle = (float(holders)/float(foodHolders.size()))*PI*2;
foodHolders[i]->position = rightCenter + Vector(sinf(angle), cosf(angle))*radius;
@ -3788,7 +3776,7 @@ void Game::createInGameMenu()
showRecipe->followCamera = 1;
showRecipe->position = Vector(575,250);
addRenderObject(showRecipe, LR_MENU);
float scrollx = 555;
recipeMenu.scroll = new Quad("gui/recipe-scroll", Vector(scrollx, 200));
recipeMenu.scroll->followCamera = 1;
@ -3815,7 +3803,7 @@ void Game::createInGameMenu()
recipeMenu.page->setText(dsq->continuity.stringBank.get(2006));
recipeMenu.page->alpha = 0;
addRenderObject(recipeMenu.page, LR_RECIPES);
recipeMenu.prevPage = new AquariaMenuItem;
recipeMenu.prevPage->useQuad("Gui/arrow-left");
recipeMenu.prevPage->useSound("click");
@ -3853,14 +3841,12 @@ void Game::createInGameMenu()
foodHolders.resize(4);
foodHolders[3] = new FoodHolder(-1, true);
foodHolders[3]->alpha = 0;
foodHolders[3]->toggleValid(false);
foodHolders[3]->position = rightCenter + Vector(96, 150);
menuBg->addChild(foodHolders[3], PM_POINTER);
int outer = 0;
int inner = 0;
for (i = 0; i < songSlots.size(); i++)
@ -3967,13 +3953,13 @@ void Game::createInGameMenu()
menu[4]->position = Vector(400,ty+10);
int gs = 40;
menu[5]->event.set(MakeFunctionEvent(Game, switchToSongMenu));
menu[5]->useQuad("gui/icon-songs");
menu[5]->useGlow("particles/glow", gs, gs);
menu[5]->useSound("Click");
menu[5]->position = Vector(400-60, 350);
menuIconGlow = new Quad("particles/glow", menu[5]->position);
menuIconGlow->alphaMod = 0.4;
menuIconGlow->alpha = 0;
@ -4028,7 +4014,7 @@ void Game::createInGameMenu()
((AquariaMenuItem*)menu[4])->setDirMove(DIR_UP, ((AquariaMenuItem*)menu[6]));
// ---------- FOOD MENU
@ -4040,7 +4026,7 @@ void Game::createInGameMenu()
for (i = 0; i < foodSlots.size(); i++)
{
foodSlots[i] = new FoodSlot(i);
float angle = (float(food)/float(foodSlots.size()))*PI*2;
foodSlots[i]->position = worldCenter + Vector(sinf(angle), cosf(angle))*foodSlotRadius;
@ -4087,7 +4073,7 @@ void Game::createInGameMenu()
// ---------- TREASURES
int treasureSlotRadius = 96;
treasureSlots.resize(treasurePageSize);
@ -5483,7 +5469,7 @@ bool Game::saveScene(std::string scene)
{
std::ostringstream& SE_rs = simpleElements_repeatScale[e->bgLayer];
SE_rs << e->repeatToFillScale.x << " "
<< e->repeatToFillScale.y << " ";
<< e->repeatToFillScale.y << " ";
}
}
@ -5779,10 +5765,10 @@ void Game::switchBgLoop(int v)
case 0:
if (!bgSfxLoop.empty())
{
PlaySfx sfx;
sfx.name = bgSfxLoop;
sfx.vol = bgSfxVol;
sfx.loops = -1;
PlaySfx sfx;
sfx.name = bgSfxLoop;
sfx.vol = bgSfxVol;
sfx.loops = -1;
sfx.priority = 0.8;
dsq->loops.bg = core->sound->playSfx(sfx);
}
@ -5790,10 +5776,10 @@ void Game::switchBgLoop(int v)
case 1:
if (!airSfxLoop.empty())
{
PlaySfx sfx;
sfx.name = airSfxLoop;
sfx.vol = bgSfxVol;
sfx.loops = -1;
PlaySfx sfx;
sfx.name = airSfxLoop;
sfx.vol = bgSfxVol;
sfx.loops = -1;
sfx.priority = 0.8;
dsq->loops.bg = core->sound->playSfx(sfx);
}
@ -6101,7 +6087,7 @@ void Game::action(int id, int state)
int trashIndex = -1;
for (int i = 0; i < foodHolders.size(); i++)
{
if (foodHolders[i]->alpha.x > 0 && foodHolders[i]->alphaMod > 0 && foodHolders[i]->isTrash())
if (foodHolders[i]->isValid() && foodHolders[i]->isTrash())
{
trashIndex = i;
break;
@ -6141,16 +6127,16 @@ void Game::toggleWorldMap()
void Game::applyState()
{
bool verbose = true;
applyingState = true;
applyingState = true;
helpText = 0;
helpUp = helpDown = 0;
inHelpScreen = false;
helpBG = 0;
helpBG2 = 0;
dsq->returnToScene = "";
// new place where mods get stopped!
// this lets recaching work
// (presumably because there has been time for the garbage to be cleared)
@ -6169,7 +6155,7 @@ void Game::applyState()
enqueuedPreviewRecipe = 0;
dsq->toggleBlackBars(false);
dsq->setTexturePointers();
@ -6240,9 +6226,9 @@ void Game::applyState()
{
dsq->game->setElementLayerVisible(i-LR_ELEMENTS1, true);
}
dsq->applyParallaxUserSettings();
controlHintTimer = 0;
cameraConstrained = true;
// reset parallax
@ -6476,15 +6462,12 @@ void Game::applyState()
if (toFlip == 1)
{
dsq->game->avatar->flipHorizontal();
toFlip = -1;
}
// li
@ -6806,8 +6789,6 @@ void Game::applyState()
cameraInterp = avatar->position;
core->cameraPos = getCameraPositionFor(avatar->position);
core->sort();
if (dsq->mod.isActive())
dsq->runScript(dsq->mod.getPath() + "scripts/premap_" + sceneName + ".lua", "init", true);
else
@ -6957,7 +6938,7 @@ void Game::applyState()
{
dsq->toggleCursor(true, 0.5);
}
dsq->forceInputGrabOff();
debugLog("Game::applyState Done");
@ -7380,7 +7361,7 @@ void Game::onCook()
goto endcook;
}
}
if(!data)
{
dsq->sound->playSfx("Denied");
@ -7421,12 +7402,12 @@ void Game::onCook()
longAnim = false;
for (int i = foodHolders.size()-1; i >= 0; i--)
if (foodHolders[i]->alpha.x > 0 && !foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash())
if (foodHolders[i]->isValid() && !foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash())
foodHolders[i]->animateLid(true, longAnim);
//dsq->main(0.2);
if (longAnim)
{
float ft = 0.8;
@ -7509,7 +7490,7 @@ void Game::onCook()
dsq->sound->playSfx("Cook");
for (int i = 0; i < foodHolders.size(); i++)
if (foodHolders[i]->alpha.x > 0 && !foodHolders[i]->isTrash())
if (foodHolders[i]->isValid() && !foodHolders[i]->isTrash())
foodHolders[i]->animateLid(false);
dsq->spawnParticleEffect("cook-food", Vector(575,250), 0, 0, LR_HUD3, 1);
@ -7733,7 +7714,7 @@ void Game::setControlHint(const std::string &h, bool left, bool right, bool midd
controlHint_image->alpha.interpolateTo(0, hintTransTime);
}
controlHint_text->position.x = 400 - controlHint_text->getSetWidth()/2 + 25;
//400 - controlHint_bg->getWidth()/2 + 25;
controlHint_text->setAlign(ALIGN_LEFT);
@ -7872,7 +7853,7 @@ void Game::toggleHelpScreen(bool on, const std::string &label)
helpWasPaused = isPaused();
togglePause(true);
std::string data;
// These say "Mac" but we use them on Linux, too.
@ -7893,7 +7874,7 @@ void Game::toggleHelpScreen(bool on, const std::string &label)
}
fname = localisePath("data/help_start.txt");
appendFileToString(data, fname);
// These say "Mac" but we use them on Linux, too.
#if defined(BBGE_BUILD_UNIX)
fname = localisePath("data/help_end_mac.txt");
@ -7941,7 +7922,7 @@ void Game::toggleHelpScreen(bool on, const std::string &label)
int line = helpText->findLine(label);
helpText->offset.interpolateTo(Vector(0, -helpText->getLineHeight()*line), -1200);
}
//helpText->offset.interpolateTo(Vector(0, -400), 4, -1, 1);
//test->position = Vector(400,300);
addRenderObject(helpText, LR_HELP);
@ -7986,7 +7967,7 @@ void Game::toggleHelpScreen(bool on, const std::string &label)
{
core->getRenderObjectLayer(i)->visible = false;
}
core->resetTimer();
dsq->screenTransition->transition(MENUPAGETRANSTIME);
@ -8277,11 +8258,9 @@ void Game::playBurstSound(bool wallJump)
sound->playSfx("Burst", 1);
if (chance(50))
{
switch (dsq->continuity.form)
if (dsq->continuity.form == FORM_BEAST)
{
case FORM_BEAST:
sound->playSfx("BeastBurst", (128+rand()%64)/256.0f);
break;
}
}
}
@ -8409,21 +8388,15 @@ Bone *Game::collideSkeletalVsCircle(Entity *skeletal, Vector pos, float radius)
{
Bone *b = skeletal->skeletalSprite.bones[i];
if (b->alpha.x == 1 && b->renderQuad)
if (b->alpha.x == 1 && b->renderQuad &&
(!b->collisionMask.empty() || b->collideRadius) // check this here to avoid calculating getWorldCollidePosition() if not necessary
)
{
float checkRadius = sqr(radius+b->collisionMaskRadius);
Vector bonePos = b->getWorldCollidePosition();
float dist = (bonePos - pos).getSquaredLength2D();
// BOUND RECT METHOD
if (!b->collisionRects.empty())
{
for (int i = 0; i < b->collisionRects.size(); i++)
{
b->collisionRects[i].isCoordinateInside(pos, radius);
}
}
// MULTIPLE CIRCLES METHOD
else if (!b->collisionMask.empty())
if (!b->collisionMask.empty())
{
if (dist < checkRadius)
{
@ -8467,7 +8440,7 @@ void Game::preLocalWarp(LocalWarpType localWarpType)
{
dsq->game->avatar->warpInLocal = Vector(0,0,0);
}
dsq->screenTransition->capture();
core->resetTimer();
}
@ -8726,7 +8699,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;
dir.setLength2D(800);
@ -9101,10 +9074,7 @@ void Game::toggleFoodMenu(bool f)
for (int i = 0; i < foodHolders.size(); i++)
{
if (f)
foodHolders[i]->alpha = 1;
else
foodHolders[i]->alpha = 0;
foodHolders[i]->toggleValid(f);
}
if (f)
@ -9112,16 +9082,16 @@ void Game::toggleFoodMenu(bool f)
if (dsq->game->avatar)
{
Path *p=0;
if (dsq->continuity.getFlag(FLAG_UPGRADE_WOK) > 0
if (dsq->continuity.getFlag(FLAG_UPGRADE_WOK) > 0
|| ((p=dsq->game->getNearestPath(dsq->game->avatar->position, PATH_COOK))
&& p->isCoordinateInside(dsq->game->avatar->position)))
{
//cook->alpha = 1;
foodHolders[0]->alpha = 1;
foodHolders[0]->toggleValid(true);
}
else
{
foodHolders[0]->alpha = 0;
foodHolders[0]->toggleValid(false);
}
}
}
@ -9193,7 +9163,7 @@ void Game::toggleFoodMenu(bool f)
foodLabel->alphaMod = 0;
foodLabel->alpha = 0;
foodDescription->alpha = 0;
foodSort->alpha = 0;
foodSort->alpha = 0;
showRecipe->alpha = 0;
liCrystal->alpha = 0;
@ -9296,7 +9266,7 @@ void Game::toggleKeyConfigMenu(bool f)
{
const float t = 0;
playingSongInMenu = -1;
if (f && !keyConfigMenu)
{
@ -9342,13 +9312,13 @@ void Game::toggleKeyConfigMenu(bool f)
opt_cancel->alpha = 1;
opt_save->alpha = 1;
opt_save->position = opt_save_original + Vector(0, 120);
opt_cancel->position = opt_cancel_original + Vector(0, 120);
opt_cancel->setFocus(true);
menuIconGlow->alpha = 0;
//dsq->screenTransition->transition(MENUPAGETRANSTIME);
@ -9365,7 +9335,7 @@ void Game::toggleKeyConfigMenu(bool f)
opt_save->position = opt_save_original;
opt_cancel->position = opt_cancel_original;
menuIconGlow->alpha = 1;
}
}
@ -9384,7 +9354,7 @@ void Game::toggleOptionsMenu(bool f, bool skipBackup, bool isKeyConfig)
{
dsq->continuity.lastOptionsMenuPage = currentMenuPage;
}
toggleFoodMenu(false);
optionsMenu = true;
voxslider->setValue(dsq->user.audio.voxvol);
@ -9454,7 +9424,7 @@ void Game::toggleOptionsMenu(bool f, bool skipBackup, bool isKeyConfig)
liCrystal->alpha = 1;
optionsMenu = true;
menuIconGlow->alpha = 0;
/*
@ -9467,7 +9437,7 @@ void Game::toggleOptionsMenu(bool f, bool skipBackup, bool isKeyConfig)
lips->alpha = 0;
keyConfigButton->alpha = 0;
options->alpha.interpolateTo(0, t);
opt_cancel->alpha = 0;
@ -9485,7 +9455,7 @@ void Game::toggleOptionsMenu(bool f, bool skipBackup, bool isKeyConfig)
optionsMenu = false;
if (!optionsOnly)
{
for (int i = 0; i <= 1; i++)
@ -9523,12 +9493,12 @@ void Game::toggleOptionsMenu(bool f, bool skipBackup, bool isKeyConfig)
//((AquariaMenuItem*)menu[4])->setFocus(true);
menuBg2->alpha.interpolateTo(1, t);
}
menuIconGlow->alpha = 1;
}
}
@ -9594,8 +9564,6 @@ void Game::updateOptionsMenu(float dt)
{
dsq->sound->playSfx("denied");
dsq->loops.updateVolume();
if (dsq->game->avatar)
dsq->game->avatar->updateHeartbeatSfx();
}
if (voxslider->isGrabbed())
{
@ -9774,7 +9742,7 @@ void Game::updateCursor(float dt)
// instant during map fadeout).
if (dsq->inputMode == INPUT_MOUSE || isSceneEditorActive() || dsq->game->isPaused())
dsq->cursor->alphaMod = 0.5;
/*
dsq->cursor->offset.stop();
dsq->cursor->offset = Vector(0,0);
@ -10022,7 +9990,7 @@ const float helpTextScrollSpeed = 800.0f;
const float helpTextScrollClickAmount = 340.0f;
const float helpTextScrollClickTime = -helpTextScrollSpeed;
void Game::onHelpDown()
{
{
float to = helpText->offset.y - helpTextScrollClickAmount;
if (to < -helpText->getHeight() + core->getVirtualHeight())
{
@ -10415,7 +10383,7 @@ void Game::update(float dt)
if (cameraFollow)
{
Vector dest = *cameraFollow;
if (avatar)
{
if (avatar->looking && !dsq->game->isPaused()) {
@ -10438,8 +10406,6 @@ void Game::update(float dt)
cameraInterp.interpolateTo(dest, cameraLerpDelay);
dsq->cameraPos = getCameraPositionFor(cameraInterp);
constrainCamera();
float dd = (dsq->cameraPos - oldCamPos).getLength2D();
}
cameraInterp.update(dt);
@ -10619,7 +10585,7 @@ ElementTemplate Game::getElementTemplateForLetter(int i)
void Game::loadElementTemplates(std::string pack)
{
stringToLower(pack);
stringToLower(pack);
/*
std::string fn = ("data/"+pack+".xml");
if (!exists(fn))
@ -10754,7 +10720,7 @@ void Game::removeState()
const float fadeTime = 0.25;
dsq->toggleVersionLabel(false);
dsq->subtitlePlayer.hide(fadeTime);
dropIngrNames.clear();

View file

@ -58,7 +58,7 @@ struct RecipeMenu
Quad *scrollEnd;
BitmapText *header, *page, *description;
AquariaMenuItem *nextPage, *prevPage;
void toggle(bool on, bool watch=false);
void createPage(int p);
@ -68,7 +68,7 @@ struct RecipeMenu
void goPrevPage();
int getNumPages();
int getNumKnown();
int currentPage;
bool on;
@ -100,7 +100,7 @@ const float MIN_SIZE = 0.1;
#undef AQUARIA_BUILD_SCENEEDITOR
#endif
//#include "GridRender.h"
class GridRender;
class MiniMapRender;
class WaterSurfaceRender;
@ -135,6 +135,20 @@ enum EditTypes
};
#endif
// impl is in Minimap.cpp
struct MinimapIcon
{
MinimapIcon();
bool setTexture(std::string);
void update(float dt);
CountedPtr<Texture> tex;
InterpolatedVector color, alpha, size;
float throbMult;
bool scaleWithDistance;
static const Vector defaultSize;
};
class ManaBall : public Quad
{
public:
@ -269,7 +283,9 @@ public:
bool isEmpty();
bool isTrash();
bool isValid();
void setIngredient(IngredientData *i, bool effects=true);
void toggleValid(bool v);
void dropFood();
IngredientData *getIngredient();
void animateLid(bool down, bool longAnim=true);
@ -349,7 +365,7 @@ class EntityClass
{
public:
EntityClass(std::string name, bool script=false, int idx=-1, std::string prevGfx="", float prevScale=1)
: name(name), script(script), idx(idx), prevGfx(prevGfx), prevScale(prevScale) {}
: name(name), prevScale(prevScale), prevGfx(prevGfx), script(script), idx(idx) {}
std::string name;
float prevScale;
std::string prevGfx;
@ -465,7 +481,6 @@ public:
bool multiSelecting;
Vector multiSelectPoint;
std::vector <Element*> selectedElements;
void fixEntityIDs();
Vector groupCenter;
Vector getSelectedElementsCenter();
@ -474,9 +489,9 @@ public:
void updateSelectedElementPosition(Vector position);
int selectedEntityType;
//int curEntity;
SelectedEntity selectedEntity;
//EntityGroups::iterator page;
int entityPageNum;
void checkForRebuild();
@ -573,6 +588,7 @@ typedef std::vector<QuadList> QuadArray;
typedef std::vector<Element*> ElementUpdateList;
// Note: although this is a bitmask, only one of these values may be set at a time!
// This is because GridRender and most Lua scripts check via ==, not for bits set (Lua 5.1 doesn't have bit ops)
enum ObsType
{
OT_EMPTY = 0x00,
@ -597,6 +613,8 @@ enum ObsType
OT_USER1 = 0x40,
OT_USER2 = 0x80,
OT_USER_MASK = OT_USER1 | OT_USER2,
OT_OUTOFBOUNDS = 0xff
};
struct EntitySaveData
@ -617,7 +635,7 @@ public:
void removeState();
void update(float dt);
void onLeftMouseButton();
//std::vector<Item*>items;
Avatar *avatar;
Entity *li;
@ -626,7 +644,7 @@ public:
FoodSlot *moveFoodSlotToFront;
//void doChoiceMenu(Vector position, std::vector<std::string> choices);
std::string getSelectedChoice() { return selectedChoice; }
@ -636,6 +654,7 @@ public:
void setGrid(const TileVector &tile, ObsType v);
void addGrid(const TileVector &tile, ObsType v);
bool isObstructed(const TileVector &tile, int t = OT_BLOCKING) const;
bool isObstructedRaw(const TileVector &tile, int t) const;
void trimGrid();
void dilateGrid(unsigned int radius, ObsType test, ObsType set, ObsType allowOverwrite);
@ -682,7 +701,7 @@ public:
void handleShotCollisionsHair(Entity *e, int num = 0, float perc = 0);
std::vector<ElementTemplate> elementTemplates;
std::string sceneName;
std::string sceneName, sceneDisplayName;
ElementTemplate *getElementTemplateByIdx(int idx);
@ -807,8 +826,8 @@ public:
Precacher tileCache;
//void cameraPanToNode(Path *p, int speed=500);
//void cameraRestore();
void setCameraFollow(Vector *position);
Shot *fireShot(Entity *firer, const std::string &particleEffect, Vector position, bool big, Vector direction, Entity *target, int homing=0, int velLenOverride=0, int targetPt=-1);
Shot *fireShot(const std::string &bankShot, Entity *firer, Entity *target=0, const Vector &pos=Vector(0,0,0), const Vector &aim=Vector(0,0,0), bool playSfx=true);
@ -893,7 +912,7 @@ public:
void selectEntityFromGroups();
InterpolatedVector cameraInterp;
//InterpolatedVector tintColor;
float getWaterLevel();
void setMusicToPlay(const std::string &musicToPlay);
Vector lastCollidePosition;
@ -1030,7 +1049,7 @@ protected:
bool isCooking;
void doMenuSectionHighlight(int sect);
float cookDelay;
float ingOffY;
@ -1041,7 +1060,7 @@ protected:
void onPrevRecipePage();
void onNextRecipePage();
typedef std::vector<IngredientData*> CookList;
CookList cookList;
@ -1088,7 +1107,6 @@ protected:
Quad *options;
Quad *image;
void assignEntitiesUniqueIDs();
void initEntities();
@ -1147,12 +1165,7 @@ protected:
float deathTimer;
/*
void onAssignMenuScreenItemToSlot0();
void onAssignMenuScreenItemToSlot1();
void onAssignMenuScreenItemToSlot2();
void onAssignMenuScreenItemToSlot3();
*/
void onInGameMenuInventory();
void onInGameMenuSpellBook();
@ -1215,7 +1228,7 @@ ObsType Game::getGridRaw(const TileVector &tile) const
{
return (unsigned(tile.x) < unsigned(MAX_GRID) && unsigned(tile.y) < unsigned(MAX_GRID))
? ObsType(grid[tile.x][tile.y])
: OT_INVISIBLE;
: OT_OUTOFBOUNDS;
}
inline
@ -1257,4 +1270,10 @@ bool Game::isObstructed(const TileVector &tile, int t /* = OT_BLOCKING */) const
return (getGrid(tile) & t);
}
inline
bool Game::isObstructedRaw(const TileVector &tile, int t) const
{
return (getGridRaw(tile) & t);
}
#endif

View file

@ -56,11 +56,7 @@ void GameplayVariables::load()
inFile >> s >> zoomNaija;
inFile >> s >> maxOutOfWaterSpeed;
inFile >> s >> defaultCameraLerpDelay;
/*
inFile >> s >> initialId;
inFile >> s >> initialEgo;
inFile >> s >> initialSuperEgo;
*/
inFile.close();
}

View file

@ -29,8 +29,8 @@ GasCloud::GasCloud(Entity *source, const Vector &position, const std::string &pa
this->poisonTime = poisonTime;
this->particles = particles;
//this->gfx = gfx;
//this->isMoney = isMoney;
this->position = position;
this->damage = damage;
this->radius = radius;
@ -46,10 +46,10 @@ GasCloud::GasCloud(Entity *source, const Vector &position, const std::string &pa
emitter->load(particles);
emitter->start();
emitter->setDie(true);
//emitter->parentManagedStatic = true;
//addChild(&emitter);
dsq->game->addRenderObject(emitter, LR_PARTICLES);
//setDamageTarget(DT_ENEMY_GAS, false)
setEntityType(ET_NEUTRAL);
deathSound = "";
@ -96,32 +96,7 @@ void GasCloud::onUpdate(float dt)
}
}
/*
pTimer += dt;
while (pTimer > pSpawnRate)
{
int a = rand()%360;
int r = rand()%radius;
Vector pos = position;
pos += Vector(sinf(a)*r, cosf(a)*r);
Quad *quad = new Quad;
{
quad->rotation.z = rand()%360;
quad->position = pos;
quad->color = color;
quad->setTexture(gfx);
quad->alpha.path.addPathNode(0, 0);
quad->alpha.path.addPathNode(0.5, 0.2);
quad->alpha.path.addPathNode(0.5, 0.8);
quad->alpha.path.addPathNode(0, 1);
quad->alpha.startPath(3);
quad->scale = Vector(0.5, 0.5);
quad->scale.interpolateTo(Vector(2,2),4);
}
dsq->getTopStateData()->addRenderObject(quad, LR_PARTICLES);
pTimer -= pSpawnRate;
}
*/
}
else
{

View file

@ -24,18 +24,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
GridRender::GridRender(ObsType obsType) : RenderObject()
{
color = Vector(1, 0, 0);
//color = Vector(0.2,0.2,1);
position.z = 5;
cull = false;
alpha = 0.5f;
this->obsType = obsType;
blendEnabled = false;
//setTexture("grid");
}
void GridRender::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
RenderObject::onUpdate(dt);
if (obsType != OT_BLACK) { blendEnabled = true; }
}
@ -46,22 +46,13 @@ inline static void doRenderGrid(int x, int startCol, int endCol)
const int drawy1 = startCol*TILE_SIZE;
const int drawy2 = (endCol+1)*TILE_SIZE;
#ifdef BBGE_BUILD_OPENGL
glBegin(GL_QUADS);
glVertex3i(drawx1, drawy2, 0.0f);
glVertex3i(drawx2, drawy2, 0.0f);
glVertex3i(drawx2, drawy1, 0.0f);
glVertex3i(drawx1, drawy1, 0.0f);
glEnd();
#endif
#ifdef BBGE_BUILD_DIRECTX
core->blitD3DVerts(0,
drawx1, drawy1,
drawx2, drawy1,
drawx2, drawy2,
drawx1, drawy2);
#endif
}
void GridRender::onRender()
@ -159,11 +150,10 @@ void SongLineRender::clear()
void SongLineRender::onRender()
{
int w=core->getWindowWidth();
//core->getWindowWidth(&w);
int ls = (4*w)/1024.0f;
if (ls < 0)
ls = 1;
#ifdef BBGE_BUILD_OPENGL
glLineWidth(ls);
const int alphaLine = pts.size()*(0.9f);
float a = 1;
@ -173,11 +163,10 @@ void SongLineRender::onRender()
if (i < alphaLine)
a = float(i)/float(alphaLine);
else
a = 1;
a = 1;
glColor4f(pts[i].color.x, pts[i].color.y, pts[i].color.z, a);
glVertex2f(pts[i].pt.x, pts[i].pt.y);
}
glEnd();
#endif
}

View file

@ -63,8 +63,17 @@ protected:
float lightLevel;
void onUpdate(float dt);
void onRender();
void renderIcon(MinimapIcon *ico, const Vector& pos);
InterpolatedVector lerp;
public:
static bool setWaterBitTex(const std::string& name);
static bool setTopTex(const std::string& name);
static bool setBottomTex(const std::string& name);
static bool setAvatarTex(const std::string& name);
static bool setHealthBarTex(const std::string& name);
static bool setMaxHealthMarkerTex(const std::string& name);
};
class WorldMapRender : public RenderObject, public ActionMapper

View file

@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Hair.h"
#include "DSQ.h"
// nodes = 40
// segmentLength = 3
Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
{
this->segmentLength = segmentLength;
@ -33,8 +33,8 @@ Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
cull = false;
hairNodes.resize(nodes);
// nodes: 20 length: 6
//segmentLength = 3;
for (int i = 0; i < hairNodes.size(); i++)
{
float perc = (float(i)/(float(hairNodes.size())));
@ -47,64 +47,14 @@ Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
void Hair::exertWave(float dt)
{
/*
Vector diff = headPos - position;
Vector diff2;
if (!isFlippedHorizontal())
diff2 = diff.getPerpendicularLeft();
else
diff2 = diff.getPerpendicularRight();
Vector diff3 = position - headPos;
float len =diff2.getLength2D();
diff3.setLength2D(len);
hairTimer += dt;
while (hairTimer > 2.0f)
{
hairTimer -= 2.0f;
}
float useTimer = hairTimer;
if (useTimer > 1.0f)
useTimer = 1.0f - (hairTimer-1);
float frc = 0.5;
diff = (diff2*(frc*(1.0f-(useTimer*0.5f))) + diff3*(frc);
diff.setLength2D(400);
//if (!vel.isLength2DIn(10))
exertForce(diff, dt);
*/
}
void Hair::exertGravityWave(float dt)
{
/*
Vector diff = headPos - position;
Vector diff2;
if (!isFlippedHorizontal())
diff2 = diff.getPerpendicularLeft();
else
diff2 = diff.getPerpendicularRight();
Vector diff3 = position - headPos;
float len =diff2.getLength2D();
diff3.setLength2D(len);
hairTimer += dt;
while (hairTimer > 2.0f)
{
hairTimer -= 2.0f;
}
float useTimer = hairTimer;
if (useTimer > 1.0f)
useTimer = 1.0f - (hairTimer-1);
float frc = 0.333333;
diff = (diff2*(frc*(1.0f-(useTimer*0.5f))) + diff3*(frc) + Vector(0,len)*(frc*(0.5f+useTimer*0.5f)));
diff.setLength2D(400);
//if (!vel.isLength2DIn(10))
exertForce(diff, dt);
*/
}
void Hair::setHeadPosition(const Vector &vec)
@ -125,16 +75,15 @@ HairNode *Hair::getHairNode(int idx)
void Hair::onRender()
{
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
glBegin(GL_QUAD_STRIP);
float texBits = 1.0f / (hairNodes.size()-1);
//float height2 = 2.5f;
Vector pl, pr;
for (int i = 0; i < hairNodes.size(); i++)
{
//glNormal3f( 0.0f, 0.0f, 1.0f);
if (i != hairNodes.size()-1)
{
@ -144,14 +93,6 @@ void Hair::onRender()
pr = diffVec.getPerpendicularRight();
}
/*
if (hairNodes[i].problem)
{
glColor3f(1,0,0);
}
else
glColor3f(1,1,1);
*/
glTexCoord2f(0, texBits*i);
@ -159,99 +100,33 @@ void Hair::onRender()
glTexCoord2f(1, texBits*i);
glVertex3f( hairNodes[i].position.x + pr.x, hairNodes[i].position.y + pr.y, 0);
//float angle = 0;
/*
float angle = 0;
if (i < hairNodes.size()-1)
{
MathFunctions::calculateAngleBetweenVectorsInDegrees(hairNodes[i+1].position, hairNodes[i].position, angle);
angle += 90;
angle = (angle*PI)/180.0f;
}
*/
/*
glTexCoord2f(0, 1-texBits*i);
glVertex3f(hairNodes[i].position.x -sinf(angle)*hairWidth, hairNodes[i].position.y + cosf(angle)*height2, 0);
glTexCoord2f(1, 1-texBits*i);
glVertex3f( hairNodes[i].position.x + sinf(angle)*hairWidth, hairNodes[i].position.y + cosf(angle)*height2, 0);
*/
}
glEnd();
/*
glColor3f(1,1,1);
for (int i = 0; i < hairNodes.size(); i++)
{
std::ostringstream os;
os << hairNodes[i].angleDiff;
core->print(hairNodes[i].position.x, hairNodes[i].position.y, os.str().c_str(), 6);
}
*/
//glEnable(GL_CULL_FACE);
#endif
}
void Hair::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
/*
// straighten hair
if (hairNodes.size()>2)
{
Vector d1 = hairNodes[1].position - hairNodes[0].position;
for (int i = 2; i < hairNodes.size(); i++)
{
Vector d2 = hairNodes[i].position - hairNodes[i-1].position;
Vector wantPos = hairNodes[i-1].position + d1;
float perc = 1.0f-float(i)/float(hairNodes.size());
hairNodes[i].position += (wantPos - hairNodes[i].position)*dt*(40 * perc);
//Vector d1 = hairNodes[i-1].position - hairNodes[i-2].position;
//Vector d2 = hairNodes[i].position - hairNodes[i-1].position;
//float prod = d1.dot2D(d2);
////if (prod < 0.5f)
//{
// d1.setLength2D(segmentLength);
//
// Vector wantPos = (hairNodes[i-1].position + d1)*0.5f + hairNodes[i].position*0.5f;
// hairNodes[i].position += (wantPos - hairNodes[i].position)*dt*10;
// break;
//}
}
}
*/
}
void Hair::updatePositions()
{
BBGE_PROF(Hair_updatePositions);
//int minLength = 1;
/*
Vector accum;
for (int i = 1; i < hairNodes.size(); i++)
{
Vector diff = hairNodes[i].position - hairNodes[i-1].position;
accum += diff;
}
accum /= float(hairNodes.size()-1);
*/
for (int i = 1; i < hairNodes.size(); i++)
{
Vector diff = hairNodes[i].position - hairNodes[i-1].position;
/*
if (diff.getLength2D() < 1)
{
diff = accum;
}
*/
/*
if (diff.getLength2D() <= 1)
{
diff = hairNodes[i].position - hairNodes[0].position;
}
*/
if (diff.getLength2D() < segmentLength)
{
@ -260,181 +135,13 @@ void Hair::updatePositions()
}
else if (diff.getLength2D() > segmentLength)
{
//diff |= segmentLength;
diff.setLength2D(segmentLength);
hairNodes[i].position = hairNodes[i-1].position + diff;
}
/*
if (i > 1)
{
Vector d1 = hairNodes[i-1].position - hairNodes[i-2].position;
Vector d2 = hairNodes[i].position - hairNodes[i-1].position;
float prod = d1.dot2D(d2);
float a1 = 0, a2 = 0;
float maxAngle = 0.3;
MathFunctions::calculateAngleBetweenVectorsInRadians(d1, Vector(0,0,0), a1);
MathFunctions::calculateAngleBetweenVectorsInRadians(d2, Vector(0,0,0), a2);
float a = a2 - a1;
hairNodes[i].angleDiff = a;
if (fabsf(a) > maxAngle)
{
float len = d2.getLength2D();
//d2 = d1;
Vector dt1 = d1;
Vector dt2 = d1;
dt1.rotate2D(-maxAngle);
dt2.rotate2D(maxAngle);
//if (a < 0)
// d2.rotate2D(-maxAngle);
//else
// d2.rotate2D(maxAngle);
//d2.setLength2D(len);
//hairNodes[i].position = hairNodes[i-1].position + d2;
dt1 = hairNodes[i-1].position + dt1;
dt2 = hairNodes[i-1].position + dt2;
if ((hairNodes[i].position - dt1).getSquaredLength2D() < (hairNodes[i].position - dt2).getSquaredLength2D())
{
hairNodes[i].position = dt1;
}
else
hairNodes[i].position = dt2;
hairNodes[i].problem = true;
}
else
{
hairNodes[i].problem = false;
}
}
*/
/*
int diffLength = segmentLength * 2;
Vector accum;
int c=0;
for (int j = 0; j < hairNodes.size(); j++)
{
if (j != i && j != i-1 && j != i+1)
{
Vector diff = hairNodes[i].position - hairNodes[j].position;
if (diff.getLength2D() < diffLength)
{
diff.setLength2D(diffLength);
//hairNodes[i].position = hairNodes[j].position + diff;
accum += hairNodes[j].position + diff;
c++;
//break;
}
}
}
if (!accum.isZero())
{
accum /= c;
//hairNodes[i].position = (hairNodes[i].position + accum)*0.5f;
hairNodes[i].position = accum;
}
*/
/*
if (i > 1)
{
Vector d1 = hairNodes[i-1].position - hairNodes[i-2].position;
Vector d2 = hairNodes[i].position - hairNodes[i-1].position;
float prod = d1.dot2D(d2);
if (prod < -0.5f)
{
//d1.setLength2D(d2.getLength2D());
Vector wantPos = hairNodes[i-1].position + d1;
hairNodes[i].position = wantPos;//hairNodes[i].position*0.75f + wantPos*0.25f;
//
//d2 = (d2 + d1)*0.5f;
//hairNodes[i].position = hairNodes[i-1].position + d1;
}
}
*/
/*
if (i > 1)
{
//float a1,a2;
float a1=0;
// MathFunctions::calculateAngleBetweenVectorsInRadians(hairNodes[i].position, hairNodes[i-1].position, a1);
MathFunctions::calculateAngleBetweenVectorsInRadians(hairNodes[i-1].position, hairNodes[i-2].position, a1);
Vector d1 = hairNodes[i-1].position - hairNodes[i-2].position;
Vector d2 = hairNodes[i].position - hairNodes[i-1].position;
float a=0;
MathFunctions::calculateAngleBetweenVectorsInRadians(d2, d1, a);
//float d = a2 - a1, c=PI/2;
float c=PI/2;
float d=0;
bool adjust = 0;
if (a > c)
{
d = a1 + c;
adjust = 1;
}
else if (a < -c)
{
d = a1 - c;
adjust = -1;
}
if (adjust)
{
Vector add(sinf(d), cosf(d));
add.setLength2D(d2.getLength2D());
hairNodes[i].position = hairNodes[i-1].position + add;
}
//Vector diff2 = hairNodes[i-1] - hairNodes[i-2].position;
//hairNodes[i].position = hairNodes[i-1].position + diff;
}
*/
/*
if (i < hairNodes.size()-1)
{
Vector diff2 = hairNodes[i+1].position - hairNodes[i].position;
float a=0,c=PI/2;
bool adjust = false;
MathFunctions::calculateAngleBetweenVectorsInRadians(hairNodes[i+1].position, hairNodes[i].position, a);
if (a > c)
{
a = c;
adjust = true;
}
else if (a < -c)
{
a = -c;
adjust = true;
}
if (adjust)
{
Vector add(sinf(a), cosf(a));
add *= diff2.getLength2D();
hairNodes[i+1].position = hairNodes[i].position + add;
}
}
*/
/*
else if (diff.getLength2D() < minLength)
{
*/
/*
diff.setLength2D(minLength);
hairNodes[i].position = hairNodes[i-1].position + diff;
*/
//}
}
@ -474,15 +181,7 @@ void Hair::exertForce(const Vector &force, float dt, int usePerc)
hairNodes[i].position += force*dt;
break;
}
/*
Vector diff = hairNodes[i].position - hairNodes[i-1].position;
if (diff.getSquaredLength2D() > sqr(segmentLength))
{
diff |= segmentLength;
hairNodes[i].position = hairNodes[i-1].position + diff;
}
*/
}
}

View file

@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Avatar.h"
IngredientData::IngredientData(const std::string &name, const std::string &gfx, IngredientType type)
: name(name), gfx(gfx), amount(0), maxAmount(MAX_INGREDIENT_AMOUNT), held(0), type(type), marked(0), sorted(false)
, displayName(dsq->continuity.getIngredientDisplayName(name))
, rotKind(!(type == IT_OIL || type == IT_EGG))
: name(name)
, gfx(gfx)
, displayName(dsq->continuity.getIngredientDisplayName(name))
, type(type)
, amount(0)
, maxAmount(MAX_INGREDIENT_AMOUNT)
, held(0)
, marked(0)
, rotKind(!(type == IT_OIL || type == IT_EGG))
{
}
@ -38,13 +44,17 @@ bool IngredientData::hasIET(IngredientEffectType iet)
for (IngredientEffects::iterator i = effects.begin(); i != effects.end(); i++)
{
if ((*i).type == iet)
return true;
return true;
}
return false;
}
Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount)
: Entity(), data(data), amount(amount), gone(false), used(false)
: Entity()
, data(data)
, used(false)
, gone(false)
, amount(amount)
{
addType(SCO_INGREDIENT);
entityType = ET_INGREDIENT;
@ -59,7 +69,7 @@ Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount)
velocity = randVector(mag)*0.5f + Vector(0, -mag)*0.5f;
else
velocity = Vector(0,-mag*0.5f);
gravity = Vector(0, 250); //300
gravity = Vector(0, 250);
scale = Vector(0.2,0.2);
scale.interpolateTo(Vector(1, 1), 0.75);
@ -89,7 +99,7 @@ bool Ingredient::isRotKind()
IngredientData *Ingredient::getIngredientData()
{
return data;
return data;
}
void Ingredient::eat(Entity *e)
@ -110,12 +120,7 @@ void Ingredient::onUpdate(float dt)
if (dsq->game->collideCircleWithGrid(position, 24))
{
position = lastPosition;
/*
if (velocity.x < velocity.y)
velocity.x = -velocity.x;
else
velocity.y = -velocity.y;
*/
velocity = 0;
}
@ -145,7 +150,7 @@ void Ingredient::onUpdate(float dt)
dsq->game->pickupIngredientEffects(data);
dsq->spawnParticleEffect("IngredientCollect", position);
dsq->sound->playSfx("pickup-ingredient");
}
}

View file

@ -227,7 +227,7 @@ void Intro::update(float dt)
dsq->toggleBlackBars(1);
dsq->setBlackBarsColor(Vector(0,0,0));
cachy.precacheTex("intro/*.png");
meteors.clear();
@ -245,7 +245,7 @@ void Intro::update(float dt)
dsq->sound->loadLocalSound("aqfocus");
dsq->sound->loadLocalSound("thewave");
dsq->sound->loadLocalSound("screaming");
SkeletalSprite *citybg = new SkeletalSprite();
citybg->loadSkeletal("citybg");
@ -278,7 +278,7 @@ void Intro::update(float dt)
}
addRenderObject(eric, LR_ENTITIES);
dsq->overlay->alpha = 0;
dsq->overlay2->alpha = 0;
@ -288,7 +288,7 @@ void Intro::update(float dt)
dsq->overlay2->color.interpolateTo(Vector(0,0,0), 1);
dsq->overlay2->alpha = 1;
core->cacheRender();
@ -404,7 +404,7 @@ void Intro::update(float dt)
// -- floating city in clouds
dsq->setClearColor(Vector(0.4,0.4,0.4));
/*
@ -474,7 +474,7 @@ void Intro::update(float dt)
if (waitQuit(2)) return;
// -- window
@ -514,7 +514,7 @@ void Intro::update(float dt)
ericHead->alpha = 0;
// -- brush
float brusht=7;
@ -544,7 +544,7 @@ void Intro::update(float dt)
dsq->sound->playSfx("aqfocus", 0.8);
if (waitQuit(1.5)) return;
if (waitQuit(2)) return;
@ -764,8 +764,6 @@ void Intro::update(float dt)
if (waitQuit(1.9)) return;
dsq->overlay->color = Vector(0,0,0);
dsq->fade(1, 0.1);
@ -817,7 +815,7 @@ void Intro::update(float dt)
play4.name = "bgloop-interior";
play4.loops = -1;
play4.time = 1;
play4.fade = SFT_IN;
play4.fade = SFT_IN;
void *bgLoop = dsq->sound->playSfx(play4);
if (waitQuit(3)) return;
@ -835,7 +833,7 @@ void Intro::update(float dt)
core->sound->playVoice("titleb");
dsq->sound->playSfx("heartbeat", 0.2);
if (waitQuit(2.5)) return;
underwaterBG->alphaMod = 0;

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void Logo::JumpTitle::act()
{
//dsq->title();
}
Logo::Logo() : StateObject()
@ -36,25 +36,8 @@ void Logo::applyState()
core->setClearColor(Vector(1,1,1));
//glClearColor(1,1,1,0);
//core->enable2D(800);
/*
Quad *q = new Quad;
{
q->setTexture("zs");
q->width=800;
q->height=100;
q->position = Vector(400,300);
q->alpha = 0;
q->alpha.interpolateTo(1, 3, 0);
}
addRenderObject(q);
addAction(&jumpTitle, MOUSE_BUTTON_LEFT, 1);
*/
Quad *q = new Quad;
{

View file

@ -27,7 +27,7 @@ class Logo : public StateObject
{
public:
Logo();
EVENT(JumpTitle, jumpTitle);
EVENT(JumpTitle, jumpTitle)
void applyState();
void removeState();
};

View file

@ -30,56 +30,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void MakeRan(void)
{
#ifdef BBGE_BUILD_WINDOWS
std::ofstream out("ran");
if(out)
{
for (int i = 0; i < 32; i++)
out << rand()%1000;
out.close();
}
std::ofstream out("ran");
if(out)
{
for (int i = 0; i < 32; i++)
out << rand()%1000;
out.close();
}
#endif
}
static void StartAQConfig()
{
#if defined(BBGE_BUILD_WINDOWS)
if (!exists("ran", false, true))
{
MakeRan();
if(exists("AQConfig.exe", false, true))
{
ShellExecute(NULL, "open", "AQConfig.exe", NULL, NULL, SW_SHOWNORMAL);
exit(0);
}
}
remove("ran");
if (!exists("ran", false, true))
{
MakeRan();
if(exists("AQConfig.exe", false, true))
{
ShellExecute(NULL, "open", "AQConfig.exe", NULL, NULL, SW_SHOWNORMAL);
exit(0);
}
}
remove("ran");
#endif
}
static void CheckConfig(void)
{
#ifdef BBGE_BUILD_WINDOWS
bool hasCfg = exists("usersettings.xml", false, true);
if(!hasCfg)
StartAQConfig();
bool hasCfg = exists("usersettings.xml", false, true);
if(!hasCfg)
StartAQConfig();
#endif
}
#if defined(BBGE_BUILD_WINDOWS) && !defined(BBGE_BUILD_SDL)
int WINAPI WinMain( HINSTANCE hInstance, // Instance
HINSTANCE hPrevInstance, // Previous Instance
LPSTR lpCmdLine, // Command Line Parameters
int nCmdShow) // Window Show State
{
#ifdef _DEBUG
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtSetReportMode ( _CRT_ERROR, _CRTDBG_MODE_DEBUG);
#endif
std::string dsqParam = GetCommandLine();
#else
extern "C" int main(int argc,char *argv[])
{
@ -102,18 +88,17 @@ static void CheckConfig(void)
extraDataDir = AQUARIA_EXTRA_DATA_DIR;
#endif
#endif
CheckConfig();
CheckConfig();
{
DSQ dsql(dsqParam, extraDataDir);
dsql.init();
dsql.main();
dsql.shutdown();
}
{
DSQ dsql(dsqParam, extraDataDir);
dsql.init();
dsql.main();
dsql.shutdown();
}
MakeRan();
MakeRan();
return (0);
}

View file

@ -86,8 +86,8 @@ void ManaBall::onUpdate(float dt)
this->scale.interpolateTo(Vector(0,0),1);
setLife(1);
setDecayRate(1);
//this->shareAlphaWithChildren = 1;
//this->fadeAlphaWithLife = 1;
}
}
@ -99,7 +99,7 @@ void ManaBall::onUpdate(float dt)
if (diff.isLength2DIn(96))
{
use(dsq->game->avatar);
//position.interpolateTo(dsq->game->avatar->position, 0.5);
}
else
{
@ -122,7 +122,7 @@ void ManaBall::onUpdate(float dt)
else
{
position.interpolateTo(dsq->game->avatar->position, 0.2);
//position = ;
}
}
position.z = 0.5;

View file

@ -47,8 +47,6 @@ namespace MiniMapRenderSpace
const float iconBaseSize = 14;
// Additional radius added (or subtracted) by "throb" effect
const float iconThrobSize = 6;
// Size of cooking icon (fixed)
const float iconCookSize = 16;
// Maximum offset of warp/save/cooking icons from center of minimap
const float iconMaxOffset = miniMapRadius * miniMapScale * (7.0f/8.0f);
// Distance at which the icon decreases to minimum size
@ -66,11 +64,9 @@ namespace MiniMapRenderSpace
const int healthMarkerSize = 20;
CountedPtr<Texture> texCook = 0;
CountedPtr<Texture> texWaterBit = 0;
CountedPtr<Texture> texMinimapBtm = 0;
CountedPtr<Texture> texMinimapTop = 0;
CountedPtr<Texture> texRipple = 0;
CountedPtr<Texture> texNaija = 0;
CountedPtr<Texture> texHealthBar = 0;
CountedPtr<Texture> texMarker = 0;
@ -91,6 +87,69 @@ namespace MiniMapRenderSpace
using namespace MiniMapRenderSpace;
const Vector MinimapIcon::defaultSize(iconBaseSize, iconBaseSize);
MinimapIcon::MinimapIcon()
: color(1,1,1), alpha(1), size(defaultSize), throbMult(iconThrobSize), scaleWithDistance(true)
{
}
void MinimapIcon::update(float dt)
{
color.update(dt);
alpha.update(dt);
size.update(dt);
}
// pretty much copied from RenderObject::setTexture()
static bool _setTex(CountedPtr<Texture> &tex, std::string name)
{
stringToLowerUserData(name);
if (name.empty())
{
tex = NULL;
return false;
}
if(tex && tex->getLoadResult() == TEX_SUCCESS && name == tex->name)
return true; // no texture change
tex = core->addTexture(name);
return tex && tex->getLoadResult() == TEX_SUCCESS;
}
bool MinimapIcon::setTexture(std::string name)
{
return _setTex(tex, name);
}
bool MiniMapRender::setWaterBitTex(const std::string& name)
{
return _setTex(texWaterBit, name);
}
bool MiniMapRender::setTopTex(const std::string& name)
{
return _setTex(texMinimapTop, name);
}
bool MiniMapRender::setBottomTex(const std::string& name)
{
return _setTex(texMinimapBtm, name);
}
bool MiniMapRender::setAvatarTex(const std::string& name)
{
return _setTex(texNaija, name);
}
bool MiniMapRender::setHealthBarTex(const std::string& name)
{
return _setTex(texHealthBar, name);
}
bool MiniMapRender::setMaxHealthMarkerTex(const std::string& name)
{
return _setTex(texMarker, name);
}
MiniMapRender::MiniMapRender() : RenderObject()
{
toggleOn = 1;
@ -108,13 +167,11 @@ MiniMapRender::MiniMapRender() : RenderObject()
cull = false;
lightLevel = 1.0;
texCook = core->addTexture("GUI/ICON-FOOD");
texWaterBit = core->addTexture("GUI/MINIMAP/WATERBIT");
texMinimapBtm = core->addTexture("GUI/MINIMAP/BTM");
texMinimapTop = core->addTexture("GUI/MINIMAP/TOP");
texRipple = core->addTexture("GUI/MINIMAP/RIPPLE");
texNaija = core->addTexture("GEMS/NAIJA-TOKEN");
texHealthBar = core->addTexture("PARTICLES/glow-masked");
texWaterBit = core->addTexture("gui/minimap/waterbit");
texMinimapBtm = core->addTexture("gui/minimap/btm");
texMinimapTop = core->addTexture("gui/minimap/top");
texNaija = core->addTexture("gems/naija-token");
texHealthBar = core->addTexture("particles/glow-masked");
texMarker = core->addTexture("gui/minimap/marker");
buttons.clear();
@ -164,11 +221,9 @@ void MiniMapRender::destroy()
{
RenderObject::destroy();
UNREFTEX(texCook);
UNREFTEX(texWaterBit);
UNREFTEX(texMinimapBtm);
UNREFTEX(texMinimapTop);
UNREFTEX(texRipple);
UNREFTEX(texNaija);
UNREFTEX(texHealthBar);
UNREFTEX(texMarker);
@ -230,17 +285,17 @@ void MiniMapRender::toggle(int t)
float MiniMapRender::getMiniMapWidth() const
{
return scale.x * miniMapSize;
return scale.x * miniMapSize;
}
float MiniMapRender::getMiniMapHeight() const
{
return scale.y * miniMapSize;
return scale.y * miniMapSize;
}
void MiniMapRender::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
RenderObject::onUpdate(dt);
position.x = core->getVirtualWidth() - core->getVirtualOffX() - getMiniMapWidth()/2;
position.y = 600 - getMiniMapHeight()/2;
@ -268,7 +323,7 @@ void MiniMapRender::onUpdate(float dt)
{
radarHide = true;
}
if(!radarHide)
{
for (Path *p = dsq->game->getFirstPathOfType(PATH_RADARHIDE); p; p = p->nextOfType)
@ -323,7 +378,7 @@ void MiniMapRender::onUpdate(float dt)
_isCursorIn = false;
if (alpha.x == 1)
{
{
if (!dsq->game->isInGameMenu() && (!dsq->game->isPaused() || (dsq->game->isPaused() && dsq->game->worldMapRender->isOn())))
{
if (isCursorInButtons())
@ -378,7 +433,7 @@ void MiniMapRender::onUpdate(float dt)
{
if (doubleClickDelay > 0 && !core->isStateJumpPending())
{
if (dsq->continuity.gems.empty())
dsq->continuity.pickupGem("Naija-Token");
@ -420,7 +475,6 @@ void MiniMapRender::onUpdate(float dt)
void MiniMapRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0;
@ -541,14 +595,10 @@ void MiniMapRender::onRender()
if (!radarHide)
{
const float factor = sinf(game->getTimer()*PI);
const float iconSize = iconBaseSize + factor*iconThrobSize;
texRipple->apply();
// FIXME: use getFirstPathOfType?
for (int i = 0; i < dsq->game->getNumPaths(); i++)
{
Path *p = dsq->game->getPath(i);
if (!p->nodes.empty() && (p->pathType==PATH_COOK || p->pathType==PATH_SAVEPOINT || p->pathType==PATH_WARP))
if (!p->nodes.empty() && p->minimapIcon)
{
bool render = true;
Path *p2 = dsq->game->getNearestPath(p->nodes[0].position, PATH_RADARHIDE);
@ -562,94 +612,17 @@ void MiniMapRender::onRender()
if (render)
{
Vector pt(p->nodes[0].position);
Vector d = pt - dsq->game->avatar->position;
const float len = d.getLength2D();
float iconScale;
if (len < iconMaxOffset)
{
iconScale = 1;
}
else
{
d *= iconMaxOffset / len;
float k;
if (len < iconMaxDistance)
k = ((iconMaxDistance - len) / (iconMaxDistance - iconMaxOffset));
else
k = 0;
iconScale = iconMinScale + k*(1-iconMinScale);
}
const Vector miniMapPos = Vector(d)*Vector(1.0f/miniMapScale, 1.0f/miniMapScale);
switch(p->pathType)
{
case PATH_COOK:
{
glColor4f(1, 1, 1, 1);
glTranslatef(miniMapPos.x, miniMapPos.y, 0);
const float sz = iconCookSize * iconScale;
texCook->apply();
glBegin(GL_QUADS);
glTexCoord2f(0, 1);
glVertex2f(-sz, sz);
glTexCoord2f(1, 1);
glVertex2f(sz, sz);
glTexCoord2f(1, 0);
glVertex2f(sz, -sz);
glTexCoord2f(0, 0);
glVertex2f(-sz, -sz);
glEnd();
glTranslatef(-miniMapPos.x, -miniMapPos.y, 0);
texRipple->apply();
render = false; // Skip common rendering code
}
break;
case PATH_SAVEPOINT:
{
glColor4f(1.0, 0, 0, alphaValue*0.75f);
}
break;
case PATH_WARP:
{
if (p->naijaHome)
{
glColor4f(1.0, 0.9, 0.2, alphaValue*0.75f);
}
else
{
glColor4f(1.0, 1.0, 1.0, alphaValue*0.75f);
}
}
break;
}
if (render)
{
glTranslatef(miniMapPos.x, miniMapPos.y, 0);
const float sz = iconSize * iconScale;
glBegin(GL_QUADS);
glTexCoord2f(0, 1);
glVertex2f(-sz, sz);
glTexCoord2f(1, 1);
glVertex2f(sz, sz);
glTexCoord2f(1, 0);
glVertex2f(sz, -sz);
glTexCoord2f(0, 0);
glVertex2f(-sz, -sz);
glEnd();
glTranslatef(-miniMapPos.x, -miniMapPos.y, 0);
}
renderIcon(p->minimapIcon, p->nodes[0].position);
}
}
}
texRipple->unbind();
FOR_ENTITIES(i)
{
Entity *e = *i;
if(e->minimapIcon)
renderIcon(e->minimapIcon, e->position);
}
}
glColor4f(1,1,1, alphaValue);
@ -786,6 +759,49 @@ void MiniMapRender::onRender()
glBindTexture(GL_TEXTURE_2D, 0);
#endif
}
void MiniMapRender::renderIcon(MinimapIcon *ico, const Vector& pos)
{
if(!ico->tex)
return;
Vector d = pos - dsq->game->avatar->position;
const float len = d.getLength2D();
float iconScale = 1;
if (len >= iconMaxOffset)
{
d *= iconMaxOffset / len; // clamp to outer circle distance
if(ico->scaleWithDistance)
{
float k;
if (len < iconMaxDistance)
k = ((iconMaxDistance - len) / (iconMaxDistance - iconMaxOffset));
else
k = 0;
iconScale = iconMinScale + k*(1-iconMinScale);
}
}
ico->tex->apply();
const Vector c = ico->color;
const float a = ico->alpha.x * this->alpha.x;
glColor4f(c.x, c.y, c.z, a);
const Vector miniMapPos = Vector(d)*Vector(1.0f/miniMapScale, 1.0f/miniMapScale);
const float factor = sinf(game->getTimer()*PI);
const float addSize = factor * ico->throbMult;
const Vector sz = (ico->size + Vector(addSize, addSize)) * iconScale;
glPushMatrix();
glTranslatef(miniMapPos.x, miniMapPos.y, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 1);
glVertex2f(-sz.x, sz.y);
glTexCoord2f(1, 1);
glVertex2f(sz.x, sz.y);
glTexCoord2f(1, 0);
glVertex2f(sz.x, -sz.y);
glTexCoord2f(0, 0);
glVertex2f(-sz.x, -sz.y);
glEnd();
glPopMatrix();
}

View file

@ -33,9 +33,9 @@ void refreshBaseModPath()
Mod::Mod()
{
clear();
enqueueModStart = 0;
shuttingDown = false;
}
@ -92,12 +92,12 @@ bool Mod::loadModXML(XMLDocument *d, std::string modName)
const std::string& Mod::getBaseModPath() const
{
refreshBaseModPath();
return baseModPath;
}
void Mod::load(const std::string &p)
{
{
clear();
refreshBaseModPath();
@ -108,10 +108,10 @@ void Mod::load(const std::string &p)
setLocalisationModPath(path);
setActive(true);
XMLDocument d;
loadModXML(&d, p);
XMLElement *mod = d.FirstChildElement("AquariaMod");
if (mod)
{
@ -204,7 +204,7 @@ void Mod::start()
core->main(t);
core->sound->stopMusic();
enqueueModStart = 1;
dsq->recentSaveSlot = -1;
}
@ -296,7 +296,7 @@ void Mod::update(float dt)
if (enqueueModStart)
{
enqueueModStart = 0;
applyStart();
}
}

View file

@ -154,9 +154,10 @@ void ModDL::GetModlist(const std::string& url, bool allowChaining, bool first)
}
else
{
std::string host, dummy_file;
std::string host, dummy_file, dummy_protocol;
int dummy_port;
minihttp::SplitURI(url, host, dummy_file, dummy_port);
bool dummy_useSSL;
minihttp::SplitURI(url, dummy_protocol, host, dummy_file, dummy_port, dummy_useSSL);
stringToLower(host);
if(knownServers.find(host) != knownServers.end())
{

View file

@ -41,8 +41,13 @@ static bool _modname_cmp(const ModIcon *a, const ModIcon *b)
return a->fname < b->fname;
}
ModSelectorScreen::ModSelectorScreen() : Quad(), ActionMapper(),
currentPanel(-1), gotServerList(false), dlText(&dsq->smallFont), subtext(&dsq->subsFont)
ModSelectorScreen::ModSelectorScreen()
: Quad()
, ActionMapper()
, dlText(&dsq->smallFont)
, gotServerList(false)
, currentPanel(-1)
, subtext(&dsq->subsFont)
{
followCamera = 1;
shareAlphaWithChildren = false;
@ -131,7 +136,7 @@ void ModSelectorScreen::showPanel(int id)
if(id == currentPanel)
return;
const float t = 0.2f;
//const float t = 0.2f;
IconGridPanel *newgrid = panels[id];
// fade in selected panel
@ -478,7 +483,11 @@ void BasicIcon::onClick()
dsq->sound->playSfx("denied");
}
MenuIcon::MenuIcon(int id) : SubtitleIcon(), iconId(id), cb(0), cb_data(0)
MenuIcon::MenuIcon(int id)
: SubtitleIcon()
, cb(0)
, cb_data(0)
, iconId(id)
{
}
@ -614,7 +623,13 @@ void ModIcon::updateStatus()
ModIconOnline::ModIconOnline()
: SubtitleIcon(), pb(0), extraIcon(0), statusIcon(0), clickable(true), pkgtype(MPT_MOD), hasUpdate(false)
: SubtitleIcon()
, pb(0)
, extraIcon(0)
, statusIcon(0)
, pkgtype(MPT_MOD)
, clickable(true)
, hasUpdate(false)
{
label = desc;
}
@ -872,7 +887,7 @@ void MenuIconBar::add(MenuIcon *ico)
}
IconGridPanel::IconGridPanel()
: spacing(0), y(0), x(0)
: spacing(0), x(0), y(0)
{
shareAlphaWithChildren = false; // patch selection icons need their own alpha, use fade() instead
alphaMod = 0.01f;

View file

@ -149,7 +149,7 @@ public:
void showPanel(int id);
void updateFade();
void initModAndPatchPanel();
void initNetPanel();

View file

@ -2,7 +2,7 @@
#include "DSQ.h"
#include "Network.h"
#include "ByteBuffer.h"
//#include "VFSTools.h"
#include "MT.h"
#include <map>
#include <set>
@ -44,7 +44,7 @@ public:
protected:
virtual void _OnClose()
{
//puts("_OnClose()");
minihttp::HttpSocket::_OnClose();
const Request& r = GetCurrentRequest();
@ -57,10 +57,10 @@ protected:
}
virtual void _OnOpen()
{
//puts("_OnOpen()");
minihttp::HttpSocket::_OnOpen();
const Request& r = GetCurrentRequest();
//const Request& r = GetCurrentRequest();
// TODO ??
}
@ -68,7 +68,7 @@ protected:
{
const Request& r = GetCurrentRequest();
RequestData *data = (RequestData*)(r.user);
//printf("_OnRequestDone(): %s\n", r.resource.c_str());
if(data->fp)
{
fclose(data->fp);
@ -87,15 +87,11 @@ protected:
notifyRequests.push(RequestDataHolder(data));
}
virtual void _OnRecv(char *buf, unsigned int size)
virtual void _OnRecv(void *buf, unsigned int size)
{
if(!size)
return;
/*if(GetStatusCode() != minihttp::HTTP_OK)
{
printf("NETWORK: Got %u bytes with status code %u", size, GetStatusCode());
return;
}*/
const Request& r = GetCurrentRequest();
RequestData *data = (RequestData*)(r.user);
if(!data->fp && !data->fail)
@ -200,7 +196,7 @@ static HttpDumpSocket *th_CreateSocket()
static bool th_DoSendRequest(RequestData *rq)
{
Request get;
SplitURI(rq->url, get.host, get.resource, get.port);
SplitURI(rq->url, get.protocol, get.host, get.resource, get.port, get.useSSL);
if(get.port < 0)
get.port = 80;
@ -210,7 +206,7 @@ static bool th_DoSendRequest(RequestData *rq)
HttpDumpSocket *sock = th_CreateSocket();
get.user = rq;
return sock->SendGet(get, false);
return sock->SendRequest(get, false);
}
static int _NetworkWorkerThread(void *)

View file

@ -46,8 +46,8 @@ void ParticleEditor::applyState()
addAction(MakeFunctionEvent(ParticleEditor, load), KEY_F1, 0);
addAction(MakeFunctionEvent(ParticleEditor, reload), KEY_F5, 0);
//addAction(MakeFunctionEvent(ParticleEditor, start), KEY_F5, 0);
//addAction(MakeFunctionEvent(ParticleEditor, stop), KEY_F6, 0);
addAction(MakeFunctionEvent(ParticleEditor, start), MOUSE_BUTTON_LEFT, 0);
addAction(MakeFunctionEvent(ParticleEditor, stop), MOUSE_BUTTON_RIGHT, 0);
@ -64,8 +64,8 @@ void ParticleEditor::applyState()
core->cameraPos = Vector(0,0);
emitter = new ParticleEffect;
//emitter->followCamera = 1;
//emitter->position = Vector(400,300);
addRenderObject(emitter, LR_ENTITIES);
dsq->overlay->alpha.interpolateTo(0, 0.5);

View file

@ -32,7 +32,6 @@ Path::Path()
pathShape = PATHSHAPE_RECT;
toFlip = -1;
replayVox = 0;
naijaHome = false;
addEmitter = false;
emitter = 0;
active = true;
@ -55,6 +54,7 @@ Path::Path()
spiritFreeze = true;
pauseFreeze = true;
activationRange = 800;
minimapIcon = 0;
}
void Path::clampPosition(Vector *pos, float radius)
@ -207,6 +207,9 @@ int Path::getDown()
void Path::destroy()
{
delete minimapIcon;
minimapIcon = NULL;
if (emitter)
{
emitter->safeKill();
@ -346,6 +349,11 @@ void Path::refreshScript()
else if (label == "cook")
{
pathType = PATH_COOK;
ensureMinimapIcon();
minimapIcon->setTexture("gui/icon-food");
minimapIcon->size = Vector(16, 16);
minimapIcon->scaleWithDistance = false;
minimapIcon->throbMult = 0.0f;
}
else if (label == "zoom")
{
@ -371,6 +379,10 @@ void Path::refreshScript()
else if (label == "savepoint")
{
pathType = PATH_SAVEPOINT;
ensureMinimapIcon();
minimapIcon->setTexture("gui/minimap/ripple");
minimapIcon->color = Vector(1, 0, 0);
minimapIcon->alpha = 0.75f;
}
else if (label == "steam")
{
@ -379,7 +391,7 @@ void Path::refreshScript()
std::string dummy;
is >> dummy;
float v = 0;
float v = 0;
is >> v;
if (v != 0)
currentMod = v;
@ -405,6 +417,10 @@ void Path::refreshScript()
else if (type == "out")
localWarpType = LOCALWARP_OUT;
pathType = PATH_WARP;
ensureMinimapIcon();
minimapIcon->setTexture("gui/minimap/ripple");
minimapIcon->alpha = 0.75f;
}
else if (label == "vox" || label == "voice")
{
@ -422,10 +438,12 @@ void Path::refreshScript()
// warpType is just char, which does not automatically skip spaces like strings would
warpType = warpTypeStr.length() ? warpTypeStr[0] : 0;
ensureMinimapIcon();
minimapIcon->setTexture("gui/minimap/ripple");
minimapIcon->alpha = 0.75f;
if (warpMap.find("vedha")!=std::string::npos)
{
naijaHome = true;
}
minimapIcon->color = Vector(1.0f, 0.9f, 0.2f);
pathType = PATH_WARP;
}
else if (label == "se")
@ -436,20 +454,15 @@ void Path::refreshScript()
spawnEnemyDistance = 0;
is >> dummy >> spawnEnemyName >> spawnEnemyDistance >> spawnEnemyNumber;
neverSpawned = true;
/*
if (!spawnedEntity && !nodes.empty())
{
spawnedEntity = dsq->game->createEntity(spawnEnemyName, 0, nodes[0].position, 0, false, "");
}
*/
}
else if (label == "pe")
{
std::string dummy, particleEffect;
SimpleIStringStream is(name);
is >> dummy >> particleEffect;
//core->removeRenderObject(&emitter, Core::DO_NOT_DESTROY_RENDER_OBJECT);
//core->getTopStateData()->addRenderObject(&emitter, LR_PARTICLES);
setEmitter(particleEffect);
}
@ -489,6 +502,9 @@ void Path::init()
void Path::update(float dt)
{
if(minimapIcon)
minimapIcon->update(dt);
if (!(pauseFreeze && dsq->game->isPaused()) && !(spiritFreeze && dsq->game->isWorldPaused()))
{
if (addEmitter && emitter)
@ -531,10 +547,7 @@ void Path::update(float dt)
if (pathType == PATH_CURRENT && !dsq->game->isWorldPaused())
{
animOffset -= currentMod*(dt/830);
/*
while (animOffset < -1.0f)
animOffset += 1.0f;
*/
}
if (pathType == PATH_GEM && dsq->game->avatar)
{
@ -574,18 +587,12 @@ void Path::update(float dt)
Vector start = nodes[0].position;
Vector end = nodes[1].position;
Vector v = end - start;
Vector left = v.getPerpendicularLeft();
Vector right = v.getPerpendicularRight();
Vector mid = (end-start) + start;
FOR_ENTITIES(i)
{
Entity *e = *i;
if (e)
{
/*
if (e->getEntityType() == ET_AVATAR && dsq->continuity.form == FORM_SPIRIT)
continue;
*/
if (dsq->game->collideCircleVsLine(e, start, end, rect.getWidth()*0.5f))
{
if (e->getEntityType() == ET_AVATAR)
@ -600,24 +607,13 @@ void Path::update(float dt)
d.damage = 0.1;
d.damageType = DT_STEAM;
e->damage(d);
//a->position = a->lastPosition;
}
Vector push;
push = e->position - dsq->game->lastCollidePosition;
// old method:
/*
int d1 = ((mid + left)-e->position).getSquaredLength2D();
if (((mid + right)-e->position).getSquaredLength2D() < d1)
{
push = right;
}
else
{
push = left;
}
*/
push.setLength2D(1000*dt);
if (e->vel2.isLength2DIn(1000) && !e->isNearObstruction(3))
@ -629,11 +625,7 @@ void Path::update(float dt)
if (dsq->game->collideCircleVsLine(e, start, end, rect.getWidth()*0.25f))
{
push.setLength2D(100);
/*
Vector oldVel = e->vel;
Vector nvel = v;
nvel.setLength2D(e->vel);
*/
e->vel = 0;
e->vel += push;
}
@ -731,3 +723,10 @@ void Path::luaDebugMsg(const std::string &func, const std::string &msg)
{
debugLog("luaScriptError: Path [" + name + "]: " + func + " : " + msg);
}
MinimapIcon *Path::ensureMinimapIcon()
{
if(!minimapIcon)
minimapIcon = new MinimapIcon;
return minimapIcon;
}

View file

@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef PATH_MAX // May be set by a system header.
struct MinimapIcon;
class PathNode
{
public:
@ -107,11 +109,14 @@ public:
void activate(Entity *e=0);
void refreshScript();
MinimapIcon *ensureMinimapIcon();
Script *script;
bool updateFunction;
bool activateFunction;
bool cursorActivation;
int replayVox;
MinimapIcon *minimapIcon;
std::string warpMap, warpNode, vox, spawnEnemyName, content;
float amount, time;
@ -130,7 +135,6 @@ public:
LocalWarpType localWarpType;
bool naijaHome;
bool catchActions;
bool songFunc, songNoteFunc, songNoteDoneFunc;
bool neverSpawned;

View file

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
class SearchGridRaw
{
public:
SearchGridRaw(ObsType blocking) : game(dsq->game), blockingObsBits(blocking) {}
SearchGridRaw(ObsType blocking) : blockingObsBits(blocking), game(dsq->game) {}
inline bool operator()(unsigned x, unsigned y) const
{
return (game->getGridRaw(TileVector(x, y)) & blockingObsBits) == OT_EMPTY;
@ -58,7 +58,7 @@ void PathFinding::forceMinimumPath(VectorPath &path, const Vector &start, const
{
if (path.getNumPathNodes() <= 2)
{
//debugLog(" Path is <= 2 nodes... setting up simple path");
path.clear();
path.addPathNode(start, 0);
path.addPathNode(dest, 1);
@ -79,8 +79,7 @@ void PathFinding::molestPath(VectorPath &path)
{
Vector node = path.getPathNode(i)->value;
float dist;
int sample = 20;
float maxDist = sample * TILE_SIZE;
const int sample = 20;
{
Vector n = dsq->game->getWallNormal(node, sample, &dist);
if (dist != -1 && (n.x != 0 || n.y != 0))
@ -105,7 +104,7 @@ void PathFinding::molestPath(VectorPath &path)
}
}
}
// use wall normal to push out node a bit
std::vector<Vector> newNormals;
newNormals.resize(normals.size());
@ -210,18 +209,19 @@ void PathFinding::beginFindPath(PathFinding::State *state, const Vector& start,
obs = OT_BLOCKING;
state->grid.blockingObsBits = (ObsType)obs;
JPS::Position istart = JPS::Pos(start.x, start.y);
JPS::Position iend = JPS::Pos(end.x, end.y);
TileVector tstart(start);
TileVector tend(end);
JPS::Position istart = JPS::Pos(tstart.x, tstart.y);
JPS::Position iend = JPS::Pos(tend.x, tend.y);
state->result = state->searcher.findPathInit(istart, iend);
}
bool PathFinding::updateFindPath(PathFinding::State *state, int limit)
{
int oldres = state->result;
if(oldres == JPS::NEED_MORE_STEPS)
if(state->result == JPS::NEED_MORE_STEPS)
{
state->result = state->searcher.findPathStep(limit);
return oldres != state->result;
return state->result != JPS::NEED_MORE_STEPS;
}
return true; // done
}
@ -229,7 +229,7 @@ bool PathFinding::updateFindPath(PathFinding::State *state, int limit)
bool PathFinding::finishFindPath(PathFinding::State *state, VectorPath& path, unsigned step /* = 0 */)
{
if(state->result != JPS::FOUND_PATH)
return false;
return state->result == JPS::EMPTY_PATH;
JPS::PathVector rawpath;
state->searcher.findPathFinish(rawpath, step);
@ -238,6 +238,11 @@ bool PathFinding::finishFindPath(PathFinding::State *state, VectorPath& path, un
return true;
}
void PathFinding::purgeFindPath(PathFinding::State *state)
{
state->searcher.freeMemory();
}
void PathFinding::getStats(PathFinding::State *state, unsigned& stepsDone, unsigned& nodesExpanded)
{
stepsDone = (unsigned)state->searcher.getStepsDone();

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PATHFINDING_H
#include "../BBGE/Base.h"
//#include "Astar.h"
#include "TileVector.h"
#include <assert.h>
@ -47,6 +47,7 @@ namespace PathFinding
bool updateFindPath(State *state, int limit);
bool finishFindPath(State *state, VectorPath& path, unsigned step = 0);
void getStats(State *state, unsigned& stepsDone, unsigned& nodesExpanded);
void purgeFindPath(PathFinding::State *state);
};
#endif

View file

@ -22,15 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
PathRender::PathRender() : RenderObject()
{
//color = Vector(1, 0, 0);
position.z = 5;
cull = false;
alpha = 0.5f;
}
void PathRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
{
const int pathcount = dsq->game->getNumPaths();
if (pathcount <= 0)
return;
@ -68,9 +67,9 @@ void PathRender::onRender()
glVertex2f(nd->position.x+p->rect.x1, nd->position.y+p->rect.y2);
glVertex2f(nd->position.x+p->rect.x2, nd->position.y+p->rect.y2);
glVertex2f(nd->position.x+p->rect.x2, nd->position.y+p->rect.y1);
glVertex2f(nd->position.x+p->rect.x1, nd->position.y+p->rect.y1);
glVertex2f(nd->position.x+p->rect.x1, nd->position.y+p->rect.y1);
glEnd();
glColor4f(1, 1, 1, 0.3);
glBegin(GL_LINES);
glVertex2f(nd->position.x+p->rect.x1, nd->position.y+p->rect.y1);
@ -104,10 +103,9 @@ void PathRender::onRender()
glColor4f(1, 0.5, 0.5, a);
glPushMatrix();
glTranslatef(nd->position.x, nd->position.y, 0);
glTranslatef(nd->position.x, nd->position.y, 0);
drawCircle(32);
glPopMatrix();
}
}
#endif
}

View file

@ -36,12 +36,12 @@ namespace RecipeMenuNamespace
}
using namespace RecipeMenuNamespace;
RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe)
{
selected = 0;
// Quad *result, *i1, *i2, *i3;
// Recipe *recipe;
data = dsq->continuity.getIngredientDataByName(recipe->result);
if (data)
@ -51,16 +51,16 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
glow->setBlendType(BLEND_ADD);
glow->alphaMod = 0;
addChild(glow, PM_POINTER);
result = new Quad("ingredients/" + data->gfx, Vector(-100,0));
result->scale = Vector(0.7, 0.7);
addChild(result, PM_POINTER);
BitmapText *text = new BitmapText(&dsq->smallFont);
text->scale = Vector(0.7, 0.7);
text->color = 0;
text->position = result->position + Vector(0, 18);
text->setText(processFoodName(data->displayName));
addChild(text, PM_POINTER);
}
@ -70,7 +70,7 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
addChild(equals, PM_POINTER);
int c = 0;
//int size = (recipe->names.size() + recipe->types.size())-1;
int size=0;
for (int i = 0; i < recipe->names.size(); i++)
@ -81,7 +81,7 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
size --;
for (int i = 0; i < recipe->names.size(); i++)
{
debugLog("recipe name: " + recipe->names[i].name);
@ -93,21 +93,21 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
ing[c] = new Quad("ingredients/" + data->gfx, Vector(100*c,0));
ing[c]->scale = Vector(0.7, 0.7);
addChild(ing[c], PM_POINTER);
BitmapText *text = new BitmapText(&dsq->smallFont);
text->scale = Vector(0.7, 0.7);
text->color = 0;
text->position = ing[c]->position + Vector(0, 18);
text->setText(processFoodName(data->displayName));
addChild(text, PM_POINTER);
if (c < size)
{
Quad *plus = new Quad("gui/recipe-plus", Vector(100*c+50, 0));
plus->scale = Vector(0.7, 0.7);
addChild(plus, PM_POINTER);
}
c++;
if (c > 3)
{
@ -117,17 +117,17 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
}
}
}
for (int i = 0; i < recipe->types.size(); i++)
{
//debugLog("recipe type: " + recipe->types[i].typeName);
for (int j = 0; j < recipe->types[i].amount; j++)
{
// any type of whatever...
BitmapText *text = new BitmapText(&dsq->smallFont);
text->color = 0;
text->scale = Vector(0.8, 0.8);
text->position = Vector(100*c, 0); //-20
text->position = Vector(100*c, 0);
std::string typeName = dsq->continuity.getIngredientDisplayName(recipe->types[i].typeName);
@ -139,16 +139,16 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
text->setText(typeName);
addChild(text, PM_POINTER);
if (c < size)
{
Quad *plus = new Quad("gui/recipe-plus", Vector(100*c+50, 0));
plus->scale = Vector(0.7, 0.7);
addChild(plus, PM_POINTER);
}
c++;
}
}
}
description = 0;
@ -180,15 +180,15 @@ void RecipeMenuEntry::onUpdate(float dt)
glow->alphaMod = 0.2;
std::ostringstream ds;
//ds << data->name << ": ";
//ds << "* ";
for (int i = 0; i < data->effects.size(); i++)
{
ds << dsq->continuity.getIEString(data, i);
if (i == data->effects.size()-1)
{
// do nothing
//ds << ".";
}
else
{
@ -198,7 +198,7 @@ void RecipeMenuEntry::onUpdate(float dt)
game->recipeMenu.description->setText(ds.str());
game->recipeMenu.description->offset = Vector(0, -10 * (game->recipeMenu.description->getNumLines()-1));
// description->setText(ds.str());
selected = 1;
}
else
@ -235,7 +235,7 @@ void RecipeMenu::slide(RenderObject *r, bool in, float t)
if (in)
{
r->alpha = 1;
//r->alpha.interpolateTo(1, 0.2);
r->offset = Vector(0,oy);
r->offset.interpolateTo(Vector(0,0), t, 0, 0, 1);
}
@ -261,20 +261,15 @@ int RecipeMenu::getNumKnown()
int RecipeMenu::getNumPages()
{
int numKnown = dsq->continuity.recipes.size();//getNumKnown();
int numKnown = dsq->continuity.recipes.size();
int numPages = (numKnown/pageSize);
/*
for (int i = 0; i < dsq->continuity.recipes.size(); i++)
{
debugLog("r: " + dsq->continuity.recipes[i].result);
}
*/
std::ostringstream os;
os << "numKnown: " << numKnown << " pagesSize: " << pageSize << " numPages: " << numPages;
debugLog(os.str());
return numPages;
}
@ -285,12 +280,12 @@ void RecipeMenu::goPrevPage()
dsq->sound->playSfx("recipemenu-pageturn");
destroyPage();
currentPage--;
if (currentPage < 0)
currentPage = getNumPages();
createPage(currentPage);
}
@ -301,15 +296,15 @@ void RecipeMenu::goNextPage()
dsq->sound->playSfx("recipemenu-pageturn");
destroyPage();
currentPage++;
int pages = getNumPages();
if (currentPage > pages)
{
currentPage = 0;
}
createPage(currentPage);
}
@ -324,7 +319,7 @@ void RecipeMenu::toggle(bool on, bool watch)
debugLog("RecipeMenu::toggle");
toggling = true;
float t = 0.6;
if (on)
@ -350,7 +345,7 @@ void RecipeMenu::toggle(bool on, bool watch)
}
createPage(currentPage);
nextPage->alpha.interpolateTo(1, 0.2);
prevPage->alpha.interpolateTo(1, 0.2);
}
@ -365,7 +360,7 @@ void RecipeMenu::toggle(bool on, bool watch)
if (this->on)
dsq->sound->playSfx("recipemenu-close");
nextPage->alpha = 0;
prevPage->alpha = 0;
@ -395,7 +390,7 @@ void RecipeMenu::createPage(int p)
{
RecipeMenuEntry *r = new RecipeMenuEntry(&dsq->continuity.recipes[i]);
recipeMenuEntries.push_back(r);
//80 + num * 70
r->position = Vector(500-5, 65 + num * 70);
dsq->game->addRenderObject(r, scroll->layer);
num++;
@ -409,21 +404,21 @@ void RecipeMenu::createPage(int p)
}
}
}
if (num == 0)
{
}
description = new BitmapText(&dsq->smallFont);
description->followCamera = 1;
description->scale = Vector(0.7, 0.7);
description->setAlign(ALIGN_LEFT);
description->position = Vector(364, 334); //most recent: (364, 334) //348, 328
description->position = Vector(364, 334); //most recent: (364, 334) //348, 328
description->color = Vector(0,0,0);//Vector(0.7,0,0);
description->setText("");
description->setWidth(500); // 1000??
dsq->game->addRenderObject(description, scroll->layer);
std::ostringstream os2;

View file

@ -32,7 +32,7 @@ void SFXLoops::updateVolume()
core->sound->updateChannelVolume(roll);
core->sound->updateChannelVolume(charge);
core->sound->updateChannelVolume(shield);
core->sound->updateChannelVolume(current);
core->sound->updateChannelVolume(current);
core->sound->updateChannelVolume(trip);
}

View file

@ -93,7 +93,6 @@ std::string getMapTemplateFilename()
void WarpAreaRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
for (int i = 0; i < dsq->game->warpAreas.size(); i++)
{
WarpArea *a = &dsq->game->warpAreas[i];
@ -141,53 +140,6 @@ void WarpAreaRender::onRender()
}
glTranslatef(-a->position.x, -a->position.y,0);
}
#endif
#ifdef BBGE_BUILD_DIRECTX
for (int i = 0; i < dsq->game->warpAreas.size(); i++)
{
WarpArea *a = &dsq->game->warpAreas[i];
core->translateMatrixStack(a->position.x, a->position.y);
switch (a->warpAreaType[0])
{
case 'B':
core->setColor(0, 0, 1, alpha.x);
break;
case 'R':
core->setColor(1,0,0,alpha.x);
break;
case 'G':
core->setColor(0,1,0,alpha.x);
break;
case 'Y':
core->setColor(1,1,0,alpha.x);
break;
case 'P':
core->setColor(1,0,1,alpha.x);
break;
}
if (a->radius)
{
// drawCircle(a->radius);
}
else
{
core->applyMatrixStackToWorld();
core->blitD3D(0, a->w*2, a->h*2);
/*
glBegin(GL_QUADS);
{
glVertex2f(-a->w,-a->h);
glVertex2f(-a->w,a->h);
glVertex2f(a->w,a->h);
glVertex2f(a->w,-a->h);
}
glEnd();
*/
}
core->translateMatrixStack(-a->position.x, -a->position.y);
//glTranslatef(-a->position.x, -a->position.y,0);
}
#endif
}
SceneEditor::SceneEditor() : ActionMapper(), on(false)
@ -217,8 +169,8 @@ void SceneEditor::changeDepth()
{
if (editingElement)
{
//editingElement->parallax = 0.9;
//editingElement->followCamera = 0.001;
editingElement->followCamera = 0.9;
editingElement->cull = false;
}
@ -280,7 +232,7 @@ public:
if (doubleClickTimer > 0)
doubleClickTimer -= dt;
Quad::onUpdate(dt);
//if ()
if (dsq->game->sceneEditor.selectedEntity.name == selectedEntity.name
|| (entType != -1 && dsq->game->sceneEditor.selectedEntity.typeListIndex == entType))
@ -311,7 +263,7 @@ public:
{
dsq->game->sceneEditor.selectedEntity.setName(selectedEntity.name, selectedEntity.prevGfx);
}
//se_changedEntityType = true;
if (doubleClickTimer > 0)
{
doubleClickTimer = 0;
@ -486,11 +438,7 @@ void SceneEditor::addMainMenuItem(const std::string &label, int bid)
void SceneEditor::openMainMenu()
{
/*
core->clearDebugMenu();
core->addDebugMenuItem("", bid);
core->doModalDebugMenu();
*/
if (core->getNestedMains()>1)
{
@ -512,31 +460,28 @@ void SceneEditor::openMainMenu()
core->main(FRAME_TIME);
}
addMainMenuItem("LOAD LEVEL... (SHIFT-F1)", 100);
addMainMenuItem("RELOAD LEVEL (F1)", 101);
addMainMenuItem("SAVE LEVEL (F2)", 102);
addMainMenuItem("EDIT TILES (F5)", 106);
addMainMenuItem("EDIT ENTITIES (F6)", 107);
addMainMenuItem("EDIT NODES (F7)", 108);
addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103);
addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130);
// addMainMenuItem("REFRESH DATAFILES (F11)", 117);
addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116);
/*
addMainMenuItem("RE-TEMPLATE (F11)", 104);
addMainMenuItem("RE-SKIN (F12)", 105);
*/
addMainMenuItem("SET BG GRADIENT", 110);
addMainMenuItem("SET MUSIC", 111);
addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112);
addMainMenuItem("LOAD LEVEL... (SHIFT-F1)", 100);
addMainMenuItem("RELOAD LEVEL (F1)", 101);
addMainMenuItem("SAVE LEVEL (F2)", 102);
addMainMenuItem("EDIT TILES (F5)", 106);
addMainMenuItem("EDIT ENTITIES (F6)", 107);
addMainMenuItem("EDIT NODES (F7)", 108);
addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103);
addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130);
addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116);
addMainMenuItem("SET BG GRADIENT", 110);
addMainMenuItem("SET MUSIC", 111);
addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112);
if (dsq->game->gridRender)
addMainMenuItem(std::string("TOGGLE TILE COLLISION RENDER ") + ((dsq->game->gridRender->alpha!=0) ? "OFF" : "ON ") + std::string(" (F9)"), 113);
addMainMenuItem("SCREENSHOT ", 114);
addMainMenuItem(std::string("TOGGLE TILE COLLISION RENDER ") + ((dsq->game->gridRender->alpha!=0) ? "OFF" : "ON ") + std::string(" (F9)"), 113);
addMainMenuItem("SCREENSHOT ", 114);
addMainMenuItem("PARTICLE VIEWER ", 120);
addMainMenuItem("ANIMATION EDITOR ", 115);
addMainMenuItem("PARTICLE VIEWER ", 120);
addMainMenuItem("ANIMATION EDITOR ", 115);
while (1 && !core->getKeyState(KEY_TAB))
{
@ -589,7 +534,7 @@ void SceneEditor::init()
btnMenu->label->setText("Menu");
btnMenu->followCamera = 1;
btnMenu->alpha = 0;
//btnMenu->event.set(MakeFunctionEvent(SceneEditor, openMainMenu));
dsq->game->addRenderObject(btnMenu, LR_HUD);
selectedEntityType = 0;
@ -601,7 +546,7 @@ void SceneEditor::init()
text->followCamera = 1;
text->position = Vector(125,20,4.5);
//text->setAlign(ALIGN_CENTER);
dsq->game->addRenderObject(text, LR_HUD);
text->alpha = 0;
selectedVariation = -1;
@ -613,13 +558,12 @@ void SceneEditor::init()
dsq->game->addRenderObject(boxPromo, LR_HUD);
on = false;
//addAction(MakeFunctionEvent(SceneEditor, addSpringPlant), KEY_K, 0);
addAction(MakeFunctionEvent(SceneEditor, loadScene), KEY_F1, 0);
addAction(MakeFunctionEvent(SceneEditor, saveScene), KEY_F2, 0);
// removed in fc3
//addAction(MakeFunctionEvent(SceneEditor, setGroup), KEY_G, 0);
addAction(MakeFunctionEvent(SceneEditor, moveToBack), KEY_Z, 0);
addAction(MakeFunctionEvent(SceneEditor, moveToFront), KEY_X, 0);
@ -640,12 +584,6 @@ void SceneEditor::init()
/*
addAction(MakeFunctionEvent(SceneEditor, placeEntity), KEY_U, 0);
addAction(MakeFunctionEvent(SceneEditor, removeEntity), KEY_I, 0);
*/
//addAction(MakeFunctionEvent(SceneEditor, changeDepth), KEY_N, 0);
addAction(MakeFunctionEvent(SceneEditor, placeElement), KEY_SPACE, 1);
addAction(MakeFunctionEvent(SceneEditor, enterName), KEY_N, 0);
@ -667,7 +605,7 @@ void SceneEditor::init()
addAction(MakeFunctionEvent(SceneEditor, generateLevel), KEY_F11, 0);
addAction(MakeFunctionEvent(SceneEditor, skinLevel), KEY_F12, 0);
//addAction(MakeFunctionEvent(SceneEditor, regenLevel), KEY_F12, 0);
addAction(MakeFunctionEvent(SceneEditor, nextEntityType), KEY_RIGHT, 0);
addAction(MakeFunctionEvent(SceneEditor, prevEntityType), KEY_LEFT, 0);
@ -699,17 +637,6 @@ void SceneEditor::init()
addAction(MakeFunctionEvent(SceneEditor, dumpObs), KEY_F8, 0);
/*
// OLD CRAP
addAction(MakeFunctionEvent(SceneEditor, rotateElement), KEY_MULTIPLY, 0);
addAction(MakeFunctionEvent(SceneEditor, rotateElement2), KEY_DIVIDE, 0);
addAction(MakeFunctionEvent(SceneEditor, scaleElementUp), KEY_NUMPAD7, 0);
addAction(MakeFunctionEvent(SceneEditor, scaleElementDown), KEY_NUMPAD1, 0);
addAction(MakeFunctionEvent(SceneEditor, scaleElement1), KEY_NUMPAD0, 0);
addAction(MakeFunctionEvent(SceneEditor, nextVariation), KEY_UP, 0);
addAction(MakeFunctionEvent(SceneEditor, prevVariation), KEY_DOWN, 0);
*/
addAction(ACTION_ZOOMIN, KEY_PGUP);
addAction(ACTION_ZOOMOUT, KEY_PGDN);
@ -844,10 +771,10 @@ void SceneEditor::alignVert()
void SceneEditor::createAquarian()
{
//if (dsq->mod.isActive()) return;
static bool inCreateAqurian = false;
if (inCreateAqurian) return;
//if (dsq->game->isPaused()) return;
inCreateAqurian = true;
std::string t = dsq->getUserInputString("Enter Aquarian:", "");
stringToUpper(t);
@ -863,7 +790,7 @@ void SceneEditor::createAquarian()
{
v = 1024+26;
}
//ElementTemplate et = dsq->game->getElementTemplateForLetter(v);
dsq->game->createElement(v, startPos + Vector(64*i,0), this->bgLayer);
}
inCreateAqurian = false;
@ -935,17 +862,17 @@ void SceneEditor::toggleWarpAreaRender()
warpAreaRender->alpha.x = 0.5;
else if (warpAreaRender->alpha.x >= 0.5f)
warpAreaRender->alpha.x = 0;
//warpAreaRender->alpha.interpolateTo(1, 0.2);
}
void SceneEditor::setGridPattern(int gi)
{
if (selectedElements.size())
for (int i = 0; i < selectedElements.size(); ++i)
selectedElements[i]->setElementEffectByIndex(gi);
else if (editingElement)
editingElement->setElementEffectByIndex(gi);
if (selectedElements.size())
for (int i = 0; i < selectedElements.size(); ++i)
selectedElements[i]->setElementEffectByIndex(gi);
else if (editingElement)
editingElement->setElementEffectByIndex(gi);
}
void SceneEditor::setGridPattern0()
@ -1038,7 +965,7 @@ void SceneEditor::editModeEntities()
//target->alpha.interpolateTo(0, 0.5);
editType = ET_ENTITIES;
//dsq->game->entityTypeList[curEntity].prevGfx
placer->setTexture(selectedEntity.prevGfx);
placer->alpha = 0.5;
pathRender->alpha = 0;
@ -1066,7 +993,7 @@ Element *SceneEditor::getElementAtCursor()
{
if (e->life == 1)
{
if (e->isCoordinateInside(dsq->getGameCursorPosition()))//, minSelectionSize
if (e->isCoordinateInside(dsq->getGameCursorPosition()))
{
Vector v = dsq->getGameCursorPosition() - e->position;
int dist = v.getSquaredLength2D();
@ -1157,11 +1084,8 @@ void SceneEditor::deleteSelected()
}
else
p->removeNode(selectedNode);
/*
if (p->nodes.size() > 1)
p->nodes.resize(p->nodes.size()-1);
*/
//selectedIdx = -1;
}
}
}
@ -1362,11 +1286,7 @@ void SceneEditor::updateEntitySaveData(Entity *editingEntity)
{
if (editingEntity)
{
/*
std::ostringstream os;
os << "oldPos (" << oldPosition.x << ", " << oldPosition.y << ")";
debugLog(os.str());
*/
EntitySaveData *d = dsq->game->getEntitySaveDataForEntity(editingEntity, oldPosition);
if (d)
{
@ -1374,22 +1294,18 @@ void SceneEditor::updateEntitySaveData(Entity *editingEntity)
os << "idx1: " << d->idx << " ";
os << "idx2: " << editingEntity->entityTypeIdx << " ";
os << "name: " << editingEntity->name;
//os << "state: " << editingEntity->getState();
debugLog(os.str());
//debugLog("changing entity save data");
d->x = editingEntity->position.x;
d->y = editingEntity->position.y;
editingEntity->startPos = Vector(d->x, d->y);
/*
std::ostringstream os2;
os2 << "setting savedata rot to: " << d->rot;
debugLog(os2.str());
*/
d->rot = editingEntity->rotation.z;
}
else
{
//debugLog("didn't get entity save data");
}
}
}
@ -1458,7 +1374,7 @@ void SceneEditor::mouseButtonRightUp()
checkForRebuild();
}
state = ES_SELECTING;
//dsq->game->reconstructGrid();
}
@ -1664,7 +1580,7 @@ bool getGrassPixel(pngRawInfo *png, int x, int y)
{
if (x >= png->Width || y >= png->Height || x < 0 || y < 0) return false;
//int c = ((x*png->Width)*3)+y*3;
int c = (y*png->Width)*png->Components + x*png->Components;
if (png->Data[c] == 128 &&
png->Data[c+1] == 255 &&
@ -1738,21 +1654,15 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
)
)
{
// do color check
/*
int ci = x+(y*png->Height);
if (png->data[ci] < pixelColor.x &&
png->data[ci+1] < pixelColor.y &&
png->data[ci+2] < pixelColor.z)
{
*/
float dist=0;
wallNormal = dsq->game->getWallNormal(t.worldVector(), 5, &dist, OT_MASK_BLACK);
offset = wallNormal*(-TILE_SIZE*0.6f);
MathFunctions::calculateAngleBetweenVectorsInDegrees(Vector(0,0,0), wallNormal, rot);
rot = 180-(360-rot);
addTile = true;
//}
}
if (addTile)
@ -1788,7 +1698,7 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
Element *e = dsq->getElement(i);
if (e->templateIdx <= 4 && e->templateIdx >= 1)
{
if ((p - e->position).getSquaredLength2D() < sqr(120))//sqr(60*3+10)) // 120
if ((p - e->position).getSquaredLength2D() < sqr(120))
{
cantUse[e->templateIdx-1]++;
}
@ -1811,40 +1721,6 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
e->offset = offset;
/*
bool addGrass = false;
int search = 2;
for (int dx = -search; dx < search; dx++)
{
for (int dy = -search; dy < search; dy++)
{
if (getGrassPixel(png, x+dx, y+dy))
{
//std::ostringstream os;
//os << "found grass pixel at (" << x+dx << ", " << y+dy << ")";
//debugLog(os.str());
//errorLog ("add grass");
addGrass = true;
break;
}
}
}
if (addGrass)
{
//Vector detailPos = p + wallNormal*48;
Element *grassE = dsq->game->createElement(5, p, 0, &q);
//dsq->game->createElement(5, detailPos, 6, &q);
//grassE->offset = offset;
}
*/
/*
float sz = ((rand()%1000)/4000.0f);
e->scale = Vector(1+sz, 1+sz, 1);
*/
idx++;
if(idx > 4)
@ -1864,24 +1740,13 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
}
}
void SceneEditor::fixEntityIDs()
{
FOR_ENTITIES(i)
{
Entity *e = *i;
e->assignUniqueID();
}
}
void SceneEditor::generateLevel()
{
//pngSetStandardOrientation(0);
std::string file=getMapTemplateFilename();
//pngInfo info;
//PNG_ALPHA
//errorLog("generate level");
// Y R G B P
std::string file=getMapTemplateFilename();
int maxX=0, maxY=0;
const int YELLOW=0, RED=1, GREEN=2, BLUE=3, PURPLE=4, ORANGE=5, BROWN=6, MAX=7;
int firstColorX[MAX], firstColorY[MAX];
@ -1903,10 +1768,10 @@ void SceneEditor::generateLevel()
bool success = pngLoadRaw(file.c_str(), &rawinfo);
if (success)
{
//dsq->elements.clear();
std::vector<Row> rows;
std::vector<Vector> positions;
const int maxRowCount = 9999;//9999;//9999;
const int maxRowCount = 9999;
int rowCount = 0;
if (rawinfo.Components < 3)
{
@ -1914,7 +1779,7 @@ void SceneEditor::generateLevel()
}
int scale = TILE_SIZE;
int c = 0;
//for (int y = rawinfo.Height-1; y >= 0; y--)
for (int y = 0; y < rawinfo.Height; y++)
{
Vector lastElement;
@ -1959,7 +1824,7 @@ void SceneEditor::generateLevel()
}
for (int i = 0; i < MAX; i++)
{
//if (checkWarpPixel(rawinfo.Data, c, colorVects[i]))
bool p1, p2, p3;
p1=p2=p3=false;
int diff;
@ -1969,25 +1834,7 @@ void SceneEditor::generateLevel()
p2 = (diff < 5);
diff = fabsf((colorVects[i].z*255) - rawinfo.Data[c+2]);
p3 = (diff < 5);
/*
p1 = (colorVects[i].x == 1 && rawinfo.Data[c] > 200);
if (!p1)
{
p1 = (colorVects[i].x == 0 && rawinfo.Data[c] < 32);
}
p2 = (colorVects[i].y == 1 && rawinfo.Data[c+1] > 200);
if (!p2)
{
p2 = (colorVects[i].y == 0 && rawinfo.Data[c+1] < 32);
if (!p2)
{
p2 = (colorVects[i].y == 0.5f && rawinfo.Data[c+1] > 96 && rawinfo.Data[c+1] < 164);
}
}
p3 = (colorVects[i].z == 1 && rawinfo.Data[c+2] > 200);
if (!p3)
p3 = (colorVects[i].z == 0 && rawinfo.Data[c+2] < 32);
*/
if (p1 && p2 && p3)
{
lastColorX[i] = x;
@ -1999,63 +1846,25 @@ void SceneEditor::generateLevel()
}
}
}
/*
else if (checkPixel(1, 0, 0))
{
lastColorX[RED] = x;
lastColorY[RED] = y;
if (firstColorX[RED] == -1)
{
firstColorX[RED] = x;
firstColorY[RED] = y;
}
}
*/
/*
else if ( rawinfo.Data[c] > 200 &&
rawinfo.Data[c+1] < 32 &&
rawinfo.Data[c+2] < 32)
{
}
else if (rawinfo.
*/
c += rawinfo.Components;
if ((e==0 && firstRowElement) || (firstRowElement && rowCount >= maxRowCount && hasLastElement)
|| (firstRowElement && x == rawinfo.Width-1))
{
/*
if (x == rawinfo.Width-1)
row.x2 = rawinfo.Width-1;
else
{
*/
// HACK: it crashes here:
// because lastElement is garbage data
// fixed!
if (hasLastElement)
row.x2 = lastElement.x;
//}
hasLastElement = false;
firstRowElement = 0;
bool add = true;
/*
for (int i = 0; i < rows.size(); i++)
{
if (rows[i].x1 == row.x1 && rows[i].x2 == row.x2)
{
if (abs(rows[i].y - row.y) <= TILE_SIZE+1)
{
rows[i].rows++;
add = false;
break;
}
}
}
*/
if (add)
rows.push_back(row);
}
@ -2082,7 +1891,7 @@ void SceneEditor::generateLevel()
for (i = 0; i < rows.size(); i++)
{
int w = rows[i].x2 - rows[i].x1;
//int h = scale * rows[i].rows;
int useY = rows[i].y;
if (rows[i].rows > 1)
{
@ -2140,7 +1949,7 @@ void SceneEditor::generateLevel()
this->skinMinY = 4;
this->skinMaxX = maxX;
this->skinMaxY = maxY;
//skinLevel(&rawinfo, 4, 4, maxX, maxY);
if (rawinfo.Data != NULL)
free(rawinfo.Data);
}
@ -2303,9 +2112,7 @@ void SceneEditor::action(int id, int state)
this->bgLayer = newLayer;
}
/*
Vector multiSelectPoint, secondMultiSelectPoint;
*/
if (id == ACTION_MULTISELECT && this->state == ES_SELECTING)
{
if (state)
@ -2407,7 +2214,7 @@ void destroyEntityPage()
}
if (se_grad)
{
//se_grad->safeKill();
se_grad->setLife(1);
se_grad->setDecayRate(10);
se_grad->fadeAlphaWithLife = 1;
@ -2430,8 +2237,8 @@ void createEntityPage()
destroyEntityPage();
se_grad = new Quad();
//Gradient()
//se_grad->makeHorizontal(Vector(0,0,0.3), Vector(0,0,0.1));
se_grad->scale = Vector(800, 500);
se_grad->position = Vector(400,350);
se_grad->followCamera = 1;
@ -2481,7 +2288,7 @@ void createEntityPage()
{
q->setWidthHeight((q->getWidth()*sizing) / q->getHeight(), sizing);
}
//q->setWidthHeight(sizing, sizing);
q->followCamera = 1;
dsq->game->addRenderObject(q, LR_HUD);
qs.push_back(q);
@ -2537,12 +2344,12 @@ void SceneEditor::selectEntityFromGroups()
if (core->mouse.position.y < 100)
break;
}
if (core->getKeyState(KEY_ESCAPE))
break;
if (core->getKeyState(KEY_SPACE))
break;
if (!core->getKeyState(KEY_E))
ld = false;
else if (!ld)
@ -2550,7 +2357,7 @@ void SceneEditor::selectEntityFromGroups()
ld=true;
nextEntityPage();
}
if (!core->getKeyState(KEY_R))
rd = !true;
else if (!rd)
@ -2722,7 +2529,7 @@ void SceneEditor::prevElement()
cycleElementPrev(editingElement);
editingElement = 0;
}
else
else
{
doPrevElement();
}
@ -2883,7 +2690,7 @@ void SceneEditor::cloneSelectedElement()
Element *e = dsq->game->createElement(e1->templateIdx, placer->position + Vector(40,40), e1->bgLayer, e1);
e->elementFlag = e1->elementFlag;
e->setElementEffectByIndex(e1->getElementEffectIndex());
//e->repeatTextureToFill(e1->isRepeatingTextureToFill());
}
dsq->game->reconstructGrid();
}
@ -2947,7 +2754,7 @@ void SceneEditor::toggle(bool on)
movingEntity = 0;
dsq->toggleCursor(true);
dsq->setCursor(CURSOR_NORMAL);
//core->flags.set(CF_CLEARBUFFERS);
dsq->darkLayer.toggle(false);
@ -2968,7 +2775,7 @@ void SceneEditor::toggle(bool on)
else
{
btnMenu->alpha = 0;
//dsq->game->reconstructGrid();
selectedElements.clear();
for (int i = 0; i < 9; i++)
dsq->getRenderObjectLayer(LR_ELEMENTS1+i)->visible = true;
@ -2985,7 +2792,7 @@ void SceneEditor::toggle(bool on)
dsq->game->avatar->enableInput();
text->alpha.interpolateTo(0, 0.2);
placer->alpha.interpolateTo(0, 0.2);
//core->flags.unset(CF_CLEARBUFFERS);
dsq->darkLayer.toggle(true);
dsq->game->rebuildElementUpdateList();
@ -3007,8 +2814,8 @@ void SceneEditor::updateText()
std::ostringstream os;
os << dsq->game->sceneName << " bgL[" << bgLayer << "] (" <<
(int)dsq->cameraPos.x << "," << (int)dsq->cameraPos.y << ") ("
//<< (int)dsq->game->avatar->position.x
//<< "," << (int)dsq->game->avatar->position.y << "," << (int)dsq->game->avatar->position.z << ")" << " ("
<< (int)dsq->getGameCursorPosition().x << "," << (int)dsq->getGameCursorPosition().y << ")" << " ";
switch(editType)
{
@ -3056,6 +2863,9 @@ void SceneEditor::updateText()
if (getSelectedPath())
os << " name: " << getSelectedPath()->name;
break;
case ET_SELECTENTITY:
case ET_MAX:
break;
}
text->setText(os.str());
}
@ -3185,6 +2995,10 @@ void SceneEditor::update(float dt)
else
placer->alpha = 0.5;
break;
case ET_PATHS:
case ET_SELECTENTITY:
case ET_MAX:
break;
}
updateText();
@ -3263,7 +3077,7 @@ void SceneEditor::update(float dt)
smallestDist = dist;
selectedIdx = i;
selectedNode = n;
//return;
}
}
}
@ -3292,6 +3106,9 @@ void SceneEditor::update(float dt)
if (selectedIdx >= 0)
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
break;
case ES_ROTATING:
case ES_MAX:
break;
}
}
else if (editType == ET_ENTITIES)
@ -3319,6 +3136,11 @@ void SceneEditor::update(float dt)
}
}
}
break;
case ES_SELECTING:
case ES_SCALING:
case ES_MAX:
break;
}
}
else if (editType == ET_ELEMENTS)
@ -3386,7 +3208,7 @@ void SceneEditor::update(float dt)
else if (cursorOffset.x < oldPosition.x-10)
right = false;
else
noSide = 1;
noSide = true;
if (cursorOffset.y > oldPosition.y+10)
down = true;
else if (cursorOffset.y < oldPosition.y-10)
@ -3451,7 +3273,7 @@ void SceneEditor::update(float dt)
}
else
{
//editingElement->scale=oldScale + add;
editVec = (repeatScale ? oldRepeatScale : oldScale) + add;
if (!uni && !repeatScale)
{
@ -3484,6 +3306,8 @@ void SceneEditor::update(float dt)
}
}
break;
case ES_MAX:
break;
}
}
}
@ -3526,8 +3350,8 @@ void SceneEditor::prevEntityType()
void SceneEditor::dumpObs()
{
TileVector tv;
unsigned char *data = new unsigned char[MAX_GRID * MAX_GRID * sizeof(uint32)];
uint32 *ptr = (uint32*)data;
unsigned char *data = new unsigned char[MAX_GRID * MAX_GRID * sizeof(unsigned)];
unsigned *ptr = (unsigned*)data;
for(tv.y = MAX_GRID - 1; ; --tv.y)
{
for(tv.x = 0; tv.x < MAX_GRID; ++tv.x)

View file

@ -25,10 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
const float strengthSeparation = 1;
const float strengthAlignment = 0.8f;
const float strengthAvoidance = 1;
//const float strengthAvoidance = 1;
const float strengthCohesion = 0.5f;
const float avoidanceDistance = 128;
//const float avoidanceDistance = 128;
const float separationDistance = 128;
const float minUrgency = 5;//0.05;
const float maxUrgency = 10;//0.1;
@ -50,12 +50,8 @@ SchoolFish::SchoolFish(const std::string &texname) : FlockEntity()
float randScale = float(rand()%200)/1000.0f;
scale = Vector(0.6f-randScale, 0.6f-randScale);
/*
float randColor = float(rand()%250)/1000.0f;
color = Vector(1-randColor, 1-randColor, 1-randColor);
*/
//color.interpolateTo(Vector(0.5, 0.5, 0.5), 2, -1, 1);
color.ensureData();
color.data->path.addPathNode(Vector(1,1,1), 0);
color.data->path.addPathNode(Vector(1,1,1), 0.5);
@ -72,30 +68,24 @@ SchoolFish::SchoolFish(const std::string &texname) : FlockEntity()
setEntityType(ET_ENEMY);
canBeTargetedByAvatar = true;
health = maxHealth = 1;
//scale = Vector(0.5, 0.5);
avoidTime=0;
vel = Vector(-minUrgency, 0);
setTexture(texname);
flockType = FLOCK_FISH;
//updateCull = -1;
updateCull = 4000;
collideRadius = 20;
//2 32 0.1 0.1 -0.03 0 4 0
setSegs(8, 2, 0.1, 0.9, 0, -0.03, 8, 0);
/*
setDamageTarget(DT_AVATAR_SPORECHILD, false);
setDamageTarget(DT_AVATAR_ENERGYBLAST, false);
*/
//setAllDamageTargets(true);
setDamageTarget(DT_AVATAR_LIZAP, false);
/*
setDamageTarget(DT_AVATAR_ENERGYBLAST, false);
setDamageTarget(DT_AVATAR_SHOCK, false);
*/
//setDamageTarget(DT_AVATAR_BITE, true);
// updateCull = 10248;
targetPriority = -1;
setEatType(EAT_FILE, "SchoolFish");
@ -111,7 +101,7 @@ void SchoolFish::onEnterState(int action)
Entity::onEnterState(action);
if (action == STATE_DEAD)
{
//rotation.interpolateTo(Vector(0,0,180), 2);
vel.setLength2D(vel.getLength2D()*-1);
oldFlockID = flock ? flock->flockID : -1;
@ -119,24 +109,11 @@ void SchoolFish::onEnterState(int action)
doDeathEffects(0, false);
/*
alpha = 0;
alphaMod = 0;
*/
respawnTimer = 20 + rand()%20;
alphaMod = 0;
/*
this->setLife(2);
this->setDecayRate(1);
this->fadeAlphaWithLife = true;
*/
/*
dsq->game->spawnIngredient("FishOil", position, 10);
dsq->game->spawnIngredient("FishMeat", position, 10);
dsq->game->spawnIngredient("SmallEgg", position, 10);
dsq->game->spawnIngredient("PlantLeaf", position, 60);
*/
if (!isGoingToBeEaten())
{
@ -182,54 +159,27 @@ void SchoolFish::updateVelocity(Vector &accumulator)
vel.z = 0;
if (fabsf(vel.y) > fabsf(vel.x))
{
/*
float sign = vel.y / fabsf(vel.y);
vel.y = fabsf(vel.x) * sign;
*/
//std::swap(vel.x, vel.y);
// going up
/*
float len = vel.getLength2D();
if (vel.y < 0)
{
if (vel.x < 0)
vel.y = vel.x;
else
vel.y = -vel.x;
}
else
{
if (vel.x < 0)
vel.y = -vel.x;
else
vel.y = vel.x;
}
vel.setLength2D(len);
*/
}
}
inline
void SchoolFish::avoid(Vector &accumulator, Vector pos, bool inv)
{
//accumulator = Vector(0,0,0);
Vector change;
if (inv)
change = pos - this->position;
else
change = this->position - pos;
//change = position;
//change -= this->position;
change.setLength2D(maxUrgency);
//change |= maxUrgency;
//change = Vector(100,0);
//avoidTime = 2;
/*
std::ostringstream os;
os << "change(" << change.x << ", " << change.y << ")";
debugLog (os.str());
*/
change.setLength2D(maxUrgency);
accumulator += change;
}
@ -256,7 +206,6 @@ void SchoolFish::applyAvoidance(Vector &accumulator)
}
//return;
if (avoidTime>0) return;
@ -285,7 +234,7 @@ void SchoolFish::applyAvoidance(Vector &accumulator)
const float tileMult = (float)TILE_SIZE / (float)obsCount;
Vector change(obsSumX*tileMult, obsSumY*tileMult);
change += position - t0.worldVector();
//change |= 200;
float dist = change.getLength2D();
float ratio = dist / radius;
@ -346,7 +295,7 @@ void SchoolFish::applyCohesion(Vector &accumulator)
change = dsq->game->avatar->position - position;
change.setLength2D(maxUrgency*strengthCohesion);
accumulator += change;
//avoid(accumulator, dsq->game->avatar->position, true);
}
}
}
@ -368,12 +317,12 @@ void SchoolFish::applySeparation(Vector &accumulator)
if (!change.isZero())
{
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;
*/
}
@ -382,47 +331,8 @@ void SchoolFish::applySeparation(Vector &accumulator)
void SchoolFish::onUpdate(float dt)
{
BBGE_PROF(SchoolFish_onUpdate);
/*
Quad::onUpdate(dt);
return;
*/
/*
if (dsq->continuity.form == FORM_BEAST)
this->activationType = ACT_CLICK;
else
this->activationType = ACT_NONE;
*/
/*
if (burstDelay == 0)
{
maxSpeedLerp = 2;
Vector v = getNormal();
vel = 0;
v *= -5000;
vel += v;
//float t = (100 + rand()%100)/100.0f;
float t = 2;
maxSpeedLerp.interpolateTo(1, t);
burstDelay = 10;// + (rand()%100)/100.0f;
//rotateToVec(v, 0, 90);
//rotation.interpolateTo(0, 1);
if (v.x > 0 && !isfh())
{
flipHorizontal();
flipDelay = 0.5;
}
if (v.x < 0 && isfh())
{
flipHorizontal();
flipDelay = 0.5;
}
}
else
*/
{
burstDelay -= dt;
@ -437,13 +347,8 @@ void SchoolFish::onUpdate(float dt)
if (this->layer < LR_ENTITIES)
{
//debugLog("background fish!");
/*
setDamageTarget(DT_AVATAR_SHOCK, false);
setDamageTarget(DT_AVATAR_BITE, false);
setDamageTarget(DT_AVATAR_VOMIT, false);
setDamageTarget(DT_AVATAR_ENERGYBLAST, false);
*/
setEntityType(ET_NEUTRAL);
collideRadius = 0;
}
@ -463,18 +368,7 @@ void SchoolFish::onUpdate(float dt)
}
else
{
/*
if (layer == LR_ENTITIES || layer == LR_ENTITIES2)
{
rippleTimer -= dt;
if (rippleTimer < 0)
{
if (core->afterEffectManager)
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),position,0.04,0.06,15,0.2f));
rippleTimer = 0.5;
}
}
*/
FlockEntity::onUpdate(dt);
@ -482,31 +376,7 @@ void SchoolFish::onUpdate(float dt)
dsq->game->handleShotCollisions(this);
/*
soundDelay -= dt;
if (soundDelay <= 0)
{
//sound(swimSound, 1000 + rand()%100);
soundDelay = 4+(rand()%50)/100.0f;
}
*/
/*
1. if distance_to(closest_boid) <= too_close then set direction away from closest_boid
2. speed_of_neighbors := average(speed(x), for all x where distance_to(x) <= neighborhood_size)
direction_of_neighbors := avg(direction(x), for all x where distance_to(x) <= neighborhood_size)
if speed < speed_of_neighbors then increase speed
if speed > speed_of_neighbors then decrease speed
turn towards direction_of_neighbors
3. position_of_neighbors := avg(position(x), for all x where distance_to(x) <= neighborhood_size)
turn towards position_of_neighbors
*/
/*
FlockPiece flock;
getFlockInRange(160, &flock);
*/
// if flock in 160 ?
if (true)
{
VectorSet newDirection;
@ -530,10 +400,6 @@ void SchoolFish::onUpdate(float dt)
applyAvoidance(accumulator);
updateVelocity(accumulator);
/*
if (dsq->game->isValidTarget(this, 0))
doSpellAvoidance(dt, 96, dodgeAbility);
*/
Vector lastPosition = position;
@ -542,57 +408,21 @@ void SchoolFish::onUpdate(float dt)
if (dsq->game->isObstructed(position))
{
position = lastPosition;
/*
Vector newPosition = position;
position = Vector(newPosition.x, lastPosition.y);
if (dsq->game->isObstructed(position))
{
position = Vector(lastPosition.x, newPosition.y);
if (dsq->game->isObstructed(position))
{
position = lastPosition;
}
}
*/
}
//updateCurrents(dt);
updateVel2(dt);
/*
if (flipDelay > 0)
{
flipDelay -= dt;
if (flipDelay < 0)
{
flipDelay = 0;
}
}
*/
flipDelay = 0;
//dir.normalize2D();
if (flipDelay <= 0)
{
const float amt = 0;
/*
if (fabsf(dir.x) > fabsf(dir.y))
{
if (dir.x > amt && !isfh())
{
flipHorizontal();
flipDelay = 0.5;
}
if (dir.x < -amt && isfh())
{
flipHorizontal();
flipDelay = 0.5;
}
}
*/
if (vel.x > amt && !isfh())
{
flipHorizontal();
@ -604,7 +434,6 @@ void SchoolFish::onUpdate(float dt)
}
//rotateToVec(accumulator, 5, 90);
float angle = atan2f(dir.x<0 ? -dir.y : dir.y, fabsf(dir.x));
angle = ((angle*180)/PI);
@ -613,11 +442,11 @@ void SchoolFish::onUpdate(float dt)
angle = 45;
if (angle < -45)
angle = -45;
rotation = Vector(0,0,angle);
//rotation.interpolateTo(Vector(0, 0, angle), 0);
}
}
@ -626,19 +455,6 @@ void SchoolFish::onUpdate(float dt)
void SchoolFish::onRender()
{
FlockEntity::onRender();
/*
glDisable(GL_BLEND);
glPointSize(12);
glDisable(GL_LIGHTING);
glColor3f(1,1,1);
glBegin(GL_POINTS);
glVertex3f(0,0,0);
glEnd();
glBegin(GL_LINES);
glVertex3f(0,0,0);
glVertex3f(vel.x*50, vel.y*50, 0);
glEnd();
*/
}

View file

@ -42,13 +42,13 @@ protected:
void applyAlignment(Vector &accumulator, const Vector &dir);
void applyAvoidance(Vector &accumulator);
void updateVelocity(Vector &accumulator);
void onEnterState(int action);
void onUpdate(float dt);
void onRender();
float avoidTime;
};
#endif

View file

@ -1,4 +1,4 @@
/*
#/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
@ -586,16 +586,6 @@ BaseText *getText(lua_State *L, int slot = 1)
return q;
}
static inline
Shader *getShader(lua_State *L, int slot = 1)
{
Shader *q = (Shader*)lua_touserdata(L, slot);
ENSURE_TYPE(q, SCO_SHADER);
if (!q)
scriptDebug(L, "Invalid Shader");
return q;
}
static SkeletalSprite *getSkeletalSprite(Entity *e)
{
return e ? &e->skeletalSprite : NULL;
@ -898,6 +888,17 @@ luaFunc(getModPath)
luaReturnStr(path.c_str());
}
luaFunc(getInterfaceFunctionNames)
{
lua_newtable(L);
for(unsigned i = 0; interfaceFunctions[i]; ++i)
{
lua_pushstring(L, interfaceFunctions[i]);
lua_rawseti(L, -2, i+1);
}
return 1;
}
// ----- RenderObject common functions -----
@ -1129,6 +1130,12 @@ luaFunc(obj_setBlendType)
luaReturnNil();
}
luaFunc(obj_getBlendType)
{
RenderObject *r = robj(L);
luaReturnInt(r ? r->blendType : 0);
}
luaFunc(obj_setTexture)
{
RenderObject *r = robj(L);
@ -1217,6 +1224,51 @@ luaFunc(obj_addChild)
luaReturnNil();
}
luaFunc(obj_getChild)
{
RenderObject *r = robj(L);
size_t idx = lua_tointeger(L, 2);
luaReturnPtr(r && idx < r->children.size() ? r->children[idx] : NULL);
}
luaFunc(obj_removeChild)
{
RenderObject *r = robj(L);
RenderObject *which = robj(L, 2);
if(r && which)
r->removeChild(which);
luaReturnNil();
}
luaFunc(obj_removeChildIdx)
{
RenderObject *r = robj(L);
size_t idx = lua_tointeger(L, 2);
if(r && idx < r->children.size())
r->removeChild(r->children[idx]);
luaReturnNil();
}
luaFunc(obj_removeAllChildren)
{
RenderObject *r = robj(L);
bool del = getBool(L, 2);
if(r)
{
if(del)
for(RenderObject::Children::iterator it = r->children.begin(); it != r->children.end(); ++it)
(*it)->safeKill();
r->children.clear();
}
luaReturnNil();
}
luaFunc(obj_getNumChildren)
{
RenderObject *r = robj(L);
luaReturnInt(r ? (int)r->children.size() : 0);
}
luaFunc(obj_setRenderBeforeParent)
{
RenderObject *r = robj(L);
@ -1831,6 +1883,7 @@ luaFunc(quad_getBorderAlpha)
RO_FUNC(getter, prefix, x ) \
RO_FUNC(getter, prefix, y ) \
RO_FUNC(getter, prefix, setBlendType ) \
RO_FUNC(getter, prefix, getBlendType ) \
RO_FUNC(getter, prefix, setTexture ) \
RO_FUNC(getter, prefix, delete ) \
RO_FUNC(getter, prefix, getLife ) \
@ -1864,6 +1917,11 @@ luaFunc(quad_getBorderAlpha)
RO_FUNC(getter, prefix, setRenderBeforeParent) \
RO_FUNC(getter, prefix, isRenderBeforeParent) \
RO_FUNC(getter, prefix, addChild ) \
RO_FUNC(getter, prefix, getChild ) \
RO_FUNC(getter, prefix, removeChild ) \
RO_FUNC(getter, prefix, removeChildIdx ) \
RO_FUNC(getter, prefix, removeAllChildren) \
RO_FUNC(getter, prefix, getNumChildren ) \
RO_FUNC(getter, prefix, fh ) \
RO_FUNC(getter, prefix, fv ) \
RO_FUNC(getter, prefix, fhTo ) \
@ -2090,7 +2148,7 @@ luaFunc(getNoteColor)
luaFunc(getRandNote)
{
//int note = lua_tointeger(L, 1);
luaReturnNum(dsq->getRandNote());
}
@ -2212,11 +2270,7 @@ luaFunc(shot_setOut)
Vector adjust = shot->velocity;
adjust.setLength2D(outness);
shot->position += adjust;
/*
std::ostringstream os;
os << "out(" << adjust.x << ", " << adjust.y << ")";
debugLog(os.str());
*/
}
luaReturnNil();
}
@ -2478,7 +2532,7 @@ static size_t _shotFilter(lua_State *L)
for(Shot::Shots::iterator it = Shot::shots.begin(); it != Shot::shots.end(); ++it)
{
Shot *s = *it;
if (s->isActive() && s->life >= 1.0f)
{
if (dt == DT_NONE || s->getDamageType() == dt)
@ -2675,7 +2729,7 @@ luaFunc(entity_getBoneLockEntity)
{
BoneLock *b = e->getBoneLock();
ent = b->entity;
//ent = e->boneLock.entity;
}
luaReturnPtr(ent);
}
@ -2935,11 +2989,7 @@ luaFunc(isWithin)
Vector v1 = getVector(L, 1);
Vector v2 = getVector(L, 3);
float dist = lua_tonumber(L, 5);
/*
std::ostringstream os;
os << "v1(" << v1.x << ", " << v1.y << ") v2(" << v2.x << ", " << v2.y << ")";
debugLog(os.str());
*/
Vector d = v2-v1;
bool v = false;
if (d.isLength2DIn(dist))
@ -4031,29 +4081,13 @@ luaFunc(entity_isNearGround)
Vector v = dsq->game->getWallNormal(e->position, sampleArea);
if (!v.isZero())
{
//if (v.y < -0.5f && fabsf(v.x) < 0.4f)
if (v.y < 0 && fabsf(v.x) < 0.6f)
{
value = true;
}
}
/*
Vector v = e->position + Vector(0,e->collideRadius + TILE_SIZE/2);
std::ostringstream os;
os << "checking (" << v.x << ", " << v.y << ")";
debugLog(os.str());
TileVector t(v);
TileVector c;
for (int i = -5; i < 5; i++)
{
c.x = t.x+i;
c.y = t.y;
if (dsq->game->isObstructed(t))
{
value = true;
}
}
*/
}
luaReturnBool(value);
}
@ -4498,7 +4532,7 @@ luaFunc(entity_getAnimationLoop)
luaFunc(entity_move)
{
Entity *e = entity(L);
bool ease = lua_tointeger(L, 5);
//bool ease = lua_tointeger(L, 5);
Vector p(lua_tonumber(L, 2), lua_tonumber(L, 3));
if (getBool(L, 6))
p = e->position + p;
@ -4662,7 +4696,7 @@ luaFunc(savePoint)
Vector position;
if (p)
{
//dsq->game->avatar->moveToNode(p, 0, 0, 1);
position = p->nodes[0].position;
}
@ -4676,6 +4710,12 @@ luaFunc(saveMenu)
luaReturnNil();
}
luaFunc(setSceneDisplayNameInSave)
{
dsq->game->sceneDisplayName = getString(L);
luaReturnNil();
}
luaFunc(pause)
{
dsq->game->togglePause(1);
@ -4794,7 +4834,7 @@ luaFunc(entity_damage)
if (e)
{
DamageData d;
//d.attacker = e;
d.attacker = lua_isuserdata(L, 2) ? entity(L, 2) : NULL;
d.damage = lua_tonumber(L, 3);
d.damageType = (DamageType)lua_tointeger(L, 4);
@ -4967,11 +5007,7 @@ luaFunc(decrFlag)
luaFunc(setFlag)
{
/*
if (lua_isstring(L, 1))
dsq->continuity.setFlag(lua_tostring(L, 1), lua_tonumber(L, 2));
else
*/
dsq->continuity.setFlag(lua_tointeger(L, 1), lua_tointeger(L, 2));
luaReturnNil();
}
@ -4979,11 +5015,7 @@ luaFunc(setFlag)
luaFunc(getFlag)
{
int v = 0;
/*
if (lua_isstring(L, 1))
v = dsq->continuity.getFlag(lua_tostring(L, 1));
else if (lua_isnumber(L, 1))
*/
v = dsq->continuity.getFlag(lua_tointeger(L, 1));
luaReturnNum(v);
@ -6219,12 +6251,8 @@ luaFunc(entity_getBoneByName)
luaFunc(entity_getBoneByInternalId)
{
Entity *e = entity(L);
if(!e)
luaReturnPtr(NULL);
size_t i = lua_tointeger(L, 1);
if(i >= e->skeletalSprite.bones.size())
luaReturnPtr(NULL);
luaReturnPtr(e->skeletalSprite.bones[i]);
size_t i = lua_tointeger(L, 2);
luaReturnPtr((e && i < e->skeletalSprite.bones.size()) ? e->skeletalSprite.bones[i] : NULL);
}
luaFunc(entity_getNumBones)
@ -6668,7 +6696,7 @@ luaFunc(playMusic)
luaFunc(playMusicStraight)
{
dsq->sound->setMusicFader(1,0);
dsq->sound->playMusic(getString(L, 1), SLT_LOOP, SFT_IN, 0.5); //SFT_IN, 0.1);//, SFT_IN, 0.2);
dsq->sound->playMusic(getString(L, 1), SLT_LOOP, SFT_IN, 0.5);
luaReturnNil();
}
@ -6793,7 +6821,7 @@ luaFunc(entity_adjustPositionBySurfaceNormal)
e->position += v;
}
e->setv(EV_CRAWLING, 0);
//e->setCrawling(false);
}
luaReturnNil();
}
@ -6807,16 +6835,10 @@ luaFunc(entity_moveAlongSurface)
{
e->lastPosition = e->position;
//if (!e->position.isInterpolating())
{
/*
if (dsq->game->isObstructed(TileVector(e->position)))
{
e->moveOutOfWall();
}
*/
Vector v;
if (e->ridingOnEntity)
@ -6826,58 +6848,22 @@ luaFunc(entity_moveAlongSurface)
}
else
v = dsq->game->getWallNormal(e->position);
//int outFromWall = lua_tointeger(L, 5);
int outFromWall = e->getv(EV_WALLOUT);
bool invisibleIn = e->isSittingOnInvisibleIn();
/*
if (invisibleIn)
debugLog("Found invisibleIn");
else
debugLog("NOT FOUND");
*/
/*
for (int x = -2; x < 2; x++)
{
for (int y = -2; y< 2; y++)
{
if (dsq->game->getGrid(TileVector(x,y))== OT_INVISIBLEIN)
{
debugLog("found invisible in");
invisibleIn = true;
break;
}
}
}
*/
if (invisibleIn)
outFromWall -= TILE_SIZE;
float t = 0.1;
e->offset.interpolateTo(v*outFromWall, t);
/*
if (outFromWall)
{
//e->lastWallOffset = dsq->game->getWallNormal(e->position)*outFromWall;
//e->offset.interpolateTo(dsq->game->getWallNormal(e->position)*outFromWall, time*2);
//e->offset = v*outFromWall;
//float t = 0;
e->offset.interpolateTo(v*outFromWall, t);
//pos += e->lastWallOffset;
}
else
{
e->offset.interpolateTo(Vector(0,0), t);
//e->offset.interpolateTo(Vector(0,0), time*2);
//e->lastWallOffset = Vector(0,0);g
}
*/
// HACK: make this an optional parameter?
//e->rotateToVec(v, 0.1);
float dt = lua_tonumber(L, 2);
float speed = lua_tonumber(L, 3);
//int climbHeight = lua_tonumber(L, 4);
Vector mov;
if (e->surfaceMoveDir==1)
mov = Vector(v.y, -v.x);
@ -6890,49 +6876,8 @@ luaFunc(entity_moveAlongSurface)
e->vel = 0;
/*
float adjustbit = float(speed)/float(TILE_SIZE);
if (e->isNearObstruction(0))
{
Vector n = dsq->game->getWallNormal(e->position);
if (!n.isZero())
{
Vector sp = e->position;
e->position += n * adjustbit * dt;
}
}
if (!e->isNearObstruction(1))
{
Vector n = dsq->game->getWallNormal(e->position);
if (!n.isZero())
{
Vector sp = e->position;
e->position -= n * adjustbit * dt;
}
}
*/
/*
Vector sp = e->position;
e->clampToSurface();
*/
/*
e->position = sp;
e->internalOffset.interpolateTo(e->position-sp, 0.2);
*/
/*
e->position = e->lastPosition;
e->position.interpolateTo(to*0.5f + e->position*0.5f, 0.5);
*/
/*
Vector to = e->position;
e->position = e->lastPosition;
e->position.interpolateTo(to, 0.5);
*/
/*
e->position = sp;
e->internalOffset.interpolateTo(e->position - sp, 0.2);
*/
//e->clampToSurface(0.1);
}
}
@ -6941,7 +6886,7 @@ luaFunc(entity_moveAlongSurface)
luaFunc(entity_rotateToSurfaceNormal)
{
//ScriptedEntity *e = scriptedEntity(L);
Entity *e = entity(L);
float t = lua_tonumber(L, 2);
int n = lua_tointeger(L, 3);
@ -6950,7 +6895,7 @@ luaFunc(entity_rotateToSurfaceNormal)
{
e->rotateToSurfaceNormal(t, n, rot);
}
//Entity *e = entity(L);
luaReturnNil();
}
@ -7199,11 +7144,7 @@ luaFunc(entity_pullEntities)
Vector pull = pos - ent->position;
pull.setLength2D(float(len) * dt);
ent->vel2 += pull;
/*
std::ostringstream os;
os << "ent: " << ent->name << " + (" << pull.x << ", " << pull.y << ")";
debugLog(os.str());
*/
}
}
}
@ -7247,7 +7188,7 @@ luaFunc(entity_isRidingOnEntity)
luaReturnPtr(NULL);
}
//entity_setProperty(me, EP_SOLID, true)
luaFunc(entity_isProperty)
{
Entity *e = entity(L);
@ -7259,7 +7200,7 @@ luaFunc(entity_isProperty)
luaReturnBool(v);
}
//entity_setProperty(me, EP_SOLID, true)
luaFunc(entity_setProperty)
{
Entity *e = entity(L);
@ -7315,10 +7256,7 @@ luaFunc(entity_hurtTarget)
d.damage = lua_tointeger(L, 2);
e->getTargetEntity(e->currentEntityTarget)->damage(d);
}
/*
if (e && e->getTargetEntity())
e->getTargetEntity(e->currentEntityTarget)->damage(lua_tointeger(L, 2), 0, e);
*/
luaReturnNil();
}
@ -7755,7 +7693,7 @@ luaFunc(getNearestEntity)
Vector p(lua_tonumber(L, 1), lua_tonumber(L, 2));
int radius = lua_tointeger(L, 3);
Entity *ignore = lua_isuserdata(L, 4) ? entity(L, 4) : NULL;
EntityType et = lua_isnumber(L, 5) ? (EntityType)lua_tointeger(L, 5) : ET_NOTYPE;
//EntityType et = lua_isnumber(L, 5) ? (EntityType)lua_tointeger(L, 5) : ET_NOTYPE;
DamageType dt = lua_isnumber(L, 6) ? (DamageType)lua_tointeger(L, 6) : DT_NONE;
int lrStart = lua_isnumber(L, 7) ? lua_tointeger(L, 7) : -1;
int lrEnd = lua_isnumber(L, 8) ? lua_tointeger(L, 8) : -1;
@ -8174,7 +8112,7 @@ luaFunc(entity_getTarget)
if (e)
{
retEnt = e->getTargetEntity(lua_tonumber(L, 2));
//e->activate();
}
luaReturnPtr(retEnt);
}
@ -8672,6 +8610,12 @@ luaFunc(isObstructed)
luaReturnBool(dsq->game->isObstructed(TileVector(Vector(lua_tonumber(L, 1), lua_tonumber(L, 2))), obs ? obs : -1));
}
luaFunc(isObstructedRaw)
{
int obs = lua_tointeger(L, 3);
luaReturnBool(dsq->game->isObstructedRaw(TileVector(Vector(lua_tonumber(L, 1), lua_tonumber(L, 2))), obs));
}
luaFunc(getObstruction)
{
luaReturnInt(dsq->game->getGrid(TileVector(Vector(lua_tonumber(L, 1), lua_tonumber(L, 2)))));
@ -8789,11 +8733,7 @@ luaFunc(entity_getFlag)
luaFunc(isFlag)
{
int v = 0;
/*
if (lua_isstring(L, 1))
v = dsq->continuity.getFlag(lua_tostring(L, 1));
else if (lua_isnumber(L, 1))
*/
bool f = false;
if (lua_isnumber(L, 1))
{
@ -8805,11 +8745,7 @@ luaFunc(isFlag)
v = dsq->continuity.getFlag(getString(L, 1));
f = (v == lua_tointeger(L, 2));
}
/*
int f = 0;
dsq->continuity.getFlag(lua_tostring(L, 1));
*/
luaReturnBool(f);
}
@ -8970,9 +8906,9 @@ luaFunc(createFindPath)
luaFunc(findPathBegin)
{
PathFinding::State *state = *(PathFinding::State**)luaL_checkudata(L, 1, "pathfinder");
Vector start(lua_tonumber(L, 1), lua_tonumber(L, 2));
Vector end(lua_tonumber(L, 3), lua_tonumber(L, 4));
ObsType obs = ObsType(lua_tointeger(L, 8));
Vector start(lua_tonumber(L, 2), lua_tonumber(L, 3));
Vector end(lua_tonumber(L, 4), lua_tonumber(L, 5));
ObsType obs = ObsType(lua_tointeger(L, 6));
PathFinding::beginFindPath(state, start, end, obs);
luaReturnNil();
}
@ -8989,12 +8925,12 @@ luaFunc(findPathFinish)
{
PathFinding::State *state = *(PathFinding::State**)luaL_checkudata(L, 1, "pathfinder");
VectorPath path;
bool found = PathFinding::finishFindPath(state, path);
bool found = PathFinding::finishFindPath(state, path, lua_tointeger(L, 2));
if(!found)
luaReturnBool(false);
lua_pushinteger(L, (int)path.getNumPathNodes());
_fillPathfindTables(L, path, 2, 3);
_fillPathfindTables(L, path, 3, 4);
return 3;
}
@ -9008,6 +8944,13 @@ luaFunc(findPathGetStats)
return 2;
}
luaFunc(findPathFreeMemory)
{
PathFinding::State *state = *(PathFinding::State**)luaL_checkudata(L, 1, "pathfinder");
PathFinding::purgeFindPath(state);
luaReturnNil();
}
luaFunc(castLine)
{
Vector v(lua_tonumber(L, 1), lua_tonumber(L, 2));
@ -9015,20 +8958,38 @@ luaFunc(castLine)
int tiletype = lua_tointeger(L, 5);
if(!tiletype)
tiletype = OT_BLOCKING;
bool invert = getBool(L, 6);
Vector step = end - v;
int steps = step.getLength2D() / TILE_SIZE;
step.setLength2D(TILE_SIZE);
for(int i = 0; i < steps; ++i)
if(!invert)
{
if(dsq->game->getGridRaw(TileVector(v)) & tiletype)
for(int i = 0; i < steps; ++i)
{
lua_pushinteger(L, dsq->game->getGrid(TileVector(v)));
lua_pushnumber(L, v.x);
lua_pushnumber(L, v.y);
return 3;
if(dsq->game->getGridRaw(TileVector(v)) & tiletype)
{
lua_pushinteger(L, dsq->game->getGrid(TileVector(v)));
lua_pushnumber(L, v.x);
lua_pushnumber(L, v.y);
return 3;
}
v += step;
}
}
else
{
for(int i = 0; i < steps; ++i)
{
if(!(dsq->game->getGridRaw(TileVector(v)) & tiletype))
{
lua_pushinteger(L, dsq->game->getGrid(TileVector(v)));
lua_pushnumber(L, v.x);
lua_pushnumber(L, v.y);
return 3;
}
v += step;
}
v += step;
}
lua_pushboolean(L, false);
@ -9377,6 +9338,191 @@ luaFunc(getPerformanceFreq)
#endif
}
// ---------- Minimap related ------------------
luaFunc(getMinimapRender)
{
luaReturnPtr(dsq->game->miniMapRender);
}
luaFunc(minimap_setWaterBitTex)
{
luaReturnBool(MiniMapRender::setWaterBitTex(getString(L)));
}
luaFunc(minimap_setTopTex)
{
luaReturnBool(MiniMapRender::setTopTex(getString(L)));
}
luaFunc(minimap_setBottomTex)
{
luaReturnBool(MiniMapRender::setBottomTex(getString(L)));
}
luaFunc(minimap_setAvatarIconTex)
{
luaReturnBool(MiniMapRender::setAvatarTex(getString(L)));
}
luaFunc(minimap_setHealthBarTex)
{
luaReturnBool(MiniMapRender::setAvatarTex(getString(L)));
}
luaFunc(minimap_setMaxHealthMarkerTex)
{
luaReturnBool(MiniMapRender::setMaxHealthMarkerTex(getString(L)));
}
template<typename T>
int mmicon_delete(lua_State *L, T *obj)
{
delete obj->minimapIcon;
obj->minimapIcon = NULL;
luaReturnNil();
}
template<typename T>
int mmicon_tex(lua_State *L, T *obj)
{
if(!obj)
luaReturnNil();
MinimapIcon *ico = obj->ensureMinimapIcon();
bool good = ico->setTexture(getString(L, 2));
luaReturnBool(good);
}
template<typename T>
int mmicon_size(lua_State *L, T *obj)
{
if(!obj)
luaReturnNil();
luaReturnNum(interpolateVec2(L, obj->ensureMinimapIcon()->size, 2));
}
template<typename T>
int mmicon_color(lua_State *L, T *obj)
{
if(!obj)
luaReturnNil();
luaReturnNum(interpolateVec3(L, obj->ensureMinimapIcon()->color, 2));
}
template<typename T>
int mmicon_alpha(lua_State *L, T *obj)
{
if(!obj)
luaReturnNil();
luaReturnNum(interpolateVec1(L, obj->ensureMinimapIcon()->alpha, 2));
}
template<typename T>
int mmicon_scaleWithDistance(lua_State *L, T *obj)
{
if(!obj)
luaReturnNil();
obj->ensureMinimapIcon()->scaleWithDistance = getBool(L, 2);
luaReturnNil();
}
template<typename T>
int mmicon_throb(lua_State *L, T *obj)
{
if(!obj)
luaReturnNil();
obj->ensureMinimapIcon()->throbMult = lua_tonumber(L, 2);
luaReturnNil();
}
luaFunc(entity_mmicon_delete) { return mmicon_delete(L, entity(L)); }
luaFunc(entity_mmicon_tex) { return mmicon_tex(L, entity(L)); }
luaFunc(entity_mmicon_size) { return mmicon_size(L, entity(L)); }
luaFunc(entity_mmicon_color) { return mmicon_color(L, entity(L)); }
luaFunc(entity_mmicon_alpha) { return mmicon_alpha(L, entity(L)); }
luaFunc(entity_mmicon_scaleWithDistance) { return mmicon_scaleWithDistance(L, entity(L)); }
luaFunc(entity_mmicon_throb) { return mmicon_throb(L, entity(L)); }
luaFunc(node_mmicon_delete) { return mmicon_delete(L, path(L)); }
luaFunc(node_mmicon_tex) { return mmicon_tex(L, path(L)); }
luaFunc(node_mmicon_size) { return mmicon_size(L, path(L)); }
luaFunc(node_mmicon_color) { return mmicon_color(L, path(L)); }
luaFunc(node_mmicon_alpha) { return mmicon_alpha(L, path(L)); }
luaFunc(node_mmicon_scaleWithDistance) { return mmicon_scaleWithDistance(L, path(L)); }
luaFunc(node_mmicon_throb) { return mmicon_throb(L, path(L)); }
class LuaXMLConverter : public tinyxml2::XMLVisitor
{
public:
LuaXMLConverter(lua_State *lua) : L(lua) {}
virtual ~LuaXMLConverter() {}
virtual bool VisitEnter( const tinyxml2::XMLDocument& /*doc*/ )
{
lua_newtable(L);
indexes.push_back(0);
return true;
}
virtual bool VisitExit( const tinyxml2::XMLDocument& /*doc*/ )
{
indexes.pop_back();
assert(indexes.empty());
// Leave the root table on the stack
return true;
}
virtual bool VisitEnter( const tinyxml2::XMLElement& element, const tinyxml2::XMLAttribute *a)
{
lua_newtable(L);
indexes.push_back(0);
if(a)
{
lua_newtable(L);
for( ; a; a = a->Next())
{
lua_pushstring(L, a->Value());
lua_setfield(L, -2, a->Name());
}
lua_setfield(L, -2, "attr");
}
if(const char *name = element.Value())
{
lua_pushstring(L, name);
lua_setfield(L, -2, "name");
}
if(const char *text = element.GetText())
{
lua_pushstring(L, text);
lua_setfield(L, -2, "text");
}
return true;
}
virtual bool VisitExit( const tinyxml2::XMLElement& /*element*/ )
{
indexes.pop_back();
lua_rawseti(L, -2, ++indexes.back());
return true;
}
protected:
std::vector<unsigned> indexes;
lua_State * const L;
};
luaFunc(loadXMLTable)
{
const std::string s = getString(L);
safePath(L, s);
std::string fn;
if(!findFile_helper(s.c_str(), fn))
luaReturnNil();
tinyxml2::XMLDocument xml;
tinyxml2::XMLError err = readXML(fn, xml);
if(err != tinyxml2::XML_SUCCESS)
{
lua_pushboolean(L, false);
lua_pushinteger(L, err);
return 2;
}
LuaXMLConverter cvt(L);
xml.Accept(&cvt);
return 1;
}
//--------------------------------------------------------------------------------------------
#define luaRegister(func) {#func, l_##func}
@ -9393,6 +9539,7 @@ static const struct {
luaRegister(fileExists),
luaRegister(getModName),
luaRegister(getModPath),
luaRegister(getInterfaceFunctionNames),
luaRegister(debugBreak),
luaRegister(setIgnoreAction),
@ -9549,6 +9696,7 @@ static const struct {
luaRegister(entity_setDeathParticleEffect),
luaRegister(entity_setDeathSound),
luaRegister(entity_setStopSoundsOnDeath),
luaRegister(entity_setDamageTarget),
luaRegister(entity_setAllDamageTargets),
@ -9801,7 +9949,7 @@ static const struct {
luaRegister(resetTimer),
luaRegister(addInfluence),
luaRegister(setSuckPosition),
luaRegister(getSuckPosition),
luaRegister(setSuckPosition),
luaRegister(setNumSuckPositions),
luaRegister(setupBasicEntity),
@ -9875,6 +10023,7 @@ static const struct {
luaRegister(savePoint),
luaRegister(saveMenu),
luaRegister(setSceneDisplayNameInSave),
luaRegister(wait),
luaRegister(watch),
@ -9942,6 +10091,7 @@ static const struct {
luaRegister(singSong),
luaRegister(isObstructed),
luaRegister(isObstructedRaw),
luaRegister(isObstructedBlock),
luaRegister(getObstruction),
luaRegister(getGridRaw),
@ -9951,6 +10101,7 @@ static const struct {
luaRegister(findPathUpdate),
luaRegister(findPathFinish),
luaRegister(findPathGetStats),
luaRegister(findPathFreeMemory),
luaRegister(castLine),
luaRegister(getUserInputString),
luaRegister(getMaxCameraValues),
@ -10403,7 +10554,29 @@ static const struct {
luaRegister(getPerformanceCounter),
luaRegister(getPerformanceFreq),
luaRegister(getMinimapRender),
luaRegister(minimap_setWaterBitTex),
luaRegister(minimap_setTopTex),
luaRegister(minimap_setBottomTex),
luaRegister(minimap_setAvatarIconTex),
luaRegister(minimap_setHealthBarTex),
luaRegister(minimap_setMaxHealthMarkerTex),
luaRegister(entity_mmicon_delete),
luaRegister(entity_mmicon_tex),
luaRegister(entity_mmicon_size),
luaRegister(entity_mmicon_color),
luaRegister(entity_mmicon_alpha),
luaRegister(entity_mmicon_scaleWithDistance),
luaRegister(entity_mmicon_throb),
luaRegister(node_mmicon_delete),
luaRegister(node_mmicon_tex),
luaRegister(node_mmicon_size),
luaRegister(node_mmicon_color),
luaRegister(node_mmicon_alpha),
luaRegister(node_mmicon_scaleWithDistance),
luaRegister(node_mmicon_throb),
luaRegister(loadXMLTable),
#undef MK_FUNC
#undef MK_ALIAS
@ -11114,6 +11287,7 @@ static const struct {
luaConstant(OT_MASK_BLACK),
luaConstant(OT_BLOCKING),
luaConstant(OT_USER_MASK),
luaConstant(OT_OUTOFBOUNDS),
luaConstant(SEE_MAP_NEVER),
luaConstant(SEE_MAP_DEFAULT),

View file

@ -39,7 +39,7 @@ ScriptedEntity::ScriptedEntity(const std::string &scriptName, Vector position, E
strandSpacing = 10;
animKeyFunc = true;
canShotHitFunc = true;
//runningActivation = false;
setEntityType(et);
myTimer = 0;
@ -80,6 +80,10 @@ ScriptedEntity::ScriptedEntity(const std::string &scriptName, Vector position, E
}
}
ScriptedEntity::~ScriptedEntity()
{
}
void ScriptedEntity::setAutoSkeletalUpdate(bool v)
{
skeletalSprite.ignoreUpdate = !v;
@ -114,7 +118,7 @@ void ScriptedEntity::warpSegments()
}
void ScriptedEntity::init()
{
{
if (script)
{
if (!script->call("init", this))
@ -125,7 +129,7 @@ void ScriptedEntity::init()
}
void ScriptedEntity::postInit()
{
{
if (script)
{
if (!script->call("postInit", this))
@ -203,7 +207,7 @@ void ScriptedEntity::initSegments(int numSegments, int minDist, int maxDist, std
else
q->setTexture(bodyTex);
q->setWidthHeight(w, h);
if (i > 0 && i < segments.size()-1 && taper !=0)
q->scale = Vector(1.0f-(i*taper), 1-(i*taper));
dsq->game->addRenderObject(q, LR_ENTITIES);
@ -227,7 +231,7 @@ void ScriptedEntity::setupEntity(const std::string &tex, int lcode)
void ScriptedEntity::setupBasicEntity(const std::string& texture, int health, int manaBall, int exp, int money, float collideRadius, int state, int w, int h, int expType, bool hitEntity, int updateCull, int layer)
{
//this->updateCull = updateCull;
updateCull = -1;
if (texture.empty())
@ -322,7 +326,7 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
e->sound("RockHit");
dsq->spawnParticleEffect("rockhit", e->position, 0, 0);
}
//e->push(vel, 0.2, 500, 0);
Vector add = vel;
add.setLength2D(5000*dt);
e->vel += add;
@ -339,7 +343,7 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
}
if (isPullable())
{
{
Entity *followEntity = dsq->game->avatar;
if (followEntity && dsq->game->avatar->pullTarget == this)
{
@ -350,13 +354,13 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
}
else if (!dist.isLength2DIn(800))
{
// break;
vel.setZero();
dsq->game->avatar->pullTarget->stopPull();
dsq->game->avatar->pullTarget = 0;
}
else if (!dist.isLength2DIn(128))
{
{
Vector v = dist;
int moveSpeed = 1000;
moveSpeed = 4000;
@ -386,7 +390,7 @@ void ScriptedEntity::updateStrands(float dt)
if (strands.empty()) return;
float angle = rotation.z;
angle = (PI*(360-(angle-90)))/180.0;
//angle = (180*angle)/PI;
float sz = (strands.size()/2);
for (int i = 0; i < strands.size(); i++)
{
@ -430,7 +434,7 @@ void ScriptedEntity::shiftWorlds(WorldType lastWorld, WorldType worldType)
}
void ScriptedEntity::startPull()
{
{
Entity::startPull();
beforePullMaxSpeed = getMaxSpeed();
becomeSolidDelay = false;
@ -638,7 +642,7 @@ void ScriptedEntity::songNoteDone(int note, float len)
void ScriptedEntity::becomeSolid()
{
//vel = 0;
float oldRot = 0;
bool doRot=false;
Vector n = dsq->game->getWallNormal(position);
@ -679,7 +683,7 @@ void ScriptedEntity::onHitWall()
{
becomeSolidDelay = true;
}
if (isEntityProperty(EP_BLOCKER) && !fillGridFromQuad)
{
Vector n = dsq->game->getWallNormal(position);
@ -699,10 +703,10 @@ void ScriptedEntity::onHitWall()
}
void ScriptedEntity::activate()
{
{
if (runningActivation) return;
Entity::activate();
runningActivation = true;
if (script)
{
@ -758,7 +762,7 @@ void ScriptedEntity::onDieEaten()
void ScriptedEntity::onEnterState(int action)
{
CollideEntity::onEnterState(action);
if (script)
{
if (!script->call("enterState", this))
@ -768,7 +772,7 @@ void ScriptedEntity::onEnterState(int action)
{
case STATE_DEAD:
if (!isGoingToBeEaten())
{
{
doDeathEffects(manaBallAmount);
dsq->spawnParticleEffect(deathParticleEffect, position);
onDieNormal();
@ -795,7 +799,7 @@ void ScriptedEntity::onEnterState(int action)
void ScriptedEntity::onExitState(int action)
{
if (script)
{
if (!script->call("exitState", this))
@ -814,4 +818,3 @@ void ScriptedEntity::deathNotify(RenderObject *r)
}
CollideEntity::deathNotify(r);
}

View file

@ -30,6 +30,7 @@ class ScriptedEntity : public CollideEntity, public Segmented
{
public:
ScriptedEntity(const std::string &scriptName, Vector position, EntityType et = ET_ENEMY);
virtual ~ScriptedEntity();
void init();
void postInit();
void destroy();
@ -49,7 +50,7 @@ public:
void entityDied(Entity *e);
void message(const std::string &msg, int v);
int messageVariadic(lua_State *L, int nparams);
static bool runningActivation;
void sporesDropped(const Vector &pos, int type);
@ -76,7 +77,7 @@ public:
ParticleEffect pullEmitter;
float manaBallAmount;
void initEmitter(int emit, const std::string &file);
void startEmitter(int emit);
void stopEmitter(int emit);
@ -100,8 +101,8 @@ protected:
void onAlwaysUpdate(float dt);
void updateStrands(float dt);
bool animKeyFunc;
//void onPathEnd();
void onExitTimer();
float myTimer;
void onHitWall();

View file

@ -345,7 +345,7 @@ void Shot::loadBankShot(const std::string &ident, Shot *setter)
{
std::string id = ident;
stringToLower(id);
//setter->shotData = &shotBank[id];
setter->applyShotData(&shotBank[id]);
}
}
@ -470,7 +470,7 @@ void Shot::onHitWall()
if (!shotData->spawnEntity.empty())
{
dsq->game->createEntity(shotData->spawnEntity, 0, position, 0, false, "", ET_ENEMY, true);
//(shotData->spawnEntity, 0, position, 0, false, "");
if (shotData->spawnEntity == "NatureFormFlowers")
{
dsq->game->registerSporeDrop(position, 0);
@ -518,9 +518,9 @@ void Shot::reflectFromEntity(Entity *e)
{
firer = e;
target = oldFirer;
//int d = (int)dt;
//d += DT_AVATAR;oll
//damageType = DamageType(d);
}
}
@ -542,11 +542,7 @@ void Shot::targetDied(Entity *target)
}
/*
std::ostringstream os;
os << "# of shots in list: " << c;
debugLog(os.str());
*/
}
bool Shot::isHitEnts() const
@ -585,13 +581,13 @@ void Shot::hitEntity(Entity *e, Bone *b)
if (damageType == DT_AVATAR_BITE)
{
//debugLog("Shot::hitEntity bittenEntities.push_back");
dsq->game->avatar->bittenEntities.push_back(e);
}
bool damaged = e->damage(d);
// doesn't have anything to do with effectTime
if (shotData)
{
if (!damaged && checkDamageTarget && !shotData->alwaysDoHitEffects)
@ -611,11 +607,11 @@ void Shot::hitEntity(Entity *e, Bone *b)
}
//debugLog("Shot hit enemy: " + e->name);
}
else
{
//debugLog("Shot hit 0 enemy");
}
if (doEffects)
@ -640,7 +636,7 @@ void Shot::hitEntity(Entity *e, Bone *b)
}
}
//d.bone = c.bone;
}
void Shot::noSegs()
@ -679,11 +675,7 @@ void Shot::setAimVector(const Vector &aim)
{
velocity.setLength2D(shotData->maxSpeed);
}
/*
std::ostringstream os;
os << "setting aim vector(" << aim.x << ", " << aim.y << ") to vel(" << velocity.x << ", " << velocity.y << ")";
debugLog(os.str());
*/
}
void Shot::setTarget(Entity *target)
@ -737,7 +729,7 @@ void Shot::onUpdate(float dt)
{
if (velocity.isZero())
{
//velocity = Vector(rand()%100-50, rand()%100-50);
}
else if (velocity.isLength2DIn(maxSpeed*0.75f))
{
@ -745,18 +737,7 @@ void Shot::onUpdate(float dt)
}
}
/*
if (!gravity.isZero())
{
velocity += shotData->gravity * dt;
}
*/
/*
std::ostringstream os;
os << "shotVel(" << velocity.x << ", " << velocity.y << ")";
debugLog(os.str());
*/
homingness += shotData->homingIncr*dt;
if (shotData->homingMax != 0 && homingness > shotData->homingMax)
@ -779,7 +760,7 @@ void Shot::onUpdate(float dt)
add.setLength2D(shotData->rotIncr);
velocity += add * dt;
}
//emitter.update(dt);
if (emitter)
{
emitter->position = position + offset;
@ -814,7 +795,7 @@ void Shot::onUpdate(float dt)
return;
}
}
//TileVector t(position);
Vector diff;
if (target)
diff = target->getTargetPoint(targetPt) - this->position;
@ -846,13 +827,13 @@ void Shot::onUpdate(float dt)
if (!N.isZero())
{
//2*(-I dot N)*N + I
velocity = 2*(-I.dot(N))*N + I;
velocity *= len;
}
break;
}
// fall through
}
default:
{

View file

@ -69,15 +69,15 @@ struct ShotData
Vector gravity;
void bankLoad(const std::string &file, const std::string &path);
};
class Shot : public Quad, public Segmented
{
public:
//Shot(DamageType damageType, Entity *firer, Vector pos, Entity *target, std::string tex="", float homingness=1000, int maxSpeed=400, int segments=10, float segMin=0.1, float segMax=5, float damage = 1, float lifeTime = 0);
Shot();
//void destroy();
void reflectFromEntity(Entity *e);
void setParticleEffect(const std::string &particleEffect);
typedef std::vector<Shot*> Shots;
@ -95,7 +95,7 @@ public:
void fire(bool playSfx = true);
void hitEntity(Entity *e, Bone *b);
void noSegs();
void rotateToVec(Vector addVec, float time, int offsetAngle);
@ -156,7 +156,7 @@ public:
Beam(Vector pos, float angle);
typedef std::list<Beam*> Beams;
static Beams beams;
//static void targetDied(Entity *t);
static void killAllBeams();
float angle;

View file

@ -49,7 +49,7 @@ bool Spore::isPositionClear(const Vector &position)
{
if (dsq->game->isObstructed(TileVector(position)))
return false;
for (Spores::iterator i = spores.begin(); i != spores.end(); i++)
for (Spores::iterator i = spores.begin(); i != spores.end(); i++)
{
Spore *s = *i;
if (s->position == position)
@ -68,7 +68,7 @@ void Spore::destroy()
void Spore::onEndOfLife()
{
//::onEndLife();
spores.remove(this);
}
@ -84,9 +84,9 @@ void Spore::onEnterState(int state)
}
void Spore::killAllSpores()
{
{
std::queue<Spore*>sporeDeleteQueue;
for (Spores::iterator i = spores.begin(); i != spores.end(); i++)
for (Spores::iterator i = spores.begin(); i != spores.end(); i++)
{
sporeDeleteQueue.push(*i);
}
@ -104,8 +104,8 @@ void Spore::killAllSpores()
}
void Spore::onUpdate(float dt)
{
{
CollideEntity::onUpdate(dt);
if (life < 1) return;
@ -118,7 +118,7 @@ void Spore::onUpdate(float dt)
int sporeCr = 48;
collideRadius = scale.x * sporeCr;
if (touchAvatarDamage(collideRadius, 1, Vector(-1,-1,-1), 500))
{
// YAY!

View file

@ -1,70 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "States.h"
StarRenderer::StarRenderer(int num, int range) : RenderObject()
{
stars.resize(num);
int rh = range/2;
for (int i = 0; i < stars.size(); i++)
{
stars[i] = Vector((rand()%range)-rh, (rand()%range)-rh, (rand()%range)-rh);
}
//rotation.interpolateTo(Vector(0,360,0), 30, -1);
//position.interpolateTo(Vector(0,0,-100), 10, -1);
}
void StarRenderer::render()
{
#ifdef BBGE_BUILD_OPENGL
core->enable3D();
glLoadIdentity();
glTranslatef(position.x, position.y, position.z);
glRotatef(rotation.x, 1, 0, 0);
glRotatef(rotation.y, 0, 1, 0);
glRotatef(rotation.z, 0, 0, 1);
glPointSize(1);
glBindTexture(GL_TEXTURE_2D, 0);
glBegin(GL_POINTS);
for (int i = 0; i < stars.size(); i++)
{
float c = 1.0f-fabsf(stars[i].z)/50.0f;
glColor3f(c,c,c);
glVertex3f(stars[i].x, stars[i].y, stars[i].z);
}
glEnd();
core->enable2D(core->getVirtualWidth());
/*
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
*/
#endif
}
void StarRenderer::onRender()
{
}

View file

@ -28,15 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Bubble::Bubble() : Quad()
{
setTexture("particles/bubble");
/*
this->life = 10;
this->decayRate = 1;
*/
this->alpha = 0.5f;
this->speed = rand()%10+20;
this->width = 32;
this->height = 32;
//this->scale = Vector(0.5f, 0.5f, 0.5f);
}
void Bubble::onUpdate(float dt)
@ -64,12 +61,12 @@ void Intro2::applyState()
ActionMapper::clearActions();
//addAction(MakeFunctionEvent(Intro2, skipIntro), KEY_ESCAPE, 0);
dsq->subtitlePlayer.show(0.5f);
core->resetCamera();
dsq->jiggleCursor();
dsq->setCutscene(1,1);
@ -78,8 +75,7 @@ void Intro2::applyState()
dsq->overlay->alpha.interpolateTo(0, 40);
dsq->toggleCursor(0);
// OLD WAY of skipping
//dsq->user.control.actionSet.importAction(this, "Escape", ACTION_ESC);
Quad *frame4 = new Quad;
{
@ -110,96 +106,11 @@ void Intro2::applyState()
dsq->voice("Naija_Intro-music");
while (dsq->sound->isPlayingVoice())
dsq->main(FRAME_TIME);
/*
while (dsq->sound->isPlayingVoice())
{
if (isActing(ACTION_ESC))
{
while (isActing(ACTION_ESC) && dsq->sound->isPlayingVoice())
{
core->main(FRAME_TIME);
}
dsq->overlay->alpha.interpolateTo(1, 1);
dsq->stopVoice();
dsq->main(1);
dsq->newGame();
return;
}
core->main(FRAME_TIME);
}
*/
/*
Quad *frame3 = new Quad;
{
frame3->setTexture("gameover-0002");
frame3->position = Vector(400,300);
frame3->width = 600;
frame3->height = 600;
}
addRenderObject(frame3, LR_BACKGROUND);
Quad *frame2 = new Quad;
{
frame2->setTexture("gameover-0003");
frame2->position = Vector(400,300);
frame2->width = 600;
frame2->height = 600;
}
addRenderObject(frame2, LR_BACKGROUND);
Quad *frame1 = new Quad;
{
frame1->setTexture("gameover-0004");
frame1->position = Vector(400,300);
frame1->width = 600;
frame1->height = 600;
}
addRenderObject(frame1, LR_BACKGROUND);
*/
/*
dsq->voice("Naija_Intro1");
while (dsq->isStreamingVoice()) core->main(1);
*/
/*
frame1->alpha.interpolateTo(0, 1);
core->main(1);
*/
/*
dsq->voice("Naija_Intro2");
while (dsq->isStreamingVoice()) core->main(1);
*/
//frame2->alpha.interpolateTo(0, 1);
/*
dsq->voice("Naija_Intro3");
while (dsq->isStreamingVoice()) core->main(1);
*/
/*
frame3->alpha.interpolateTo(0, 1);
core->main(1);
*/
/*
dsq->voice("Naija_Intro3");
while (dsq->isStreamingVoice()) core->main(1);
*/
//frame4->alpha.interpolateTo(0, 1);
/*
dsq->voice("Naija_Intro4");
while (dsq->isStreamingVoice()) core->main(1);
*/
emitter->stop();
emitter2->start();
@ -245,8 +156,8 @@ void GameOver::applyState()
const bool frameOutputGameOver = false;
core->sound->fadeMusic(SFT_OUT, 1);
//float transTime = 0.01;
//core->sound->fadeOut(transTime);
StateObject::applyState();
core->globalScale = Vector(1,1);
core->globalScaleChanged();
@ -268,18 +179,6 @@ void GameOver::applyState()
}
addRenderObject(q);
/*
BitmapText *b = new BitmapText(&dsq->font);
{
int sz = 64;
b->setFontSize(sz);
b->setText("GAME OVER");
b->position = Vector(400+sz/2,300-sz/2);
}
addRenderObject(b);
*/
//core->main(transTime);
frame1 = new Quad;
@ -331,11 +230,10 @@ void GameOver::applyState()
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter, 0.07,0.03,30,0.2f, 1.1));
}
//dsq->screenTransition->transition(0);
dsq->overlay->alpha = 0;
//core->main(0.1);
//frame3->alpha.interpolateTo(0, GO_ANIM_TIME);
core->main(GO_ANIM_TIME);
frame4->alpha.interpolateTo(0, GO_ANIM_TIME);
@ -351,24 +249,18 @@ void GameOver::applyState()
core->main(GO_ANIM_TIME);
core->main(1.5);
//core->sound->streamMusic("Requiem", 0);
if (dsq->recentSaveSlot != -1)
{
// game over recent save load
dsq->sound->stopMusic();
float transferSeconds = dsq->continuity.seconds;
dsq->continuity.loadFile(dsq->recentSaveSlot);
/*
//float lastLoadSeconds = dsq->continuity.seconds;
// time spent on a session that ended with death is the
// difference between the current total time and the last save time?
// nope.
// ignore doing the above for now!
*/
dsq->continuity.seconds = transferSeconds;
dsq->game->transitionToScene(dsq->game->sceneToLoad);
}
@ -376,20 +268,16 @@ void GameOver::applyState()
dsq->title();
//core->main(transTime);
if (frameOutputGameOver)
core->frameOutputMode = false;
/*
addAction(MakeFunctionEvent(GameOver, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0);
timer = 1;
*/
}
void GameOver::removeState()
{
//dsq->screenTransition->capture();
StateObject::removeState();
frame3 = frame2 = frame1 = 0;
}
@ -410,30 +298,7 @@ void GameOver::update(float dt)
timer = 0;
}
/*
if (frame1 && frame2 && frame3)
{
if (frame3->alpha.x == 0 && !frame3->alpha.isInterpolating())
{
if (frame2->alpha.x == 0 && !frame2->alpha.isInterpolating())
{
if (frame1->alpha.x == 0 && !frame1->alpha.isInterpolating())
{
frame1=frame2=frame3=0;
}
else if (!frame1->alpha.isInterpolating())
{
frame1->alpha.interpolateTo(0, 0.8);
}
}
else if (!frame2->alpha.isInterpolating())
{
frame2->alpha.interpolateTo(0, GO_ANIM_TIME);
}
}
}
*/
}
namespace NagStuff
@ -442,10 +307,7 @@ namespace NagStuff
int ic=0;
const int numScreens = 11;
float screenTimer = 0;
/*
const float screenTime = 7;
const float nagFadeTime = 3;
*/
const float screenTime = 3;
const float nagFadeTime = 1;
};
@ -477,7 +339,7 @@ void Nag::applyState()
core->setInputGrab(false);
grab = false;
dsq->overlay2->alpha = 0;
dsq->stopVoice();
@ -489,8 +351,8 @@ void Nag::applyState()
AquariaMenuItem *buy = new AquariaMenuItem();
buy->followCamera = 1;
buy->position = Vector(630, 400); //300, 540);
//buy->setLabel("Buy");
buy->position = Vector(630, 400);
buy->useGlow("particles/glow", 480, 128);
buy->event.set(MakeFunctionEvent(Nag, onBuy));
buy->setDirMove(DIR_LEFT, buy);
@ -501,7 +363,7 @@ void Nag::applyState()
AquariaMenuItem *exit = new AquariaMenuItem();
exit->followCamera = 1;
exit->position = Vector(732, 543);
//exit->setLabel("Exit");
exit->useGlow("particles/glow", 128, 64);
exit->event.set(MakeFunctionEvent(Nag, onExit));
exit->setDirMove(DIR_LEFT, exit);
@ -518,7 +380,7 @@ void Nag::applyState()
ic = 0;
irot.clear();
//Vector framePos(235, 405);
Vector framePos(240, 400);
Vector frameScale(0.98, 0.98);

View file

@ -68,7 +68,7 @@ protected:
bool done;
Precacher cachy;
//void update(float dt);
};
class Intro2 : public StateObject
@ -88,11 +88,11 @@ public:
void applyState();
void removeState();
void update(float dt);
void doShortBitBlot();
void getOut();
void skipLogo();
bool watchQuit(float time);
protected:
int quitFlag;

View file

@ -92,7 +92,7 @@ const int FLAG_SPIRIT_DRASK = 126;
const int FLAG_SPIRIT_DRUNIAD = 127;
const int FLAG_TRANSTURTLE_VEIL01 = 130;
const int FLAG_TRANSTURTLE_OPENWATER06 = 131;
//const int FLAG_TRANSTURTLE_OPENWATER06 = 131;
const int FLAG_TRANSTURTLE_FOREST04 = 132;
const int FLAG_TRANSTURTLE_OPENWATER03 = 133;
const int FLAG_TRANSTURTLE_FOREST05 = 134;
@ -104,15 +104,15 @@ const int FLAG_TRANSTURTLE_FINALBOSS = 139;
const int FLAG_SEAHORSEBESTTIME = 247;
const int FLAG_MINIBOSS_START = 700;
const int FLAG_MINIBOSS_NAUTILUSPRIME = 700;
//const int FLAG_MINIBOSS_START = 700;
//const int FLAG_MINIBOSS_NAUTILUSPRIME = 700;
const int FLAG_MINIBOSS_KINGJELLY = 701;
const int FLAG_MINIBOSS_MERGOG = 702;
const int FLAG_MINIBOSS_CRAB = 703;
const int FLAG_MINIBOSS_OCTOMUN = 704;
const int FLAG_MINIBOSS_MANTISSHRIMP = 705;
const int FLAG_MINIBOSS_PRIESTS = 706;
const int FLAG_MINIBOSS_END = 720;
//const int FLAG_MINIBOSS_PRIESTS = 706;
//const int FLAG_MINIBOSS_END = 720;
//-----------------------------------------------------------------------------
@ -122,15 +122,11 @@ const int FLAG_MINIBOSS_END = 720;
#pragma warning( push )
// warning C4355: 'this' : used in base member initializer list
// This is OK because it's warning on setting up the Steam callbacks, they won't use this until after construction is done
#pragma warning( disable : 4355 )
#pragma warning( disable : 4355 )
#endif
StatsAndAchievements::StatsAndAchievements()
{
/*
std::ostringstream os;
os << "app_id: " << SteamUtils()->GetAppID();
debugLog(os.str());
*/
#ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL
unlockedDisplayTimestamp = -1.0f;
@ -140,21 +136,7 @@ StatsAndAchievements::StatsAndAchievements()
statsValid = false;
storeStats = false;
/*
m_flGameFeetTraveled = 0;
m_nTotalGamesPlayed = 0;
m_nTotalNumWins = 0;
m_nTotalNumLosses = 0;
m_flTotalFeetTraveled = 0;
m_flMaxFeetTraveled = 0;
m_flAverageSpeed = 0;
m_hDisplayFont = pGameEngine->HCreateFont( ACHDISP_FONT_HEIGHT, FW_MEDIUM, false, "Arial" );
if ( !m_hDisplayFont )
OutputDebugString( "Stats font was not created properly, text won't draw\n" );
*/
}
#ifdef _MSC_VER
#pragma warning( pop )
@ -343,7 +325,7 @@ void StatsAndAchievements::OnGameStateChange( EClientGameState eNewState )
m_ulTickCountGameStart = m_pGameEngine->GetGameTickCount();
break;
case k_EClientFindInternetServers:
break;
break;
case k_EClientGameWinner:
if ( SpaceWarClient()->BLocalPlayerWonLastGame() )
m_nTotalNumWins++;
@ -379,11 +361,11 @@ void StatsAndAchievements::OnGameStateChange( EClientGameState eNewState )
//-----------------------------------------------------------------------------
void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
{
//debugLog("Eval...");
// Already have it?
if ( achievement.achieved ) {
//debugLog(std::string(achievement.chAchievementID) + " was already achieved");
return;
}
@ -423,11 +405,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
|| (dsq->continuity.recipes[i].result == "VeggieSoup" && didVeggieSoup))
{}
else {
/*
std::ostringstream os;
os << "doesn't know recipe: " << dsq->continuity.recipes[i].result;
debugLog(os.str());
*/
knowAll = false;
}
}
@ -442,20 +420,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
case ACH_MASS_TRANSIT:
{
/*
debugLog("eval ACH_MASS_TRANSIT");
std::ostringstream os;
os << "FLAG_TRANSTURTLE_VEIL01: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL01) << "\n";
os << "FLAG_TRANSTURTLE_VEIL02: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL02) << "\n";
os << "FLAG_TRANSTURTLE_OPENWATER03: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_OPENWATER03) << "\n";
os << "FLAG_TRANSTURTLE_FOREST04: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_FOREST04) << "\n";
os << "FLAG_TRANSTURTLE_FOREST05: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_FOREST05) << "\n";
os << "FLAG_TRANSTURTLE_MAINAREA: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_MAINAREA) << "\n";
os << "FLAG_TRANSTURTLE_SEAHORSE: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_SEAHORSE) << "\n";
os << "FLAG_TRANSTURTLE_ABYSS03: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_ABYSS03) << "\n";
os << "FLAG_TRANSTURTLE_FINALBOSS: " << dsq->continuity.getFlag(FLAG_TRANSTURTLE_FINALBOSS) << "\n";
debugLog(os.str());
*/
if (dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL01) > 0
&& dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL02) > 0
@ -481,11 +446,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
{
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
if (!tile->revealed && (nocasecmp(tile->name, "thirteenlair") != 0)) {
/*
std::ostringstream os;
os << "does not have: " << tile->name;
debugLog(os.str());
*/
hasAllMap = false;
break;
}
@ -506,7 +467,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
break;
case ACH_AQUIRE_ALL_SONGS:
//debugLog("eval ACH_AQUIRE_ALL_SONGS");
if (dsq->continuity.hasSong(SONG_BIND)
&& dsq->continuity.hasSong(SONG_SHIELDAURA)
&& dsq->continuity.hasSong(SONG_LI)
@ -518,14 +479,14 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
&& dsq->continuity.hasSong(SONG_FISHFORM)
&& dsq->continuity.hasSong(SONG_SPIRITFORM))
{
//errorLog("ACH_AQUIRE_ALL_SONGS!");
UnlockAchievement(achievement);
}
break;
// gameplay
case ACH_DEFEAT_PRIESTS:
//if (dsq->continuity.getFlag(FLAG_MINIBOSS_PRIESTS) > 0)
if (dsq->continuity.hasSong(SONG_SPIRITFORM))
{
UnlockAchievement(achievement);
@ -609,7 +570,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
UnlockAchievement(achievement);
}
break;
case ACH_THE_FROZEN_VEIL:
if (dsq->game->sceneName == "frozenveil")
{
@ -618,8 +579,8 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
break;
case ACH_MOMMY_AND_DADDY:
//if (dsq->continuity.getFlag(SUNKENCITY_BOSSDONE) > 0)
//setFlag(FLAG_SUNKENCITY_PUZZLE, SUNKENCITY_BOSSDONE)
if (dsq->continuity.getFlag(FLAG_SUNKENCITY_PUZZLE) >= SUNKENCITY_BOSSDONE)
{
UnlockAchievement(achievement);
@ -723,16 +684,8 @@ void StatsAndAchievements::entityDied(Entity *eDead)
biteDeathComboCounter = 0;
}
/*
eDead->getState() ==
if (eDead->name == "monkey") {
// we killed a monkey, but how?
if (eDead->lastDamage.damageType == DT_AVATAR_VINE) {
// with a nature form vine
flungMonkey = true;
}
}
*/
}
void StatsAndAchievements::update(float dt)
@ -748,15 +701,11 @@ void StatsAndAchievements::update(float dt)
if (!rodeEkkritToTheStars) {
if (!dsq->game->isPaused() && b->on) {
//debugLog("boneLock->entity->name: " + b->entity->name);
if (b->entity->name == "ekkrit") {
ridingEkkritTime += dt;
/*
std::ostringstream os;
os << "ridingEkkritTime: " << ridingEkkritTime;
debugLog(os.str());
*/
if (ridingEkkritTime >= ridingEkkritTimeMax) {
rodeEkkritToTheStars = true;
@ -828,7 +777,7 @@ void StatsAndAchievements::UnlockAchievement( Achievement &achievement )
achievement.iconImage = 0;
#ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL
unlockedToBeDisplayed.push( std::string(achievement.name) );
unlockedToBeDisplayed.push( std::string(achievement.name) );
#endif
// Store stats end of frame
@ -864,7 +813,7 @@ void StatsAndAchievements::StoreStatsIfNecessary()
const size_t max_achievements = ARRAYSIZE(g_rgAchievements);
unsigned char *buf = new unsigned char[max_achievements];
for (size_t i = 0; i < max_achievements; i++)
{
int val = g_rgAchievements[i].achieved ? 1 : 0;

View file

@ -99,13 +99,13 @@ struct PlayStats
// maybe
int timesPlayed; // # of times the game started
int timesPoisoned; // # of times the poison applied gets called on Naija
int timesUsedTurtle; // # of times trans turtle is used (how to check?)
int timesRideSeahorse; // # of times ride seahorse
int timesLeptOutOfWater; // # of times Naija goes not underwater after being underwater
int timesBackflipped; // # of times Naija does a backflip, check in Avatar.cpp
float highestDive; // ...?
int creaturesConsumed; // # of times swallow creatures, check in Avatar.cpp
int sealoafsConsumed; // # of sealoafs eaten
int creaturesKilled; //
@ -155,7 +155,7 @@ private:
// Should we store stats this frame?
bool storeStats;
PlayStats playStats;
// PlayStats playStats;
// Current Stat details
//float m_flGameFeetTraveled;

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
SteamRender::SteamRender() : RenderObject()
{
cull = false;
//alpha = 0.1f;
alpha = 0.7;
setTexture("Particles/Steam");
texture->repeat = true;
@ -40,9 +40,8 @@ void SteamRender::onUpdate(float dt)
void SteamRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
//int qs = 0;
for (Path *p = dsq->game->getFirstPathOfType(PATH_STEAM); p; p = p->nextOfType)
{
@ -84,7 +83,7 @@ void SteamRender::onRender()
const float len = diff.getLength2D();
const float texScale = len/256.0f;
//qs++;
glBegin(GL_QUAD_STRIP);
glColor4f(1,1,1,0);
glTexCoord2f((0)*texScale+p->animOffset, 0);
@ -121,7 +120,6 @@ void SteamRender::onRender()
}
}
//glEnable(GL_CULL_FACE);
#endif
}

View file

@ -50,7 +50,6 @@ void Strand::onUpdate(float dt)
void Strand::onRender()
{
#ifdef BBGE_BUILD_OPENGL
const int numSegments = segments.size();
if (numSegments == 0) return;
@ -59,8 +58,8 @@ void Strand::onRender()
glLineWidth(1);
glBegin(GL_LINE_STRIP);
//glColor4f(0.25,0.25,0.5,1);
// Use fixed-point math to speed things up. --achurch
unsigned int r = (unsigned int)(color.x * (255<<8));
unsigned int g = (unsigned int)(color.y * (255<<8));
unsigned int b = (unsigned int)(color.z * (255<<8));
@ -90,5 +89,4 @@ void Strand::onRender()
glVertex2f(segments[i]->position.x, segments[i]->position.y);
}
glEnd();
#endif
}

View file

@ -48,7 +48,7 @@ void StringBank::load()
void StringBank::_load(const std::string &file)
{
//debugLog("StringBank::load("+file+")");
InStream in(file.c_str());
@ -59,9 +59,7 @@ void StringBank::_load(const std::string &file)
{
std::getline(in, line);
//std::ostringstream os;
//os << idx << ": StringBank Read Line: " << line;
//debugLog(os.str());
if (!line.empty() && line[0] == ' ')
line = line.substr(1, line.size());

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../BBGE/DebugFont.h"
#include "../BBGE/BitmapFont.h"
//#define DISABLE_SUBS
SubtitlePlayer::SubtitlePlayer()
{
@ -130,7 +130,7 @@ void SubtitlePlayer::update(float dt)
// set text
debugLog(subLines[curLine].line);
dsq->subtext->scrollText(subLines[curLine].line, 0.02);
//dsq->subtext->scrollText(subLines[curLine].line, 0.1);
// advance
curLine++;
}

View file

@ -54,7 +54,7 @@ void ToolTip::setText(const std::string &t, const Vector &center, int width)
int height = 0;
back->position = center;
text->setWidth(width - 40);
text->setText(t);
@ -62,7 +62,7 @@ void ToolTip::setText(const std::string &t, const Vector &center, int width)
back->setWidthHeight(width, height);
text->position = center - Vector(width,height)*0.5f + Vector(5, 5);
text->position = center - Vector(width,height)*0.5f + Vector(5, 5);
}
void ToolTip::setArea(const Vector &p1, const Vector &p2)
@ -114,7 +114,7 @@ void ToolTip::onUpdate(float dt)
break;
}
const float t = 0.0;//0.4;//0.05;
const float t = 0.0;
if (in && (required || dsq->user.control.toolTipsOn))
{
back->alpha.interpolateTo(1, t);

View file

@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void UserSettings::save()
{
//initInputCodeMap();
XMLDocument doc;
{
@ -268,7 +268,7 @@ void UserSettings::save()
doc.SaveFile(userSettingsFilename.c_str());
#endif
//clearInputCodeMap();
}
static void readInt(XMLElement *xml, const char *elem, const char *att, int *toChange)
@ -328,7 +328,7 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
}
control.actionSet.clearActions();
//initInputCodeMap();
control.actionSet.addActionInput("lmb");
control.actionSet.addActionInput("rmb");
@ -419,9 +419,7 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
readInt(xml_video, "FpsSmoothing", "v", &video.fpsSmoothing);
/*
readInt(xml_video, "Parallax", "on", &video.parallaxOn);
*/
XMLElement *xml_parallax = xml_video->FirstChildElement("Parallax");
if (xml_parallax)
{
@ -484,12 +482,10 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
xml_action = xml_actionSet->FirstChildElement();
while (xml_action)
{
std::string name = xml_action->Attribute("name");
if (!name.empty())
const char *name = xml_action->Attribute("name");
if (name && *name)
{
ActionInput *ai = control.actionSet.addActionInput(name);
ai->fromString(xml_action->Attribute("input"));
}
xml_action = xml_action->NextSiblingElement();
@ -534,7 +530,7 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
network.masterServer = serv;
}
//clearInputCodeMap();
if (system.locale.empty())
{
@ -578,11 +574,6 @@ void UserSettings::apply()
if (dsq->game)
{
dsq->game->bindInput();
if (dsq->game->avatar)
{
dsq->game->avatar->updateHeartbeatSfx();
}
}
dsq->bindInput();

View file

@ -1,104 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "WaterFont.h"
#include "DSQ.h"
#include "Game.h"
#include "Avatar.h"
#include "../BBGE/Particles.h"
WaterFont::WaterFont() : BitmapText(&dsq->font)
{
pTime = 0;
setBitmapFontEffect(BFE_SHADOWBLUR);
setFontSize(26);
}
//const float interval = 0.015;
void spawnWaterFontParticle(RenderObject *me, Vector position, int size, float life, int layer)
{
float t = life;
int angle = rand()%360;
int spd = 10;
PauseQuad *q = new PauseQuad;
q->setTexture("particles/spark");
q->setBlendType(RenderObject::BLEND_ADD);
q->color.ensureData();
q->color.data->path.addPathNode(Vector(1,1,1),0);
q->color.data->path.addPathNode(Vector(0.1,0.75,1),0.3);
q->color.data->path.addPathNode(Vector(0.05,0.5,1),0.8);
q->color.data->path.addPathNode(Vector(0,0,1),1.0);
q->color.startPath(t);
//q->color = Vector(1, 0.5, 0);
q->alpha.ensureData();
q->alpha.data->path.addPathNode(0, 0);
q->alpha.data->path.addPathNode(0.2, 0.5);
q->alpha.data->path.addPathNode(0, 1.0);
q->alpha.startPath(t);
q->velocity = Vector(sinf(angle)*spd,cosf(angle)*spd);
//q->velocity += vel;
q->setLife(1.0);
q->setDecayRate(1.0f/t);
q->rotation.z = rand()%360;
q->setWidthHeight(size, size);
q->position = position;
q->cull = false;
//q->influenced = 16;
dsq->game->addRenderObject(q, layer);
//me->addChild(q);
//me->renderBeforeParent = false;
//me->parentManagedPointer = true;
//q->update(interval);
}
//const float interval = 0.012;
const float interval = 0.08;
void WaterFont::onUpdate(float dt)
{
BitmapText::onUpdate(dt);
Vector sp(position.x-alignWidth*0.5f-15, 5+position.y+5);
Vector ep(position.x+alignWidth*0.5f+15, 5+position.y+10);
pTime += dt;
while (pTime > interval)
{
int dist = alignWidth / 40;
for (int i = 0; i < dist; i++)
{
Vector p(rand()%(int(ep.x-sp.x))+sp.x, rand()%(int(ep.y-sp.y))+sp.y);
/*
std::ostringstream os;
os << "p(" << p.x << ", " << p.y << ")";
debugLog(os.str());
*/
Vector d(rand()%200-100,rand()%200-100);
d *= 0.01f;
spawnWaterFontParticle(this, p, 64, 1.2, LR_PARTICLES);
}
pTime -= interval;
}
}

View file

@ -1,35 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef WATERFONT_H
#define WATERFONT_H
#include "../BBGE/BitmapFont.h"
class WaterFont : public BitmapText
{
public:
WaterFont();
protected:
float pTime;
void onUpdate(float dt);
};
#endif

View file

@ -1,37 +1,10 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "WaterSurfaceRender.h"
#include "DSQ.h"
#include "Game.h"
#include "Avatar.h"
/*
{
public:
WaterSurfaceRender();
void render();
protected:
void onRender();
};
*/
namespace WaterSurfaceRenderStuff
{
@ -44,7 +17,7 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
{
color = baseColor;
cull = false;
//alpha = 0.98;
alpha = 0.75;
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
@ -54,33 +27,17 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
//addChild(qSurface);
//qSurface->renderBeforeParent = 1;
/*
qLine = new Quad("water/water-line", Vector(0,50));
qLine->repeatTextureToFill(1);
addChild(qLine);
*/
qLine = new Quad("water/water-line", Vector(0,0));
qLine->repeatTextureToFill(1);
qLine->cull = false;
dsq->game->addRenderObject(qLine, LR_WATERSURFACE2);
qLine2 = 0;
/*
qLine2 = new Quad("water/water-line", Vector(0,0));
qLine2->repeatTextureToFill(1);
qLine2->cull = false;
//qLine2->flipVertical();
dsq->game->addRenderObject(qLine2, LR_ELEMENTS3);
*/
//water/water-surface
qSurface = new Quad("missingimage", Vector(0,0));
//qSurface->parentManagedPointer = 1;
qSurface->cull = false;
qSurface->repeatTextureToFill(1);
dsq->game->addRenderObject(qSurface, LR_WATERSURFACE2);
@ -90,22 +47,22 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
}
void WaterSurfaceRender::render()
{
//if (dsq->frameBuffer.isInited())
{
if (dsq->game->waterLevel.x > 0)
{
{
qLine->alpha = qSurface->alpha = 1;
//qSurface->alpha = 0;
position.x = core->screenCenter.x;
position.y = dsq->game->waterLevel.x;
width = core->getVirtualWidth()*core->invGlobalScale;
height = 100;
float dist = (core->screenCenter.y - position.y);
if (dist > 0)
@ -117,7 +74,7 @@ void WaterSurfaceRender::render()
}
offset.y = (height*scale.y);
//offset.y += 10;
offset.y -= 40*scale.y;
@ -125,11 +82,7 @@ void WaterSurfaceRender::render()
qLine->alphaMod = 0.5;
qLine->setWidth(width);
/*
qLine2->position = position + offset;
qLine2->alphaMod = 0.5;
qLine2->width = this->width;
*/
qSurface->position = position+offset;
qSurface->scale = scale.y;
@ -137,48 +90,35 @@ void WaterSurfaceRender::render()
qSurface->setWidthHeight(width, height);
float bit = core->cameraPos.x/300.0f;
//qSurface->texOff.x = bit;
qLine->texOff.x = bit;
//qSurface->refreshRepeatTextureToFill();
qLine->refreshRepeatTextureToFill();
/*
qLine2->texOff.x = bit;
qLine2->refreshRepeatTextureToFill();
*/
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
{
qSurface->alphaMod = 0.5;
Quad::render();
//qLine->alpha = qSurface->alpha = 0;
}
else
{
//color = baseColor;
Quad::render();
//qSurface->alphaMod = 0.6;
//deleteGrid();
//color = Vector(1,1,1);
}
/*
//core->setupRenderPositionAndScale();
glClear(GL_DEPTH_BUFFER_BIT);
core->currentLayerPass = 0;
dsq->game->avatar->color = Vector(1,0,0);
dsq->game->avatar->render();
dsq->game->avatar->color = Vector(1,1,1);
//glBindTexture(GL_TEXTURE_2D, 0);
*/
}
else
{
qLine->alpha = qSurface->alpha = 0;
if (qLine2)
{
qLine2->alpha = 0;
@ -188,7 +128,6 @@ void WaterSurfaceRender::render()
void WaterSurfaceRender::onRender()
{
#ifdef BBGE_BUILD_OPENGL
if (dsq->game->waterLevel == 0) return;
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
{
@ -218,22 +157,13 @@ void WaterSurfaceRender::onRender()
Quad::onRender();
/*
glTranslatef(0, -height - 20);
height = 40;
Quad::onRender();
*/
glBindTexture(GL_TEXTURE_2D, 0);
}
else
{
/*
upperLeftTextureCoordinates.x = 0;
lowerRightTextureCoordinates.x = core->frameBuffer.getWidthP();
*/
glColor4f(0.4, 0.7, 0.8, 0.2);
Quad::onRender();
@ -242,19 +172,6 @@ void WaterSurfaceRender::onRender()
RenderObject::lastTextureApplied = 0;
//dsq->game->avatar->setRenderPass(0);
/*
glEnable(GL_SCISSOR_TEST);
float realSz2 = sz2*scale.x;
float factor = float(core->getWindowWidth()) / 800.0f;
glScissor(dsq->game->waterLevel.x*factor - realSz2 * factor, 600*factor-(position.y+realSz2)*factor, realSz2*2*factor, realSz2*2*factor);
*/
//glDisable(GL_SCISSOR_TEST);
#endif
}

View file

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Web.h"
#include "Web.h"
#include "DSQ.h"
#include "Game.h"
#include "Avatar.h"
@ -40,9 +40,9 @@ void Web::setParentEntity(Entity *e)
}
void Web::killAllWebs()
{
{
std::queue<Web*>shotDeleteQueue;
for (Webs::iterator i = webs.begin(); i != webs.end(); i++)
for (Webs::iterator i = webs.begin(); i != webs.end(); i++)
{
shotDeleteQueue.push(*i);
}
@ -136,14 +136,7 @@ void Web::onUpdate(float dt)
}
if (hit)
{
/*
if (!e->vel.isZero())
{
Vector n = e->vel;
n.setLength2D(e->getv(EV_WEBSLOW)*dt);
e->vel -= n;
}
*/
e->vel /= float(e->getv(EV_WEBSLOW)) * dt;
}
}
@ -153,24 +146,22 @@ void Web::onUpdate(float dt)
void Web::onRender()
{
#ifdef BBGE_BUILD_OPENGL
glBindTexture(GL_TEXTURE_2D, 0);
//glDisable(GL_BLEND);
glLineWidth(4);
//glDisable(GL_CULL_FACE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_LINES);
for (int i = 0; i < points.size()-1; i++)
{
{
glColor4f(1, 1, 1, 0.5f*alpha.x);
glVertex3f(points[i].x, points[i].y, 0);
glColor4f(1, 1, 1, 0.5f*alpha.x);
glVertex3f(points[i+1].x, points[i+1].y, 0);
}
glEnd();
#endif
}

View file

@ -67,7 +67,7 @@ namespace WorldMapRenderNamespace
bool editorActive=false;
Quad *tophud=0;
Gradient *underlay = 0;
}
@ -157,44 +157,35 @@ public:
BeaconRender(BeaconData *beaconData) : Quad(), beaconData(beaconData)
{
renderQuad = false;
setTexture("gui/minimap/ripple"); //"particles/softring"); // or whatever
setTexture("gui/minimap/ripple");
position = beaconData->pos;
truePosition = beaconData->pos;
followCamera = 1;
/*
scale = Vector(0.2, 0.2);
scale.interpolateTo(Vector(0.5, 0.5), 0.75, -1, 1, 1);
*/
alpha = 0.5;
color = beaconData->color;
/*
pe = new ParticleEffect();
pe->load("sparkle");
pe->followCamera = 1;
pe->start();
core->addRenderObject(pe, LR_PARTICLES);
*/
spawnBitTimer = 0;
}
//float spawnBitTimer;
Vector truePosition;
ParticleEffect *pe;
float spawnBitTimer;
void render()
{
//setProperPosition();
Quad::render();
}
protected:
BeaconData *beaconData;
void setProperPosition()
{
Vector wp = parent->getWorldCollidePosition(truePosition);
@ -215,13 +206,13 @@ protected:
Vector move = wp - getWorldPosition();
position += move;
}
void onUpdate(float dt)
{
Quad::onUpdate(dt);
//setProperPosition();
if (!dsq->game->worldMapRender->isOn()) return;
@ -244,7 +235,7 @@ protected:
int x = sinf(radius)*len;
int y = cosf(radius)*len;
//truePosition +
float t = 0.75;
WorldMapBoundQuad *q = new WorldMapBoundQuad(Vector(x, y, 0));
q->setTexture("particles/glow");
@ -257,16 +248,15 @@ protected:
q->color = color;
q->scale = Vector(pscale, pscale);
//q->fadeAlphaWithLife = 1;
q->setLife(1);
q->setDecayRate(1.0f/t);
q->setBlendType(BLEND_ADD);
addChild(q, PM_POINTER);
//std::ostringstream os;
//os << "children: " << children.size();
//debugLog(os.str());
}
else
{
@ -276,9 +266,6 @@ protected:
/*
*/
}
};
@ -295,41 +282,26 @@ public:
blinkTimer = 0;
alphaMod = 0.66;
canMove = gemData->canMove;
//canMove = true;
//gemData->userString = "HI THERE!";
std::string useString = gemData->userString;
/*
if (gemData->userString.empty())
{
if (gemData->name == "savepoint")
useString = "Memory Crystal";
if (gemData->name == "cook")
useString = "Kitchen";
}
*/
/*
text = new BitmapText(&dsq->smallFont);
text->position = Vector(0, -20);
text->setText(gemData->userString);
addChild(text, PM_POINTER);
*/
text = new TTFText(&dsq->fontArialSmall);//new DebugFont(10, useString);
text->offset = Vector(0, 4); //Vector(0,5);
text = new TTFText(&dsq->fontArialSmall);
text->offset = Vector(0, 4);
text->setText(useString);
text->setAlign(ALIGN_CENTER);
textBG = new RoundedRect();
textBG->setWidthHeight(text->getActualWidth() + 20, 25, 10); // 30
textBG->setWidthHeight(text->getActualWidth() + 20, 25, 10);
textBG->alpha = 0;
textBG->followCamera = 1;
game->addRenderObject(textBG, LR_WORLDMAPHUD);
textBG->addChild(text, PM_POINTER);
//game->addRenderObject(text, LR_WORLDMAPHUD);
}
void destroy()
@ -348,32 +320,16 @@ public:
{
this->blink = blink;
//if (blink)
//{
// scale = Vector(0.5, 0.5);
// scale.interpolateTo(Vector(1,1), 0.5, -1, 1);
// /*
// alpha = 0.5;
// alpha.interpolateTo(1, 0.5, -1, 1);
// */
//}
//else
//{
// scale.stop();
// scale = Vector(1,1);
// /*
// alpha.stop();
// alpha = 1;
// */
//}
}
bool canMove;
protected:
float blinkTimer;
bool blink;
GemData *gemData;
//BitmapText *text;
TTFText *text;
RoundedRect *textBG;
void onUpdate(float dt)
@ -386,7 +342,7 @@ protected:
sz.x = sz.y = zoomMin;
if (sz.x > zoomMax)
sz.x = sz.y = zoomMax;
if (sz.x > 1.0f)
{
scale.x = (1.0f/sz.x);
@ -421,22 +377,22 @@ protected:
{
core->sound->playSfx("Gem-Move");
mover = this;
//offset = Vector(position - core->mouse.position);
//position += core->mouse.position - wp;
//offset = Vector(0, 4);
}
}
else if (mover == this)
{
//position = core->mouse.position;
position += (core->mouse.position - wp)/parent->scale.x;
if (!core->mouse.buttons.left)
{
mover = 0;
core->sound->playSfx("Gem-Place");
//position += offset;
//offset = Vector(0,0);
//offset = Vector(0,0);
gemData->pos = position;
}
}
@ -450,20 +406,14 @@ protected:
if ((core->mouse.position - wp).isLength2DIn(GEM_GRAB))
{
//text->alpha.interpolateTo(1, 0.1);
/*
if (!gemData->userString.empty())
textBG->alpha.interpolateTo(1, 0.1);
*/
if (!gemData->userString.empty())
textBG->show();
}
else
{
/*
text->alpha.interpolateTo(0, 0.1);
textBG->alpha.interpolateTo(0, 0.1);
*/
if (textBG->alpha == 1)
textBG->hide();
}
@ -502,7 +452,6 @@ void WorldMapRender::setProperTileColor(WorldMapTile *tile)
}
}
#ifdef AQUARIA_BUILD_MAPVIS
static void tileDataToVis(WorldMapTile *tile, Vector **vis)
{
@ -615,24 +564,16 @@ static void resetTileAlpha(WorldMapTile *tile, const unsigned char *savedTexData
tile->q->texture->write(0, 0, tile->q->texture->width, tile->q->texture->height, savedTexData);
}
#endif // AQUARIA_BUILD_MAPVIS
void WorldMapRender::setVis(WorldMapTile *tile)
{
if (!tile) return;
#ifdef AQUARIA_BUILD_MAPVIS
/*
if (lastVisQuad)
{
lastVisQuad->alphaMod = 0.5;
lastVisQuad->color = Vector(0.7, 0.8, 1);
}
*/
tile->q->color = Vector(1,1,1);
tile->q->alphaMod = 1;
if (visMethod == VIS_VERTEX)
{
tile->q->setSegs(MAPVIS_SUBDIV, MAPVIS_SUBDIV, 0, 0, 0, 0, 2.0, 1);
@ -645,13 +586,11 @@ void WorldMapRender::setVis(WorldMapTile *tile)
lastVisQuad = tile->q;
lastVisTile = tile;
#endif
}
void WorldMapRender::clearVis(WorldMapTile *tile)
{
if (!tile) return;
#ifdef AQUARIA_BUILD_MAPVIS
if (visMethod == VIS_VERTEX)
{
if (tile->q)
@ -666,7 +605,6 @@ void WorldMapRender::clearVis(WorldMapTile *tile)
savedTexData = 0;
}
}
#endif
}
@ -704,19 +642,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
savedTexData = 0;
/*
bg = new Quad("", Vector(400,300));
bg->setWidthHeight(810, 610);
bg->setSegs(32, 32, 0.5, 0.5, 0.008, 0.008, 2.0, 1);
bg->alphaMod = 0.5;
bg->alpha = 0;
bg->followCamera = 1;
bg->repeatTextureToFill(true);
//bg->parentManagedPointer = 1;
dsq->game->addRenderObject(bg, LR_MESSAGEBOX);
bg->renderQuad = false;
*/
int num = dsq->continuity.worldMap.getNumWorldMapTiles();
std::string n = dsq->game->sceneName;
@ -750,7 +676,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
q->alphaMod = 0;
tile->q = q;
q->setWidthHeight(q->getWidth()*tile->scale, q->getHeight()*tile->scale);
q->scale = Vector(0.25f*tile->scale2, 0.25f*tile->scale2);
@ -769,7 +695,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
activeTile->q->color = Vector(1,1,1);
activeTile->q->alphaMod = 1;
}
addChild(q, PM_POINTER);
tiles.push_back(q);
@ -789,14 +715,14 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
tophud->alpha = 0;
dsq->game->addRenderObject(tophud, LR_WORLDMAPHUD);
//int fontSize = 6;
float aly = 26, aly2 = 18;
float sz = 0.6;
//hover
areaLabel = new BitmapText(&dsq->smallFont);
areaLabel->scale = Vector(sz,sz);
//areaLabel->setFontSize(fontSize);
areaLabel->setAlign(ALIGN_CENTER);
areaLabel->followCamera = 1;
areaLabel->position = Vector(150,aly);
@ -805,7 +731,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
//in
areaLabel2 = new BitmapText(&dsq->smallFont);
//areaLabel2->setFontSize(fontSize);
areaLabel2->scale = Vector(sz,sz);
areaLabel2->followCamera = 1;
areaLabel2->setAlign(ALIGN_CENTER);
@ -816,7 +742,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
//select
areaLabel3 = new BitmapText(&dsq->smallFont);
areaLabel3->scale = Vector(sz,sz);
//areaLabel3->setFontSize(fontSize);
areaLabel3->followCamera = 1;
areaLabel3->setAlign(ALIGN_CENTER);
areaLabel3->position = Vector(650, aly);
@ -831,9 +757,9 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
originalActiveTile = activeTile;
bindInput();
underlay = new Gradient;
//underlay->makeVertical(Vector(0.5,0.5,1), Vector(0,0,0.5));
underlay->makeVertical(Vector(0.25,0.25,0.5), Vector(0,0,0.25));
underlay->position = Vector(400,300);
underlay->autoWidth = AUTO_VIRTUALWIDTH;
@ -852,14 +778,14 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
addHintQuad2->alpha = 0;
dsq->game->addRenderObject(addHintQuad2, LR_WORLDMAPHUD);
//helpButton->event.set(MakeFunctionEvent(WorldMapRender, onToggleHelpScreen));
helpButton = new AquariaMenuItem;
helpButton->event.setActionMapperCallback(this, ACTION_TOGGLEHELPSCREEN, 0);
helpButton->useQuad("gui/icon-help");
helpButton->useGlow("particles/glow", 40, 40);
helpButton->useSound("Click");
helpButton->alpha = 0;
//helpButton->position = Vector(800-20, 20);
dsq->game->addRenderObject(helpButton, LR_WORLDMAPHUD);
}
@ -886,7 +812,7 @@ void WorldMapRender::bindInput()
void WorldMapRender::destroy()
{
//clearVis(activeTile);
for (int i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++)
{
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
@ -939,7 +865,7 @@ void WorldMapRender::onUpdate(float dt)
if (alpha.x > 0)
{
//if (activeTile && activeTile==originalActiveTile && !gemMovers.empty())
if (originalActiveTile && !gemMovers.empty())
{
gemMovers.back()->position = getAvatarWorldMapPosition();
@ -975,7 +901,7 @@ void WorldMapRender::onUpdate(float dt)
if (q)
{
d = (q->getWorldPosition() - core->mouse.position).getSquaredLength2D();
if (q->isCoordinateInsideWorld(core->mouse.position) && (sd == -1 || d < sd))
{
sd = d;
@ -993,7 +919,7 @@ void WorldMapRender::onUpdate(float dt)
{
areaLabel3->setText(dsq->continuity.stringBank.get(activeTile->stringIndex));
}
if (selectedTile)
{
areaLabel->setText(dsq->continuity.stringBank.get(selectedTile->stringIndex));
@ -1009,7 +935,7 @@ void WorldMapRender::onUpdate(float dt)
activeTile = selectedTile;
activeQuad = activeTile->q;
//activeTile->gridPos = activeTile->q->position;
if (activeQuad)
{
dsq->clickRingEffect(activeQuad->getWorldPosition(), 0);
@ -1126,7 +1052,7 @@ void WorldMapRender::onUpdate(float dt)
zoomMax = exteriorZoomMax;
}
float scrollAmount = 0.2;//0.25;
float scrollAmount = 0.2;
if (core->mouse.scrollWheelChange)
{
@ -1219,7 +1145,6 @@ void WorldMapRender::onUpdate(float dt)
}
else
{
#ifdef AQUARIA_BUILD_MAPVIS
if (!dsq->isInCutscene() && dsq->game->avatar && activeTile
#ifdef AQUARIA_BUILD_SCENEEDITOR
&& !dsq->game->sceneEditor.isOn()
@ -1261,7 +1186,6 @@ void WorldMapRender::onUpdate(float dt)
}
}
}
#endif
}
lastMousePosition = core->mouse.position;
@ -1357,7 +1281,7 @@ void WorldMapRender::toggle(bool turnON)
if (alpha.isInterpolating()) return;
if (dsq->mod.isActive() && !dsq->mod.hasWorldMap()) return;
if (dsq->isNested()) return;
if (!dsq->game->avatar) return;
@ -1367,7 +1291,7 @@ void WorldMapRender::toggle(bool turnON)
if (dsq->game->isInGameMenu()) return;
if (!dsq->game->isActive()) return;
if (turnON && dsq->game->isPaused()) return;
if (!this->on && !dsq->game->avatar->isInputEnabled()) return;
@ -1387,7 +1311,7 @@ void WorldMapRender::toggle(bool turnON)
{
restoreVel = dsq->game->avatar->vel;
dsq->game->avatar->vel = Vector(0,0,0);
//dsq->game->avatar->idle();
dsq->game->togglePause(true);
core->sound->playSfx("menu-open");
@ -1435,23 +1359,23 @@ void WorldMapRender::toggle(bool turnON)
alpha.interpolateTo(1, 0.2);
//dsq->game->hudUnderlay->alpha.interpolateTo(WORLDMAP_UNDERLAY_ALPHA, 0.2);
underlay->alpha.interpolateTo(WORLDMAP_UNDERLAY_ALPHA, 0.2);
addHintQuad1->alpha.interpolateTo(1.0, 0.2);
addHintQuad2->alpha.interpolateTo(1.0, 0.2);
helpButton->alpha.interpolateTo(1.0, 0.2);
addAllGems();
for (Continuity::Beacons::reverse_iterator i = dsq->continuity.beacons.rbegin(); i != dsq->continuity.beacons.rend(); i++)
{
if ((*i).on)
{
BeaconRender *b = new BeaconRender(&(*i));
//b->position = (*i).pos;
//game->addRenderObject(b, layer+1);
addChild(b, PM_POINTER);
beaconRenders.push_back(b);
}
@ -1496,14 +1420,6 @@ void WorldMapRender::toggle(bool turnON)
}
//setVis(activeTile);
/*
for (int i = 0; i < LR_MENU; i++)
{
RenderObjectLayer *rl = dsq->getRenderObjectLayer(i);
rl->visible = true;
}
*/
core->sound->playSfx("Menu-Close");
@ -1513,7 +1429,7 @@ void WorldMapRender::toggle(bool turnON)
alpha.interpolateTo(0, 0.2);
dsq->game->togglePause(false);
//dsq->game->hudUnderlay->alpha.interpolateTo(0, 0.2);
underlay->alpha.interpolateTo(0, 0.2);
addHintQuad1->alpha.interpolateTo(0, 0.2);
addHintQuad2->alpha.interpolateTo(0, 0.2);
@ -1522,14 +1438,14 @@ void WorldMapRender::toggle(bool turnON)
for (GemMovers::iterator i = gemMovers.begin(); i != gemMovers.end(); i++)
{
//removeChild(*i);
(*i)->safeKill();
}
gemMovers.clear();
for (BeaconRenders::iterator i = beaconRenders.begin(); i != beaconRenders.end(); i++)
{
//removeChild(*i);
(*i)->safeKill();
}
beaconRenders.clear();
@ -1546,7 +1462,7 @@ void WorldMapRender::createGemHint(const std::string &gfx)
doubleClickTimer = 0;
GemData *g = dsq->continuity.pickupGem(gfx, false);
g->canMove = 1;
g->pos = getAvatarWorldMapPosition();// + Vector(0, -20);
g->pos = getAvatarWorldMapPosition();
g->userString = useString;
addGem(g);
fixGems();
@ -1614,25 +1530,6 @@ void WorldMapRender::action (int id, int state)
}
/*
if (id == ACTION_PRIMARY && state)
{
if (doubleClickTimer > 0)
{
doubleClickTimer = 0;
GemData *g = dsq->continuity.pickupGem("pyramidyellow", false);
g->canMove = 1;
g->userString = dsq->getUserInputString("Enter Map Hint Name:", "");
addGem(g);
}
else
{
if (doubleClickTimer == 0)
{
doubleClickTimer = DOUBLE_CLICK_DELAY;
}
}
}
*/
}
}

View file

@ -255,7 +255,7 @@ void WorldMap::_load(const std::string &file)
std::string line;
InStream in(file.c_str());
while (std::getline(in, line))
{
WorldMapTile t;
@ -337,18 +337,8 @@ WorldMapTile *WorldMap::getWorldMapTileByIndex(int index)
return 0;
}
/*
void WorldMap::revealMapIndex(int index)
{
if (index < 0 || index >= worldMapTiles.size()) return;
worldMapTiles[index].revealed = true;
}
*/
void WorldMap::hideMap()
{
for (int i = 0; i < worldMapTiles.size(); i++)

View file

@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <Winver.h>
#include <Windows.h>
#include "resource.h" // Might as well use what's there, even though it's questionable.
#define AQUARIA_RC_FILEVERSION 1,1,3,999
#define AQUARIA_RC_PRODUCTVERSION 1,1,3,0
#define AQUARIA_RC_PRODUCTVERSION_STRING "1.1.3"

View file

@ -1,37 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by DSQ.rc
//
#define IDI_ICON1 106
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -13,53 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "ActionMapper.h"
#include "Core.h"
//bool ActionMapper::isActing(const std::string &action)
//{
// ButtonList::iterator i = actionMap[action].begin();
// for (; i != actionMap[action].end(); i++)
// {
// if (keyDownMap[(*i)])
// return true;
// }
// return false;
// //return keyDownMap[actionMap[action]];
//}
//bool ActionMapper::isActing(int actionID)
//{
// std::string action = "A";
// action[0] = char(actionID);
// ButtonList::iterator i = actionMap[action].begin();
// for (; i != actionMap[action].end(); i++)
// {
// if (keyDownMap[(*i)])
// return true;
// }
// return false;
// //return keyDownMap[actionMap[action]];
//}
//void ActionMapper::addAction (const std::string &action, int k)
//{
// actionMap[action].push_back(k);
// keyDownMap[k] = core->getKeyState(k);
//}
//
//void ActionMapper::addAction (int actionID, int k)
//{
// std::string action = "A";
// action[0] = char(actionID);
// actionMap[action].push_back(k);
// keyDownMap[k] = core->getKeyState(k);
//}
ActionMapper::ActionMapper()
{
@ -104,11 +62,7 @@ void ActionMapper::addAction (int actionID, int k)
if (ad)
{
/*
std::ostringstream os;
os << "Action ID [" << actionID << "] already exists!";
debugLog(os.str());
*/
}
else
{
@ -166,55 +120,7 @@ void ActionMapper::clearCreatedEvents()
createdEvents.clear();
}
/*
void ActionMapper::addMouseButtonAction (const std::string &action, int b)
{
actionMap[action].push_back (0-b);
keyDownMap[0-b] = mouse_b & b;
}
void ActionMapper::addJoystickButtonAction (const std::string &action, int b)
{
if (num_joysticks)
{
actionMap[action].push_back (b+9000);
keyDownMap[b+9000] = joy[0].button[b].b;
}
}
int ActionMapper::getDPad(int dir)
{
// for (int = 0; i < joy[0].num_sticks; i++)
//int s = 4;
int s = 0;
switch (dir)
{
case 0:
return (joy[0].stick[s].axis[0].d1);
break;
case 1:
return (joy[0].stick[s].axis[0].d2);
break;
case 2:
return (joy[0].stick[s].axis[1].d1);
break;
case 3:
return (joy[0].stick[s].axis[1].d2);
break;
}
return 0;
}
void ActionMapper::addJoystickDPadAction (const std::string &action, int dir)
{
if (num_joysticks)
{
actionMap[action].push_back (dir+8000);
keyDownMap[dir+8000] = getDPad(dir);
}
}
*/
void ActionMapper::enableInput()
{
@ -235,7 +141,7 @@ void ActionMapper::removeAction(int actionID)
for (; i != ad->buttonList.end(); i++)
{
int k = (*i);
cleared = true; // it's a hack, but it works
cleared = true; // it's a hack, but it works
keyDownMap.erase(k);
}
for (ActionDataSet::iterator i = actionData.begin(); i != actionData.end();)
@ -248,19 +154,7 @@ void ActionMapper::removeAction(int actionID)
}
}
//int ActionMapper::getKeyForAction (std::string action)
//{
// ButtonList b = actionMap[action];
// if (!b.empty())
// {
// return b[0];
// }
// else
// {
// debugLog ("no action: " +action);
// return -1;
// }
//}
bool ActionMapper::pollAction(int actionID)
{
@ -272,7 +166,7 @@ bool ActionMapper::pollAction(int actionID)
ButtonList *blist = &ad->buttonList;
ButtonList::iterator j;
j = blist->begin();
for (; j != blist->end(); j++)
{
if (getKeyState((*j)))
@ -316,11 +210,11 @@ bool ActionMapper::getKeyState(int k)
else if (k == MOUSE_BUTTON_MIDDLE)
{
keyState = (core->mouse.buttons.middle == DOWN);
}
}
else if (k >= JOY1_BUTTON_0 && k <= JOY1_BUTTON_16)
{
int v = k - JOY1_BUTTON_0;
if (core->joystickEnabled)
keyState = core->joystick.buttons[v];
}
@ -369,13 +263,10 @@ bool ActionMapper::getKeyState(int k)
}
void ActionMapper::onUpdate (float dt)
{
{
if (inUpdate) return;
inUpdate = true;
/*
if (num_joysticks)
poll_joystick();
*/
if (cleared) cleared = false;
ActionDataSet::iterator i;
KeyDownMap oldKeyDownMap = keyDownMap;
@ -392,7 +283,7 @@ void ActionMapper::onUpdate (float dt)
keyState = getKeyState(k);
if (keyState != oldKeyDownMap[k])
{
{
keyDownMap[k] = keyState;
if (inputEnabled)
{
@ -417,7 +308,7 @@ void ActionMapper::onUpdate (float dt)
out:
inUpdate = false;
// keyDownMap[k] = ;
}
void ActionMapper::clearActions()

View file

@ -44,45 +44,37 @@ struct ActionData
class ActionMapper
{
public:
// funcs
ActionMapper();
virtual ~ActionMapper();
//void addAction (const std::string &action, int k);
void addAction(Event *event, int k, int state=-1);
void addAction(int actionID, int k);
/*
void addMouseButtonAction (const std::string &action, int b);
void addJoystickButtonAction (const std::string &action, int b);
void addJoystickDPadAction (const std::string &action, int dir);
int getDPad(int dir);
*/
void removeAction(int actionID);
void removeAllActions();
bool isActing(int actionID);
virtual void action(int actionID, int state){}
void clearActions();
bool isInputEnabled() { return inputEnabled; }
// vars
typedef std::list<ActionData> ActionDataSet;
ActionDataSet actionData;
typedef std::map <int, int> KeyDownMap;
KeyDownMap keyDownMap;
bool cleared;
//typedef std::map <std::string, int> StringIntMap;
//StringIntMap stateCheckMap;
enum {
MOUSE_BUTTON_LEFT = 999,
MOUSE_BUTTON_RIGHT = 1000,
@ -106,7 +98,7 @@ public:
JOY1_BUTTON_15 = 2015,
JOY1_BUTTON_16 = 2016,
//JOY1_BUTTON_X360_START=2011,
X360_BTN_START = 3016,
X360_BTN_BACK = 3017,
@ -122,13 +114,13 @@ public:
enum { DPAD_LEFT = 0, DPAD_RIGHT, DPAD_UP, DPAD_DOWN };
//int getKeyForAction(std::string action);
virtual void enableInput();
virtual void disableInput();
/*void loadActionSet(const std::string &fn);*/
//nasty hack
//void forceUpdate(float dt);
Event *addCreatedEvent(Event *event);
void clearCreatedEvents();
@ -149,4 +141,3 @@ protected:

View file

@ -38,68 +38,7 @@ ActionInput *ActionSet::getActionInputByName(const std::string &name)
return 0;
}
//void ActionSet::loadAction(const std::string &name, int inputCode, InputSetType set)
//{
// ActionInput *a = getActionInputByName(name);
// if (!a)
// {
// ActionInput newa;
// newa.name = name;
// inputSet.push_back(newa);
// a = getActionInputByName(name);
//
// if (!a) return;
// }
//
// switch(set)
// {
// case INPUTSET_KEY:
// a->keyCodes.push_back(inputCode);
// break;
// case INPUTSET_JOY:
// a->joyCodes.push_back(inputCode);
// break;
// case INPUTSET_MOUSE:
// a->mouseCodes.push_back(inputCode);
// break;
// case INPUTSET_GENERAL:
// default:
// a->inputCodes.push_back(inputCode);
// break;
// }
//}
//
//void ActionSet::loadAction(const std::string &name, const std::vector<int> &inputCodes, InputSetType set)
//{
//
// ActionInput *a = getActionInputByName(name);
// if (!a)
// {
// ActionInput newa;
// newa.name = name;
// inputSet.push_back(newa);
// a = getActionInputByName(name);
//
// if (!a) return;
// }
//
// switch(set)
// {
// case INPUTSET_KEY:
// a->keyCodes = inputCodes;
// break;
// case INPUTSET_JOY:
// a->joyCodes = inputCodes;
// break;
// case INPUTSET_MOUSE:
// a->mouseCodes = inputCodes;
// break;
// case INPUTSET_GENERAL:
// default:
// a->inputCodes = inputCodes;
// break;
// }
//}
void ActionSet::importAction(ActionMapper *mapper, const std::string &name, int actionID)
{
@ -168,7 +107,7 @@ ActionInput *ActionSet::addActionInput(const std::string &name)
std::string ActionSet::insertInputIntoString(const std::string &string)
{
std::string str = string;
int start = str.find('{');
int end = str.find('}');
if (start == std::string::npos || end == std::string::npos)
@ -177,18 +116,18 @@ std::string ActionSet::insertInputIntoString(const std::string &string)
stringToLower(code);
std::string part1 = str.substr(0, start);
std::string part3 = str.substr(end+1, str.size());
//{ToggleHelp:k0}
int thing = code.find(':');
std::string input = code.substr(0, thing);
std::string button = code.substr(thing+1, code.size());
char buttonType;
int buttonNum;
std::istringstream is(button);
is >> buttonType >> buttonNum;
ActionInput *actionInput=0;
actionInput = getActionInputByName(input);
if (!actionInput)
@ -209,7 +148,7 @@ std::string ActionSet::insertInputIntoString(const std::string &string)
inputCode = actionInput->mse[buttonNum];
break;
}
std::string part2 = getInputCodeToUserString(inputCode);
return part1 + part2 + part3;
}

View file

@ -39,13 +39,12 @@ public:
ActionInput *addActionInput(const std::string &name);
//void loadAction(const std::string &name, int inputCode, InputSetType set);
//void loadAction(const std::string &name, const std::vector<int> &inputCodes, InputSetType set=INPUTSET_GENERAL);
ActionInput *getActionInputByName(const std::string &name);
ActionInputSet inputSet;
std::string insertInputIntoString(const std::string &string);
};

View file

@ -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 "AfterEffect.h"
//#include "math.h"
#include <assert.h>
@ -76,7 +76,7 @@ AfterEffectManager::~AfterEffectManager()
for (i = 0; i < xDivs; i++)
{
delete[] drawGrid[i];
}
}
delete[] drawGrid;
}
deleteEffects();
@ -128,7 +128,7 @@ void AfterEffectManager::clear()
void AfterEffectManager::update(float dt)
{
if (core->particlesPaused) return;
if (core->particlesPaused) return;
resetGrid();
@ -138,7 +138,7 @@ void AfterEffectManager::update(float dt)
active = false;
for (int i = 0; i < effects.size(); i++)
{
{
Effect *e = effects[i];
if (e)
{
@ -177,7 +177,6 @@ void AfterEffectManager::render()
{
assert(core->frameBuffer.isInited());
#ifdef BBGE_BUILD_OPENGL
glPushMatrix();
glDisable (GL_ALPHA_TEST);
@ -189,14 +188,12 @@ void AfterEffectManager::render()
glColor4f(1,1,1,1);
renderGrid();
//renderGridPoints();
glPopMatrix();
#endif
}
void AfterEffectManager::renderGrid()
{
#ifdef BBGE_BUILD_OPENGL
int firstShader = -1;
int lastShader = -1;
@ -237,29 +234,29 @@ void AfterEffectManager::renderGrid()
backupBuffer.startCapture();
}
//float div = xDivs;
for (int i = 0; i < (xDivs-1); i++)
{
for (int j = 0; j < (yDivs-1); j++)
{
glBegin(GL_QUADS);
//glColor3f(i/div, i/div, i/div);
{
glBegin(GL_QUADS);
glTexCoord2f(i/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,i/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,0);
glVertex2f(offx + vw*drawGrid[i][j].x, offy + vh*drawGrid[i][j].y);
glTexCoord2f(i/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,i/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,(float)(screenHeight/(yDivs-1))/16);
glVertex2f(offx + vw*drawGrid[i][j+1].x, offy + vh*drawGrid[i][j+1].y);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,(i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,(float)(screenWidth/(xDivs-1))/16,(float)(screenHeight/(yDivs-1))/16);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
glVertex2f(offx + vw*drawGrid[i+1][j+1].x, offy + vh*drawGrid[i+1][j+1].y);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,(i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,(float)(screenWidth/(xDivs-1))/16,0);
glVertex2f(offx + vw*drawGrid[i+1][j].x, offy + vh*drawGrid[i+1][j].y);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
glVertex2f(offx + vw*drawGrid[i+1][j].x, offy + vh*drawGrid[i+1][j].y);
glEnd();
}
}
@ -267,10 +264,6 @@ void AfterEffectManager::renderGrid()
if (activeShader)
activeShader->unbind();
float width2 = float(vw)/2;
float height2 = float(vh)/2;
if(firstShader != lastShader)
{
// From here on: secondary shader passes.
@ -296,7 +289,7 @@ void AfterEffectManager::renderGrid()
activeShader->bind();
activeShader->setInt("tex", 0);
// note that offx, offy are negative here!
glBegin(GL_QUADS);
glTexCoord2d(0.0f, 0.0f);
@ -308,7 +301,7 @@ void AfterEffectManager::renderGrid()
glTexCoord2d(0.0f, percentY);
glVertex3f(offx, offy, 0.0f);
glEnd();
activeShader->unbind();
}
}
@ -322,8 +315,8 @@ void AfterEffectManager::renderGrid()
for (int i = 0; i < (xDivs-1); i++)
{
for (int j = 0; j < (yDivs-1); j++)
{
glBegin(GL_POINTS);
{
glBegin(GL_POINTS);
//glColor3f(i/div, i/div, i/div);
glTexCoord2f(i/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,i/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
@ -333,17 +326,17 @@ void AfterEffectManager::renderGrid()
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,i/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,(float)(screenHeight/(yDivs-1))/16);
glVertex2f(800*drawGrid[i][j+1].x, 600*drawGrid[i][j+1].y);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,(i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,(float)(screenWidth/(xDivs-1))/16,(float)(screenHeight/(yDivs-1))/16);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,(i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j+1)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,(float)(screenWidth/(xDivs-1))/16,(float)(screenHeight/(yDivs-1))/16);
glVertex2f(800*drawGrid[i+1][j+1].x, 600*drawGrid[i+1][j+1].y);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,(i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,(float)(screenWidth/(xDivs-1))/16,0);
glVertex2f(800*drawGrid[i+1][j].x, 600*drawGrid[i+1][j].y);
glTexCoord2f((i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE0_ARB,(i+1)/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY);
//glMultiTexCoord2fARB(GL_TEXTURE1_ARB,(float)(screenWidth/(xDivs-1))/16,0);
glVertex2f(800*drawGrid[i+1][j].x, 600*drawGrid[i+1][j].y);
glEnd();
}
}
}
*/
//glDisable(GL_TEXTURE_2D);
@ -352,15 +345,13 @@ void AfterEffectManager::renderGrid()
//bwShader.unbind();
//glActiveTextureARB(GL_TEXTURE0_ARB);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//if (bRenderGridPoints)
// renderGridPoints();
#endif
}
void AfterEffectManager::renderGridPoints()
{
#ifdef BBGE_BUILD_OPENGL
glColor4f(0.0f,0.0f,0.0f,1.0f);
for (int i = 0; i < (xDivs); i++)
{
@ -374,7 +365,6 @@ void AfterEffectManager::renderGridPoints()
glEnd();
}
}
#endif
}
void AfterEffectManager::unloadDevice()
@ -438,31 +428,15 @@ void AfterEffectManager::addEffect(Effect *e)
effects.push_back(e);
}
numEffects++;
//float lowest = 9999;
Vector base(0,0,0);
//Vector *newPos = &base;
//Vector *v;
e->position.x /= screenWidth;
//e->position.x *= xDivs;
e->position.y /= screenHeight;
//e->position.y *= yDivs;
/*
for (int x = 1; x < xDivs-1; x++)
{
for (int y = 1; y < yDivs-1; y++)
{
v = &drawGrid[x][y];
float dist = (v->x - e->position.x)*(v->x - e->position.x)+(v->y - e->position.y)*(v->y - e->position.y);
if (dist < lowest)
{
lowest = dist;
newPos = &drawGrid[x][y];
}
}
}
e->position = Vector(newPos->x, newPos->y, newPos->z);
*/
Vector base(0,0,0);
e->position.x /= screenWidth;
e->position.y /= screenHeight;
}
@ -471,18 +445,13 @@ void ShockEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
{
dt *= timeMultiplier;
Effect::update(dt, drawGrid, xDivs, yDivs);
//GLdouble sx, sy,sz;
/*
gluProject(position.x,position.y,position.z,
nCameraPointer->modelMatrix,nCameraPointer->projMatrix,nCameraPointer->viewport,
&sx,&sy,&sz); // Find out where the light is on the screen.
centerPoint.Set(sx/(float)nCameraPointer->viewport[2],1-sy/(float)nCameraPointer->viewport[3],sz);
*/
centerPoint = position;
centerPoint -= ((core->screenCenter-originalCenter)*core->globalScale.x)/core->width;
//centerPoint = position/xDivs;
//centerPoint = drawGrid[xDivs/2][yDivs/2];
float xDist,yDist,tDist;
@ -490,8 +459,7 @@ void ShockEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
currentDistance+=dt*frequency;
//float distFromCamp =(core->cameraPos - position).getLength2D();//v3dDist(nCameraPointer->pos, position);
//if (distFromCamp < 4)
float distFromCamp = 4;
float adjWaveLength = waveLength/distFromCamp;
@ -504,33 +472,21 @@ void ShockEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
{
for (int j = 1; j < (yDivs-1); j++)
{
/*
Vector p = getNearestPointOnLine(centerPoint, centerPoint + Vector(-200, -200), Vector(drawGrid[i][j].x*core->width, drawGrid[i][j].y*core->height));
p.x /= core->width;
p.y /= core->height;
*/
xDist = (centerPoint.x - drawGrid[i][j].x)/.75;
yDist = centerPoint.y - drawGrid[i][j].y;
/*
xDist = (p.x - drawGrid[i][j].x)/.75;
yDist = p.y - drawGrid[i][j].y;
*/
//xDist = 1;
//yDist = 2;
tDist = sqrtf(xDist*xDist+yDist*yDist);
//drawGrid[i][j].x += (rand()%100)/10000.0f;
//drawGrid[i][j].y += (rand()%100)/10000.0f;
if (tDist < currentDistance*adjWaveLength)
{
//drawGrid[i][j].x += rand()%50;
//drawGrid[i][j].y += rand()%50;
drawGrid[i][j].x += adjAmplitude*sinf(-tDist/adjWaveLength+currentDistance)*.75f;
drawGrid[i][j].y += adjAmplitude*cosf(-tDist/adjWaveLength+currentDistance);
}
@ -546,20 +502,9 @@ RippleEffect::RippleEffect() : Effect()
void RippleEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
{
/*
// whole screen roll
time += dt;
float amp = 0.01;
for (int i = 0; i < (xDivs-1); i++)
{
for (int j = 0; j < (yDivs-1); j++)
{
float offset = +i/float(xDivs) +j/float(xDivs);
//drawGrid[i][j].x += sinf(time+offset)*amp;
drawGrid[i][j].y += cosf((time+offset)*2.5f)*amp;
}
}
*/
time += dt*0.5f;
float amp = 0.002;
for (int i = 0; i < (xDivs-1); i++)
@ -567,7 +512,7 @@ void RippleEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
for (int j = 0; j < (yDivs-1); j++)
{
float offset = i/float(xDivs) + (core->screenCenter.x/float(core->width)/2) +j/float(xDivs) + (core->screenCenter.y/float(core->height)/2);
//drawGrid[i][j].x += sinf(time+offset)*amp;
drawGrid[i][j].x += sinf((time+offset)*7.5f)*(amp*0.5f);
drawGrid[i][j].y += cosf((time+offset)*7.5f)*amp;
}

View file

@ -28,6 +28,7 @@ class Effect
{
public:
Effect();
virtual ~Effect(){};
virtual void go(){}
virtual void update(float dt, Vector ** drawGrid, int xDivs, int yDivs){}
bool done;
@ -51,7 +52,7 @@ public:
this->timeMultiplier = timeMultiplier;
}
float timeMultiplier;
//void go();
void update(float dt, Vector ** drawGrid, int xDivs, int yDivs);
float waveLength;

View file

@ -1,79 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "AnimatedSprite.h"
AnimData::AnimData()
{
frameStart = frameEnd = 0;
time = 0;
loop = 0;
pingPong = false;
datafile = 0;
}
AnimatedSprite::AnimatedSprite() : Quad()
{
//debugLog("AnimatedSprite::AnimatedSprite()");
frame = 0;
animator.setUpdatee(&frame);
animationTime.setUpdatee (&animator.timePeriod);
//debugLog("End AnimatedSprite::AnimatedSprite()");
}
void AnimatedSprite::animate (AnimData &animData)
{
onAnimData(animData);
animate (animData.name, animData.frameStart, animData.frameEnd, animData.time, animData.loop, animData.pingPong);
}
void AnimatedSprite::onAnimData(AnimData &animData)
{
}
void AnimatedSprite::animate (const std::string &name, int from, int to, float time, int loopType, bool pingPong, float initialDelay)
{
if (from == to && to == 0)
{
debugLog ("null animation");
animator.stop();
return;
}
currentAnim = name;
frame = from;
animator.interpolateTo (to, time, loopType);
animator.pingPong = pingPong;
animator.initialDelay = initialDelay;
}
void AnimatedSprite::onUpdate (float dt)
{
Quad::onUpdate (dt);
animator.update (dt);
animationTime.update (dt);
if (!animator.interpolating && currentAnim != "")
{
animComplete(currentAnim);
lastAnim = currentAnim;
currentAnim = "";
}
}

View file

@ -1,68 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __animated_sprite__
#define __animated_sprite__
#include "Quad.h"
#include "Interpolator.h"
class AnimData
{
public:
AnimData();
std::string name;
int frameStart, frameEnd, datafile;
float time;
int loop;
bool pingPong;
};
class AnimatedSprite : public Quad
{
public:
AnimatedSprite();
Interpolator animator, animationTime;
float frame;
std::string currentAnim, lastAnim;
virtual void animComplete(std::string name) {}
void animate (const std::string &name, int from, int to, float time, int loopType, bool pingPong = false, float initialDelay = 0.0f);
void animate (AnimData &animData);
bool isAnimating()
{
return animator.interpolating;
}
protected:
virtual void onAnimData(AnimData &animData);
virtual void onUpdate (float dt);
};
#endif

View file

@ -47,7 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef BBGE_BUILD_VFS
# include "ttvfs.h"
# ifndef VFS_IGNORE_CASE
# error Must define VFS_IGNORE_CASE, see VFSDefines.h
# error Must define VFS_IGNORE_CASE, see VFSDefines.h
# endif
ttvfs::Root vfs; // extern
#endif
@ -68,6 +68,13 @@ Vector getDirVector(Direction dir)
case DIR_RIGHT:
return Vector(1, 0);
break;
case DIR_UPLEFT:
case DIR_UPRIGHT:
case DIR_DOWNLEFT:
case DIR_DOWNRIGHT:
case DIR_MAX:
case DIR_NONE:
break;
}
return Vector(0,0);
}
@ -88,6 +95,13 @@ Direction getOppositeDir(Direction dir)
case DIR_RIGHT:
return DIR_LEFT;
break;
case DIR_UPLEFT:
case DIR_UPRIGHT:
case DIR_DOWNLEFT:
case DIR_DOWNRIGHT:
case DIR_MAX:
case DIR_NONE:
break;
}
return DIR_NONE;
@ -109,6 +123,13 @@ Direction getNextDirClockwise(Direction dir)
case DIR_RIGHT:
return DIR_DOWN;
break;
case DIR_UPLEFT:
case DIR_UPRIGHT:
case DIR_DOWNLEFT:
case DIR_DOWNRIGHT:
case DIR_MAX:
case DIR_NONE:
break;
}
return DIR_NONE;
}
@ -153,15 +174,14 @@ std::string removeSpaces(const std::string &input)
unsigned hash(const std::string &string)
{
unsigned hash = 5381;
unsigned hash = 5381;
for (int i = 0; i < string.size(); i++)
hash = ((hash << 5) + hash) + (unsigned char)string[i];
for (int i = 0; i < string.size(); i++)
hash = ((hash << 5) + hash) + (unsigned char)string[i];
return hash;
return hash;
}
/* hash * 33 + c */
static unsigned char lowerToUpperTable[256];
@ -198,11 +218,6 @@ struct TransatableStaticInit
static TransatableStaticInit _transtable_static_init;
static unsigned char charIsUpper(unsigned char c)
{
return c == upperToLowerTable[c];
}
static unsigned char charIsLower(unsigned char c)
{
return c == lowerToUpperTable[c];
}
@ -284,8 +299,8 @@ void stringToLowerUserData(std::string &s)
const std::string userdata = core->getUserDataFolder();
const size_t len = userdata.length();
const bool match = (s.length() > len) &&
((s[len] == '/') || (s[len] == '\\')) &&
!strncmp(userdata.c_str(), s.c_str(), len);
((s[len] == '/') || (s[len] == '\\')) &&
!strncmp(userdata.c_str(), s.c_str(), len);
if (!match)
stringToLower(s);
else
@ -305,18 +320,18 @@ int nocasecmp(const std::string &s1, const std::string &s2)
//stop when either string's end has been reached
while ( *it1 && *it2 )
{
if(charToUpper(*it1) != charToUpper(*it2)) //letters differ?
// return -1 to indicate smaller than, 1 otherwise
return (charToUpper(*it1) < charToUpper(*it2)) ? -1 : 1;
//proceed to the next character in each string
++it1;
++it2;
if(charToUpper(*it1) != charToUpper(*it2)) //letters differ?
// return -1 to indicate smaller than, 1 otherwise
return (charToUpper(*it1) < charToUpper(*it2)) ? -1 : 1;
//proceed to the next character in each string
++it1;
++it2;
}
size_t size1=s1.size(), size2=s2.size();// cache lengths
//return -1,0 or 1 according to strings' lengths
if (size1==size2)
return 0;
return (size1<size2) ? -1 : 1;
if (size1==size2)
return 0;
return (size1<size2) ? -1 : 1;
}
#endif // #if !HAVE_STRCASECMP
@ -352,8 +367,7 @@ bool exists(const std::string &f, bool makeFatal, bool skipVFS)
void drawCircle(float radius, int stepSize)
{
#ifdef BBGE_BUILD_OPENGL
//glDisable(GL_CULL_FACE);
glBegin(GL_POLYGON);
{
@ -364,8 +378,7 @@ void drawCircle(float radius, int stepSize)
}
glEnd();
//glEnable(GL_CULL_FACE);
#endif
}
void exit_error(const std::string &message)
@ -386,9 +399,7 @@ std::string parseCommand(const std::string &line, const std::string &command)
void glColor3_256(int r, int g, int b)
{
#ifdef BBGE_BUILD_OPENGL
glColor4f(float(r)/256.0f, float(g)/256.0f, float(b)/256.0f, 1.0f);
#endif
}
bool chance(int perc)
@ -405,68 +416,7 @@ bool chancef(float p)
return ((rand()%100) <= p*100);
}
/*
PHYSFS_file *openRead(const std::string &f)
{
PHYSFS_file *file = PHYSFS_openRead(f.c_str());
if (!file)
{
errorLog ("Could not open [" + f + "]");
exit(0);
}
return file;
}
void pfread(void *buffer, PHYSFS_uint32 size, PHYSFS_uint32 objs, PHYSFS_file *handle)
{
PHYSFS_read(handle, buffer, size, objs);
}
void pfseek(PHYSFS_file *handle,PHYSFS_uint64 byte,int origin)
{
if (origin == SEEK_CUR)
{
byte += PHYSFS_tell(handle);
}
PHYSFS_seek(handle,byte);
}
void pfclose(PHYSFS_file *handle)
{
PHYSFS_close(handle);
}
std::string pLoadStream(const std::string &filename)
{
PHYSFS_file *f = openRead(filename.c_str());
int len = PHYSFS_fileLength(f);
std::string s;
for (int i = 0; i < len; i++)
{
char p;
PHYSFS_read(f, &p, sizeof(char), 1);
s += p;
}
//std::istringstream is(s);
PHYSFS_close(f);
return s;
}
void pSaveStream(const std::string &filename, std::ostringstream &os)
{
PHYSFS_file *f = PHYSFS_openWrite(filename.c_str());
//int size = os.str().size();
//PHYSFS_write(f, (void*)size, sizeof(int), 1);
PHYSFS_write(f, (void*)os.str().c_str(), sizeof(char)*os.str().size(), 1);
PHYSFS_close(f);
}
*/
void errorLog(const std::string &s)
{
@ -562,29 +512,7 @@ tinyxml2::XMLDocument *readXML(const std::string& fn, tinyxml2::XMLError *perr /
return doc;
}
/*
void pForEachFile(std::string path, std::string type, void callback(const std::string &filename, int param), int param)
{
char **rc = PHYSFS_enumerateFiles(path.c_str());
char **i;
for (i = rc; *i != NULL; i++)
{
std::string s(*i);
int p=0;
if ((p=s.find('.'))!=std::string::npos)
{
std::string ext = s.susbtr(p, s.getLength2D());
if (ext == type)
{
callback(fielnameafhghaha
}
}
}
PHYSFS_freeList(rc);
}
*/
void doSingleFile(const std::string &path, const std::string &type, std::string filename, void callback(const std::string &filename, int param), int param)
{
@ -593,9 +521,9 @@ void doSingleFile(const std::string &path, const std::string &type, std::string
std::string search = filename;
stringToLower(search);
std::string filetype = filename.substr(search.size()-4, search.size());
//stringToUpper(filetype);
//debugLog("comparing: " + filetype + " and: " + type);
//if (filetype==type)
debugLog("checking:" + search + " for type:" + type);
if (search.find(type)!=std::string::npos)
{
@ -626,22 +554,22 @@ std::string stripEndlineForUnix(const std::string &in)
struct vfscallback_s
{
std::string *path;
const char *ext;
intptr_t param;
void (*callback)(const std::string &filename, intptr_t param);
std::string *path;
const char *ext;
intptr_t param;
void (*callback)(const std::string &filename, intptr_t param);
};
void forEachFile_vfscallback(VFILE *vf, void *user)
{
vfscallback_s *d = (vfscallback_s*)user;
if(d->ext)
{
const char *e = strrchr(vf->name(), '.');
if(e && nocasecmp(d->ext, e))
return;
}
d->callback(*(d->path) + vf->name(), d->param);
vfscallback_s *d = (vfscallback_s*)user;
if(d->ext)
{
const char *e = strrchr(vf->name(), '.');
if(e && nocasecmp(d->ext, e))
return;
}
d->callback(*(d->path) + vf->name(), d->param);
}
#endif
@ -677,45 +605,45 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
dir = opendir(path.c_str());
if (dir)
{
dirent *file=0;
dirent *file=0;
while ( (file=readdir(dir)) != NULL )
{
if (file->d_name && strlen(file->d_name) > 4)
{
debugLog(file->d_name);
char *extension=strrchr(file->d_name,'.');
if (extension)
{
debugLog(extension);
if (extension!=NULL)
{
if (strcasecmp(extension,type.c_str())==0)
{
callback(path + std::string(file->d_name), param);
}
}
}
}
if (strlen(file->d_name) > 4)
{
debugLog(file->d_name);
char *extension=strrchr(file->d_name,'.');
if (extension)
{
debugLog(extension);
if (extension!=NULL)
{
if (strcasecmp(extension,type.c_str())==0)
{
callback(path + std::string(file->d_name), param);
}
}
}
}
}
closedir(dir);
}
else
{
debugLog("FAILED TO OPEN DIR");
debugLog("FAILED TO OPEN DIR");
}
#endif
#ifdef BBGE_BUILD_WINDOWS
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH+1];
WIN32_FIND_DATA FileData;
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH+1];
WIN32_FIND_DATA FileData;
int end = path.size()-1;
if (path[end] != '/')
path[end] += '/';
// Get the proper directory path
// Get the proper directory path
// \\ %s\\*
@ -726,36 +654,34 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
}
//std::string add = "%s*" + type;
//sprintf(szDir, "%s*", path.c_str());
sprintf(szDir, "%s\\*", path.c_str());
stringToUpper(type);
// Get the first file
hList = FindFirstFile(szDir, &FileData);
if (hList == INVALID_HANDLE_VALUE)
{
//printf("No files found\n\n");
// Get the first file
hList = FindFirstFile(szDir, &FileData);
if (hList == INVALID_HANDLE_VALUE)
{
debugLog("No files of type " + type + " found in path " + path);
}
else
{
// Traverse through the directory structure
fFinished = FALSE;
while (!fFinished)
{
// Check the object is a directory or not
//printf("%*s%s\n", indent, "", FileData.cFileName);
}
else
{
// Traverse through the directory structure
fFinished = FALSE;
while (!fFinished)
{
// Check the object is a directory or not
//printf("%*s%s\n", indent, "", FileData.cFileName);
std::string filename = FileData.cFileName;
//debugLog("found: " + filename);
if (filename.size()>4)
{
std::string filetype = filename.substr(filename.size()-4, filename.size());
stringToUpper(filetype);
//debugLog("comparing: " + filetype + " and: " + type);
if (filetype==type)
{
callback(path+filename, param);
@ -763,20 +689,15 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
}
if (!FindNextFile(hList, &FileData))
{
/*
if (GetLastError() == ERROR_NO_MORE_FILES)
{
fFinished = TRUE;
}
*/
fFinished = TRUE;
}
}
}
if (!FindNextFile(hList, &FileData))
{
FindClose(hList);
fFinished = TRUE;
}
}
}
FindClose(hList);
#endif
}
@ -785,51 +706,46 @@ std::vector<std::string> getFileList(std::string path, std::string type, int par
std::vector<std::string> list;
#ifdef BBGE_BUILD_WINDOWS
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH+1];
WIN32_FIND_DATA FileData;
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH+1];
WIN32_FIND_DATA FileData;
// Get the proper directory path
sprintf(szDir, "%s\\*", path.c_str());
// Get the proper directory path
sprintf(szDir, "%s\\*", path.c_str());
// Get the first file
hList = FindFirstFile(szDir, &FileData);
if (hList == INVALID_HANDLE_VALUE)
{
printf("No files found\n\n");
}
else
{
// Traverse through the directory structure
fFinished = FALSE;
while (!fFinished)
{
// Check the object is a directory or not
//printf("%*s%s\n", indent, "", FileData.cFileName);
// Get the first file
hList = FindFirstFile(szDir, &FileData);
if (hList == INVALID_HANDLE_VALUE)
{
printf("No files found\n\n");
}
else
{
// Traverse through the directory structure
fFinished = FALSE;
while (!fFinished)
{
// Check the object is a directory or not
//printf("%*s%s\n", indent, "", FileData.cFileName);
std::string filename = FileData.cFileName;
if (filename.size()>4 && filename.substr(filename.size()-4, filename.size())==type)
{
//callback(path+filename, param);
list.push_back (filename);
}
if (!FindNextFile(hList, &FileData))
{
/*
if (GetLastError() == ERROR_NO_MORE_FILES)
{
fFinished = TRUE;
}
*/
fFinished = TRUE;
}
}
}
if (!FindNextFile(hList, &FileData))
{
FindClose(hList);
fFinished = TRUE;
}
}
}
FindClose(hList);
#endif
return list;
@ -842,7 +758,7 @@ void cocoaMessageBox(const std::string &title, const std::string &msg);
void messageBox(const std::string& title, const std::string &msg)
{
#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)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, title.c_str(),
msg.c_str(), NULL);
@ -884,39 +800,28 @@ Vector getNearestPointOnLine(Vector a, Vector b, Vector c)
return nearest;
}
/*
bool isTouchingLine(Vector lineStart, Vector lineEnd, Vector point, int radius)
{
Vector p = getNearestPointOnLine(lineStart, lineEnd, point);
Vector diff = p - point;
std::ostringstream os;
os << "s(" << lineStart.x << ", " << lineStart.y << ") e(";
os << lineEnd.x << ", " << lineEnd.y << ") - p(" << point.x << ", " << point.y << ")";
debugLog(os.str());
return (diff.getSquaredLength2D() < sqr(radius));
}
*/
bool isTouchingLine(Vector lineStart, Vector lineEnd, Vector point, int radius, Vector *closestP)
{
Vector dir = lineEnd - lineStart;
Vector diff = point - lineStart;
Vector closest;
if (!dir.isZero()) {
Vector dir = lineEnd - lineStart;
Vector diff = point - lineStart;
Vector closest;
if (!dir.isZero()) {
float t = diff.dot2D(dir) / dir.dot2D(dir);
if (t < 0.0f)
t = 0.0f;
t = 0.0f;
if (t > 1.0f)
t = 1.0f;
t = 1.0f;
closest = lineStart + t * dir;
} else {
} else {
closest = lineStart;
}
Vector d = point - closest;
float distsqr = d.dot2D(d);
}
Vector d = point - closest;
float distsqr = d.dot2D(d);
if (closestP)
(*closestP) = closest;
return distsqr <= radius*radius;
return distsqr <= radius*radius;
}
@ -931,14 +836,12 @@ GLuint generateEmptyTexture(int quality) // Create An Empty Texture
memset(data, 0, size); // Clear Storage Memory
#ifdef BBGE_BUILD_OPENGL
glGenTextures(1, &txtnumber); // Create 1 Texture
glBindTexture(GL_TEXTURE_2D, txtnumber); // Bind The Texture
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, quality, quality, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data); // Build Texture Using Information In data
#endif
delete [] data; // Release data
@ -997,56 +900,56 @@ int packFile(const std::string &sourcef, const std::string &destf, int level)
if (!source || !dest)
return 0;
int ret, flush;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];
unsigned char out[CHUNK];
int ret, flush;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];
unsigned char out[CHUNK];
/* allocate deflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
ret = deflateInit(&strm, level);
if (ret != Z_OK)
return ret;
/* allocate deflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
ret = deflateInit(&strm, level);
if (ret != Z_OK)
return ret;
/* compress until end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
strm.next_in = in;
/* compress until end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
strm.next_in = in;
/* run deflate() on input until output buffer not full, finish
compression if all of source has been read in */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = deflate(&strm, flush); /* no bad return value */
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
assert(strm.avail_in == 0); /* all input will be used */
/* run deflate() on input until output buffer not full, finish
compression if all of source has been read in */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = deflate(&strm, flush); /* no bad return value */
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
assert(strm.avail_in == 0); /* all input will be used */
/* done when last data in file processed */
} while (flush != Z_FINISH);
assert(ret == Z_STREAM_END); /* stream will be complete */
/* done when last data in file processed */
} while (flush != Z_FINISH);
assert(ret == Z_STREAM_END); /* stream will be complete */
/* clean up and return */
(void)deflateEnd(&strm);
/* clean up and return */
(void)deflateEnd(&strm);
fclose(source);
fclose(dest);
return Z_OK;
return Z_OK;
}
/* Decompress from file source to file dest until stream ends or EOF.
@ -1063,64 +966,64 @@ int unpackFile(const std::string &sourcef, const std::string &destf)
if (!source || !dest)
return 0;
int ret;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];
unsigned char out[CHUNK];
int ret;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];
unsigned char out[CHUNK];
/* allocate inflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
ret = inflateInit(&strm);
if (ret != Z_OK)
return ret;
/* allocate inflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
ret = inflateInit(&strm);
if (ret != Z_OK)
return ret;
/* decompress until deflate stream ends or end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
if (strm.avail_in == 0)
break;
strm.next_in = in;
/* decompress until deflate stream ends or end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
if (strm.avail_in == 0)
break;
strm.next_in = in;
/* run inflate() on input until output buffer not full */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = inflate(&strm, Z_NO_FLUSH);
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR; /* and fall through */
case Z_DATA_ERROR:
case Z_MEM_ERROR:
(void)inflateEnd(&strm);
return ret;
}
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
/* run inflate() on input until output buffer not full */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = inflate(&strm, Z_NO_FLUSH);
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR; /* and fall through */
case Z_DATA_ERROR:
case Z_MEM_ERROR:
(void)inflateEnd(&strm);
return ret;
}
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
/* done when inflate() says it's done */
} while (ret != Z_STREAM_END);
/* done when inflate() says it's done */
} while (ret != Z_STREAM_END);
/* clean up and return */
(void)inflateEnd(&strm);
/* clean up and return */
(void)inflateEnd(&strm);
fclose(source);
fclose(dest);
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
}
#endif

View file

@ -29,77 +29,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef min
#undef max
#ifdef _MSC_VER
#define strtof (float)strtod
#define snprintf _snprintf
#endif
#ifdef _MSC_VER
#define strtof (float)strtod
#define snprintf _snprintf
#endif
#endif
#include "BBGECompileConfig.h"
#ifdef BBGE_BUILD_WINDOWS
//#include "iprof/prof.h"
//#define BBGE_PROF(x) Prof(x)
#define BBGE_PROF(x)
/*
//#ifdef BBGE_BUILD_DIRECTX
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
//#endif
*/
#else
#define BBGE_PROF(x)
#endif
#ifdef BBGE_BUILD_GLFW
#include <glfw.h>
#include "glext.h"
//#include "glext.h"
#elif BBGE_BUILD_DIRECTX
#if defined(BBGE_BUILD_X360) && !defined(BBGE_BUILD_WINDOWS)
#include <xtl.h>
#include <ppcintrinsics.h>
#endif // _XBOX
#if defined(BBGE_BUILD_X360) && defined(BBGE_BUILD_WINDOWS)
// Using the win32\ path prefix on the D3D include files makes sure that the Xbox 360
// version of D3D is used, not the DirectX SDK version.
#include <win32\vs2005\d3d9.h>
#include <win32\vs2005\d3dx9.h>
#pragma warning(disable:4100)
#include "XTLOnPC.h"
#endif // _PC
#if defined(BBGE_BUILD_X360)
#include <xgraphics.h>
#include <xboxmath.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#endif
#endif
#ifdef BBGE_BUILD_SDL
#include "SDL.h"
#endif
#if defined(BBGE_BUILD_OPENGL)
#define GL_GLEXT_LEGACY 1
#include "gl.h"
#include "glext.h"
#endif
#define compile_assert(pred) switch(0){case 0:case (pred):;}
@ -136,7 +94,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <queue>
#include <map>
#include <stack>
//#include <typeinfo.h>
#include "Rect.h"
@ -233,23 +191,9 @@ Direction getOppositeDir(Direction dir);
Direction getNextDirClockwise(Direction dir);
Vector colorRGB(int r, int g, int b);
#ifdef BBGE_BUILD_DIRECTX
typedef unsigned int GLuint;
#endif
GLuint generateEmptyTexture(int res);
//void pForEachFile(std::string path, std::string type, void callback(const std::string &filename, int param), int param);
/*
void pfread(void *buffer, PHYSFS_uint32 size, PHYSFS_uint32 objs, PHYSFS_file *handle);
void pfseek(PHYSFS_file *handle,PHYSFS_uint64 byte,int origin);
void pfclose(PHYSFS_file *handle);
PHYSFS_file *openRead(const std::string &f);
std::string pLoadStream(const std::string &filename);
void pSaveStream(const std::string &filename, std::ostringstream &os);
*/
void drawCircle(float radius, int steps=1);
bool isVectorInRect(const Vector &vec, const Vector &coord1, const Vector &coord2);
@ -287,8 +231,7 @@ enum LerpType
float lerp(const float &v1, const float &v2, float dt, int lerpType);
//int packFile(const std::string &sourcef, const std::string &destf, int level);
//int unpackFile(const std::string &sourcef, const std::string &destf);
void openURL(const std::string &url);

View file

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "BitmapFont.h"
#include "Core.h"
//#include "DSQ.h"
using namespace glfont;
@ -56,14 +56,12 @@ void BmpFont::load(const std::string &file, float scale, bool loadTexture)
this->scale = scale;
#ifdef BBGE_BUILD_OPENGL
GLuint id=0;
glGenTextures(1, &id);
if (!font.Create(file.c_str(), id, loadTexture))
return;
#endif
loaded = true;
}
@ -81,13 +79,13 @@ BitmapText::BitmapText(BmpFont *bmpFont)
align = ALIGN_CENTER;
textWidth = 600;
this->fontDrawSize = 24;
//color = Vector(0.5,0.5,1);
cull = false;
//setTexture(font);
alignWidth = 0;
//fontTextureTest = core->addTexture("font");
}
void BitmapText::autoKern()
@ -164,8 +162,8 @@ void BitmapText::formatText()
alignWidth = 0;
maxW = 0;
for (int i = 0; i < text.size(); i++)
{
//currentWidth += spacingMap[text[i]]*fontDrawSize;
{
float sz = bmpFont->font.GetCharWidth(text[i])*bmpFont->scale;
currentWidth += sz;
@ -218,24 +216,7 @@ void BitmapText::updateWordColoring()
}
}
/*
for (int i = 0; i < lines.size(); i++)
{
int c = 0;
for (int t = 0; t < dsq->continuity.wordColoring.size(); t++)
{
WordColoring *w = &dsq->continuity.wordColoring[t];
if ((c = lines[i].find(w->word)) != std::string::npos)
{
for (int j = c; j < c + w->word.size(); j++)
{
colorIndices[i][j] = w->color;
}
}
}
}
*/
//lines.push_back(text);
}
@ -316,15 +297,9 @@ void BitmapText::onRender()
float top_color[3] = {bmpFont->fontTopColor.x*color.x, bmpFont->fontTopColor.y*color.y, bmpFont->fontTopColor.z*color.z};
float bottom_color[3] = {bmpFont->fontBtmColor.x*color.x, bmpFont->fontBtmColor.y*color.y, bmpFont->fontBtmColor.z*color.z};
#ifdef BBGE_BUILD_OPENGL
glEnable(GL_TEXTURE_2D);
/*
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
*/
//glDisable(GL_CULL_FACE);
//glScalef(1, -1, 0);
bmpFont->font.Begin();
@ -353,11 +328,7 @@ void BitmapText::onRender()
x = -sz.first*0.5f*bmpFont->scale;
}
float la = 1.0f-(scrollDelay/scrollSpeed);
/*
std::ostringstream os;
os << "la: " << la;
debugLog(os.str());
*/
bmpFont->font.DrawString(theLine, bmpFont->scale, x, y, top_color, bottom_color, alpha.x, la);
y += adj;
@ -378,11 +349,10 @@ void BitmapText::onRender()
y += adj;
}
}
//glEnable(GL_CULL_FACE);
glBindTexture(GL_TEXTURE_2D, 0);
#endif
}
void BitmapText::unloadDevice()
@ -454,33 +424,4 @@ float BitmapText::getStringWidth(const std::string& text)
return maxsize * bmpFont->scale;
}
/*
BitmapText::BitmapText() : RenderObject()
{
cull = false;
followCamera = 1;
scrollSpeed = 0.1f;
}
void BitmapText::scrollText(const std::string &text, float scrollSpeed)
{
setText(text);
this->scrollSpeed = scrollSpeed;
}
void BitmapText::setText(const std::string &text)
{
this->text = text;
}
std::string BitmapText::getText()
{
return text;
}
void BitmapText::onRender()
{
CTextDrawer::GetSingleton().SetColor(color.x, color.y, color.z, alpha.getValue());
dsq->print(position.x, 600 - (position.y + 16*2), text);
}
*/

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef BITMAPFONT_H
#define BITMAPFONT_H
//#include "DrawText.h"
#include "RenderObject.h"
#include "BaseText.h"

View file

@ -1,139 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "BloomEffect.h"
#include "Core.h"
BloomEffect::BloomEffect() : RenderObject()
{
active = false;
followCamera = 1;
cull = 0;
stretch = 0;
startLayer = endLayer = -1;
texID = 0;
format = GL_LUMINANCE;
useFrameBuffer = true;
}
void BloomEffect::init(int quality, int startLayer, int endLayer)
{
this->startLayer = startLayer;
this->endLayer = endLayer;
this->quality = quality;
if (useFrameBuffer)
{
if (frameBuffer.init(quality, quality))
active = true;
else
{
active = false;
useFrameBuffer = false;
}
}
else
{
texID = generateEmptyTexture(quality);
}
}
void BloomEffect::unloadDevice()
{
if (frameBuffer.isInited())
frameBuffer.unloadDevice();
}
void BloomEffect::reloadDevice()
{
if (frameBuffer.isInited())
frameBuffer.reloadDevice();
}
void BloomEffect::render()
{
if (active && frameBuffer.isInited())
{
// get
glViewport(0,0,quality,quality);
frameBuffer.startCapture();
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
core->render(startLayer, endLayer, false);
if (useFrameBuffer)
{
frameBuffer.endCapture();
}
else
{
glBindTexture(GL_TEXTURE_2D,texID);
glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, quality, quality, 0);
}
core->setClearColor(core->getClearColor());
glViewport(0, 0, core->width, core->height);
// render
glEnable(GL_TEXTURE_2D);
if (useFrameBuffer)
frameBuffer.bindTexture();
else
glBindTexture(GL_TEXTURE_2D,texID);
glPushMatrix();
glLoadIdentity();
//glScalef(scale.x, scale.y, 0);
float spost = 0.0;
int x=0,y=0;
x = -core->getVirtualOffX()*2;
y = -core->getVirtualOffY()*2;
applyBlendType();
glColor4f(color.x, color.y, color.z, alpha.x*alphaMod);
glBegin(GL_QUADS); // Begin Drawing Quads
glTexCoord2f(0,1); // Texture Coordinate ( 0, 1 )
glVertex2f(x-stretch,y-stretch); // First Vertex ( 0, 0 )
glTexCoord2f(0,0); // Texture Coordinate ( 0, 0 )
glVertex2f(x-stretch,core->height+stretch); // Second Vertex ( 0, 480 )
glTexCoord2f(1,0); // Texture Coordinate ( 1, 0 )
glVertex2f(core->width+stretch,core->height+stretch); // Third Vertex ( 640, 480 )
glTexCoord2f(1,1); // Texture Coordinate ( 1, 1 )
glVertex2f(core->width+stretch,y-stretch); // Fourth Vertex ( 640, 0 )
glEnd();
glPopMatrix();
glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0;
}
}

View file

@ -1,48 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef BLOOMEFFECT_H
#define BLOOMEFFECT_H
#include "RenderObject.h"
#include "FrameBuffer.h"
class BloomEffect : public RenderObject
{
public:
BloomEffect();
void init(int quality, int startLayer, int endLayer);
FrameBuffer frameBuffer;
void unloadDevice();
void reloadDevice();
void render();
GLuint format;
int texID;
protected:
int startLayer, endLayer;
int quality;
bool active;
int stretch; // slightly adjust edges outward
bool useFrameBuffer;
};
#endif

Some files were not shown because too many files have changed in this diff Show more