1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-04 06:54:39 +00:00

Remove commented-out code

This commit is contained in:
Nicolas Braud-Santoni 2016-05-05 19:40:28 +02:00
parent 0f39b825e1
commit eb128e65a4
162 changed files with 2092 additions and 6594 deletions

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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// moved

View file

@ -98,11 +98,7 @@ void KeyframeWidget::shiftRight()
void KeyframeWidget::onUpdate(float dt) void KeyframeWidget::onUpdate(float dt)
{ {
/*
if (this->key == ae->currentKey)
color = Vector(0.75, 0.75, 1);
else
*/
Quad::onUpdate(dt); Quad::onUpdate(dt);
if (life != 1 || ae->editSprite->isAnimating()) return; if (life != 1 || ae->editSprite->isAnimating()) return;
switch(ae->editSprite->getCurrentAnimation()->getKeyframe(this->key)->lerpType) switch(ae->editSprite->getCurrentAnimation()->getKeyframe(this->key)->lerpType)
@ -137,7 +133,7 @@ void KeyframeWidget::onUpdate(float dt)
{ {
if (core->mouse.buttons.left) if (core->mouse.buttons.left)
{ {
//ae->selectionLocked = false;
movingWidget = this; movingWidget = this;
ae->currentKey = this->key; ae->currentKey = this->key;
} }
@ -234,7 +230,7 @@ void AnimationEditor::applyState()
editSprite->cull = false; editSprite->cull = false;
editSprite->loadSkeletal(editingFile); editSprite->loadSkeletal(editingFile);
editSprite->position = Vector(400,300); editSprite->position = Vector(400,300);
//editSprite->scale = Vector(0.5, 0.5);
addAction(MakeFunctionEvent(AnimationEditor, lmbu), ActionMapper::MOUSE_BUTTON_LEFT, 0); addAction(MakeFunctionEvent(AnimationEditor, lmbu), ActionMapper::MOUSE_BUTTON_LEFT, 0);
addAction(MakeFunctionEvent(AnimationEditor, lmbd), ActionMapper::MOUSE_BUTTON_LEFT, 1); addAction(MakeFunctionEvent(AnimationEditor, lmbd), ActionMapper::MOUSE_BUTTON_LEFT, 1);
@ -269,7 +265,7 @@ void AnimationEditor::applyState()
addAction(MakeFunctionEvent(AnimationEditor, undo), KEY_Z, 0); addAction(MakeFunctionEvent(AnimationEditor, undo), KEY_Z, 0);
addAction(MakeFunctionEvent(AnimationEditor, redo), KEY_Y, 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, cycleLerpType), KEY_L, 0);
addAction(MakeFunctionEvent(AnimationEditor, selectPrevBone), KEY_UP, 0); addAction(MakeFunctionEvent(AnimationEditor, selectPrevBone), KEY_UP, 0);
@ -292,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_SWIMLEFT, KEY_J);
addAction(ACTION_SWIMRIGHT, KEY_K); addAction(ACTION_SWIMRIGHT, KEY_K);
addAction(ACTION_SWIMUP, KEY_UP); addAction(ACTION_SWIMUP, KEY_UP);
addAction(ACTION_SWIMDOWN, KEY_DOWN); 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); addRenderObject(editSprite, LR_ENTITIES);
@ -668,35 +644,9 @@ void AnimationEditor::moveBoneStripPoint(const Vector &mov)
b->strip[selectedStripPoint] = sel->changeStrip[selectedStripPoint] += mov*0.006f; b->strip[selectedStripPoint] = sel->changeStrip[selectedStripPoint] += mov*0.006f;
sel->setGridPoints(sel->stripVert, sel->strip); 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);
} }
} }
} }
@ -708,7 +658,7 @@ void AnimationEditor::selectPrevBone()
if (editingStrip) if (editingStrip)
{ {
//moveBoneStripPoint(Vector(0, 1));
} }
else else
{ {
@ -722,7 +672,7 @@ void AnimationEditor::selectNextBone()
if (editingStrip) if (editingStrip)
{ {
//moveBoneStripPoint(Vector(0, -1));
} }
else else
{ {
@ -765,7 +715,7 @@ void AnimationEditor::update(float dt)
if (core->mouse.buttons.middle) if (core->mouse.buttons.middle)
{ {
editSprite->position += core->mouse.change; editSprite->position += core->mouse.change;
//core->setMousePosition(Vector(400,300));
} }
if (editingStrip) if (editingStrip)
@ -809,29 +759,7 @@ void AnimationEditor::update(float dt)
updateEditingBone(); updateEditingBone();
if (editingBone) 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) if (editingBone && boneEdit == 1)
@ -1051,8 +979,8 @@ void AnimationEditor::lmbd()
{ {
pushUndo(); pushUndo();
updateEditingBone(); updateEditingBone();
if (editingBone /*&& (editSprite->position - core->mouse.position).isLength2DIn(400)*/ if (editingBone
/*&& core->mouse.position.x > 200 && core->mouse.position.y < 560*/
&& core->mouse.position.x > 400-200 && core->mouse.position.x < 400+200 && core->mouse.position.x > 400-200 && core->mouse.position.x < 400+200
&& core->mouse.position.y > 300-200 && core->mouse.position.y < 300+200 && core->mouse.position.y > 300-200 && core->mouse.position.y < 300+200
) )
@ -1146,7 +1074,7 @@ void AnimationEditor::rmbd()
updateEditingBone(); updateEditingBone();
if (editingBone) if (editingBone)
{ {
//cursorOffset = editingBone->position + editSprite->position - core->mouse.position;
cursorOffset = core->mouse.position; cursorOffset = core->mouse.position;
rotOffset = editingBone->rotation.z; rotOffset = editingBone->rotation.z;
boneEdit = 2; boneEdit = 2;
@ -1305,8 +1233,8 @@ void AnimationEditor::rmbu()
void AnimationEditor::mmbd() void AnimationEditor::mmbd()
{ {
//editingBone = editSprite->getSelectedBone(ignoreBone);
//cloneBoneAhead();
} }
void AnimationEditor::cloneBoneAhead() void AnimationEditor::cloneBoneAhead()
@ -1427,8 +1355,8 @@ void AnimationEditor::loadSkin()
std::string file = dsq->getUserInputString("Enter skin file to load:"); std::string file = dsq->getUserInputString("Enter skin file to load:");
if (file.empty()) return; if (file.empty()) return;
//this->editingFile = file;
//loadFile();
SkeletalSprite::clearCache(); SkeletalSprite::clearCache();
editSprite->loadSkin(file); editSprite->loadSkin(file);
} }

View file

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

View file

@ -5,7 +5,7 @@
// Define BBGE_SKIP_CONFIG_HEADERS to use CMake-only configuration. // Define BBGE_SKIP_CONFIG_HEADERS to use CMake-only configuration.
#ifndef BBGE_SKIP_CONFIG_HEADERS #ifndef BBGE_SKIP_CONFIG_HEADERS
//#define AQUARIA_DEMO 1
#define AQUARIA_BUILD_CONSOLE 1 #define AQUARIA_BUILD_CONSOLE 1
#define AQUARIA_BUILD_SCENEEDITOR 1 #define AQUARIA_BUILD_SCENEEDITOR 1

View file

@ -100,17 +100,11 @@ void AquariaGuiElement::setFocus(bool v)
void AquariaGuiElement::updateMovement(float dt) void AquariaGuiElement::updateMovement(float dt)
{ {
//debugLog("in update movement");
if (hasFocus && isGuiVisible() && canDirMove && canDirMoveGlobal && hasInput()) if (hasFocus && isGuiVisible() && canDirMove && canDirMoveGlobal && hasInput())
{ {
//debugLog("has focus");
/*
if (alpha.x <= 0 || alphaMod <= 0)
{
setFocus(false);
return;
}
*/
if (guiMoveTimer > 0) if (guiMoveTimer > 0)
{ {
@ -162,7 +156,6 @@ void AquariaGuiElement::updateMovement(float dt)
if (gui) if (gui)
{ {
gui->setFocus(true); gui->setFocus(true);
//this->setFocus(false);
@ -461,21 +454,12 @@ AquariaKeyConfig::AquariaKeyConfig(const std::string &actionInputName, InputSetT
bg->alphaMod = 0; bg->alphaMod = 0;
addChild(bg, PM_POINTER); 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 = new TTFText(&dsq->fontArialSmallest);
keyConfigFont->setAlign(ALIGN_CENTER); keyConfigFont->setAlign(ALIGN_CENTER);
//keyConfigFont->position = Vector(0, -10);
addChild(keyConfigFont, PM_POINTER); addChild(keyConfigFont, PM_POINTER);
@ -523,16 +507,7 @@ void AquariaKeyConfig::toggleEnterKey(int on)
bg->alphaMod = 0.5; bg->alphaMod = 0.5;
bg->color = Vector(0.5, 0.5, 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) void AquariaKeyConfig::setLock(int lock)
@ -548,8 +523,6 @@ void AquariaKeyConfig::onUpdate(float dt)
AquariaGuiElement::updateMovement(dt); AquariaGuiElement::updateMovement(dt);
RenderObject::onUpdate(dt); RenderObject::onUpdate(dt);
@ -640,15 +613,8 @@ void AquariaKeyConfig::onUpdate(float dt)
{ {
if (i != KEY_ESCAPE) 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) if (i >= KEY_0 && i <= KEY_9)
{ {
*value = i-KEY_0; *value = i-KEY_0;
@ -745,11 +711,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; 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; keyDown = false;
@ -805,18 +771,15 @@ AquariaMenuItem::AquariaMenuItem() : Quad(), ActionMapper(), AquariaGuiElement()
glowFont->position = Vector(0, -sz/2, 0); glowFont->position = Vector(0, -sz/2, 0);
glowFont->setBlendType(BLEND_ADD); glowFont->setBlendType(BLEND_ADD);
glowFont->alpha = 0; glowFont->alpha = 0;
//glowFont->scale.interpolateTo(Vector(1.1,1.1), 0.5, -1, 1, 1);
addChild(glowFont, PM_POINTER, RBP_OFF); addChild(glowFont, PM_POINTER, RBP_OFF);
//setTexture("bubble");
//this->shareAlphaWithChildren = true;
width = 0; width = 0;
height = 0; height = 0;
highlighted = false; highlighted = false;
/*
width = 256;
height = 64;
*/
cull = false; cull = false;
followCamera = 1; followCamera = 1;
addAction(MakeFunctionEvent(AquariaMenuItem, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0); addAction(MakeFunctionEvent(AquariaMenuItem, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0);
@ -888,9 +851,8 @@ void AquariaMenuItem::onClick()
event.call(); event.call();
//glowFont->scale.interpolateTo(Vector(4,4), 0.5, 1, 1);
//glowFont->alpha.interpolateTo(0, 0.5);
//scale.interpolateTo(Vector(4, 4), 3);
} }
} }
@ -913,7 +875,7 @@ void AquariaMenuItem::toggleHighlight(bool state)
{ {
glowFont->alpha.interpolateTo(0.3, 0.2); glowFont->alpha.interpolateTo(0.3, 0.2);
} }
//scale.interpolateTo(Vector(1.1, 1.1), 0.2);
} }
else else
{ {
@ -922,7 +884,7 @@ void AquariaMenuItem::toggleHighlight(bool state)
else else
glowFont->alpha.interpolateTo(0, 0.2); glowFont->alpha.interpolateTo(0, 0.2);
} }
//scale.interpolateTo(Vector(1,1), 0.2);
} }
void AquariaMenuItem::onUpdate(float dt) void AquariaMenuItem::onUpdate(float dt)
@ -951,10 +913,7 @@ void AquariaMenuItem::onUpdate(float dt)
quad->alpha.x = alpha.x; quad->alpha.x = alpha.x;
} }
/*
font->position = this->position;
font->alpha = this->alpha;
*/
if (hasInput()) if (hasInput())
{ {
if (alpha.x == 1) if (alpha.x == 1)

View file

@ -184,8 +184,8 @@ protected:
InputSetType inputSetType; InputSetType inputSetType;
int inputIdx; int inputIdx;
//BitmapText *label;
//DebugFont *keyConfigFont;
TTFText *keyConfigFont; TTFText *keyConfigFont;
Quad *bg; Quad *bg;
}; };
@ -247,18 +247,6 @@ protected:
std::vector<AquariaComboBoxItem*> shownItems; 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 #endif

View file

@ -37,12 +37,8 @@ AquariaSaveSlot::AquariaSaveSlot(int slot) : AquariaGuiQuad()
box->setWidthHeight(450, 96); box->setWidthHeight(450, 96);
box->alphaMod = 0; box->alphaMod = 0;
addChild(box, PM_POINTER); addChild(box, PM_POINTER);
//setTexture("dialogue-bg");
//setTexture("HintBox");
//renderQuad = false;
//shareAlphaWithChildren = 1;
text1 = new BitmapText(&dsq->smallFont); text1 = new BitmapText(&dsq->smallFont);
text1->setFontSize(14); text1->setFontSize(14);
@ -122,7 +118,7 @@ AquariaSaveSlot::AquariaSaveSlot(int slot) : AquariaGuiQuad()
core->resetTimer(); core->resetTimer();
screen->upperLeftTextureCoordinates = Vector(0, 1); screen->upperLeftTextureCoordinates = Vector(0, 1);
screen->lowerRightTextureCoordinates = Vector(1, 0.25); screen->lowerRightTextureCoordinates = Vector(1, 0.25);
//screen->scale = Vector(0.4, 0.3);
if (screen->getWidth() == 0) if (screen->getWidth() == 0)
screen->color = 0; screen->color = 0;
@ -171,7 +167,7 @@ void AquariaSaveSlot::close(bool trans)
setDecayRate(2); setDecayRate(2);
fadeAlphaWithLife = 1; fadeAlphaWithLife = 1;
} }
//shareAlphaWithChildren = 1;
} }
void AquariaSaveSlot::transition() void AquariaSaveSlot::transition()
@ -204,10 +200,10 @@ void AquariaSaveSlot::onUpdate(float dt)
if (core->mouse.position.x < position.x + 150 && core->mouse.position.x > position.x - 300 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) && core->mouse.position.y < position.y+32 && core->mouse.position.y > position.y-32)
{ {
//setBlendType(BLEND_ADD);
glowText->alpha.interpolateTo(0.5, 0.2); glowText->alpha.interpolateTo(0.5, 0.2);
screen->color.interpolateTo(Vector(1,1,1), 0.1); 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) if ((core->mouse.buttons.left || core->mouse.buttons.right) && !mbDown)
{ {
mbDown = true; mbDown = true;
@ -218,22 +214,22 @@ void AquariaSaveSlot::onUpdate(float dt)
if (!(empty && dsq->saveSlotMode == SSM_LOAD)) if (!(empty && dsq->saveSlotMode == SSM_LOAD))
{ {
selected = true; selected = true;
// pick this file
dsq->playMenuSelectSfx(); dsq->playMenuSelectSfx();
closed = true; closed = true;
if (dsq->saveSlotMode == SSM_LOAD) if (dsq->saveSlotMode == SSM_LOAD)
{ {
//dsq->clearSaveSlots();
dsq->hideSaveSlots(); dsq->hideSaveSlots();
this->moveToFront(); this->moveToFront();
//screen->enableMotionBlur(10, 5);
screen->position.interpolateTo(Vector(400-position.x, 300-position.y), 1.0, 0, 0, 1); screen->position.interpolateTo(Vector(400-position.x, 300-position.y), 1.0, 0, 0, 1);
dsq->tfader->alpha.interpolateTo(1, 1); dsq->tfader->alpha.interpolateTo(1, 1);
dsq->toggleCursor(false); dsq->toggleCursor(false);
core->main(1); core->main(1);
//core->main(2);
} }
bool didIt = dsq->onPickedSaveSlot(this); bool didIt = dsq->onPickedSaveSlot(this);
@ -242,9 +238,8 @@ void AquariaSaveSlot::onUpdate(float dt)
{ {
done = true; done = true;
//alpha = 0.9;
//setBlendType(BLEND_DEFAULT);
//glowText->alpha.interpolateTo(0, 0.2);
return; return;
} }
else else
@ -258,7 +253,7 @@ void AquariaSaveSlot::onUpdate(float dt)
else else
{ {
glowText->alpha.interpolateTo(0, 0.2); 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); screen->color.interpolateTo(Vector(0.7, 0.7, 1), 0.3);
} }
if ((core->mouse.buttons.left || core->mouse.buttons.right) && !mbDown) if ((core->mouse.buttons.left || core->mouse.buttons.right) && !mbDown)
@ -416,8 +411,8 @@ std::string AquariaSaveSlot::getSaveDescription(const XMLDocument &doc)
std::ostringstream os; std::ostringstream os;
os << location << std::endl; os << location << std::endl;
os << hours << ":" << numToZeroString(minutes, 2) << showLoc; os << hours << ":" << numToZeroString(minutes, 2) << showLoc;
// << ": " << seconds;
//" T: " << time;
dsq->continuity.seconds = s; 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 AUTOMAP_GRIDTILE 512
//#define FOR(ir,mx) for (int ir=0;ir<mx;ir++)
AutoMap::AutoMap() : RenderObject(), ActionMapper() AutoMap::AutoMap() : RenderObject(), ActionMapper()
{ {
//texture = 0;
followCamera = 1; followCamera = 1;
scale = Vector(0.4, 0.4); scale = Vector(0.4, 0.4);
position = Vector(400,300); position = Vector(400,300);
@ -41,7 +41,7 @@ AutoMap::AutoMap() : RenderObject(), ActionMapper()
initedGrid = false; initedGrid = false;
//shadowTex = core->addTexture("particles/glow");
setTexture("particles/glow"); setTexture("particles/glow");
paintColor = Vector(1,1,1); paintColor = Vector(1,1,1);
@ -52,17 +52,7 @@ AutoMap::AutoMap() : RenderObject(), ActionMapper()
shadowTex = 0; shadowTex = 0;
} }
/*
void AutoMap::create(const std::string &startMap)
{
bool done = false;
while (!done)
{
dsq->game->smallLoadXML("NAIJACAVE");
}
}
*/
void AutoMap::destroy() void AutoMap::destroy()
{ {
@ -93,41 +83,8 @@ void AutoMap::toggle(bool on)
core->overrideEndLayer = LR_MAX; core->overrideEndLayer = LR_MAX;
vis = true; 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; alpha = 1;
dsq->fade(0, t); dsq->fade(0, t);
@ -169,11 +126,8 @@ void AutoMap::setGridFromWorld(Vector worldPos, int gridValue)
void AutoMap::initGrid() 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 x=0;x<MAX_AUTOMAP_GRID;x++)
{ {
for (int y=0;y<MAX_AUTOMAP_GRID;y++) for (int y=0;y<MAX_AUTOMAP_GRID;y++)
@ -216,32 +170,8 @@ void AutoMap::onUpdate(float dt)
{ {
const float maxScale=1.25, minScale=0.5; const float maxScale=1.25, minScale=0.5;
blip.update(dt); 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; float spd = 0.5;
@ -261,7 +191,7 @@ void AutoMap::onUpdate(float dt)
{ {
offset += core->mouse.change*scale; offset += core->mouse.change*scale;
} }
//scale.interpolateTo(sTarget, 0.1);
} }
} }
@ -275,7 +205,7 @@ void AutoMap::lmb()
void AutoMap::onRender() void AutoMap::onRender()
{ {
// if (!doRender) return;
if (alpha.x == 0) return; if (alpha.x == 0) return;
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
@ -284,12 +214,10 @@ void AutoMap::onRender()
//int sz2 = 80;//80;
int ysz = dsq->game->cameraMax.y/TILE_SIZE; int ysz = dsq->game->cameraMax.y/TILE_SIZE;
int xsz = dsq->game->cameraMax.x/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)); TileVector t(Vector(dsq->game->cameraMax.x/2, dsq->game->cameraMax.y/2));
@ -299,14 +227,9 @@ void AutoMap::onRender()
if (alphaValue > 0) 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) for (int y = 0; y < ysz; y += skip)
{ {
float f = float(y)/float(ysz); float f = float(y)/float(ysz);
@ -316,7 +239,7 @@ void AutoMap::onRender()
glBegin(GL_LINES); glBegin(GL_LINES);
int rowStart = -1; int rowStart = -1;
int x = 0; int x = 0;
//for (x = t.x-sz2; x < t.x+sz2; x++)
for (x = 0; x < xsz; x++) for (x = 0; x < xsz; x++)
{ {
if (dsq->game->getGrid(TileVector(x,y))!=OT_BLACK) if (dsq->game->getGrid(TileVector(x,y))!=OT_BLACK)
@ -344,45 +267,8 @@ void AutoMap::onRender()
glEnd(); 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); TileVector nt(dsq->game->avatar->position);

View file

@ -3077,7 +3077,6 @@ void Avatar::doShock(const std::string &shotName)
if (sz == 0) if (sz == 0)
{ {
for (int i = 0; i < thits; i++) for (int i = 0; i < thits; i++)

View file

@ -118,7 +118,7 @@ public:
bool blind; bool blind;
bool wasUnderWater; bool wasUnderWater;
float shotDelay; float shotDelay;
//Timer shockTimer;
Timer useItemDelay; Timer useItemDelay;
Timer lockToWallDelay; Timer lockToWallDelay;
float spellCharge; float spellCharge;
@ -147,7 +147,7 @@ public:
float burstDelay; float burstDelay;
bool bursting; bool bursting;
BurstType lastBurstType; BurstType lastBurstType;
//void damage(int amount);
bool isCharging(); bool isCharging();
void setBlind(float time); void setBlind(float time);
@ -276,7 +276,7 @@ public:
float songInterfaceTimer; float songInterfaceTimer;
void removeEatData(int idx); void removeEatData(int idx);
//std::list<Entity*>bittenEntities;
typedef std::list<Entity*> BittenEntities; typedef std::list<Entity*> BittenEntities;
BittenEntities bittenEntities; BittenEntities bittenEntities;
void updateHeartbeatSfx(float t = 0); void updateHeartbeatSfx(float t = 0);
@ -444,9 +444,9 @@ protected:
bool checkWarpAreas(); bool checkWarpAreas();
float splashDelay; float splashDelay;
//Hair *hair;
//Item *currentItem;
void onUpdate(float dt); void onUpdate(float dt);
void onRender(); void onRender();

View file

@ -31,7 +31,7 @@ Beam::Beam(Vector pos, float angle) : Quad()
addType(SCO_BEAM); addType(SCO_BEAM);
cull = false; cull = false;
trace(); trace();
//rotation.z = angle;
this->angle = angle; this->angle = angle;
position = pos; position = pos;
@ -91,17 +91,13 @@ void Beam::killAllBeams()
void Beam::trace() void Beam::trace()
{ {
float angle = MathFunctions::toRadians(this->angle); float angle = MathFunctions::toRadians(this->angle);
//(float(-this->angle)/180.0f)*PI;
//float angle = rotation.z;
Vector mov(sinf(angle), cosf(angle)); Vector mov(sinf(angle), cosf(angle));
TileVector t(position); TileVector t(position);
Vector startTile(t.x, t.y); 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; int moves = 0;
while (!dsq->game->isObstructed(TileVector(startTile.x, startTile.y))) while (!dsq->game->isObstructed(TileVector(startTile.x, startTile.y)))
@ -114,37 +110,24 @@ void Beam::trace()
t = TileVector(startTile.x, startTile.y); t = TileVector(startTile.x, startTile.y);
endPos = t.worldVector(); endPos = t.worldVector();
/*
offset = endPos - position;
offset /= 2;
offset *= -1;
*/
//width = (endPos - position).getLength2D();
} }
void Beam::render() 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(); Quad::render();
} }
void Beam::onRender() void Beam::onRender()
{ {
//glDisable(GL_CULL_FACE);
Vector diff = endPos - position; Vector diff = endPos - position;
Vector side = diff; Vector side = diff;
//side.normalize2D();
side.setLength2D(beamWidth*2); side.setLength2D(beamWidth*2);
Vector sideLeft = side.getPerpendicularLeft(); Vector sideLeft = side.getPerpendicularLeft();
Vector sideRight = side.getPerpendicularRight(); Vector sideRight = side.getPerpendicularRight();

View file

@ -32,15 +32,7 @@ bool BitBlotLogo::watchQuit(float time)
{ {
core->main(time); core->main(time);
return false; return false;
/*
dsq->watch(time);
if (quitFlag > 0)
{
skipLogo();
return true;
}
return false;
*/
} }
void BitBlotLogo::doShortBitBlot() void BitBlotLogo::doShortBitBlot()
@ -78,7 +70,7 @@ void BitBlotLogo::skipLogo()
void BitBlotLogo::getOut() void BitBlotLogo::getOut()
{ {
//dsq->continuity.reset();
#ifdef AQUARIA_DEMO #ifdef AQUARIA_DEMO
dsq->title(); dsq->title();
@ -97,7 +89,7 @@ void BitBlotLogo::applyState()
logo = 0; logo = 0;
dsq->toggleCursor(0); dsq->toggleCursor(0);
dsq->toggleBlackBars(1); dsq->toggleBlackBars(1);
//dsq->setBlackBarsColor(Vector(1,1,1));
dsq->jiggleCursor(); dsq->jiggleCursor();
dsq->forceInputGrabOff(); dsq->forceInputGrabOff();
@ -143,7 +135,7 @@ void BitBlotLogo::applyState()
bird->update((rand()%100)*0.1f); bird->update((rand()%100)*0.1f);
} }
//if (true)
if (rand()%100 < 40) if (rand()%100 < 40)
{ {
SkeletalSprite *dragon = new SkeletalSprite(); SkeletalSprite *dragon = new SkeletalSprite();
@ -254,12 +246,12 @@ void BitBlotLogo::applyState()
dsq->overlay->alpha.interpolateTo(0, 1); dsq->overlay->alpha.interpolateTo(0, 1);
//sound->playSfx("BBSplash");
sound->playMusic("bblogo", SLT_NONE); sound->playMusic("bblogo", SLT_NONE);
if (watchQuit(1.0)) return; if (watchQuit(1.0)) return;
//sound->playSfx("normalform");
dsq->overlay2->color = Vector(1,1,1); dsq->overlay2->color = Vector(1,1,1);
@ -272,23 +264,20 @@ void BitBlotLogo::applyState()
sound->playSfx("normalform"); sound->playSfx("normalform");
//landscape->alpha.interpolateTo(1, 2);
white->alpha.interpolateTo(0, 2); white->alpha.interpolateTo(0, 2);
landscape->position.interpolateTo(Vector(400,400), 5); 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); landscape->scale.interpolateTo(Vector(1.1, 1.1), 5);
scanline->alpha.interpolateTo(0, 1); scanline->alpha.interpolateTo(0, 1);
//scanline->scale.interpolateTo(Vector(5, 5), 1);
logo->scale.interpolateTo(Vector(2, 2), 1); logo->scale.interpolateTo(Vector(2, 2), 1);
//logo->offset.interpolateTo(Vector(0, -300), 1);
logo->alpha.interpolateTo(0, 1); logo->alpha.interpolateTo(0, 1);
lines->alpha.interpolateTo(0, 4); lines->alpha.interpolateTo(0, 4);
@ -304,32 +293,8 @@ void BitBlotLogo::applyState()
getOut(); 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() void BitBlotLogo::removeState()
@ -342,14 +307,6 @@ void BitBlotLogo::update(float dt)
{ {
StateObject::update(dt); StateObject::update(dt);
/*
if (quitFlag == 0)
{
if (core->getKeyState(KEY_ESCAPE))
{
quitFlag = 1;
}
}
*/
} }

View file

@ -34,26 +34,8 @@ BoxElement::BoxElement(int width, int height) : Element(BOX)
hh = height/2 + 10; hh = height/2 + 10;
this->color = 0; this->color = 0;
cull = true; 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

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "CollideEntity.h" #include "CollideEntity.h"
#include "DSQ.h" #include "DSQ.h"
#include "Game.h" #include "Game.h"
//#include "ParticleEffects.h"
CollideEntity::CollideEntity() : Entity() CollideEntity::CollideEntity() : Entity()
{ {
@ -51,7 +51,7 @@ void CollideEntity::bounce(float ba)
if (getState() == STATE_PUSH) if (getState() == STATE_PUSH)
{ {
dsq->spawnParticleEffect("HitSurface", dsq->game->lastCollidePosition); dsq->spawnParticleEffect("HitSurface", dsq->game->lastCollidePosition);
//dsq->effectCollisionSmoke(position);
sound("RockHit"); sound("RockHit");
// HACK: replace damage function // HACK: replace damage function
//damage(pushDamage); //damage(pushDamage);
@ -70,7 +70,7 @@ void CollideEntity::bounce(float ba)
if (!N.isZero()) if (!N.isZero())
{ {
//2*(-I dot N)*N + I
vel = 2*(-I.dot(N))*N + I; vel = 2*(-I.dot(N))*N + I;
vel.setLength2D(len*ba); vel.setLength2D(len*ba);
} }
@ -94,7 +94,7 @@ void CollideEntity::bounce(float ba)
} }
break; break;
} }
//mov.setLength2D(-len * ba);
onBounce(); onBounce();
@ -105,14 +105,8 @@ void CollideEntity::updateMovement(float dt)
if (isEntityDead()) return; if (isEntityDead()) return;
if (position.isFollowingPath()) return; if (position.isFollowingPath()) return;
vel.capLength2D(getMaxSpeed()*maxSpeedLerp.x); vel.capLength2D(getMaxSpeed()*maxSpeedLerp.x);
/*
if (vel.getSquaredLength2D() > sqr(getMaxSpeed()))
{
vel.setLength2D(getMaxSpeed());
vel.z = 0;
}
*/
//Vector lastPos = pos;
updateVel2(dt); updateVel2(dt);
@ -135,21 +129,7 @@ void CollideEntity::updateMovement(float dt)
} }
} }
/*
if (!canLeaveWater)
{
if (waterBubble)
{
}
else
{
if (position.y-collideRadius < dsq->game->getWaterLevel())
{
}
}
}
*/
bool collided = false; bool collided = false;
@ -175,7 +155,7 @@ void CollideEntity::updateMovement(float dt)
} }
} }
//Vector lastPosition = lastPos;
Vector newPosition = position + (getMoveVel() * dt); Vector newPosition = position + (getMoveVel() * dt);
position = newPosition; position = newPosition;

View file

@ -304,11 +304,7 @@ void Continuity::sortFood()
switch (dsq->continuity.foodSortType) switch (dsq->continuity.foodSortType)
{ {
/*
case FOODSORT_UNSORTED:
sortOrder = sortByUnsort;
break;
*/
case FOODSORT_BYTYPE: case FOODSORT_BYTYPE:
sortOrder = sortByType; sortOrder = sortByType;
break; break;
@ -321,8 +317,7 @@ void Continuity::sortFood()
} }
//IngredientData *plantLeaf = dsq->continuity.getIngredientHeldByName("PlantLeaf");
//int oldHeld = plantLeaf->held;
if (doSort) if (doSort)
{ {
@ -391,11 +386,11 @@ void Continuity::sortFood()
ingredients.push_back(sort[i]); ingredients.push_back(sort[i]);
} }
sort.clear(); sort.clear();
//dsq->continuity.ingredients = sort;
} }
//IngredientData *plantLeaf2 = dsq->continuity.getIngredientHeldByName("PlantLeaf");
//int newHeld = plantLeaf2->held;
} }
void Continuity::setRegen(float t) 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(210);
os << " " << dsq->continuity.stringBank.get(205) << " " << (fx.magnitude*5) << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << (fx.magnitude*5) << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
//return dsq->continuity.stringBank.get(210);
break; break;
case IET_ENERGY: case IET_ENERGY:
os << dsq->continuity.stringBank.get(211) << " " << fx.magnitude; os << dsq->continuity.stringBank.get(211) << " " << fx.magnitude;
@ -829,7 +824,7 @@ bool Continuity::applyIngredientEffects(IngredientData *data)
dsq->centerMessage(getIEString(data, i), y); dsq->centerMessage(getIEString(data, i), y);
dsq->continuity.setWeb(webTime); dsq->continuity.setWeb(webTime);
//dsq->centerMessage(dsq->continuity.stringBank.get(216), y);
} }
break; break;
case IET_ALLSTATUS: case IET_ALLSTATUS:
@ -1477,8 +1472,8 @@ void Continuity::castSong(int num)
os << "Could not find song with index [" << num << "]"; os << "Could not find song with index [" << num << "]";
debugLog(os.str()); debugLog(os.str());
} }
//float et = 0.5;
//float et = 10;
float et = 0.5; float et = 0.5;
std::ostringstream os; std::ostringstream os;
os << "Song/SongSlot-" << dsq->continuity.getSongSlotByType(num); os << "Song/SongSlot-" << dsq->continuity.getSongSlotByType(num);
@ -1487,7 +1482,7 @@ void Continuity::castSong(int num)
effect->setTexture(os.str()); effect->setTexture(os.str());
effect->position = selected->position + selected->offset; effect->position = selected->position + selected->offset;
effect->scale.interpolateTo(Vector(3,3), et); effect->scale.interpolateTo(Vector(3,3), et);
//effect->setBlendType(RenderObject::BLEND_ADD);
effect->alpha.ensureData(); effect->alpha.ensureData();
effect->alpha.data->path.addPathNode(0, 0); effect->alpha.data->path.addPathNode(0, 0);
effect->alpha.data->path.addPathNode(0.5, 0.1); effect->alpha.data->path.addPathNode(0.5, 0.1);
@ -1536,12 +1531,7 @@ void Continuity::castSong(int num)
sound->playSfx("Heal"); sound->playSfx("Heal");
selected->heal(2); 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); selected->skeletalSprite.animate("healSelf", 0, 1);
break; break;
case SONG_TIME: case SONG_TIME:
@ -1575,7 +1565,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)) 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->overlay->color = Vector(1,1,1);
dsq->fade(1, 0.3); dsq->fade(1, 0.3);
dsq->main(0.3); dsq->main(0.3);
@ -1583,7 +1573,7 @@ void Continuity::castSong(int num)
dsq->fade(0, 0.3); dsq->fade(0, 0.3);
dsq->main(0.3); dsq->main(0.3);
dsq->overlay->color = 0; dsq->overlay->color = 0;
//dsq->game->avatar->enableInput();
} }
else if ((dsq->game->li->position - dsq->game->avatar->position).isLength2DIn(500)) else if ((dsq->game->li->position - dsq->game->avatar->position).isLength2DIn(500))
{ {
@ -1597,13 +1587,7 @@ void Continuity::castSong(int num)
{ {
core->sound->playSfx("Denied"); core->sound->playSfx("Denied");
} }
/*
}
else
{
core->sound->playSfx("SongFail");
}
*/
} }
else else
{ {
@ -1785,12 +1769,8 @@ loop:
// make sure last note is more or less close // make sure last note is more or less close
if (song.notes.size()-last < 2) 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].pass = true;
songChecks[i].rank = rank; songChecks[i].rank = rank;
@ -1813,11 +1793,7 @@ loop:
} }
} }
/*
std::ostringstream os;
os << "lowest rank: " << lowestRank;
debugLog(os.str());
*/
return songIdx; return songIdx;
} }
@ -1835,7 +1811,7 @@ int Continuity::checkSong(const Song &song)
Song *s = &songBank[i]; Song *s = &songBank[i];
if (s->notes.empty()) continue; if (s->notes.empty()) continue;
int j = 0; int j = 0;
//if (s->size() == song.size())
{ {
bool foundSong = false; bool foundSong = false;
int currentNote = 0; int currentNote = 0;
@ -1867,7 +1843,7 @@ int Continuity::checkSong(const Song &song)
} }
} }
if (j != song.notes.size()-1) foundSong = false; if (j != song.notes.size()-1) foundSong = false;
//if (j == s->size())
if (foundSong) if (foundSong)
{ {
return i; return i;
@ -1910,7 +1886,7 @@ void Continuity::update(float dt)
statsAndAchievements->RunFrame(); statsAndAchievements->RunFrame();
} }
if (dsq->game->isActive() && !dsq->game->isPaused() /*&& !(getWorldType() == WT_SPIRIT)*/) if (dsq->game->isActive() && !dsq->game->isPaused() )
{ {
if (liPowerTimer.updateCheck(dt)) if (liPowerTimer.updateCheck(dt))
@ -2011,18 +1987,14 @@ void Continuity::update(float dt)
if (regenTimer.isActive()) if (regenTimer.isActive())
{ {
/*
static float regenBit = 0;
regenBit += dt;
if (regenBit > 1)
*/
{ {
Avatar *a = dsq->game->avatar; Avatar *a = dsq->game->avatar;
if (a) if (a)
{ {
a->heal(dt*0.5f); a->heal(dt*0.5f);
} }
//regenBit = 0;
} }
} }
} }
@ -2104,17 +2076,14 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
{ {
core->postProcessingFx.blendType = 1; core->postProcessingFx.blendType = 1;
core->postProcessingFx.intensity = 0.2f; 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.renderLayer = LR_AFTER_EFFECTS;
core->postProcessingFx.enable(FXT_RADIALBLUR); core->postProcessingFx.enable(FXT_RADIALBLUR);
} }
dsq->game->avatar->canWarp = false; dsq->game->avatar->canWarp = false;
/*
if (affectMusic)
dsq->sound->toggleEffects(1);
*/
dsq->game->backupSceneColor = dsq->game->sceneColor; dsq->game->backupSceneColor = dsq->game->sceneColor;
dsq->game->sceneColor.interpolateTo(Vector(0.4, 0.8, 0.9), time); dsq->game->sceneColor.interpolateTo(Vector(0.4, 0.8, 0.9), time);
dsq->game->avatar->applyWorldEffects(type); dsq->game->avatar->applyWorldEffects(type);
@ -2124,23 +2093,15 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
dsq->game->avatar->canWarp = true; dsq->game->avatar->canWarp = true;
core->postProcessingFx.disable(FXT_RADIALBLUR); 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->sceneColor.interpolateTo(Vector(1,1,1), time);
dsq->game->avatar->applyWorldEffects(type); dsq->game->avatar->applyWorldEffects(type);
} }
if (time > 0) if (time > 0)
{ {
/*
dsq->game->avatar->slowToRest();
dsq->game->avatar->disableInput();
core->main(time);
dsq->game->avatar->enableInput();
*/
} }
worldType = type; worldType = type;
} }
@ -2291,12 +2252,7 @@ void Continuity::setFlag(std::string flag, int v)
flags[flag] = v; flags[flag] = v;
} }
/*
void Continuity::setActivePet(int flag)
{
setFlag(FLAG_ACTIVEPET, flag);
}
*/
void Continuity::loadPetData() void Continuity::loadPetData()
{ {
@ -2789,20 +2745,7 @@ void Continuity::loadFile(int slot)
e = e->NextSiblingElement("Flag"); 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"); XMLElement *efx = doc.FirstChildElement("EFX");
if (efx) if (efx)
@ -3027,7 +2970,7 @@ void Continuity::loadFile(int slot)
int idx; int idx;
//worldMapTiles.clear();
while (is >> idx) while (is >> idx)
{ {
@ -3322,13 +3265,7 @@ void Continuity::loadFile(int slot)
void Continuity::setNaijaModel(std::string model) void Continuity::setNaijaModel(std::string model)
{ {
/*
naijaModel = model;
if (dsq->game->avatar)
{
dsq->game->avatar->refreshModel();
}
*/
} }
int Continuity::getFlag(int flag) int Continuity::getFlag(int flag)
@ -3404,7 +3341,7 @@ public:
timer = 0; timer = 0;
//GemGet *q = this;
setTexture("Gems/" + gem); setTexture("Gems/" + gem);
@ -3424,11 +3361,7 @@ public:
setLife(timeScale+0.1f); setLife(timeScale+0.1f);
setDecayRate(1); 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: protected:
float timer; float timer;
@ -3496,26 +3429,7 @@ GemData *Continuity::pickupGem(std::string name, bool effects)
GemGet *gg = new GemGet(g.name); GemGet *gg = new GemGet(g.name);
dsq->game->addRenderObject(gg, LR_MINIMAP); 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")) if (!getFlag("tokenHint"))
@ -3523,8 +3437,8 @@ GemData *Continuity::pickupGem(std::string name, bool effects)
setFlag("tokenHint", 1); setFlag("tokenHint", 1);
dsq->game->setControlHint(dsq->continuity.stringBank.get(4), false, false, false, 8); dsq->game->setControlHint(dsq->continuity.stringBank.get(4), false, false, false, 8);
} }
//dsq->watch(1);
//dsq->resetTimer();
} }
// return the last one // return the last one
@ -3580,7 +3494,7 @@ void Continuity::reset()
dsq->game->recipeMenu.currentPage = 0; dsq->game->recipeMenu.currentPage = 0;
} }
//worldMapTiles.clear();
speedMult = biteMult = fishPoison = defenseMult = 1; speedMult = biteMult = fishPoison = defenseMult = 1;
speedMult2 = 1; speedMult2 = 1;
@ -3636,12 +3550,12 @@ void Continuity::reset()
loadEatBank(); loadEatBank();
dsq->loadElementEffects(); dsq->loadElementEffects();
form = FORM_NORMAL; form = FORM_NORMAL;
//cm.reset();
naijaModel = "Naija"; naijaModel = "Naija";
costume = ""; costume = "";
dsq->emote.load("data/naijaemote.txt"); dsq->emote.load("data/naijaemote.txt");
//learnSong(SONG_SONGDOOR1);
worldType = WT_NORMAL; worldType = WT_NORMAL;
@ -3669,7 +3583,7 @@ void Continuity::reset()
inFile >> spd; inFile >> spd;
speedTypes.push_back(spd); speedTypes.push_back(spd);
} }
//selectedSpell = SpellType(0);
if (!dsq->mod.isActive()) if (!dsq->mod.isActive())
{ {

View file

@ -32,7 +32,7 @@ namespace AQCredits
void watchSlide(int slide) void watchSlide(int slide)
{ {
float t = 10;//15; float t = 10;
if (!(slide >= 0 && slide < slides.size())) return; if (!(slide >= 0 && slide < slides.size())) return;
@ -190,7 +190,7 @@ void Credits::applyState()
dsq->game->transitionToScene("thirteenlair"); dsq->game->transitionToScene("thirteenlair");
#endif #endif
//dsq->title();
} }
void Credits::removeState() void Credits::removeState()

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CurrentRender::CurrentRender() : RenderObject() CurrentRender::CurrentRender() : RenderObject()
{ {
cull = false; cull = false;
//alpha = 0.2f;
setTexture("Particles/Current"); setTexture("Particles/Current");
texture->repeat = true; texture->repeat = true;
rippleDelay = 2; rippleDelay = 2;
@ -35,27 +35,8 @@ void CurrentRender::onUpdate(float dt)
{ {
RenderObject::onUpdate(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() void CurrentRender::onRender()
@ -68,86 +49,12 @@ void CurrentRender::onRender()
if (p->active) if (p->active)
{ {
/*
std::ostringstream os;
os << "animOffset: " << p->animOffset;
debugLog(os.str());
*/
int w2 = p->rect.getWidth()/2; 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) if (true)
{ {
int sz = p->nodes.size()-1; int sz = p->nodes.size()-1;
@ -164,23 +71,7 @@ void CurrentRender::onRender()
p2 += d*0.75f; p2 += d*0.75f;
diff = p2 - p1; 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()) if (!diff.isZero())
{ {
@ -201,21 +92,12 @@ void CurrentRender::onRender()
Vector r8 = p2+pr; Vector r8 = p2+pr;
float len = diff.getLength2D(); float len = diff.getLength2D();
float texScale = len/256.0f; 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)) if (isTouchingLine(p1, p2, dsq->screenCenter, dsq->cullRadius+p->rect.getWidth()/2.0f))
{ {
//qs++;
glBegin(GL_QUAD_STRIP); glBegin(GL_QUAD_STRIP);
glColor4f(1,1,1,0); glColor4f(1,1,1,0);
@ -273,7 +155,7 @@ void CurrentRender::onRender()
if (isTouchingLine(p1, p2, dsq->screenCenter, dsq->cullRadius)) if (isTouchingLine(p1, p2, dsq->screenCenter, dsq->cullRadius))
{ {
//qs++;
glBegin(GL_QUADS); glBegin(GL_QUADS);
if (n==0) if (n==0)
glColor4f(1,1,1,0); glColor4f(1,1,1,0);
@ -304,16 +186,10 @@ void CurrentRender::onRender()
} }
} }
} }
//glEnd();
} }
//glEnable(GL_CULL_FACE);
/*
std::ostringstream os;
os << "current quads: " << qs;
debugLog(os.str());
*/
} }

File diff suppressed because it is too large Load diff

View file

@ -191,16 +191,7 @@ enum WorldMapRevealMethod
}; };
/*
class Title;
class GameOver;
class Logo;
class Entity;
class SCLogo;
class IntroText;
class AnimationEditor;
class Intro;
*/
struct SubLine struct SubLine
{ {
SubLine() { timeStamp = 0; } SubLine() { timeStamp = 0; }
@ -551,23 +542,7 @@ enum Layers
class Avatar; 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 #define MAPVIS_SUBDIV 64
@ -857,12 +832,7 @@ const int FLAG_SECRET03 = 236;
const int FLAG_COLLECTIBLE_START = 500; const int FLAG_COLLECTIBLE_START = 500;
const int FLAG_COLLECTIBLE_END = 600; 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 struct PetData
{ {

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "DSQ.h" #include "DSQ.h"
#include "Game.h" #include "Game.h"
#include "Avatar.h" #include "Avatar.h"
//const float key = 0.1;
Demo::Demo() Demo::Demo()
{ {
time = 0; time = 0;
@ -77,22 +77,8 @@ void Demo::save(const std::string &name)
std::string filename = "" + name + ".demo"; 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) void Demo::load(const std::string &name)
@ -103,10 +89,8 @@ void Demo::load(const std::string &name)
// UNFINISHED // UNFINISHED
std::string filename = "" + name + ".demo"; std::string filename = "" + name + ".demo";
//XMLDocument doc;
//doc.LoadFile(filename.c_str());
//doc.FirstChildElement("");
} }
void Demo::clearRecordedFrames() void Demo::clearRecordedFrames()
@ -136,13 +120,7 @@ void Demo::update(float dt)
frames.push_back(f); frames.push_back(f);
/*
timeDiff += dt;
if (timeDiff > key)
{
timeDiff -= key;
}
*/
time += dt; time += dt;
if (getQuitKey()) if (getQuitKey())
@ -153,7 +131,7 @@ void Demo::update(float dt)
} }
else if (mode == DEMOMODE_PLAYBACK) else if (mode == DEMOMODE_PLAYBACK)
{ {
//core->updateMouse = false;
while (frame < frames.size()) while (frame < frames.size())
{ {
DemoFrame *f = &frames[frame]; DemoFrame *f = &frames[frame];
@ -175,10 +153,10 @@ void Demo::update(float dt)
break; break;
} }
//
} }
time += dt; time += dt;
//core->updateMouse = true;
if (getQuitKey() || (!frames.empty() && frame >= frames.size())) { if (getQuitKey() || (!frames.empty() && frame >= frames.size())) {
togglePlayback(false); togglePlayback(false);

View file

@ -100,7 +100,6 @@ void Element::updateEffects(float dt)
/// check player position /// check player position
{ {
// if a big wavy doesn't work, this is probably why // if a big wavy doesn't work, this is probably why
//if ((position - ent->position).isLength2DIn(1024))
{ {
ElementEffectData *eff = this->eff; ElementEffectData *eff = this->eff;
@ -163,7 +162,7 @@ void Element::updateEffects(float dt)
eff->wavyMagnitude = 0; eff->wavyMagnitude = 0;
} }
//std::cout << "setting grid from wav w/ wavyWaving\n";
setGridFromWavy(); setGridFromWavy();
} }
@ -210,7 +209,7 @@ void Element::setGridFromWavy()
{ {
if (drawGrid) if (drawGrid)
{ {
//std::cout << "set grid from wavy (" << xDivs << ", " << yDivs << ")\n"
const float w = float(getWidth()); const float w = float(getWidth());
for (int x = 0; x < xDivs-1; x++) for (int x = 0; x < xDivs-1; x++)
{ {
@ -262,11 +261,7 @@ void Element::setElementEffectByIndex(int eidx)
break; break;
case EFX_WAVY: 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); eff->wavy.resize(e.segsy);
float bity = float(getHeight())/float(e.segsy); float bity = float(getHeight())/float(e.segsy);
for (int i = 0; i < eff->wavy.size(); i++) for (int i = 0; i < eff->wavy.size(); i++)
@ -317,7 +312,7 @@ void Element::render()
renderBorderColor = Vector(1,1,1); renderBorderColor = Vector(1,1,1);
} }
renderBorder = true; renderBorder = true;
//errorLog("!^!^$");
} }
#endif #endif

View file

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

File diff suppressed because it is too large Load diff

View file

@ -217,7 +217,7 @@ public:
ACT_RANGE = 1 ACT_RANGE = 1
}; };
void destroy(); void destroy();
//void damage(int amount, Spell *spell=0, Entity *attacker=0);
bool isEntityDead() const {return entityDead;} bool isEntityDead() const {return entityDead;}
std::string name; std::string name;
Vector vel; Vector vel;
@ -244,8 +244,7 @@ public:
bool isUnderWater(const Vector &o=Vector()); bool isUnderWater(const Vector &o=Vector());
//virtual void onHitBySpell(Spell *spell) {}
//virtual void onCollide(Entity *e);
virtual bool damage(const DamageData &d); virtual bool damage(const DamageData &d);
virtual bool canShotHit(const DamageData &d) { return true; } virtual bool canShotHit(const DamageData &d) { return true; }
@ -313,7 +312,7 @@ public:
STATE_TITLE =24 STATE_TITLE =24
}; };
virtual void onNotify(Entity *notify){} 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); float followPath(Path *p, float speed, int dir, bool deleteOnEnd = false);
Entity *attachedTo; 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)); 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));
@ -334,7 +333,7 @@ public:
void doEntityAvoidance(float dt, int range, float mod, Entity *ignore =0); void doEntityAvoidance(float dt, int range, float mod, Entity *ignore =0);
void setMaxSpeed(float ms); void setMaxSpeed(float ms);
Entity *findTarget(int dist, int type, int t=0); Entity *findTarget(int dist, int type, int t=0);
//bool hasTarget() { return target != 0; }
bool hasTarget(int t=0); bool hasTarget(int t=0);
bool isTargetInRange(int range, 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); void doGlint(const Vector &position, const Vector &scale=Vector(2,2), const std::string &tex="Glint", RenderObject::BlendTypes bt=BLEND_DEFAULT);
@ -419,10 +418,7 @@ public:
Vector ridingOnEntityOffset; Vector ridingOnEntityOffset;
void moveOutOfWall(); void moveOutOfWall();
bool isSittingOnInvisibleIn(); bool isSittingOnInvisibleIn();
/*
void setCrawling(bool on) { crawling = on; }
bool isCrawling() { return crawling; }
*/
void flipToVel(); void flipToVel();
bool isInCurrent() { return inCurrent; } bool isInCurrent() { return inCurrent; }
void clearTargetPoints(); void clearTargetPoints();
@ -456,10 +452,10 @@ public:
void clampToHit(); void clampToHit();
bool updateLocalWarpAreas(bool affectAvatar); bool updateLocalWarpAreas(bool affectAvatar);
virtual void entityDied(Entity *e); virtual void entityDied(Entity *e);
//bool registerEntityDied;
bool clampToSurface(int tcheck=0, Vector usePos=Vector(0,0), TileVector hitTile=TileVector(0,0)); bool clampToSurface(int tcheck=0, Vector usePos=Vector(0,0), TileVector hitTile=TileVector(0,0));
bool checkSurface(int tcheck, int state, float statet); bool checkSurface(int tcheck, int state, float statet);
//static Shader blurShader;
std::string naijaReaction; std::string naijaReaction;
Vector lookAtPoint; Vector lookAtPoint;
Vector getLookAtPoint(); Vector getLookAtPoint();
@ -533,7 +529,7 @@ protected:
int lance; int lance;
Bone *lanceBone; Bone *lanceBone;
void updateLance(float dt); void updateLance(float dt);
//InterpolatedVector blurShaderAnim;
int fhScale, fvScale; int fhScale, fvScale;
@ -555,9 +551,9 @@ protected:
Vector getMoveVel(); Vector getMoveVel();
DisabledDamageTypes disabledDamageTypes; DisabledDamageTypes disabledDamageTypes;
//bool crawling;
//Vector backupPos, backupVel;
virtual void onIdle() {} virtual void onIdle() {}
virtual void onHeal(int type){} virtual void onHeal(int type){}
virtual void onDamage(DamageData &d){} virtual void onDamage(DamageData &d){}
@ -578,7 +574,7 @@ protected:
virtual void onFreeze(){} virtual void onFreeze(){}
//Entity *target;
std::vector<Entity*>targets; std::vector<Entity*>targets;
virtual void onAlwaysUpdate(float dt){} virtual void onAlwaysUpdate(float dt){}
virtual void onUpdateFrozen(float dt){} virtual void onUpdateFrozen(float dt){}
@ -589,7 +585,7 @@ protected:
void onEnterState(int action); void onEnterState(int action);
void onExitState(int action); void onExitState(int action);
//virtual bool onDamage(int amount, Spell *spell, Entity *attacker);
bool invincibleBreak; bool invincibleBreak;
bool entityDead; bool entityDead;

View file

@ -43,11 +43,7 @@ int FFTNotes::getNoteFromFFT(int fft, int octave)
if (fft == 0) if (fft == 0)
return -1; return -1;
int v = data[fft]-1; int v = data[fft]-1;
/*
std::ostringstream os;
os << "fftv: " << v;
debugLog(os.str());
*/
if (v == (octave+1)*10) if (v == (octave+1)*10)
{ {
v = 7; v = 7;
@ -57,6 +53,6 @@ int FFTNotes::getNoteFromFFT(int fft, int octave)
v = -1; v = -1;
} }
if (v != -1) if (v != -1)
v -= octave*10; // : ) v -= octave*10;
return v; return v;
} }

View file

@ -1648,7 +1648,6 @@ void Game::hideInGameMenu(bool effects, bool cancel)
for (int i = 0; i < dropIngrNames.size(); i++) for (int i = 0; i < dropIngrNames.size(); i++)
{ {
dsq->game->spawnIngredient(dropIngrNames[i], avatar->position + Vector(0,-96), 1, 1); dsq->game->spawnIngredient(dropIngrNames[i], avatar->position + Vector(0,-96), 1, 1);
@ -3483,7 +3482,6 @@ void Game::createInGameMenu()
ToolTip *tip = 0; ToolTip *tip = 0;
foodTips.clear(); foodTips.clear();
@ -3842,8 +3840,6 @@ void Game::createInGameMenu()
int outer = 0; int outer = 0;
int inner = 0; int inner = 0;
for (i = 0; i < songSlots.size(); i++) for (i = 0; i < songSlots.size(); i++)
@ -6459,7 +6455,6 @@ void Game::applyState()
if (toFlip == 1) if (toFlip == 1)
{ {
dsq->game->avatar->flipHorizontal(); dsq->game->avatar->flipHorizontal();
@ -6468,8 +6463,6 @@ void Game::applyState()
// li // li
//if (true) //if (true)

View file

@ -100,7 +100,7 @@ const float MIN_SIZE = 0.1;
#undef AQUARIA_BUILD_SCENEEDITOR #undef AQUARIA_BUILD_SCENEEDITOR
#endif #endif
//#include "GridRender.h"
class GridRender; class GridRender;
class MiniMapRender; class MiniMapRender;
class WaterSurfaceRender; class WaterSurfaceRender;
@ -487,9 +487,9 @@ public:
void updateSelectedElementPosition(Vector position); void updateSelectedElementPosition(Vector position);
int selectedEntityType; int selectedEntityType;
//int curEntity;
SelectedEntity selectedEntity; SelectedEntity selectedEntity;
//EntityGroups::iterator page;
int entityPageNum; int entityPageNum;
void checkForRebuild(); void checkForRebuild();
@ -633,7 +633,7 @@ public:
void removeState(); void removeState();
void update(float dt); void update(float dt);
void onLeftMouseButton(); void onLeftMouseButton();
//std::vector<Item*>items;
Avatar *avatar; Avatar *avatar;
Entity *li; Entity *li;
@ -642,7 +642,7 @@ public:
FoodSlot *moveFoodSlotToFront; FoodSlot *moveFoodSlotToFront;
//void doChoiceMenu(Vector position, std::vector<std::string> choices);
std::string getSelectedChoice() { return selectedChoice; } std::string getSelectedChoice() { return selectedChoice; }
@ -824,8 +824,8 @@ public:
Precacher tileCache; Precacher tileCache;
//void cameraPanToNode(Path *p, int speed=500);
//void cameraRestore();
void setCameraFollow(Vector *position); 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(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); 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);
@ -910,7 +910,7 @@ public:
void selectEntityFromGroups(); void selectEntityFromGroups();
InterpolatedVector cameraInterp; InterpolatedVector cameraInterp;
//InterpolatedVector tintColor;
float getWaterLevel(); float getWaterLevel();
void setMusicToPlay(const std::string &musicToPlay); void setMusicToPlay(const std::string &musicToPlay);
Vector lastCollidePosition; Vector lastCollidePosition;
@ -1163,12 +1163,7 @@ protected:
float deathTimer; float deathTimer;
/*
void onAssignMenuScreenItemToSlot0();
void onAssignMenuScreenItemToSlot1();
void onAssignMenuScreenItemToSlot2();
void onAssignMenuScreenItemToSlot3();
*/
void onInGameMenuInventory(); void onInGameMenuInventory();
void onInGameMenuSpellBook(); void onInGameMenuSpellBook();

View file

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

View file

@ -29,8 +29,8 @@ GasCloud::GasCloud(Entity *source, const Vector &position, const std::string &pa
this->poisonTime = poisonTime; this->poisonTime = poisonTime;
this->particles = particles; this->particles = particles;
//this->gfx = gfx;
//this->isMoney = isMoney;
this->position = position; this->position = position;
this->damage = damage; this->damage = damage;
this->radius = radius; this->radius = radius;
@ -46,10 +46,10 @@ GasCloud::GasCloud(Entity *source, const Vector &position, const std::string &pa
emitter->load(particles); emitter->load(particles);
emitter->start(); emitter->start();
emitter->setDie(true); emitter->setDie(true);
//emitter->parentManagedStatic = true;
//addChild(&emitter);
dsq->game->addRenderObject(emitter, LR_PARTICLES); dsq->game->addRenderObject(emitter, LR_PARTICLES);
//setDamageTarget(DT_ENEMY_GAS, false)
setEntityType(ET_NEUTRAL); setEntityType(ET_NEUTRAL);
deathSound = ""; 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 else
{ {

View file

@ -24,13 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
GridRender::GridRender(ObsType obsType) : RenderObject() GridRender::GridRender(ObsType obsType) : RenderObject()
{ {
color = Vector(1, 0, 0); color = Vector(1, 0, 0);
//color = Vector(0.2,0.2,1);
position.z = 5; position.z = 5;
cull = false; cull = false;
alpha = 0.5f; alpha = 0.5f;
this->obsType = obsType; this->obsType = obsType;
blendEnabled = false; blendEnabled = false;
//setTexture("grid");
} }
void GridRender::onUpdate(float dt) void GridRender::onUpdate(float dt)
@ -150,7 +150,7 @@ void SongLineRender::clear()
void SongLineRender::onRender() void SongLineRender::onRender()
{ {
int w=core->getWindowWidth(); int w=core->getWindowWidth();
//core->getWindowWidth(&w);
int ls = (4*w)/1024.0f; int ls = (4*w)/1024.0f;
if (ls < 0) if (ls < 0)
ls = 1; ls = 1;

View file

@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Hair.h" #include "Hair.h"
#include "DSQ.h" #include "DSQ.h"
// nodes = 40
// segmentLength = 3
Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject() Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
{ {
this->segmentLength = segmentLength; this->segmentLength = segmentLength;
@ -33,8 +33,8 @@ Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
cull = false; cull = false;
hairNodes.resize(nodes); hairNodes.resize(nodes);
// nodes: 20 length: 6
//segmentLength = 3;
for (int i = 0; i < hairNodes.size(); i++) for (int i = 0; i < hairNodes.size(); i++)
{ {
float perc = (float(i)/(float(hairNodes.size()))); 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) 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) 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) void Hair::setHeadPosition(const Vector &vec)
@ -125,15 +75,15 @@ HairNode *Hair::getHairNode(int idx)
void Hair::onRender() void Hair::onRender()
{ {
//glDisable(GL_CULL_FACE);
glBegin(GL_QUAD_STRIP); glBegin(GL_QUAD_STRIP);
float texBits = 1.0f / (hairNodes.size()-1); float texBits = 1.0f / (hairNodes.size()-1);
//float height2 = 2.5f;
Vector pl, pr; Vector pl, pr;
for (int i = 0; i < hairNodes.size(); i++) for (int i = 0; i < hairNodes.size(); i++)
{ {
//glNormal3f( 0.0f, 0.0f, 1.0f);
if (i != hairNodes.size()-1) if (i != hairNodes.size()-1)
{ {
@ -143,14 +93,6 @@ void Hair::onRender()
pr = diffVec.getPerpendicularRight(); pr = diffVec.getPerpendicularRight();
} }
/*
if (hairNodes[i].problem)
{
glColor3f(1,0,0);
}
else
glColor3f(1,1,1);
*/
glTexCoord2f(0, texBits*i); glTexCoord2f(0, texBits*i);
@ -158,98 +100,33 @@ void Hair::onRender()
glTexCoord2f(1, texBits*i); glTexCoord2f(1, texBits*i);
glVertex3f( hairNodes[i].position.x + pr.x, hairNodes[i].position.y + pr.y, 0); 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(); 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);
} }
void Hair::onUpdate(float dt) void Hair::onUpdate(float dt)
{ {
RenderObject::onUpdate(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() void Hair::updatePositions()
{ {
BBGE_PROF(Hair_updatePositions); BBGE_PROF(Hair_updatePositions);
//int minLength = 1;
/*
Vector accum;
for (int i = 1; i < hairNodes.size(); i++) for (int i = 1; i < hairNodes.size(); i++)
{ {
Vector diff = hairNodes[i].position - hairNodes[i-1].position; 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) if (diff.getLength2D() < segmentLength)
{ {
@ -258,181 +135,13 @@ void Hair::updatePositions()
} }
else if (diff.getLength2D() > segmentLength) else if (diff.getLength2D() > segmentLength)
{ {
//diff |= segmentLength;
diff.setLength2D(segmentLength); diff.setLength2D(segmentLength);
hairNodes[i].position = hairNodes[i-1].position + diff; 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;
*/
//}
} }
@ -472,15 +181,7 @@ void Hair::exertForce(const Vector &force, float dt, int usePerc)
hairNodes[i].position += force*dt; hairNodes[i].position += force*dt;
break; 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

@ -59,7 +59,7 @@ Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount)
velocity = randVector(mag)*0.5f + Vector(0, -mag)*0.5f; velocity = randVector(mag)*0.5f + Vector(0, -mag)*0.5f;
else else
velocity = Vector(0,-mag*0.5f); velocity = Vector(0,-mag*0.5f);
gravity = Vector(0, 250); //300 gravity = Vector(0, 250);
scale = Vector(0.2,0.2); scale = Vector(0.2,0.2);
scale.interpolateTo(Vector(1, 1), 0.75); scale.interpolateTo(Vector(1, 1), 0.75);
@ -110,12 +110,7 @@ void Ingredient::onUpdate(float dt)
if (dsq->game->collideCircleWithGrid(position, 24)) if (dsq->game->collideCircleWithGrid(position, 24))
{ {
position = lastPosition; position = lastPosition;
/*
if (velocity.x < velocity.y)
velocity.x = -velocity.x;
else
velocity.y = -velocity.y;
*/
velocity = 0; velocity = 0;
} }

View file

@ -765,8 +765,6 @@ void Intro::update(float dt)
dsq->overlay->color = Vector(0,0,0); dsq->overlay->color = Vector(0,0,0);
dsq->fade(1, 0.1); dsq->fade(1, 0.1);
if (waitQuit(0.1)) return; if (waitQuit(0.1)) return;

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void Logo::JumpTitle::act() void Logo::JumpTitle::act()
{ {
//dsq->title();
} }
Logo::Logo() : StateObject() Logo::Logo() : StateObject()
@ -36,25 +36,8 @@ void Logo::applyState()
core->setClearColor(Vector(1,1,1)); 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; Quad *q = new Quad;
{ {

View file

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

View file

@ -2,7 +2,7 @@
#include "DSQ.h" #include "DSQ.h"
#include "Network.h" #include "Network.h"
#include "ByteBuffer.h" #include "ByteBuffer.h"
//#include "VFSTools.h"
#include "MT.h" #include "MT.h"
#include <map> #include <map>
#include <set> #include <set>
@ -44,7 +44,7 @@ public:
protected: protected:
virtual void _OnClose() virtual void _OnClose()
{ {
//puts("_OnClose()");
minihttp::HttpSocket::_OnClose(); minihttp::HttpSocket::_OnClose();
const Request& r = GetCurrentRequest(); const Request& r = GetCurrentRequest();
@ -57,7 +57,7 @@ protected:
} }
virtual void _OnOpen() virtual void _OnOpen()
{ {
//puts("_OnOpen()");
minihttp::HttpSocket::_OnOpen(); minihttp::HttpSocket::_OnOpen();
const Request& r = GetCurrentRequest(); const Request& r = GetCurrentRequest();
@ -68,7 +68,7 @@ protected:
{ {
const Request& r = GetCurrentRequest(); const Request& r = GetCurrentRequest();
RequestData *data = (RequestData*)(r.user); RequestData *data = (RequestData*)(r.user);
//printf("_OnRequestDone(): %s\n", r.resource.c_str());
if(data->fp) if(data->fp)
{ {
fclose(data->fp); fclose(data->fp);
@ -91,11 +91,7 @@ protected:
{ {
if(!size) if(!size)
return; return;
/*if(GetStatusCode() != minihttp::HTTP_OK)
{
printf("NETWORK: Got %u bytes with status code %u", size, GetStatusCode());
return;
}*/
const Request& r = GetCurrentRequest(); const Request& r = GetCurrentRequest();
RequestData *data = (RequestData*)(r.user); RequestData *data = (RequestData*)(r.user);
if(!data->fp && !data->fail) if(!data->fp && !data->fail)

View file

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

View file

@ -454,20 +454,15 @@ void Path::refreshScript()
spawnEnemyDistance = 0; spawnEnemyDistance = 0;
is >> dummy >> spawnEnemyName >> spawnEnemyDistance >> spawnEnemyNumber; is >> dummy >> spawnEnemyName >> spawnEnemyDistance >> spawnEnemyNumber;
neverSpawned = true; neverSpawned = true;
/*
if (!spawnedEntity && !nodes.empty())
{
spawnedEntity = dsq->game->createEntity(spawnEnemyName, 0, nodes[0].position, 0, false, "");
}
*/
} }
else if (label == "pe") else if (label == "pe")
{ {
std::string dummy, particleEffect; std::string dummy, particleEffect;
SimpleIStringStream is(name); SimpleIStringStream is(name);
is >> dummy >> particleEffect; is >> dummy >> particleEffect;
//core->removeRenderObject(&emitter, Core::DO_NOT_DESTROY_RENDER_OBJECT);
//core->getTopStateData()->addRenderObject(&emitter, LR_PARTICLES);
setEmitter(particleEffect); setEmitter(particleEffect);
} }
@ -552,10 +547,7 @@ void Path::update(float dt)
if (pathType == PATH_CURRENT && !dsq->game->isWorldPaused()) if (pathType == PATH_CURRENT && !dsq->game->isWorldPaused())
{ {
animOffset -= currentMod*(dt/830); animOffset -= currentMod*(dt/830);
/*
while (animOffset < -1.0f)
animOffset += 1.0f;
*/
} }
if (pathType == PATH_GEM && dsq->game->avatar) if (pathType == PATH_GEM && dsq->game->avatar)
{ {
@ -603,10 +595,7 @@ void Path::update(float dt)
Entity *e = *i; Entity *e = *i;
if (e) 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 (dsq->game->collideCircleVsLine(e, start, end, rect.getWidth()*0.5f))
{ {
if (e->getEntityType() == ET_AVATAR) if (e->getEntityType() == ET_AVATAR)
@ -621,24 +610,13 @@ void Path::update(float dt)
d.damage = 0.1; d.damage = 0.1;
d.damageType = DT_STEAM; d.damageType = DT_STEAM;
e->damage(d); e->damage(d);
//a->position = a->lastPosition;
} }
Vector push; Vector push;
push = e->position - dsq->game->lastCollidePosition; 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); push.setLength2D(1000*dt);
if (e->vel2.isLength2DIn(1000) && !e->isNearObstruction(3)) if (e->vel2.isLength2DIn(1000) && !e->isNearObstruction(3))
@ -650,11 +628,7 @@ void Path::update(float dt)
if (dsq->game->collideCircleVsLine(e, start, end, rect.getWidth()*0.25f)) if (dsq->game->collideCircleVsLine(e, start, end, rect.getWidth()*0.25f))
{ {
push.setLength2D(100); push.setLength2D(100);
/*
Vector oldVel = e->vel;
Vector nvel = v;
nvel.setLength2D(e->vel);
*/
e->vel = 0; e->vel = 0;
e->vel += push; e->vel += push;
} }

View file

@ -58,7 +58,7 @@ void PathFinding::forceMinimumPath(VectorPath &path, const Vector &start, const
{ {
if (path.getNumPathNodes() <= 2) if (path.getNumPathNodes() <= 2)
{ {
//debugLog(" Path is <= 2 nodes... setting up simple path");
path.clear(); path.clear();
path.addPathNode(start, 0); path.addPathNode(start, 0);
path.addPathNode(dest, 1); path.addPathNode(dest, 1);

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PATHFINDING_H #define PATHFINDING_H
#include "../BBGE/Base.h" #include "../BBGE/Base.h"
//#include "Astar.h"
#include "TileVector.h" #include "TileVector.h"
#include <assert.h> #include <assert.h>

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
PathRender::PathRender() : RenderObject() PathRender::PathRender() : RenderObject()
{ {
//color = Vector(1, 0, 0);
position.z = 5; position.z = 5;
cull = false; cull = false;
alpha = 0.5f; alpha = 0.5f;

View file

@ -40,8 +40,8 @@ using namespace RecipeMenuNamespace;
RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe) RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe)
{ {
selected = 0; selected = 0;
// Quad *result, *i1, *i2, *i3;
// Recipe *recipe;
data = dsq->continuity.getIngredientDataByName(recipe->result); data = dsq->continuity.getIngredientDataByName(recipe->result);
if (data) if (data)
@ -70,7 +70,7 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
addChild(equals, PM_POINTER); addChild(equals, PM_POINTER);
int c = 0; int c = 0;
//int size = (recipe->names.size() + recipe->types.size())-1;
int size=0; int size=0;
for (int i = 0; i < recipe->names.size(); i++) for (int i = 0; i < recipe->names.size(); i++)
@ -120,14 +120,14 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
for (int i = 0; i < recipe->types.size(); i++) 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++) for (int j = 0; j < recipe->types[i].amount; j++)
{ {
// any type of whatever... // any type of whatever...
BitmapText *text = new BitmapText(&dsq->smallFont); BitmapText *text = new BitmapText(&dsq->smallFont);
text->color = 0; text->color = 0;
text->scale = Vector(0.8, 0.8); 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); std::string typeName = dsq->continuity.getIngredientDisplayName(recipe->types[i].typeName);
@ -180,15 +180,15 @@ void RecipeMenuEntry::onUpdate(float dt)
glow->alphaMod = 0.2; glow->alphaMod = 0.2;
std::ostringstream ds; std::ostringstream ds;
//ds << data->name << ": ";
//ds << "* ";
for (int i = 0; i < data->effects.size(); i++) for (int i = 0; i < data->effects.size(); i++)
{ {
ds << dsq->continuity.getIEString(data, i); ds << dsq->continuity.getIEString(data, i);
if (i == data->effects.size()-1) if (i == data->effects.size()-1)
{ {
// do nothing
//ds << ".";
} }
else else
{ {
@ -198,7 +198,7 @@ void RecipeMenuEntry::onUpdate(float dt)
game->recipeMenu.description->setText(ds.str()); game->recipeMenu.description->setText(ds.str());
game->recipeMenu.description->offset = Vector(0, -10 * (game->recipeMenu.description->getNumLines()-1)); game->recipeMenu.description->offset = Vector(0, -10 * (game->recipeMenu.description->getNumLines()-1));
// description->setText(ds.str());
selected = 1; selected = 1;
} }
else else
@ -235,7 +235,7 @@ void RecipeMenu::slide(RenderObject *r, bool in, float t)
if (in) if (in)
{ {
r->alpha = 1; r->alpha = 1;
//r->alpha.interpolateTo(1, 0.2);
r->offset = Vector(0,oy); r->offset = Vector(0,oy);
r->offset.interpolateTo(Vector(0,0), t, 0, 0, 1); r->offset.interpolateTo(Vector(0,0), t, 0, 0, 1);
} }
@ -261,15 +261,10 @@ int RecipeMenu::getNumKnown()
int RecipeMenu::getNumPages() int RecipeMenu::getNumPages()
{ {
int numKnown = dsq->continuity.recipes.size();//getNumKnown(); int numKnown = dsq->continuity.recipes.size();
int numPages = (numKnown/pageSize); int numPages = (numKnown/pageSize);
/*
for (int i = 0; i < dsq->continuity.recipes.size(); i++)
{
debugLog("r: " + dsq->continuity.recipes[i].result);
}
*/
std::ostringstream os; std::ostringstream os;
os << "numKnown: " << numKnown << " pagesSize: " << pageSize << " numPages: " << numPages; os << "numKnown: " << numKnown << " pagesSize: " << pageSize << " numPages: " << numPages;
@ -395,7 +390,7 @@ void RecipeMenu::createPage(int p)
{ {
RecipeMenuEntry *r = new RecipeMenuEntry(&dsq->continuity.recipes[i]); RecipeMenuEntry *r = new RecipeMenuEntry(&dsq->continuity.recipes[i]);
recipeMenuEntries.push_back(r); recipeMenuEntries.push_back(r);
//80 + num * 70
r->position = Vector(500-5, 65 + num * 70); r->position = Vector(500-5, 65 + num * 70);
dsq->game->addRenderObject(r, scroll->layer); dsq->game->addRenderObject(r, scroll->layer);
num++; num++;

View file

@ -169,8 +169,8 @@ void SceneEditor::changeDepth()
{ {
if (editingElement) if (editingElement)
{ {
//editingElement->parallax = 0.9;
//editingElement->followCamera = 0.001;
editingElement->followCamera = 0.9; editingElement->followCamera = 0.9;
editingElement->cull = false; editingElement->cull = false;
} }
@ -232,7 +232,7 @@ public:
if (doubleClickTimer > 0) if (doubleClickTimer > 0)
doubleClickTimer -= dt; doubleClickTimer -= dt;
Quad::onUpdate(dt); Quad::onUpdate(dt);
//if ()
if (dsq->game->sceneEditor.selectedEntity.name == selectedEntity.name if (dsq->game->sceneEditor.selectedEntity.name == selectedEntity.name
|| (entType != -1 && dsq->game->sceneEditor.selectedEntity.typeListIndex == entType)) || (entType != -1 && dsq->game->sceneEditor.selectedEntity.typeListIndex == entType))
@ -263,7 +263,7 @@ public:
{ {
dsq->game->sceneEditor.selectedEntity.setName(selectedEntity.name, selectedEntity.prevGfx); dsq->game->sceneEditor.selectedEntity.setName(selectedEntity.name, selectedEntity.prevGfx);
} }
//se_changedEntityType = true;
if (doubleClickTimer > 0) if (doubleClickTimer > 0)
{ {
doubleClickTimer = 0; doubleClickTimer = 0;
@ -438,11 +438,7 @@ void SceneEditor::addMainMenuItem(const std::string &label, int bid)
void SceneEditor::openMainMenu() void SceneEditor::openMainMenu()
{ {
/*
core->clearDebugMenu();
core->addDebugMenuItem("", bid);
core->doModalDebugMenu();
*/
if (core->getNestedMains()>1) if (core->getNestedMains()>1)
{ {
@ -472,12 +468,9 @@ void SceneEditor::openMainMenu()
addMainMenuItem("EDIT NODES (F7)", 108); addMainMenuItem("EDIT NODES (F7)", 108);
addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103); addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103);
addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130); addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130);
// addMainMenuItem("REFRESH DATAFILES (F11)", 117);
addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116); 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 BG GRADIENT", 110);
addMainMenuItem("SET MUSIC", 111); addMainMenuItem("SET MUSIC", 111);
addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112); addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112);
@ -541,7 +534,7 @@ void SceneEditor::init()
btnMenu->label->setText("Menu"); btnMenu->label->setText("Menu");
btnMenu->followCamera = 1; btnMenu->followCamera = 1;
btnMenu->alpha = 0; btnMenu->alpha = 0;
//btnMenu->event.set(MakeFunctionEvent(SceneEditor, openMainMenu));
dsq->game->addRenderObject(btnMenu, LR_HUD); dsq->game->addRenderObject(btnMenu, LR_HUD);
selectedEntityType = 0; selectedEntityType = 0;
@ -553,7 +546,7 @@ void SceneEditor::init()
text->followCamera = 1; text->followCamera = 1;
text->position = Vector(125,20,4.5); text->position = Vector(125,20,4.5);
//text->setAlign(ALIGN_CENTER);
dsq->game->addRenderObject(text, LR_HUD); dsq->game->addRenderObject(text, LR_HUD);
text->alpha = 0; text->alpha = 0;
selectedVariation = -1; selectedVariation = -1;
@ -565,13 +558,12 @@ void SceneEditor::init()
dsq->game->addRenderObject(boxPromo, LR_HUD); dsq->game->addRenderObject(boxPromo, LR_HUD);
on = false; on = false;
//addAction(MakeFunctionEvent(SceneEditor, addSpringPlant), KEY_K, 0);
addAction(MakeFunctionEvent(SceneEditor, loadScene), KEY_F1, 0); addAction(MakeFunctionEvent(SceneEditor, loadScene), KEY_F1, 0);
addAction(MakeFunctionEvent(SceneEditor, saveScene), KEY_F2, 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, moveToBack), KEY_Z, 0);
addAction(MakeFunctionEvent(SceneEditor, moveToFront), KEY_X, 0); addAction(MakeFunctionEvent(SceneEditor, moveToFront), KEY_X, 0);
@ -592,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, placeElement), KEY_SPACE, 1);
addAction(MakeFunctionEvent(SceneEditor, enterName), KEY_N, 0); addAction(MakeFunctionEvent(SceneEditor, enterName), KEY_N, 0);
@ -619,7 +605,7 @@ void SceneEditor::init()
addAction(MakeFunctionEvent(SceneEditor, generateLevel), KEY_F11, 0); addAction(MakeFunctionEvent(SceneEditor, generateLevel), KEY_F11, 0);
addAction(MakeFunctionEvent(SceneEditor, skinLevel), KEY_F12, 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, nextEntityType), KEY_RIGHT, 0);
addAction(MakeFunctionEvent(SceneEditor, prevEntityType), KEY_LEFT, 0); addAction(MakeFunctionEvent(SceneEditor, prevEntityType), KEY_LEFT, 0);
@ -651,17 +637,6 @@ void SceneEditor::init()
addAction(MakeFunctionEvent(SceneEditor, dumpObs), KEY_F8, 0); 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_ZOOMIN, KEY_PGUP);
addAction(ACTION_ZOOMOUT, KEY_PGDN); addAction(ACTION_ZOOMOUT, KEY_PGDN);
@ -796,10 +771,10 @@ void SceneEditor::alignVert()
void SceneEditor::createAquarian() void SceneEditor::createAquarian()
{ {
//if (dsq->mod.isActive()) return;
static bool inCreateAqurian = false; static bool inCreateAqurian = false;
if (inCreateAqurian) return; if (inCreateAqurian) return;
//if (dsq->game->isPaused()) return;
inCreateAqurian = true; inCreateAqurian = true;
std::string t = dsq->getUserInputString("Enter Aquarian:", ""); std::string t = dsq->getUserInputString("Enter Aquarian:", "");
stringToUpper(t); stringToUpper(t);
@ -815,7 +790,7 @@ void SceneEditor::createAquarian()
{ {
v = 1024+26; v = 1024+26;
} }
//ElementTemplate et = dsq->game->getElementTemplateForLetter(v);
dsq->game->createElement(v, startPos + Vector(64*i,0), this->bgLayer); dsq->game->createElement(v, startPos + Vector(64*i,0), this->bgLayer);
} }
inCreateAqurian = false; inCreateAqurian = false;
@ -887,7 +862,7 @@ void SceneEditor::toggleWarpAreaRender()
warpAreaRender->alpha.x = 0.5; warpAreaRender->alpha.x = 0.5;
else if (warpAreaRender->alpha.x >= 0.5f) else if (warpAreaRender->alpha.x >= 0.5f)
warpAreaRender->alpha.x = 0; warpAreaRender->alpha.x = 0;
//warpAreaRender->alpha.interpolateTo(1, 0.2);
} }
@ -990,7 +965,7 @@ void SceneEditor::editModeEntities()
//target->alpha.interpolateTo(0, 0.5); //target->alpha.interpolateTo(0, 0.5);
editType = ET_ENTITIES; editType = ET_ENTITIES;
//dsq->game->entityTypeList[curEntity].prevGfx
placer->setTexture(selectedEntity.prevGfx); placer->setTexture(selectedEntity.prevGfx);
placer->alpha = 0.5; placer->alpha = 0.5;
pathRender->alpha = 0; pathRender->alpha = 0;
@ -1018,7 +993,7 @@ Element *SceneEditor::getElementAtCursor()
{ {
if (e->life == 1) if (e->life == 1)
{ {
if (e->isCoordinateInside(dsq->getGameCursorPosition()))//, minSelectionSize if (e->isCoordinateInside(dsq->getGameCursorPosition()))
{ {
Vector v = dsq->getGameCursorPosition() - e->position; Vector v = dsq->getGameCursorPosition() - e->position;
int dist = v.getSquaredLength2D(); int dist = v.getSquaredLength2D();
@ -1109,11 +1084,8 @@ void SceneEditor::deleteSelected()
} }
else else
p->removeNode(selectedNode); p->removeNode(selectedNode);
/*
if (p->nodes.size() > 1)
p->nodes.resize(p->nodes.size()-1);
*/
//selectedIdx = -1;
} }
} }
} }
@ -1314,11 +1286,7 @@ void SceneEditor::updateEntitySaveData(Entity *editingEntity)
{ {
if (editingEntity) if (editingEntity)
{ {
/*
std::ostringstream os;
os << "oldPos (" << oldPosition.x << ", " << oldPosition.y << ")";
debugLog(os.str());
*/
EntitySaveData *d = dsq->game->getEntitySaveDataForEntity(editingEntity, oldPosition); EntitySaveData *d = dsq->game->getEntitySaveDataForEntity(editingEntity, oldPosition);
if (d) if (d)
{ {
@ -1326,22 +1294,18 @@ void SceneEditor::updateEntitySaveData(Entity *editingEntity)
os << "idx1: " << d->idx << " "; os << "idx1: " << d->idx << " ";
os << "idx2: " << editingEntity->entityTypeIdx << " "; os << "idx2: " << editingEntity->entityTypeIdx << " ";
os << "name: " << editingEntity->name; os << "name: " << editingEntity->name;
//os << "state: " << editingEntity->getState();
debugLog(os.str()); debugLog(os.str());
//debugLog("changing entity save data");
d->x = editingEntity->position.x; d->x = editingEntity->position.x;
d->y = editingEntity->position.y; d->y = editingEntity->position.y;
editingEntity->startPos = Vector(d->x, d->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; d->rot = editingEntity->rotation.z;
} }
else else
{ {
//debugLog("didn't get entity save data");
} }
} }
} }
@ -1410,7 +1374,7 @@ void SceneEditor::mouseButtonRightUp()
checkForRebuild(); checkForRebuild();
} }
state = ES_SELECTING; state = ES_SELECTING;
//dsq->game->reconstructGrid();
} }
@ -1616,7 +1580,7 @@ bool getGrassPixel(pngRawInfo *png, int x, int y)
{ {
if (x >= png->Width || y >= png->Height || x < 0 || y < 0) return false; 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; int c = (y*png->Width)*png->Components + x*png->Components;
if (png->Data[c] == 128 && if (png->Data[c] == 128 &&
png->Data[c+1] == 255 && png->Data[c+1] == 255 &&
@ -1690,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; float dist=0;
wallNormal = dsq->game->getWallNormal(t.worldVector(), 5, &dist, OT_MASK_BLACK); wallNormal = dsq->game->getWallNormal(t.worldVector(), 5, &dist, OT_MASK_BLACK);
offset = wallNormal*(-TILE_SIZE*0.6f); offset = wallNormal*(-TILE_SIZE*0.6f);
MathFunctions::calculateAngleBetweenVectorsInDegrees(Vector(0,0,0), wallNormal, rot); MathFunctions::calculateAngleBetweenVectorsInDegrees(Vector(0,0,0), wallNormal, rot);
rot = 180-(360-rot); rot = 180-(360-rot);
addTile = true; addTile = true;
//}
} }
if (addTile) if (addTile)
@ -1740,7 +1698,7 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
Element *e = dsq->getElement(i); Element *e = dsq->getElement(i);
if (e->templateIdx <= 4 && e->templateIdx >= 1) 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]++; cantUse[e->templateIdx-1]++;
} }
@ -1763,40 +1721,6 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
e->offset = offset; 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++; idx++;
if(idx > 4) if(idx > 4)
@ -1818,13 +1742,11 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
void SceneEditor::generateLevel() void SceneEditor::generateLevel()
{ {
//pngSetStandardOrientation(0);
std::string file=getMapTemplateFilename();
//pngInfo info;
//PNG_ALPHA
//errorLog("generate level"); std::string file=getMapTemplateFilename();
// Y R G B P
int maxX=0, maxY=0; int maxX=0, maxY=0;
const int YELLOW=0, RED=1, GREEN=2, BLUE=3, PURPLE=4, ORANGE=5, BROWN=6, MAX=7; const int YELLOW=0, RED=1, GREEN=2, BLUE=3, PURPLE=4, ORANGE=5, BROWN=6, MAX=7;
int firstColorX[MAX], firstColorY[MAX]; int firstColorX[MAX], firstColorY[MAX];
@ -1846,10 +1768,10 @@ void SceneEditor::generateLevel()
bool success = pngLoadRaw(file.c_str(), &rawinfo); bool success = pngLoadRaw(file.c_str(), &rawinfo);
if (success) if (success)
{ {
//dsq->elements.clear();
std::vector<Row> rows; std::vector<Row> rows;
std::vector<Vector> positions; std::vector<Vector> positions;
const int maxRowCount = 9999;//9999;//9999; const int maxRowCount = 9999;
int rowCount = 0; int rowCount = 0;
if (rawinfo.Components < 3) if (rawinfo.Components < 3)
{ {
@ -1857,7 +1779,7 @@ void SceneEditor::generateLevel()
} }
int scale = TILE_SIZE; int scale = TILE_SIZE;
int c = 0; int c = 0;
//for (int y = rawinfo.Height-1; y >= 0; y--)
for (int y = 0; y < rawinfo.Height; y++) for (int y = 0; y < rawinfo.Height; y++)
{ {
Vector lastElement; Vector lastElement;
@ -1902,7 +1824,7 @@ void SceneEditor::generateLevel()
} }
for (int i = 0; i < MAX; i++) for (int i = 0; i < MAX; i++)
{ {
//if (checkWarpPixel(rawinfo.Data, c, colorVects[i]))
bool p1, p2, p3; bool p1, p2, p3;
p1=p2=p3=false; p1=p2=p3=false;
int diff; int diff;
@ -1912,25 +1834,7 @@ void SceneEditor::generateLevel()
p2 = (diff < 5); p2 = (diff < 5);
diff = fabsf((colorVects[i].z*255) - rawinfo.Data[c+2]); diff = fabsf((colorVects[i].z*255) - rawinfo.Data[c+2]);
p3 = (diff < 5); 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) if (p1 && p2 && p3)
{ {
lastColorX[i] = x; lastColorX[i] = x;
@ -1942,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; c += rawinfo.Components;
if ((e==0 && firstRowElement) || (firstRowElement && rowCount >= maxRowCount && hasLastElement) if ((e==0 && firstRowElement) || (firstRowElement && rowCount >= maxRowCount && hasLastElement)
|| (firstRowElement && x == rawinfo.Width-1)) || (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) if (hasLastElement)
row.x2 = lastElement.x; row.x2 = lastElement.x;
//}
hasLastElement = false; hasLastElement = false;
firstRowElement = 0; firstRowElement = 0;
bool add = true; 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) if (add)
rows.push_back(row); rows.push_back(row);
} }
@ -2025,7 +1891,7 @@ void SceneEditor::generateLevel()
for (i = 0; i < rows.size(); i++) for (i = 0; i < rows.size(); i++)
{ {
int w = rows[i].x2 - rows[i].x1; int w = rows[i].x2 - rows[i].x1;
//int h = scale * rows[i].rows;
int useY = rows[i].y; int useY = rows[i].y;
if (rows[i].rows > 1) if (rows[i].rows > 1)
{ {
@ -2083,7 +1949,7 @@ void SceneEditor::generateLevel()
this->skinMinY = 4; this->skinMinY = 4;
this->skinMaxX = maxX; this->skinMaxX = maxX;
this->skinMaxY = maxY; this->skinMaxY = maxY;
//skinLevel(&rawinfo, 4, 4, maxX, maxY);
if (rawinfo.Data != NULL) if (rawinfo.Data != NULL)
free(rawinfo.Data); free(rawinfo.Data);
} }
@ -2246,9 +2112,7 @@ void SceneEditor::action(int id, int state)
this->bgLayer = newLayer; this->bgLayer = newLayer;
} }
/*
Vector multiSelectPoint, secondMultiSelectPoint;
*/
if (id == ACTION_MULTISELECT && this->state == ES_SELECTING) if (id == ACTION_MULTISELECT && this->state == ES_SELECTING)
{ {
if (state) if (state)
@ -2350,7 +2214,7 @@ void destroyEntityPage()
} }
if (se_grad) if (se_grad)
{ {
//se_grad->safeKill();
se_grad->setLife(1); se_grad->setLife(1);
se_grad->setDecayRate(10); se_grad->setDecayRate(10);
se_grad->fadeAlphaWithLife = 1; se_grad->fadeAlphaWithLife = 1;
@ -2373,8 +2237,8 @@ void createEntityPage()
destroyEntityPage(); destroyEntityPage();
se_grad = new Quad(); 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->scale = Vector(800, 500);
se_grad->position = Vector(400,350); se_grad->position = Vector(400,350);
se_grad->followCamera = 1; se_grad->followCamera = 1;
@ -2424,7 +2288,7 @@ void createEntityPage()
{ {
q->setWidthHeight((q->getWidth()*sizing) / q->getHeight(), sizing); q->setWidthHeight((q->getWidth()*sizing) / q->getHeight(), sizing);
} }
//q->setWidthHeight(sizing, sizing);
q->followCamera = 1; q->followCamera = 1;
dsq->game->addRenderObject(q, LR_HUD); dsq->game->addRenderObject(q, LR_HUD);
qs.push_back(q); qs.push_back(q);
@ -2826,7 +2690,7 @@ void SceneEditor::cloneSelectedElement()
Element *e = dsq->game->createElement(e1->templateIdx, placer->position + Vector(40,40), e1->bgLayer, e1); Element *e = dsq->game->createElement(e1->templateIdx, placer->position + Vector(40,40), e1->bgLayer, e1);
e->elementFlag = e1->elementFlag; e->elementFlag = e1->elementFlag;
e->setElementEffectByIndex(e1->getElementEffectIndex()); e->setElementEffectByIndex(e1->getElementEffectIndex());
//e->repeatTextureToFill(e1->isRepeatingTextureToFill());
} }
dsq->game->reconstructGrid(); dsq->game->reconstructGrid();
} }
@ -2890,7 +2754,7 @@ void SceneEditor::toggle(bool on)
movingEntity = 0; movingEntity = 0;
dsq->toggleCursor(true); dsq->toggleCursor(true);
dsq->setCursor(CURSOR_NORMAL); dsq->setCursor(CURSOR_NORMAL);
//core->flags.set(CF_CLEARBUFFERS);
dsq->darkLayer.toggle(false); dsq->darkLayer.toggle(false);
@ -2911,7 +2775,7 @@ void SceneEditor::toggle(bool on)
else else
{ {
btnMenu->alpha = 0; btnMenu->alpha = 0;
//dsq->game->reconstructGrid();
selectedElements.clear(); selectedElements.clear();
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
dsq->getRenderObjectLayer(LR_ELEMENTS1+i)->visible = true; dsq->getRenderObjectLayer(LR_ELEMENTS1+i)->visible = true;
@ -2928,7 +2792,7 @@ void SceneEditor::toggle(bool on)
dsq->game->avatar->enableInput(); dsq->game->avatar->enableInput();
text->alpha.interpolateTo(0, 0.2); text->alpha.interpolateTo(0, 0.2);
placer->alpha.interpolateTo(0, 0.2); placer->alpha.interpolateTo(0, 0.2);
//core->flags.unset(CF_CLEARBUFFERS);
dsq->darkLayer.toggle(true); dsq->darkLayer.toggle(true);
dsq->game->rebuildElementUpdateList(); dsq->game->rebuildElementUpdateList();
@ -2950,8 +2814,8 @@ void SceneEditor::updateText()
std::ostringstream os; std::ostringstream os;
os << dsq->game->sceneName << " bgL[" << bgLayer << "] (" << os << dsq->game->sceneName << " bgL[" << bgLayer << "] (" <<
(int)dsq->cameraPos.x << "," << (int)dsq->cameraPos.y << ") (" (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 << ")" << " "; << (int)dsq->getGameCursorPosition().x << "," << (int)dsq->getGameCursorPosition().y << ")" << " ";
switch(editType) switch(editType)
{ {
@ -3206,7 +3070,7 @@ void SceneEditor::update(float dt)
smallestDist = dist; smallestDist = dist;
selectedIdx = i; selectedIdx = i;
selectedNode = n; selectedNode = n;
//return;
} }
} }
} }
@ -3394,7 +3258,7 @@ void SceneEditor::update(float dt)
} }
else else
{ {
//editingElement->scale=oldScale + add;
editVec = (repeatScale ? oldRepeatScale : oldScale) + add; editVec = (repeatScale ? oldRepeatScale : oldScale) + add;
if (!uni && !repeatScale) if (!uni && !repeatScale)
{ {

View file

@ -50,12 +50,8 @@ SchoolFish::SchoolFish(const std::string &texname) : FlockEntity()
float randScale = float(rand()%200)/1000.0f; float randScale = float(rand()%200)/1000.0f;
scale = Vector(0.6f-randScale, 0.6f-randScale); 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.ensureData();
color.data->path.addPathNode(Vector(1,1,1), 0); color.data->path.addPathNode(Vector(1,1,1), 0);
color.data->path.addPathNode(Vector(1,1,1), 0.5); color.data->path.addPathNode(Vector(1,1,1), 0.5);
@ -72,30 +68,24 @@ SchoolFish::SchoolFish(const std::string &texname) : FlockEntity()
setEntityType(ET_ENEMY); setEntityType(ET_ENEMY);
canBeTargetedByAvatar = true; canBeTargetedByAvatar = true;
health = maxHealth = 1; health = maxHealth = 1;
//scale = Vector(0.5, 0.5);
avoidTime=0; avoidTime=0;
vel = Vector(-minUrgency, 0); vel = Vector(-minUrgency, 0);
setTexture(texname); setTexture(texname);
flockType = FLOCK_FISH; flockType = FLOCK_FISH;
//updateCull = -1;
updateCull = 4000; updateCull = 4000;
collideRadius = 20; 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); 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_LIZAP, false);
/*
setDamageTarget(DT_AVATAR_ENERGYBLAST, false);
setDamageTarget(DT_AVATAR_SHOCK, false);
*/
//setDamageTarget(DT_AVATAR_BITE, true);
// updateCull = 10248;
targetPriority = -1; targetPriority = -1;
setEatType(EAT_FILE, "SchoolFish"); setEatType(EAT_FILE, "SchoolFish");
@ -111,7 +101,7 @@ void SchoolFish::onEnterState(int action)
Entity::onEnterState(action); Entity::onEnterState(action);
if (action == STATE_DEAD) if (action == STATE_DEAD)
{ {
//rotation.interpolateTo(Vector(0,0,180), 2);
vel.setLength2D(vel.getLength2D()*-1); vel.setLength2D(vel.getLength2D()*-1);
oldFlockID = flock ? flock->flockID : -1; oldFlockID = flock ? flock->flockID : -1;
@ -119,24 +109,11 @@ void SchoolFish::onEnterState(int action)
doDeathEffects(0, false); doDeathEffects(0, false);
/*
alpha = 0;
alphaMod = 0;
*/
respawnTimer = 20 + rand()%20; respawnTimer = 20 + rand()%20;
alphaMod = 0; 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()) if (!isGoingToBeEaten())
{ {
@ -182,54 +159,27 @@ void SchoolFish::updateVelocity(Vector &accumulator)
vel.z = 0; vel.z = 0;
if (fabsf(vel.y) > fabsf(vel.x)) 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 inline
void SchoolFish::avoid(Vector &accumulator, Vector pos, bool inv) void SchoolFish::avoid(Vector &accumulator, Vector pos, bool inv)
{ {
//accumulator = Vector(0,0,0);
Vector change; Vector change;
if (inv) if (inv)
change = pos - this->position; change = pos - this->position;
else else
change = this->position - pos; change = this->position - pos;
//change = position;
//change -= this->position;
change.setLength2D(maxUrgency);
//change |= maxUrgency;
//change = Vector(100,0);
//avoidTime = 2; change.setLength2D(maxUrgency);
/*
std::ostringstream os;
os << "change(" << change.x << ", " << change.y << ")";
debugLog (os.str());
*/
accumulator += change; accumulator += change;
} }
@ -256,7 +206,6 @@ void SchoolFish::applyAvoidance(Vector &accumulator)
} }
//return;
if (avoidTime>0) return; if (avoidTime>0) return;
@ -285,7 +234,7 @@ void SchoolFish::applyAvoidance(Vector &accumulator)
const float tileMult = (float)TILE_SIZE / (float)obsCount; const float tileMult = (float)TILE_SIZE / (float)obsCount;
Vector change(obsSumX*tileMult, obsSumY*tileMult); Vector change(obsSumX*tileMult, obsSumY*tileMult);
change += position - t0.worldVector(); change += position - t0.worldVector();
//change |= 200;
float dist = change.getLength2D(); float dist = change.getLength2D();
float ratio = dist / radius; float ratio = dist / radius;
@ -346,7 +295,7 @@ void SchoolFish::applyCohesion(Vector &accumulator)
change = dsq->game->avatar->position - position; change = dsq->game->avatar->position - position;
change.setLength2D(maxUrgency*strengthCohesion); change.setLength2D(maxUrgency*strengthCohesion);
accumulator += change; accumulator += change;
//avoid(accumulator, dsq->game->avatar->position, true);
} }
} }
} }
@ -382,47 +331,8 @@ void SchoolFish::applySeparation(Vector &accumulator)
void SchoolFish::onUpdate(float dt) void SchoolFish::onUpdate(float dt)
{ {
BBGE_PROF(SchoolFish_onUpdate); 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; burstDelay -= dt;
@ -437,13 +347,8 @@ void SchoolFish::onUpdate(float dt)
if (this->layer < LR_ENTITIES) 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); setEntityType(ET_NEUTRAL);
collideRadius = 0; collideRadius = 0;
} }
@ -463,18 +368,7 @@ void SchoolFish::onUpdate(float dt)
} }
else 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); FlockEntity::onUpdate(dt);
@ -482,31 +376,7 @@ void SchoolFish::onUpdate(float dt)
dsq->game->handleShotCollisions(this); 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) if (true)
{ {
VectorSet newDirection; VectorSet newDirection;
@ -530,10 +400,6 @@ void SchoolFish::onUpdate(float dt)
applyAvoidance(accumulator); applyAvoidance(accumulator);
updateVelocity(accumulator); updateVelocity(accumulator);
/*
if (dsq->game->isValidTarget(this, 0))
doSpellAvoidance(dt, 96, dodgeAbility);
*/
Vector lastPosition = position; Vector lastPosition = position;
@ -542,57 +408,21 @@ void SchoolFish::onUpdate(float dt)
if (dsq->game->isObstructed(position)) if (dsq->game->isObstructed(position))
{ {
position = lastPosition; 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); updateVel2(dt);
/*
if (flipDelay > 0)
{
flipDelay -= dt;
if (flipDelay < 0)
{
flipDelay = 0;
}
}
*/
flipDelay = 0; flipDelay = 0;
//dir.normalize2D();
if (flipDelay <= 0) if (flipDelay <= 0)
{ {
const float amt = 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()) if (vel.x > amt && !isfh())
{ {
flipHorizontal(); 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)); float angle = atan2f(dir.x<0 ? -dir.y : dir.y, fabsf(dir.x));
angle = ((angle*180)/PI); angle = ((angle*180)/PI);
@ -617,7 +446,7 @@ void SchoolFish::onUpdate(float dt)
rotation = Vector(0,0,angle); rotation = Vector(0,0,angle);
//rotation.interpolateTo(Vector(0, 0, angle), 0);
} }
} }
@ -626,19 +455,6 @@ void SchoolFish::onUpdate(float dt)
void SchoolFish::onRender() void SchoolFish::onRender()
{ {
FlockEntity::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

@ -2108,7 +2108,7 @@ luaFunc(getNoteColor)
luaFunc(getRandNote) luaFunc(getRandNote)
{ {
//int note = lua_tointeger(L, 1);
luaReturnNum(dsq->getRandNote()); luaReturnNum(dsq->getRandNote());
} }
@ -2230,11 +2230,7 @@ luaFunc(shot_setOut)
Vector adjust = shot->velocity; Vector adjust = shot->velocity;
adjust.setLength2D(outness); adjust.setLength2D(outness);
shot->position += adjust; shot->position += adjust;
/*
std::ostringstream os;
os << "out(" << adjust.x << ", " << adjust.y << ")";
debugLog(os.str());
*/
} }
luaReturnNil(); luaReturnNil();
} }
@ -2693,7 +2689,7 @@ luaFunc(entity_getBoneLockEntity)
{ {
BoneLock *b = e->getBoneLock(); BoneLock *b = e->getBoneLock();
ent = b->entity; ent = b->entity;
//ent = e->boneLock.entity;
} }
luaReturnPtr(ent); luaReturnPtr(ent);
} }
@ -2953,11 +2949,7 @@ luaFunc(isWithin)
Vector v1 = getVector(L, 1); Vector v1 = getVector(L, 1);
Vector v2 = getVector(L, 3); Vector v2 = getVector(L, 3);
float dist = lua_tonumber(L, 5); 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; Vector d = v2-v1;
bool v = false; bool v = false;
if (d.isLength2DIn(dist)) if (d.isLength2DIn(dist))
@ -4049,29 +4041,13 @@ luaFunc(entity_isNearGround)
Vector v = dsq->game->getWallNormal(e->position, sampleArea); Vector v = dsq->game->getWallNormal(e->position, sampleArea);
if (!v.isZero()) if (!v.isZero())
{ {
//if (v.y < -0.5f && fabsf(v.x) < 0.4f)
if (v.y < 0 && fabsf(v.x) < 0.6f) if (v.y < 0 && fabsf(v.x) < 0.6f)
{ {
value = true; 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); luaReturnBool(value);
} }
@ -4680,7 +4656,7 @@ luaFunc(savePoint)
Vector position; Vector position;
if (p) if (p)
{ {
//dsq->game->avatar->moveToNode(p, 0, 0, 1);
position = p->nodes[0].position; position = p->nodes[0].position;
} }
@ -4818,7 +4794,7 @@ luaFunc(entity_damage)
if (e) if (e)
{ {
DamageData d; DamageData d;
//d.attacker = e;
d.attacker = lua_isuserdata(L, 2) ? entity(L, 2) : NULL; d.attacker = lua_isuserdata(L, 2) ? entity(L, 2) : NULL;
d.damage = lua_tonumber(L, 3); d.damage = lua_tonumber(L, 3);
d.damageType = (DamageType)lua_tointeger(L, 4); d.damageType = (DamageType)lua_tointeger(L, 4);
@ -4991,11 +4967,7 @@ luaFunc(decrFlag)
luaFunc(setFlag) 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)); dsq->continuity.setFlag(lua_tointeger(L, 1), lua_tointeger(L, 2));
luaReturnNil(); luaReturnNil();
} }
@ -5003,11 +4975,7 @@ luaFunc(setFlag)
luaFunc(getFlag) luaFunc(getFlag)
{ {
int v = 0; 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)); v = dsq->continuity.getFlag(lua_tointeger(L, 1));
luaReturnNum(v); luaReturnNum(v);
@ -6688,7 +6656,7 @@ luaFunc(playMusic)
luaFunc(playMusicStraight) luaFunc(playMusicStraight)
{ {
dsq->sound->setMusicFader(1,0); 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(); luaReturnNil();
} }
@ -6813,7 +6781,7 @@ luaFunc(entity_adjustPositionBySurfaceNormal)
e->position += v; e->position += v;
} }
e->setv(EV_CRAWLING, 0); e->setv(EV_CRAWLING, 0);
//e->setCrawling(false);
} }
luaReturnNil(); luaReturnNil();
} }
@ -6827,16 +6795,10 @@ luaFunc(entity_moveAlongSurface)
{ {
e->lastPosition = e->position; e->lastPosition = e->position;
//if (!e->position.isInterpolating())
{ {
/*
if (dsq->game->isObstructed(TileVector(e->position)))
{
e->moveOutOfWall();
}
*/
Vector v; Vector v;
if (e->ridingOnEntity) if (e->ridingOnEntity)
@ -6846,58 +6808,22 @@ luaFunc(entity_moveAlongSurface)
} }
else else
v = dsq->game->getWallNormal(e->position); v = dsq->game->getWallNormal(e->position);
//int outFromWall = lua_tointeger(L, 5);
int outFromWall = e->getv(EV_WALLOUT); int outFromWall = e->getv(EV_WALLOUT);
bool invisibleIn = e->isSittingOnInvisibleIn(); 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) if (invisibleIn)
outFromWall -= TILE_SIZE; outFromWall -= TILE_SIZE;
float t = 0.1; float t = 0.1;
e->offset.interpolateTo(v*outFromWall, t); 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 dt = lua_tonumber(L, 2);
float speed = lua_tonumber(L, 3); float speed = lua_tonumber(L, 3);
//int climbHeight = lua_tonumber(L, 4);
Vector mov; Vector mov;
if (e->surfaceMoveDir==1) if (e->surfaceMoveDir==1)
mov = Vector(v.y, -v.x); mov = Vector(v.y, -v.x);
@ -6910,49 +6836,8 @@ luaFunc(entity_moveAlongSurface)
e->vel = 0; 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);
} }
} }
@ -6961,7 +6846,7 @@ luaFunc(entity_moveAlongSurface)
luaFunc(entity_rotateToSurfaceNormal) luaFunc(entity_rotateToSurfaceNormal)
{ {
//ScriptedEntity *e = scriptedEntity(L);
Entity *e = entity(L); Entity *e = entity(L);
float t = lua_tonumber(L, 2); float t = lua_tonumber(L, 2);
int n = lua_tointeger(L, 3); int n = lua_tointeger(L, 3);
@ -6970,7 +6855,7 @@ luaFunc(entity_rotateToSurfaceNormal)
{ {
e->rotateToSurfaceNormal(t, n, rot); e->rotateToSurfaceNormal(t, n, rot);
} }
//Entity *e = entity(L);
luaReturnNil(); luaReturnNil();
} }
@ -7219,11 +7104,7 @@ luaFunc(entity_pullEntities)
Vector pull = pos - ent->position; Vector pull = pos - ent->position;
pull.setLength2D(float(len) * dt); pull.setLength2D(float(len) * dt);
ent->vel2 += pull; ent->vel2 += pull;
/*
std::ostringstream os;
os << "ent: " << ent->name << " + (" << pull.x << ", " << pull.y << ")";
debugLog(os.str());
*/
} }
} }
} }
@ -7267,7 +7148,7 @@ luaFunc(entity_isRidingOnEntity)
luaReturnPtr(NULL); luaReturnPtr(NULL);
} }
//entity_setProperty(me, EP_SOLID, true)
luaFunc(entity_isProperty) luaFunc(entity_isProperty)
{ {
Entity *e = entity(L); Entity *e = entity(L);
@ -7279,7 +7160,7 @@ luaFunc(entity_isProperty)
luaReturnBool(v); luaReturnBool(v);
} }
//entity_setProperty(me, EP_SOLID, true)
luaFunc(entity_setProperty) luaFunc(entity_setProperty)
{ {
Entity *e = entity(L); Entity *e = entity(L);
@ -7335,10 +7216,7 @@ luaFunc(entity_hurtTarget)
d.damage = lua_tointeger(L, 2); d.damage = lua_tointeger(L, 2);
e->getTargetEntity(e->currentEntityTarget)->damage(d); e->getTargetEntity(e->currentEntityTarget)->damage(d);
} }
/*
if (e && e->getTargetEntity())
e->getTargetEntity(e->currentEntityTarget)->damage(lua_tointeger(L, 2), 0, e);
*/
luaReturnNil(); luaReturnNil();
} }
@ -8194,7 +8072,7 @@ luaFunc(entity_getTarget)
if (e) if (e)
{ {
retEnt = e->getTargetEntity(lua_tonumber(L, 2)); retEnt = e->getTargetEntity(lua_tonumber(L, 2));
//e->activate();
} }
luaReturnPtr(retEnt); luaReturnPtr(retEnt);
} }
@ -8815,11 +8693,7 @@ luaFunc(entity_getFlag)
luaFunc(isFlag) luaFunc(isFlag)
{ {
int v = 0; 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; bool f = false;
if (lua_isnumber(L, 1)) if (lua_isnumber(L, 1))
{ {
@ -8831,11 +8705,7 @@ luaFunc(isFlag)
v = dsq->continuity.getFlag(getString(L, 1)); v = dsq->continuity.getFlag(getString(L, 1));
f = (v == lua_tointeger(L, 2)); f = (v == lua_tointeger(L, 2));
} }
/*
int f = 0;
dsq->continuity.getFlag(lua_tostring(L, 1));
*/
luaReturnBool(f); luaReturnBool(f);
} }

View file

@ -39,7 +39,7 @@ ScriptedEntity::ScriptedEntity(const std::string &scriptName, Vector position, E
strandSpacing = 10; strandSpacing = 10;
animKeyFunc = true; animKeyFunc = true;
canShotHitFunc = true; canShotHitFunc = true;
//runningActivation = false;
setEntityType(et); setEntityType(et);
myTimer = 0; myTimer = 0;
@ -231,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) 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; updateCull = -1;
if (texture.empty()) if (texture.empty())
@ -326,7 +326,7 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
e->sound("RockHit"); e->sound("RockHit");
dsq->spawnParticleEffect("rockhit", e->position, 0, 0); dsq->spawnParticleEffect("rockhit", e->position, 0, 0);
} }
//e->push(vel, 0.2, 500, 0);
Vector add = vel; Vector add = vel;
add.setLength2D(5000*dt); add.setLength2D(5000*dt);
e->vel += add; e->vel += add;
@ -354,7 +354,7 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
} }
else if (!dist.isLength2DIn(800)) else if (!dist.isLength2DIn(800))
{ {
// break;
vel.setZero(); vel.setZero();
dsq->game->avatar->pullTarget->stopPull(); dsq->game->avatar->pullTarget->stopPull();
dsq->game->avatar->pullTarget = 0; dsq->game->avatar->pullTarget = 0;
@ -390,7 +390,7 @@ void ScriptedEntity::updateStrands(float dt)
if (strands.empty()) return; if (strands.empty()) return;
float angle = rotation.z; float angle = rotation.z;
angle = (PI*(360-(angle-90)))/180.0; angle = (PI*(360-(angle-90)))/180.0;
//angle = (180*angle)/PI;
float sz = (strands.size()/2); float sz = (strands.size()/2);
for (int i = 0; i < strands.size(); i++) for (int i = 0; i < strands.size(); i++)
{ {
@ -642,7 +642,7 @@ void ScriptedEntity::songNoteDone(int note, float len)
void ScriptedEntity::becomeSolid() void ScriptedEntity::becomeSolid()
{ {
//vel = 0;
float oldRot = 0; float oldRot = 0;
bool doRot=false; bool doRot=false;
Vector n = dsq->game->getWallNormal(position); Vector n = dsq->game->getWallNormal(position);

View file

@ -101,7 +101,7 @@ protected:
void onAlwaysUpdate(float dt); void onAlwaysUpdate(float dt);
void updateStrands(float dt); void updateStrands(float dt);
bool animKeyFunc; bool animKeyFunc;
//void onPathEnd();
void onExitTimer(); void onExitTimer();
float myTimer; float myTimer;

View file

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

View file

@ -75,9 +75,9 @@ struct ShotData
class Shot : public Quad, public Segmented class Shot : public Quad, public Segmented
{ {
public: 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(); Shot();
//void destroy();
void reflectFromEntity(Entity *e); void reflectFromEntity(Entity *e);
void setParticleEffect(const std::string &particleEffect); void setParticleEffect(const std::string &particleEffect);
typedef std::vector<Shot*> Shots; typedef std::vector<Shot*> Shots;
@ -156,7 +156,7 @@ public:
Beam(Vector pos, float angle); Beam(Vector pos, float angle);
typedef std::list<Beam*> Beams; typedef std::list<Beam*> Beams;
static Beams beams; static Beams beams;
//static void targetDied(Entity *t);
static void killAllBeams(); static void killAllBeams();
float angle; float angle;

View file

@ -68,7 +68,7 @@ void Spore::destroy()
void Spore::onEndOfLife() void Spore::onEndOfLife()
{ {
//::onEndLife();
spores.remove(this); spores.remove(this);
} }

View file

@ -28,15 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Bubble::Bubble() : Quad() Bubble::Bubble() : Quad()
{ {
setTexture("particles/bubble"); setTexture("particles/bubble");
/*
this->life = 10;
this->decayRate = 1;
*/
this->alpha = 0.5f; this->alpha = 0.5f;
this->speed = rand()%10+20; this->speed = rand()%10+20;
this->width = 32; this->width = 32;
this->height = 32; this->height = 32;
//this->scale = Vector(0.5f, 0.5f, 0.5f);
} }
void Bubble::onUpdate(float dt) void Bubble::onUpdate(float dt)
@ -64,7 +61,7 @@ void Intro2::applyState()
ActionMapper::clearActions(); ActionMapper::clearActions();
//addAction(MakeFunctionEvent(Intro2, skipIntro), KEY_ESCAPE, 0);
dsq->subtitlePlayer.show(0.5f); dsq->subtitlePlayer.show(0.5f);
@ -78,8 +75,7 @@ void Intro2::applyState()
dsq->overlay->alpha.interpolateTo(0, 40); dsq->overlay->alpha.interpolateTo(0, 40);
dsq->toggleCursor(0); dsq->toggleCursor(0);
// OLD WAY of skipping
//dsq->user.control.actionSet.importAction(this, "Escape", ACTION_ESC);
Quad *frame4 = new Quad; Quad *frame4 = new Quad;
{ {
@ -114,92 +110,7 @@ void Intro2::applyState()
while (dsq->sound->isPlayingVoice()) while (dsq->sound->isPlayingVoice())
dsq->main(FRAME_TIME); 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(); emitter->stop();
emitter2->start(); emitter2->start();
@ -245,8 +156,8 @@ void GameOver::applyState()
const bool frameOutputGameOver = false; const bool frameOutputGameOver = false;
core->sound->fadeMusic(SFT_OUT, 1); core->sound->fadeMusic(SFT_OUT, 1);
//float transTime = 0.01;
//core->sound->fadeOut(transTime);
StateObject::applyState(); StateObject::applyState();
core->globalScale = Vector(1,1); core->globalScale = Vector(1,1);
core->globalScaleChanged(); core->globalScaleChanged();
@ -268,18 +179,6 @@ void GameOver::applyState()
} }
addRenderObject(q); 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; 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)); 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; dsq->overlay->alpha = 0;
//core->main(0.1);
//frame3->alpha.interpolateTo(0, GO_ANIM_TIME);
core->main(GO_ANIM_TIME); core->main(GO_ANIM_TIME);
frame4->alpha.interpolateTo(0, GO_ANIM_TIME); frame4->alpha.interpolateTo(0, GO_ANIM_TIME);
@ -351,23 +249,17 @@ void GameOver::applyState()
core->main(GO_ANIM_TIME); core->main(GO_ANIM_TIME);
core->main(1.5); core->main(1.5);
//core->sound->streamMusic("Requiem", 0);
if (dsq->recentSaveSlot != -1) if (dsq->recentSaveSlot != -1)
{ {
// game over recent save load
dsq->sound->stopMusic(); dsq->sound->stopMusic();
float transferSeconds = dsq->continuity.seconds; float transferSeconds = dsq->continuity.seconds;
dsq->continuity.loadFile(dsq->recentSaveSlot); 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->continuity.seconds = transferSeconds;
dsq->game->transitionToScene(dsq->game->sceneToLoad); dsq->game->transitionToScene(dsq->game->sceneToLoad);
@ -376,20 +268,16 @@ void GameOver::applyState()
dsq->title(); dsq->title();
//core->main(transTime);
if (frameOutputGameOver) if (frameOutputGameOver)
core->frameOutputMode = false; core->frameOutputMode = false;
/*
addAction(MakeFunctionEvent(GameOver, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0);
timer = 1;
*/
} }
void GameOver::removeState() void GameOver::removeState()
{ {
//dsq->screenTransition->capture();
StateObject::removeState(); StateObject::removeState();
frame3 = frame2 = frame1 = 0; frame3 = frame2 = frame1 = 0;
} }
@ -410,30 +298,7 @@ void GameOver::update(float dt)
timer = 0; 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 namespace NagStuff
@ -442,10 +307,7 @@ namespace NagStuff
int ic=0; int ic=0;
const int numScreens = 11; const int numScreens = 11;
float screenTimer = 0; float screenTimer = 0;
/*
const float screenTime = 7;
const float nagFadeTime = 3;
*/
const float screenTime = 3; const float screenTime = 3;
const float nagFadeTime = 1; const float nagFadeTime = 1;
}; };
@ -489,8 +351,8 @@ void Nag::applyState()
AquariaMenuItem *buy = new AquariaMenuItem(); AquariaMenuItem *buy = new AquariaMenuItem();
buy->followCamera = 1; buy->followCamera = 1;
buy->position = Vector(630, 400); //300, 540); buy->position = Vector(630, 400);
//buy->setLabel("Buy");
buy->useGlow("particles/glow", 480, 128); buy->useGlow("particles/glow", 480, 128);
buy->event.set(MakeFunctionEvent(Nag, onBuy)); buy->event.set(MakeFunctionEvent(Nag, onBuy));
buy->setDirMove(DIR_LEFT, buy); buy->setDirMove(DIR_LEFT, buy);
@ -501,7 +363,7 @@ void Nag::applyState()
AquariaMenuItem *exit = new AquariaMenuItem(); AquariaMenuItem *exit = new AquariaMenuItem();
exit->followCamera = 1; exit->followCamera = 1;
exit->position = Vector(732, 543); exit->position = Vector(732, 543);
//exit->setLabel("Exit");
exit->useGlow("particles/glow", 128, 64); exit->useGlow("particles/glow", 128, 64);
exit->event.set(MakeFunctionEvent(Nag, onExit)); exit->event.set(MakeFunctionEvent(Nag, onExit));
exit->setDirMove(DIR_LEFT, exit); exit->setDirMove(DIR_LEFT, exit);
@ -518,7 +380,7 @@ void Nag::applyState()
ic = 0; ic = 0;
irot.clear(); irot.clear();
//Vector framePos(235, 405);
Vector framePos(240, 400); Vector framePos(240, 400);
Vector frameScale(0.98, 0.98); Vector frameScale(0.98, 0.98);

View file

@ -68,7 +68,7 @@ protected:
bool done; bool done;
Precacher cachy; Precacher cachy;
//void update(float dt);
}; };
class Intro2 : public StateObject class Intro2 : public StateObject

View file

@ -126,11 +126,7 @@ const int FLAG_MINIBOSS_END = 720;
#endif #endif
StatsAndAchievements::StatsAndAchievements() StatsAndAchievements::StatsAndAchievements()
{ {
/*
std::ostringstream os;
os << "app_id: " << SteamUtils()->GetAppID();
debugLog(os.str());
*/
#ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL #ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL
unlockedDisplayTimestamp = -1.0f; unlockedDisplayTimestamp = -1.0f;
@ -140,21 +136,7 @@ StatsAndAchievements::StatsAndAchievements()
statsValid = false; statsValid = false;
storeStats = 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 #ifdef _MSC_VER
#pragma warning( pop ) #pragma warning( pop )
@ -379,11 +361,11 @@ void StatsAndAchievements::OnGameStateChange( EClientGameState eNewState )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StatsAndAchievements::EvaluateAchievement( Achievement &achievement ) void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
{ {
//debugLog("Eval...");
// Already have it? // Already have it?
if ( achievement.achieved ) { if ( achievement.achieved ) {
//debugLog(std::string(achievement.chAchievementID) + " was already achieved");
return; return;
} }
@ -423,11 +405,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
|| (dsq->continuity.recipes[i].result == "VeggieSoup" && didVeggieSoup)) || (dsq->continuity.recipes[i].result == "VeggieSoup" && didVeggieSoup))
{} {}
else { else {
/*
std::ostringstream os;
os << "doesn't know recipe: " << dsq->continuity.recipes[i].result;
debugLog(os.str());
*/
knowAll = false; knowAll = false;
} }
} }
@ -442,20 +420,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
case ACH_MASS_TRANSIT: 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 if (dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL01) > 0
&& dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL02) > 0 && dsq->continuity.getFlag(FLAG_TRANSTURTLE_VEIL02) > 0
@ -481,11 +446,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
{ {
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i); WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
if (!tile->revealed && (nocasecmp(tile->name, "thirteenlair") != 0)) { if (!tile->revealed && (nocasecmp(tile->name, "thirteenlair") != 0)) {
/*
std::ostringstream os;
os << "does not have: " << tile->name;
debugLog(os.str());
*/
hasAllMap = false; hasAllMap = false;
break; break;
} }
@ -506,7 +467,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
break; break;
case ACH_AQUIRE_ALL_SONGS: case ACH_AQUIRE_ALL_SONGS:
//debugLog("eval ACH_AQUIRE_ALL_SONGS");
if (dsq->continuity.hasSong(SONG_BIND) if (dsq->continuity.hasSong(SONG_BIND)
&& dsq->continuity.hasSong(SONG_SHIELDAURA) && dsq->continuity.hasSong(SONG_SHIELDAURA)
&& dsq->continuity.hasSong(SONG_LI) && dsq->continuity.hasSong(SONG_LI)
@ -518,14 +479,14 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
&& dsq->continuity.hasSong(SONG_FISHFORM) && dsq->continuity.hasSong(SONG_FISHFORM)
&& dsq->continuity.hasSong(SONG_SPIRITFORM)) && dsq->continuity.hasSong(SONG_SPIRITFORM))
{ {
//errorLog("ACH_AQUIRE_ALL_SONGS!");
UnlockAchievement(achievement); UnlockAchievement(achievement);
} }
break; break;
// gameplay // gameplay
case ACH_DEFEAT_PRIESTS: case ACH_DEFEAT_PRIESTS:
//if (dsq->continuity.getFlag(FLAG_MINIBOSS_PRIESTS) > 0)
if (dsq->continuity.hasSong(SONG_SPIRITFORM)) if (dsq->continuity.hasSong(SONG_SPIRITFORM))
{ {
UnlockAchievement(achievement); UnlockAchievement(achievement);
@ -618,8 +579,8 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
break; break;
case ACH_MOMMY_AND_DADDY: 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) if (dsq->continuity.getFlag(FLAG_SUNKENCITY_PUZZLE) >= SUNKENCITY_BOSSDONE)
{ {
UnlockAchievement(achievement); UnlockAchievement(achievement);
@ -723,16 +684,8 @@ void StatsAndAchievements::entityDied(Entity *eDead)
biteDeathComboCounter = 0; 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) void StatsAndAchievements::update(float dt)
@ -748,15 +701,11 @@ void StatsAndAchievements::update(float dt)
if (!rodeEkkritToTheStars) { if (!rodeEkkritToTheStars) {
if (!dsq->game->isPaused() && b->on) { if (!dsq->game->isPaused() && b->on) {
//debugLog("boneLock->entity->name: " + b->entity->name);
if (b->entity->name == "ekkrit") { if (b->entity->name == "ekkrit") {
ridingEkkritTime += dt; ridingEkkritTime += dt;
/*
std::ostringstream os;
os << "ridingEkkritTime: " << ridingEkkritTime;
debugLog(os.str());
*/
if (ridingEkkritTime >= ridingEkkritTimeMax) { if (ridingEkkritTime >= ridingEkkritTimeMax) {
rodeEkkritToTheStars = true; rodeEkkritToTheStars = true;

View file

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

View file

@ -58,8 +58,8 @@ void Strand::onRender()
glLineWidth(1); glLineWidth(1);
glBegin(GL_LINE_STRIP); 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 r = (unsigned int)(color.x * (255<<8));
unsigned int g = (unsigned int)(color.y * (255<<8)); unsigned int g = (unsigned int)(color.y * (255<<8));
unsigned int b = (unsigned int)(color.z * (255<<8)); unsigned int b = (unsigned int)(color.z * (255<<8));

View file

@ -48,7 +48,7 @@ void StringBank::load()
void StringBank::_load(const std::string &file) void StringBank::_load(const std::string &file)
{ {
//debugLog("StringBank::load("+file+")");
InStream in(file.c_str()); InStream in(file.c_str());
@ -59,9 +59,7 @@ void StringBank::_load(const std::string &file)
{ {
std::getline(in, line); std::getline(in, line);
//std::ostringstream os;
//os << idx << ": StringBank Read Line: " << line;
//debugLog(os.str());
if (!line.empty() && line[0] == ' ') if (!line.empty() && line[0] == ' ')
line = line.substr(1, line.size()); 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/DebugFont.h"
#include "../BBGE/BitmapFont.h" #include "../BBGE/BitmapFont.h"
//#define DISABLE_SUBS
SubtitlePlayer::SubtitlePlayer() SubtitlePlayer::SubtitlePlayer()
{ {
@ -130,7 +130,7 @@ void SubtitlePlayer::update(float dt)
// set text // set text
debugLog(subLines[curLine].line); debugLog(subLines[curLine].line);
dsq->subtext->scrollText(subLines[curLine].line, 0.02); dsq->subtext->scrollText(subLines[curLine].line, 0.02);
//dsq->subtext->scrollText(subLines[curLine].line, 0.1);
// advance // advance
curLine++; curLine++;
} }

View file

@ -114,7 +114,7 @@ void ToolTip::onUpdate(float dt)
break; break;
} }
const float t = 0.0;//0.4;//0.05; const float t = 0.0;
if (in && (required || dsq->user.control.toolTipsOn)) if (in && (required || dsq->user.control.toolTipsOn))
{ {
back->alpha.interpolateTo(1, t); 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() void UserSettings::save()
{ {
//initInputCodeMap();
XMLDocument doc; XMLDocument doc;
{ {
@ -268,7 +268,7 @@ void UserSettings::save()
doc.SaveFile(userSettingsFilename.c_str()); doc.SaveFile(userSettingsFilename.c_str());
#endif #endif
//clearInputCodeMap();
} }
static void readInt(XMLElement *xml, const char *elem, const char *att, int *toChange) 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(); control.actionSet.clearActions();
//initInputCodeMap();
control.actionSet.addActionInput("lmb"); control.actionSet.addActionInput("lmb");
control.actionSet.addActionInput("rmb"); 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, "FpsSmoothing", "v", &video.fpsSmoothing);
/*
readInt(xml_video, "Parallax", "on", &video.parallaxOn);
*/
XMLElement *xml_parallax = xml_video->FirstChildElement("Parallax"); XMLElement *xml_parallax = xml_video->FirstChildElement("Parallax");
if (xml_parallax) if (xml_parallax)
{ {
@ -534,7 +532,7 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
network.masterServer = serv; network.masterServer = serv;
} }
//clearInputCodeMap();
if (system.locale.empty()) if (system.locale.empty())
{ {

View file

@ -50,31 +50,30 @@ void spawnWaterFontParticle(RenderObject *me, Vector position, int size, float l
q->color.data->path.addPathNode(Vector(0,0,1),1.0); q->color.data->path.addPathNode(Vector(0,0,1),1.0);
q->color.startPath(t); q->color.startPath(t);
//q->color = Vector(1, 0.5, 0);
q->alpha.ensureData(); q->alpha.ensureData();
q->alpha.data->path.addPathNode(0, 0); q->alpha.data->path.addPathNode(0, 0);
q->alpha.data->path.addPathNode(0.2, 0.5); q->alpha.data->path.addPathNode(0.2, 0.5);
q->alpha.data->path.addPathNode(0, 1.0); q->alpha.data->path.addPathNode(0, 1.0);
q->alpha.startPath(t); q->alpha.startPath(t);
q->velocity = Vector(sinf(angle)*spd,cosf(angle)*spd); q->velocity = Vector(sinf(angle)*spd,cosf(angle)*spd);
//q->velocity += vel;
q->setLife(1.0); q->setLife(1.0);
q->setDecayRate(1.0f/t); q->setDecayRate(1.0f/t);
q->rotation.z = rand()%360; q->rotation.z = rand()%360;
q->setWidthHeight(size, size); q->setWidthHeight(size, size);
q->position = position; q->position = position;
q->cull = false; q->cull = false;
//q->influenced = 16;
dsq->game->addRenderObject(q, layer); 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; const float interval = 0.08;
void WaterFont::onUpdate(float dt) void WaterFont::onUpdate(float dt)
{ {
@ -89,11 +88,7 @@ void WaterFont::onUpdate(float dt)
for (int i = 0; i < dist; i++) 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); 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); Vector d(rand()%200-100,rand()%200-100);
d *= 0.01f; d *= 0.01f;
spawnWaterFontParticle(this, p, 64, 1.2, LR_PARTICLES); spawnWaterFontParticle(this, p, 64, 1.2, LR_PARTICLES);

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 "WaterSurfaceRender.h"
#include "DSQ.h" #include "DSQ.h"
#include "Game.h" #include "Game.h"
#include "Avatar.h" #include "Avatar.h"
/*
{
public:
WaterSurfaceRender();
void render();
protected:
void onRender();
};
*/
namespace WaterSurfaceRenderStuff namespace WaterSurfaceRenderStuff
{ {
@ -44,7 +17,7 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
{ {
color = baseColor; color = baseColor;
cull = false; cull = false;
//alpha = 0.98;
alpha = 0.75; alpha = 0.75;
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited()) 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 = new Quad("water/water-line", Vector(0,0));
qLine->repeatTextureToFill(1); qLine->repeatTextureToFill(1);
qLine->cull = false; qLine->cull = false;
dsq->game->addRenderObject(qLine, LR_WATERSURFACE2); dsq->game->addRenderObject(qLine, LR_WATERSURFACE2);
qLine2 = 0; 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 = new Quad("missingimage", Vector(0,0));
//qSurface->parentManagedPointer = 1;
qSurface->cull = false; qSurface->cull = false;
qSurface->repeatTextureToFill(1); qSurface->repeatTextureToFill(1);
dsq->game->addRenderObject(qSurface, LR_WATERSURFACE2); dsq->game->addRenderObject(qSurface, LR_WATERSURFACE2);
@ -91,14 +48,14 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
void WaterSurfaceRender::render() void WaterSurfaceRender::render()
{ {
//if (dsq->frameBuffer.isInited())
if (dsq->game->waterLevel.x > 0) if (dsq->game->waterLevel.x > 0)
{ {
qLine->alpha = qSurface->alpha = 1; qLine->alpha = qSurface->alpha = 1;
//qSurface->alpha = 0;
position.x = core->screenCenter.x; position.x = core->screenCenter.x;
position.y = dsq->game->waterLevel.x; position.y = dsq->game->waterLevel.x;
@ -117,7 +74,7 @@ void WaterSurfaceRender::render()
} }
offset.y = (height*scale.y); offset.y = (height*scale.y);
//offset.y += 10;
offset.y -= 40*scale.y; offset.y -= 40*scale.y;
@ -125,11 +82,7 @@ void WaterSurfaceRender::render()
qLine->alphaMod = 0.5; qLine->alphaMod = 0.5;
qLine->setWidth(width); qLine->setWidth(width);
/*
qLine2->position = position + offset;
qLine2->alphaMod = 0.5;
qLine2->width = this->width;
*/
qSurface->position = position+offset; qSurface->position = position+offset;
qSurface->scale = scale.y; qSurface->scale = scale.y;
@ -137,43 +90,30 @@ void WaterSurfaceRender::render()
qSurface->setWidthHeight(width, height); qSurface->setWidthHeight(width, height);
float bit = core->cameraPos.x/300.0f; float bit = core->cameraPos.x/300.0f;
//qSurface->texOff.x = bit;
qLine->texOff.x = bit; qLine->texOff.x = bit;
//qSurface->refreshRepeatTextureToFill();
qLine->refreshRepeatTextureToFill(); qLine->refreshRepeatTextureToFill();
/*
qLine2->texOff.x = bit;
qLine2->refreshRepeatTextureToFill();
*/
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited()) if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
{ {
qSurface->alphaMod = 0.5; qSurface->alphaMod = 0.5;
Quad::render(); Quad::render();
//qLine->alpha = qSurface->alpha = 0;
} }
else else
{ {
//color = baseColor;
Quad::render(); 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 else
{ {
@ -217,22 +157,13 @@ void WaterSurfaceRender::onRender()
Quad::onRender(); Quad::onRender();
/*
glTranslatef(0, -height - 20);
height = 40;
Quad::onRender();
*/
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
} }
else else
{ {
/*
upperLeftTextureCoordinates.x = 0;
lowerRightTextureCoordinates.x = core->frameBuffer.getWidthP();
*/
glColor4f(0.4, 0.7, 0.8, 0.2); glColor4f(0.4, 0.7, 0.8, 0.2);
Quad::onRender(); Quad::onRender();
@ -241,18 +172,6 @@ void WaterSurfaceRender::onRender()
RenderObject::lastTextureApplied = 0; 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);
} }

View file

@ -136,14 +136,7 @@ void Web::onUpdate(float dt)
} }
if (hit) 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; e->vel /= float(e->getv(EV_WEBSLOW)) * dt;
} }
} }
@ -154,10 +147,10 @@ void Web::onUpdate(float dt)
void Web::onRender() void Web::onRender()
{ {
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
//glDisable(GL_BLEND);
glLineWidth(4); glLineWidth(4);
//glDisable(GL_CULL_FACE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_LINES); glBegin(GL_LINES);

View file

@ -157,28 +157,19 @@ public:
BeaconRender(BeaconData *beaconData) : Quad(), beaconData(beaconData) BeaconRender(BeaconData *beaconData) : Quad(), beaconData(beaconData)
{ {
renderQuad = false; renderQuad = false;
setTexture("gui/minimap/ripple"); //"particles/softring"); // or whatever setTexture("gui/minimap/ripple");
position = beaconData->pos; position = beaconData->pos;
truePosition = beaconData->pos; truePosition = beaconData->pos;
followCamera = 1; followCamera = 1;
/*
scale = Vector(0.2, 0.2);
scale.interpolateTo(Vector(0.5, 0.5), 0.75, -1, 1, 1);
*/
alpha = 0.5; alpha = 0.5;
color = beaconData->color; color = beaconData->color;
/*
pe = new ParticleEffect();
pe->load("sparkle");
pe->followCamera = 1;
pe->start();
core->addRenderObject(pe, LR_PARTICLES);
*/
spawnBitTimer = 0; spawnBitTimer = 0;
} }
//float spawnBitTimer;
Vector truePosition; Vector truePosition;
ParticleEffect *pe; ParticleEffect *pe;
@ -188,7 +179,7 @@ public:
void render() void render()
{ {
//setProperPosition();
Quad::render(); Quad::render();
} }
@ -221,7 +212,7 @@ protected:
{ {
Quad::onUpdate(dt); Quad::onUpdate(dt);
//setProperPosition();
if (!dsq->game->worldMapRender->isOn()) return; if (!dsq->game->worldMapRender->isOn()) return;
@ -244,7 +235,7 @@ protected:
int x = sinf(radius)*len; int x = sinf(radius)*len;
int y = cosf(radius)*len; int y = cosf(radius)*len;
//truePosition +
float t = 0.75; float t = 0.75;
WorldMapBoundQuad *q = new WorldMapBoundQuad(Vector(x, y, 0)); WorldMapBoundQuad *q = new WorldMapBoundQuad(Vector(x, y, 0));
q->setTexture("particles/glow"); q->setTexture("particles/glow");
@ -257,16 +248,15 @@ protected:
q->color = color; q->color = color;
q->scale = Vector(pscale, pscale); q->scale = Vector(pscale, pscale);
//q->fadeAlphaWithLife = 1;
q->setLife(1); q->setLife(1);
q->setDecayRate(1.0f/t); q->setDecayRate(1.0f/t);
q->setBlendType(BLEND_ADD); q->setBlendType(BLEND_ADD);
addChild(q, PM_POINTER); addChild(q, PM_POINTER);
//std::ostringstream os;
//os << "children: " << children.size();
//debugLog(os.str());
} }
else else
{ {
@ -276,9 +266,6 @@ protected:
/*
*/
} }
}; };
@ -295,41 +282,26 @@ public:
blinkTimer = 0; blinkTimer = 0;
alphaMod = 0.66; alphaMod = 0.66;
canMove = gemData->canMove; canMove = gemData->canMove;
//canMove = true;
//gemData->userString = "HI THERE!";
std::string useString = gemData->userString; 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 = new TTFText(&dsq->fontArialSmall);
text->offset = Vector(0, 4); //Vector(0,5); text->offset = Vector(0, 4);
text->setText(useString); text->setText(useString);
text->setAlign(ALIGN_CENTER); text->setAlign(ALIGN_CENTER);
textBG = new RoundedRect(); textBG = new RoundedRect();
textBG->setWidthHeight(text->getActualWidth() + 20, 25, 10); // 30 textBG->setWidthHeight(text->getActualWidth() + 20, 25, 10);
textBG->alpha = 0; textBG->alpha = 0;
textBG->followCamera = 1; textBG->followCamera = 1;
game->addRenderObject(textBG, LR_WORLDMAPHUD); game->addRenderObject(textBG, LR_WORLDMAPHUD);
textBG->addChild(text, PM_POINTER); textBG->addChild(text, PM_POINTER);
//game->addRenderObject(text, LR_WORLDMAPHUD);
} }
void destroy() void destroy()
@ -348,24 +320,8 @@ public:
{ {
this->blink = blink; 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; bool canMove;
protected: protected:
@ -373,7 +329,7 @@ protected:
float blinkTimer; float blinkTimer;
bool blink; bool blink;
GemData *gemData; GemData *gemData;
//BitmapText *text;
TTFText *text; TTFText *text;
RoundedRect *textBG; RoundedRect *textBG;
void onUpdate(float dt) void onUpdate(float dt)
@ -421,22 +377,22 @@ protected:
{ {
core->sound->playSfx("Gem-Move"); core->sound->playSfx("Gem-Move");
mover = this; mover = this;
//offset = Vector(position - core->mouse.position);
//position += core->mouse.position - wp;
//offset = Vector(0, 4);
} }
} }
else if (mover == this) else if (mover == this)
{ {
//position = core->mouse.position;
position += (core->mouse.position - wp)/parent->scale.x; position += (core->mouse.position - wp)/parent->scale.x;
if (!core->mouse.buttons.left) if (!core->mouse.buttons.left)
{ {
mover = 0; mover = 0;
core->sound->playSfx("Gem-Place"); core->sound->playSfx("Gem-Place");
//position += offset;
//offset = Vector(0,0);
//offset = Vector(0,0);
gemData->pos = position; gemData->pos = position;
} }
} }
@ -450,20 +406,14 @@ protected:
if ((core->mouse.position - wp).isLength2DIn(GEM_GRAB)) 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()) if (!gemData->userString.empty())
textBG->show(); textBG->show();
} }
else else
{ {
/*
text->alpha.interpolateTo(0, 0.1);
textBG->alpha.interpolateTo(0, 0.1);
*/
if (textBG->alpha == 1) if (textBG->alpha == 1)
textBG->hide(); textBG->hide();
} }
@ -622,13 +572,7 @@ void WorldMapRender::setVis(WorldMapTile *tile)
{ {
if (!tile) return; if (!tile) return;
#ifdef AQUARIA_BUILD_MAPVIS #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->color = Vector(1,1,1);
tile->q->alphaMod = 1; tile->q->alphaMod = 1;
@ -704,19 +648,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
savedTexData = 0; 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(); int num = dsq->continuity.worldMap.getNumWorldMapTiles();
std::string n = dsq->game->sceneName; std::string n = dsq->game->sceneName;
@ -789,14 +721,14 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
tophud->alpha = 0; tophud->alpha = 0;
dsq->game->addRenderObject(tophud, LR_WORLDMAPHUD); dsq->game->addRenderObject(tophud, LR_WORLDMAPHUD);
//int fontSize = 6;
float aly = 26, aly2 = 18; float aly = 26, aly2 = 18;
float sz = 0.6; float sz = 0.6;
//hover //hover
areaLabel = new BitmapText(&dsq->smallFont); areaLabel = new BitmapText(&dsq->smallFont);
areaLabel->scale = Vector(sz,sz); areaLabel->scale = Vector(sz,sz);
//areaLabel->setFontSize(fontSize);
areaLabel->setAlign(ALIGN_CENTER); areaLabel->setAlign(ALIGN_CENTER);
areaLabel->followCamera = 1; areaLabel->followCamera = 1;
areaLabel->position = Vector(150,aly); areaLabel->position = Vector(150,aly);
@ -805,7 +737,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
//in //in
areaLabel2 = new BitmapText(&dsq->smallFont); areaLabel2 = new BitmapText(&dsq->smallFont);
//areaLabel2->setFontSize(fontSize);
areaLabel2->scale = Vector(sz,sz); areaLabel2->scale = Vector(sz,sz);
areaLabel2->followCamera = 1; areaLabel2->followCamera = 1;
areaLabel2->setAlign(ALIGN_CENTER); areaLabel2->setAlign(ALIGN_CENTER);
@ -816,7 +748,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
//select //select
areaLabel3 = new BitmapText(&dsq->smallFont); areaLabel3 = new BitmapText(&dsq->smallFont);
areaLabel3->scale = Vector(sz,sz); areaLabel3->scale = Vector(sz,sz);
//areaLabel3->setFontSize(fontSize);
areaLabel3->followCamera = 1; areaLabel3->followCamera = 1;
areaLabel3->setAlign(ALIGN_CENTER); areaLabel3->setAlign(ALIGN_CENTER);
areaLabel3->position = Vector(650, aly); areaLabel3->position = Vector(650, aly);
@ -833,7 +765,7 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
bindInput(); bindInput();
underlay = new Gradient; 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->makeVertical(Vector(0.25,0.25,0.5), Vector(0,0,0.25));
underlay->position = Vector(400,300); underlay->position = Vector(400,300);
underlay->autoWidth = AUTO_VIRTUALWIDTH; underlay->autoWidth = AUTO_VIRTUALWIDTH;
@ -852,14 +784,14 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
addHintQuad2->alpha = 0; addHintQuad2->alpha = 0;
dsq->game->addRenderObject(addHintQuad2, LR_WORLDMAPHUD); dsq->game->addRenderObject(addHintQuad2, LR_WORLDMAPHUD);
//helpButton->event.set(MakeFunctionEvent(WorldMapRender, onToggleHelpScreen));
helpButton = new AquariaMenuItem; helpButton = new AquariaMenuItem;
helpButton->event.setActionMapperCallback(this, ACTION_TOGGLEHELPSCREEN, 0); helpButton->event.setActionMapperCallback(this, ACTION_TOGGLEHELPSCREEN, 0);
helpButton->useQuad("gui/icon-help"); helpButton->useQuad("gui/icon-help");
helpButton->useGlow("particles/glow", 40, 40); helpButton->useGlow("particles/glow", 40, 40);
helpButton->useSound("Click"); helpButton->useSound("Click");
helpButton->alpha = 0; helpButton->alpha = 0;
//helpButton->position = Vector(800-20, 20);
dsq->game->addRenderObject(helpButton, LR_WORLDMAPHUD); dsq->game->addRenderObject(helpButton, LR_WORLDMAPHUD);
} }
@ -886,7 +818,7 @@ void WorldMapRender::bindInput()
void WorldMapRender::destroy() void WorldMapRender::destroy()
{ {
//clearVis(activeTile);
for (int i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++) for (int i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++)
{ {
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i); WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
@ -939,7 +871,7 @@ void WorldMapRender::onUpdate(float dt)
if (alpha.x > 0) if (alpha.x > 0)
{ {
//if (activeTile && activeTile==originalActiveTile && !gemMovers.empty())
if (originalActiveTile && !gemMovers.empty()) if (originalActiveTile && !gemMovers.empty())
{ {
gemMovers.back()->position = getAvatarWorldMapPosition(); gemMovers.back()->position = getAvatarWorldMapPosition();
@ -1009,7 +941,7 @@ void WorldMapRender::onUpdate(float dt)
activeTile = selectedTile; activeTile = selectedTile;
activeQuad = activeTile->q; activeQuad = activeTile->q;
//activeTile->gridPos = activeTile->q->position;
if (activeQuad) if (activeQuad)
{ {
dsq->clickRingEffect(activeQuad->getWorldPosition(), 0); dsq->clickRingEffect(activeQuad->getWorldPosition(), 0);
@ -1126,7 +1058,7 @@ void WorldMapRender::onUpdate(float dt)
zoomMax = exteriorZoomMax; zoomMax = exteriorZoomMax;
} }
float scrollAmount = 0.2;//0.25; float scrollAmount = 0.2;
if (core->mouse.scrollWheelChange) if (core->mouse.scrollWheelChange)
{ {
@ -1387,7 +1319,7 @@ void WorldMapRender::toggle(bool turnON)
{ {
restoreVel = dsq->game->avatar->vel; restoreVel = dsq->game->avatar->vel;
dsq->game->avatar->vel = Vector(0,0,0); dsq->game->avatar->vel = Vector(0,0,0);
//dsq->game->avatar->idle();
dsq->game->togglePause(true); dsq->game->togglePause(true);
core->sound->playSfx("menu-open"); core->sound->playSfx("menu-open");
@ -1436,7 +1368,7 @@ void WorldMapRender::toggle(bool turnON)
alpha.interpolateTo(1, 0.2); alpha.interpolateTo(1, 0.2);
//dsq->game->hudUnderlay->alpha.interpolateTo(WORLDMAP_UNDERLAY_ALPHA, 0.2);
underlay->alpha.interpolateTo(WORLDMAP_UNDERLAY_ALPHA, 0.2); underlay->alpha.interpolateTo(WORLDMAP_UNDERLAY_ALPHA, 0.2);
addHintQuad1->alpha.interpolateTo(1.0, 0.2); addHintQuad1->alpha.interpolateTo(1.0, 0.2);
@ -1450,8 +1382,8 @@ void WorldMapRender::toggle(bool turnON)
if ((*i).on) if ((*i).on)
{ {
BeaconRender *b = new BeaconRender(&(*i)); BeaconRender *b = new BeaconRender(&(*i));
//b->position = (*i).pos;
//game->addRenderObject(b, layer+1);
addChild(b, PM_POINTER); addChild(b, PM_POINTER);
beaconRenders.push_back(b); beaconRenders.push_back(b);
} }
@ -1496,14 +1428,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"); core->sound->playSfx("Menu-Close");
@ -1513,7 +1437,7 @@ void WorldMapRender::toggle(bool turnON)
alpha.interpolateTo(0, 0.2); alpha.interpolateTo(0, 0.2);
dsq->game->togglePause(false); dsq->game->togglePause(false);
//dsq->game->hudUnderlay->alpha.interpolateTo(0, 0.2);
underlay->alpha.interpolateTo(0, 0.2); underlay->alpha.interpolateTo(0, 0.2);
addHintQuad1->alpha.interpolateTo(0, 0.2); addHintQuad1->alpha.interpolateTo(0, 0.2);
addHintQuad2->alpha.interpolateTo(0, 0.2); addHintQuad2->alpha.interpolateTo(0, 0.2);
@ -1522,14 +1446,14 @@ void WorldMapRender::toggle(bool turnON)
for (GemMovers::iterator i = gemMovers.begin(); i != gemMovers.end(); i++) for (GemMovers::iterator i = gemMovers.begin(); i != gemMovers.end(); i++)
{ {
//removeChild(*i);
(*i)->safeKill(); (*i)->safeKill();
} }
gemMovers.clear(); gemMovers.clear();
for (BeaconRenders::iterator i = beaconRenders.begin(); i != beaconRenders.end(); i++) for (BeaconRenders::iterator i = beaconRenders.begin(); i != beaconRenders.end(); i++)
{ {
//removeChild(*i);
(*i)->safeKill(); (*i)->safeKill();
} }
beaconRenders.clear(); beaconRenders.clear();
@ -1546,7 +1470,7 @@ void WorldMapRender::createGemHint(const std::string &gfx)
doubleClickTimer = 0; doubleClickTimer = 0;
GemData *g = dsq->continuity.pickupGem(gfx, false); GemData *g = dsq->continuity.pickupGem(gfx, false);
g->canMove = 1; g->canMove = 1;
g->pos = getAvatarWorldMapPosition();// + Vector(0, -20); g->pos = getAvatarWorldMapPosition();
g->userString = useString; g->userString = useString;
addGem(g); addGem(g);
fixGems(); fixGems();
@ -1614,25 +1538,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

@ -337,18 +337,8 @@ WorldMapTile *WorldMap::getWorldMapTileByIndex(int index)
return 0; return 0;
} }
/*
void WorldMap::revealMapIndex(int index)
{
if (index < 0 || index >= worldMapTiles.size()) return;
worldMapTiles[index].revealed = true;
}
*/
void WorldMap::hideMap() void WorldMap::hideMap()
{ {
for (int i = 0; i < worldMapTiles.size(); i++) for (int i = 0; i < worldMapTiles.size(); i++)

View file

@ -13,53 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. 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 "ActionMapper.h"
#include "Core.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() ActionMapper::ActionMapper()
{ {
@ -104,11 +62,7 @@ void ActionMapper::addAction (int actionID, int k)
if (ad) if (ad)
{ {
/*
std::ostringstream os;
os << "Action ID [" << actionID << "] already exists!";
debugLog(os.str());
*/
} }
else else
{ {
@ -166,55 +120,7 @@ void ActionMapper::clearCreatedEvents()
createdEvents.clear(); 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() void ActionMapper::enableInput()
{ {
@ -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) bool ActionMapper::pollAction(int actionID)
{ {
@ -372,10 +266,7 @@ void ActionMapper::onUpdate (float dt)
{ {
if (inUpdate) return; if (inUpdate) return;
inUpdate = true; inUpdate = true;
/*
if (num_joysticks)
poll_joystick();
*/
if (cleared) cleared = false; if (cleared) cleared = false;
ActionDataSet::iterator i; ActionDataSet::iterator i;
KeyDownMap oldKeyDownMap = keyDownMap; KeyDownMap oldKeyDownMap = keyDownMap;
@ -417,7 +308,7 @@ void ActionMapper::onUpdate (float dt)
out: out:
inUpdate = false; inUpdate = false;
// keyDownMap[k] = ;
} }
void ActionMapper::clearActions() void ActionMapper::clearActions()

View file

@ -48,15 +48,10 @@ public:
// funcs // funcs
ActionMapper(); ActionMapper();
virtual ~ActionMapper(); virtual ~ActionMapper();
//void addAction (const std::string &action, int k);
void addAction(Event *event, int k, int state=-1); void addAction(Event *event, int k, int state=-1);
void addAction(int actionID, int k); 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 removeAction(int actionID);
void removeAllActions(); void removeAllActions();
@ -80,9 +75,6 @@ public:
//typedef std::map <std::string, int> StringIntMap;
//StringIntMap stateCheckMap;
enum { enum {
MOUSE_BUTTON_LEFT = 999, MOUSE_BUTTON_LEFT = 999,
MOUSE_BUTTON_RIGHT = 1000, MOUSE_BUTTON_RIGHT = 1000,
@ -106,7 +98,7 @@ public:
JOY1_BUTTON_15 = 2015, JOY1_BUTTON_15 = 2015,
JOY1_BUTTON_16 = 2016, JOY1_BUTTON_16 = 2016,
//JOY1_BUTTON_X360_START=2011,
X360_BTN_START = 3016, X360_BTN_START = 3016,
X360_BTN_BACK = 3017, X360_BTN_BACK = 3017,
@ -122,13 +114,13 @@ public:
enum { DPAD_LEFT = 0, DPAD_RIGHT, DPAD_UP, DPAD_DOWN }; enum { DPAD_LEFT = 0, DPAD_RIGHT, DPAD_UP, DPAD_DOWN };
//int getKeyForAction(std::string action);
virtual void enableInput(); virtual void enableInput();
virtual void disableInput(); virtual void disableInput();
/*void loadActionSet(const std::string &fn);*/
//nasty hack
//void forceUpdate(float dt);
Event *addCreatedEvent(Event *event); Event *addCreatedEvent(Event *event);
void clearCreatedEvents(); void clearCreatedEvents();
@ -149,4 +141,3 @@ protected:

View file

@ -38,68 +38,7 @@ ActionInput *ActionSet::getActionInputByName(const std::string &name)
return 0; 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) void ActionSet::importAction(ActionMapper *mapper, const std::string &name, int actionID)
{ {
@ -178,7 +117,7 @@ std::string ActionSet::insertInputIntoString(const std::string &string)
std::string part1 = str.substr(0, start); std::string part1 = str.substr(0, start);
std::string part3 = str.substr(end+1, str.size()); std::string part3 = str.substr(end+1, str.size());
//{ToggleHelp:k0}
int thing = code.find(':'); int thing = code.find(':');
std::string input = code.substr(0, thing); std::string input = code.substr(0, thing);
std::string button = code.substr(thing+1, code.size()); std::string button = code.substr(thing+1, code.size());

View file

@ -39,8 +39,7 @@ public:
ActionInput *addActionInput(const std::string &name); 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); ActionInput *getActionInputByName(const std::string &name);

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. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "AfterEffect.h" #include "AfterEffect.h"
//#include "math.h"
#include <assert.h> #include <assert.h>
@ -188,7 +188,7 @@ void AfterEffectManager::render()
glColor4f(1,1,1,1); glColor4f(1,1,1,1);
renderGrid(); renderGrid();
//renderGridPoints();
glPopMatrix(); glPopMatrix();
} }
@ -234,28 +234,28 @@ void AfterEffectManager::renderGrid()
backupBuffer.startCapture(); backupBuffer.startCapture();
} }
//float div = xDivs;
for (int i = 0; i < (xDivs-1); i++) for (int i = 0; i < (xDivs-1); i++)
{ {
for (int j = 0; j < (yDivs-1); j++) for (int j = 0; j < (yDivs-1); j++)
{ {
glBegin(GL_QUADS); glBegin(GL_QUADS);
//glColor3f(i/div, i/div, i/div);
glTexCoord2f(i/(float)(xDivs-1)*percentX, 1*percentY-(j)/(float)(yDivs-1)*percentY); 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); 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); 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); 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); 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(offx + vw*drawGrid[i+1][j+1].x, offy + vh*drawGrid[i+1][j+1].y); 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); 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); glVertex2f(offx + vw*drawGrid[i+1][j].x, offy + vh*drawGrid[i+1][j].y);
glEnd(); glEnd();
} }
@ -432,31 +432,15 @@ void AfterEffectManager::addEffect(Effect *e)
effects.push_back(e); effects.push_back(e);
} }
numEffects++; 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;
/* Vector base(0,0,0);
for (int x = 1; x < xDivs-1; x++)
{
for (int y = 1; y < yDivs-1; y++) e->position.x /= screenWidth;
{
v = &drawGrid[x][y]; e->position.y /= screenHeight;
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);
*/
} }
@ -465,18 +449,13 @@ void ShockEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
{ {
dt *= timeMultiplier; dt *= timeMultiplier;
Effect::update(dt, drawGrid, xDivs, yDivs); 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 = position;
centerPoint -= ((core->screenCenter-originalCenter)*core->globalScale.x)/core->width; centerPoint -= ((core->screenCenter-originalCenter)*core->globalScale.x)/core->width;
//centerPoint = position/xDivs;
//centerPoint = drawGrid[xDivs/2][yDivs/2];
float xDist,yDist,tDist; float xDist,yDist,tDist;
@ -484,8 +463,7 @@ void ShockEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
currentDistance+=dt*frequency; currentDistance+=dt*frequency;
//float distFromCamp =(core->cameraPos - position).getLength2D();//v3dDist(nCameraPointer->pos, position);
//if (distFromCamp < 4)
float distFromCamp = 4; float distFromCamp = 4;
float adjWaveLength = waveLength/distFromCamp; float adjWaveLength = waveLength/distFromCamp;
@ -498,33 +476,21 @@ void ShockEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
{ {
for (int j = 1; j < (yDivs-1); j++) 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; xDist = (centerPoint.x - drawGrid[i][j].x)/.75;
yDist = centerPoint.y - drawGrid[i][j].y; 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); 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) 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].x += adjAmplitude*sinf(-tDist/adjWaveLength+currentDistance)*.75f;
drawGrid[i][j].y += adjAmplitude*cosf(-tDist/adjWaveLength+currentDistance); drawGrid[i][j].y += adjAmplitude*cosf(-tDist/adjWaveLength+currentDistance);
} }
@ -540,20 +506,9 @@ RippleEffect::RippleEffect() : Effect()
void RippleEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs) 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; time += dt*0.5f;
float amp = 0.002; float amp = 0.002;
for (int i = 0; i < (xDivs-1); i++) for (int i = 0; i < (xDivs-1); i++)
@ -561,7 +516,7 @@ void RippleEffect::update(float dt, Vector ** drawGrid, int xDivs, int yDivs)
for (int j = 0; j < (yDivs-1); j++) 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); 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].x += sinf((time+offset)*7.5f)*(amp*0.5f);
drawGrid[i][j].y += cosf((time+offset)*7.5f)*amp; drawGrid[i][j].y += cosf((time+offset)*7.5f)*amp;
} }

View file

@ -51,7 +51,7 @@ public:
this->timeMultiplier = timeMultiplier; this->timeMultiplier = timeMultiplier;
} }
float timeMultiplier; float timeMultiplier;
//void go();
void update(float dt, Vector ** drawGrid, int xDivs, int yDivs); void update(float dt, Vector ** drawGrid, int xDivs, int yDivs);
float waveLength; float waveLength;

View file

@ -31,11 +31,11 @@ AnimData::AnimData()
AnimatedSprite::AnimatedSprite() : Quad() AnimatedSprite::AnimatedSprite() : Quad()
{ {
//debugLog("AnimatedSprite::AnimatedSprite()");
frame = 0; frame = 0;
animator.setUpdatee(&frame); animator.setUpdatee(&frame);
animationTime.setUpdatee (&animator.timePeriod); animationTime.setUpdatee (&animator.timePeriod);
//debugLog("End AnimatedSprite::AnimatedSprite()");
} }
void AnimatedSprite::animate (AnimData &animData) void AnimatedSprite::animate (AnimData &animData)

View file

@ -160,7 +160,6 @@ unsigned hash(const std::string &string)
return hash; return hash;
} }
/* hash * 33 + c */
static unsigned char lowerToUpperTable[256]; static unsigned char lowerToUpperTable[256];
@ -351,7 +350,7 @@ bool exists(const std::string &f, bool makeFatal, bool skipVFS)
void drawCircle(float radius, int stepSize) void drawCircle(float radius, int stepSize)
{ {
//glDisable(GL_CULL_FACE);
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
{ {
@ -362,7 +361,7 @@ void drawCircle(float radius, int stepSize)
} }
glEnd(); glEnd();
//glEnable(GL_CULL_FACE);
} }
void exit_error(const std::string &message) void exit_error(const std::string &message)
@ -400,68 +399,7 @@ bool chancef(float p)
return ((rand()%100) <= p*100); 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) void errorLog(const std::string &s)
{ {
@ -557,29 +495,7 @@ tinyxml2::XMLDocument *readXML(const std::string& fn, tinyxml2::XMLError *perr /
return doc; 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) void doSingleFile(const std::string &path, const std::string &type, std::string filename, void callback(const std::string &filename, int param), int param)
{ {
@ -588,9 +504,9 @@ void doSingleFile(const std::string &path, const std::string &type, std::string
std::string search = filename; std::string search = filename;
stringToLower(search); stringToLower(search);
std::string filetype = filename.substr(search.size()-4, search.size()); 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); debugLog("checking:" + search + " for type:" + type);
if (search.find(type)!=std::string::npos) if (search.find(type)!=std::string::npos)
{ {
@ -721,9 +637,7 @@ 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()); sprintf(szDir, "%s\\*", path.c_str());
stringToUpper(type); stringToUpper(type);
@ -732,7 +646,7 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
hList = FindFirstFile(szDir, &FileData); hList = FindFirstFile(szDir, &FileData);
if (hList == INVALID_HANDLE_VALUE) if (hList == INVALID_HANDLE_VALUE)
{ {
//printf("No files found\n\n");
debugLog("No files of type " + type + " found in path " + path); debugLog("No files of type " + type + " found in path " + path);
} }
else else
@ -744,13 +658,13 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
// Check the object is a directory or not // Check the object is a directory or not
//printf("%*s%s\n", indent, "", FileData.cFileName); //printf("%*s%s\n", indent, "", FileData.cFileName);
std::string filename = FileData.cFileName; std::string filename = FileData.cFileName;
//debugLog("found: " + filename);
if (filename.size()>4) if (filename.size()>4)
{ {
std::string filetype = filename.substr(filename.size()-4, filename.size()); std::string filetype = filename.substr(filename.size()-4, filename.size());
stringToUpper(filetype); stringToUpper(filetype);
//debugLog("comparing: " + filetype + " and: " + type);
if (filetype==type) if (filetype==type)
{ {
callback(path+filename, param); callback(path+filename, param);
@ -760,12 +674,7 @@ void forEachFile(std::string path, std::string type, void callback(const std::st
if (!FindNextFile(hList, &FileData)) if (!FindNextFile(hList, &FileData))
{ {
/*
if (GetLastError() == ERROR_NO_MORE_FILES)
{
fFinished = TRUE;
}
*/
fFinished = TRUE; fFinished = TRUE;
} }
} }
@ -806,19 +715,14 @@ std::vector<std::string> getFileList(std::string path, std::string type, int par
std::string filename = FileData.cFileName; std::string filename = FileData.cFileName;
if (filename.size()>4 && filename.substr(filename.size()-4, filename.size())==type) if (filename.size()>4 && filename.substr(filename.size()-4, filename.size())==type)
{ {
//callback(path+filename, param);
list.push_back (filename); list.push_back (filename);
} }
if (!FindNextFile(hList, &FileData)) if (!FindNextFile(hList, &FileData))
{ {
/*
if (GetLastError() == ERROR_NO_MORE_FILES)
{
fFinished = TRUE;
}
*/
fFinished = TRUE; fFinished = TRUE;
} }
} }
@ -879,18 +783,7 @@ Vector getNearestPointOnLine(Vector a, Vector b, Vector c)
return nearest; 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) bool isTouchingLine(Vector lineStart, Vector lineEnd, Vector point, int radius, Vector *closestP)
{ {

View file

@ -39,17 +39,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef BBGE_BUILD_WINDOWS #ifdef BBGE_BUILD_WINDOWS
//#include "iprof/prof.h"
//#define BBGE_PROF(x) Prof(x)
#define BBGE_PROF(x) #define BBGE_PROF(x)
/*
//#ifdef BBGE_BUILD_DIRECTX
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
//#endif
*/
#else #else
#define BBGE_PROF(x) #define BBGE_PROF(x)
@ -100,7 +94,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <queue> #include <queue>
#include <map> #include <map>
#include <stack> #include <stack>
//#include <typeinfo.h>
#include "Rect.h" #include "Rect.h"
@ -199,18 +193,7 @@ Vector colorRGB(int r, int g, int b);
GLuint generateEmptyTexture(int res); 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); void drawCircle(float radius, int steps=1);
bool isVectorInRect(const Vector &vec, const Vector &coord1, const Vector &coord2); bool isVectorInRect(const Vector &vec, const Vector &coord1, const Vector &coord2);
@ -248,8 +231,7 @@ enum LerpType
float lerp(const float &v1, const float &v2, float dt, int 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); 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 "BitmapFont.h"
#include "Core.h" #include "Core.h"
//#include "DSQ.h"
using namespace glfont; using namespace glfont;
@ -79,13 +79,13 @@ BitmapText::BitmapText(BmpFont *bmpFont)
align = ALIGN_CENTER; align = ALIGN_CENTER;
textWidth = 600; textWidth = 600;
this->fontDrawSize = 24; this->fontDrawSize = 24;
//color = Vector(0.5,0.5,1);
cull = false; cull = false;
//setTexture(font);
alignWidth = 0; alignWidth = 0;
//fontTextureTest = core->addTexture("font");
} }
void BitmapText::autoKern() void BitmapText::autoKern()
@ -163,7 +163,7 @@ void BitmapText::formatText()
maxW = 0; maxW = 0;
for (int i = 0; i < text.size(); i++) for (int i = 0; i < text.size(); i++)
{ {
//currentWidth += spacingMap[text[i]]*fontDrawSize;
float sz = bmpFont->font.GetCharWidth(text[i])*bmpFont->scale; float sz = bmpFont->font.GetCharWidth(text[i])*bmpFont->scale;
currentWidth += sz; currentWidth += sz;
@ -216,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);
} }
@ -315,13 +298,8 @@ void BitmapText::onRender()
float bottom_color[3] = {bmpFont->fontBtmColor.x*color.x, bmpFont->fontBtmColor.y*color.y, bmpFont->fontBtmColor.z*color.z}; float bottom_color[3] = {bmpFont->fontBtmColor.x*color.x, bmpFont->fontBtmColor.y*color.y, bmpFont->fontBtmColor.z*color.z};
glEnable(GL_TEXTURE_2D); 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(); bmpFont->font.Begin();
@ -350,11 +328,7 @@ void BitmapText::onRender()
x = -sz.first*0.5f*bmpFont->scale; x = -sz.first*0.5f*bmpFont->scale;
} }
float la = 1.0f-(scrollDelay/scrollSpeed); 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); bmpFont->font.DrawString(theLine, bmpFont->scale, x, y, top_color, bottom_color, alpha.x, la);
y += adj; y += adj;
@ -376,7 +350,7 @@ void BitmapText::onRender()
} }
} }
//glEnable(GL_CULL_FACE);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
} }
@ -450,33 +424,4 @@ float BitmapText::getStringWidth(const std::string& text)
return maxsize * bmpFont->scale; 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 #ifndef BITMAPFONT_H
#define BITMAPFONT_H #define BITMAPFONT_H
//#include "DrawText.h"
#include "RenderObject.h" #include "RenderObject.h"
#include "BaseText.h" #include "BaseText.h"

View file

@ -106,7 +106,7 @@ void BloomEffect::render()
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
//glScalef(scale.x, scale.y, 0);
float spost = 0.0; float spost = 0.0;

View file

@ -41,22 +41,7 @@ CollisionShape::Type CollisionShape::getType()
return type; return type;
} }
/*
bool CollisionShape::compareMask(CollisionShape &c)
{
for (CollisionLayerMask::iterator i = c.colliderMask.begin(); i != c.colliderMask.end(); i++)
{
for (CollisionLayerMask::iterator j = c.collideeMask.begin(); j != c.collideeMask.end(); j++)
{
if ((*i)) && (*j))
{
return true;
}
}
}
return false;
}
*/
bool CollisionShape::compareLayer(CollisionShape &c) bool CollisionShape::compareLayer(CollisionShape &c)
{ {
return (this->layer <= c.layer); return (this->layer <= c.layer);
@ -65,19 +50,7 @@ bool CollisionShape::compareLayer(CollisionShape &c)
void CollisionShape::updatePosition(const Vector &position) void CollisionShape::updatePosition(const Vector &position)
{ {
this->position = position + offsetPosition; this->position = position + offsetPosition;
/*
switch (getType())
{
case AABB:
{
corners[0] = position + Vector( - xw, - yw);
corners[1] = position + Vector(xw, - yw);
corners[2] = position + Vector(xw, yw);
corners[3] = position + Vector(-xw ,yw);
}
break;
}
*/
} }
@ -142,7 +115,7 @@ CollisionResult CollisionShape::findOverlap(CollisionShape &collisionShape)
} }
} }
//return collideCircleWithAABB(collisionShape);
} }
break; break;
case TOP_HALF_CIRCLE: case TOP_HALF_CIRCLE:
@ -158,20 +131,16 @@ CollisionResult CollisionShape::findOverlap(CollisionShape &collisionShape)
CollisionResult CollisionShape::collideCircleWithCircle(CollisionShape &collisionShape) CollisionResult CollisionShape::collideCircleWithCircle(CollisionShape &collisionShape)
{ {
CollisionResult c; CollisionResult c;
Vector dist = position - collisionShape.position;// - position; Vector dist = position - collisionShape.position;
float fastLen = dist.getSquaredLength2D(); float fastLen = dist.getSquaredLength2D();
float totalDist = (radius + collisionShape.radius); float totalDist = (radius + collisionShape.radius);
if (fastLen < (totalDist*totalDist)) if (fastLen < (totalDist*totalDist))
{ {
/*
std::ostringstream os;
os << "len " << len << " totalDist " << totalDist;
msg(os.str());
*/
float len = dist.getLength2D(); float len = dist.getLength2D();
c.collided = true; c.collided = true;
dist.setLength2D(totalDist - len); dist.setLength2D(totalDist - len);
//dist |= totalDist;
c.overlap = dist; c.overlap = dist;
} }
else else
@ -210,10 +179,8 @@ void CollisionShape::render()
drawCircle(radius); drawCircle(radius);
break; break;
case AABB: case AABB:
//case CIRCLE:
//glColor3f(1,1,1);
//glLineWidth(2);
glBegin(GL_QUADS); glBegin(GL_QUADS);
{ {
@ -222,21 +189,7 @@ void CollisionShape::render()
glVertex2f(xw,-yw); glVertex2f(xw,-yw);
glVertex2f(-xw,-yw); glVertex2f(-xw,-yw);
/*
glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
glVertex2f(topLeft.x, topLeft.y);
glVertex2f(bottomRight.x, topLeft.y);
glVertex2f(bottomRight.x, topLeft.y);
glVertex2f(bottomRight.x, bottomRight.y);
glVertex2f(bottomRight.x, bottomRight.y);
glVertex2f(topLeft.x, bottomRight.y);
glVertex2f(topLeft.x, bottomRight.y);
glVertex2f(topLeft.x, topLeft.y);
*/
} }
glEnd(); glEnd();
@ -244,47 +197,11 @@ void CollisionShape::render()
} }
glTranslatef(-offsetPosition.x, -offsetPosition.y,0); glTranslatef(-offsetPosition.x, -offsetPosition.y,0);
//glDisable(GL_BLEND);
} }
/*
// FOR EDGES
if (position.y > collisionShape.getY1() - radius && position.y < collisionShape.getY2() + radius)
{
float dist = collisionShape.getX1() - position.x;
if (dist > 0 && dist < radius)
{
c.collided = true;
c.overlap = Vector(radius - dist,0);
}
else if (dist < 0 && -dist < radius)
{
c.collided = true;
c.overlap = -Vector(radius - (-dist),0);
}
}
if (!c.collided)
{
if (position.y > collisionShape.getY1() - radius && position.y < collisionShape.getY2() + radius)
{
float dist = collisionShape.getX2() - position.x;
if (dist > 0 && dist < radius)
{
c.collided = true;
c.overlap += Vector(radius - dist,0);
}
else if (dist < 0 && -dist < radius)
{
c.collided = true;
c.overlap += -Vector(radius - (-dist),0);
}
}
}
*/
CollisionResult CollisionShape::collideCircleWithAABB(CollisionShape &collisionShape, float x, float y, int oH, int oV) CollisionResult CollisionShape::collideCircleWithAABB(CollisionShape &collisionShape, float x, float y, int oH, int oV)
{ {
@ -336,14 +253,14 @@ CollisionResult CollisionShape::collideCircleWithAABB(CollisionShape &collisionS
} }
else else
{ {
// msg ("oH == 0, oV != 0");
c.reportCollision(Vector(0, y*oV)); c.reportCollision(Vector(0, y*oV));
return c; return c;
} }
} }
else if(oV == 0) else if(oV == 0)
{ {
// msg ("oV == 0");
c.reportCollision(Vector(x*oH,0)); c.reportCollision(Vector(x*oH,0));
return c; return c;
} }

View file

@ -50,11 +50,7 @@ class CollisionShape
public: public:
CollisionShape(); CollisionShape();
/*
void addCollisionGroup(int group);
void removeCollisionGroup(int group);
void canCollideWithGroup();
*/
void updatePosition(const Vector &position); void updatePosition(const Vector &position);
@ -93,17 +89,14 @@ public:
Vector offsetPosition; Vector offsetPosition;
bool compareLayer(CollisionShape &c); bool compareLayer(CollisionShape &c);
//bool compareMask(CollisionShape &c);
int getLayer() { return layer; } int getLayer() { return layer; }
void setLayer(int layer) { this->layer = layer; } void setLayer(int layer) { this->layer = layer; }
bool project; bool project;
protected: protected:
int layer; int layer;
/*
typedef std::vector<int> CollisionLayerMask;
CollisionLayerMask colliderMask, collideeMask;
*/
std::vector<Vector> corners; std::vector<Vector> corners;
Vector position; Vector position;
bool active; bool active;
@ -116,31 +109,6 @@ protected:
Type type; Type type;
}; };
/*
class CollisionObject
{
public:
void onCollision();
void collide()
{
CollisionResult c;
for (int i = 0; i < collisionManager->colliders.size(); i++)
{
c = findOverlap(collisionManager->colliders[i]->collisionShape);
if (c.collided)
{
position -= c.overlap;
collisionShape.position =
}
}
}
};
class CollisionManager
{
public:
void addCollider(
};
*/
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -37,17 +37,13 @@ BUILD_LINUX
#include "StateManager.h" #include "StateManager.h"
#include "Light.h" #include "Light.h"
#include "Flags.h" #include "Flags.h"
//#include "Scripting.h"
#include "Effects.h" #include "Effects.h"
#include "Localization.h" #include "Localization.h"
#include "DarkLayer.h" #include "DarkLayer.h"
/*
#ifdef BBGE_BUILD_WINDOWS
#include "Joystick.h"
#endif
*/
#include "FrameBuffer.h" #include "FrameBuffer.h"
#include "Shader.h" #include "Shader.h"
@ -107,13 +103,8 @@ const int baseVirtualHeight = 600;
enum GameKeys enum GameKeys
{ {
// replace with GLFW equivalent
/*
KEY_DOWNARROW = GLFW_KEY_DOWN,
KEY_RIGHTARROW = GLFW_KEY_RIGHT,
KEY_UPARROW = GLFW_KEY_UP,
KEY_LEFTARROW = GLFW_KEY_LEFT,
*/
KEY_LSUPER, KEY_LSUPER,
KEY_RSUPER, KEY_RSUPER,
@ -122,8 +113,8 @@ enum GameKeys
KEY_BACKSPACE, KEY_BACKSPACE,
KEY_PRINTSCREEN, KEY_PRINTSCREEN,
//KEY_CAPSLOCK,
//KEY_CIRCUMFLEX,
KEY_LALT, KEY_LALT,
KEY_RALT, KEY_RALT,
KEY_LSHIFT, KEY_LSHIFT,
@ -142,7 +133,7 @@ enum GameKeys
KEY_SEMICOLON, KEY_SEMICOLON,
KEY_LBRACKET, KEY_LBRACKET,
KEY_RBRACKET, KEY_RBRACKET,
//KEY_RALT,
KEY_TILDE, KEY_TILDE,
KEY_0, KEY_0,
KEY_1, KEY_1,
@ -306,10 +297,10 @@ enum FollowCameraLock
FCL_VERT = 2 FCL_VERT = 2
}; };
//RenderObject Layer Type (enable only one)
//#define RLT_DYNAMIC // Dynamic list
#define RLT_FIXED // Static array #define RLT_FIXED
//#define RLT_MAP // Mapping
typedef std::vector <RenderObject*> RenderObjects; typedef std::vector <RenderObject*> RenderObjects;
typedef std::list <RenderObject*> RenderObjectList; typedef std::list <RenderObject*> RenderObjectList;
@ -415,9 +406,9 @@ public:
void initRenderObjectLayers(int num); void initRenderObjectLayers(int num);
void applyState(const std::string &state); void applyState(const std::string &state);
//bool createGlWindow(char* title, int width, int height, int bits, bool fullscreenflag);
bool createWindow(int width, int height, int bits, bool fullscreen, std::string windowTitle=""); bool createWindow(int width, int height, int bits, bool fullscreen, std::string windowTitle="");
//void setWindowTitle(const std::string &title); // func not yet written
void clearBuffers(); void clearBuffers();
void render(int startLayer=-1, int endLayer=-1, bool useFrameBufferIfAvail=true); void render(int startLayer=-1, int endLayer=-1, bool useFrameBufferIfAvail=true);
void showBuffer(); void showBuffer();
@ -446,7 +437,7 @@ public:
void main(float runTime = -1); // can use main void main(float runTime = -1); // can use main
//void adjustWindowPosition(int x, int y);
// state functions // state functions
@ -503,15 +494,7 @@ public:
void resetGraphics(int w, int h, int fullscreen=-1, int vsync=-1, int bpp=-1); void resetGraphics(int w, int h, int fullscreen=-1, int vsync=-1, int bpp=-1);
/*
#ifdef BBGE_BUILD_OPENGL
void getWindowHeight(int *height)
{glfwGetWindowSize(0, height);}
void getWindowWidth(int *width)
{glfwGetWindowSize(width, 0);}
#endif
*/
void setDockIcon(const std::string &ident); void setDockIcon(const std::string &ident);
@ -541,7 +524,7 @@ public:
RenderObjectLayer *getRenderObjectLayer(int i); RenderObjectLayer *getRenderObjectLayer(int i);
std::vector <int> renderObjectLayerOrder; std::vector <int> renderObjectLayerOrder;
//typedef std::list<RenderObject*> RenderObjects;
typedef std::vector<RenderObjectLayer> RenderObjectLayers; typedef std::vector<RenderObjectLayer> RenderObjectLayers;
RenderObjectLayers renderObjectLayers; RenderObjectLayers renderObjectLayers;
@ -574,7 +557,6 @@ public:
ParticleManager *particleManager; ParticleManager *particleManager;
//Scripting::Script script;
void setBaseTextureDirectory(const std::string &baseTextureDirectory) void setBaseTextureDirectory(const std::string &baseTextureDirectory)
@ -621,7 +603,7 @@ public:
void applyMatrixStackToWorld(); void applyMatrixStackToWorld();
void translateMatrixStack(float x, float y, float z=0); void translateMatrixStack(float x, float y, float z=0);
//void translateMatrixStackRelative(float x, float y, float z=0);
void rotateMatrixStack(float x, float y, float z); void rotateMatrixStack(float x, float y, float z);
void scaleMatrixStack(float x, float y, float z=1); void scaleMatrixStack(float x, float y, float z=1);
void rotateMatrixStack(float z); void rotateMatrixStack(float z);
@ -656,14 +638,10 @@ public:
int particlesPaused; int particlesPaused;
//JoystickData joystickData[4];
bool joystickEnabled; bool joystickEnabled;
bool joystickOverrideMouse; bool joystickOverrideMouse;
/*
int numJoysticks;
DIJOYSTATE2 joystate;
Joystick* joysticks[4];
*/
bool debugLogTextures; bool debugLogTextures;
@ -819,7 +797,6 @@ protected:
CountedPtr<Texture> texError; CountedPtr<Texture> texError;
//unsigned int windowWidth, windowHeight;
int tgaSaveSeries(char *filename, short int width, short int height, unsigned char pixelDepth, unsigned char *imageData); int tgaSaveSeries(char *filename, short int width, short int height, unsigned char pixelDepth, unsigned char *imageData);

View file

@ -23,17 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
DFSprite::DFSprite() : AnimatedSprite() DFSprite::DFSprite() : AnimatedSprite()
{ {
//debugLog("DFSprite::DFSprite()");
currentDatafile = 0; currentDatafile = 0;
//debugLog("End DFSprite::DFSprite()");
} }
/*
DFSprite::~DFSprite()
{
destroy();
}
*/
void DFSprite::destroy() void DFSprite::destroy()
{ {
@ -63,12 +58,9 @@ void DFSprite::onUpdate(float dt)
void DFSprite::onSetTexture() void DFSprite::onSetTexture()
{ {
Quad::onSetTexture(); Quad::onSetTexture();
/*
width = texture->width;
height = texture->height;
*/
//scale = Vector(texture->width, texture->height,0);
} }
// returns index of datafile with the specified name // returns index of datafile with the specified name

View file

@ -29,10 +29,10 @@ class DFSprite : public AnimatedSprite
{ {
public: public:
DFSprite(); DFSprite();
//~DFSprite();
void destroy(); void destroy();
//void animate();
int findDatafile(const std::string &name); int findDatafile(const std::string &name);
void selectDatafile(int index); void selectDatafile(int index);

View file

@ -63,7 +63,7 @@ bool DarkLayer::isUsed()
//HACK: disabling dark layer for temporary testing build //HACK: disabling dark layer for temporary testing build
// MAKE SURE TO RESTORE THIS CODE TO THE WAY IT WAS // MAKE SURE TO RESTORE THIS CODE TO THE WAY IT WAS
return layer > -1 && active; return layer > -1 && active;
//return false;
} }
void DarkLayer::setLayers(int layer, int rl) void DarkLayer::setLayers(int layer, int rl)
@ -110,9 +110,8 @@ void DarkLayer::preRender()
if (verbose) debugLog("viewport"); if (verbose) debugLog("viewport");
glViewport(0,0,quality,quality); glViewport(0,0,quality,quality);
//core->clearBuffers();
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (verbose) debugLog("startCapture"); if (verbose) debugLog("startCapture");
@ -145,10 +144,8 @@ void DarkLayer::preRender()
glClearColor(0,0,0,0); glClearColor(0,0,0,0);
if (verbose) debugLog("done"); if (verbose) debugLog("done");
/*
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
*/
//glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, quality, quality, 0);
} }
} }
@ -158,8 +155,8 @@ void DarkLayer::render()
{ {
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
//float percentX = (float)core->width/(float)quality;
//float percentY = (float)core->height/(float)quality;
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
if (useFrameBuffer) if (useFrameBuffer)
@ -167,15 +164,11 @@ void DarkLayer::render()
else else
glBindTexture(GL_TEXTURE_2D,texture); glBindTexture(GL_TEXTURE_2D,texture);
//glDisable(GL_BLEND);
glEnable(GL_BLEND); glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glBlendFunc(GL_ZERO, GL_SRC_COLOR);
//glBlendEquation(GL_FUNC_SUBTRACT);
// subtractive blend! (using color) // subtractive blend! (using color)
glBlendFunc(GL_ZERO, GL_SRC_COLOR); glBlendFunc(GL_ZERO, GL_SRC_COLOR);
@ -190,8 +183,8 @@ void DarkLayer::render()
debugLog("darkLayer: invalid operation"); debugLog("darkLayer: invalid operation");
} }
//glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
//glBlendFunc(GL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1,1,1,1); glColor4f(1,1,1,1);
float width = core->getWindowWidth(); float width = core->getWindowWidth();

View file

@ -58,68 +58,14 @@ Texture* Datafile::get(int idx)
} }
return textures[idx]; return textures[idx];
} }
/*
void Datafile::load(const std::string &name, int w, int h)
{
this->w = w;
this->h = h;
std::ifstream in;
in.open(name);
std::string read;
while (std::getline(in,read))
{
Texture *t = new Texture;
t->loadFromString(read);
}
}
void Datafile::save(const std::string &datafile)
{
std::ofstream out;
}
*/
void Datafile::loadFromAVI(const std::string &aviFile) void Datafile::loadFromAVI(const std::string &aviFile)
{ {
/*
AviRender a(aviFile);
bool done = false;
float time = 0;
int counter = 20;
while (!done)
{
// GLuint id;
//a.bindFrameToTexture(time, &id);
//if (id)
{
Texture *texture = new Texture;
//a.setCurrentFrameAsTexture();
//texture->id = a.id;
a.bindFrameToTexture(time, texture->id, texture->imageData);
//texture->setID(id);
texture->width = 512;
texture->height = 512;
addTexture(texture);
//texture->addRef();
//frame ++;
}
counter --;
if (counter <= 0)
done = true;
time += 1;
//frame++;
}
//a.getCurrentFrameAsTexture();
*/
} }
void Datafile::loadTextureRange(const std::string &file, const std::string &type, int start, int end) void Datafile::loadTextureRange(const std::string &file, const std::string &type, int start, int end)

View file

@ -43,7 +43,7 @@ public:
return textures.size(); return textures.size();
} }
protected: protected:
//void load(const std::string &name);
std::string name; std::string name;

View file

@ -134,7 +134,7 @@ void DebugFont::onRender()
for (int i = 0; i < lines.size(); i++) for (int i = 0; i < lines.size(); i++)
{ {
//float width = (lines[i].size()-1) * fontDrawSize * 1.4f * 0.75f;
float width = (lines[i].size()) * fontDrawSize * 1.4f * 0.75f; float width = (lines[i].size()) * fontDrawSize * 1.4f * 0.75f;
if (align == ALIGN_CENTER) if (align == ALIGN_CENTER)
{ {

View file

@ -156,92 +156,5 @@ void PostProcessingFX::render()
} }
} }
/*
GLuint blurTexture;
GLuint emptyTexture() // Create An Empty Texture
{
GLuint txtnumber; // Texture ID
unsigned int* data; // Stored Data
// Create Storage Space For Texture Data (128x128x4)
data = (unsigned int*)new GLuint[((128 * 128)* 4 * sizeof(unsigned int))];
ZeroMemory(data,((128 * 128)* 4 * sizeof(unsigned int))); // Clear Storage Memory
glGenTextures(1, &txtnumber); // Create 1 Texture
glBindTexture(GL_TEXTURE_2D, txtnumber); // Bind The Texture
glTexImage2D(GL_TEXTURE_2D, 0, 4, 128, 128, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data); // Build Texture Using Information In data
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
delete [] data; // Release data
return txtnumber; // Return The Texture ID
}
PostProcessingFX::PostProcessingFX()
{
}
void PostProcessingFX::init(FXTypes type)
{
if (type == FXT_RADIALBLUR)
{
blurTexture = emptyTexture();
}
enabled[(int)type] = true;
}
void PostProcessingFX::shutdown(FXTypes type)
{
enabled[int(type)] = false;
}
void PostProcessingFX::preRender()
{
for (int i = 0; i < FXT_MAX; i++)
{
if (enabled[i])
{
FXTType type = (FXType)i;
switch(type)
{
case FXT_RADIALBLUR:
glViewport(0,0,128,128); // Set Our Viewport (Match Texture Size;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And Depth Buffer
core->render();
glBindTexture(GL_TEXTURE_2D,BlurTexture); // Bind To The Blur Texture
// Copy Our ViewPort To The Blur Texture (From 0,0 To 128,128... No Border)
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, 128, 128, 0);
glClearColor(0.0f, 0.0f, 0.5f, 0.5); // Set The Clear Color To Medium Blue
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And Depth Buffer
glViewport(0, 0, 800, 600);
break;
}
}
}
}
void PostProcessingFX::render()
{
for (int i = 0; i < FXT_MAX; i++)
{
if (enabled[i])
{
FXTType type = (FXType)i;
switch(type)
{
case FXT_RADIALBLUR:
glBegin(GL_QUADS);
glEnd();
break;
}
}
}
}
*/

View file

@ -37,7 +37,7 @@ void Emitter::destroy()
} }
particles.clear(); particles.clear();
Quad::destroy(); Quad::destroy();
//particleManager->setFree(firstFree);
} }
void Emitter::spawnParticle(float perc) void Emitter::spawnParticle(float perc)
@ -105,14 +105,7 @@ void Emitter::spawnParticle(float perc)
p->rot.data->target.z += p->rot.z; p->rot.data->target.z += p->rot.z;
} }
/*
if (data.calculateVelocityToCenter)
{
Vector pos = p->position - this->position;
pos.setLength2D(1);
quad->velocity = -p*particles[i].velocityMagnitude.x;
}
*/
if (data.randomVelocityMagnitude > 0) if (data.randomVelocityMagnitude > 0)
{ {
@ -138,12 +131,7 @@ void Emitter::onUpdate(float dt)
{ {
Quad::onUpdate(dt); Quad::onUpdate(dt);
/*
for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
{
particleManager->updateParticle(*i, dt);
}
*/
if (pe->isRunning() && core->particlesPaused <= data.pauseLevel) if (pe->isRunning() && core->particlesPaused <= data.pauseLevel)
{ {
@ -232,16 +220,7 @@ void Emitter::removeParticle(Particle *p)
} }
else else
particles.remove(p); particles.remove(p);
/*
for (Particles::reverse_iterator i = particles.rbegin(); i != particles.rend(); i++)
{
if (*i == p)
{
particles.erase(i);
return;
}
}
*/
} }
void Emitter::render() void Emitter::render()
@ -258,17 +237,7 @@ void Emitter::onRender()
if (!data.spawnLocal) if (!data.spawnLocal)
{ {
glLoadIdentity(); glLoadIdentity();
/*
if (pe && pe->followCamera)
{
glLoadIdentity();
glScalef(core->globalResolutionScale.x, core->globalResolutionScale.y,0);
}
else
{
core->setupRenderPositionAndScale();
}
*/
core->setupRenderPositionAndScale(); core->setupRenderPositionAndScale();
} }
@ -306,16 +275,11 @@ void Emitter::onRender()
if (data.flipH || (data.copyParentFlip && (pe->isfh() || (pe->getParent() && pe->getParent()->isfh())))) if (data.flipH || (data.copyParentFlip && (pe->isfh() || (pe->getParent() && pe->getParent()->isfh()))))
{ {
//glDisable(GL_CULL_FACE);
glRotatef(180, 0, 1, 0); glRotatef(180, 0, 1, 0);
} }
/*
if (data.flipV || (data.copyParentFlip && (this->isfv() || (parent && parent->isfv()))))
{
glDisable(GL_CULL_FACE);
}
*/
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2f(0,1); glTexCoord2f(0,1);
@ -388,23 +352,4 @@ void Emitter::onRender()
/*
glDisable(GL_TEXTURE_2D);
glPointSize(4);
glBegin(GL_POINTS);
for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
{
Particle *p = *i;
if (p->active)
{
glColor4f(1, 0, 0, 1);
x = p->pos.x;
y = p->pos.y;
glVertex2f(x, y);
}
}
glEnd();
glEnable(GL_TEXTURE_2D);
*/
} }

View file

@ -239,5 +239,5 @@ float Timer::getValue()
{ {
return timer; return timer;
} }
//EventPtr endEvent, startEvent;

View file

@ -1282,7 +1282,6 @@ void OpenALChannel::setSound(OpenALSound *_sound)
// FMOD::System implementation ... // FMOD::System implementation ...
class OpenALSystem class OpenALSystem

View file

@ -113,10 +113,7 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen, GLint filter)
_fitToScreen = fitToScreen; _fitToScreen = fitToScreen;
if (width == 0 || height == 0) if (width == 0 || height == 0)
return false; return false;
/*
if (width > height)
height = width;
*/
w=width; w=width;
h=height; h=height;
@ -308,7 +305,7 @@ void FrameBuffer::startCapture()
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
//glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, g_depthRenderBuffer );
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_dynamicTextureID, 0 ); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, g_dynamicTextureID, 0 );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_depthRenderBuffer ); glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, g_depthRenderBuffer );

View file

@ -44,9 +44,7 @@ extern "C" {
#undef WINGDIAPI #undef WINGDIAPI
#define WINGDIAPI extern #define WINGDIAPI extern
/*#ifndef WIN32
#define WINGDIAPI
#endif*/
#ifndef GLAPI #ifndef GLAPI
# ifdef _WIN32 # ifdef _WIN32
@ -104,13 +102,13 @@ typedef void GLvoid;
#define GL_SCISSOR_BIT 0x00080000 #define GL_SCISSOR_BIT 0x00080000
#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF #define GL_ALL_ATTRIB_BITS 0xFFFFFFFF
/* ClearBufferMask */
/* GL_COLOR_BUFFER_BIT */
/* GL_ACCUM_BUFFER_BIT */
/* GL_STENCIL_BUFFER_BIT */
/* GL_DEPTH_BUFFER_BIT */
/* ClientAttribMask */
#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 #define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 #define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF #define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
@ -158,55 +156,55 @@ typedef void GLvoid;
#define GL_DST_ALPHA 0x0304 #define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305 #define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306 #define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308 #define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* ColorMaterialFace */
/* GL_FRONT */
/* GL_BACK */
/* GL_FRONT_AND_BACK */
/* ColorMaterialParameter */
/* GL_AMBIENT */
/* GL_DIFFUSE */
/* GL_SPECULAR */
/* GL_EMISSION */
/* GL_AMBIENT_AND_DIFFUSE */
/* ColorPointerType */
/* GL_BYTE */
/* GL_UNSIGNED_BYTE */
/* GL_SHORT */
/* GL_UNSIGNED_SHORT */
/* GL_INT */
/* GL_UNSIGNED_INT */
/* GL_FLOAT */
/* GL_DOUBLE */
/* CullFaceMode */
/* GL_FRONT */
/* GL_BACK */
/* GL_FRONT_AND_BACK */
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* DrawBufferMode */
#define GL_NONE 0 #define GL_NONE 0
#define GL_FRONT_LEFT 0x0400 #define GL_FRONT_LEFT 0x0400
#define GL_FRONT_RIGHT 0x0401 #define GL_FRONT_RIGHT 0x0401
@ -222,75 +220,75 @@ typedef void GLvoid;
#define GL_AUX2 0x040B #define GL_AUX2 0x040B
#define GL_AUX3 0x040C #define GL_AUX3 0x040C
/* EnableCap */
/* GL_FOG */
/* GL_LIGHTING */
/* GL_TEXTURE_1D */
/* GL_TEXTURE_2D */
/* GL_LINE_STIPPLE */
/* GL_POLYGON_STIPPLE */
/* GL_CULL_FACE */
/* GL_ALPHA_TEST */
/* GL_BLEND */
/* GL_INDEX_LOGIC_OP */
/* GL_COLOR_LOGIC_OP */
/* GL_DITHER */
/* GL_STENCIL_TEST */
/* GL_DEPTH_TEST */
/* GL_CLIP_PLANE0 */
/* GL_CLIP_PLANE1 */
/* GL_CLIP_PLANE2 */
/* GL_CLIP_PLANE3 */
/* GL_CLIP_PLANE4 */
/* GL_CLIP_PLANE5 */
/* GL_LIGHT0 */
/* GL_LIGHT1 */
/* GL_LIGHT2 */
/* GL_LIGHT3 */
/* GL_LIGHT4 */
/* GL_LIGHT5 */
/* GL_LIGHT6 */
/* GL_LIGHT7 */
/* GL_TEXTURE_GEN_S */
/* GL_TEXTURE_GEN_T */
/* GL_TEXTURE_GEN_R */
/* GL_TEXTURE_GEN_Q */
/* GL_MAP1_VERTEX_3 */
/* GL_MAP1_VERTEX_4 */
/* GL_MAP1_COLOR_4 */
/* GL_MAP1_INDEX */
/* GL_MAP1_NORMAL */
/* GL_MAP1_TEXTURE_COORD_1 */
/* GL_MAP1_TEXTURE_COORD_2 */
/* GL_MAP1_TEXTURE_COORD_3 */
/* GL_MAP1_TEXTURE_COORD_4 */
/* GL_MAP2_VERTEX_3 */
/* GL_MAP2_VERTEX_4 */
/* GL_MAP2_COLOR_4 */
/* GL_MAP2_INDEX */
/* GL_MAP2_NORMAL */
/* GL_MAP2_TEXTURE_COORD_1 */
/* GL_MAP2_TEXTURE_COORD_2 */
/* GL_MAP2_TEXTURE_COORD_3 */
/* GL_MAP2_TEXTURE_COORD_4 */
/* GL_POINT_SMOOTH */
/* GL_LINE_SMOOTH */
/* GL_POLYGON_SMOOTH */
/* GL_SCISSOR_TEST */
/* GL_COLOR_MATERIAL */
/* GL_NORMALIZE */
/* GL_AUTO_NORMAL */
/* GL_POLYGON_OFFSET_POINT */
/* GL_POLYGON_OFFSET_LINE */
/* GL_POLYGON_OFFSET_FILL */
/* GL_VERTEX_ARRAY */
/* GL_NORMAL_ARRAY */
/* GL_COLOR_ARRAY */
/* GL_INDEX_ARRAY */
/* GL_TEXTURE_COORD_ARRAY */
/* GL_EDGE_FLAG_ARRAY */
/* ErrorCode */
#define GL_NO_ERROR 0 #define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500 #define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501 #define GL_INVALID_VALUE 0x0501
@ -317,8 +315,8 @@ typedef void GLvoid;
#define GL_COPY_PIXEL_TOKEN 0x0706 #define GL_COPY_PIXEL_TOKEN 0x0706
#define GL_LINE_RESET_TOKEN 0x0707 #define GL_LINE_RESET_TOKEN 0x0707
/* FogMode */
/* GL_LINEAR */
#define GL_EXP 0x0800 #define GL_EXP 0x0800
#define GL_EXP2 0x0801 #define GL_EXP2 0x0801

View file

@ -59,38 +59,26 @@ void Gradient::makeHorizontal(Vector c1, Vector c2)
void Gradient::onRender() void Gradient::onRender()
{ {
//glNormal3f(0, 0, 1);
glBegin(GL_QUADS); glBegin(GL_QUADS);
//glNormal3f(0, 0, 1);
glColor4f(ulc2.x*color.x, ulc2.y*color.y, ulc2.z*color.z, alpha.x); glColor4f(ulc2.x*color.x, ulc2.y*color.y, ulc2.z*color.z, alpha.x);
glVertex3f(-0.5, 0.5, 0.0f); glVertex3f(-0.5, 0.5, 0.0f);
// 2
glColor4f(ulc3.x*color.x, ulc3.y*color.y, ulc3.z*color.z, alpha.x); glColor4f(ulc3.x*color.x, ulc3.y*color.y, ulc3.z*color.z, alpha.x);
glVertex3f( 0.5, 0.5, 0.0f); glVertex3f( 0.5, 0.5, 0.0f);
// 3
glColor4f(ulc0.x*color.x, ulc0.y*color.y, ulc0.z*color.z, alpha.x); glColor4f(ulc0.x*color.x, ulc0.y*color.y, ulc0.z*color.z, alpha.x);
glVertex3f( 0.5, -0.5, 0.0f); glVertex3f( 0.5, -0.5, 0.0f);
// 4
glColor4f(ulc1.x*color.x, ulc1.y*color.y, ulc1.z*color.z, alpha.x); glColor4f(ulc1.x*color.x, ulc1.y*color.y, ulc1.z*color.z, alpha.x);
glVertex3f(-0.5, -0.5, 0.0f); glVertex3f(-0.5, -0.5, 0.0f);
/*
glColor3f(ulc0.x, ulc0.y, ulc0.z);
glVertex3f(-0.5, -0.5, 0);
glColor3f(ulc1.x, ulc1.y, ulc1.z);
glVertex3f(0.5, -0.5, 0);
glColor3f(ulc2.x, ulc2.y, ulc2.z);
glVertex3f(0.5, 0.5, 0);
glColor3f(ulc3.x, ulc3.y, ulc3.z);
glVertex3f(-0.5, 0.5, 0);
*/
glEnd(); glEnd();
} }

View file

@ -110,48 +110,9 @@ void Interpolator::update (float dt)
*updatee += speed * dt; *updatee += speed * dt;
if(*updatee > 255) *updatee = 0; if(*updatee > 255) *updatee = 0;
if(*updatee < 0) *updatee = 255; if(*updatee < 0) *updatee = 255;
/*
timePassed += speed *dt;
if (timePassed >= timePeriod)
{
*updatee = to;
interpolating = false;
if (loopType != 0)
{
if (loopType > 0)
loopType -= 1;
if (pingPong)
interpolateTo (from, timePeriod, loopType);
else
{
*updatee = from;
interpolateTo (to, timePeriod, loopType);
}
}
}
else
{
*updatee = (to - from) * (timePassed / timePeriod);
*updatee += from;
}
*/
/*
if (updatee >= to)
{
if (pingPong)
{
interpolateTo (from, timePeriod, loopType);
//if(*updatee > to) *updatee = 0;
//if(*updatee < from) *updatee = 255;
}
else
{
*updatee = from;
interpolateTo (to, timePeriod, loopType);
}
}
*/
} }
} }
} }

View file

@ -273,7 +273,7 @@ void Joystick::rumble(float leftMotor, float rightMotor, float time)
void Joystick::callibrate(Vector &calvec, float deadZone) void Joystick::callibrate(Vector &calvec, float deadZone)
{ {
//float len = position.getLength2D();
if (calvec.isLength2DIn(deadZone)) if (calvec.isLength2DIn(deadZone))
{ {
calvec = Vector(0,0,0); calvec = Vector(0,0,0);
@ -364,11 +364,6 @@ void Joystick::update(float dt)
rightStick.y = yaxis2/32768.0f; rightStick.y = yaxis2/32768.0f;
#endif #endif
/*
std::ostringstream os;
os << "joy(" << position.x << ", " << position.y << ")";
debugLog(os.str());
*/
callibrate(position, deadZone1); callibrate(position, deadZone1);
@ -376,11 +371,7 @@ void Joystick::update(float dt)
callibrate(rightStick, deadZone2); callibrate(rightStick, deadZone2);
/*
std::ostringstream os2;
os2 << "joy2(" << position.x << ", " << position.y << ")";
debugLog(os2.str());
*/
#ifdef BBGE_BUILD_SDL2 #ifdef BBGE_BUILD_SDL2
if (sdl_controller) if (sdl_controller)
{ {
@ -398,17 +389,7 @@ void Joystick::update(float dt)
for (int i = 0; i < maxJoyBtns; i++) for (int i = 0; i < maxJoyBtns; i++)
buttons[i] = SDL_JoystickGetButton(sdl_joy, i)?DOWN:UP; buttons[i] = SDL_JoystickGetButton(sdl_joy, i)?DOWN:UP;
#endif #endif
/*
unsigned char btns[maxJoyBtns];
glfwGetJoystickButtons(GLFW_JOYSTICK_1, btns, maxJoyBtns);
for (int i = 0; i < maxJoyBtns; i++)
{
if (btns[i] == GLFW_PRESS)
buttons[i] = DOWN;
else
buttons[i] = UP;
}
*/
} }
@ -424,11 +405,6 @@ void Joystick::update(float dt)
/*
std::ostringstream os;
os << "j-pos(" << position.x << ", " << position.y << " - b0[" << buttons[0] << "]) - len[" << len << "]";
debugLog(os.str());
*/
} }
bool Joystick::anyButton() bool Joystick::anyButton()

View file

@ -43,7 +43,7 @@ void LensFlare::addFlare(const std::string &tex, Vector color, int w, int h)
void LensFlare::onUpdate(float dt) void LensFlare::onUpdate(float dt)
{ {
//const int maxLen = 1500;
RenderObject::onUpdate(dt); RenderObject::onUpdate(dt);
Vector v = core->screenCenter - this->position; Vector v = core->screenCenter - this->position;
if (v.getSquaredLength2D() > sqr(maxLen)) if (v.getSquaredLength2D() > sqr(maxLen))
@ -53,7 +53,7 @@ void LensFlare::onUpdate(float dt)
float l = v.getLength2D(); float l = v.getLength2D();
float a = 1.0f-(l/(float)maxLen); float a = 1.0f-(l/(float)maxLen);
a*=0.8f; a*=0.8f;
//Vector vbit = v*(1.0f/flares.size());
Vector vbit = v; Vector vbit = v;
vbit *= inc; vbit *= inc;
for (int i = 0; i < flares.size(); i++) for (int i = 0; i < flares.size(); i++)

View file

@ -30,7 +30,7 @@ void LightCone::onRender()
{ {
RenderObject::onRender(); RenderObject::onRender();
glBegin(GL_QUADS); glBegin(GL_QUADS);
//glNormal3f( 0.0f, 0, 1.0f);
glColor4f(color.x, color.y, color.z, 1*alpha.x); glColor4f(color.x, color.y, color.z, 1*alpha.x);
glVertex3f(0, 0, 0); glVertex3f(0, 0, 0);
glColor4f(color.x, color.y, color.z,1*alpha.x); glColor4f(color.x, color.y, color.z,1*alpha.x);

View file

@ -9,7 +9,7 @@
#include <assert.h> #include <assert.h>
//#define DD(...) fprintf(stderr, __VA_ARGS__)
#define DD(...) #define DD(...)
#define logdev(...) #define logdev(...)
#define logerror(...) #define logerror(...)

View file

@ -79,8 +79,8 @@ private:
inline unsigned int GetIndexForElemSize(unsigned int elemSize) inline unsigned int GetIndexForElemSize(unsigned int elemSize)
{ {
//ASSERT(elemSize);
//ASSERT(elemSize <= _blockSizeMax);
return ((elemSize + (_blockSizeIncr - 1)) / _blockSizeIncr) - 1; return ((elemSize + (_blockSizeIncr - 1)) / _blockSizeIncr) - 1;
} }

View file

@ -30,7 +30,7 @@ const std::string modelPath = "models/";
Model::Model() : RenderObject() Model::Model() : RenderObject()
{ {
m_calModel = 0; m_calModel = 0;
//, coreModel("poot")
m_calCoreModel = new CalCoreModel("model"); m_calCoreModel = new CalCoreModel("model");
if (!m_calCoreModel) if (!m_calCoreModel)
{ {
@ -242,13 +242,7 @@ bool Model::load(const std::string& _strFilename)
// set the material set of the whole model // set the material set of the whole model
m_calModel->setMaterialSet(0); m_calModel->setMaterialSet(0);
// set initial animation state
/*
m_state = STATE_MOTION;
m_calModel->getMixer()->blendCycle(m_animationId[STATE_MOTION], m_motionBlend[0], 0.0f);
m_calModel->getMixer()->blendCycle(m_animationId[STATE_MOTION + 1], m_motionBlend[1], 0.0f);
m_calModel->getMixer()->blendCycle(m_animationId[STATE_MOTION + 2], m_motionBlend[2], 0.0f);
*/
return true; return true;
} }
@ -393,20 +387,8 @@ void Model::renderMesh(bool bWireframe, bool bLight)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
// DEBUG-CODE //////////////////////////////////////////////////////////////////
/*
glBegin(GL_LINES);
glColor3f(1.0f, 1.0f, 1.0f);
int vertexId;
for(vertexId = 0; vertexId < vertexCount; vertexId++)
{
const float scale = 0.3f;
glVertex3f(meshVertices[vertexId][0], meshVertices[vertexId][1], meshVertices[vertexId][2]);
glVertex3f(meshVertices[vertexId][0] + meshNormals[vertexId][0] * scale, meshVertices[vertexId][1] + meshNormals[vertexId][1] * scale, meshVertices[vertexId][2] + meshNormals[vertexId][2] * scale);
}
glEnd();
*/
////////////////////////////////////////////////////////////////////////////////
} }
} }
} }
@ -437,10 +419,7 @@ glEnd();
void Model::onRender() void Model::onRender()
{ {
/*
glClearDepth(1.0f);
core->resize3D();
*/
glEnable(GL_DEPTH_TEST); // Enables Depth Testing glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do

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