mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 22:44:32 +00:00
Merge branch 'gccwarn' into controllerfixup
This commit is contained in:
commit
f9357e7fca
99 changed files with 1238 additions and 792 deletions
|
@ -506,13 +506,14 @@ void AnimationEditor::undo()
|
||||||
|
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
{
|
{
|
||||||
if (undoEntry >= 0 && undoEntry < undoHistory.size())
|
if (undoEntry < undoHistory.size())
|
||||||
{
|
{
|
||||||
std::list<SkeletalSprite>::iterator it = undoHistory.begin();
|
std::list<SkeletalSprite>::iterator it = undoHistory.begin();
|
||||||
std::advance(it, undoEntry);
|
std::advance(it, undoEntry);
|
||||||
editSprite->animations = it->animations;
|
editSprite->animations = it->animations;
|
||||||
undoEntry--;
|
if(undoEntry > 0) {
|
||||||
if (undoEntry<0) undoEntry = 0;
|
undoEntry--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -524,7 +525,7 @@ void AnimationEditor::redo()
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
{
|
{
|
||||||
undoEntry++;
|
undoEntry++;
|
||||||
if (undoEntry >= 0 && undoEntry < undoHistory.size())
|
if (undoEntry < undoHistory.size())
|
||||||
{
|
{
|
||||||
std::list<SkeletalSprite>::iterator it = undoHistory.begin();
|
std::list<SkeletalSprite>::iterator it = undoHistory.begin();
|
||||||
std::advance(it, undoEntry);
|
std::advance(it, undoEntry);
|
||||||
|
@ -592,7 +593,7 @@ void AnimationEditor::reorderKeys()
|
||||||
void AnimationEditor::rebuildKeyframeWidgets()
|
void AnimationEditor::rebuildKeyframeWidgets()
|
||||||
{
|
{
|
||||||
int offx=0;
|
int offx=0;
|
||||||
for (int i = 0; i < keyframeWidgets.size(); i++)
|
for (size_t i = 0; i < keyframeWidgets.size(); i++)
|
||||||
{
|
{
|
||||||
keyframeWidgets[i]->setLife(0.03);
|
keyframeWidgets[i]->setLife(0.03);
|
||||||
keyframeWidgets[i]->setDecayRate(1);
|
keyframeWidgets[i]->setDecayRate(1);
|
||||||
|
@ -714,7 +715,7 @@ void AnimationEditor::update(float dt)
|
||||||
text->setText(os.str());
|
text->setText(os.str());
|
||||||
|
|
||||||
char t2buf[128];
|
char t2buf[128];
|
||||||
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f strip: %d pass: %d (%d)", ebdata.x, ebdata.y, ebdata.z, selectedStripPoint, pass, origpass);
|
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f strip: %lu pass: %d (%d)", ebdata.x, ebdata.y, ebdata.z, selectedStripPoint, pass, origpass);
|
||||||
text2->setText(t2buf);
|
text2->setText(t2buf);
|
||||||
|
|
||||||
if (core->mouse.buttons.middle)
|
if (core->mouse.buttons.middle)
|
||||||
|
@ -831,14 +832,15 @@ void AnimationEditor::nextKey()
|
||||||
if (editingStrip)
|
if (editingStrip)
|
||||||
{
|
{
|
||||||
selectedStripPoint++;
|
selectedStripPoint++;
|
||||||
if (selectedStripPoint >= editSprite->getSelectedBone(false)->changeStrip.size())
|
if (selectedStripPoint >= editSprite->getSelectedBone(false)->changeStrip.size()
|
||||||
|
&& selectedStripPoint > 0)
|
||||||
selectedStripPoint --;
|
selectedStripPoint --;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < keyframeWidgets.size(); i++)
|
for (size_t i = 0; i < keyframeWidgets.size(); i++)
|
||||||
{
|
{
|
||||||
keyframeWidgets[i]->shiftLeft();
|
keyframeWidgets[i]->shiftLeft();
|
||||||
}
|
}
|
||||||
|
@ -861,15 +863,15 @@ void AnimationEditor::prevKey()
|
||||||
|
|
||||||
if (editingStrip)
|
if (editingStrip)
|
||||||
{
|
{
|
||||||
selectedStripPoint--;
|
if(selectedStripPoint > 0) {
|
||||||
if (selectedStripPoint < 0)
|
selectedStripPoint--;
|
||||||
selectedStripPoint = 0;
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < keyframeWidgets.size(); i++)
|
for (size_t i = 0; i < keyframeWidgets.size(); i++)
|
||||||
{
|
{
|
||||||
keyframeWidgets[i]->shiftRight();
|
keyframeWidgets[i]->shiftRight();
|
||||||
}
|
}
|
||||||
|
@ -1017,7 +1019,7 @@ void AnimationEditor::applyTranslation()
|
||||||
if(!core->getCtrlState())
|
if(!core->getCtrlState())
|
||||||
{
|
{
|
||||||
// all bones in one anim mode
|
// all bones in one anim mode
|
||||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
for (size_t i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -1030,9 +1032,9 @@ void AnimationEditor::applyTranslation()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// all bones in all anims mode
|
// all bones in all anims mode
|
||||||
for (int a = 0; a < editSprite->animations.size(); ++a)
|
for (size_t a = 0; a < editSprite->animations.size(); ++a)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
for (size_t i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -1117,7 +1119,7 @@ void AnimationEditor::flipRot()
|
||||||
{
|
{
|
||||||
if (!core->getCtrlState())
|
if (!core->getCtrlState())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
for (size_t i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -1129,9 +1131,9 @@ void AnimationEditor::flipRot()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// all bones in all anims mode
|
// all bones in all anims mode
|
||||||
for (int a = 0; a < editSprite->animations.size(); ++a)
|
for (size_t a = 0; a < editSprite->animations.size(); ++a)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
for (size_t i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -1199,7 +1201,7 @@ void AnimationEditor::rmbu()
|
||||||
int rotdiff = editingBone->rotation.z - bcur->rot;
|
int rotdiff = editingBone->rotation.z - bcur->rot;
|
||||||
if (!core->getCtrlState())
|
if (!core->getCtrlState())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
for (size_t i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -1211,9 +1213,9 @@ void AnimationEditor::rmbu()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// all bones in all anims mode
|
// all bones in all anims mode
|
||||||
for (int a = 0; a < editSprite->animations.size(); ++a)
|
for (size_t a = 0; a < editSprite->animations.size(); ++a)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
for (size_t i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -1369,7 +1371,7 @@ void AnimationEditor::moveNextWidgets(float dt)
|
||||||
|
|
||||||
int s = 0;
|
int s = 0;
|
||||||
KeyframeWidget *w=0;
|
KeyframeWidget *w=0;
|
||||||
for (int i = 0; i < keyframeWidgets.size(); i++)
|
for (size_t i = 0; i < keyframeWidgets.size(); i++)
|
||||||
{
|
{
|
||||||
w = keyframeWidgets[i];
|
w = keyframeWidgets[i];
|
||||||
if (s)
|
if (s)
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
SkeletalKeyframe buffer;
|
SkeletalKeyframe buffer;
|
||||||
|
|
||||||
bool editingStrip;
|
bool editingStrip;
|
||||||
int selectedStripPoint;
|
size_t selectedStripPoint;
|
||||||
|
|
||||||
void reverseAnim();
|
void reverseAnim();
|
||||||
|
|
||||||
|
|
|
@ -72,14 +72,14 @@ void AquariaComboBox::enqueueSelectItem(int index)
|
||||||
enqueuedSelectItem = index;
|
enqueuedSelectItem = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AquariaComboBox::setScroll(int sc)
|
void AquariaComboBox::setScroll(size_t sc)
|
||||||
{
|
{
|
||||||
scroll = sc;
|
scroll = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AquariaComboBox::getSelectedItemString()
|
std::string AquariaComboBox::getSelectedItemString()
|
||||||
{
|
{
|
||||||
if (selectedItem >= 0 && selectedItem < items.size())
|
if (selectedItem < items.size())
|
||||||
return items[selectedItem];
|
return items[selectedItem];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -88,10 +88,8 @@ void AquariaComboBox::doScroll(int t)
|
||||||
{
|
{
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
{
|
{
|
||||||
scroll--;
|
if(scroll > 0) {
|
||||||
if (scroll < 0) scroll = 0;
|
scroll--;
|
||||||
else
|
|
||||||
{
|
|
||||||
close(0);
|
close(0);
|
||||||
open(0);
|
open(0);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +239,7 @@ void AquariaComboBox::open(float t)
|
||||||
{
|
{
|
||||||
shownItems.clear();
|
shownItems.clear();
|
||||||
|
|
||||||
for (int i = scroll; i < scroll + numDrops; i++)
|
for (size_t i = scroll; i < scroll + numDrops; i++)
|
||||||
{
|
{
|
||||||
if (i < items.size())
|
if (i < items.size())
|
||||||
{
|
{
|
||||||
|
@ -266,7 +264,7 @@ void AquariaComboBox::close(float t)
|
||||||
|
|
||||||
isopen = false;
|
isopen = false;
|
||||||
|
|
||||||
for (int i = 0; i < shownItems.size(); i++)
|
for (size_t i = 0; i < shownItems.size(); i++)
|
||||||
{
|
{
|
||||||
shownItems[i]->alpha.interpolateTo(0, t);
|
shownItems[i]->alpha.interpolateTo(0, t);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +272,7 @@ void AquariaComboBox::close(float t)
|
||||||
if (t>0)
|
if (t>0)
|
||||||
dsq->run(t);
|
dsq->run(t);
|
||||||
|
|
||||||
for(int i = 0; i < shownItems.size(); i++)
|
for(size_t i = 0; i < shownItems.size(); i++)
|
||||||
{
|
{
|
||||||
removeChild(shownItems[i]);
|
removeChild(shownItems[i]);
|
||||||
shownItems[i]->destroy();
|
shownItems[i]->destroy();
|
||||||
|
@ -289,7 +287,7 @@ void AquariaComboBox::close(float t)
|
||||||
|
|
||||||
bool AquariaComboBox::setSelectedItem(const std::string &item)
|
bool AquariaComboBox::setSelectedItem(const std::string &item)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < items.size(); i++)
|
for (size_t i = 0; i < items.size(); i++)
|
||||||
{
|
{
|
||||||
if (items[i] == item)
|
if (items[i] == item)
|
||||||
{
|
{
|
||||||
|
@ -312,9 +310,9 @@ void AquariaComboBox::setSelectedItem(int index)
|
||||||
{
|
{
|
||||||
doScroll(0);
|
doScroll(0);
|
||||||
}
|
}
|
||||||
else
|
else if(index > 0)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < items.size())
|
if ((size_t) index < items.size())
|
||||||
{
|
{
|
||||||
selectedItem = index;
|
selectedItem = index;
|
||||||
selectedItemLabel->setText(items[index]);
|
selectedItemLabel->setText(items[index]);
|
||||||
|
|
|
@ -591,13 +591,13 @@ void AquariaKeyConfig::onUpdate(float dt)
|
||||||
switch(inputSetType)
|
switch(inputSetType)
|
||||||
{
|
{
|
||||||
case INPUTSET_KEY:
|
case INPUTSET_KEY:
|
||||||
k = &ai->key[inputIdx];
|
k = &ai->data.single.key[inputIdx];
|
||||||
break;
|
break;
|
||||||
case INPUTSET_MOUSE:
|
case INPUTSET_MOUSE:
|
||||||
k = &ai->mse[inputIdx];
|
k = &ai->data.single.mse[inputIdx];
|
||||||
break;
|
break;
|
||||||
case INPUTSET_JOY:
|
case INPUTSET_JOY:
|
||||||
k = &ai->joy[inputIdx];
|
k = &ai->data.single.joy[inputIdx];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
k = 0;
|
k = 0;
|
||||||
|
@ -1186,7 +1186,7 @@ void AquariaButton::goDown()
|
||||||
buttonlabel->position = Vector(0, 7);
|
buttonlabel->position = Vector(0, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AquariaButton::action(int actionID, int state, int source)
|
void AquariaButton::action(int actionID, int state, int source, InputDevice device)
|
||||||
{
|
{
|
||||||
if(actionID == ACTION_PRIMARY)
|
if(actionID == ACTION_PRIMARY)
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,14 +225,14 @@ public:
|
||||||
bool setSelectedItem(const std::string &item);
|
bool setSelectedItem(const std::string &item);
|
||||||
int getSelectedItem();
|
int getSelectedItem();
|
||||||
void enqueueSelectItem(int index);
|
void enqueueSelectItem(int index);
|
||||||
void setScroll(int sc);
|
void setScroll(size_t sc);
|
||||||
std::string getSelectedItemString();
|
std::string getSelectedItemString();
|
||||||
void doScroll(int dir);
|
void doScroll(int dir);
|
||||||
bool isOpen() const { return isopen; }
|
bool isOpen() const { return isopen; }
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
|
|
||||||
int numDrops;
|
size_t numDrops;
|
||||||
bool mb, isopen;
|
bool mb, isopen;
|
||||||
|
|
||||||
int scroll;
|
int scroll;
|
||||||
|
@ -243,7 +243,7 @@ protected:
|
||||||
Quad *bar, *scrollBtnUp, *scrollBtnDown;
|
Quad *bar, *scrollBtnUp, *scrollBtnDown;
|
||||||
|
|
||||||
BitmapText *selectedItemLabel;
|
BitmapText *selectedItemLabel;
|
||||||
int selectedItem;
|
size_t selectedItem;
|
||||||
float scrollDelay;
|
float scrollDelay;
|
||||||
bool firstScroll;
|
bool firstScroll;
|
||||||
Vector textscale;
|
Vector textscale;
|
||||||
|
@ -269,7 +269,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void action(int actionID, int state, int source);
|
virtual void action(int actionID, int state, int source, InputDevice device);
|
||||||
virtual void onUpdate(float dt);
|
virtual void onUpdate(float dt);
|
||||||
virtual void onToggleHighlight(bool on);
|
virtual void onToggleHighlight(bool on);
|
||||||
|
|
||||||
|
|
286
Aquaria/AutoMap.cpp
Normal file
286
Aquaria/AutoMap.cpp
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
/*
|
||||||
|
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 "AutoMap.h"
|
||||||
|
#include "DSQ.h"
|
||||||
|
#include "Game.h"
|
||||||
|
#include "Avatar.h"
|
||||||
|
|
||||||
|
#define AUTOMAP_GRIDTILE 512
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AutoMap::AutoMap() : RenderObject(), ActionMapper()
|
||||||
|
{
|
||||||
|
|
||||||
|
followCamera = 1;
|
||||||
|
scale = Vector(0.4, 0.4);
|
||||||
|
position = Vector(400,300);
|
||||||
|
alpha = 0;
|
||||||
|
vis = false;
|
||||||
|
|
||||||
|
blip = Vector(1,1);
|
||||||
|
blip.interpolateTo(Vector(4,4), 0.75, -1, 1, 1);
|
||||||
|
|
||||||
|
initedGrid = false;
|
||||||
|
|
||||||
|
|
||||||
|
setTexture("particles/glow");
|
||||||
|
|
||||||
|
paintColor = Vector(1,1,1);
|
||||||
|
autoMapMode = 0;
|
||||||
|
|
||||||
|
addAction(MakeFunctionEvent(AutoMap, lmb), ActionMapper::MOUSE_BUTTON_LEFT);
|
||||||
|
|
||||||
|
shadowTex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void AutoMap::destroy()
|
||||||
|
{
|
||||||
|
RenderObject::destroy();
|
||||||
|
if (shadowTex)
|
||||||
|
{
|
||||||
|
shadowTex->destroy();
|
||||||
|
delete shadowTex;
|
||||||
|
shadowTex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AutoMap::isOn()
|
||||||
|
{
|
||||||
|
return vis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::toggle(bool on)
|
||||||
|
{
|
||||||
|
const float t = 0.2;
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
autoMapMode = 0;
|
||||||
|
dsq->game->togglePause(true);
|
||||||
|
dsq->fade(1, t);
|
||||||
|
dsq->main(t);
|
||||||
|
core->overrideStartLayer = LR_AFTER_EFFECTS;
|
||||||
|
core->overrideEndLayer = LR_MAX;
|
||||||
|
vis = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
alpha = 1;
|
||||||
|
|
||||||
|
dsq->fade(0, t);
|
||||||
|
dsq->main(t);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dsq->fade(1, t);
|
||||||
|
dsq->main(t);
|
||||||
|
|
||||||
|
core->overrideStartLayer = 0;
|
||||||
|
core->overrideEndLayer = 0;
|
||||||
|
vis = false;
|
||||||
|
alpha.interpolateTo(0, 0.5);
|
||||||
|
alpha = 0;
|
||||||
|
dsq->game->togglePause(false);
|
||||||
|
|
||||||
|
dsq->fade(0, t);
|
||||||
|
dsq->main(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::setGridFromWorld(Vector worldPos, int gridValue)
|
||||||
|
{
|
||||||
|
int gx = worldPos.x / AUTOMAP_GRIDTILE;
|
||||||
|
int gy = worldPos.y / AUTOMAP_GRIDTILE;
|
||||||
|
|
||||||
|
if (gx<0 || gy<0 || gx >= MAX_AUTOMAP_GRID || gy >= MAX_AUTOMAP_GRID)
|
||||||
|
{
|
||||||
|
std::ostringstream os;
|
||||||
|
os << "AutoMap::setGridFromWorld - exceeded grid size";
|
||||||
|
os << "(" << gx <<", " << gy << ")";
|
||||||
|
debugLog(os.str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
grid[gx][gy] = gridValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::initGrid()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
for (int x=0;x<MAX_AUTOMAP_GRID;x++)
|
||||||
|
{
|
||||||
|
for (int y=0;y<MAX_AUTOMAP_GRID;y++)
|
||||||
|
{
|
||||||
|
grid[x][y] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initedGrid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::paint(const Vector &pos)
|
||||||
|
{
|
||||||
|
Quad *q = new Quad("particles/WhiteGlow", pos);
|
||||||
|
q->setLife(1);
|
||||||
|
q->setDecayRate(0.5);
|
||||||
|
q->color = paintColor;
|
||||||
|
q->followCamera = 1;
|
||||||
|
q->setWidthHeight(8,8);
|
||||||
|
dsq->game->addRenderObject(q, this->layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::onUpdate(float dt)
|
||||||
|
{
|
||||||
|
RenderObject::onUpdate(dt);
|
||||||
|
|
||||||
|
if (!initedGrid)
|
||||||
|
{
|
||||||
|
initGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (dsq->game->avatar)
|
||||||
|
{
|
||||||
|
setGridFromWorld(dsq->game->avatar->position, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (vis && alpha.x == 1)
|
||||||
|
{
|
||||||
|
const float maxScale=1.25, minScale=0.5;
|
||||||
|
blip.update(dt);
|
||||||
|
|
||||||
|
float spd = 0.5;
|
||||||
|
if (core->mouse.scrollWheelChange < 0)
|
||||||
|
{
|
||||||
|
scale -= Vector(spd*0.05f,spd*0.05f);
|
||||||
|
}
|
||||||
|
else if (core->mouse.scrollWheelChange > 0)
|
||||||
|
{
|
||||||
|
scale += Vector(spd*0.05f,spd*0.05f);
|
||||||
|
}
|
||||||
|
if (scale.x < minScale)
|
||||||
|
scale = Vector(minScale, minScale);
|
||||||
|
if (scale.x > maxScale)
|
||||||
|
scale = Vector(maxScale, maxScale);
|
||||||
|
if (core->mouse.buttons.middle)
|
||||||
|
{
|
||||||
|
offset += core->mouse.change*scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::lmb()
|
||||||
|
{
|
||||||
|
if (autoMapMode == 0)
|
||||||
|
autoMapMode = 1;
|
||||||
|
else
|
||||||
|
autoMapMode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoMap::onRender()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (alpha.x == 0) return;
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
float alphaValue = alpha.x;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ysz = dsq->game->cameraMax.y/TILE_SIZE;
|
||||||
|
int xsz = dsq->game->cameraMax.x/TILE_SIZE;
|
||||||
|
|
||||||
|
|
||||||
|
TileVector t(Vector(dsq->game->cameraMax.x/2, dsq->game->cameraMax.y/2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int skip = 4;
|
||||||
|
glLineWidth(skip);
|
||||||
|
|
||||||
|
if (alphaValue > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (int y = 0; y < ysz; y += skip)
|
||||||
|
{
|
||||||
|
float f = float(y)/float(ysz);
|
||||||
|
f = 0.8f-(f*0.5f);
|
||||||
|
glColor4f(0.5f*f, 0.75f*f, 1*f, alphaValue);
|
||||||
|
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
int rowStart = -1;
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
for (x = 0; x < xsz; x++)
|
||||||
|
{
|
||||||
|
if (dsq->game->getGrid(TileVector(x,y))!=OT_BLACK)
|
||||||
|
{
|
||||||
|
if (rowStart == -1)
|
||||||
|
{
|
||||||
|
rowStart = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rowStart != -1)
|
||||||
|
{
|
||||||
|
glVertex3f((rowStart-t.x), (y-t.y),0);
|
||||||
|
glVertex3f((x-t.x), (y-t.y),0);
|
||||||
|
rowStart = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rowStart != -1)
|
||||||
|
{
|
||||||
|
glVertex3f((rowStart-t.x), (y-t.y),0);
|
||||||
|
glVertex3f((x-t.x), (y-t.y),0);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TileVector nt(dsq->game->avatar->position);
|
||||||
|
|
||||||
|
glTranslatef(nt.x - t.x, nt.y - t.y,0);
|
||||||
|
glColor4f(0.5,0.7,1, alphaValue);
|
||||||
|
glPointSize(4);
|
||||||
|
|
||||||
|
glBegin(GL_POINTS);
|
||||||
|
glVertex2f(0,0);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glColor4f(0.5,0.75,1, alphaValue*0.5f);
|
||||||
|
drawCircle(blip.x*16, 8);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ const float JELLYCOSTUME_HEALAMOUNT = 0.5;
|
||||||
const float biteTimerBiteRange = 0.6;
|
const float biteTimerBiteRange = 0.6;
|
||||||
const float biteTimerMax = 3;
|
const float biteTimerMax = 3;
|
||||||
const float biteDelayPeriod = 0.08;
|
const float biteDelayPeriod = 0.08;
|
||||||
const int normalTendrilHits = 3;
|
const size_t normalTendrilHits = 3;
|
||||||
const int rollTendrilHits = 4;
|
const size_t rollTendrilHits = 4;
|
||||||
const int maxTendrilHits = 6;
|
const size_t maxTendrilHits = 6;
|
||||||
|
|
||||||
const float fireDelayTime = 0.2;
|
const float fireDelayTime = 0.2;
|
||||||
const int maxShieldPoints = 8;
|
const int maxShieldPoints = 8;
|
||||||
|
@ -215,7 +215,7 @@ Vector randCirclePos(Vector position, int radius)
|
||||||
return position + Vector(sinf(a), cosf(a))*radius;
|
return position + Vector(sinf(a), cosf(a))*radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
SongIconParticle::SongIconParticle(Vector color, Vector pos, int note)
|
SongIconParticle::SongIconParticle(Vector color, Vector pos, size_t note)
|
||||||
: note(note)
|
: note(note)
|
||||||
{
|
{
|
||||||
cull = false;
|
cull = false;
|
||||||
|
@ -251,7 +251,7 @@ SongIconParticle::SongIconParticle(Vector color, Vector pos, int note)
|
||||||
|
|
||||||
float smallestDist = HUGE_VALF;
|
float smallestDist = HUGE_VALF;
|
||||||
SongIcon *closest = 0;
|
SongIcon *closest = 0;
|
||||||
for (int i = 0; i < avatar->songIcons.size(); i++)
|
for (size_t i = 0; i < avatar->songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
if (i != note)
|
if (i != note)
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ void SongIconParticle::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SongIcon::SongIcon(int note) : Quad(), note(note)
|
SongIcon::SongIcon(size_t note) : Quad(), note(note)
|
||||||
{
|
{
|
||||||
open = false;
|
open = false;
|
||||||
alphaMod = 0.9;
|
alphaMod = 0.9;
|
||||||
|
@ -553,7 +553,7 @@ void SongIcon::openNote()
|
||||||
e->songNote(note);
|
e->songNote(note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < dsq->game->getNumPaths(); i++)
|
for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
Path *p = dsq->game->getPath(i);
|
Path *p = dsq->game->getPath(i);
|
||||||
if (!p->nodes.empty())
|
if (!p->nodes.empty())
|
||||||
|
@ -604,7 +604,7 @@ void SongIcon::closeNote()
|
||||||
e->songNoteDone(note, len);
|
e->songNoteDone(note, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < dsq->game->getNumPaths(); i++)
|
for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
Path *p = dsq->game->getPath(i);
|
Path *p = dsq->game->getPath(i);
|
||||||
if (!p->nodes.empty())
|
if (!p->nodes.empty())
|
||||||
|
@ -1198,7 +1198,7 @@ void Avatar::lostTarget(int i, Entity *e)
|
||||||
void Avatar::entityDied(Entity *e)
|
void Avatar::entityDied(Entity *e)
|
||||||
{
|
{
|
||||||
Entity::entityDied(e);
|
Entity::entityDied(e);
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
if (targets[i].e == e)
|
if (targets[i].e == e)
|
||||||
{
|
{
|
||||||
|
@ -1266,7 +1266,7 @@ void Avatar::enableInput()
|
||||||
|
|
||||||
if (dsq->continuity.form == FORM_ENERGY)
|
if (dsq->continuity.form == FORM_ENERGY)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < targetQuads.size(); i++)
|
for (size_t i = 0; i < targetQuads.size(); i++)
|
||||||
targetQuads[i]->start();
|
targetQuads[i]->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1292,7 +1292,7 @@ void Avatar::disableInput()
|
||||||
dsq->setMousePosition(Vector(400,300));
|
dsq->setMousePosition(Vector(400,300));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < targetQuads.size(); i++)
|
for (size_t i = 0; i < targetQuads.size(); i++)
|
||||||
{
|
{
|
||||||
targetQuads[i]->stop();
|
targetQuads[i]->stop();
|
||||||
}
|
}
|
||||||
|
@ -1302,7 +1302,7 @@ void Avatar::disableInput()
|
||||||
|
|
||||||
void Avatar::clearTargets()
|
void Avatar::clearTargets()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
if (targets[i].e)
|
if (targets[i].e)
|
||||||
{
|
{
|
||||||
|
@ -1329,7 +1329,7 @@ void Avatar::openSingingInterface(InputDevice device)
|
||||||
currentSongIdx = SONG_NONE;
|
currentSongIdx = SONG_NONE;
|
||||||
|
|
||||||
// make the singing icons appear
|
// make the singing icons appear
|
||||||
for (int i = 0; i < songIcons.size(); i++)
|
for (size_t i = 0; i < songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
songIcons[i]->openInterface();
|
songIcons[i]->openInterface();
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1362,7 @@ void Avatar::closeSingingInterface()
|
||||||
applyRidingPosition();
|
applyRidingPosition();
|
||||||
singing = false;
|
singing = false;
|
||||||
|
|
||||||
for (int i = 0; i < songIcons.size(); i++)
|
for (size_t i = 0; i < songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
songIcons[i]->closeInterface();
|
songIcons[i]->closeInterface();
|
||||||
}
|
}
|
||||||
|
@ -1452,7 +1452,7 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
|
||||||
os2 << "lastForm: " << lastForm;
|
os2 << "lastForm: " << lastForm;
|
||||||
debugLog(os2.str());
|
debugLog(os2.str());
|
||||||
|
|
||||||
for (int i = 0; i < targetQuads.size(); i++)
|
for (size_t i = 0; i < targetQuads.size(); i++)
|
||||||
{
|
{
|
||||||
if (targetQuads[i])
|
if (targetQuads[i])
|
||||||
targetQuads[i]->stop();
|
targetQuads[i]->stop();
|
||||||
|
@ -1604,17 +1604,15 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
|
||||||
dsq->game->sceneColor3.interpolateTo(Vector(1,1,1), 0.2);
|
dsq->game->sceneColor3.interpolateTo(Vector(1,1,1), 0.2);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
float lastHairAlphaMod = 0;
|
|
||||||
if (hair)
|
if (hair)
|
||||||
{
|
{
|
||||||
hair->alphaMod = 0;
|
hair->alphaMod = 0;
|
||||||
lastHairAlphaMod = hair->alphaMod;
|
|
||||||
}
|
}
|
||||||
switch (form)
|
switch (form)
|
||||||
{
|
{
|
||||||
case FORM_ENERGY:
|
case FORM_ENERGY:
|
||||||
refreshModel("Naija", "EnergyForm");
|
refreshModel("Naija", "EnergyForm");
|
||||||
for (int i = 0; i < targetQuads.size(); i++)
|
for (size_t i = 0; i < targetQuads.size(); i++)
|
||||||
targetQuads[i]->start();
|
targetQuads[i]->start();
|
||||||
leftHandEmitter->load("EnergyFormHandGlow");
|
leftHandEmitter->load("EnergyFormHandGlow");
|
||||||
leftHandEmitter->start();
|
leftHandEmitter->start();
|
||||||
|
@ -1738,7 +1736,7 @@ void Avatar::updateSingingInterface(float dt)
|
||||||
{
|
{
|
||||||
float smallestDist = HUGE_VALF;
|
float smallestDist = HUGE_VALF;
|
||||||
int closest = -1;
|
int closest = -1;
|
||||||
for (int i = 0; i < songIcons.size(); i++)
|
for (size_t i = 0; i < songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
float dist = (songIcons[i]->position - core->mouse.position).getSquaredLength2D();
|
float dist = (songIcons[i]->position - core->mouse.position).getSquaredLength2D();
|
||||||
if (dist < smallestDist)
|
if (dist < smallestDist)
|
||||||
|
@ -1793,7 +1791,7 @@ void Avatar::updateSingingInterface(float dt)
|
||||||
if (!setNote)
|
if (!setNote)
|
||||||
{
|
{
|
||||||
bool alreadyAtNote = false;
|
bool alreadyAtNote = false;
|
||||||
for (int i = 0; i < songIcons.size(); i++)
|
for (size_t i = 0; i < songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
const float dist = (songIcons[i]->position - core->mouse.position).getSquaredLength2D();
|
const float dist = (songIcons[i]->position - core->mouse.position).getSquaredLength2D();
|
||||||
if (dist <= sqr(NOTE_ACCEPT_DISTANCE))
|
if (dist <= sqr(NOTE_ACCEPT_DISTANCE))
|
||||||
|
@ -1820,7 +1818,7 @@ void Avatar::setSongIconPositions()
|
||||||
{
|
{
|
||||||
float radIncr = (2*PI)/float(songIcons.size());
|
float radIncr = (2*PI)/float(songIcons.size());
|
||||||
float rad = 0;
|
float rad = 0;
|
||||||
for (int i = 0; i < songIcons.size(); i++)
|
for (size_t i = 0; i < songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
songIcons[i]->position = Vector(400,300)+/*this->position + */Vector(sinf(rad)*singingInterfaceRadius, cosf(rad)*singingInterfaceRadius);
|
songIcons[i]->position = Vector(400,300)+/*this->position + */Vector(sinf(rad)*singingInterfaceRadius, cosf(rad)*singingInterfaceRadius);
|
||||||
rad += radIncr;
|
rad += radIncr;
|
||||||
|
@ -1877,7 +1875,7 @@ Target Avatar::getNearestTarget(const Vector &checkPos, const Vector &distPos, E
|
||||||
{
|
{
|
||||||
if (ignore)
|
if (ignore)
|
||||||
{
|
{
|
||||||
int j = 0;
|
size_t j = 0;
|
||||||
for (; j < ignore->size(); j++)
|
for (; j < ignore->size(); j++)
|
||||||
{
|
{
|
||||||
if ((*ignore)[j].e == e)
|
if ((*ignore)[j].e == e)
|
||||||
|
@ -1895,7 +1893,7 @@ Target Avatar::getNearestTarget(const Vector &checkPos, const Vector &distPos, E
|
||||||
{
|
{
|
||||||
if (ignore)
|
if (ignore)
|
||||||
{
|
{
|
||||||
int j = 0;
|
size_t j = 0;
|
||||||
for (; j < ignore->size(); j++)
|
for (; j < ignore->size(); j++)
|
||||||
{
|
{
|
||||||
if ((*ignore)[j].e == e && (*ignore)[j].targetPt == i)
|
if ((*ignore)[j].e == e && (*ignore)[j].targetPt == i)
|
||||||
|
@ -1939,7 +1937,7 @@ bool wasDown = false;
|
||||||
void Avatar::updateTargets(float dt, bool override)
|
void Avatar::updateTargets(float dt, bool override)
|
||||||
{
|
{
|
||||||
DamageType damageType = DT_AVATAR_ENERGYBLAST;
|
DamageType damageType = DT_AVATAR_ENERGYBLAST;
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
if (!targets[i].e
|
if (!targets[i].e
|
||||||
|| !targets[i].e->isPresent()
|
|| !targets[i].e->isPresent()
|
||||||
|
@ -1999,7 +1997,7 @@ void Avatar::updateTargets(float dt, bool override)
|
||||||
}
|
}
|
||||||
if (targets.empty())
|
if (targets.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < oldTargets.size(); i++)
|
for (size_t i = 0; i < oldTargets.size(); i++)
|
||||||
{
|
{
|
||||||
Entity *e = oldTargets[i].e;
|
Entity *e = oldTargets[i].e;
|
||||||
if (e)
|
if (e)
|
||||||
|
@ -2021,7 +2019,7 @@ void Avatar::updateTargets(float dt, bool override)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
Entity *e = targets[i].e;
|
Entity *e = targets[i].e;
|
||||||
if (e)
|
if (e)
|
||||||
|
@ -2053,7 +2051,7 @@ void Avatar::updateTargetQuads(float dt)
|
||||||
|
|
||||||
static Entity *lastTargetE = 0;
|
static Entity *lastTargetE = 0;
|
||||||
const float tt = 0.02;
|
const float tt = 0.02;
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
if (targets[i].e)
|
if (targets[i].e)
|
||||||
{
|
{
|
||||||
|
@ -2094,7 +2092,7 @@ void Avatar::updateTargetQuads(float dt)
|
||||||
|
|
||||||
if (targets.empty())
|
if (targets.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < targetQuads.size(); i++)
|
for (size_t i = 0; i < targetQuads.size(); i++)
|
||||||
{
|
{
|
||||||
if (lastTargetE != 0)
|
if (lastTargetE != 0)
|
||||||
{
|
{
|
||||||
|
@ -2205,7 +2203,7 @@ bool Avatar::fireAtNearestValidEntity(const std::string &shot)
|
||||||
if (!targets.empty())
|
if (!targets.empty())
|
||||||
{
|
{
|
||||||
//homing = home;
|
//homing = home;
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if (!aimAt)
|
if (!aimAt)
|
||||||
|
@ -2832,9 +2830,9 @@ Vector Avatar::getTendrilAimVector(int i, int max)
|
||||||
return aim;
|
return aim;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Avatar::getNumShots()
|
size_t Avatar::getNumShots()
|
||||||
{
|
{
|
||||||
int thits = normalTendrilHits;
|
size_t thits = normalTendrilHits;
|
||||||
if (flourishPowerTimer.isActive())
|
if (flourishPowerTimer.isActive())
|
||||||
{
|
{
|
||||||
if (lastBurstType == BURST_WALL)
|
if (lastBurstType == BURST_WALL)
|
||||||
|
@ -2855,17 +2853,17 @@ int Avatar::getNumShots()
|
||||||
|
|
||||||
void Avatar::doShock(const std::string &shotName)
|
void Avatar::doShock(const std::string &shotName)
|
||||||
{
|
{
|
||||||
int c = 0;
|
size_t c = 0;
|
||||||
std::vector <Entity*> entitiesToHit;
|
std::vector <Entity*> entitiesToHit;
|
||||||
std::vector <Target> localTargets;
|
std::vector <Target> localTargets;
|
||||||
bool clearTargets = true;
|
bool clearTargets = true;
|
||||||
|
|
||||||
int thits = getNumShots();
|
size_t thits = getNumShots();
|
||||||
|
|
||||||
if (!targets.empty() && targets[0].e != 0)
|
if (!targets.empty() && targets[0].e != 0)
|
||||||
{
|
{
|
||||||
clearTargets = false;
|
clearTargets = false;
|
||||||
for (int i = 0; i < thits; i++)
|
for (size_t i = 0; i < thits; i++)
|
||||||
{
|
{
|
||||||
entitiesToHit.push_back(targets[0].e);
|
entitiesToHit.push_back(targets[0].e);
|
||||||
}
|
}
|
||||||
|
@ -2894,7 +2892,7 @@ void Avatar::doShock(const std::string &shotName)
|
||||||
{
|
{
|
||||||
while (entitiesToHit.size()<thits)
|
while (entitiesToHit.size()<thits)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < localTargets.size(); i++)
|
for (size_t i = 0; i < localTargets.size(); i++)
|
||||||
{
|
{
|
||||||
if (!(entitiesToHit.size()<thits))
|
if (!(entitiesToHit.size()<thits))
|
||||||
break;
|
break;
|
||||||
|
@ -2913,7 +2911,7 @@ void Avatar::doShock(const std::string &shotName)
|
||||||
|
|
||||||
if (sz == 0)
|
if (sz == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < thits; i++)
|
for (size_t i = 0; i < thits; i++)
|
||||||
{
|
{
|
||||||
Shot *s = dsq->game->fireShot(shotName, this, 0);
|
Shot *s = dsq->game->fireShot(shotName, this, 0);
|
||||||
|
|
||||||
|
@ -2932,7 +2930,7 @@ void Avatar::doShock(const std::string &shotName)
|
||||||
Shot *s = dsq->game->fireShot(shotName, this, e);
|
Shot *s = dsq->game->fireShot(shotName, this, e);
|
||||||
if (!targets.empty())
|
if (!targets.empty())
|
||||||
{
|
{
|
||||||
for (int j = 0; j < targets.size(); j++)
|
for (size_t j = 0; j < targets.size(); j++)
|
||||||
{
|
{
|
||||||
if (targets[j].e == e)
|
if (targets[j].e == e)
|
||||||
s->targetPt = targets[j].targetPt;
|
s->targetPt = targets[j].targetPt;
|
||||||
|
@ -3744,7 +3742,7 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
||||||
dsq->game->addRenderObject(tripper, LR_AFTER_EFFECTS);
|
dsq->game->addRenderObject(tripper, LR_AFTER_EFFECTS);
|
||||||
|
|
||||||
songIcons.resize(8);
|
songIcons.resize(8);
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < songIcons.size(); i++)
|
for (i = 0; i < songIcons.size(); i++)
|
||||||
{
|
{
|
||||||
songIcons[i] = new SongIcon(i);
|
songIcons[i] = new SongIcon(i);
|
||||||
|
@ -6908,7 +6906,7 @@ void Avatar::onWarp()
|
||||||
|
|
||||||
bool Avatar::checkWarpAreas()
|
bool Avatar::checkWarpAreas()
|
||||||
{
|
{
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < dsq->game->getNumPaths(); i++)
|
for (i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
bool warp = false;
|
bool warp = false;
|
||||||
|
|
|
@ -74,7 +74,7 @@ enum SeeMapMode
|
||||||
class SongIconParticle : public Quad
|
class SongIconParticle : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SongIconParticle(Vector color, Vector pos, int note);
|
SongIconParticle(Vector color, Vector pos, size_t note);
|
||||||
int note;
|
int note;
|
||||||
SongIcon *toIcon;
|
SongIcon *toIcon;
|
||||||
protected:
|
protected:
|
||||||
|
@ -84,9 +84,9 @@ protected:
|
||||||
class SongIcon : public Quad
|
class SongIcon : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SongIcon(int note);
|
SongIcon(size_t note);
|
||||||
void destroy();
|
void destroy();
|
||||||
int note;
|
size_t note;
|
||||||
void openNote();
|
void openNote();
|
||||||
void closeNote();
|
void closeNote();
|
||||||
void openInterface();
|
void openInterface();
|
||||||
|
@ -340,7 +340,7 @@ protected:
|
||||||
Timer webBitTimer;
|
Timer webBitTimer;
|
||||||
int curWebPoint;
|
int curWebPoint;
|
||||||
void checkUpgradeForShot(Shot *s);
|
void checkUpgradeForShot(Shot *s);
|
||||||
int getNumShots();
|
size_t getNumShots();
|
||||||
void lockToWallCommon();
|
void lockToWallCommon();
|
||||||
void onSetBoneLock();
|
void onSetBoneLock();
|
||||||
void onUpdateBoneLock();
|
void onUpdateBoneLock();
|
||||||
|
|
|
@ -141,7 +141,7 @@ void BitBlotLogo::applyState()
|
||||||
dragon->loadSkeletal("bb-dragon");
|
dragon->loadSkeletal("bb-dragon");
|
||||||
dragon->animate("idle", -1);
|
dragon->animate("idle", -1);
|
||||||
dragon->position = Vector(300 , -100);
|
dragon->position = Vector(300 , -100);
|
||||||
for (int i = 0; i < dragon->bones.size(); i++)
|
for (size_t i = 0; i < dragon->bones.size(); i++)
|
||||||
{
|
{
|
||||||
dragon->getBoneByIdx(i)->shareAlphaWithChildren = 1;
|
dragon->getBoneByIdx(i)->shareAlphaWithChildren = 1;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ void BitBlotLogo::applyState()
|
||||||
landscape->addChild(windmill, PM_POINTER, RBP_OFF);
|
landscape->addChild(windmill, PM_POINTER, RBP_OFF);
|
||||||
windmill->update((rand()%100)*0.1f);
|
windmill->update((rand()%100)*0.1f);
|
||||||
windmill->scale = Vector(0.7, 0.7);
|
windmill->scale = Vector(0.7, 0.7);
|
||||||
for (int i = 0; i < windmill->bones.size(); i++)
|
for (size_t i = 0; i < windmill->bones.size(); i++)
|
||||||
{
|
{
|
||||||
windmill->getBoneByIdx(i)->alpha = 0.7;
|
windmill->getBoneByIdx(i)->alpha = 0.7;
|
||||||
}
|
}
|
||||||
|
@ -172,11 +172,11 @@ void BitBlotLogo::applyState()
|
||||||
|
|
||||||
if (windmills.size() >= 2)
|
if (windmills.size() >= 2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < windmills.size()-1; i++)
|
for (size_t i = 0; i < windmills.size()-1; i++)
|
||||||
{
|
{
|
||||||
if (windmills[i]->position.y < 4000)
|
if (windmills[i]->position.y < 4000)
|
||||||
{
|
{
|
||||||
for (int j = i+1; j < windmills.size(); j++)
|
for (size_t j = i+1; j < windmills.size(); j++)
|
||||||
{
|
{
|
||||||
if (windmills[j]->position.y < 4000)
|
if (windmills[j]->position.y < 4000)
|
||||||
{
|
{
|
||||||
|
|
|
@ -189,7 +189,7 @@ void CollideEntity::updateMovement(float dt)
|
||||||
{
|
{
|
||||||
vel += Vector(0, weight*dt);
|
vel += Vector(0, weight*dt);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < attachedEntities.size(); i++)
|
for (size_t i = 0; i < attachedEntities.size(); i++)
|
||||||
{
|
{
|
||||||
attachedEntities[i]->position = this->position + attachedEntitiesOffsets[i];
|
attachedEntities[i]->position = this->position + attachedEntitiesOffsets[i];
|
||||||
attachedEntities[i]->rotation = this->rotation;
|
attachedEntities[i]->rotation = this->rotation;
|
||||||
|
|
|
@ -60,7 +60,7 @@ Continuity::Continuity()
|
||||||
|
|
||||||
bool Continuity::isIngredientFull(IngredientData *data)
|
bool Continuity::isIngredientFull(IngredientData *data)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ingredients.size(); i++)
|
for (size_t i = 0; i < ingredients.size(); i++)
|
||||||
{
|
{
|
||||||
if (nocasecmp(ingredients[i]->name, data->name)==0)
|
if (nocasecmp(ingredients[i]->name, data->name)==0)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ void Continuity::pickupIngredient(IngredientData *d, int amount, bool effects, b
|
||||||
|
|
||||||
int Continuity::indexOfIngredientData(const IngredientData* data) const
|
int Continuity::indexOfIngredientData(const IngredientData* data) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ingredientData.size(); i++)
|
for (size_t i = 0; i < ingredientData.size(); i++)
|
||||||
{
|
{
|
||||||
if (ingredientData[i]->name == data->name)
|
if (ingredientData[i]->name == data->name)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ int Continuity::indexOfIngredientData(const IngredientData* data) const
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FOR_INGREDIENTDATA(x) for (int x = 0; x < ingredientData.size(); x++)
|
#define FOR_INGREDIENTDATA(x) for (size_t x = 0; x < ingredientData.size(); x++)
|
||||||
|
|
||||||
IngredientData *Continuity::getIngredientDataByName(const std::string &name)
|
IngredientData *Continuity::getIngredientDataByName(const std::string &name)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ IngredientData *Continuity::getIngredientDataByName(const std::string &name)
|
||||||
|
|
||||||
IngredientData *Continuity::getIngredientHeldByName(const std::string &name) const
|
IngredientData *Continuity::getIngredientHeldByName(const std::string &name) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ingredients.size(); i++) {
|
for (size_t i = 0; i < ingredients.size(); i++) {
|
||||||
if (nocasecmp(ingredients[i]->name, name)==0)
|
if (nocasecmp(ingredients[i]->name, name)==0)
|
||||||
return ingredients[i];
|
return ingredients[i];
|
||||||
}
|
}
|
||||||
|
@ -183,15 +183,15 @@ std::string Continuity::getIngredientDisplayName(const std::string& name) const
|
||||||
return splitCamelCase(name);
|
return splitCamelCase(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
IngredientData *Continuity::getIngredientHeldByIndex(int idx) const
|
IngredientData *Continuity::getIngredientHeldByIndex(size_t idx) const
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= ingredients.size()) return 0;
|
if (idx >= ingredients.size()) return 0;
|
||||||
return ingredients[idx];
|
return ingredients[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
IngredientData *Continuity::getIngredientDataByIndex(int idx)
|
IngredientData *Continuity::getIngredientDataByIndex(size_t idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= ingredientData.size()) return 0;
|
if (idx >= ingredientData.size()) return 0;
|
||||||
return ingredientData[idx];
|
return ingredientData[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,14 +277,14 @@ void Continuity::sortFood()
|
||||||
|
|
||||||
std::vector<IngredientData*> sort;
|
std::vector<IngredientData*> sort;
|
||||||
|
|
||||||
for (int i = 0; i < dsq->continuity.ingredients.size(); i++)
|
for (size_t i = 0; i < dsq->continuity.ingredients.size(); i++)
|
||||||
{
|
{
|
||||||
dsq->continuity.ingredients[i]->sorted = false;
|
dsq->continuity.ingredients[i]->sorted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < sortOrder.size(); j++)
|
for (size_t j = 0; j < sortOrder.size(); j++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dsq->continuity.ingredients.size(); i++)
|
for (size_t i = 0; i < dsq->continuity.ingredients.size(); i++)
|
||||||
{
|
{
|
||||||
IngredientData *data = dsq->continuity.ingredients[i];
|
IngredientData *data = dsq->continuity.ingredients[i];
|
||||||
if (!data->sorted)
|
if (!data->sorted)
|
||||||
|
@ -301,7 +301,7 @@ void Continuity::sortFood()
|
||||||
}
|
}
|
||||||
else if (sortOrder[j].effectType != IET_NONE)
|
else if (sortOrder[j].effectType != IET_NONE)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < data->effects.size(); c++)
|
for (size_t c = 0; c < data->effects.size(); c++)
|
||||||
{
|
{
|
||||||
if (data->effects[c].type == sortOrder[j].effectType)
|
if (data->effects[c].type == sortOrder[j].effectType)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +323,7 @@ void Continuity::sortFood()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < dsq->continuity.ingredients.size(); i++)
|
for (size_t i = 0; i < dsq->continuity.ingredients.size(); i++)
|
||||||
{
|
{
|
||||||
IngredientData *data = dsq->continuity.ingredients[i];
|
IngredientData *data = dsq->continuity.ingredients[i];
|
||||||
if (!data->sorted)
|
if (!data->sorted)
|
||||||
|
@ -334,7 +334,7 @@ void Continuity::sortFood()
|
||||||
}
|
}
|
||||||
|
|
||||||
ingredients.clear();
|
ingredients.clear();
|
||||||
for (int i = 0; i < sort.size(); i++) {
|
for (size_t i = 0; i < sort.size(); i++) {
|
||||||
ingredients.push_back(sort[i]);
|
ingredients.push_back(sort[i]);
|
||||||
}
|
}
|
||||||
sort.clear();
|
sort.clear();
|
||||||
|
@ -445,9 +445,9 @@ void Continuity::setFishPoison(float m, float t)
|
||||||
fishPoison = m;
|
fishPoison = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Continuity::getIEString(IngredientData *data, int i)
|
std::string Continuity::getIEString(IngredientData *data, size_t i)
|
||||||
{
|
{
|
||||||
if (i < 0 || i >= data->effects.size()) return "";
|
if (i >= data->effects.size()) return "";
|
||||||
|
|
||||||
IngredientEffect fx = data->effects[i];
|
IngredientEffect fx = data->effects[i];
|
||||||
IngredientEffectType useType = fx.type;
|
IngredientEffectType useType = fx.type;
|
||||||
|
@ -572,7 +572,7 @@ std::string Continuity::getAllIEString(IngredientData *data)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
||||||
for (int i = 0; i < data->effects.size(); i++)
|
for (size_t i = 0; i < data->effects.size(); i++)
|
||||||
{
|
{
|
||||||
os << getIEString(data, i) << "\n";
|
os << getIEString(data, i) << "\n";
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ bool Continuity::applyIngredientEffects(IngredientData *data)
|
||||||
{
|
{
|
||||||
bool eaten = true;
|
bool eaten = true;
|
||||||
float y =0;
|
float y =0;
|
||||||
for (int i = 0; i < data->effects.size(); i++)
|
for (size_t i = 0; i < data->effects.size(); i++)
|
||||||
{
|
{
|
||||||
y = 300 + i * 40;
|
y = 300 + i * 40;
|
||||||
IngredientEffect fx = data->effects[i];
|
IngredientEffect fx = data->effects[i];
|
||||||
|
@ -955,8 +955,8 @@ void Continuity::loadIngredientData(const std::string &file)
|
||||||
|
|
||||||
if (!effects.empty())
|
if (!effects.empty())
|
||||||
{
|
{
|
||||||
int p1 = effects.find("(");
|
size_t p1 = effects.find("(");
|
||||||
int p2 = effects.find(")");
|
size_t p2 = effects.find(")");
|
||||||
if (p1 != std::string::npos && p2 != std::string::npos)
|
if (p1 != std::string::npos && p2 != std::string::npos)
|
||||||
{
|
{
|
||||||
effects = effects.substr(p1+1, p2-(p1+1));
|
effects = effects.substr(p1+1, p2-(p1+1));
|
||||||
|
@ -1053,7 +1053,7 @@ void Continuity::loadIngredientData(const std::string &file)
|
||||||
fx.type = IET_SCRIPT;
|
fx.type = IET_SCRIPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int c = 0;
|
size_t c = 0;
|
||||||
while (c < bit.size())
|
while (c < bit.size())
|
||||||
{
|
{
|
||||||
if (bit[c] == '+')
|
if (bit[c] == '+')
|
||||||
|
@ -1309,7 +1309,7 @@ std::string Continuity::getVoxForSongSlot(int songSlot)
|
||||||
|
|
||||||
EatData *Continuity::getEatData(const std::string &name)
|
EatData *Continuity::getEatData(const std::string &name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < eats.size(); i++)
|
for (size_t i = 0; i < eats.size(); i++)
|
||||||
{
|
{
|
||||||
if (eats[i].name == name)
|
if (eats[i].name == name)
|
||||||
return &eats[i];
|
return &eats[i];
|
||||||
|
@ -1607,7 +1607,7 @@ void Continuity::castSong(int num)
|
||||||
e->song((SongType)num);
|
e->song((SongType)num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < dsq->game->getNumPaths(); i++)
|
for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
Path *p = dsq->game->getPath(i);
|
Path *p = dsq->game->getPath(i);
|
||||||
if (p && !p->nodes.empty())
|
if (p && !p->nodes.empty())
|
||||||
|
@ -1642,13 +1642,13 @@ bool Continuity::isSongTypeForm(SongType s)
|
||||||
return (s == SONG_ENERGYFORM || s == SONG_BEASTFORM || s == SONG_NATUREFORM || s == SONG_SUNFORM || s == SONG_SPIRITFORM || s == SONG_FISHFORM || s== SONG_DUALFORM);
|
return (s == SONG_ENERGYFORM || s == SONG_BEASTFORM || s == SONG_NATUREFORM || s == SONG_SUNFORM || s == SONG_SPIRITFORM || s == SONG_FISHFORM || s== SONG_DUALFORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Continuity::shortenSong(Song &song, int size)
|
void Continuity::shortenSong(Song &song, size_t size)
|
||||||
{
|
{
|
||||||
if (song.notes.size() > size)
|
if (song.notes.size() > size)
|
||||||
{
|
{
|
||||||
Song copy = song;
|
Song copy = song;
|
||||||
song.notes.clear();
|
song.notes.clear();
|
||||||
for (int i = copy.notes.size()-size; i < copy.notes.size(); i++)
|
for (size_t i = copy.notes.size()-size; i < copy.notes.size(); i++)
|
||||||
{
|
{
|
||||||
song.notes.push_back(copy.notes[i]);
|
song.notes.push_back(copy.notes[i]);
|
||||||
}
|
}
|
||||||
|
@ -1674,7 +1674,7 @@ int Continuity::checkSongAssisted(const Song &s)
|
||||||
shortenSong(song, 64);
|
shortenSong(song, 64);
|
||||||
|
|
||||||
std::vector<SongCheck> songChecks;
|
std::vector<SongCheck> songChecks;
|
||||||
for (int c = 0; c < songBank.size(); c++)
|
for (size_t c = 0; c < songBank.size(); c++)
|
||||||
{
|
{
|
||||||
int i = songSlotsToType[c];
|
int i = songSlotsToType[c];
|
||||||
if (knowsSong[i])
|
if (knowsSong[i])
|
||||||
|
@ -1683,9 +1683,10 @@ int Continuity::checkSongAssisted(const Song &s)
|
||||||
songChecks.push_back(SongCheck(i, s));
|
songChecks.push_back(SongCheck(i, s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < songChecks.size(); i++)
|
for (size_t i = 0; i < songChecks.size(); i++)
|
||||||
{
|
{
|
||||||
int j=0,c=0,m=0,last=0,rank=0;
|
size_t j = 0;
|
||||||
|
int c=0,m=0,last=0,rank=0;
|
||||||
int ms=songChecks[i].song->notes.size();
|
int ms=songChecks[i].song->notes.size();
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
|
@ -1739,7 +1740,7 @@ loop:
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
int songIdx = SONG_NONE, lowestRank = -1;
|
int songIdx = SONG_NONE, lowestRank = -1;
|
||||||
for (int i = 0; i < songChecks.size(); i++)
|
for (size_t i = 0; i < songChecks.size(); i++)
|
||||||
{
|
{
|
||||||
if (songChecks[i].pass)
|
if (songChecks[i].pass)
|
||||||
{
|
{
|
||||||
|
@ -1762,21 +1763,21 @@ int Continuity::checkSong(const Song &song)
|
||||||
bool knowAllSongs = false;
|
bool knowAllSongs = false;
|
||||||
// way too long song
|
// way too long song
|
||||||
if (song.notes.size() > 64) return SONG_NONE;
|
if (song.notes.size() > 64) return SONG_NONE;
|
||||||
for (int c = 0; c < songBank.size(); c++)
|
for (size_t c = 0; c < songBank.size(); c++)
|
||||||
{
|
{
|
||||||
int i = songSlotsToType[c];
|
int i = songSlotsToType[c];
|
||||||
if ((knowAllSongs || knowsSong[i]))
|
if ((knowAllSongs || knowsSong[i]))
|
||||||
{
|
{
|
||||||
Song *s = &songBank[i];
|
Song *s = &songBank[i];
|
||||||
if (s->notes.empty()) continue;
|
if (s->notes.empty()) continue;
|
||||||
int j = 0;
|
size_t j = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
bool foundSong = false;
|
bool foundSong = false;
|
||||||
int currentNote = 0;
|
size_t currentNote = 0;
|
||||||
for (j = 0; j < song.notes.size(); j++)
|
for (j = 0; j < song.notes.size(); j++)
|
||||||
{
|
{
|
||||||
if (currentNote >= 0 && currentNote < (*s).notes.size())
|
if (currentNote < (*s).notes.size())
|
||||||
{
|
{
|
||||||
int bankNote = (*s).notes[currentNote];
|
int bankNote = (*s).notes[currentNote];
|
||||||
int songNote = song.notes[j];
|
int songNote = song.notes[j];
|
||||||
|
@ -2083,11 +2084,11 @@ void Continuity::eatBeast(const EatData &eatData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Continuity::removeNaijaEat(int idx)
|
void Continuity::removeNaijaEat(size_t idx)
|
||||||
{
|
{
|
||||||
std::vector<EatData> copy = naijaEats;
|
std::vector<EatData> copy = naijaEats;
|
||||||
naijaEats.clear();
|
naijaEats.clear();
|
||||||
for (int i = 0; i < copy.size(); i++)
|
for (size_t i = 0; i < copy.size(); i++)
|
||||||
{
|
{
|
||||||
if (i != idx)
|
if (i != idx)
|
||||||
naijaEats.push_back(copy[i]);
|
naijaEats.push_back(copy[i]);
|
||||||
|
@ -2167,7 +2168,7 @@ void Continuity::initAvatar(Avatar *a)
|
||||||
|
|
||||||
void Continuity::spawnAllIngredients(const Vector &position)
|
void Continuity::spawnAllIngredients(const Vector &position)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ingredientData.size(); i++)
|
for (size_t i = 0; i < ingredientData.size(); i++)
|
||||||
{
|
{
|
||||||
dsq->game->spawnIngredient(ingredientData[i]->name, position, 4, 0);
|
dsq->game->spawnIngredient(ingredientData[i]->name, position, 4, 0);
|
||||||
}
|
}
|
||||||
|
@ -2227,9 +2228,9 @@ void Continuity::loadPetData()
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
PetData *Continuity::getPetData(int idx)
|
PetData *Continuity::getPetData(size_t idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= petData.size())
|
if (idx >= petData.size())
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "getPetData(" << idx << ") index out of range";
|
os << "getPetData(" << idx << ") index out of range";
|
||||||
|
@ -2405,7 +2406,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
||||||
XMLElement *vox = doc.NewElement("VO");
|
XMLElement *vox = doc.NewElement("VO");
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
for (int i = 0; i < dsq->continuity.voiceOversPlayed.size(); i++)
|
for (size_t i = 0; i < dsq->continuity.voiceOversPlayed.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
os << dsq->continuity.voiceOversPlayed[i] << " ";
|
os << dsq->continuity.voiceOversPlayed[i] << " ";
|
||||||
|
@ -2487,7 +2488,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
||||||
|
|
||||||
// new format as used by android version
|
// new format as used by android version
|
||||||
std::ostringstream ingrNames;
|
std::ostringstream ingrNames;
|
||||||
for (int i = 0; i < ingredients.size(); i++)
|
for (size_t i = 0; i < ingredients.size(); i++)
|
||||||
{
|
{
|
||||||
IngredientData *data = ingredients[i];
|
IngredientData *data = ingredients[i];
|
||||||
ingrNames << data->name << " " << data->amount << " ";
|
ingrNames << data->name << " " << data->amount << " ";
|
||||||
|
@ -2496,7 +2497,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
||||||
|
|
||||||
// for compatibility with older versions
|
// for compatibility with older versions
|
||||||
std::ostringstream ingrOs;
|
std::ostringstream ingrOs;
|
||||||
for (int i = 0; i < ingredients.size(); i++)
|
for (size_t i = 0; i < ingredients.size(); i++)
|
||||||
{
|
{
|
||||||
IngredientData *data = ingredients[i];
|
IngredientData *data = ingredients[i];
|
||||||
ingrOs << data->getIndex() << " " << data->amount << " ";
|
ingrOs << data->getIndex() << " " << data->amount << " ";
|
||||||
|
@ -2504,7 +2505,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
||||||
startData->SetAttribute("ingr", ingrOs.str().c_str());
|
startData->SetAttribute("ingr", ingrOs.str().c_str());
|
||||||
|
|
||||||
std::ostringstream recOs;
|
std::ostringstream recOs;
|
||||||
for (int i = 0; i < recipes.size(); i++)
|
for (size_t i = 0; i < recipes.size(); i++)
|
||||||
{
|
{
|
||||||
recOs << recipes[i].isKnown() << " ";
|
recOs << recipes[i].isKnown() << " ";
|
||||||
}
|
}
|
||||||
|
@ -2684,15 +2685,6 @@ void Continuity::loadFile(int slot)
|
||||||
|
|
||||||
this->reset();
|
this->reset();
|
||||||
|
|
||||||
int versionMajor=-1, versionMinor=-1, versionRevision=-1;
|
|
||||||
XMLElement *xmlVersion = doc.FirstChildElement("Version");
|
|
||||||
if (xmlVersion)
|
|
||||||
{
|
|
||||||
versionMajor = atoi(xmlVersion->Attribute("major"));
|
|
||||||
versionMinor = atoi(xmlVersion->Attribute("minor"));
|
|
||||||
versionRevision = atoi(xmlVersion->Attribute("revision"));
|
|
||||||
}
|
|
||||||
|
|
||||||
XMLElement *e = doc.FirstChildElement("Flag");
|
XMLElement *e = doc.FirstChildElement("Flag");
|
||||||
while (e)
|
while (e)
|
||||||
{
|
{
|
||||||
|
@ -2700,8 +2692,6 @@ void Continuity::loadFile(int slot)
|
||||||
e = e->NextSiblingElement("Flag");
|
e = e->NextSiblingElement("Flag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
XMLElement *efx = doc.FirstChildElement("EFX");
|
XMLElement *efx = doc.FirstChildElement("EFX");
|
||||||
if (efx)
|
if (efx)
|
||||||
{
|
{
|
||||||
|
@ -3013,7 +3003,7 @@ void Continuity::loadFile(int slot)
|
||||||
{
|
{
|
||||||
std::istringstream is(startData->Attribute("rec"));
|
std::istringstream is(startData->Attribute("rec"));
|
||||||
|
|
||||||
for (int i = 0; i < recipes.size(); i++)
|
for (size_t i = 0; i < recipes.size(); i++)
|
||||||
{
|
{
|
||||||
bool known = false;
|
bool known = false;
|
||||||
is >> known;
|
is >> known;
|
||||||
|
@ -3421,7 +3411,7 @@ void Continuity::learnRecipe(Recipe *r, bool effects)
|
||||||
|
|
||||||
void Continuity::learnRecipe(const std::string &result, bool effects)
|
void Continuity::learnRecipe(const std::string &result, bool effects)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < recipes.size(); i++)
|
for (size_t i = 0; i < recipes.size(); i++)
|
||||||
{
|
{
|
||||||
if (nocasecmp(recipes[i].result, result)==0)
|
if (nocasecmp(recipes[i].result, result)==0)
|
||||||
{
|
{
|
||||||
|
@ -3540,9 +3530,9 @@ void Continuity::reset()
|
||||||
core->resetTimer();
|
core->resetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
float Continuity::getSpeedType(int speedType)
|
float Continuity::getSpeedType(size_t speedType)
|
||||||
{
|
{
|
||||||
if (speedType >= speedTypes.size() || speedType < 0)
|
if (speedType >= speedTypes.size())
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "speedType: " << speedType << " out of range";
|
os << "speedType: " << speedType << " out of range";
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
void setCostume(const std::string &c);
|
void setCostume(const std::string &c);
|
||||||
|
|
||||||
void shortenSong(Song &song, int size);
|
void shortenSong(Song &song, size_t size);
|
||||||
void warpLiToAvatar();
|
void warpLiToAvatar();
|
||||||
|
|
||||||
void flingMonkey(Entity *e);
|
void flingMonkey(Entity *e);
|
||||||
|
@ -76,7 +76,7 @@ public:
|
||||||
std::string getDescriptionForSongSlot(int songSlot);
|
std::string getDescriptionForSongSlot(int songSlot);
|
||||||
std::string getVoxForSongSlot(int songSlot);
|
std::string getVoxForSongSlot(int songSlot);
|
||||||
|
|
||||||
std::string getIEString(IngredientData *data, int i);
|
std::string getIEString(IngredientData *data, size_t i);
|
||||||
std::string getAllIEString(IngredientData *data);
|
std::string getAllIEString(IngredientData *data);
|
||||||
|
|
||||||
std::string getInternalFormName();
|
std::string getInternalFormName();
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
float getStory();
|
float getStory();
|
||||||
void setStory(float v);
|
void setStory(float v);
|
||||||
|
|
||||||
float getSpeedType(int speedType);
|
float getSpeedType(size_t speedType);
|
||||||
void setNaijaModel(std::string model);
|
void setNaijaModel(std::string model);
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ public:
|
||||||
IngredientData *getIngredientHeldByName(const std::string &name) const; // an ingredient that the player actually has; in the ingredients list
|
IngredientData *getIngredientHeldByName(const std::string &name) const; // an ingredient that the player actually has; in the ingredients list
|
||||||
IngredientData *getIngredientDataByName(const std::string &name); // an ingredient in the general data list; ingredientData
|
IngredientData *getIngredientDataByName(const std::string &name); // an ingredient in the general data list; ingredientData
|
||||||
|
|
||||||
IngredientData *getIngredientHeldByIndex(int idx) const;
|
IngredientData *getIngredientHeldByIndex(size_t idx) const;
|
||||||
IngredientData *getIngredientDataByIndex(int idx);
|
IngredientData *getIngredientDataByIndex(size_t idx);
|
||||||
|
|
||||||
int getIngredientDataSize() const;
|
int getIngredientDataSize() const;
|
||||||
int getIngredientHeldSize() const;
|
int getIngredientHeldSize() const;
|
||||||
|
@ -242,13 +242,13 @@ public:
|
||||||
float speedMult2;
|
float speedMult2;
|
||||||
|
|
||||||
void eatBeast(const EatData &eatData);
|
void eatBeast(const EatData &eatData);
|
||||||
void removeNaijaEat(int idx);
|
void removeNaijaEat(size_t idx);
|
||||||
void removeLastNaijaEat();
|
void removeLastNaijaEat();
|
||||||
EatData *getLastNaijaEat();
|
EatData *getLastNaijaEat();
|
||||||
bool isNaijaEatsEmpty();
|
bool isNaijaEatsEmpty();
|
||||||
|
|
||||||
void loadPetData();
|
void loadPetData();
|
||||||
PetData *getPetData(int idx);
|
PetData *getPetData(size_t idx);
|
||||||
|
|
||||||
std::vector<EatData> naijaEats;
|
std::vector<EatData> naijaEats;
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ namespace AQCredits
|
||||||
|
|
||||||
std::vector<Quad*> slides;
|
std::vector<Quad*> slides;
|
||||||
|
|
||||||
void watchSlide(int slide)
|
void watchSlide(size_t slide)
|
||||||
{
|
{
|
||||||
float t = 10;
|
float t = 10;
|
||||||
|
|
||||||
if (!(slide >= 0 && slide < slides.size())) return;
|
if (slide >= slides.size()) return;
|
||||||
|
|
||||||
Quad *q = slides[slide];
|
Quad *q = slides[slide];
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace AQCredits
|
||||||
else
|
else
|
||||||
cred->alpha.interpolateTo(0, t, 0, 0, 1);
|
cred->alpha.interpolateTo(0, t, 0, 0, 1);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
using namespace AQCredits;
|
using namespace AQCredits;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ void Credits::applyState()
|
||||||
|
|
||||||
slides.resize(numSlides);
|
slides.resize(numSlides);
|
||||||
|
|
||||||
for (int i = 0; i < slides.size(); i++)
|
for (size_t i = 0; i < slides.size(); i++)
|
||||||
{
|
{
|
||||||
slides[i] = new Quad("credits/slide-" + numToZeroString(i, 4), Vector(400, 300));
|
slides[i] = new Quad("credits/slide-" + numToZeroString(i, 4), Vector(400, 300));
|
||||||
slides[i]->alpha = 0;
|
slides[i]->alpha = 0;
|
||||||
|
|
|
@ -131,8 +131,8 @@ static void Linux_CopyTree(const char *src, const char *dst)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
const int saveSlotPageSize = 4;
|
const size_t saveSlotPageSize = 4;
|
||||||
int maxPages = 15;
|
size_t maxPages = 15;
|
||||||
#ifdef AQUARIA_BUILD_CONSOLE
|
#ifdef AQUARIA_BUILD_CONSOLE
|
||||||
const int MAX_CONSOLELINES = 18;
|
const int MAX_CONSOLELINES = 18;
|
||||||
#endif
|
#endif
|
||||||
|
@ -325,15 +325,26 @@ void DSQ::loadElementEffects()
|
||||||
inFile.close();
|
inFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementEffect DSQ::getElementEffectByIndex(int e)
|
ElementEffect DSQ::getElementEffectByIndex(size_t e)
|
||||||
{
|
{
|
||||||
if (e < elementEffects.size() && e >= 0)
|
if (e < elementEffects.size())
|
||||||
{
|
{
|
||||||
return elementEffects[e];
|
return elementEffects[e];
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementEffect empty;
|
ElementEffect empty;
|
||||||
empty.type = EFX_NONE;
|
empty.type = EFX_NONE;
|
||||||
|
empty.alpha = 0;
|
||||||
|
empty.blendType = 0;
|
||||||
|
empty.color = 0;
|
||||||
|
empty.segsx = empty.segsy = 0;
|
||||||
|
empty.segs_dgmx = empty.segs_dgmy = 0;
|
||||||
|
empty.segs_dgo = 0;
|
||||||
|
empty.segs_dgox = empty.segs_dgoy = 0;
|
||||||
|
empty.segs_dgtm = 0;
|
||||||
|
empty.wavy_flip = false;
|
||||||
|
empty.wavy_max = empty.wavy_min = 0;
|
||||||
|
empty.wavy_radius = 0;
|
||||||
|
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
@ -1703,6 +1714,8 @@ void DSQ::setInputMode(InputDevice mode)
|
||||||
break;
|
break;
|
||||||
case INPUT_KEYBOARD:
|
case INPUT_KEYBOARD:
|
||||||
break;
|
break;
|
||||||
|
case INPUT_NODEVICE:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,7 +1769,7 @@ void DSQ::debugLog(const std::string &s)
|
||||||
if (consoleLines.size() > MAX_CONSOLELINES)
|
if (consoleLines.size() > MAX_CONSOLELINES)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < consoleLines.size()-1; i++)
|
for (size_t i = 0; i < consoleLines.size()-1; i++)
|
||||||
{
|
{
|
||||||
consoleLines[i] = consoleLines[i+1];
|
consoleLines[i] = consoleLines[i+1];
|
||||||
}
|
}
|
||||||
|
@ -1765,7 +1778,7 @@ void DSQ::debugLog(const std::string &s)
|
||||||
if (console)
|
if (console)
|
||||||
{
|
{
|
||||||
std::string text;
|
std::string text;
|
||||||
for (int i = 0; i < consoleLines.size(); i++)
|
for (size_t i = 0; i < consoleLines.size(); i++)
|
||||||
{
|
{
|
||||||
text += consoleLines[i] + '\n';
|
text += consoleLines[i] + '\n';
|
||||||
}
|
}
|
||||||
|
@ -1777,7 +1790,7 @@ void DSQ::debugLog(const std::string &s)
|
||||||
|
|
||||||
int DSQ::getEntityTypeIndexByName(std::string s)
|
int DSQ::getEntityTypeIndexByName(std::string s)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < game->entityTypeList.size(); i++)
|
for (size_t i = 0; i < game->entityTypeList.size(); i++)
|
||||||
{
|
{
|
||||||
EntityClass *t = &game->entityTypeList[i];
|
EntityClass *t = &game->entityTypeList[i];
|
||||||
if (t->name == s)
|
if (t->name == s)
|
||||||
|
@ -1841,7 +1854,7 @@ void DSQ::startSelectedMod()
|
||||||
|
|
||||||
ModEntry* DSQ::getSelectedModEntry()
|
ModEntry* DSQ::getSelectedModEntry()
|
||||||
{
|
{
|
||||||
if (!modEntries.empty() && selectedMod >= 0 && selectedMod < modEntries.size())
|
if (!modEntries.empty() && selectedMod < modEntries.size())
|
||||||
return &modEntries[selectedMod];
|
return &modEntries[selectedMod];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1877,7 +1890,7 @@ void DSQ::applyPatches()
|
||||||
loadMods();
|
loadMods();
|
||||||
|
|
||||||
for (std::vector<std::string>::iterator it = activePatches.begin(); it != activePatches.end(); ++it)
|
for (std::vector<std::string>::iterator it = activePatches.begin(); it != activePatches.end(); ++it)
|
||||||
for(int i = 0; i < modEntries.size(); ++i)
|
for(size_t i = 0; i < modEntries.size(); ++i)
|
||||||
if(modEntries[i].type == MODTYPE_PATCH)
|
if(modEntries[i].type == MODTYPE_PATCH)
|
||||||
if(!nocasecmp(modEntries[i].path.c_str(), it->c_str()))
|
if(!nocasecmp(modEntries[i].path.c_str(), it->c_str()))
|
||||||
_applyPatch(modEntries[i].path);
|
_applyPatch(modEntries[i].path);
|
||||||
|
@ -1940,10 +1953,9 @@ void DSQ::refreshResourcesForPatch(const std::string& name)
|
||||||
int reloaded = 0;
|
int reloaded = 0;
|
||||||
if(files.size())
|
if(files.size())
|
||||||
{
|
{
|
||||||
for(int i = 0; i < dsq->resources.size(); ++i)
|
for(size_t i = 0; i < dsq->resources.size(); ++i)
|
||||||
{
|
{
|
||||||
Texture *r = dsq->resources[i];
|
Texture *r = dsq->resources[i];
|
||||||
bool found = false;
|
|
||||||
for(size_t i = 0; i < files.size(); ++i)
|
for(size_t i = 0; i < files.size(); ++i)
|
||||||
if(files[i] == r->name)
|
if(files[i] == r->name)
|
||||||
{
|
{
|
||||||
|
@ -2344,7 +2356,7 @@ void DSQ::playNoEffect()
|
||||||
|
|
||||||
void DSQ::clearMenu(float t)
|
void DSQ::clearMenu(float t)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < menu.size(); i++)
|
for (size_t i = 0; i < menu.size(); i++)
|
||||||
{
|
{
|
||||||
menu[i]->setLife(1);
|
menu[i]->setLife(1);
|
||||||
menu[i]->setDecayRate(1/t);
|
menu[i]->setDecayRate(1/t);
|
||||||
|
@ -2412,7 +2424,7 @@ bool DSQ::onPickedSaveSlot(AquariaSaveSlot *slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < saveSlots.size(); i++)
|
for (size_t i = 0; i < saveSlots.size(); i++)
|
||||||
{
|
{
|
||||||
saveSlots[i]->mbDown = false;
|
saveSlots[i]->mbDown = false;
|
||||||
}
|
}
|
||||||
|
@ -2486,7 +2498,7 @@ bool DSQ::modIsKnown(const std::string& name)
|
||||||
std::string nlower = name;
|
std::string nlower = name;
|
||||||
stringToLower(nlower);
|
stringToLower(nlower);
|
||||||
|
|
||||||
for(int i = 0; i < modEntries.size(); ++i)
|
for(size_t i = 0; i < modEntries.size(); ++i)
|
||||||
{
|
{
|
||||||
std::string elower = modEntries[i].path;
|
std::string elower = modEntries[i].path;
|
||||||
stringToLower(elower);
|
stringToLower(elower);
|
||||||
|
@ -2718,13 +2730,13 @@ void DSQ::title(bool fade)
|
||||||
|
|
||||||
void DSQ::createSaveSlotPage()
|
void DSQ::createSaveSlotPage()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < saveSlots.size(); i++)
|
for (size_t i = 0; i < saveSlots.size(); i++)
|
||||||
{
|
{
|
||||||
saveSlots[i]->safeKill();
|
saveSlots[i]->safeKill();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSlots.resize(saveSlotPageSize);
|
saveSlots.resize(saveSlotPageSize);
|
||||||
for (int i = 0; i < saveSlots.size(); i++)
|
for (size_t i = 0; i < saveSlots.size(); i++)
|
||||||
{
|
{
|
||||||
saveSlots[i] = new AquariaSaveSlot(i + user.data.savePage * saveSlotPageSize);
|
saveSlots[i] = new AquariaSaveSlot(i + user.data.savePage * saveSlotPageSize);
|
||||||
saveSlots[i]->followCamera = 1;
|
saveSlots[i]->followCamera = 1;
|
||||||
|
@ -2764,7 +2776,7 @@ void DSQ::prevSaveSlotPage()
|
||||||
if (saveSlots.empty()) return;
|
if (saveSlots.empty()) return;
|
||||||
|
|
||||||
user.data.savePage--;
|
user.data.savePage--;
|
||||||
if (user.data.savePage < 0)
|
if (user.data.savePage > maxPages)
|
||||||
user.data.savePage = maxPages;
|
user.data.savePage = maxPages;
|
||||||
createSaveSlotPage();
|
createSaveSlotPage();
|
||||||
|
|
||||||
|
@ -2814,7 +2826,7 @@ void DSQ::clearSaveSlots(bool trans)
|
||||||
saveSlotPageCount->fadeAlphaWithLife = 1;
|
saveSlotPageCount->fadeAlphaWithLife = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < saveSlots.size(); i++)
|
for (size_t i = 0; i < saveSlots.size(); i++)
|
||||||
{
|
{
|
||||||
saveSlots[i]->close(trans);
|
saveSlots[i]->close(trans);
|
||||||
}
|
}
|
||||||
|
@ -2827,7 +2839,7 @@ void DSQ::clearSaveSlots(bool trans)
|
||||||
{
|
{
|
||||||
disableMiniMapOnNoInput = false;
|
disableMiniMapOnNoInput = false;
|
||||||
|
|
||||||
for (int i = 0; i < menu.size(); i++)
|
for (size_t i = 0; i < menu.size(); i++)
|
||||||
{
|
{
|
||||||
if (i != 1)
|
if (i != 1)
|
||||||
{
|
{
|
||||||
|
@ -2853,7 +2865,7 @@ void DSQ::clearSaveSlots(bool trans)
|
||||||
|
|
||||||
void DSQ::hideSaveSlots()
|
void DSQ::hideSaveSlots()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < saveSlots.size(); i++)
|
for (size_t i = 0; i < saveSlots.size(); i++)
|
||||||
{
|
{
|
||||||
saveSlots[i]->hide();
|
saveSlots[i]->hide();
|
||||||
}
|
}
|
||||||
|
@ -2863,7 +2875,7 @@ void DSQ::transitionSaveSlots()
|
||||||
{
|
{
|
||||||
hideSaveSlotCrap();
|
hideSaveSlotCrap();
|
||||||
|
|
||||||
for (int i = 0; i < saveSlots.size(); i++)
|
for (size_t i = 0; i < saveSlots.size(); i++)
|
||||||
{
|
{
|
||||||
saveSlots[i]->transition();
|
saveSlots[i]->transition();
|
||||||
}
|
}
|
||||||
|
@ -2902,7 +2914,7 @@ void DSQ::doSaveSlotMenu(SaveSlotMode ssm, const Vector &position)
|
||||||
saveSlotMode = SSM_NONE;
|
saveSlotMode = SSM_NONE;
|
||||||
|
|
||||||
createSaveSlots(ssm);
|
createSaveSlots(ssm);
|
||||||
const int firstSaveSlot = user.data.savePage * saveSlotPageSize;
|
const size_t firstSaveSlot = user.data.savePage * saveSlotPageSize;
|
||||||
if (user.data.saveSlot >= firstSaveSlot && user.data.saveSlot < firstSaveSlot + saveSlots.size())
|
if (user.data.saveSlot >= firstSaveSlot && user.data.saveSlot < firstSaveSlot + saveSlots.size())
|
||||||
{
|
{
|
||||||
selectedSaveSlot = saveSlots[user.data.saveSlot - firstSaveSlot];
|
selectedSaveSlot = saveSlots[user.data.saveSlot - firstSaveSlot];
|
||||||
|
@ -3344,7 +3356,7 @@ bool DSQ::playedVoice(const std::string &file)
|
||||||
{
|
{
|
||||||
std::string f = file;
|
std::string f = file;
|
||||||
stringToUpper(f);
|
stringToUpper(f);
|
||||||
for (int i = 0; i < dsq->continuity.voiceOversPlayed.size(); i++)
|
for (size_t i = 0; i < dsq->continuity.voiceOversPlayed.size(); i++)
|
||||||
{
|
{
|
||||||
if (f == dsq->continuity.voiceOversPlayed[i])
|
if (f == dsq->continuity.voiceOversPlayed[i])
|
||||||
{
|
{
|
||||||
|
@ -3733,13 +3745,13 @@ void DSQ::updateActionButtons()
|
||||||
if (/*inputMode != INPUT_KEYBOARD &&*/ game->isActive())
|
if (/*inputMode != INPUT_KEYBOARD &&*/ game->isActive())
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < almb.size(); ++i)
|
for(size_t i = 0; i < almb.size(); ++i)
|
||||||
if (ActionMapper::getKeyState(almb[i]->key[0]) || ActionMapper::getKeyState(almb[i]->key[1]))
|
if (ActionMapper::getKeyState(almb[i]->data.single.key[0]) || ActionMapper::getKeyState(almb[i]->data.single.key[1]))
|
||||||
{
|
{
|
||||||
mouse.buttons.left = DOWN;
|
mouse.buttons.left = DOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for(size_t i = 0; i < armb.size(); ++i)
|
for(size_t i = 0; i < armb.size(); ++i)
|
||||||
if (ActionMapper::getKeyState(armb[i]->key[0]) || ActionMapper::getKeyState(armb[i]->key[1]))
|
if (ActionMapper::getKeyState(armb[i]->data.single.key[0]) || ActionMapper::getKeyState(armb[i]->data.single.key[1]))
|
||||||
{
|
{
|
||||||
mouse.buttons.right = DOWN;
|
mouse.buttons.right = DOWN;
|
||||||
break;
|
break;
|
||||||
|
@ -3749,13 +3761,13 @@ void DSQ::updateActionButtons()
|
||||||
if (joystickAsMouse)
|
if (joystickAsMouse)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < almb.size(); ++i)
|
for(size_t i = 0; i < almb.size(); ++i)
|
||||||
if (ActionMapper::getKeyState(almb[i]->joy[0]))
|
if (ActionMapper::getKeyState(almb[i]->data.single.joy[0]))
|
||||||
{
|
{
|
||||||
mouse.buttons.left = DOWN;
|
mouse.buttons.left = DOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for(size_t i = 0; i < armb.size(); ++i)
|
for(size_t i = 0; i < armb.size(); ++i)
|
||||||
if (ActionMapper::getKeyState(armb[i]->joy[0]))
|
if (ActionMapper::getKeyState(armb[i]->data.single.joy[0]))
|
||||||
{
|
{
|
||||||
mouse.buttons.right = DOWN;
|
mouse.buttons.right = DOWN;
|
||||||
break;
|
break;
|
||||||
|
@ -3936,6 +3948,8 @@ void DSQ::onUpdate(float dt)
|
||||||
break;
|
break;
|
||||||
case INPUT_KEYBOARD:
|
case INPUT_KEYBOARD:
|
||||||
break;
|
break;
|
||||||
|
case INPUT_NODEVICE:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
Bone *b = dsq->game->avatar->skeletalSprite.getBoneByIdx(1);
|
Bone *b = dsq->game->avatar->skeletalSprite.getBoneByIdx(1);
|
||||||
|
@ -4248,7 +4262,7 @@ void DSQ::modifyDt(float &dt)
|
||||||
|
|
||||||
void DSQ::removeElement(Element *element)
|
void DSQ::removeElement(Element *element)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dsq->elements.size(); i++)
|
for (size_t i = 0; i < dsq->elements.size(); i++)
|
||||||
{
|
{
|
||||||
if (dsq->elements[i] == element)
|
if (dsq->elements[i] == element)
|
||||||
{
|
{
|
||||||
|
@ -4259,11 +4273,11 @@ void DSQ::removeElement(Element *element)
|
||||||
|
|
||||||
}
|
}
|
||||||
// only happens in editor, no need to optimize
|
// only happens in editor, no need to optimize
|
||||||
void DSQ::removeElement(int idx)
|
void DSQ::removeElement(size_t idx)
|
||||||
{
|
{
|
||||||
ElementContainer copy = elements;
|
ElementContainer copy = elements;
|
||||||
clearElements();
|
clearElements();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < idx; i++)
|
for (i = 0; i < idx; i++)
|
||||||
{
|
{
|
||||||
addElement(copy[i]);
|
addElement(copy[i]);
|
||||||
|
@ -4288,7 +4302,7 @@ void DSQ::clearElements()
|
||||||
|
|
||||||
void DSQ::addEntity(Entity *entity)
|
void DSQ::addEntity(Entity *entity)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
for (i = 0; entities[i] != 0; i++) {}
|
for (i = 0; entities[i] != 0; i++) {}
|
||||||
if (i+1 >= entities.size())
|
if (i+1 >= entities.size())
|
||||||
entities.resize(entities.size()*2, 0);
|
entities.resize(entities.size()*2, 0);
|
||||||
|
@ -4353,7 +4367,7 @@ void DSQ::updatepecue(float dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nz = 0;
|
int nz = 0;
|
||||||
for (int i = 0; i < pecue.size(); i++)
|
for (size_t i = 0; i < pecue.size(); i++)
|
||||||
{
|
{
|
||||||
PECue *p = &pecue[i];
|
PECue *p = &pecue[i];
|
||||||
if (p->t > 0)
|
if (p->t > 0)
|
||||||
|
|
|
@ -79,7 +79,6 @@ public:
|
||||||
void capture();
|
void capture();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct SFXLoops
|
struct SFXLoops
|
||||||
{
|
{
|
||||||
SFXLoops();
|
SFXLoops();
|
||||||
|
@ -116,7 +115,6 @@ public:
|
||||||
void load();
|
void load();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Profile
|
class Profile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -164,7 +162,7 @@ public:
|
||||||
void save(const std::string &name);
|
void save(const std::string &name);
|
||||||
void load(const std::string &name);
|
void load(const std::string &name);
|
||||||
|
|
||||||
int frame;
|
unsigned int frame;
|
||||||
float time;
|
float time;
|
||||||
float timeDiff;
|
float timeDiff;
|
||||||
std::vector <DemoFrame> frames;
|
std::vector <DemoFrame> frames;
|
||||||
|
@ -237,12 +235,12 @@ public:
|
||||||
int getEntityLayerToLayer(int layer);
|
int getEntityLayerToLayer(int layer);
|
||||||
|
|
||||||
void addElement(Element *e);
|
void addElement(Element *e);
|
||||||
int getNumElements() const {return elements.size();}
|
size_t getNumElements() const {return elements.size();}
|
||||||
Element *getElement(int idx) const {return elements[idx];}
|
Element *getElement(int idx) const {return elements[idx];}
|
||||||
Element *getFirstElementOnLayer(int layer) const {return layer<0 || layer>15 ? 0 : firstElementOnLayer[layer];}
|
Element *getFirstElementOnLayer(int layer) const {return layer<0 || layer>15 ? 0 : firstElementOnLayer[layer];}
|
||||||
void clearElements();
|
void clearElements();
|
||||||
// Used only by scene editor:
|
// Used only by scene editor:
|
||||||
void removeElement(int idx);
|
void removeElement(size_t idx);
|
||||||
void removeElement(Element *e);
|
void removeElement(Element *e);
|
||||||
ElementContainer getElementsCopy() const {return elements;}
|
ElementContainer getElementsCopy() const {return elements;}
|
||||||
|
|
||||||
|
@ -335,7 +333,7 @@ public:
|
||||||
bool canOpenEditor() const;
|
bool canOpenEditor() const;
|
||||||
|
|
||||||
void loadElementEffects();
|
void loadElementEffects();
|
||||||
ElementEffect getElementEffectByIndex(int e);
|
ElementEffect getElementEffectByIndex(size_t e);
|
||||||
typedef std::vector<ElementEffect> ElementEffects;
|
typedef std::vector<ElementEffect> ElementEffects;
|
||||||
ElementEffects elementEffects;
|
ElementEffects elementEffects;
|
||||||
|
|
||||||
|
@ -414,7 +412,7 @@ public:
|
||||||
|
|
||||||
std::vector<ModEntry> modEntries;
|
std::vector<ModEntry> modEntries;
|
||||||
std::vector<std::string> activePatches;
|
std::vector<std::string> activePatches;
|
||||||
int selectedMod;
|
size_t selectedMod;
|
||||||
ModSelectorScreen *modSelectorScr;
|
ModSelectorScreen *modSelectorScr;
|
||||||
|
|
||||||
void startSelectedMod();
|
void startSelectedMod();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
class Shot;
|
class Shot;
|
||||||
class Bone;
|
class Bone;
|
||||||
class Entity;
|
class Entity;
|
||||||
enum FormType;
|
|
||||||
|
|
||||||
enum DamageType
|
enum DamageType
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,7 +131,6 @@ void Demo::update(float dt)
|
||||||
}
|
}
|
||||||
else if (mode == DEMOMODE_PLAYBACK)
|
else if (mode == DEMOMODE_PLAYBACK)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (frame < frames.size())
|
while (frame < frames.size())
|
||||||
{
|
{
|
||||||
DemoFrame *f = &frames[frame];
|
DemoFrame *f = &frames[frame];
|
||||||
|
|
|
@ -127,7 +127,7 @@ void Element::updateEffects(float dt)
|
||||||
float magRedSpd = 48;
|
float magRedSpd = 48;
|
||||||
float lerpSpd = 5.0;
|
float lerpSpd = 5.0;
|
||||||
float wavySz = float(eff->wavy.size());
|
float wavySz = float(eff->wavy.size());
|
||||||
for (int i = 0; i < eff->wavy.size(); i++)
|
for (size_t i = 0; i < eff->wavy.size(); i++)
|
||||||
{
|
{
|
||||||
float weight = float(i)/wavySz;
|
float weight = float(i)/wavySz;
|
||||||
if (eff->wavyFlip)
|
if (eff->wavyFlip)
|
||||||
|
@ -211,13 +211,13 @@ void Element::setGridFromWavy()
|
||||||
{
|
{
|
||||||
|
|
||||||
const float w = float(getWidth());
|
const float w = float(getWidth());
|
||||||
for (int x = 0; x < xDivs-1; x++)
|
for (size_t x = 0; x < xDivs-1; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < yDivs; y++)
|
for (size_t y = 0; y < yDivs; y++)
|
||||||
{
|
{
|
||||||
const int wavy_y = (yDivs - y)-1;
|
const int wavy_y = (yDivs - y)-1;
|
||||||
const float tmp = eff->wavy[wavy_y].x / w;
|
const float tmp = eff->wavy[wavy_y].x / w;
|
||||||
if (wavy_y < eff->wavy.size())
|
if (wavy_y < 0 || (size_t) wavy_y < eff->wavy.size())
|
||||||
{
|
{
|
||||||
|
|
||||||
drawGrid[x][y].x = tmp - 0.5f;
|
drawGrid[x][y].x = tmp - 0.5f;
|
||||||
|
@ -264,7 +264,7 @@ void Element::setElementEffectByIndex(int eidx)
|
||||||
|
|
||||||
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 (size_t i = 0; i < eff->wavy.size(); i++)
|
||||||
{
|
{
|
||||||
eff->wavy[i] = Vector(0, -(i*bity));
|
eff->wavy[i] = Vector(0, -(i*bity));
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ void Element::render()
|
||||||
renderBorderColor = Vector(0.5,0.5,0.5);
|
renderBorderColor = Vector(0.5,0.5,0.5);
|
||||||
if (!dsq->game->sceneEditor.selectedElements.empty())
|
if (!dsq->game->sceneEditor.selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dsq->game->sceneEditor.selectedElements.size(); i++)
|
for (size_t i = 0; i < dsq->game->sceneEditor.selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
if (this == dsq->game->sceneEditor.selectedElements[i])
|
if (this == dsq->game->sceneEditor.selectedElements[i])
|
||||||
renderBorderColor = Vector(1,1,1);
|
renderBorderColor = Vector(1,1,1);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
~Element();
|
~Element();
|
||||||
void destroy();
|
void destroy();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
int templateIdx;
|
size_t templateIdx;
|
||||||
int bgLayer;
|
int bgLayer;
|
||||||
Element *bgLayerNext;
|
Element *bgLayerNext;
|
||||||
void render();
|
void render();
|
||||||
|
|
|
@ -45,9 +45,9 @@ void Emote::load(const std::string &file)
|
||||||
emoteTimer = 0;
|
emoteTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Emote::playSfx(int index)
|
void Emote::playSfx(size_t index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= emotes.size()) return;
|
if (index >= emotes.size()) return;
|
||||||
if (emoteTimer > 0) return;
|
if (emoteTimer > 0) return;
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
|
@ -45,7 +45,7 @@ void Entity::setIngredientData(const std::string &name)
|
||||||
|
|
||||||
void Entity::entityDied(Entity *e)
|
void Entity::entityDied(Entity *e)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < targets.size(); i++)
|
for (size_t i = 0; i < targets.size(); i++)
|
||||||
{
|
{
|
||||||
targets[i] = 0;
|
targets[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ void Entity::generateCollisionMask(int ovrCollideRadius)
|
||||||
{
|
{
|
||||||
if (this->skeletalSprite.isLoaded())
|
if (this->skeletalSprite.isLoaded())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < skeletalSprite.bones.size(); i++)
|
for (size_t i = 0; i < skeletalSprite.bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (skeletalSprite.bones[i]->generateCollisionMask)
|
if (skeletalSprite.bones[i]->generateCollisionMask)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ Entity::Entity()
|
||||||
dropChance = 0;
|
dropChance = 0;
|
||||||
inCurrent = false;
|
inCurrent = false;
|
||||||
entityProperties.resize(EP_MAX);
|
entityProperties.resize(EP_MAX);
|
||||||
for (int i = 0; i < entityProperties.size(); i++)
|
for (size_t i = 0; i < entityProperties.size(); i++)
|
||||||
{
|
{
|
||||||
entityProperties[i] = false;
|
entityProperties[i] = false;
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ float Entity::followPath(Path *p, float speed, int dir, bool deleteOnEnd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < p->nodes.size(); i++)
|
for (size_t i = 0; i < p->nodes.size(); i++)
|
||||||
{
|
{
|
||||||
PathNode pn = p->nodes[i];
|
PathNode pn = p->nodes[i];
|
||||||
position.data->path.addPathNode(pn.position, float(i/float(p->nodes.size())));
|
position.data->path.addPathNode(pn.position, float(i/float(p->nodes.size())));
|
||||||
|
@ -1265,7 +1265,7 @@ bool Entity::updateCurrents(float dt)
|
||||||
{
|
{
|
||||||
if (p->active)
|
if (p->active)
|
||||||
{
|
{
|
||||||
for (int n = 1; n < p->nodes.size(); n++)
|
for (size_t n = 1; n < p->nodes.size(); n++)
|
||||||
{
|
{
|
||||||
PathNode *node2 = &p->nodes[n];
|
PathNode *node2 = &p->nodes[n];
|
||||||
PathNode *node1 = &p->nodes[n-1];
|
PathNode *node1 = &p->nodes[n-1];
|
||||||
|
@ -1849,7 +1849,7 @@ void Entity::detachEntity(Entity *e)
|
||||||
attachedEntities.clear();
|
attachedEntities.clear();
|
||||||
attachedEntitiesOffsets.clear();
|
attachedEntitiesOffsets.clear();
|
||||||
|
|
||||||
for (int i = 0; i < copyEnts.size(); i++)
|
for (size_t i = 0; i < copyEnts.size(); i++)
|
||||||
{
|
{
|
||||||
if (copyEnts[i] != e)
|
if (copyEnts[i] != e)
|
||||||
{
|
{
|
||||||
|
@ -1904,9 +1904,9 @@ int Entity::getNumTargetPoints()
|
||||||
return targetPoints.size();
|
return targetPoints.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector Entity::getTargetPoint(int i)
|
Vector Entity::getTargetPoint(size_t i)
|
||||||
{
|
{
|
||||||
if (i >= targetPoints.size() || i < 0)
|
if (i >= targetPoints.size())
|
||||||
return getEnergyShotTargetPosition();
|
return getEnergyShotTargetPosition();
|
||||||
return targetPoints[i];
|
return targetPoints[i];
|
||||||
}
|
}
|
||||||
|
@ -1995,9 +1995,9 @@ Vector Entity::getEnergyShotTargetPosition()
|
||||||
return getWorldPosition();
|
return getWorldPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::isTargetInRange(int range, int t)
|
bool Entity::isTargetInRange(int range, size_t t)
|
||||||
{
|
{
|
||||||
if (t < 0 || t >= targets.size())
|
if (t >= targets.size())
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "isTargetInRange: invalid target index: " << t;
|
os << "isTargetInRange: invalid target index: " << t;
|
||||||
|
@ -2299,7 +2299,7 @@ bool Entity::canSetState(int state)
|
||||||
|
|
||||||
bool Entity::updateLocalWarpAreas(bool affectAvatar)
|
bool Entity::updateLocalWarpAreas(bool affectAvatar)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dsq->game->getNumPaths(); i++)
|
for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
Path *p = dsq->game->getPath(i);
|
Path *p = dsq->game->getPath(i);
|
||||||
if (!p->nodes.empty())
|
if (!p->nodes.empty())
|
||||||
|
@ -2343,9 +2343,9 @@ void Entity::warpLastPosition()
|
||||||
|
|
||||||
void Entity::spawnParticlesFromCollisionMask(const std::string &p, int intv)
|
void Entity::spawnParticlesFromCollisionMask(const std::string &p, int intv)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < skeletalSprite.bones.size(); i++)
|
for (size_t i = 0; i < skeletalSprite.bones.size(); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < skeletalSprite.bones[i]->collisionMask.size(); j+=intv)
|
for (size_t j = 0; j < skeletalSprite.bones[i]->collisionMask.size(); j+=intv)
|
||||||
{
|
{
|
||||||
Vector pos = skeletalSprite.bones[i]->getWorldCollidePosition(skeletalSprite.bones[i]->collisionMask[j]);
|
Vector pos = skeletalSprite.bones[i]->getWorldCollidePosition(skeletalSprite.bones[i]->collisionMask[j]);
|
||||||
dsq->spawnParticleEffect(p, pos);
|
dsq->spawnParticleEffect(p, pos);
|
||||||
|
@ -2564,7 +2564,7 @@ void Entity::doSpellAvoidance(float dt, int range, float mod)
|
||||||
|
|
||||||
if (s->isActive() && (s->position - this->position).getSquaredLength2D() < sqr(range))
|
if (s->isActive() && (s->position - this->position).getSquaredLength2D() < sqr(range))
|
||||||
{
|
{
|
||||||
for (int j = 0; j < ignoreShotDamageTypes.size(); j++)
|
for (size_t j = 0; j < ignoreShotDamageTypes.size(); j++)
|
||||||
{
|
{
|
||||||
if (s->getDamageType() == ignoreShotDamageTypes[j])
|
if (s->getDamageType() == ignoreShotDamageTypes[j])
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,7 +181,7 @@ public:
|
||||||
Entity *findTarget(int dist, int type, int t=0);
|
Entity *findTarget(int dist, int type, int t=0);
|
||||||
|
|
||||||
bool hasTarget(int t=0);
|
bool hasTarget(int t=0);
|
||||||
bool isTargetInRange(int range, int t=0);
|
bool isTargetInRange(int range, size_t 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);
|
||||||
Entity *getTargetEntity(int t=0);
|
Entity *getTargetEntity(int t=0);
|
||||||
void setTargetEntity(Entity *e, int t=0);
|
void setTargetEntity(Entity *e, int t=0);
|
||||||
|
@ -266,7 +266,7 @@ public:
|
||||||
void clearTargetPoints();
|
void clearTargetPoints();
|
||||||
void addTargetPoint(const Vector &point);
|
void addTargetPoint(const Vector &point);
|
||||||
int getNumTargetPoints();
|
int getNumTargetPoints();
|
||||||
Vector getTargetPoint(int i);
|
Vector getTargetPoint(size_t i);
|
||||||
int targetPriority;
|
int targetPriority;
|
||||||
virtual void shiftWorlds(WorldType lastWorld, WorldType worldType){}
|
virtual void shiftWorlds(WorldType lastWorld, WorldType worldType){}
|
||||||
void setCanLeaveWater(bool v);
|
void setCanLeaveWater(bool v);
|
||||||
|
|
|
@ -36,13 +36,13 @@ FlockEntity::FlockEntity() : CollideEntity()
|
||||||
collideRadius = 8;
|
collideRadius = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlockEntity::addToFlock(int id)
|
void FlockEntity::addToFlock(size_t id)
|
||||||
{
|
{
|
||||||
if (id >= flocks.size())
|
if (id >= flocks.size())
|
||||||
{
|
{
|
||||||
int curSize = flocks.size();
|
int curSize = flocks.size();
|
||||||
flocks.resize(id+1);
|
flocks.resize(id+1);
|
||||||
for (int i = curSize; i < id+1; i++)
|
for (size_t i = curSize; i < id+1; i++)
|
||||||
flocks[i] = 0;
|
flocks[i] = 0;
|
||||||
}
|
}
|
||||||
if (!flocks[id])
|
if (!flocks[id])
|
||||||
|
@ -113,7 +113,7 @@ void FlockEntity::destroy()
|
||||||
|
|
||||||
void FlockEntity::updateFlockData(void)
|
void FlockEntity::updateFlockData(void)
|
||||||
{
|
{
|
||||||
for (int flockID = 0; flockID < flocks.size(); flockID++)
|
for (size_t flockID = 0; flockID < flocks.size(); flockID++)
|
||||||
{
|
{
|
||||||
Flock *flock = flocks[flockID];
|
Flock *flock = flocks[flockID];
|
||||||
if (flock)
|
if (flock)
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
FLOCK_FISH = 0,
|
FLOCK_FISH = 0,
|
||||||
MAX_FLOCKTYPES
|
MAX_FLOCKTYPES
|
||||||
};
|
};
|
||||||
void addToFlock(int id);
|
void addToFlock(size_t id);
|
||||||
void removeFromFlock();
|
void removeFromFlock();
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ void Game::transitionToScene(std::string scene)
|
||||||
core->enqueueJumpState("Game", false);
|
core->enqueueJumpState("Game", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementTemplate *Game::getElementTemplateByIdx(int idx)
|
ElementTemplate *Game::getElementTemplateByIdx(size_t idx)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < elementTemplates.size(); i++)
|
for (int i = 0; i < elementTemplates.size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -330,7 +330,7 @@ ElementTemplate *Game::getElementTemplateByIdx(int idx)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Element* Game::createElement(int idx, Vector position, int bgLayer, RenderObject *copy, ElementTemplate *et)
|
Element* Game::createElement(size_t idx, Vector position, size_t bgLayer, RenderObject *copy, ElementTemplate *et)
|
||||||
{
|
{
|
||||||
if (idx == -1) return 0;
|
if (idx == -1) return 0;
|
||||||
|
|
||||||
|
@ -1169,12 +1169,12 @@ void Game::addPath(Path *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::removePath(int idx)
|
void Game::removePath(size_t idx)
|
||||||
{
|
{
|
||||||
if (idx >= 0 && idx < paths.size()) paths[idx]->destroy();
|
if (idx < paths.size()) paths[idx]->destroy();
|
||||||
std::vector<Path*> copy = this->paths;
|
std::vector<Path*> copy = this->paths;
|
||||||
clearPaths();
|
clearPaths();
|
||||||
for (int i = 0; i < copy.size(); i++)
|
for (size_t i = 0; i < copy.size(); i++)
|
||||||
{
|
{
|
||||||
if (i != idx)
|
if (i != idx)
|
||||||
addPath(copy[i]);
|
addPath(copy[i]);
|
||||||
|
@ -1377,6 +1377,7 @@ bool Game::loadSceneXML(std::string scene)
|
||||||
levelSF->SetAttribute("airSfxLoop", airSfxLoop.c_str());
|
levelSF->SetAttribute("airSfxLoop", airSfxLoop.c_str());
|
||||||
}
|
}
|
||||||
if (level->Attribute("bnat"))
|
if (level->Attribute("bnat"))
|
||||||
|
|
||||||
{
|
{
|
||||||
bNatural = atoi(level->Attribute("bnat"));
|
bNatural = atoi(level->Attribute("bnat"));
|
||||||
levelSF->SetAttribute("bnat", 1);
|
levelSF->SetAttribute("bnat", 1);
|
||||||
|
@ -2170,7 +2171,6 @@ bool Game::saveScene(std::string scene)
|
||||||
std::ostringstream simpleElements[LR_MAX];
|
std::ostringstream simpleElements[LR_MAX];
|
||||||
std::ostringstream simpleElements_repeatScale[LR_MAX];
|
std::ostringstream simpleElements_repeatScale[LR_MAX];
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < dsq->getNumElements(); i++)
|
for (i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
|
@ -3122,7 +3122,6 @@ void Game::applyState()
|
||||||
|
|
||||||
createPets();
|
createPets();
|
||||||
|
|
||||||
|
|
||||||
postInitEntities();
|
postInitEntities();
|
||||||
|
|
||||||
bool musicchanged = updateMusic();
|
bool musicchanged = updateMusic();
|
||||||
|
@ -3813,12 +3812,7 @@ void Game::onPressEscape(int source, InputDevice device)
|
||||||
|
|
||||||
void Game::toggleDamageSprite(bool on)
|
void Game::toggleDamageSprite(bool on)
|
||||||
{
|
{
|
||||||
if (on)
|
damageSprite->alphaMod = (float) on;
|
||||||
{
|
|
||||||
damageSprite->alphaMod = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
damageSprite->alphaMod = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::togglePause(bool v)
|
void Game::togglePause(bool v)
|
||||||
|
@ -3899,14 +3893,14 @@ Bone *Game::collideSkeletalVsCircle(Entity *skeletal, RenderObject *circle)
|
||||||
Bone *Game::collideSkeletalVsLine(Entity *skeletal, Vector start, Vector end, float radius)
|
Bone *Game::collideSkeletalVsLine(Entity *skeletal, Vector start, Vector end, float radius)
|
||||||
{
|
{
|
||||||
Bone *closest = 0;
|
Bone *closest = 0;
|
||||||
for (int i = 0; i < skeletal->skeletalSprite.bones.size(); i++)
|
for (size_t i = 0; i < skeletal->skeletalSprite.bones.size(); i++)
|
||||||
{
|
{
|
||||||
Bone *b = skeletal->skeletalSprite.bones[i];
|
Bone *b = skeletal->skeletalSprite.bones[i];
|
||||||
|
|
||||||
// MULTIPLE CIRCLES METHOD
|
// MULTIPLE CIRCLES METHOD
|
||||||
if (!b->collisionMask.empty() && b->alpha.x == 1 && b->renderQuad)
|
if (!b->collisionMask.empty() && b->alpha.x == 1 && b->renderQuad)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < b->transformedCollisionMask.size(); i++)
|
for (size_t i = 0; i < b->transformedCollisionMask.size(); i++)
|
||||||
{
|
{
|
||||||
if (isTouchingLine(start, end, b->transformedCollisionMask[i], radius+b->collideRadius))
|
if (isTouchingLine(start, end, b->transformedCollisionMask[i], radius+b->collideRadius))
|
||||||
{
|
{
|
||||||
|
@ -4589,7 +4583,7 @@ void Game::update(float dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < dsq->game->getNumPaths(); i++)
|
for (i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
dsq->game->getPath(i)->update(dt);
|
dsq->game->getPath(i)->update(dt);
|
||||||
|
@ -4761,7 +4755,6 @@ void Game::update(float dt)
|
||||||
//cameraLerpDelay = 0.15;
|
//cameraLerpDelay = 0.15;
|
||||||
cameraLerpDelay = vars->defaultCameraLerpDelay;
|
cameraLerpDelay = vars->defaultCameraLerpDelay;
|
||||||
}
|
}
|
||||||
Vector oldCamPos = dsq->cameraPos;
|
|
||||||
cameraInterp.stop();
|
cameraInterp.stop();
|
||||||
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
cameraInterp.interpolateTo(dest, cameraLerpDelay);
|
||||||
dsq->cameraPos = getCameraPositionFor(cameraInterp);
|
dsq->cameraPos = getCameraPositionFor(cameraInterp);
|
||||||
|
@ -4924,9 +4917,9 @@ void Game::loadElementTemplates(std::string pack)
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
for (int i = 0; i < elementTemplates.size(); i++)
|
for (size_t i = 0; i < elementTemplates.size(); i++)
|
||||||
{
|
{
|
||||||
for (int j = i; j < elementTemplates.size(); j++)
|
for (size_t j = i; j < elementTemplates.size(); j++)
|
||||||
{
|
{
|
||||||
if (elementTemplates[i].idx > elementTemplates[j].idx)
|
if (elementTemplates[i].idx > elementTemplates[j].idx)
|
||||||
{
|
{
|
||||||
|
@ -4955,7 +4948,7 @@ void Game::resetFromTitle()
|
||||||
|
|
||||||
void Game::setGrid(ElementTemplate *et, Vector position, float rot360)
|
void Game::setGrid(ElementTemplate *et, Vector position, float rot360)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < et->grid.size(); i++)
|
for (size_t i = 0; i < et->grid.size(); i++)
|
||||||
{
|
{
|
||||||
TileVector t(position);
|
TileVector t(position);
|
||||||
int x = et->grid[i].x;
|
int x = et->grid[i].x;
|
||||||
|
@ -5067,7 +5060,7 @@ void Game::removeState()
|
||||||
dsq->globalScale = Vector(1,1);
|
dsq->globalScale = Vector(1,1);
|
||||||
core->globalScaleChanged();
|
core->globalScaleChanged();
|
||||||
|
|
||||||
for (int i = 0; i < getNumPaths(); i++)
|
for (size_t i = 0; i < getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
Path *p = getPath(i);
|
Path *p = getPath(i);
|
||||||
p->destroy();
|
p->destroy();
|
||||||
|
|
|
@ -125,7 +125,7 @@ public:
|
||||||
void setGrid(Vector position);
|
void setGrid(Vector position);
|
||||||
bool cull;
|
bool cull;
|
||||||
float alpha;
|
float alpha;
|
||||||
int idx;
|
size_t idx;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ObsRow
|
class ObsRow
|
||||||
|
@ -258,8 +258,9 @@ public:
|
||||||
Entity *editingEntity;
|
Entity *editingEntity;
|
||||||
Path *editingPath;
|
Path *editingPath;
|
||||||
|
|
||||||
int selectedIdx;
|
size_t selectedIdx;
|
||||||
int selectedNode;
|
size_t selectedNode;
|
||||||
|
|
||||||
Path *getSelectedPath();
|
Path *getSelectedPath();
|
||||||
void changeDepth();
|
void changeDepth();
|
||||||
void updateEntitySaveData(Entity *editingEntity);
|
void updateEntitySaveData(Entity *editingEntity);
|
||||||
|
@ -280,7 +281,7 @@ public:
|
||||||
|
|
||||||
SelectedEntity selectedEntity;
|
SelectedEntity selectedEntity;
|
||||||
|
|
||||||
int entityPageNum;
|
size_t entityPageNum;
|
||||||
|
|
||||||
void checkForRebuild();
|
void checkForRebuild();
|
||||||
void createAquarian();
|
void createAquarian();
|
||||||
|
@ -353,7 +354,7 @@ protected:
|
||||||
void mouseButtonLeft();
|
void mouseButtonLeft();
|
||||||
void mouseButtonRight();
|
void mouseButtonRight();
|
||||||
|
|
||||||
int curElement, selectedVariation, possibleSelectedIdx;
|
size_t curElement, selectedVariation, possibleSelectedIdx;
|
||||||
|
|
||||||
Quad *placer;
|
Quad *placer;
|
||||||
DebugFont *text;
|
DebugFont *text;
|
||||||
|
@ -413,7 +414,7 @@ public:
|
||||||
InGameMenu *getInGameMenu() { return themenu; }
|
InGameMenu *getInGameMenu() { return themenu; }
|
||||||
|
|
||||||
void loadElementTemplates(std::string pack);
|
void loadElementTemplates(std::string pack);
|
||||||
Element* createElement(int etidx, Vector position, int bgLayer=0, RenderObject *copy=0, ElementTemplate *et=0);
|
Element* createElement(size_t etidx, Vector position, size_t bgLayer=0, RenderObject *copy=0, ElementTemplate *et=0);
|
||||||
void setGrid(ElementTemplate *et, Vector position, float rot360=0);
|
void setGrid(ElementTemplate *et, Vector position, float rot360=0);
|
||||||
|
|
||||||
void updateParticlePause();
|
void updateParticlePause();
|
||||||
|
@ -440,7 +441,7 @@ public:
|
||||||
std::vector<ElementTemplate> elementTemplates;
|
std::vector<ElementTemplate> elementTemplates;
|
||||||
std::string sceneName, sceneDisplayName;
|
std::string sceneName, sceneDisplayName;
|
||||||
|
|
||||||
ElementTemplate *getElementTemplateByIdx(int idx);
|
ElementTemplate *getElementTemplateByIdx(size_t idx);
|
||||||
|
|
||||||
bool saveScene(std::string scene);
|
bool saveScene(std::string scene);
|
||||||
|
|
||||||
|
@ -509,10 +510,10 @@ protected:
|
||||||
Path *firstPathOfType[PATH_MAX];
|
Path *firstPathOfType[PATH_MAX];
|
||||||
public:
|
public:
|
||||||
void addPath(Path *p);
|
void addPath(Path *p);
|
||||||
void removePath(int idx);
|
void removePath(size_t idx);
|
||||||
void clearPaths();
|
void clearPaths();
|
||||||
int getNumPaths() const {return paths.size();}
|
size_t getNumPaths() const {return paths.size();}
|
||||||
Path *getPath(int idx) const {return paths[idx];}
|
Path *getPath(size_t idx) const {return paths[idx];}
|
||||||
Path *getFirstPathOfType(PathType type) const {return firstPathOfType[type];}
|
Path *getFirstPathOfType(PathType type) const {return firstPathOfType[type];}
|
||||||
Path *getPathByName(std::string name);
|
Path *getPathByName(std::string name);
|
||||||
int getIndexOfPath(Path *p);
|
int getIndexOfPath(Path *p);
|
||||||
|
|
|
@ -147,7 +147,7 @@ class Emote
|
||||||
public:
|
public:
|
||||||
Emote();
|
Emote();
|
||||||
void load(const std::string &file);
|
void load(const std::string &file);
|
||||||
void playSfx(int index);
|
void playSfx(size_t index);
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
float emoteTimer;
|
float emoteTimer;
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
|
|
||||||
struct IngredientEffect
|
struct IngredientEffect
|
||||||
{
|
{
|
||||||
IngredientEffect() : type(IET_NONE), magnitude(0) {}
|
IngredientEffect() : magnitude(0), type(IET_NONE) {}
|
||||||
float magnitude;
|
float magnitude;
|
||||||
IngredientEffectType type;
|
IngredientEffectType type;
|
||||||
std::string string;
|
std::string string;
|
||||||
|
|
|
@ -123,7 +123,7 @@ SongLineRender::SongLineRender()
|
||||||
|
|
||||||
void SongLineRender::newPoint(const Vector &pt, const Vector &color)
|
void SongLineRender::newPoint(const Vector &pt, const Vector &color)
|
||||||
{
|
{
|
||||||
int maxx = 40;
|
size_t maxx = 40;
|
||||||
bool inRange = true;
|
bool inRange = true;
|
||||||
if (pts.size() > 1)
|
if (pts.size() > 1)
|
||||||
inRange = (pt - pts[pts.size()-2].pt).isLength2DIn(4);
|
inRange = (pt - pts[pts.size()-2].pt).isLength2DIn(4);
|
||||||
|
@ -156,10 +156,10 @@ void SongLineRender::onRender()
|
||||||
if (ls < 0)
|
if (ls < 0)
|
||||||
ls = 1;
|
ls = 1;
|
||||||
glLineWidth(ls);
|
glLineWidth(ls);
|
||||||
const int alphaLine = pts.size()*(0.9f);
|
const unsigned int alphaLine = pts.size()*(0.9f);
|
||||||
float a = 1;
|
float a = 1;
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
for (int i = 0; i < pts.size(); i++)
|
for (size_t i = 0; i < pts.size(); i++)
|
||||||
{
|
{
|
||||||
if (i < alphaLine)
|
if (i < alphaLine)
|
||||||
a = float(i)/float(alphaLine);
|
a = float(i)/float(alphaLine);
|
||||||
|
|
|
@ -35,7 +35,7 @@ Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
|
||||||
hairNodes.resize(nodes);
|
hairNodes.resize(nodes);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < hairNodes.size(); i++)
|
for (size_t i = 0; i < hairNodes.size(); i++)
|
||||||
{
|
{
|
||||||
float perc = (float(i)/(float(hairNodes.size())));
|
float perc = (float(i)/(float(hairNodes.size())));
|
||||||
if (perc < 0)
|
if (perc < 0)
|
||||||
|
@ -81,7 +81,7 @@ void Hair::onRender()
|
||||||
float texBits = 1.0f / (hairNodes.size()-1);
|
float texBits = 1.0f / (hairNodes.size()-1);
|
||||||
|
|
||||||
Vector pl, pr;
|
Vector pl, pr;
|
||||||
for (int i = 0; i < hairNodes.size(); i++)
|
for (size_t i = 0; i < hairNodes.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ void Hair::updatePositions()
|
||||||
BBGE_PROF(Hair_updatePositions);
|
BBGE_PROF(Hair_updatePositions);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 1; i < hairNodes.size(); i++)
|
for (size_t i = 1; i < hairNodes.size(); i++)
|
||||||
{
|
{
|
||||||
Vector diff = hairNodes[i].position - hairNodes[i-1].position;
|
Vector diff = hairNodes[i].position - hairNodes[i-1].position;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ void Hair::updatePositions()
|
||||||
|
|
||||||
void Hair::returnToDefaultPositions(float dt)
|
void Hair::returnToDefaultPositions(float dt)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < hairNodes.size(); i++)
|
for (size_t i = 0; i < hairNodes.size(); i++)
|
||||||
{
|
{
|
||||||
Vector mov = hairNodes[i].defaultPosition - hairNodes[i].position;
|
Vector mov = hairNodes[i].defaultPosition - hairNodes[i].position;
|
||||||
if (!mov.isLength2DIn(2))
|
if (!mov.isLength2DIn(2))
|
||||||
|
|
|
@ -24,10 +24,9 @@ std::vector<PetSlot*> petSlots;
|
||||||
|
|
||||||
static const float MENUPAGETRANSTIME = 0.2;
|
static const float MENUPAGETRANSTIME = 0.2;
|
||||||
const Vector menuBgScale(800.0f/1024.0f, 800.0f/1024.0f);
|
const Vector menuBgScale(800.0f/1024.0f, 800.0f/1024.0f);
|
||||||
const int foodPageSize = 16;
|
const size_t foodPageSize = 16;
|
||||||
const int treasurePageSize = 16;
|
const size_t treasurePageSize = 16;
|
||||||
const int ITEMS_PER_PAGE = 12;
|
const size_t numTreasures = 16*2;
|
||||||
const int numTreasures = 16*2;
|
|
||||||
|
|
||||||
const Vector worldLeftCenter(217,250), worldRightCenter(575, 250);
|
const Vector worldLeftCenter(217,250), worldRightCenter(575, 250);
|
||||||
const Vector opt_save_original = Vector(350, 350), opt_cancel_original = Vector(450, 350);
|
const Vector opt_save_original = Vector(350, 350), opt_cancel_original = Vector(450, 350);
|
||||||
|
@ -107,7 +106,7 @@ protected:
|
||||||
class FoodHolder : public Quad
|
class FoodHolder : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FoodHolder(int slot, bool trash=false);
|
FoodHolder(size_t slot, bool trash=false);
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
void toggleValid(bool b);
|
void toggleValid(bool b);
|
||||||
|
@ -125,7 +124,7 @@ protected:
|
||||||
|
|
||||||
Quad *lid;
|
Quad *lid;
|
||||||
|
|
||||||
int slot;
|
size_t slot;
|
||||||
private:
|
private:
|
||||||
IngredientData *foodHolderIngredient;
|
IngredientData *foodHolderIngredient;
|
||||||
};
|
};
|
||||||
|
@ -232,7 +231,7 @@ void PetSlot::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FoodHolder::FoodHolder(int slot, bool trash) : Quad(), slot(slot), trash(trash)
|
FoodHolder::FoodHolder(size_t slot, bool trash) : Quad(), trash(trash), slot(slot)
|
||||||
{
|
{
|
||||||
foodHolderIngredient = 0;
|
foodHolderIngredient = 0;
|
||||||
buttonDown = false;
|
buttonDown = false;
|
||||||
|
@ -4265,7 +4264,6 @@ void InGameMenu::nextJoystick()
|
||||||
int i = as.joystickID;
|
int i = as.joystickID;
|
||||||
Joystick *j = NULL;
|
Joystick *j = NULL;
|
||||||
const int N = core->getNumJoysticks();
|
const int N = core->getNumJoysticks();
|
||||||
bool looped = false;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
++i;
|
++i;
|
||||||
|
|
|
@ -51,8 +51,8 @@ struct RecipeMenu
|
||||||
void destroyPage();
|
void destroyPage();
|
||||||
void goNextPage();
|
void goNextPage();
|
||||||
void goPrevPage();
|
void goPrevPage();
|
||||||
int getNumPages();
|
size_t getNumPages();
|
||||||
int getNumKnown();
|
size_t getNumKnown();
|
||||||
|
|
||||||
int currentPage;
|
int currentPage;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace IntroStuff
|
||||||
{
|
{
|
||||||
//Mappy *m;
|
//Mappy *m;
|
||||||
bool quitFlag;
|
bool quitFlag;
|
||||||
};
|
}
|
||||||
|
|
||||||
using namespace IntroStuff;
|
using namespace IntroStuff;
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void Intro::createMeteor(int layer, Vector pos, Vector off, Vector sz)
|
||||||
|
|
||||||
void Intro::clearMeteors()
|
void Intro::clearMeteors()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < meteors.size(); i++)
|
for (size_t i = 0; i < meteors.size(); i++)
|
||||||
{
|
{
|
||||||
meteors[i]->setLife(1);
|
meteors[i]->setLife(1);
|
||||||
meteors[i]->setDecayRate(100);
|
meteors[i]->setDecayRate(100);
|
||||||
|
@ -258,7 +258,7 @@ void Intro::update(float dt)
|
||||||
citybg->offset = Vector(-100, 0);
|
citybg->offset = Vector(-100, 0);
|
||||||
citybg->scale = Vector(0.6, 0.6);
|
citybg->scale = Vector(0.6, 0.6);
|
||||||
citybg->alpha = 0;
|
citybg->alpha = 0;
|
||||||
for (int i = 0; i < citybg->bones.size(); i++)
|
for (size_t i = 0; i < citybg->bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (citybg->bones[i]->name != "meteor")
|
if (citybg->bones[i]->name != "meteor")
|
||||||
{
|
{
|
||||||
|
@ -275,7 +275,7 @@ void Intro::update(float dt)
|
||||||
eric->position = Vector(50, 400);
|
eric->position = Vector(50, 400);
|
||||||
eric->alpha = 0;
|
eric->alpha = 0;
|
||||||
eric->scale = Vector(0.4, 0.4);
|
eric->scale = Vector(0.4, 0.4);
|
||||||
for (int i = 0; i < eric->bones.size(); i++)
|
for (size_t i = 0; i < eric->bones.size(); i++)
|
||||||
{
|
{
|
||||||
eric->bones[i]->color = eric->color;
|
eric->bones[i]->color = eric->color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,7 +403,7 @@ void MiniMapRender::onUpdate(float dt)
|
||||||
|
|
||||||
if (!dsq->game->worldMapRender->isOn())
|
if (!dsq->game->worldMapRender->isOn())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buttons.size(); i++)
|
for (size_t i = 0; i < buttons.size(); i++)
|
||||||
{
|
{
|
||||||
if ((buttons[i]->getWorldPosition() - core->mouse.position).isLength2DIn(BUTTON_RADIUS))
|
if ((buttons[i]->getWorldPosition() - core->mouse.position).isLength2DIn(BUTTON_RADIUS))
|
||||||
{
|
{
|
||||||
|
@ -596,7 +596,7 @@ void MiniMapRender::onRender()
|
||||||
|
|
||||||
if (!radarHide)
|
if (!radarHide)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dsq->game->getNumPaths(); i++)
|
for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
Path *p = dsq->game->getPath(i);
|
Path *p = dsq->game->getPath(i);
|
||||||
if (!p->nodes.empty() && p->minimapIcon)
|
if (!p->nodes.empty() && p->minimapIcon)
|
||||||
|
|
|
@ -310,14 +310,13 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining)
|
||||||
ModPackageType pkgtype = MPT_MOD;
|
ModPackageType pkgtype = MPT_MOD;
|
||||||
int serverSize = 0;
|
int serverSize = 0;
|
||||||
int serverIconSize = 0;
|
int serverIconSize = 0;
|
||||||
XMLElement *fullname, *desc, *icon, *pkg, *confirm, *props, *web;
|
XMLElement *fullname, *desc, *icon, *pkg, *confirm, *props;
|
||||||
fullname = modx->FirstChildElement("Fullname");
|
fullname = modx->FirstChildElement("Fullname");
|
||||||
desc = modx->FirstChildElement("Description");
|
desc = modx->FirstChildElement("Description");
|
||||||
icon = modx->FirstChildElement("Icon");
|
icon = modx->FirstChildElement("Icon");
|
||||||
pkg = modx->FirstChildElement("Package");
|
pkg = modx->FirstChildElement("Package");
|
||||||
confirm = modx->FirstChildElement("Confirm");
|
confirm = modx->FirstChildElement("Confirm");
|
||||||
props = modx->FirstChildElement("Properties");
|
props = modx->FirstChildElement("Properties");
|
||||||
web = modx->FirstChildElement("Web");
|
|
||||||
|
|
||||||
if(fullname && fullname->Attribute("text"))
|
if(fullname && fullname->Attribute("text"))
|
||||||
namestr = fullname->Attribute("text");
|
namestr = fullname->Attribute("text");
|
||||||
|
|
|
@ -131,7 +131,7 @@ void ModSelectorScreen::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModSelectorScreen::showPanel(int id)
|
void ModSelectorScreen::showPanel(size_t id)
|
||||||
{
|
{
|
||||||
if(id == currentPanel)
|
if(id == currentPanel)
|
||||||
return;
|
return;
|
||||||
|
@ -140,7 +140,7 @@ void ModSelectorScreen::showPanel(int id)
|
||||||
IconGridPanel *newgrid = panels[id];
|
IconGridPanel *newgrid = panels[id];
|
||||||
|
|
||||||
// fade in selected panel
|
// fade in selected panel
|
||||||
if(currentPanel < 0) // just bringing up?
|
if(currentPanel == -1) // just bringing up?
|
||||||
{
|
{
|
||||||
newgrid->scale = Vector(0.8f,0.8f);
|
newgrid->scale = Vector(0.8f,0.8f);
|
||||||
newgrid->alpha = 0;
|
newgrid->alpha = 0;
|
||||||
|
@ -155,7 +155,7 @@ void ModSelectorScreen::updateFade()
|
||||||
{
|
{
|
||||||
// fade out background panels
|
// fade out background panels
|
||||||
// necessary to do all of them, that icon alphas are 0... they would trigger otherwise, even if invisible because parent panel is not shown
|
// necessary to do all of them, that icon alphas are 0... they would trigger otherwise, even if invisible because parent panel is not shown
|
||||||
for(int i = 0; i < panels.size(); ++i)
|
for(size_t i = 0; i < panels.size(); ++i)
|
||||||
panels[i]->fade(i == currentPanel, true);
|
panels[i]->fade(i == currentPanel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ void ModSelectorScreen::init()
|
||||||
addChild(&rightbar, PM_STATIC);
|
addChild(&rightbar, PM_STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < panels.size(); ++i)
|
for(size_t i = 0; i < panels.size(); ++i)
|
||||||
{
|
{
|
||||||
if(panels[i])
|
if(panels[i])
|
||||||
continue;
|
continue;
|
||||||
|
@ -326,7 +326,7 @@ void ModSelectorScreen::initModAndPatchPanel()
|
||||||
}
|
}
|
||||||
std::sort(tv.begin(), tv.end(), _modname_cmp);
|
std::sort(tv.begin(), tv.end(), _modname_cmp);
|
||||||
|
|
||||||
for(int i = 0; i < tv.size(); ++i)
|
for(size_t i = 0; i < tv.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!tv[i]->getParent()) // ensure it was not added earlier
|
if(!tv[i]->getParent()) // ensure it was not added earlier
|
||||||
{
|
{
|
||||||
|
|
|
@ -148,7 +148,7 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
void showPanel(int id);
|
void showPanel(size_t id);
|
||||||
void updateFade();
|
void updateFade();
|
||||||
|
|
||||||
void initModAndPatchPanel();
|
void initModAndPatchPanel();
|
||||||
|
@ -172,7 +172,7 @@ protected:
|
||||||
virtual void onUpdate(float dt);
|
virtual void onUpdate(float dt);
|
||||||
MenuIconBar leftbar;
|
MenuIconBar leftbar;
|
||||||
MenuBasicBar rightbar;
|
MenuBasicBar rightbar;
|
||||||
int currentPanel;
|
size_t currentPanel;
|
||||||
BitmapText subtext;
|
BitmapText subtext;
|
||||||
Quad subbox;
|
Quad subbox;
|
||||||
float subFadeT;
|
float subFadeT;
|
||||||
|
|
|
@ -37,8 +37,7 @@ namespace Network
|
||||||
void download(RequestData *rq);
|
void download(RequestData *rq);
|
||||||
void update();
|
void update();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -85,9 +85,9 @@ void Path::clampPosition(Vector *pos, float radius)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PathNode *Path::getPathNode(int idx)
|
PathNode *Path::getPathNode(size_t idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= nodes.size()) return 0;
|
if (idx >= nodes.size()) return 0;
|
||||||
return &nodes[idx];
|
return &nodes[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,30 +661,30 @@ void Path::activate(Entity *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Path::removeNode(int idx)
|
void Path::removeNode(size_t idx)
|
||||||
{
|
{
|
||||||
std::vector<PathNode> copy = nodes;
|
std::vector<PathNode> copy = nodes;
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
for (int i = 0; i < copy.size(); i++)
|
for (size_t i = 0; i < copy.size(); i++)
|
||||||
{
|
{
|
||||||
if (idx != i)
|
if (idx != i)
|
||||||
nodes.push_back(copy[i]);
|
nodes.push_back(copy[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Path::addNode(int idx)
|
void Path::addNode(size_t idx)
|
||||||
{
|
{
|
||||||
std::vector<PathNode> copy = nodes;
|
std::vector<PathNode> copy = nodes;
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
bool added = false;
|
bool added = false;
|
||||||
for (int i = 0; i < copy.size(); i++)
|
for (size_t i = 0; i < copy.size(); i++)
|
||||||
{
|
{
|
||||||
nodes.push_back(copy[i]);
|
nodes.push_back(copy[i]);
|
||||||
if (idx == i)
|
if (idx == i)
|
||||||
{
|
{
|
||||||
added = true;
|
added = true;
|
||||||
PathNode p;
|
PathNode p;
|
||||||
int j = i + 1;
|
size_t j = i + 1;
|
||||||
if (j < copy.size())
|
if (j < copy.size())
|
||||||
{
|
{
|
||||||
Vector add = copy[j].position - copy[i].position;
|
Vector add = copy[j].position - copy[i].position;
|
||||||
|
|
|
@ -87,14 +87,14 @@ public:
|
||||||
std::string name; // full node string
|
std::string name; // full node string
|
||||||
std::string label; // first part only (the actual node name)
|
std::string label; // first part only (the actual node name)
|
||||||
std::vector<PathNode>nodes;
|
std::vector<PathNode>nodes;
|
||||||
void removeNode(int idx);
|
void removeNode(size_t idx);
|
||||||
void addNode(int idx);
|
void addNode(size_t idx);
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void setActive(bool v);
|
void setActive(bool v);
|
||||||
bool action(int id, int state, int source, InputDevice device);
|
bool action(int id, int state, int source, InputDevice device);
|
||||||
void setEmitter(const std::string& name);
|
void setEmitter(const std::string& name);
|
||||||
|
|
||||||
PathNode *getPathNode(int idx);
|
PathNode *getPathNode(size_t idx);
|
||||||
bool isCoordinateInside(const Vector &pos, int rad=0);
|
bool isCoordinateInside(const Vector &pos, int rad=0);
|
||||||
|
|
||||||
void reverseNodes();
|
void reverseNodes();
|
||||||
|
|
|
@ -67,11 +67,11 @@ void PathFinding::forceMinimumPath(VectorPath &path, const Vector &start, const
|
||||||
|
|
||||||
void PathFinding::molestPath(VectorPath &path)
|
void PathFinding::molestPath(VectorPath &path)
|
||||||
{
|
{
|
||||||
int sz=path.getNumPathNodes();
|
size_t sz=path.getNumPathNodes();
|
||||||
if(!sz)
|
if(!sz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
// make normals
|
// make normals
|
||||||
std::vector<Vector> normals;
|
std::vector<Vector> normals;
|
||||||
normals.resize(sz);
|
normals.resize(sz);
|
||||||
|
@ -108,8 +108,11 @@ void PathFinding::molestPath(VectorPath &path)
|
||||||
// use wall normal to push out node a bit
|
// use wall normal to push out node a bit
|
||||||
std::vector<Vector> newNormals;
|
std::vector<Vector> newNormals;
|
||||||
newNormals.resize(normals.size());
|
newNormals.resize(normals.size());
|
||||||
for (i = 1; i < normals.size()-1; i++)
|
if(normals.size() > 0) {
|
||||||
newNormals[i] = (normals[i] + normals[i-1] + normals[i+1])/3.0f;
|
for (i = 1; i < normals.size()-1; i++) {
|
||||||
|
newNormals[i] = (normals[i] + normals[i-1] + normals[i+1])/3.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (i = 1; i < sz-1; i++)
|
for (i = 1; i < sz-1; i++)
|
||||||
path.getPathNode(i)->value += newNormals[i];
|
path.getPathNode(i)->value += newNormals[i];
|
||||||
|
|
||||||
|
@ -132,7 +135,7 @@ void PathFinding::molestPath(VectorPath &path)
|
||||||
lastSuccessNode = 0;
|
lastSuccessNode = 0;
|
||||||
hadSuccess = false;
|
hadSuccess = false;
|
||||||
Vector node = path.getPathNode(i)->value;
|
Vector node = path.getPathNode(i)->value;
|
||||||
for (int j = sz-1; j >= i+adjust; j--)
|
for (size_t j = sz-1; j >= i+adjust; j--)
|
||||||
{
|
{
|
||||||
Vector target = path.getPathNode(j)->value;
|
Vector target = path.getPathNode(j)->value;
|
||||||
if (dsq->game->trace(node, target))
|
if (dsq->game->trace(node, target))
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace PathFinding
|
||||||
bool finishFindPath(State *state, VectorPath& path, unsigned step = 0);
|
bool finishFindPath(State *state, VectorPath& path, unsigned step = 0);
|
||||||
void getStats(State *state, unsigned& stepsDone, unsigned& nodesExpanded);
|
void getStats(State *state, unsigned& stepsDone, unsigned& nodesExpanded);
|
||||||
void purgeFindPath(PathFinding::State *state);
|
void purgeFindPath(PathFinding::State *state);
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@ PathRender::PathRender() : RenderObject()
|
||||||
|
|
||||||
void PathRender::onRender()
|
void PathRender::onRender()
|
||||||
{
|
{
|
||||||
const int pathcount = dsq->game->getNumPaths();
|
const size_t pathcount = dsq->game->getNumPaths();
|
||||||
if (pathcount <= 0)
|
if (pathcount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < pathcount; i++)
|
for (size_t i = 0; i < pathcount; i++)
|
||||||
{
|
{
|
||||||
Path *p = dsq->game->getPath(i);
|
Path *p = dsq->game->getPath(i);
|
||||||
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
||||||
|
@ -47,7 +47,7 @@ void PathRender::onRender()
|
||||||
glColor4f(1, 0.5, 0.5, 0.75);
|
glColor4f(1, 0.5, 0.5, 0.75);
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
for (int n = 0; n < p->nodes.size()-1; n++)
|
for (size_t n = 0; n < p->nodes.size()-1; n++)
|
||||||
{
|
{
|
||||||
PathNode *nd = &p->nodes[n];
|
PathNode *nd = &p->nodes[n];
|
||||||
PathNode *nd2 = &p->nodes[n+1];
|
PathNode *nd2 = &p->nodes[n+1];
|
||||||
|
@ -56,7 +56,7 @@ void PathRender::onRender()
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
for (int n = 0; n < p->nodes.size(); n++)
|
for (size_t n = 0; n < p->nodes.size(); n++)
|
||||||
{
|
{
|
||||||
PathNode *nd = &p->nodes[n];
|
PathNode *nd = &p->nodes[n];
|
||||||
|
|
||||||
|
|
|
@ -73,20 +73,22 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
|
||||||
equals->scale = Vector(0.7, 0.7);
|
equals->scale = Vector(0.7, 0.7);
|
||||||
addChild(equals, PM_POINTER);
|
addChild(equals, PM_POINTER);
|
||||||
|
|
||||||
int c = 0;
|
size_t c = 0;
|
||||||
|
|
||||||
int size=0;
|
size_t size=0;
|
||||||
|
|
||||||
for (int i = 0; i < recipe->names.size(); i++)
|
for (size_t i = 0; i < recipe->names.size(); i++)
|
||||||
size += recipe->names[i].amount;
|
size += recipe->names[i].amount;
|
||||||
|
|
||||||
for (int j = 0; j < recipe->types.size(); j++)
|
for (size_t j = 0; j < recipe->types.size(); j++)
|
||||||
size += recipe->types[j].amount;
|
size += recipe->types[j].amount;
|
||||||
|
|
||||||
size --;
|
if(size > 0) {
|
||||||
|
size --;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < recipe->names.size(); i++)
|
for (size_t i = 0; i < recipe->names.size(); i++)
|
||||||
{
|
{
|
||||||
debugLog("recipe name: " + recipe->names[i].name);
|
debugLog("recipe name: " + recipe->names[i].name);
|
||||||
IngredientData *data = dsq->continuity.getIngredientDataByName(recipe->names[i].name);
|
IngredientData *data = dsq->continuity.getIngredientDataByName(recipe->names[i].name);
|
||||||
|
@ -122,7 +124,7 @@ RecipeMenuEntry::RecipeMenuEntry(Recipe *recipe) : RenderObject(), recipe(recipe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < recipe->types.size(); i++)
|
for (size_t i = 0; i < recipe->types.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int j = 0; j < recipe->types[i].amount; j++)
|
for (int j = 0; j < recipe->types[i].amount; j++)
|
||||||
|
@ -188,7 +190,7 @@ void RecipeMenuEntry::onUpdate(float dt)
|
||||||
std::ostringstream ds;
|
std::ostringstream ds;
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < data->effects.size(); i++)
|
for (size_t 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)
|
||||||
|
@ -212,9 +214,9 @@ void RecipeMenuEntry::onUpdate(float dt)
|
||||||
glow->alphaMod = 0;
|
glow->alphaMod = 0;
|
||||||
selected = 0;
|
selected = 0;
|
||||||
|
|
||||||
int n=0;
|
size_t n=0;
|
||||||
|
|
||||||
for (int i = 0; i < recipeMenu.recipeMenuEntries.size(); i++)
|
for (size_t i = 0; i < recipeMenu.recipeMenuEntries.size(); i++)
|
||||||
{
|
{
|
||||||
if (!recipeMenu.recipeMenuEntries[i]->selected)
|
if (!recipeMenu.recipeMenuEntries[i]->selected)
|
||||||
n++;
|
n++;
|
||||||
|
@ -252,10 +254,10 @@ void RecipeMenu::slide(RenderObject *r, bool in, float t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RecipeMenu::getNumKnown()
|
size_t RecipeMenu::getNumKnown()
|
||||||
{
|
{
|
||||||
int num = 0;
|
size_t num = 0;
|
||||||
for (int i = 0; i < dsq->continuity.recipes.size(); i++)
|
for (size_t i = 0; i < dsq->continuity.recipes.size(); i++)
|
||||||
{
|
{
|
||||||
if (dsq->continuity.recipes[i].isKnown())
|
if (dsq->continuity.recipes[i].isKnown())
|
||||||
{
|
{
|
||||||
|
@ -265,10 +267,10 @@ int RecipeMenu::getNumKnown()
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RecipeMenu::getNumPages()
|
size_t RecipeMenu::getNumPages()
|
||||||
{
|
{
|
||||||
int numKnown = dsq->continuity.recipes.size();
|
size_t numKnown = dsq->continuity.recipes.size();
|
||||||
int numPages = (numKnown/pageSize);
|
size_t numPages = (numKnown/pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -436,7 +438,7 @@ void RecipeMenu::createPage(int p)
|
||||||
|
|
||||||
void RecipeMenu::destroyPage()
|
void RecipeMenu::destroyPage()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < recipeMenuEntries.size(); i++)
|
for (size_t i = 0; i < recipeMenuEntries.size(); i++)
|
||||||
{
|
{
|
||||||
recipeMenuEntries[i]->setLife(1);
|
recipeMenuEntries[i]->setLife(1);
|
||||||
recipeMenuEntries[i]->setDecayRate(20);
|
recipeMenuEntries[i]->setDecayRate(20);
|
||||||
|
|
|
@ -94,6 +94,7 @@ std::string getMapTemplateFilename()
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SceneEditor::SceneEditor() : ActionMapper(), on(false)
|
SceneEditor::SceneEditor() : ActionMapper(), on(false)
|
||||||
{
|
{
|
||||||
autoSaveFile = 0;
|
autoSaveFile = 0;
|
||||||
|
@ -448,7 +449,7 @@ void SceneEditor::openMainMenu()
|
||||||
void SceneEditor::closeMainMenu()
|
void SceneEditor::closeMainMenu()
|
||||||
{
|
{
|
||||||
inMainMenu = false;
|
inMainMenu = false;
|
||||||
for (int i = 0; i < mainMenu.size(); i++)
|
for (size_t i = 0; i < mainMenu.size(); i++)
|
||||||
{
|
{
|
||||||
mainMenu[i]->alpha = 0;
|
mainMenu[i]->alpha = 0;
|
||||||
mainMenu[i]->safeKill();
|
mainMenu[i]->safeKill();
|
||||||
|
@ -709,7 +710,7 @@ void SceneEditor::createAquarian()
|
||||||
std::string t = dsq->getUserInputString("Enter Aquarian:", "");
|
std::string t = dsq->getUserInputString("Enter Aquarian:", "");
|
||||||
stringToUpper(t);
|
stringToUpper(t);
|
||||||
Vector startPos = dsq->getGameCursorPosition();
|
Vector startPos = dsq->getGameCursorPosition();
|
||||||
for (int i = 0; i < t.size(); i++)
|
for (size_t i = 0; i < t.size(); i++)
|
||||||
{
|
{
|
||||||
int v = 0;
|
int v = 0;
|
||||||
if (t[i] >= 'A' && t[i] <= 'Z')
|
if (t[i] >= 'A' && t[i] <= 'Z')
|
||||||
|
@ -728,7 +729,7 @@ void SceneEditor::createAquarian()
|
||||||
|
|
||||||
Path *SceneEditor::getSelectedPath()
|
Path *SceneEditor::getSelectedPath()
|
||||||
{
|
{
|
||||||
if (selectedIdx >= 0 && selectedIdx < dsq->game->getNumPaths())
|
if (selectedIdx < dsq->game->getNumPaths())
|
||||||
{
|
{
|
||||||
return dsq->game->getPath(selectedIdx);
|
return dsq->game->getPath(selectedIdx);
|
||||||
}
|
}
|
||||||
|
@ -789,7 +790,7 @@ void SceneEditor::reversePath()
|
||||||
void SceneEditor::setGridPattern(int gi)
|
void SceneEditor::setGridPattern(int gi)
|
||||||
{
|
{
|
||||||
if (selectedElements.size())
|
if (selectedElements.size())
|
||||||
for (int i = 0; i < selectedElements.size(); ++i)
|
for (size_t i = 0; i < selectedElements.size(); ++i)
|
||||||
selectedElements[i]->setElementEffectByIndex(gi);
|
selectedElements[i]->setElementEffectByIndex(gi);
|
||||||
else if (editingElement)
|
else if (editingElement)
|
||||||
editingElement->setElementEffectByIndex(gi);
|
editingElement->setElementEffectByIndex(gi);
|
||||||
|
@ -833,7 +834,7 @@ void SceneEditor::moveToFront()
|
||||||
dsq->clearElements();
|
dsq->clearElements();
|
||||||
|
|
||||||
// move to the foreground ... this means that the editing element should be last in the list (Added last)
|
// move to the foreground ... this means that the editing element should be last in the list (Added last)
|
||||||
for (int i = 0; i < copy.size(); i++)
|
for (size_t i = 0; i < copy.size(); i++)
|
||||||
{
|
{
|
||||||
if (copy[i] != editingElement)
|
if (copy[i] != editingElement)
|
||||||
dsq->addElement(copy[i]);
|
dsq->addElement(copy[i]);
|
||||||
|
@ -853,7 +854,7 @@ void SceneEditor::moveToBack()
|
||||||
|
|
||||||
// move to the background ... this means that the editing element should be first in the list (Added first)
|
// move to the background ... this means that the editing element should be first in the list (Added first)
|
||||||
dsq->addElement(editingElement);
|
dsq->addElement(editingElement);
|
||||||
for (int i = 0; i < copy.size(); i++)
|
for (size_t i = 0; i < copy.size(); i++)
|
||||||
{
|
{
|
||||||
if (copy[i] != editingElement)
|
if (copy[i] != editingElement)
|
||||||
dsq->addElement(copy[i]);
|
dsq->addElement(copy[i]);
|
||||||
|
@ -959,7 +960,7 @@ void SceneEditor::deleteSelected()
|
||||||
{
|
{
|
||||||
if (selectedElements.size()>0)
|
if (selectedElements.size()>0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->safeKill();
|
selectedElements[i]->safeKill();
|
||||||
dsq->removeElement(selectedElements[i]);
|
dsq->removeElement(selectedElements[i]);
|
||||||
|
@ -1049,7 +1050,7 @@ void SceneEditor::checkForRebuild()
|
||||||
if (editType == ET_ELEMENTS && state != ES_SELECTING && !selectedElements.empty())
|
if (editType == ET_ELEMENTS && state != ES_SELECTING && !selectedElements.empty())
|
||||||
{
|
{
|
||||||
bool rebuild = false;
|
bool rebuild = false;
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
if (selectedElements[i]->elementFlag == EF_SOLID || selectedElements[i]->elementFlag == EF_HURT)
|
if (selectedElements[i]->elementFlag == EF_SOLID || selectedElements[i]->elementFlag == EF_HURT)
|
||||||
{
|
{
|
||||||
|
@ -1072,7 +1073,7 @@ void SceneEditor::exitMoveState()
|
||||||
{
|
{
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->position = selectedElements[i]->getWorldPosition();
|
selectedElements[i]->position = selectedElements[i]->getWorldPosition();
|
||||||
dummy.removeChild(selectedElements[i]);
|
dummy.removeChild(selectedElements[i]);
|
||||||
|
@ -1094,7 +1095,7 @@ void SceneEditor::enterMoveState()
|
||||||
dummy.rotation = Vector(0,0,0);
|
dummy.rotation = Vector(0,0,0);
|
||||||
cursorOffset = dsq->getGameCursorPosition();
|
cursorOffset = dsq->getGameCursorPosition();
|
||||||
groupCenter = getSelectedElementsCenter();
|
groupCenter = getSelectedElementsCenter();
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->position -= groupCenter;
|
selectedElements[i]->position -= groupCenter;
|
||||||
dummy.addChild(selectedElements[i], PM_NONE);
|
dummy.addChild(selectedElements[i], PM_NONE);
|
||||||
|
@ -1142,7 +1143,7 @@ void SceneEditor::enterRotateState()
|
||||||
oldRotation = dummy.rotation;
|
oldRotation = dummy.rotation;
|
||||||
cursorOffset = dsq->getGameCursorPosition();
|
cursorOffset = dsq->getGameCursorPosition();
|
||||||
groupCenter = getSelectedElementsCenter();
|
groupCenter = getSelectedElementsCenter();
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->position -= groupCenter;
|
selectedElements[i]->position -= groupCenter;
|
||||||
dummy.addChild(selectedElements[i], PM_NONE);
|
dummy.addChild(selectedElements[i], PM_NONE);
|
||||||
|
@ -1175,7 +1176,7 @@ void SceneEditor::enterScaleState()
|
||||||
oldRepeatScale = Vector(1, 1); // not handled for multi-selection
|
oldRepeatScale = Vector(1, 1); // not handled for multi-selection
|
||||||
cursorOffset = dsq->getGameCursorPosition();
|
cursorOffset = dsq->getGameCursorPosition();
|
||||||
groupCenter = getSelectedElementsCenter();
|
groupCenter = getSelectedElementsCenter();
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->position -= groupCenter;
|
selectedElements[i]->position -= groupCenter;
|
||||||
dummy.addChild(selectedElements[i], PM_NONE);
|
dummy.addChild(selectedElements[i], PM_NONE);
|
||||||
|
@ -1258,7 +1259,7 @@ void SceneEditor::mouseButtonRightUp()
|
||||||
{
|
{
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->position = selectedElements[i]->getWorldPosition();
|
selectedElements[i]->position = selectedElements[i]->getWorldPosition();
|
||||||
selectedElements[i]->rotation = selectedElements[i]->getAbsoluteRotation();
|
selectedElements[i]->rotation = selectedElements[i]->getAbsoluteRotation();
|
||||||
|
@ -1272,7 +1273,7 @@ void SceneEditor::mouseButtonRightUp()
|
||||||
|
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->position = selectedElements[i]->getWorldPosition();
|
selectedElements[i]->position = selectedElements[i]->getWorldPosition();
|
||||||
selectedElements[i]->scale = selectedElements[i]->scale * dummy.scale;
|
selectedElements[i]->scale = selectedElements[i]->scale * dummy.scale;
|
||||||
|
@ -1388,7 +1389,7 @@ void SceneEditor::mouseButtonLeft()
|
||||||
{
|
{
|
||||||
Path *p = getSelectedPath();
|
Path *p = getSelectedPath();
|
||||||
editingPath = p;
|
editingPath = p;
|
||||||
if (p && selectedNode >= 0 && selectedNode < p->nodes.size())
|
if (p && selectedNode < p->nodes.size())
|
||||||
{
|
{
|
||||||
if (core->getShiftState())
|
if (core->getShiftState())
|
||||||
{
|
{
|
||||||
|
@ -1496,12 +1497,12 @@ public:
|
||||||
int rows;
|
int rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool getGrassPixel(pngRawInfo *png, int x, int y)
|
bool getGrassPixel(pngRawInfo *png, size_t x, size_t y)
|
||||||
{
|
{
|
||||||
if (x >= png->Width || y >= png->Height || x < 0 || y < 0) return false;
|
if (x >= png->Width || y >= png->Height) return false;
|
||||||
|
|
||||||
|
|
||||||
int c = (y*png->Width)*png->Components + x*png->Components;
|
size_t 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 &&
|
||||||
png->Data[c+2] == 128)
|
png->Data[c+2] == 128)
|
||||||
|
@ -1538,7 +1539,7 @@ void SceneEditor::skinLevel()
|
||||||
void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int maxY)
|
void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int maxY)
|
||||||
{
|
{
|
||||||
std::vector<Element*> deleteElements;
|
std::vector<Element*> deleteElements;
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < dsq->getNumElements(); i++)
|
for (i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
|
@ -1595,7 +1596,7 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
|
||||||
offset.z = 0;
|
offset.z = 0;
|
||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
for (int i = 0; i < dsq->getNumElements(); i++)
|
for (size_t i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
if (e->templateIdx <= 4 && e->templateIdx >= 1)
|
if (e->templateIdx <= 4 && e->templateIdx >= 1)
|
||||||
|
@ -1612,7 +1613,7 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
|
||||||
{
|
{
|
||||||
std::vector<int> cantUse;
|
std::vector<int> cantUse;
|
||||||
cantUse.resize(4);
|
cantUse.resize(4);
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < dsq->getNumElements(); i++)
|
for (i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
|
@ -1624,10 +1625,10 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int useIdx = rand()%cantUse.size()+1;
|
size_t useIdx = rand()%cantUse.size()+1;
|
||||||
for (i = 0; i < cantUse.size(); i++)
|
for (i = 0; i < cantUse.size(); i++)
|
||||||
{
|
{
|
||||||
int check = i + idxCount;
|
size_t check = i + idxCount;
|
||||||
if (check >= cantUse.size())
|
if (check >= cantUse.size())
|
||||||
check -= cantUse.size();
|
check -= cantUse.size();
|
||||||
if (cantUse[check]<=0)
|
if (cantUse[check]<=0)
|
||||||
|
@ -1648,7 +1649,7 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < dsq->getNumElements(); i++)
|
for (size_t i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
if (e->bgLayer == 4 && e->templateIdx >= 1 && e->templateIdx <= 4)
|
if (e->bgLayer == 4 && e->templateIdx >= 1 && e->templateIdx <= 4)
|
||||||
|
@ -1667,7 +1668,7 @@ void SceneEditor::generateLevel()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int maxX=0, maxY=0;
|
size_t 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];
|
||||||
int lastColorX[MAX], lastColorY[MAX];
|
int lastColorX[MAX], lastColorY[MAX];
|
||||||
|
@ -1700,7 +1701,7 @@ void SceneEditor::generateLevel()
|
||||||
int scale = TILE_SIZE;
|
int scale = TILE_SIZE;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
for (int y = 0; y < rawinfo.Height; y++)
|
for (size_t y = 0; y < rawinfo.Height; y++)
|
||||||
{
|
{
|
||||||
Vector lastElement;
|
Vector lastElement;
|
||||||
lastElement = Vector(0,0,0);
|
lastElement = Vector(0,0,0);
|
||||||
|
@ -1709,7 +1710,7 @@ void SceneEditor::generateLevel()
|
||||||
Row row;
|
Row row;
|
||||||
rowCount = 0;
|
rowCount = 0;
|
||||||
positions.clear();
|
positions.clear();
|
||||||
for (int x = 0; x < rawinfo.Width; x++)
|
for (size_t x = 0; x < rawinfo.Width; x++)
|
||||||
{
|
{
|
||||||
Vector *e = 0;
|
Vector *e = 0;
|
||||||
if
|
if
|
||||||
|
@ -1807,7 +1808,7 @@ void SceneEditor::generateLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
dsq->game->clearObsRows();
|
dsq->game->clearObsRows();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
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;
|
||||||
|
@ -1893,7 +1894,7 @@ void SceneEditor::moveElementToLayer(Element *e, int bgLayer)
|
||||||
{
|
{
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
Element *e = selectedElements[i];
|
Element *e = selectedElements[i];
|
||||||
core->removeRenderObject(e, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
core->removeRenderObject(e, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
||||||
|
@ -1945,7 +1946,7 @@ void SceneEditor::updateMultiSelect()
|
||||||
|
|
||||||
selectedElements.clear();
|
selectedElements.clear();
|
||||||
|
|
||||||
for (int i = 0; i < dsq->getNumElements(); i++)
|
for (size_t i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
if (e->bgLayer == bgLayer && e->position.x >= p1.x && e->position.y >= p1.y && e->position.x <= p2.x && e->position.y <= p2.y)
|
if (e->bgLayer == bgLayer && e->position.x >= p1.x && e->position.y >= p1.y && e->position.x <= p2.x && e->position.y <= p2.y)
|
||||||
|
@ -2100,7 +2101,7 @@ void destroyEntityPage()
|
||||||
se_grad->fadeAlphaWithLife = 1;
|
se_grad->fadeAlphaWithLife = 1;
|
||||||
se_grad = 0;
|
se_grad = 0;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < qs.size(); i++)
|
for (size_t i = 0; i < qs.size(); i++)
|
||||||
{
|
{
|
||||||
qs[i]->safeKill();
|
qs[i]->safeKill();
|
||||||
}
|
}
|
||||||
|
@ -2129,7 +2130,7 @@ void createEntityPage()
|
||||||
|
|
||||||
EntityGroup &group = game->entityGroups[game->sceneEditor.entityPageNum];
|
EntityGroup &group = game->entityGroups[game->sceneEditor.entityPageNum];
|
||||||
|
|
||||||
for (int i = 0; i < group.entities.size(); i++)
|
for (size_t i = 0; i < group.entities.size(); i++)
|
||||||
{
|
{
|
||||||
EntityGroupEntity ent = group.entities[i];
|
EntityGroupEntity ent = group.entities[i];
|
||||||
EntityClass *ec = dsq->game->getEntityClassForEntityType(ent.name);
|
EntityClass *ec = dsq->game->getEntityClassForEntityType(ent.name);
|
||||||
|
@ -2140,7 +2141,7 @@ void createEntityPage()
|
||||||
int type = -1;
|
int type = -1;
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
int j=0;
|
size_t j=0;
|
||||||
for (j = 0; j < dsq->game->entityTypeList.size(); j++)
|
for (j = 0; j < dsq->game->entityTypeList.size(); j++)
|
||||||
{
|
{
|
||||||
if (ec->idx == dsq->game->entityTypeList[j].idx)
|
if (ec->idx == dsq->game->entityTypeList[j].idx)
|
||||||
|
@ -2197,7 +2198,7 @@ void nextEntityPage()
|
||||||
void prevEntityPage()
|
void prevEntityPage()
|
||||||
{
|
{
|
||||||
game->sceneEditor.entityPageNum--;
|
game->sceneEditor.entityPageNum--;
|
||||||
if (game->sceneEditor.entityPageNum < 0)
|
if (game->sceneEditor.entityPageNum >= game->entityGroups.size())
|
||||||
game->sceneEditor.entityPageNum = game->entityGroups.size()-1;
|
game->sceneEditor.entityPageNum = game->entityGroups.size()-1;
|
||||||
|
|
||||||
createEntityPage();
|
createEntityPage();
|
||||||
|
@ -2265,9 +2266,9 @@ void SceneEditor::updateEntityPlacer()
|
||||||
|
|
||||||
Element* SceneEditor::cycleElementNext(Element *e1)
|
Element* SceneEditor::cycleElementNext(Element *e1)
|
||||||
{
|
{
|
||||||
int ce = e1->templateIdx;
|
size_t ce = e1->templateIdx;
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for (int i = 0; i < dsq->game->elementTemplates.size(); i++)
|
for (size_t i = 0; i < dsq->game->elementTemplates.size(); i++)
|
||||||
{
|
{
|
||||||
if (dsq->game->elementTemplates[i].idx == ce)
|
if (dsq->game->elementTemplates[i].idx == ce)
|
||||||
idx = i;
|
idx = i;
|
||||||
|
@ -2289,9 +2290,9 @@ Element* SceneEditor::cycleElementNext(Element *e1)
|
||||||
|
|
||||||
Element* SceneEditor::cycleElementPrev(Element *e1)
|
Element* SceneEditor::cycleElementPrev(Element *e1)
|
||||||
{
|
{
|
||||||
int ce = e1->templateIdx;
|
size_t ce = e1->templateIdx;
|
||||||
int idx=0;
|
size_t idx=0;
|
||||||
for (int i = 0; i < dsq->game->elementTemplates.size(); i++)
|
for (size_t i = 0; i < dsq->game->elementTemplates.size(); i++)
|
||||||
{
|
{
|
||||||
if (dsq->game->elementTemplates[i].idx == ce)
|
if (dsq->game->elementTemplates[i].idx == ce)
|
||||||
{
|
{
|
||||||
|
@ -2301,7 +2302,7 @@ Element* SceneEditor::cycleElementPrev(Element *e1)
|
||||||
}
|
}
|
||||||
ce = idx;
|
ce = idx;
|
||||||
ce--;
|
ce--;
|
||||||
if (ce < 0)
|
if (ce == -1)
|
||||||
ce = dsq->game->elementTemplates.size()-1;
|
ce = dsq->game->elementTemplates.size()-1;
|
||||||
idx = dsq->game->elementTemplates[ce].idx;
|
idx = dsq->game->elementTemplates[ce].idx;
|
||||||
if (idx < 1024)
|
if (idx < 1024)
|
||||||
|
@ -2339,7 +2340,7 @@ void SceneEditor::nextElement()
|
||||||
{
|
{
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i]->rotation.z = 0;
|
selectedElements[i]->rotation.z = 0;
|
||||||
}
|
}
|
||||||
|
@ -2351,7 +2352,7 @@ void SceneEditor::nextElement()
|
||||||
}
|
}
|
||||||
else if (!selectedElements.empty())
|
else if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i] = cycleElementNext(selectedElements[i]);
|
selectedElements[i] = cycleElementNext(selectedElements[i]);
|
||||||
}
|
}
|
||||||
|
@ -2399,7 +2400,7 @@ void SceneEditor::prevElement()
|
||||||
if (dsq->game->elementTemplates.empty()) return;
|
if (dsq->game->elementTemplates.empty()) return;
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
selectedElements[i] = cycleElementPrev(selectedElements[i]);
|
selectedElements[i] = cycleElementPrev(selectedElements[i]);
|
||||||
}
|
}
|
||||||
|
@ -2418,13 +2419,17 @@ void SceneEditor::prevElement()
|
||||||
|
|
||||||
void SceneEditor::doPrevElement()
|
void SceneEditor::doPrevElement()
|
||||||
{
|
{
|
||||||
int oldCur = curElement;
|
size_t oldCur = curElement;
|
||||||
curElement--;
|
|
||||||
if (curElement < 0)
|
|
||||||
curElement = dsq->game->elementTemplates.size()-1;
|
|
||||||
|
|
||||||
if (curElement < 0)
|
if(dsq->game->elementTemplates.size() == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(curElement > 0) {
|
||||||
|
curElement--;
|
||||||
|
}
|
||||||
|
if (curElement >= game->elementTemplates.size())
|
||||||
|
curElement = dsq->game->elementTemplates.size()-1;
|
||||||
|
|
||||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||||
{
|
{
|
||||||
|
@ -2446,7 +2451,7 @@ void SceneEditor::moveLayer()
|
||||||
is >> fromLayer >> toLayer;
|
is >> fromLayer >> toLayer;
|
||||||
toLayer--;
|
toLayer--;
|
||||||
fromLayer--;
|
fromLayer--;
|
||||||
for (int i = 0; i < dsq->getNumElements(); i++)
|
for (size_t i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Element *e = dsq->getElement(i);
|
Element *e = dsq->getElement(i);
|
||||||
if (e)
|
if (e)
|
||||||
|
@ -2486,8 +2491,8 @@ void SceneEditor::selectEnd()
|
||||||
if (dsq->game->elementTemplates.empty()) return;
|
if (dsq->game->elementTemplates.empty()) return;
|
||||||
if (!editingElement)
|
if (!editingElement)
|
||||||
{
|
{
|
||||||
int largest = 0;
|
size_t largest = 0;
|
||||||
for (int i = 0; i < dsq->game->elementTemplates.size(); i++)
|
for (size_t i = 0; i < dsq->game->elementTemplates.size(); i++)
|
||||||
{
|
{
|
||||||
ElementTemplate et = dsq->game->elementTemplates[i];
|
ElementTemplate et = dsq->game->elementTemplates[i];
|
||||||
if (et.idx < 1024 && i > largest)
|
if (et.idx < 1024 && i > largest)
|
||||||
|
@ -2551,7 +2556,7 @@ void SceneEditor::cloneSelectedElement()
|
||||||
{
|
{
|
||||||
std::vector<Element*>copy;
|
std::vector<Element*>copy;
|
||||||
Vector groupCenter = this->getSelectedElementsCenter();
|
Vector groupCenter = this->getSelectedElementsCenter();
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
Element *e1 = selectedElements[i];
|
Element *e1 = selectedElements[i];
|
||||||
Vector dist = e1->position - groupCenter;
|
Vector dist = e1->position - groupCenter;
|
||||||
|
@ -2751,7 +2756,7 @@ void SceneEditor::updateText()
|
||||||
Vector SceneEditor::getSelectedElementsCenter()
|
Vector SceneEditor::getSelectedElementsCenter()
|
||||||
{
|
{
|
||||||
Vector c;
|
Vector c;
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
{
|
{
|
||||||
c += selectedElements[i]->position;
|
c += selectedElements[i]->position;
|
||||||
}
|
}
|
||||||
|
@ -2880,9 +2885,12 @@ void SceneEditor::update(float dt)
|
||||||
selectedIdx = -1;
|
selectedIdx = -1;
|
||||||
selectedNode = -1;
|
selectedNode = -1;
|
||||||
float smallestDist = sqr(64);
|
float smallestDist = sqr(64);
|
||||||
for (int i = 0; i < dsq->game->getNumPaths(); i++)
|
for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
|
||||||
{
|
{
|
||||||
for (int n = dsq->game->getPath(i)->nodes.size()-1; n >=0; n--)
|
if(dsq->game->getPath(i)->nodes.size() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (size_t n = dsq->game->getPath(i)->nodes.size(); n-- > 0; )
|
||||||
{
|
{
|
||||||
Vector v = dsq->game->getPath(i)->nodes[n].position - dsq->getGameCursorPosition();
|
Vector v = dsq->game->getPath(i)->nodes[n].position - dsq->getGameCursorPosition();
|
||||||
float dist = v.getSquaredLength2D();
|
float dist = v.getSquaredLength2D();
|
||||||
|
@ -2917,8 +2925,7 @@ void SceneEditor::update(float dt)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ES_MOVING:
|
case ES_MOVING:
|
||||||
if (selectedIdx >= 0)
|
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
||||||
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
|
||||||
break;
|
break;
|
||||||
case ES_ROTATING:
|
case ES_ROTATING:
|
||||||
case ES_MAX:
|
case ES_MAX:
|
||||||
|
@ -2964,7 +2971,7 @@ void SceneEditor::update(float dt)
|
||||||
case ES_SELECTING:
|
case ES_SELECTING:
|
||||||
{
|
{
|
||||||
float closest = sqr(800);
|
float closest = sqr(800);
|
||||||
int idx = -1, i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < dsq->getNumElements(); i++)
|
for (i = 0; i < dsq->getNumElements(); i++)
|
||||||
{
|
{
|
||||||
Vector dist = dsq->getElement(i)->getFollowCameraPosition() - dsq->getGameCursorPosition();
|
Vector dist = dsq->getElement(i)->getFollowCameraPosition() - dsq->getGameCursorPosition();
|
||||||
|
@ -2972,7 +2979,6 @@ void SceneEditor::update(float dt)
|
||||||
if (len < closest)
|
if (len < closest)
|
||||||
{
|
{
|
||||||
closest = len;
|
closest = len;
|
||||||
idx = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3075,7 +3081,7 @@ void SceneEditor::update(float dt)
|
||||||
dummy.scale.y = MIN_SIZE;
|
dummy.scale.y = MIN_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < selectedElements.size(); i++)
|
for (size_t i = 0; i < selectedElements.size(); i++)
|
||||||
selectedElements[i]->refreshRepeatTextureToFill();
|
selectedElements[i]->refreshRepeatTextureToFill();
|
||||||
}
|
}
|
||||||
else if (editingElement)
|
else if (editingElement)
|
||||||
|
|
|
@ -940,8 +940,8 @@ luaFunc(getInterfaceFunctionNames)
|
||||||
#define MakeTypeCheckFunc(fname, ty) luaFunc(fname) \
|
#define MakeTypeCheckFunc(fname, ty) luaFunc(fname) \
|
||||||
{ ScriptObject *r = (ScriptObject*)lua_touserdata(L, 1); luaReturnBool(r ? r->isType(ty) : false); }
|
{ ScriptObject *r = (ScriptObject*)lua_touserdata(L, 1); luaReturnBool(r ? r->isType(ty) : false); }
|
||||||
|
|
||||||
MakeTypeCheckFunc(isNode, SCO_PATH);
|
MakeTypeCheckFunc(isNode, SCO_PATH)
|
||||||
MakeTypeCheckFunc(isObject, SCO_RENDEROBJECT);
|
MakeTypeCheckFunc(isObject, SCO_RENDEROBJECT)
|
||||||
MakeTypeCheckFunc(isEntity, SCO_ENTITY)
|
MakeTypeCheckFunc(isEntity, SCO_ENTITY)
|
||||||
MakeTypeCheckFunc(isScriptedEntity, SCO_SCRIPTED_ENTITY)
|
MakeTypeCheckFunc(isScriptedEntity, SCO_SCRIPTED_ENTITY)
|
||||||
MakeTypeCheckFunc(isBone, SCO_BONE)
|
MakeTypeCheckFunc(isBone, SCO_BONE)
|
||||||
|
@ -2576,7 +2576,8 @@ static size_t _shotFilter(lua_State *L)
|
||||||
{
|
{
|
||||||
if (dt == DT_NONE || s->getDamageType() == dt)
|
if (dt == DT_NONE || s->getDamageType() == dt)
|
||||||
{
|
{
|
||||||
if (skipRadiusCheck || (distsq = (s->position - p).getSquaredLength2D()) <= sqrRadius)
|
distsq = (s->position - p).getSquaredLength2D();
|
||||||
|
if (skipRadiusCheck || distsq <= sqrRadius)
|
||||||
{
|
{
|
||||||
filteredShots.push_back(std::make_pair(s, distsq));
|
filteredShots.push_back(std::make_pair(s, distsq));
|
||||||
++added;
|
++added;
|
||||||
|
@ -6083,7 +6084,7 @@ luaFunc(entity_setVel2Len)
|
||||||
if(e)
|
if(e)
|
||||||
e->vel2.setLength2D(lua_tonumber(L, 2));
|
e->vel2.setLength2D(lua_tonumber(L, 2));
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
};
|
}
|
||||||
|
|
||||||
luaFunc(entity_getVel2)
|
luaFunc(entity_getVel2)
|
||||||
{
|
{
|
||||||
|
@ -7600,7 +7601,7 @@ luaFunc(entity_getNearestBoneToPosition)
|
||||||
Bone *closest = 0;
|
Bone *closest = 0;
|
||||||
if (me)
|
if (me)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < me->skeletalSprite.bones.size(); i++)
|
for (size_t i = 0; i < me->skeletalSprite.bones.size(); i++)
|
||||||
{
|
{
|
||||||
Bone *b = me->skeletalSprite.bones[i];
|
Bone *b = me->skeletalSprite.bones[i];
|
||||||
float dist = (b->getWorldPosition() - p).getSquaredLength2D();
|
float dist = (b->getWorldPosition() - p).getSquaredLength2D();
|
||||||
|
@ -8455,7 +8456,7 @@ luaFunc(pickupGem)
|
||||||
|
|
||||||
luaFunc(setGemPosition)
|
luaFunc(setGemPosition)
|
||||||
{
|
{
|
||||||
int gemId = lua_tointeger(L, 1);
|
size_t gemId = lua_tointeger(L, 1);
|
||||||
std::string mapname = getString(L, 4);
|
std::string mapname = getString(L, 4);
|
||||||
if(mapname.empty())
|
if(mapname.empty())
|
||||||
mapname = dsq->game->sceneName;
|
mapname = dsq->game->sceneName;
|
||||||
|
@ -8466,7 +8467,7 @@ luaFunc(setGemPosition)
|
||||||
if(tile)
|
if(tile)
|
||||||
{
|
{
|
||||||
pos = dsq->game->worldMapRender->getWorldToTile(tile, pos, true, true);
|
pos = dsq->game->worldMapRender->getWorldToTile(tile, pos, true, true);
|
||||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
if(gemId < dsq->continuity.gems.size())
|
||||||
{
|
{
|
||||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||||
std::advance(it, gemId);
|
std::advance(it, gemId);
|
||||||
|
@ -8489,10 +8490,10 @@ luaFunc(setGemPosition)
|
||||||
|
|
||||||
luaFunc(setGemName)
|
luaFunc(setGemName)
|
||||||
{
|
{
|
||||||
int gemId = lua_tointeger(L, 1);
|
size_t gemId = lua_tointeger(L, 1);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
if(gemId < dsq->continuity.gems.size())
|
||||||
{
|
{
|
||||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||||
std::advance(it, gemId);
|
std::advance(it, gemId);
|
||||||
|
@ -8508,10 +8509,10 @@ luaFunc(setGemName)
|
||||||
|
|
||||||
luaFunc(setGemBlink)
|
luaFunc(setGemBlink)
|
||||||
{
|
{
|
||||||
int gemId = lua_tointeger(L, 1);
|
size_t gemId = lua_tointeger(L, 1);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
if(gemId < dsq->continuity.gems.size())
|
||||||
{
|
{
|
||||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||||
std::advance(it, gemId);
|
std::advance(it, gemId);
|
||||||
|
@ -8527,8 +8528,8 @@ luaFunc(setGemBlink)
|
||||||
|
|
||||||
luaFunc(removeGem)
|
luaFunc(removeGem)
|
||||||
{
|
{
|
||||||
int gemId = lua_tointeger(L, 1);
|
size_t gemId = lua_tointeger(L, 1);
|
||||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
if(gemId < dsq->continuity.gems.size())
|
||||||
{
|
{
|
||||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||||
std::advance(it, gemId);
|
std::advance(it, gemId);
|
||||||
|
@ -8602,10 +8603,10 @@ luaFunc(setCostume)
|
||||||
|
|
||||||
luaFunc(setLayerRenderPass)
|
luaFunc(setLayerRenderPass)
|
||||||
{
|
{
|
||||||
int layer = lua_tointeger(L, 1);
|
size_t layer = lua_tointeger(L, 1);
|
||||||
int startPass = lua_tointeger(L, 2);
|
int startPass = lua_tointeger(L, 2);
|
||||||
int endPass = lua_tointeger(L, 3);
|
int endPass = lua_tointeger(L, 3);
|
||||||
if(layer >= 0 && layer < core->renderObjectLayers.size())
|
if(layer < core->renderObjectLayers.size())
|
||||||
{
|
{
|
||||||
core->renderObjectLayers[layer].startPass = startPass;
|
core->renderObjectLayers[layer].startPass = startPass;
|
||||||
core->renderObjectLayers[layer].endPass = endPass;
|
core->renderObjectLayers[layer].endPass = endPass;
|
||||||
|
|
|
@ -140,7 +140,7 @@ void ScriptedEntity::postInit()
|
||||||
Entity::postInit();
|
Entity::postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedEntity::initEmitter(int emit, const std::string &file)
|
void ScriptedEntity::initEmitter(size_t emit, const std::string &file)
|
||||||
{
|
{
|
||||||
if (emitters.size() <= emit)
|
if (emitters.size() <= emit)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ void ScriptedEntity::initEmitter(int emit, const std::string &file)
|
||||||
emitters[emit]->load(file);
|
emitters[emit]->load(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedEntity::startEmitter(int emit)
|
void ScriptedEntity::startEmitter(size_t emit)
|
||||||
{
|
{
|
||||||
if(emit >= emitters.size())
|
if(emit >= emitters.size())
|
||||||
return;
|
return;
|
||||||
|
@ -167,7 +167,7 @@ void ScriptedEntity::startEmitter(int emit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedEntity::stopEmitter(int emit)
|
void ScriptedEntity::stopEmitter(size_t emit)
|
||||||
{
|
{
|
||||||
if(emit >= emitters.size())
|
if(emit >= emitters.size())
|
||||||
return;
|
return;
|
||||||
|
@ -178,12 +178,12 @@ void ScriptedEntity::stopEmitter(int emit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleEffect *ScriptedEntity::getEmitter(int emit)
|
ParticleEffect *ScriptedEntity::getEmitter(size_t emit)
|
||||||
{
|
{
|
||||||
return (size_t(emit) < emitters.size()) ? emitters[emit] : NULL;
|
return (size_t(emit) < emitters.size()) ? emitters[emit] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptedEntity::getNumEmitters() const
|
size_t ScriptedEntity::getNumEmitters() const
|
||||||
{
|
{
|
||||||
return emitters.size();
|
return emitters.size();
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ void ScriptedEntity::initSegments(int numSegments, int minDist, int maxDist, std
|
||||||
this->minDist = minDist;
|
this->minDist = minDist;
|
||||||
this->maxDist = maxDist;
|
this->maxDist = maxDist;
|
||||||
segments.resize(numSegments);
|
segments.resize(numSegments);
|
||||||
for (int i = segments.size()-1; i >= 0 ; i--)
|
for (size_t i = segments.size(); i-- > 0 ; )
|
||||||
{
|
{
|
||||||
Quad *q = new Quad;
|
Quad *q = new Quad;
|
||||||
if (i == segments.size()-1)
|
if (i == segments.size()-1)
|
||||||
|
@ -258,7 +258,7 @@ void ScriptedEntity::initStrands(int num, int segs, int dist, int strandSpacing,
|
||||||
{
|
{
|
||||||
this->strandSpacing = strandSpacing;
|
this->strandSpacing = strandSpacing;
|
||||||
strands.resize(num);
|
strands.resize(num);
|
||||||
for (int i = 0; i < strands.size(); i++)
|
for (size_t i = 0; i < strands.size(); i++)
|
||||||
{
|
{
|
||||||
strands[i] = new Strand(position, segs, dist);
|
strands[i] = new Strand(position, segs, dist);
|
||||||
strands[i]->color = color;
|
strands[i]->color = color;
|
||||||
|
@ -393,7 +393,7 @@ void ScriptedEntity::updateStrands(float dt)
|
||||||
angle = (PI*(360-(angle-90)))/180.0;
|
angle = (PI*(360-(angle-90)))/180.0;
|
||||||
|
|
||||||
float sz = (strands.size()/2);
|
float sz = (strands.size()/2);
|
||||||
for (int i = 0; i < strands.size(); i++)
|
for (size_t i = 0; i < strands.size(); i++)
|
||||||
{
|
{
|
||||||
float diff = (i-sz)*strandSpacing;
|
float diff = (i-sz)*strandSpacing;
|
||||||
if (diff < 0)
|
if (diff < 0)
|
||||||
|
@ -787,7 +787,7 @@ void ScriptedEntity::onEnterState(int action)
|
||||||
destroySegments(1);
|
destroySegments(1);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < strands.size(); i++)
|
for (size_t i = 0; i < strands.size(); i++)
|
||||||
{
|
{
|
||||||
strands[i]->safeKill();
|
strands[i]->safeKill();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,11 +80,11 @@ public:
|
||||||
ParticleEffect pullEmitter;
|
ParticleEffect pullEmitter;
|
||||||
float manaBallAmount;
|
float manaBallAmount;
|
||||||
|
|
||||||
void initEmitter(int emit, const std::string &file);
|
void initEmitter(size_t emit, const std::string &file);
|
||||||
void startEmitter(int emit);
|
void startEmitter(size_t emit);
|
||||||
void stopEmitter(int emit);
|
void stopEmitter(size_t emit);
|
||||||
ParticleEffect *getEmitter(int emit);
|
ParticleEffect *getEmitter(size_t emit);
|
||||||
int getNumEmitters() const;
|
size_t getNumEmitters() const;
|
||||||
|
|
||||||
void shiftWorlds(WorldType lastWorld, WorldType worldType);
|
void shiftWorlds(WorldType lastWorld, WorldType worldType);
|
||||||
void setAutoSkeletalUpdate(bool v);
|
void setAutoSkeletalUpdate(bool v);
|
||||||
|
|
|
@ -36,14 +36,14 @@ void Segmented::setMaxDist(float m)
|
||||||
|
|
||||||
void Segmented::initSegments(const Vector &position)
|
void Segmented::initSegments(const Vector &position)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
segments[i]->position = position;
|
segments[i]->position = position;
|
||||||
numSegments = segments.size();
|
numSegments = segments.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Segmented::destroySegments(float life)
|
void Segmented::destroySegments(float life)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
segments[i]->setLife(life);
|
segments[i]->setLife(life);
|
||||||
segments[i]->setDecayRate(1.0f);
|
segments[i]->setDecayRate(1.0f);
|
||||||
|
@ -52,9 +52,9 @@ void Segmented::destroySegments(float life)
|
||||||
segments.clear();
|
segments.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderObject *Segmented::getSegment(int seg)
|
RenderObject *Segmented::getSegment(size_t seg)
|
||||||
{
|
{
|
||||||
if (seg < 0 || seg >= segments.size())
|
if (seg >= segments.size())
|
||||||
return 0;
|
return 0;
|
||||||
return segments[seg];
|
return segments[seg];
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void Segmented::updateSegment(int i, const Vector &diff)
|
||||||
|
|
||||||
void Segmented::updateAlpha(float a)
|
void Segmented::updateAlpha(float a)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
segments[i]->alpha = a;
|
segments[i]->alpha = a;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ void Segmented::updateAlpha(float a)
|
||||||
|
|
||||||
void Segmented::warpSegments(const Vector &position)
|
void Segmented::warpSegments(const Vector &position)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
segments[i]->position = position;
|
segments[i]->position = position;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Segmented
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Segmented(float minDist, float maxDist);
|
Segmented(float minDist, float maxDist);
|
||||||
RenderObject *getSegment(int seg);
|
RenderObject *getSegment(size_t seg);
|
||||||
void updateAlpha(float a);
|
void updateAlpha(float a);
|
||||||
void warpSegments(const Vector &position);
|
void warpSegments(const Vector &position);
|
||||||
void setMaxDist(float m);
|
void setMaxDist(float m);
|
||||||
|
@ -47,7 +47,7 @@ protected:
|
||||||
class Strand : public RenderObject, public Segmented
|
class Strand : public RenderObject, public Segmented
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Strand(const Vector &position, int segs, int dist=32);
|
Strand(const Vector &position, size_t segs, size_t dist=32);
|
||||||
void destroy();
|
void destroy();
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
|
|
|
@ -292,7 +292,7 @@ namespace NagStuff
|
||||||
|
|
||||||
const float screenTime = 3;
|
const float screenTime = 3;
|
||||||
const float nagFadeTime = 1;
|
const float nagFadeTime = 1;
|
||||||
};
|
}
|
||||||
|
|
||||||
using namespace NagStuff;
|
using namespace NagStuff;
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ void Nag::update(float dt)
|
||||||
ic ++;
|
ic ++;
|
||||||
if (ic >= numScreens)
|
if (ic >= numScreens)
|
||||||
ic = 0;
|
ic = 0;
|
||||||
for (int i = 0; i < irot.size(); i++) irot[i]->alpha.interpolateTo(0, nagFadeTime);
|
for (size_t i = 0; i < irot.size(); i++) irot[i]->alpha.interpolateTo(0, nagFadeTime);
|
||||||
irot[ic]->alpha.interpolateTo(1, nagFadeTime);
|
irot[ic]->alpha.interpolateTo(1, nagFadeTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ void StatsAndAchievements::RunFrame()
|
||||||
// but only if we're not in a mod
|
// but only if we're not in a mod
|
||||||
if (!dsq->mod.isActive())
|
if (!dsq->mod.isActive())
|
||||||
{
|
{
|
||||||
for ( int iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
for (size_t iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
||||||
{
|
{
|
||||||
EvaluateAchievement( g_rgAchievements[iAch] );
|
EvaluateAchievement( g_rgAchievements[iAch] );
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ void StatsAndAchievements::appendStringData(std::string &data)
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
data += "Unlocked:\n\n";
|
data += "Unlocked:\n\n";
|
||||||
for ( int iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
for (size_t iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
||||||
{
|
{
|
||||||
const Achievement &ach = g_rgAchievements[iAch];
|
const Achievement &ach = g_rgAchievements[iAch];
|
||||||
if (!ach.achieved)
|
if (!ach.achieved)
|
||||||
|
@ -271,7 +271,7 @@ void StatsAndAchievements::appendStringData(std::string &data)
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
data += "Locked:\n\n";
|
data += "Locked:\n\n";
|
||||||
for ( int iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
for (size_t iAch = 0; iAch < ARRAYSIZE( g_rgAchievements ); ++iAch )
|
||||||
{
|
{
|
||||||
const Achievement &ach = g_rgAchievements[iAch];
|
const Achievement &ach = g_rgAchievements[iAch];
|
||||||
if (ach.achieved)
|
if (ach.achieved)
|
||||||
|
@ -384,7 +384,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
|
||||||
bool didPoisonLoaf = false;
|
bool didPoisonLoaf = false;
|
||||||
bool didVeggieSoup = false;
|
bool didVeggieSoup = false;
|
||||||
|
|
||||||
for (int i = 0; i < dsq->continuity.recipes.size(); i++ )
|
for (size_t i = 0; i < dsq->continuity.recipes.size(); i++ )
|
||||||
{
|
{
|
||||||
if (dsq->continuity.recipes[i].isKnown())
|
if (dsq->continuity.recipes[i].isKnown())
|
||||||
{
|
{
|
||||||
|
@ -397,7 +397,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < dsq->continuity.recipes.size(); i++ )
|
for (size_t i = 0; i < dsq->continuity.recipes.size(); i++ )
|
||||||
{
|
{
|
||||||
if (!dsq->continuity.recipes[i].isKnown())
|
if (!dsq->continuity.recipes[i].isKnown())
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,11 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "Segmented.h"
|
#include "Segmented.h"
|
||||||
#include "RenderBase.h"
|
#include "RenderBase.h"
|
||||||
|
|
||||||
Strand::Strand(const Vector &position, int segs, int dist) : RenderObject(), Segmented(dist, dist)
|
Strand::Strand(const Vector &position, size_t segs, size_t dist) : RenderObject(), Segmented(dist, dist)
|
||||||
{
|
{
|
||||||
cull = false;
|
cull = false;
|
||||||
segments.resize(segs);
|
segments.resize(segs);
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
segments[i] = new RenderObject;
|
segments[i] = new RenderObject;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ Strand::Strand(const Vector &position, int segs, int dist) : RenderObject(), Seg
|
||||||
void Strand::destroy()
|
void Strand::destroy()
|
||||||
{
|
{
|
||||||
RenderObject::destroy();
|
RenderObject::destroy();
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
segments[i]->destroy();
|
segments[i]->destroy();
|
||||||
delete segments[i];
|
delete segments[i];
|
||||||
|
|
|
@ -65,7 +65,7 @@ void StringBank::_load(const std::string &file)
|
||||||
|
|
||||||
if (!line.empty() && line[0] == ' ')
|
if (!line.empty() && line[0] == ' ')
|
||||||
line = line.substr(1, line.size());
|
line = line.substr(1, line.size());
|
||||||
for (int i = 0; i < line.size(); i++)
|
for (size_t i = 0; i < line.size(); i++)
|
||||||
{
|
{
|
||||||
if (line[i] == '|')
|
if (line[i] == '|')
|
||||||
line[i] = '\n';
|
line[i] = '\n';
|
||||||
|
|
|
@ -200,30 +200,28 @@ void UserSettings::save()
|
||||||
{
|
{
|
||||||
const ActionSet& as = control.actionSets[i];
|
const ActionSet& as = control.actionSets[i];
|
||||||
XMLElement *xml_actionSet = doc.NewElement("ActionSet");
|
XMLElement *xml_actionSet = doc.NewElement("ActionSet");
|
||||||
|
xml_actionSet->SetAttribute("enabled", as.enabled);
|
||||||
|
xml_actionSet->SetAttribute("name", as.name.c_str());
|
||||||
|
xml_actionSet->SetAttribute("joystickName", as.joystickName.c_str());
|
||||||
|
xml_actionSet->SetAttribute("joystickGUID", as.joystickGUID.c_str());
|
||||||
|
XMLElement *xml_joyAxes = doc.NewElement("JoyAxes");
|
||||||
{
|
{
|
||||||
xml_actionSet->SetAttribute("enabled", as.enabled);
|
xml_joyAxes->SetAttribute("s1ax", as.joycfg.s1ax);
|
||||||
xml_actionSet->SetAttribute("name", as.name.c_str());
|
xml_joyAxes->SetAttribute("s1ay", as.joycfg.s1ay);
|
||||||
xml_actionSet->SetAttribute("joystickName", as.joystickName.c_str());
|
xml_joyAxes->SetAttribute("s2ax", as.joycfg.s2ax);
|
||||||
xml_actionSet->SetAttribute("joystickGUID", as.joystickGUID.c_str());
|
xml_joyAxes->SetAttribute("s2ay", as.joycfg.s2ay);
|
||||||
XMLElement *xml_joyAxes = doc.NewElement("JoyAxes");
|
xml_joyAxes->SetAttribute("s1dead", as.joycfg.s1dead);
|
||||||
{
|
xml_joyAxes->SetAttribute("s2dead", as.joycfg.s2dead);
|
||||||
xml_joyAxes->SetAttribute("s1ax", as.joycfg.s1ax);
|
}
|
||||||
xml_joyAxes->SetAttribute("s1ay", as.joycfg.s1ay);
|
xml_actionSet->InsertEndChild(xml_joyAxes);
|
||||||
xml_joyAxes->SetAttribute("s2ax", as.joycfg.s2ax);
|
for (int i = 0; i < as.inputSet.size(); i++)
|
||||||
xml_joyAxes->SetAttribute("s2ay", as.joycfg.s2ay);
|
{
|
||||||
xml_joyAxes->SetAttribute("s1dead", as.joycfg.s1dead);
|
XMLElement *xml_action = doc.NewElement("Action");
|
||||||
xml_joyAxes->SetAttribute("s2dead", as.joycfg.s2dead);
|
const ActionInput& ai = as.inputSet[i];
|
||||||
}
|
xml_action->SetAttribute("name", ai.name.c_str());
|
||||||
xml_actionSet->InsertEndChild(xml_joyAxes);
|
xml_action->SetAttribute("input", ai.toString().c_str());
|
||||||
for (int i = 0; i < as.inputSet.size(); i++)
|
|
||||||
{
|
|
||||||
XMLElement *xml_action = doc.NewElement("Action");
|
|
||||||
const ActionInput& ai = as.inputSet[i];
|
|
||||||
xml_action->SetAttribute("name", ai.name.c_str());
|
|
||||||
xml_action->SetAttribute("input", ai.toString().c_str());
|
|
||||||
|
|
||||||
xml_actionSet->InsertEndChild(xml_action);
|
xml_actionSet->InsertEndChild(xml_action);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
xml_control->InsertEndChild(xml_actionSet);
|
xml_control->InsertEndChild(xml_actionSet);
|
||||||
}
|
}
|
||||||
|
@ -254,8 +252,8 @@ void UserSettings::save()
|
||||||
|
|
||||||
XMLElement *xml_data = doc.NewElement("Data");
|
XMLElement *xml_data = doc.NewElement("Data");
|
||||||
{
|
{
|
||||||
xml_data->SetAttribute("savePage", data.savePage);
|
xml_data->SetAttribute("savePage", (unsigned int) data.savePage);
|
||||||
xml_data->SetAttribute("saveSlot", data.saveSlot);
|
xml_data->SetAttribute("saveSlot", (unsigned int) data.saveSlot);
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
for (std::vector<std::string>::iterator it = dsq->activePatches.begin(); it != dsq->activePatches.end(); ++it)
|
for (std::vector<std::string>::iterator it = dsq->activePatches.begin(); it != dsq->activePatches.end(); ++it)
|
||||||
|
@ -544,8 +542,12 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
|
||||||
XMLElement *xml_data = doc.FirstChildElement("Data");
|
XMLElement *xml_data = doc.FirstChildElement("Data");
|
||||||
if (xml_data)
|
if (xml_data)
|
||||||
{
|
{
|
||||||
xml_data->QueryIntAttribute("savePage", &data.savePage);
|
// use a temporary variable so we don't get into trouble on big-endian architectures
|
||||||
xml_data->QueryIntAttribute("saveSlot", &data.saveSlot);
|
unsigned int tmp;
|
||||||
|
xml_data->QueryUnsignedAttribute("savePage", &tmp);
|
||||||
|
data.savePage = tmp;
|
||||||
|
xml_data->QueryUnsignedAttribute("saveSlot", &tmp);
|
||||||
|
data.saveSlot = tmp;
|
||||||
|
|
||||||
if(const char *patchlist = xml_data->Attribute("activePatches"))
|
if(const char *patchlist = xml_data->Attribute("activePatches"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,8 +117,8 @@ public:
|
||||||
struct Data
|
struct Data
|
||||||
{
|
{
|
||||||
Data() { savePage=0; saveSlot=0; }
|
Data() { savePage=0; saveSlot=0; }
|
||||||
int savePage;
|
size_t savePage;
|
||||||
int saveSlot;
|
size_t saveSlot;
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
struct Version
|
struct Version
|
||||||
|
|
|
@ -77,16 +77,16 @@ int Web::addPoint(const Vector &point)
|
||||||
return points.size()-1;
|
return points.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Web::setPoint(int pt, const Vector &v)
|
void Web::setPoint(size_t pt, const Vector &v)
|
||||||
{
|
{
|
||||||
if (pt < 0 || pt >= points.size()) return;
|
if (pt >= points.size()) return;
|
||||||
points[pt] = v;
|
points[pt] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector Web::getPoint(int pt) const
|
Vector Web::getPoint(size_t pt) const
|
||||||
{
|
{
|
||||||
Vector v;
|
Vector v;
|
||||||
if (pt >= 0 || pt < points.size())
|
if ( pt < points.size())
|
||||||
v = points[pt];
|
v = points[pt];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -123,9 +123,9 @@ void Web::onUpdate(float dt)
|
||||||
Entity *e = (*i);
|
Entity *e = (*i);
|
||||||
if ((e->getEntityType() == ET_ENEMY || e->getEntityType() == ET_AVATAR) && e->isDamageTarget(DT_ENEMY_WEB))
|
if ((e->getEntityType() == ET_ENEMY || e->getEntityType() == ET_AVATAR) && e->isDamageTarget(DT_ENEMY_WEB))
|
||||||
{
|
{
|
||||||
if (parentEntity != e)
|
if (parentEntity != e && points.size() > 0)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < points.size()-1; j++)
|
for (size_t j = 0; j < points.size()-1; j++)
|
||||||
{
|
{
|
||||||
if (game->collideCircleVsLine(e, points[j], points[j+1], 4))
|
if (game->collideCircleVsLine(e, points[j], points[j+1], 4))
|
||||||
{
|
{
|
||||||
|
@ -155,14 +155,13 @@ void Web::onRender()
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
for (int i = 0; i < points.size()-1; i++)
|
if(points.size() > 0) {
|
||||||
{
|
for (size_t i = 0; i < points.size()-1; i++) {
|
||||||
|
glColor4f(1, 1, 1, 0.5f*alpha.x);
|
||||||
glColor4f(1, 1, 1, 0.5f*alpha.x);
|
glVertex3f(points[i].x, points[i].y, 0);
|
||||||
glVertex3f(points[i].x, points[i].y, 0);
|
glColor4f(1, 1, 1, 0.5f*alpha.x);
|
||||||
glColor4f(1, 1, 1, 0.5f*alpha.x);
|
glVertex3f(points[i+1].x, points[i+1].y, 0);
|
||||||
glVertex3f(points[i+1].x, points[i+1].y, 0);
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ class Web : public RenderObject
|
||||||
public:
|
public:
|
||||||
Web();
|
Web();
|
||||||
int addPoint(const Vector &point = Vector(0,0));
|
int addPoint(const Vector &point = Vector(0,0));
|
||||||
void setPoint(int pt, const Vector &v);
|
void setPoint(size_t pt, const Vector &v);
|
||||||
Vector getPoint(int pt) const;
|
Vector getPoint(size_t pt) const;
|
||||||
void setParentEntity(Entity *e);
|
void setParentEntity(Entity *e);
|
||||||
int getNumPoints();
|
int getNumPoints();
|
||||||
typedef std::list<Web*> Webs;
|
typedef std::list<Web*> Webs;
|
||||||
|
|
|
@ -40,8 +40,8 @@ struct WorldMap
|
||||||
void hideMap();
|
void hideMap();
|
||||||
void revealMap(const std::string &name);
|
void revealMap(const std::string &name);
|
||||||
WorldMapTile *getWorldMapTile(const std::string &name);
|
WorldMapTile *getWorldMapTile(const std::string &name);
|
||||||
int getNumWorldMapTiles();
|
size_t getNumWorldMapTiles();
|
||||||
WorldMapTile *getWorldMapTile(int index);
|
WorldMapTile *getWorldMapTile(size_t index);
|
||||||
|
|
||||||
WorldMapTile *getWorldMapTileByIndex(int index);
|
WorldMapTile *getWorldMapTileByIndex(int index);
|
||||||
void revealMapIndex(int index);
|
void revealMapIndex(int index);
|
||||||
|
|
|
@ -1282,7 +1282,7 @@ void WorldMapRender::fixGems()
|
||||||
|
|
||||||
void WorldMapRender::addAllGems()
|
void WorldMapRender::addAllGems()
|
||||||
{
|
{
|
||||||
int c = 0;
|
size_t c = 0;
|
||||||
for (Continuity::Gems::reverse_iterator i = dsq->continuity.gems.rbegin(); i != dsq->continuity.gems.rend(); i++)
|
for (Continuity::Gems::reverse_iterator i = dsq->continuity.gems.rbegin(); i != dsq->continuity.gems.rend(); i++)
|
||||||
{
|
{
|
||||||
GemMover *g = addGem(&(*i));
|
GemMover *g = addGem(&(*i));
|
||||||
|
|
|
@ -282,7 +282,7 @@ void WorldMap::save()
|
||||||
|
|
||||||
if (out)
|
if (out)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
for (size_t i = 0; i < worldMapTiles.size(); i++)
|
||||||
{
|
{
|
||||||
WorldMapTile *t = &worldMapTiles[i];
|
WorldMapTile *t = &worldMapTiles[i];
|
||||||
out << t->index << " " << t->stringIndex << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
out << t->index << " " << t->stringIndex << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
||||||
|
@ -317,7 +317,7 @@ WorldMapTile *WorldMap::getWorldMapTile(const std::string &name)
|
||||||
{
|
{
|
||||||
std::string n = name;
|
std::string n = name;
|
||||||
stringToUpper(n);
|
stringToUpper(n);
|
||||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
for (size_t i = 0; i < worldMapTiles.size(); i++)
|
||||||
{
|
{
|
||||||
if (worldMapTiles[i].name == n)
|
if (worldMapTiles[i].name == n)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,7 @@ WorldMapTile *WorldMap::getWorldMapTile(const std::string &name)
|
||||||
|
|
||||||
WorldMapTile *WorldMap::getWorldMapTileByIndex(int index)
|
WorldMapTile *WorldMap::getWorldMapTileByIndex(int index)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
for (size_t i = 0; i < worldMapTiles.size(); i++)
|
||||||
{
|
{
|
||||||
if (worldMapTiles[i].index == index)
|
if (worldMapTiles[i].index == index)
|
||||||
{
|
{
|
||||||
|
@ -343,20 +343,20 @@ WorldMapTile *WorldMap::getWorldMapTileByIndex(int index)
|
||||||
|
|
||||||
void WorldMap::hideMap()
|
void WorldMap::hideMap()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
for (size_t i = 0; i < worldMapTiles.size(); i++)
|
||||||
{
|
{
|
||||||
worldMapTiles[i].revealed = false;
|
worldMapTiles[i].revealed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int WorldMap::getNumWorldMapTiles()
|
size_t WorldMap::getNumWorldMapTiles()
|
||||||
{
|
{
|
||||||
return worldMapTiles.size();
|
return worldMapTiles.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldMapTile *WorldMap::getWorldMapTile(int index)
|
WorldMapTile *WorldMap::getWorldMapTile(size_t index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= worldMapTiles.size()) return 0;
|
if (index >= worldMapTiles.size()) return 0;
|
||||||
|
|
||||||
return &worldMapTiles[index];
|
return &worldMapTiles[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,9 +177,9 @@ int getStringToInputCode(const std::string& s)
|
||||||
|
|
||||||
ActionInput::ActionInput()
|
ActionInput::ActionInput()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < INP_MSESIZE; i++) mse[i] = 0;
|
for (int i = 0; i < INP_MSESIZE; i++) data.single.mse[i] = 0;
|
||||||
for (int i = 0; i < INP_KEYSIZE; i++) key[i] = 0;
|
for (int i = 0; i < INP_KEYSIZE; i++) data.single.key[i] = 0;
|
||||||
for (int i = 0; i < INP_JOYSIZE; i++) joy[i] = 0;
|
for (int i = 0; i < INP_JOYSIZE; i++) data.single.joy[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ActionInput::toString() const
|
std::string ActionInput::toString() const
|
||||||
|
@ -188,15 +188,15 @@ std::string ActionInput::toString() const
|
||||||
|
|
||||||
for (int i = 0; i < INP_MSESIZE; i++)
|
for (int i = 0; i < INP_MSESIZE; i++)
|
||||||
{
|
{
|
||||||
os << getInputCodeToString(mse[i]) << " ";
|
os << getInputCodeToString(data.single.mse[i]) << " ";
|
||||||
}
|
}
|
||||||
for (int i = 0; i < INP_KEYSIZE; i++)
|
for (int i = 0; i < INP_KEYSIZE; i++)
|
||||||
{
|
{
|
||||||
os << getInputCodeToString(key[i]) << " ";
|
os << getInputCodeToString(data.single.key[i]) << " ";
|
||||||
}
|
}
|
||||||
for (int i = 0; i < INP_JOYSIZE; i++)
|
for (int i = 0; i < INP_JOYSIZE; i++)
|
||||||
{
|
{
|
||||||
os << getInputCodeToString(joy[i]) << " ";
|
os << getInputCodeToString(data.single.joy[i]) << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
|
@ -209,17 +209,17 @@ void ActionInput::fromString(const std::string &read)
|
||||||
for (int i = 0; i < INP_MSESIZE; i++)
|
for (int i = 0; i < INP_MSESIZE; i++)
|
||||||
{
|
{
|
||||||
is >> str;
|
is >> str;
|
||||||
mse[i] = getStringToInputCode(str);
|
data.single.mse[i] = getStringToInputCode(str);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < INP_KEYSIZE; i++)
|
for (int i = 0; i < INP_KEYSIZE; i++)
|
||||||
{
|
{
|
||||||
is >> str;
|
is >> str;
|
||||||
key[i] = getStringToInputCode(str);
|
data.single.key[i] = getStringToInputCode(str);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < INP_JOYSIZE; i++)
|
for (int i = 0; i < INP_JOYSIZE; i++)
|
||||||
{
|
{
|
||||||
is >> str;
|
is >> str;
|
||||||
joy[i] = getStringToInputCode(str);
|
data.single.joy[i] = getStringToInputCode(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ public:
|
||||||
int mse[INP_MSESIZE];
|
int mse[INP_MSESIZE];
|
||||||
int key[INP_KEYSIZE];
|
int key[INP_KEYSIZE];
|
||||||
int joy[INP_JOYSIZE];
|
int joy[INP_JOYSIZE];
|
||||||
};
|
} single;
|
||||||
int all[INP_COMBINED_SIZE];
|
int all[INP_COMBINED_SIZE];
|
||||||
};
|
} data;
|
||||||
|
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
void fromString(const std::string &read);
|
void fromString(const std::string &read);
|
||||||
|
|
|
@ -113,7 +113,7 @@ void ActionMapper::addAction(Event *event, int k, int state)
|
||||||
|
|
||||||
Event* ActionMapper::addCreatedEvent(Event *event)
|
Event* ActionMapper::addCreatedEvent(Event *event)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < createdEvents.size(); i++)
|
for (size_t i = 0; i < createdEvents.size(); i++)
|
||||||
{
|
{
|
||||||
if (createdEvents[i] == event)
|
if (createdEvents[i] == event)
|
||||||
return event;
|
return event;
|
||||||
|
@ -124,7 +124,7 @@ Event* ActionMapper::addCreatedEvent(Event *event)
|
||||||
|
|
||||||
void ActionMapper::clearCreatedEvents()
|
void ActionMapper::clearCreatedEvents()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < createdEvents.size(); i++)
|
for (size_t i = 0; i < createdEvents.size(); i++)
|
||||||
{
|
{
|
||||||
delete createdEvents[i];
|
delete createdEvents[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,14 +148,14 @@ void ActionSet::importAction(ActionMapper *mapper, const std::string &name, int
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
if (!mapper) return;
|
if (!mapper) return;
|
||||||
|
|
||||||
for (int i = 0; i < inputSet.size(); i++)
|
for (size_t i = 0; i < inputSet.size(); i++)
|
||||||
{
|
{
|
||||||
const ActionInput *actionInput = &inputSet[i];
|
const ActionInput *actionInput = &inputSet[i];
|
||||||
if (actionInput->name == name)
|
if (actionInput->name == name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < INP_COMBINED_SIZE; i++)
|
for (int i = 0; i < INP_COMBINED_SIZE; i++)
|
||||||
if (actionInput->all[i])
|
if (actionInput->data.all[i])
|
||||||
mapper->addAction(actionID, actionInput->all[i], sourceID);
|
mapper->addAction(actionID, actionInput->data.all[i], sourceID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,14 +166,14 @@ void ActionSet::importAction(ActionMapper *mapper, const std::string &name, Even
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
if (!mapper) return;
|
if (!mapper) return;
|
||||||
|
|
||||||
for (int i = 0; i < inputSet.size(); i++)
|
for (size_t i = 0; i < inputSet.size(); i++)
|
||||||
{
|
{
|
||||||
const ActionInput *actionInput = &inputSet[i];
|
const ActionInput *actionInput = &inputSet[i];
|
||||||
if (actionInput->name == name)
|
if (actionInput->name == name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < INP_COMBINED_SIZE; i++)
|
for (int i = 0; i < INP_COMBINED_SIZE; i++)
|
||||||
if (actionInput->all[i])
|
if (actionInput->data.all[i])
|
||||||
mapper->addAction(event, actionInput->all[i], state);
|
mapper->addAction(event, actionInput->data.all[i], state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,8 @@ std::string ActionSet::insertInputIntoString(const std::string &string)
|
||||||
{
|
{
|
||||||
std::string str = string;
|
std::string str = string;
|
||||||
|
|
||||||
int start = str.find('{');
|
size_t start = str.find('{');
|
||||||
int end = str.find('}');
|
size_t end = str.find('}');
|
||||||
if (start == std::string::npos || end == std::string::npos)
|
if (start == std::string::npos || end == std::string::npos)
|
||||||
return string;
|
return string;
|
||||||
std::string code = str.substr(start+1, end - start);
|
std::string code = str.substr(start+1, end - start);
|
||||||
|
|
|
@ -20,8 +20,8 @@ void ActionButtonStatus::import(const ActionSet& as)
|
||||||
{
|
{
|
||||||
const ActionInput& inp = as.inputSet[i];
|
const ActionInput& inp = as.inputSet[i];
|
||||||
for(int j = 0; j < INP_COMBINED_SIZE; ++j)
|
for(int j = 0; j < INP_COMBINED_SIZE; ++j)
|
||||||
if(unsigned(inp.all[j]) < ACTION_BUTTON_ENUM_SIZE)
|
if(unsigned(inp.data.all[j]) < ACTION_BUTTON_ENUM_SIZE)
|
||||||
found[inp.all[j]] = 1;
|
found[inp.data.all[j]] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
toQuery.clear();
|
toQuery.clear();
|
||||||
|
|
|
@ -81,7 +81,7 @@ AfterEffectManager::~AfterEffectManager()
|
||||||
|
|
||||||
void AfterEffectManager::deleteEffects()
|
void AfterEffectManager::deleteEffects()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < effects.size(); i++)
|
for (size_t i = 0; i < effects.size(); i++)
|
||||||
{
|
{
|
||||||
if (effects[i])
|
if (effects[i])
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ void AfterEffectManager::update(float dt)
|
||||||
else
|
else
|
||||||
active = false;
|
active = false;
|
||||||
|
|
||||||
for (int i = 0; i < effects.size(); i++)
|
for (size_t i = 0; i < effects.size(); i++)
|
||||||
{
|
{
|
||||||
Effect *e = effects[i];
|
Effect *e = effects[i];
|
||||||
if (e)
|
if (e)
|
||||||
|
|
|
@ -50,7 +50,7 @@ int randRange(int n1, int n2)
|
||||||
std::string removeSpaces(const std::string &input)
|
std::string removeSpaces(const std::string &input)
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
for (int i = 0; i < input.size(); i++)
|
for (size_t i = 0; i < input.size(); i++)
|
||||||
{
|
{
|
||||||
if (input[i] != ' ')
|
if (input[i] != ' ')
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ unsigned hash(const std::string &string)
|
||||||
{
|
{
|
||||||
unsigned hash = 5381;
|
unsigned hash = 5381;
|
||||||
|
|
||||||
for (int i = 0; i < string.size(); i++)
|
for (size_t i = 0; i < string.size(); i++)
|
||||||
hash = ((hash << 5) + hash) + (unsigned char)string[i];
|
hash = ((hash << 5) + hash) + (unsigned char)string[i];
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
|
@ -127,7 +127,7 @@ std::string splitCamelCase(const std::string &input)
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
int last = 0;
|
int last = 0;
|
||||||
for (int i = 0; i < input.size(); i++)
|
for (size_t i = 0; i < input.size(); i++)
|
||||||
{
|
{
|
||||||
if (last == 1)
|
if (last == 1)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ std::string splitCamelCase(const std::string &input)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string numToZeroString(int num, int zeroes)
|
std::string numToZeroString(int num, size_t zeroes)
|
||||||
{
|
{
|
||||||
std::ostringstream num_os;
|
std::ostringstream num_os;
|
||||||
num_os << num;
|
num_os << num;
|
||||||
|
@ -158,7 +158,7 @@ std::string numToZeroString(int num, int zeroes)
|
||||||
|
|
||||||
if (num_os.str().size() <= zeroes)
|
if (num_os.str().size() <= zeroes)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < zeroes - num_os.str().size(); j++)
|
for (size_t j = 0; j < zeroes - num_os.str().size(); j++)
|
||||||
{
|
{
|
||||||
os << "0";
|
os << "0";
|
||||||
}
|
}
|
||||||
|
@ -169,13 +169,13 @@ std::string numToZeroString(int num, int zeroes)
|
||||||
|
|
||||||
void stringToUpper(std::string &s)
|
void stringToUpper(std::string &s)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < s.size(); i++)
|
for (size_t i = 0; i < s.size(); i++)
|
||||||
s[i] = charToUpper(s[i]);
|
s[i] = charToUpper(s[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stringToLower(std::string &s)
|
void stringToLower(std::string &s)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < s.size(); i++)
|
for (size_t i = 0; i < s.size(); i++)
|
||||||
s[i] = charToLower(s[i]);
|
s[i] = charToLower(s[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ char *readFile(const std::string& path, unsigned long *size_ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
long bytesRead = vfread(buffer, 1, fileSize, f);
|
size_t bytesRead = vfread(buffer, 1, fileSize, f);
|
||||||
if (bytesRead != fileSize)
|
if (bytesRead != fileSize)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
@ -340,7 +340,7 @@ char *readFile(const std::string& path, unsigned long *size_ret)
|
||||||
std::string stripEndlineForUnix(const std::string &in)
|
std::string stripEndlineForUnix(const std::string &in)
|
||||||
{
|
{
|
||||||
std::string out;
|
std::string out;
|
||||||
for (int i = 0; i < in.size(); i++)
|
for (size_t i = 0; i < in.size(); i++)
|
||||||
{
|
{
|
||||||
if (int(in[i]) != 13)
|
if (int(in[i]) != 13)
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,7 @@ float lerp(const float &v1, const float &v2, float dt, int lerpType)
|
||||||
std::string underscoresToSpaces(const std::string &str)
|
std::string underscoresToSpaces(const std::string &str)
|
||||||
{
|
{
|
||||||
std::string s = str;
|
std::string s = str;
|
||||||
for (int i = 0; i < s.size(); i++)
|
for (size_t i = 0; i < s.size(); i++)
|
||||||
if (s[i] == '_') s[i] = ' ';
|
if (s[i] == '_') s[i] = ' ';
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ std::string underscoresToSpaces(const std::string &str)
|
||||||
std::string spacesToUnderscores(const std::string &str)
|
std::string spacesToUnderscores(const std::string &str)
|
||||||
{
|
{
|
||||||
std::string s = str;
|
std::string s = str;
|
||||||
for (int i = 0; i < s.size(); i++)
|
for (size_t i = 0; i < s.size(); i++)
|
||||||
if (s[i] == ' ') s[i] = '_';
|
if (s[i] == ' ') s[i] = '_';
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ typedef int CharTranslationTable[256]; // -1 entries are skipped
|
||||||
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
||||||
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
||||||
|
|
||||||
std::string numToZeroString(int num, int zeroes);
|
std::string numToZeroString(int num, size_t zeroes);
|
||||||
bool chance(int perc);
|
bool chance(int perc);
|
||||||
void initCharTranslationTables(const CharTranslationTable *ptab);
|
void initCharTranslationTables(const CharTranslationTable *ptab);
|
||||||
void stringToUpper(std::string &s);
|
void stringToUpper(std::string &s);
|
||||||
|
|
|
@ -148,7 +148,7 @@ void BitmapText::formatText()
|
||||||
float currentWidth = 0;
|
float currentWidth = 0;
|
||||||
alignWidth = 0;
|
alignWidth = 0;
|
||||||
maxW = 0;
|
maxW = 0;
|
||||||
for (int i = 0; i < text.size(); i++)
|
for (size_t i = 0; i < text.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
float sz = bmpFont->font->GetCharWidth(text[i])*bmpFont->scale;
|
float sz = bmpFont->font->GetCharWidth(text[i])*bmpFont->scale;
|
||||||
|
@ -194,10 +194,10 @@ void BitmapText::setBitmapFontEffect(BitmapFontEffect bfe)
|
||||||
void BitmapText::updateWordColoring()
|
void BitmapText::updateWordColoring()
|
||||||
{
|
{
|
||||||
colorIndices.resize(lines.size());
|
colorIndices.resize(lines.size());
|
||||||
for (int i = 0; i < colorIndices.size(); i++)
|
for (size_t i = 0; i < colorIndices.size(); i++)
|
||||||
{
|
{
|
||||||
colorIndices[i].resize(lines[i].size());
|
colorIndices[i].resize(lines[i].size());
|
||||||
for (int j = 0; j < colorIndices[i].size(); j++)
|
for (size_t j = 0; j < colorIndices[i].size(); j++)
|
||||||
{
|
{
|
||||||
colorIndices[i][j] = Vector(1,1,1);
|
colorIndices[i][j] = Vector(1,1,1);
|
||||||
}
|
}
|
||||||
|
@ -265,15 +265,12 @@ void BitmapText::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector BitmapText::getColorIndex(int i, int j)
|
Vector BitmapText::getColorIndex(size_t i, size_t j)
|
||||||
{
|
{
|
||||||
Vector c(1,1,1);
|
Vector c(1,1,1);
|
||||||
if (!(i < 0 || j < 0))
|
if ( i < colorIndices.size() && j < colorIndices[i].size())
|
||||||
{
|
{
|
||||||
if ( i < colorIndices.size() && j < colorIndices[i].size())
|
c = colorIndices[i][j];
|
||||||
{
|
|
||||||
c = colorIndices[i][j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +298,7 @@ void BitmapText::onRender()
|
||||||
|
|
||||||
if (scrolling)
|
if (scrolling)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= currentScrollLine; i++)
|
for (size_t i = 0; i <= currentScrollLine; i++)
|
||||||
{
|
{
|
||||||
std::string theLine = lines[i];
|
std::string theLine = lines[i];
|
||||||
if (i == currentScrollLine)
|
if (i == currentScrollLine)
|
||||||
|
@ -323,7 +320,7 @@ void BitmapText::onRender()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < lines.size(); i++)
|
for (size_t i = 0; i < lines.size(); i++)
|
||||||
{
|
{
|
||||||
x=0;
|
x=0;
|
||||||
if (align == ALIGN_CENTER)
|
if (align == ALIGN_CENTER)
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
virtual void setAlign(Align align);
|
virtual void setAlign(Align align);
|
||||||
std::string getText();
|
std::string getText();
|
||||||
int getWidthOnScreen();
|
int getWidthOnScreen();
|
||||||
Vector getColorIndex(int i, int j);
|
Vector getColorIndex(size_t i, size_t j);
|
||||||
void updateWordColoring();
|
void updateWordColoring();
|
||||||
void autoKern();
|
void autoKern();
|
||||||
void setBitmapFontEffect(BitmapFontEffect bfe);
|
void setBitmapFontEffect(BitmapFontEffect bfe);
|
||||||
|
@ -87,8 +87,8 @@ protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
float scrollDelay;
|
float scrollDelay;
|
||||||
bool scrolling;
|
bool scrolling;
|
||||||
int currentScrollLine;
|
size_t currentScrollLine;
|
||||||
int currentScrollChar;
|
size_t currentScrollChar;
|
||||||
Align align;
|
Align align;
|
||||||
float alignWidth;
|
float alignWidth;
|
||||||
void formatText();
|
void formatText();
|
||||||
|
|
|
@ -89,7 +89,7 @@ ParticleEffect* Core::createParticleEffect(const std::string &name, const Vector
|
||||||
|
|
||||||
void Core::unloadDevice()
|
void Core::unloadDevice()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < renderObjectLayers.size(); i++)
|
for (size_t i = 0; i < renderObjectLayers.size(); i++)
|
||||||
{
|
{
|
||||||
RenderObjectLayer *r = &renderObjectLayers[i];
|
RenderObjectLayer *r = &renderObjectLayers[i];
|
||||||
RenderObject *robj = r->getFirst();
|
RenderObject *robj = r->getFirst();
|
||||||
|
@ -107,7 +107,7 @@ void Core::unloadDevice()
|
||||||
|
|
||||||
void Core::reloadDevice()
|
void Core::reloadDevice()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < renderObjectLayers.size(); i++)
|
for (size_t i = 0; i < renderObjectLayers.size(); i++)
|
||||||
{
|
{
|
||||||
RenderObjectLayer *r = &renderObjectLayers[i];
|
RenderObjectLayer *r = &renderObjectLayers[i];
|
||||||
r->reloadDevice();
|
r->reloadDevice();
|
||||||
|
@ -574,7 +574,7 @@ void Core::initPlatform(const std::string &filesystem)
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
// always a symlink to this process's binary, on modern Linux systems.
|
// always a symlink to this process's binary, on modern Linux systems.
|
||||||
const ssize_t rc = readlink("/proc/self/exe", path, sizeof (path));
|
const ssize_t rc = readlink("/proc/self/exe", path, sizeof (path));
|
||||||
if ( (rc == -1) || (rc >= sizeof (path)) )
|
if ( (rc == -1) || (rc >= (ssize_t) sizeof (path)) )
|
||||||
{
|
{
|
||||||
// error!
|
// error!
|
||||||
debugLog("readlink");
|
debugLog("readlink");
|
||||||
|
@ -698,7 +698,9 @@ void Core::init()
|
||||||
|
|
||||||
if((SDL_Init(SDL_INIT_EVERYTHING))==-1)
|
if((SDL_Init(SDL_INIT_EVERYTHING))==-1)
|
||||||
{
|
{
|
||||||
exit_error("Failed to init SDL");
|
std::string msg("Failed to init SDL: ");
|
||||||
|
msg.append(SDL_GetError());
|
||||||
|
exit_error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
loopDone = false;
|
loopDone = false;
|
||||||
|
@ -1222,7 +1224,7 @@ void Core::resetTimer()
|
||||||
{
|
{
|
||||||
nowTicks = thenTicks = SDL_GetTicks();
|
nowTicks = thenTicks = SDL_GetTicks();
|
||||||
|
|
||||||
for (int i = 0; i < avgFPS.size(); i++)
|
for (size_t i = 0; i < avgFPS.size(); i++)
|
||||||
{
|
{
|
||||||
avgFPS[i] = 0;
|
avgFPS[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -1230,8 +1232,6 @@ void Core::resetTimer()
|
||||||
|
|
||||||
void Core::setMousePosition(const Vector &p)
|
void Core::setMousePosition(const Vector &p)
|
||||||
{
|
{
|
||||||
Vector lp = core->mouse.position;
|
|
||||||
|
|
||||||
core->mouse.position = p;
|
core->mouse.position = p;
|
||||||
float px = p.x + virtualOffX;
|
float px = p.x + virtualOffX;
|
||||||
float py = p.y;
|
float py = p.y;
|
||||||
|
@ -1246,7 +1246,7 @@ void Core::setMousePosition(const Vector &p)
|
||||||
// used to update all render objects either uniformly or as part of a time sliced update process
|
// used to update all render objects either uniformly or as part of a time sliced update process
|
||||||
void Core::updateRenderObjects(float dt)
|
void Core::updateRenderObjects(float dt)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < renderObjectLayers.size(); c++)
|
for (size_t c = 0; c < renderObjectLayers.size(); c++)
|
||||||
{
|
{
|
||||||
|
|
||||||
RenderObjectLayer *rl = &renderObjectLayers[c];
|
RenderObjectLayer *rl = &renderObjectLayers[c];
|
||||||
|
@ -1335,7 +1335,7 @@ void Core::run(float runTime)
|
||||||
if (!avgFPS.empty())
|
if (!avgFPS.empty())
|
||||||
{
|
{
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = avgFPS.size()-1; i > 0; i--)
|
for (i = avgFPS.size()-1; i > 0; i--)
|
||||||
{
|
{
|
||||||
avgFPS[i] = avgFPS[i-1];
|
avgFPS[i] = avgFPS[i-1];
|
||||||
|
@ -1796,11 +1796,9 @@ void Core::print(int x, int y, const char *str, float sz)
|
||||||
|
|
||||||
|
|
||||||
float xx = x;
|
float xx = x;
|
||||||
float yy = y;
|
|
||||||
glTranslatef(x, y-0.5f*sz, 0);
|
glTranslatef(x, y-0.5f*sz, 0);
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
xx = 0; yy = 0;
|
xx = 0;
|
||||||
bool isLower = false, wasLower = false;
|
|
||||||
int c=0;
|
int c=0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1811,13 +1809,6 @@ void Core::print(int x, int y, const char *str, float sz)
|
||||||
|
|
||||||
while (str[c] != '\0')
|
while (str[c] != '\0')
|
||||||
{
|
{
|
||||||
if (str[c] <= 'z' && str[c] >= 'a')
|
|
||||||
isLower = true;
|
|
||||||
else
|
|
||||||
isLower = false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch(toupper(str[c]))
|
switch(toupper(str[c]))
|
||||||
{
|
{
|
||||||
case '_':
|
case '_':
|
||||||
|
@ -2067,11 +2058,6 @@ void Core::print(int x, int y, const char *str, float sz)
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if (isLower)
|
|
||||||
{
|
|
||||||
wasLower = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
c++;
|
c++;
|
||||||
xx += 1.4f;
|
xx += 1.4f;
|
||||||
|
@ -2142,7 +2128,7 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
|
||||||
|
|
||||||
RenderObject::rlayer = 0;
|
RenderObject::rlayer = 0;
|
||||||
|
|
||||||
for (int c = 0; c < renderObjectLayerOrder.size(); c++)
|
for (size_t c = 0; c < renderObjectLayerOrder.size(); c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
int i = renderObjectLayerOrder[c];
|
int i = renderObjectLayerOrder[c];
|
||||||
|
@ -2239,7 +2225,7 @@ void Core::shutdownJoystickLibrary()
|
||||||
|
|
||||||
void Core::clearRenderObjects()
|
void Core::clearRenderObjects()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < renderObjectLayers.size(); i++)
|
for (size_t i = 0; i < renderObjectLayers.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
RenderObject *r = renderObjectLayers[i].getFirst();
|
RenderObject *r = renderObjectLayers[i].getFirst();
|
||||||
|
@ -2454,11 +2440,11 @@ CountedPtr<Texture> Core::addTexture(const std::string &textureName)
|
||||||
return ptex;
|
return ptex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::addRenderObject(RenderObject *o, int layer)
|
void Core::addRenderObject(RenderObject *o, size_t layer)
|
||||||
{
|
{
|
||||||
if (!o) return;
|
if (!o) return;
|
||||||
o->layer = layer;
|
o->layer = layer;
|
||||||
if (layer < 0 || layer >= renderObjectLayers.size())
|
if (layer >= renderObjectLayers.size())
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "attempted to add render object to invalid layer [" << layer << "]";
|
os << "attempted to add render object to invalid layer [" << layer << "]";
|
||||||
|
@ -2477,7 +2463,7 @@ void Core::switchRenderObjectLayer(RenderObject *o, int toLayer)
|
||||||
|
|
||||||
void Core::unloadResources()
|
void Core::unloadResources()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < resources.size(); i++)
|
for (size_t i = 0; i < resources.size(); i++)
|
||||||
{
|
{
|
||||||
resources[i]->unload();
|
resources[i]->unload();
|
||||||
}
|
}
|
||||||
|
@ -2489,7 +2475,7 @@ void Core::onReloadResources()
|
||||||
|
|
||||||
void Core::reloadResources()
|
void Core::reloadResources()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < resources.size(); i++)
|
for (size_t i = 0; i < resources.size(); i++)
|
||||||
{
|
{
|
||||||
resources[i]->reload();
|
resources[i]->reload();
|
||||||
}
|
}
|
||||||
|
@ -2645,8 +2631,8 @@ bool Core::saveScreenshot(const std::string &filename, bool png)
|
||||||
|
|
||||||
// saves an array of pixels as a TGA image
|
// saves an array of pixels as a TGA image
|
||||||
bool Core::tgaSave( const char *filename,
|
bool Core::tgaSave( const char *filename,
|
||||||
short int width,
|
short unsigned int width,
|
||||||
short int height,
|
short unsigned int height,
|
||||||
unsigned char pixelDepth,
|
unsigned char pixelDepth,
|
||||||
unsigned char *imageData) {
|
unsigned char *imageData) {
|
||||||
|
|
||||||
|
@ -2712,8 +2698,8 @@ void Core::screenshot()
|
||||||
|
|
||||||
// saves an array of pixels as a TGA image (frees the image data passed in)
|
// saves an array of pixels as a TGA image (frees the image data passed in)
|
||||||
bool Core::zgaSave( const char *filename,
|
bool Core::zgaSave( const char *filename,
|
||||||
short int w,
|
short unsigned int w,
|
||||||
short int h,
|
short unsigned int h,
|
||||||
unsigned char depth,
|
unsigned char depth,
|
||||||
unsigned char *imageData) {
|
unsigned char *imageData) {
|
||||||
|
|
||||||
|
|
13
BBGE/Core.h
13
BBGE/Core.h
|
@ -190,9 +190,9 @@ protected:
|
||||||
std::vector<DisplayListElement> displayList;
|
std::vector<DisplayListElement> displayList;
|
||||||
|
|
||||||
RenderObjects renderObjects;
|
RenderObjects renderObjects;
|
||||||
int objectCount;
|
size_t objectCount;
|
||||||
int firstFreeIdx;
|
size_t firstFreeIdx;
|
||||||
int iter;
|
size_t iter;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Core : public ActionMapper, public StateManager
|
class Core : public ActionMapper, public StateManager
|
||||||
|
@ -244,7 +244,7 @@ public:
|
||||||
void setFullscreen(bool full);
|
void setFullscreen(bool full);
|
||||||
|
|
||||||
void enable2D(int pixelScaleX, int pixelScaleY);
|
void enable2D(int pixelScaleX, int pixelScaleY);
|
||||||
void addRenderObject(RenderObject *o, int layer=0);
|
void addRenderObject(RenderObject *o, size_t layer=0);
|
||||||
void switchRenderObjectLayer(RenderObject *o, int toLayer);
|
void switchRenderObjectLayer(RenderObject *o, int toLayer);
|
||||||
void addTexture(Texture *r);
|
void addTexture(Texture *r);
|
||||||
CountedPtr<Texture> findTexture(const std::string &name);
|
CountedPtr<Texture> findTexture(const std::string &name);
|
||||||
|
@ -435,9 +435,10 @@ public:
|
||||||
|
|
||||||
CoreSettings settings;
|
CoreSettings settings;
|
||||||
|
|
||||||
bool tgaSave(const char *filename, short int width, short int height, unsigned char pixelDepth, unsigned char *imageData);
|
bool tgaSave(const char *filename, short unsigned int width, short unsigned int height, unsigned char pixelDepth, unsigned char *imageData);
|
||||||
bool zgaSave(const char *filename, short int width, short int height, unsigned char pixelDepth, unsigned char *imageData);
|
bool zgaSave(const char *filename, short unsigned int width, short unsigned int height, unsigned char pixelDepth, unsigned char *imageData);
|
||||||
bool pngSave(const char *filename, unsigned width, unsigned height, unsigned char *data);
|
bool pngSave(const char *filename, unsigned width, unsigned height, unsigned char *data);
|
||||||
|
|
||||||
volatile int dbg_numThreadDecoders;
|
volatile int dbg_numThreadDecoders;
|
||||||
|
|
||||||
virtual void onBackgroundUpdate();
|
virtual void onBackgroundUpdate();
|
||||||
|
|
|
@ -92,7 +92,7 @@ void DebugFont::formatText()
|
||||||
int lastSpace = -1;
|
int lastSpace = -1;
|
||||||
float currentWidth = 0;
|
float currentWidth = 0;
|
||||||
maxW = 0;
|
maxW = 0;
|
||||||
for (int i = 0; i < text.size(); i++)
|
for (size_t i = 0; i < text.size(); i++)
|
||||||
{
|
{
|
||||||
currentWidth += fontDrawSize;
|
currentWidth += fontDrawSize;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void DebugFont::onRender()
|
||||||
{
|
{
|
||||||
const float vspc = 1.5;
|
const float vspc = 1.5;
|
||||||
|
|
||||||
for (int i = 0; i < lines.size(); i++)
|
for (size_t i = 0; i < lines.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
float width = (lines[i].size()) * fontDrawSize * 1.4f * 0.75f;
|
float width = (lines[i].size()) * fontDrawSize * 1.4f * 0.75f;
|
||||||
|
@ -167,12 +167,12 @@ DebugButton::DebugButton(int buttonID, DebugButtonReceiver *receiver, int bgWidt
|
||||||
: RenderObject()
|
: RenderObject()
|
||||||
, label(0)
|
, label(0)
|
||||||
, buttonID(buttonID)
|
, buttonID(buttonID)
|
||||||
, highlight(0)
|
|
||||||
, receiver(receiver)
|
|
||||||
, activeAlpha(0.5f)
|
, activeAlpha(0.5f)
|
||||||
, activeColor(1,1,1)
|
, activeColor(1,1,1)
|
||||||
, inactiveAlpha(0.5f)
|
, inactiveAlpha(0.5f)
|
||||||
, inactiveColor(0,0,0)
|
, inactiveColor(0,0,0)
|
||||||
|
, highlight(0)
|
||||||
|
, receiver(receiver)
|
||||||
{
|
{
|
||||||
if (bgWidth == 0)
|
if (bgWidth == 0)
|
||||||
bgWidth = 150;
|
bgWidth = 150;
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ static void *decode_to_pcm(VFILE *io, ALenum &format, ALsizei &size, ALuint &fre
|
||||||
if (rc > 0)
|
if (rc > 0)
|
||||||
{
|
{
|
||||||
size += rc;
|
size += rc;
|
||||||
if (size >= allocated)
|
if ((size_t) size >= allocated)
|
||||||
{
|
{
|
||||||
allocated *= 2;
|
allocated *= 2;
|
||||||
ALubyte *tmp = (ALubyte *) realloc(retval, allocated);
|
ALubyte *tmp = (ALubyte *) realloc(retval, allocated);
|
||||||
|
@ -1738,7 +1738,7 @@ FMOD_RESULT OpenALSystem::update()
|
||||||
}
|
}
|
||||||
|
|
||||||
ALBRIDGE(System, set3DListenerAttributes, (int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up),
|
ALBRIDGE(System, set3DListenerAttributes, (int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up),
|
||||||
(listener, pos, vel, forward, up));
|
(listener, pos, vel, forward, up))
|
||||||
FMOD_RESULT OpenALSystem::set3DListenerAttributes(int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up)
|
FMOD_RESULT OpenALSystem::set3DListenerAttributes(int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up)
|
||||||
{
|
{
|
||||||
// ignore listener parameter; there is only one listener in OpenAL.
|
// ignore listener parameter; there is only one listener in OpenAL.
|
||||||
|
|
|
@ -56,7 +56,7 @@ void LensFlare::onUpdate(float dt)
|
||||||
|
|
||||||
Vector vbit = v;
|
Vector vbit = v;
|
||||||
vbit *= inc;
|
vbit *= inc;
|
||||||
for (int i = 0; i < flares.size(); i++)
|
for (size_t i = 0; i < flares.size(); i++)
|
||||||
{
|
{
|
||||||
flares[i]->position = vbit*i;
|
flares[i]->position = vbit*i;
|
||||||
flares[i]->alpha = a;
|
flares[i]->alpha = a;
|
||||||
|
|
|
@ -58,5 +58,5 @@ namespace MathFunctions
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ void forEachFile(const std::string& inpath, std::string type, void callback(cons
|
||||||
dirent *file=0;
|
dirent *file=0;
|
||||||
while ( (file=readdir(dir)) != NULL )
|
while ( (file=readdir(dir)) != NULL )
|
||||||
{
|
{
|
||||||
if (file->d_name && strlen(file->d_name) > 4)
|
if (strlen(file->d_name) > 4)
|
||||||
{
|
{
|
||||||
debugLog(file->d_name);
|
debugLog(file->d_name);
|
||||||
char *extension=strrchr(file->d_name,'.');
|
char *extension=strrchr(file->d_name,'.');
|
||||||
|
|
|
@ -44,10 +44,10 @@ ParticleManager::ParticleManager(int size)
|
||||||
setSize(size);
|
setSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleManager::setSize(int size)
|
void ParticleManager::setSize(size_t size)
|
||||||
{
|
{
|
||||||
// dangerous!
|
// dangerous!
|
||||||
for (int i = 0; i < particles.size(); i++)
|
for (size_t i = 0; i < particles.size(); i++)
|
||||||
{
|
{
|
||||||
Particle *p = &particles[i];
|
Particle *p = &particles[i];
|
||||||
if (p->emitter)
|
if (p->emitter)
|
||||||
|
@ -71,15 +71,15 @@ void ParticleManager::setNumSuckPositions(int num)
|
||||||
suckPositions.resize(num);
|
suckPositions.resize(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleManager::setSuckPosition(int idx, const Vector &pos)
|
void ParticleManager::setSuckPosition(size_t idx, const Vector &pos)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= suckPositions.size()) return;
|
if (idx >= suckPositions.size()) return;
|
||||||
suckPositions[idx] = pos;
|
suckPositions[idx] = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector *ParticleManager::getSuckPosition(int idx)
|
Vector *ParticleManager::getSuckPosition(size_t idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= suckPositions.size()) return 0;
|
if (idx >= suckPositions.size()) return 0;
|
||||||
return &suckPositions[idx];
|
return &suckPositions[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,12 +207,14 @@ void ParticleManager::nextFree(int jump)
|
||||||
|
|
||||||
void ParticleManager::prevFree(int jump)
|
void ParticleManager::prevFree(int jump)
|
||||||
{
|
{
|
||||||
free -= jump;
|
if(free < jump) {
|
||||||
if (free < 0)
|
free = free + size - jump;
|
||||||
free += size;
|
} else {
|
||||||
|
free -= jump;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleManager::setFree(int free)
|
void ParticleManager::setFree(size_t free)
|
||||||
{
|
{
|
||||||
if (free != -1)
|
if (free != -1)
|
||||||
{
|
{
|
||||||
|
@ -363,7 +365,7 @@ void ParticleManager::update(float dt)
|
||||||
{
|
{
|
||||||
BBGE_PROF(ParticleManager_update);
|
BBGE_PROF(ParticleManager_update);
|
||||||
numActive = 0;
|
numActive = 0;
|
||||||
for (int i = 0; i < particles.size(); i++)
|
for (size_t i = 0; i < particles.size(); i++)
|
||||||
{
|
{
|
||||||
if (particles[i].active)
|
if (particles[i].active)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,7 +198,7 @@ class ParticleManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ParticleManager(int size);
|
ParticleManager(int size);
|
||||||
void setSize(int size);
|
void setSize(size_t size);
|
||||||
void loadParticleBank(const std::string &bank1, const std::string &bank2);
|
void loadParticleBank(const std::string &bank1, const std::string &bank2);
|
||||||
void clearParticleBank();
|
void clearParticleBank();
|
||||||
|
|
||||||
|
@ -217,15 +217,15 @@ public:
|
||||||
|
|
||||||
void endParticle(Particle *p);
|
void endParticle(Particle *p);
|
||||||
|
|
||||||
void setFree(int free);
|
void setFree(size_t free);
|
||||||
|
|
||||||
int getFree() { return free; }
|
int getFree() { return free; }
|
||||||
int getNumActive() { return numActive; }
|
int getNumActive() { return numActive; }
|
||||||
|
|
||||||
void setNumSuckPositions(int num);
|
void setNumSuckPositions(int num);
|
||||||
void setSuckPosition(int idx, const Vector &pos);
|
void setSuckPosition(size_t idx, const Vector &pos);
|
||||||
|
|
||||||
Vector *getSuckPosition(int idx);
|
Vector *getSuckPosition(size_t idx);
|
||||||
|
|
||||||
static std::string particleBankPath;
|
static std::string particleBankPath;
|
||||||
|
|
||||||
|
@ -234,18 +234,18 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
std::vector<Vector> suckPositions;
|
std::vector<Vector> suckPositions;
|
||||||
int numActive;
|
size_t numActive;
|
||||||
Particle* stomp();
|
Particle* stomp();
|
||||||
|
|
||||||
void nextFree(int f=1);
|
void nextFree(int f=1);
|
||||||
void prevFree(int f=1);
|
void prevFree(int f=1);
|
||||||
|
|
||||||
int oldFree;
|
size_t oldFree;
|
||||||
|
|
||||||
typedef std::vector<ParticleInfluence> Influences;
|
typedef std::vector<ParticleInfluence> Influences;
|
||||||
Influences influences;
|
Influences influences;
|
||||||
|
|
||||||
int size, used, free, halfSize;
|
size_t size, used, free, halfSize;
|
||||||
Particles particles;
|
Particles particles;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,10 @@ void Precacher::loadTextureRange(const std::string &file, const std::string &typ
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << file;
|
os << file;
|
||||||
|
|
||||||
for (int j = 0; j < 4 - num_os.str().size(); j++)
|
if(num_os.str().size() <= 4) {
|
||||||
{
|
for (size_t j = 0; j < 4 - num_os.str().size(); j++) {
|
||||||
os << "0";
|
os << "0";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
os << t;
|
os << t;
|
||||||
|
|
|
@ -74,7 +74,7 @@ void Quad::createStrip(bool vert, int num)
|
||||||
void Quad::setStrip(const std::vector<Vector> &st)
|
void Quad::setStrip(const std::vector<Vector> &st)
|
||||||
{
|
{
|
||||||
resetStrip();
|
resetStrip();
|
||||||
for (int i = 0; i < st.size(); i++)
|
for (size_t i = 0; i < st.size(); i++)
|
||||||
{
|
{
|
||||||
if (i < strip.size())
|
if (i < strip.size())
|
||||||
{
|
{
|
||||||
|
@ -92,10 +92,10 @@ void Quad::createGrid(int xd, int yd)
|
||||||
yDivs = yd;
|
yDivs = yd;
|
||||||
|
|
||||||
drawGrid = new Vector * [xDivs];
|
drawGrid = new Vector * [xDivs];
|
||||||
for (int i = 0; i < xDivs; i++)
|
for (size_t i = 0; i < xDivs; i++)
|
||||||
{
|
{
|
||||||
drawGrid[i] = new Vector [yDivs];
|
drawGrid[i] = new Vector [yDivs];
|
||||||
for (int j = 0; j < yDivs; j++)
|
for (size_t j = 0; j < yDivs; j++)
|
||||||
{
|
{
|
||||||
drawGrid[i][j].z = 1;
|
drawGrid[i][j].z = 1;
|
||||||
}
|
}
|
||||||
|
@ -104,9 +104,9 @@ void Quad::createGrid(int xd, int yd)
|
||||||
resetGrid();
|
resetGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Quad::setDrawGridAlpha(int x, int y, float alpha)
|
void Quad::setDrawGridAlpha(size_t x, size_t y, float alpha)
|
||||||
{
|
{
|
||||||
if (x < xDivs && x >= 0 && y < yDivs && y >= 0)
|
if (x < xDivs && y < yDivs)
|
||||||
{
|
{
|
||||||
drawGrid[x][y].z = alpha;
|
drawGrid[x][y].z = alpha;
|
||||||
}
|
}
|
||||||
|
@ -116,13 +116,13 @@ void Quad::setGridPoints(bool vert, const std::vector<Vector> &points)
|
||||||
{
|
{
|
||||||
if (!drawGrid) return;
|
if (!drawGrid) return;
|
||||||
resetGrid();
|
resetGrid();
|
||||||
for (int i = 0; i < points.size(); i++)
|
for (size_t i = 0; i < points.size(); i++)
|
||||||
{
|
{
|
||||||
if (!vert) // horz
|
if (!vert) // horz
|
||||||
{
|
{
|
||||||
for (int y = 0; y < yDivs; y++)
|
for (size_t y = 0; y < yDivs; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < xDivs; x++)
|
for (size_t x = 0; x < xDivs; x++)
|
||||||
{
|
{
|
||||||
if (x < points.size())
|
if (x < points.size())
|
||||||
{
|
{
|
||||||
|
@ -133,9 +133,9 @@ void Quad::setGridPoints(bool vert, const std::vector<Vector> &points)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int x = 0; x < xDivs; x++)
|
for (size_t x = 0; x < xDivs; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < yDivs; y++)
|
for (size_t y = 0; y < yDivs; y++)
|
||||||
{
|
{
|
||||||
if (y < points.size())
|
if (y < points.size())
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ void Quad::resetStrip()
|
||||||
{
|
{
|
||||||
if (!stripVert)
|
if (!stripVert)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < strip.size(); i++)
|
for (size_t i = 0; i < strip.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
float v = (i/(float(strip.size())));
|
float v = (i/(float(strip.size())));
|
||||||
|
@ -172,9 +172,9 @@ void Quad::resetStrip()
|
||||||
|
|
||||||
void Quad::resetGrid()
|
void Quad::resetGrid()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < xDivs; i++)
|
for (size_t i = 0; i < xDivs; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < yDivs; j++)
|
for (size_t j = 0; j < yDivs; j++)
|
||||||
{
|
{
|
||||||
drawGrid[i][j].x = i/(float)(xDivs-1)-0.5f;
|
drawGrid[i][j].x = i/(float)(xDivs-1)-0.5f;
|
||||||
drawGrid[i][j].y = j/(float)(yDivs-1)-0.5f;
|
drawGrid[i][j].y = j/(float)(yDivs-1)-0.5f;
|
||||||
|
@ -226,7 +226,7 @@ void Quad::deleteGrid()
|
||||||
{
|
{
|
||||||
if (drawGrid)
|
if (drawGrid)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < xDivs; i++)
|
for (size_t i = 0; i < xDivs; i++)
|
||||||
{
|
{
|
||||||
delete[] drawGrid[i];
|
delete[] drawGrid[i];
|
||||||
}
|
}
|
||||||
|
@ -308,14 +308,14 @@ void Quad::updateGrid(float dt)
|
||||||
{
|
{
|
||||||
gridTimer += dt * drawGridTimeMultiplier;
|
gridTimer += dt * drawGridTimeMultiplier;
|
||||||
resetGrid();
|
resetGrid();
|
||||||
int hx = xDivs/2;
|
size_t hx = xDivs/2;
|
||||||
for (int x = 0; x < xDivs; x++)
|
for (size_t x = 0; x < xDivs; x++)
|
||||||
{
|
{
|
||||||
float yoffset = x * drawGridOffsetY;
|
float yoffset = x * drawGridOffsetY;
|
||||||
float addY = 0;
|
float addY = 0;
|
||||||
if (drawGridModY != 0)
|
if (drawGridModY != 0)
|
||||||
addY = cosf(gridTimer+yoffset)*drawGridModY;
|
addY = cosf(gridTimer+yoffset)*drawGridModY;
|
||||||
for (int y = 0; y < yDivs; y++)
|
for (size_t y = 0; y < yDivs; y++)
|
||||||
{
|
{
|
||||||
float xoffset = y * drawGridOffsetX;
|
float xoffset = y * drawGridOffsetX;
|
||||||
if (drawGridModX != 0)
|
if (drawGridModX != 0)
|
||||||
|
@ -366,11 +366,11 @@ void Quad::renderGrid()
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
float u0 = baseX;
|
float u0 = baseX;
|
||||||
float u1 = u0 + incX;
|
float u1 = u0 + incX;
|
||||||
for (int i = 0; i < (xDivs-1); i++, u0 = u1, u1 += incX)
|
for (size_t i = 0; i < (xDivs-1); i++, u0 = u1, u1 += incX)
|
||||||
{
|
{
|
||||||
float v0 = 1 - percentY + baseY;
|
float v0 = 1 - percentY + baseY;
|
||||||
float v1 = v0 + incY;
|
float v1 = v0 + incY;
|
||||||
for (int j = 0; j < (yDivs-1); j++, v0 = v1, v1 += incY)
|
for (size_t j = 0; j < (yDivs-1); j++, v0 = v1, v1 += incY)
|
||||||
{
|
{
|
||||||
if (drawGrid[i][j].z != 0 || drawGrid[i][j+1].z != 0 || drawGrid[i+1][j].z != 0 || drawGrid[i+1][j+1].z != 0)
|
if (drawGrid[i][j].z != 0 || drawGrid[i][j+1].z != 0 || drawGrid[i+1][j].z != 0 || drawGrid[i+1][j+1].z != 0)
|
||||||
{
|
{
|
||||||
|
@ -410,9 +410,10 @@ void Quad::renderGrid()
|
||||||
glPointSize(2);
|
glPointSize(2);
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
for (int i = 0; i < (xDivs-1); i++)
|
if(xDivs > 0 && yDivs > 0)
|
||||||
|
for (size_t i = 0; i < (xDivs-1); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < (yDivs-1); j++)
|
for (size_t j = 0; j < (yDivs-1); j++)
|
||||||
{
|
{
|
||||||
glVertex2f(w*drawGrid[i][j].x, h*drawGrid[i][j].y);
|
glVertex2f(w*drawGrid[i][j].x, h*drawGrid[i][j].y);
|
||||||
glVertex2f(w*drawGrid[i][j+1].x, h*drawGrid[i][j+1].y);
|
glVertex2f(w*drawGrid[i][j+1].x, h*drawGrid[i][j+1].y);
|
||||||
|
@ -453,7 +454,7 @@ void Quad::onRender()
|
||||||
|
|
||||||
if (!stripVert)
|
if (!stripVert)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < strip.size(); i++)
|
for (size_t i = 0; i < strip.size(); i++)
|
||||||
{
|
{
|
||||||
glTexCoord2f(texBits*i, 0);
|
glTexCoord2f(texBits*i, 0);
|
||||||
glVertex2f(strip[i].x*width-_w2, strip[i].y*_h2*10 - _h2);
|
glVertex2f(strip[i].x*width-_w2, strip[i].y*_h2*10 - _h2);
|
||||||
|
@ -469,7 +470,7 @@ void Quad::onRender()
|
||||||
glPointSize(64);
|
glPointSize(64);
|
||||||
|
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
for (int i = 0; i < strip.size(); i++)
|
for (size_t i = 0; i < strip.size(); i++)
|
||||||
{
|
{
|
||||||
glVertex2f((strip[i].x*width)-_w2, strip[i].y*height);
|
glVertex2f((strip[i].x*width)-_w2, strip[i].y*height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
int getHeight() const {return int(height);}
|
int getHeight() const {return int(height);}
|
||||||
|
|
||||||
void setSegs(int x, int y, float dgox, float dgoy, float dgmx, float dgmy, float dgtm, bool dgo);
|
void setSegs(int x, int y, float dgox, float dgoy, float dgmx, float dgmy, float dgtm, bool dgo);
|
||||||
void setDrawGridAlpha(int x, int y, float alpha);
|
void setDrawGridAlpha(size_t x, size_t y, float alpha);
|
||||||
void repeatTextureToFill(bool on);
|
void repeatTextureToFill(bool on);
|
||||||
void refreshRepeatTextureToFill();
|
void refreshRepeatTextureToFill();
|
||||||
bool isRepeatingTextureToFill() const { return repeatingTextureToFill; }
|
bool isRepeatingTextureToFill() const { return repeatingTextureToFill; }
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool repeatingTextureToFill;
|
bool repeatingTextureToFill;
|
||||||
float gridTimer;
|
float gridTimer;
|
||||||
int xDivs, yDivs;
|
size_t xDivs, yDivs;
|
||||||
Vector ** drawGrid;
|
Vector ** drawGrid;
|
||||||
|
|
||||||
void resetGrid();
|
void resetGrid();
|
||||||
|
|
|
@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool RenderObject::renderCollisionShape = false;
|
bool RenderObject::renderCollisionShape = false;
|
||||||
int RenderObject::lastTextureApplied = 0;
|
size_t RenderObject::lastTextureApplied = 0;
|
||||||
bool RenderObject::lastTextureRepeat = false;
|
bool RenderObject::lastTextureRepeat = false;
|
||||||
bool RenderObject::renderPaths = false;
|
bool RenderObject::renderPaths = false;
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ void RenderObject::enableMotionBlur(int sz, int off)
|
||||||
motionBlurPositions.resize(sz);
|
motionBlurPositions.resize(sz);
|
||||||
motionBlurFrameOffsetCounter = 0;
|
motionBlurFrameOffsetCounter = 0;
|
||||||
motionBlurFrameOffset = off;
|
motionBlurFrameOffset = off;
|
||||||
for (int i = 0; i < motionBlurPositions.size(); i++)
|
for (size_t i = 0; i < motionBlurPositions.size(); i++)
|
||||||
{
|
{
|
||||||
motionBlurPositions[i].position = position;
|
motionBlurPositions[i].position = position;
|
||||||
motionBlurPositions[i].rotz = rotation.z;
|
motionBlurPositions[i].rotz = rotation.z;
|
||||||
|
@ -561,7 +561,7 @@ void RenderObject::render()
|
||||||
Vector oldPos = position;
|
Vector oldPos = position;
|
||||||
float oldAlpha = alpha.x;
|
float oldAlpha = alpha.x;
|
||||||
float oldRotZ = rotation.z;
|
float oldRotZ = rotation.z;
|
||||||
for (int i = 0; i < motionBlurPositions.size(); i++)
|
for (size_t i = 0; i < motionBlurPositions.size(); i++)
|
||||||
{
|
{
|
||||||
position = motionBlurPositions[i].position;
|
position = motionBlurPositions[i].position;
|
||||||
rotation.z = motionBlurPositions[i].rotz;
|
rotation.z = motionBlurPositions[i].rotz;
|
||||||
|
@ -650,7 +650,7 @@ void RenderObject::renderCall()
|
||||||
glLineWidth(4);
|
glLineWidth(4);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ void RenderObject::renderCollision()
|
||||||
|
|
||||||
glColor4f(1,1,0,0.5);
|
glColor4f(1,1,0,0.5);
|
||||||
|
|
||||||
for (int i = 0; i < transformedCollisionMask.size(); i++)
|
for (size_t i = 0; i < transformedCollisionMask.size(); i++)
|
||||||
{
|
{
|
||||||
Vector collide = this->transformedCollisionMask[i];
|
Vector collide = this->transformedCollisionMask[i];
|
||||||
|
|
||||||
|
@ -840,11 +840,11 @@ void RenderObject::deathNotify(RenderObject *r)
|
||||||
deathNotifications.remove(r);
|
deathNotifications.remove(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getCollisionMaskNormal(int index)
|
Vector RenderObject::getCollisionMaskNormal(size_t index)
|
||||||
{
|
{
|
||||||
Vector sum;
|
Vector sum;
|
||||||
int num=0;
|
size_t num=0;
|
||||||
for (int i = 0; i < this->transformedCollisionMask.size(); i++)
|
for (size_t i = 0; i < this->transformedCollisionMask.size(); i++)
|
||||||
{
|
{
|
||||||
if (i != index)
|
if (i != index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -135,8 +135,8 @@ public:
|
||||||
bool isfhr();
|
bool isfhr();
|
||||||
bool isfvr();
|
bool isfvr();
|
||||||
|
|
||||||
int getIdx() const { return idx; }
|
size_t getIdx() const { return idx; }
|
||||||
void setIdx(int idx) { this->idx = idx; }
|
void setIdx(size_t idx) { this->idx = idx; }
|
||||||
void moveToFront();
|
void moveToFront();
|
||||||
void moveToBack();
|
void moveToBack();
|
||||||
|
|
||||||
|
@ -217,13 +217,13 @@ public:
|
||||||
virtual void unloadDevice();
|
virtual void unloadDevice();
|
||||||
virtual void reloadDevice();
|
virtual void reloadDevice();
|
||||||
|
|
||||||
Vector getCollisionMaskNormal(int index);
|
Vector getCollisionMaskNormal(size_t index);
|
||||||
|
|
||||||
//-------------------------------- Methods above, fields below
|
//-------------------------------- Methods above, fields below
|
||||||
|
|
||||||
static bool renderCollisionShape;
|
static bool renderCollisionShape;
|
||||||
static bool renderPaths;
|
static bool renderPaths;
|
||||||
static int lastTextureApplied;
|
static size_t lastTextureApplied;
|
||||||
static bool lastTextureRepeat;
|
static bool lastTextureRepeat;
|
||||||
|
|
||||||
float width, height; // Only used by Quads, but stored here for getCullRadius()
|
float width, height; // Only used by Quads, but stored here for getCullRadius()
|
||||||
|
@ -331,7 +331,7 @@ protected:
|
||||||
bool _static;
|
bool _static;
|
||||||
bool _fv, _fh;
|
bool _fv, _fh;
|
||||||
|
|
||||||
int idx;
|
size_t idx;
|
||||||
RenderObject *parent;
|
RenderObject *parent;
|
||||||
StateData *stateData;
|
StateData *stateData;
|
||||||
float decayRate;
|
float decayRate;
|
||||||
|
|
|
@ -63,7 +63,7 @@ void RenderObjectLayer::setOptimizeStatic(bool opt)
|
||||||
|
|
||||||
void RenderObjectLayer::add(RenderObject* r)
|
void RenderObjectLayer::add(RenderObject* r)
|
||||||
{
|
{
|
||||||
int size = renderObjects.size();
|
size_t size = renderObjects.size();
|
||||||
if (firstFreeIdx >= size)
|
if (firstFreeIdx >= size)
|
||||||
{
|
{
|
||||||
size += size/2; // Increase size by 50% each time we fill up.
|
size += size/2; // Increase size by 50% each time we fill up.
|
||||||
|
@ -85,8 +85,8 @@ void RenderObjectLayer::add(RenderObject* r)
|
||||||
|
|
||||||
void RenderObjectLayer::remove(RenderObject* r)
|
void RenderObjectLayer::remove(RenderObject* r)
|
||||||
{
|
{
|
||||||
const int idx = r->getIdx();
|
const size_t idx = r->getIdx();
|
||||||
if (idx < 0 || idx >= renderObjects.size())
|
if (idx >= renderObjects.size())
|
||||||
{
|
{
|
||||||
errorLog("Trying to remove RenderObject with invalid index");
|
errorLog("Trying to remove RenderObject with invalid index");
|
||||||
return;
|
return;
|
||||||
|
@ -107,9 +107,9 @@ void RenderObjectLayer::remove(RenderObject* r)
|
||||||
|
|
||||||
void RenderObjectLayer::moveToFront(RenderObject *r)
|
void RenderObjectLayer::moveToFront(RenderObject *r)
|
||||||
{
|
{
|
||||||
const int size = renderObjects.size();
|
const size_t size = renderObjects.size();
|
||||||
const int curIdx = r->getIdx();
|
const size_t curIdx = r->getIdx();
|
||||||
int lastUsed;
|
size_t lastUsed;
|
||||||
for (lastUsed = size-1; lastUsed > curIdx; lastUsed--)
|
for (lastUsed = size-1; lastUsed > curIdx; lastUsed--)
|
||||||
{
|
{
|
||||||
if (renderObjects[lastUsed])
|
if (renderObjects[lastUsed])
|
||||||
|
@ -122,7 +122,7 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
||||||
}
|
}
|
||||||
else if (lastUsed < size-1)
|
else if (lastUsed < size-1)
|
||||||
{
|
{
|
||||||
const int newIdx = lastUsed + 1;
|
const size_t newIdx = lastUsed + 1;
|
||||||
renderObjects[curIdx] = 0;
|
renderObjects[curIdx] = 0;
|
||||||
renderObjects[newIdx] = r;
|
renderObjects[newIdx] = r;
|
||||||
r->setIdx(newIdx);
|
r->setIdx(newIdx);
|
||||||
|
@ -132,12 +132,12 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
||||||
else if (objectCount == size)
|
else if (objectCount == size)
|
||||||
{
|
{
|
||||||
// Expand the array so future calls have a bit of breathing room.
|
// Expand the array so future calls have a bit of breathing room.
|
||||||
const int newSize = size + 10;
|
const size_t newSize = size + 10;
|
||||||
renderObjects.resize(newSize);
|
renderObjects.resize(newSize);
|
||||||
renderObjects[curIdx] = 0;
|
renderObjects[curIdx] = 0;
|
||||||
renderObjects[size] = r;
|
renderObjects[size] = r;
|
||||||
r->setIdx(size);
|
r->setIdx(size);
|
||||||
for (int i = size+1; i < newSize; i++)
|
for (size_t i = size+1; i < newSize; i++)
|
||||||
renderObjects[i] = 0;
|
renderObjects[i] = 0;
|
||||||
if (firstFreeIdx > curIdx)
|
if (firstFreeIdx > curIdx)
|
||||||
firstFreeIdx = curIdx;
|
firstFreeIdx = curIdx;
|
||||||
|
@ -146,13 +146,13 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
||||||
{
|
{
|
||||||
// Need to shift elements downward to make room for the new one.
|
// Need to shift elements downward to make room for the new one.
|
||||||
renderObjects[curIdx] = 0;
|
renderObjects[curIdx] = 0;
|
||||||
int lastFree;
|
size_t lastFree;
|
||||||
for (lastFree = lastUsed-1; lastFree > curIdx; lastFree--)
|
for (lastFree = lastUsed-1; lastFree > curIdx; lastFree--)
|
||||||
{
|
{
|
||||||
if (!renderObjects[lastFree])
|
if (!renderObjects[lastFree])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (int i = lastFree + 1; i <= lastUsed; i++)
|
for (size_t i = lastFree + 1; i <= lastUsed; i++)
|
||||||
{
|
{
|
||||||
renderObjects[i-1] = renderObjects[i];
|
renderObjects[i-1] = renderObjects[i];
|
||||||
renderObjects[i-1]->setIdx(i-1); // Known to be non-NULL.
|
renderObjects[i-1]->setIdx(i-1); // Known to be non-NULL.
|
||||||
|
@ -170,9 +170,9 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
||||||
|
|
||||||
void RenderObjectLayer::moveToBack(RenderObject *r)
|
void RenderObjectLayer::moveToBack(RenderObject *r)
|
||||||
{
|
{
|
||||||
const int size = renderObjects.size();
|
const size_t size = renderObjects.size();
|
||||||
const int curIdx = r->getIdx();
|
const size_t curIdx = r->getIdx();
|
||||||
int firstUsed;
|
size_t firstUsed;
|
||||||
for (firstUsed = 0; firstUsed < curIdx; firstUsed++)
|
for (firstUsed = 0; firstUsed < curIdx; firstUsed++)
|
||||||
{
|
{
|
||||||
if (renderObjects[firstUsed])
|
if (renderObjects[firstUsed])
|
||||||
|
@ -196,19 +196,19 @@ void RenderObjectLayer::moveToBack(RenderObject *r)
|
||||||
}
|
}
|
||||||
else if (objectCount == size)
|
else if (objectCount == size)
|
||||||
{
|
{
|
||||||
const int newSize = size + 10;
|
const size_t newSize = size + 10;
|
||||||
const int sizeDiff = newSize - size;
|
const size_t sizeDiff = newSize - size;
|
||||||
const int newIdx = sizeDiff - 1;
|
const size_t newIdx = sizeDiff - 1;
|
||||||
|
|
||||||
renderObjects.resize(newSize);
|
renderObjects.resize(newSize);
|
||||||
renderObjects[curIdx] = 0;
|
renderObjects[curIdx] = 0;
|
||||||
for (int i = newSize - 1; i >= sizeDiff; i--)
|
for (size_t i = newSize - 1; i >= sizeDiff; i--)
|
||||||
{
|
{
|
||||||
renderObjects[i] = renderObjects[i - sizeDiff];
|
renderObjects[i] = renderObjects[i - sizeDiff];
|
||||||
if(renderObjects[i])
|
if(renderObjects[i])
|
||||||
renderObjects[i]->setIdx(i);
|
renderObjects[i]->setIdx(i);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < newIdx; i++)
|
for (size_t i = 0; i < newIdx; i++)
|
||||||
renderObjects[i] = 0;
|
renderObjects[i] = 0;
|
||||||
renderObjects[newIdx] = r;
|
renderObjects[newIdx] = r;
|
||||||
r->setIdx(newIdx);
|
r->setIdx(newIdx);
|
||||||
|
|
|
@ -327,9 +327,9 @@ bool Shader::Uniform::operator< (const Uniform& b) const
|
||||||
|
|
||||||
void Shader::_queryUniforms()
|
void Shader::_queryUniforms()
|
||||||
{
|
{
|
||||||
glGetObjectParameterivARB(g_programObj, GL_OBJECT_ACTIVE_UNIFORMS_ARB , &numUniforms);
|
glGetObjectParameterivARB(g_programObj, GL_OBJECT_ACTIVE_UNIFORMS_ARB , (GLint*)&numUniforms);
|
||||||
|
|
||||||
if (numUniforms <= 0)
|
if (numUniforms == 0 || numUniforms == -1)
|
||||||
{
|
{
|
||||||
uniforms.clear();
|
uniforms.clear();
|
||||||
return;
|
return;
|
||||||
|
@ -385,7 +385,7 @@ int Shader::_getUniformIndex(const char *name)
|
||||||
void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, int w /* = 0 */)
|
void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, int w /* = 0 */)
|
||||||
{
|
{
|
||||||
#if BBGE_BUILD_SHADERS
|
#if BBGE_BUILD_SHADERS
|
||||||
if(!g_programObj || numUniforms <= 0)
|
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
|
||||||
return;
|
return;
|
||||||
int idx = _getUniformIndex(name);
|
int idx = _getUniformIndex(name);
|
||||||
if(unsigned(idx) >= uniforms.size())
|
if(unsigned(idx) >= uniforms.size())
|
||||||
|
@ -403,7 +403,7 @@ void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, i
|
||||||
void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = 0 */, float w /* = 0 */)
|
void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = 0 */, float w /* = 0 */)
|
||||||
{
|
{
|
||||||
#if BBGE_BUILD_SHADERS
|
#if BBGE_BUILD_SHADERS
|
||||||
if(!g_programObj || numUniforms <= 0)
|
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
|
||||||
return;
|
return;
|
||||||
int idx = _getUniformIndex(name);
|
int idx = _getUniformIndex(name);
|
||||||
if(unsigned(idx) >= uniforms.size())
|
if(unsigned(idx) >= uniforms.size())
|
||||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
||||||
std::string vertFile, fragFile;
|
std::string vertFile, fragFile;
|
||||||
std::string vertSrc, fragSrc;
|
std::string vertSrc, fragSrc;
|
||||||
unsigned g_programObj;
|
unsigned g_programObj;
|
||||||
int numUniforms;
|
unsigned numUniforms;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void staticInit();
|
static void staticInit();
|
||||||
|
@ -58,7 +58,7 @@ private:
|
||||||
struct Uniform
|
struct Uniform
|
||||||
{
|
{
|
||||||
int location; // GL location variable
|
int location; // GL location variable
|
||||||
int type;
|
size_t type;
|
||||||
bool dirty; // need to flush if true
|
bool dirty; // need to flush if true
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,7 @@ void Bone::destroy()
|
||||||
{
|
{
|
||||||
Quad::destroy();
|
Quad::destroy();
|
||||||
|
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
segments[i]->setLife(1.0);
|
segments[i]->setLife(1.0);
|
||||||
segments[i]->setDecayRate(10);
|
segments[i]->setDecayRate(10);
|
||||||
|
@ -246,7 +246,7 @@ void Bone::updateSegments()
|
||||||
|
|
||||||
if (!reverse)
|
if (!reverse)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < segments.size(); i++)
|
for (size_t i = 0; i < segments.size(); i++)
|
||||||
{
|
{
|
||||||
Vector diff;
|
Vector diff;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
@ -416,7 +416,7 @@ void AnimationLayer::animate(const std::string &a, int loop)
|
||||||
stringToLower(animation);
|
stringToLower(animation);
|
||||||
|
|
||||||
bool played = false;
|
bool played = false;
|
||||||
for (int i = 0; i < s->animations.size(); i++)
|
for (size_t i = 0; i < s->animations.size(); i++)
|
||||||
{
|
{
|
||||||
if (s->animations[i].name == animation)
|
if (s->animations[i].name == animation)
|
||||||
{
|
{
|
||||||
|
@ -494,7 +494,7 @@ Animation* AnimationLayer::getCurrentAnimation()
|
||||||
{
|
{
|
||||||
if (currentAnimation == -1)
|
if (currentAnimation == -1)
|
||||||
return &blendAnimation;
|
return &blendAnimation;
|
||||||
if (currentAnimation < 0 || currentAnimation >= s->animations.size())
|
if (currentAnimation >= s->animations.size())
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "skel: " << s->filenameLoaded << " currentAnimation: " << currentAnimation << " is out of range\n error in anim file?";
|
os << "skel: " << s->filenameLoaded << " currentAnimation: " << currentAnimation << " is out of range\n error in anim file?";
|
||||||
|
@ -512,7 +512,7 @@ bool AnimationLayer::createTransitionAnimation(const std::string& anim, float ti
|
||||||
blendAnimation.keyframes.clear();
|
blendAnimation.keyframes.clear();
|
||||||
SkeletalKeyframe k;
|
SkeletalKeyframe k;
|
||||||
k.t = 0;
|
k.t = 0;
|
||||||
for (int i = 0; i < s->bones.size(); i++)
|
for (size_t i = 0; i < s->bones.size(); i++)
|
||||||
{
|
{
|
||||||
BoneKeyframe b;
|
BoneKeyframe b;
|
||||||
b.idx = s->bones[i]->boneIdx;
|
b.idx = s->bones[i]->boneIdx;
|
||||||
|
@ -566,14 +566,14 @@ Animation::Animation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int Animation::getNumKeyframes()
|
size_t Animation::getNumKeyframes()
|
||||||
{
|
{
|
||||||
return keyframes.size();
|
return keyframes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletalKeyframe *Animation::getKeyframe(int key)
|
SkeletalKeyframe *Animation::getKeyframe(size_t key)
|
||||||
{
|
{
|
||||||
if (key < 0 || key >= keyframes.size()) return 0;
|
if (key >= keyframes.size()) return 0;
|
||||||
return &keyframes[key];
|
return &keyframes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,9 +613,9 @@ SkeletalKeyframe *Animation::getFirstKeyframe()
|
||||||
void Animation::reorderKeyframes()
|
void Animation::reorderKeyframes()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < keyframes.size(); i++)
|
for (size_t i = 0; i < keyframes.size(); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < keyframes.size()-1; j++)
|
for (size_t j = 0; j < keyframes.size()-1; j++)
|
||||||
{
|
{
|
||||||
if (keyframes[j].t > keyframes[j+1].t)
|
if (keyframes[j].t > keyframes[j+1].t)
|
||||||
{
|
{
|
||||||
|
@ -627,11 +627,11 @@ void Animation::reorderKeyframes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::cloneKey(int key, float toffset)
|
void Animation::cloneKey(size_t key, float toffset)
|
||||||
{
|
{
|
||||||
std::vector<SkeletalKeyframe> copy = this->keyframes;
|
std::vector<SkeletalKeyframe> copy = this->keyframes;
|
||||||
keyframes.clear();
|
keyframes.clear();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i <= key; i++)
|
for (i = 0; i <= key; i++)
|
||||||
keyframes.push_back(copy[i]);
|
keyframes.push_back(copy[i]);
|
||||||
for (i = key; i < copy.size(); i++)
|
for (i = key; i < copy.size(); i++)
|
||||||
|
@ -639,20 +639,20 @@ void Animation::cloneKey(int key, float toffset)
|
||||||
keyframes[key+1].t += toffset;
|
keyframes[key+1].t += toffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::deleteKey(int key)
|
void Animation::deleteKey(size_t key)
|
||||||
{
|
{
|
||||||
std::vector<SkeletalKeyframe> copy = this->keyframes;
|
std::vector<SkeletalKeyframe> copy = this->keyframes;
|
||||||
keyframes.clear();
|
keyframes.clear();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < key; i++)
|
for (i = 0; i < key; i++)
|
||||||
keyframes.push_back(copy[i]);
|
keyframes.push_back(copy[i]);
|
||||||
for (i = key+1; i < copy.size(); i++)
|
for (i = key+1; i < copy.size(); i++)
|
||||||
keyframes.push_back(copy[i]);
|
keyframes.push_back(copy[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Animation::getSkeletalKeyframeIndex(SkeletalKeyframe *skey)
|
size_t Animation::getSkeletalKeyframeIndex(SkeletalKeyframe *skey)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < keyframes.size(); i++)
|
for (size_t i = 0; i < keyframes.size(); i++)
|
||||||
{
|
{
|
||||||
if (&keyframes[i] == skey)
|
if (&keyframes[i] == skey)
|
||||||
return i;
|
return i;
|
||||||
|
@ -660,9 +660,9 @@ int Animation::getSkeletalKeyframeIndex(SkeletalKeyframe *skey)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoneKeyframe *SkeletalKeyframe::getBoneKeyframe(int idx)
|
BoneKeyframe *SkeletalKeyframe::getBoneKeyframe(size_t idx)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < keyframes.size(); i++)
|
for (size_t i = 0; i < keyframes.size(); i++)
|
||||||
{
|
{
|
||||||
if (keyframes[i].idx == idx)
|
if (keyframes[i].idx == idx)
|
||||||
{
|
{
|
||||||
|
@ -674,8 +674,8 @@ BoneKeyframe *SkeletalKeyframe::getBoneKeyframe(int idx)
|
||||||
|
|
||||||
SkeletalKeyframe *Animation::getPrevKeyframe(float t)
|
SkeletalKeyframe *Animation::getPrevKeyframe(float t)
|
||||||
{
|
{
|
||||||
int kf = -1;
|
size_t kf = -1;
|
||||||
for (int i = keyframes.size()-1; i >= 0; i--)
|
for (size_t i = keyframes.size(); i-- > 0; )
|
||||||
{
|
{
|
||||||
if (t >= keyframes[i].t)
|
if (t >= keyframes[i].t)
|
||||||
{
|
{
|
||||||
|
@ -687,15 +687,13 @@ SkeletalKeyframe *Animation::getPrevKeyframe(float t)
|
||||||
return 0;
|
return 0;
|
||||||
if (kf >= keyframes.size())
|
if (kf >= keyframes.size())
|
||||||
kf = keyframes.size()-1;
|
kf = keyframes.size()-1;
|
||||||
if (kf < 0)
|
|
||||||
kf = 0;
|
|
||||||
return &keyframes[kf];
|
return &keyframes[kf];
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletalKeyframe *Animation::getNextKeyframe(float t)
|
SkeletalKeyframe *Animation::getNextKeyframe(float t)
|
||||||
{
|
{
|
||||||
int kf = -1;
|
size_t kf = -1;
|
||||||
for (int i = 0; i < keyframes.size(); i++)
|
for (size_t i = 0; i < keyframes.size(); i++)
|
||||||
{
|
{
|
||||||
if (t <= keyframes[i].t)
|
if (t <= keyframes[i].t)
|
||||||
{
|
{
|
||||||
|
@ -708,8 +706,6 @@ SkeletalKeyframe *Animation::getNextKeyframe(float t)
|
||||||
return 0;
|
return 0;
|
||||||
if (kf >= keyframes.size())
|
if (kf >= keyframes.size())
|
||||||
kf = keyframes.size()-1;
|
kf = keyframes.size()-1;
|
||||||
if (kf < 0)
|
|
||||||
kf = 0;
|
|
||||||
return &keyframes[kf];
|
return &keyframes[kf];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +715,7 @@ SkeletalSprite::SkeletalSprite() : RenderObject()
|
||||||
animKeyNotify = 0;
|
animKeyNotify = 0;
|
||||||
loaded = false;
|
loaded = false;
|
||||||
animLayers.resize(10);
|
animLayers.resize(10);
|
||||||
for (int i = 0; i < animLayers.size(); i++)
|
for (size_t i = 0; i < animLayers.size(); i++)
|
||||||
animLayers[i].setSkeletalSprite(this);
|
animLayers[i].setSkeletalSprite(this);
|
||||||
selectedBone = -1;
|
selectedBone = -1;
|
||||||
}
|
}
|
||||||
|
@ -747,9 +743,9 @@ float SkeletalSprite::transitionAnimate(const std::string& anim, float time, int
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationLayer* SkeletalSprite::getAnimationLayer(int l)
|
AnimationLayer* SkeletalSprite::getAnimationLayer(size_t l)
|
||||||
{
|
{
|
||||||
if (l >= 0 && l < animLayers.size())
|
if (l < animLayers.size())
|
||||||
{
|
{
|
||||||
return &animLayers[l];
|
return &animLayers[l];
|
||||||
}
|
}
|
||||||
|
@ -769,7 +765,7 @@ void SkeletalSprite::onUpdate(float dt)
|
||||||
if (frozen) return;
|
if (frozen) return;
|
||||||
RenderObject::onUpdate(dt);
|
RenderObject::onUpdate(dt);
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < bones.size(); i++)
|
for (i = 0; i < bones.size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -780,7 +776,7 @@ void SkeletalSprite::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
b->transformedCollisionMask.resize(b->collisionMask.size());
|
b->transformedCollisionMask.resize(b->collisionMask.size());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < b->collisionMask.size(); i++)
|
for (size_t i = 0; i < b->collisionMask.size(); i++)
|
||||||
{
|
{
|
||||||
b->transformedCollisionMask[i] = b->getWorldCollidePosition(b->collisionMask[i]);
|
b->transformedCollisionMask[i] = b->getWorldCollidePosition(b->collisionMask[i]);
|
||||||
}
|
}
|
||||||
|
@ -851,7 +847,7 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
file = animationPath + filename + ".xml";
|
file = animationPath + filename + ".xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
XMLDocument *xml = _retrieveSkeletalXML(file, true);
|
XMLDocument *xml = _retrieveSkeletalXML(file, true);
|
||||||
xml->Clear();
|
xml->Clear();
|
||||||
|
|
||||||
|
@ -862,7 +858,7 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
if (animLayers[i].ignoreBones.size() > 0)
|
if (animLayers[i].ignoreBones.size() > 0)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
for (int j = 0; j < animLayers[i].ignoreBones.size(); j++)
|
for (size_t j = 0; j < animLayers[i].ignoreBones.size(); j++)
|
||||||
{
|
{
|
||||||
os << animLayers[i].ignoreBones[j] << " ";
|
os << animLayers[i].ignoreBones[j] << " ";
|
||||||
}
|
}
|
||||||
|
@ -871,7 +867,7 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
if (animLayers[i].includeBones.size() > 0)
|
if (animLayers[i].includeBones.size() > 0)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
for (int j = 0; j < animLayers[i].includeBones.size(); j++)
|
for (size_t j = 0; j < animLayers[i].includeBones.size(); j++)
|
||||||
{
|
{
|
||||||
os << animLayers[i].includeBones[j] << " ";
|
os << animLayers[i].includeBones[j] << " ";
|
||||||
}
|
}
|
||||||
|
@ -891,7 +887,7 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
for (i = 0; i < this->bones.size(); i++)
|
for (i = 0; i < this->bones.size(); i++)
|
||||||
{
|
{
|
||||||
XMLElement *bone = xml->NewElement("Bone");
|
XMLElement *bone = xml->NewElement("Bone");
|
||||||
bone->SetAttribute("idx", this->bones[i]->boneIdx);
|
bone->SetAttribute("idx", (unsigned int) this->bones[i]->boneIdx);
|
||||||
bone->SetAttribute("gfx", this->bones[i]->gfx.c_str());
|
bone->SetAttribute("gfx", this->bones[i]->gfx.c_str());
|
||||||
bone->SetAttribute("pidx", this->bones[i]->pidx);
|
bone->SetAttribute("pidx", this->bones[i]->pidx);
|
||||||
bone->SetAttribute("name", this->bones[i]->name.c_str());
|
bone->SetAttribute("name", this->bones[i]->name.c_str());
|
||||||
|
@ -969,7 +965,7 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
animation->SetAttribute("name", a->name.c_str());
|
animation->SetAttribute("name", a->name.c_str());
|
||||||
if(a->resetPassOnEnd)
|
if(a->resetPassOnEnd)
|
||||||
animation->SetAttribute("resetPassOnEnd", a->resetPassOnEnd);
|
animation->SetAttribute("resetPassOnEnd", a->resetPassOnEnd);
|
||||||
for (int j = 0; j < a->keyframes.size(); j++)
|
for (size_t j = 0; j < a->keyframes.size(); j++)
|
||||||
{
|
{
|
||||||
XMLElement *key = xml->NewElement("Key");
|
XMLElement *key = xml->NewElement("Key");
|
||||||
if (!a->keyframes[j].sound.empty())
|
if (!a->keyframes[j].sound.empty())
|
||||||
|
@ -985,12 +981,12 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << a->keyframes[j].t << " ";
|
os << a->keyframes[j].t << " ";
|
||||||
std::ostringstream szos;
|
std::ostringstream szos;
|
||||||
for (int k = 0; k < a->keyframes[j].keyframes.size(); k++)
|
for (size_t k = 0; k < a->keyframes[j].keyframes.size(); k++)
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = &a->keyframes[j].keyframes[k];
|
BoneKeyframe *b = &a->keyframes[j].keyframes[k];
|
||||||
os << b->idx << " " << b->x << " " << b->y << " " << b->rot << " ";
|
os << b->idx << " " << b->x << " " << b->y << " " << b->rot << " ";
|
||||||
os << b->strip.size() << " ";
|
os << b->strip.size() << " ";
|
||||||
for (int i = 0; i < b->strip.size(); i++)
|
for (size_t i = 0; i < b->strip.size(); i++)
|
||||||
{
|
{
|
||||||
os << b->strip[i].x << " " << b->strip[i].y << " ";
|
os << b->strip[i].x << " " << b->strip[i].y << " ";
|
||||||
}
|
}
|
||||||
|
@ -1013,9 +1009,9 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
|
||||||
return xml->SaveFile(file.c_str()) == XML_SUCCESS;
|
return xml->SaveFile(file.c_str()) == XML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkeletalSprite::getBoneIdx(Bone *b)
|
size_t SkeletalSprite::getBoneIdx(Bone *b)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bones.size(); i++)
|
for (size_t i = 0; i < bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (bones[i] == b)
|
if (bones[i] == b)
|
||||||
return i;
|
return i;
|
||||||
|
@ -1023,9 +1019,9 @@ int SkeletalSprite::getBoneIdx(Bone *b)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletalSprite::toggleBone(int idx, int v)
|
void SkeletalSprite::toggleBone(size_t idx, int v)
|
||||||
{
|
{
|
||||||
if (idx >= 0 && idx < bones.size())
|
if (idx < bones.size())
|
||||||
{
|
{
|
||||||
bones[idx]->alpha.x = v;
|
bones[idx]->alpha.x = v;
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1029,7 @@ void SkeletalSprite::toggleBone(int idx, int v)
|
||||||
|
|
||||||
Bone *SkeletalSprite::getBoneByName(const std::string &name)
|
Bone *SkeletalSprite::getBoneByName(const std::string &name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bones.size(); i++)
|
for (size_t i = 0; i < bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (bones[i]->name == name)
|
if (bones[i]->name == name)
|
||||||
return bones[i];
|
return bones[i];
|
||||||
|
@ -1044,9 +1040,9 @@ Bone *SkeletalSprite::getBoneByName(const std::string &name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bone *SkeletalSprite::getBoneByIdx(int idx)
|
Bone *SkeletalSprite::getBoneByIdx(size_t idx)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bones.size(); i++)
|
for (size_t i = 0; i < bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (bones[i]->boneIdx == idx)
|
if (bones[i]->boneIdx == idx)
|
||||||
return bones[i];
|
return bones[i];
|
||||||
|
@ -1102,7 +1098,7 @@ void SkeletalSprite::prevAnimation()
|
||||||
{
|
{
|
||||||
stopAnimation();
|
stopAnimation();
|
||||||
animLayers[0].currentAnimation--;
|
animLayers[0].currentAnimation--;
|
||||||
if (animLayers[0].currentAnimation < 0)
|
if (animLayers[0].currentAnimation >= animations.size())
|
||||||
animLayers[0].currentAnimation = animations.size()-1;
|
animLayers[0].currentAnimation = animations.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,7 +1113,7 @@ void SkeletalSprite::deleteBones()
|
||||||
|
|
||||||
Animation *SkeletalSprite::getAnimation(const std::string& anim)
|
Animation *SkeletalSprite::getAnimation(const std::string& anim)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < animations.size(); i++)
|
for (size_t i = 0; i < animations.size(); i++)
|
||||||
{
|
{
|
||||||
if (animations[i].name == anim)
|
if (animations[i].name == anim)
|
||||||
return &animations[i];
|
return &animations[i];
|
||||||
|
@ -1220,7 +1216,7 @@ void SkeletalSprite::stopAnimation(int layer)
|
||||||
|
|
||||||
void SkeletalSprite::stopAllAnimations()
|
void SkeletalSprite::stopAllAnimations()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < animLayers.size(); i++)
|
for (size_t i = 0; i < animLayers.size(); i++)
|
||||||
{
|
{
|
||||||
animLayers[i].stopAnimation();
|
animLayers[i].stopAnimation();
|
||||||
}
|
}
|
||||||
|
@ -1445,7 +1441,7 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
||||||
bone = bone->NextSiblingElement("Bone");
|
bone = bone->NextSiblingElement("Bone");
|
||||||
}
|
}
|
||||||
// attach bones
|
// attach bones
|
||||||
for (int i = 0; i < this->bones.size(); i++)
|
for (size_t i = 0; i < this->bones.size(); i++)
|
||||||
{
|
{
|
||||||
Bone *b = this->bones[i];
|
Bone *b = this->bones[i];
|
||||||
if (b->pidx != -1)
|
if (b->pidx != -1)
|
||||||
|
@ -1545,7 +1541,7 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
||||||
if (strip>0)
|
if (strip>0)
|
||||||
{
|
{
|
||||||
b.strip.resize(strip);
|
b.strip.resize(strip);
|
||||||
for (int i = 0; i < b.strip.size(); i++)
|
for (size_t i = 0; i < b.strip.size(); i++)
|
||||||
{
|
{
|
||||||
is >> b.strip[i].x >> b.strip[i].y;
|
is >> b.strip[i].x >> b.strip[i].y;
|
||||||
|
|
||||||
|
@ -1619,7 +1615,7 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// generate empty bone keys
|
// generate empty bone keys
|
||||||
for (int i = 0; i < this->bones.size(); i++)
|
for (size_t i = 0; i < this->bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (newSkeletalKeyframe.getBoneKeyframe(this->bones[i]->boneIdx))
|
if (newSkeletalKeyframe.getBoneKeyframe(this->bones[i]->boneIdx))
|
||||||
{
|
{
|
||||||
|
@ -1640,12 +1636,12 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation *SkeletalSprite::getCurrentAnimation(int layer)
|
Animation *SkeletalSprite::getCurrentAnimation(size_t layer)
|
||||||
{
|
{
|
||||||
return layer < animLayers.size() ? animLayers[layer].getCurrentAnimation() : NULL;
|
return layer < animLayers.size() ? animLayers[layer].getCurrentAnimation() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletalSprite::setTime(float time, int layer)
|
void SkeletalSprite::setTime(float time, size_t layer)
|
||||||
{
|
{
|
||||||
if(layer < animLayers.size())
|
if(layer < animLayers.size())
|
||||||
animLayers[layer].timer = time;
|
animLayers[layer].timer = time;
|
||||||
|
@ -1653,7 +1649,7 @@ void SkeletalSprite::setTime(float time, int layer)
|
||||||
|
|
||||||
void AnimationLayer::resetPass()
|
void AnimationLayer::resetPass()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < s->bones.size(); i++)
|
for (size_t i = 0; i < s->bones.size(); i++)
|
||||||
{
|
{
|
||||||
Bone *b = s->bones[i];
|
Bone *b = s->bones[i];
|
||||||
if (contains(b))
|
if (contains(b))
|
||||||
|
@ -1666,13 +1662,13 @@ bool AnimationLayer::contains(const Bone *b) const
|
||||||
const int idx = b->boneIdx;
|
const int idx = b->boneIdx;
|
||||||
if (!ignoreBones.empty())
|
if (!ignoreBones.empty())
|
||||||
{
|
{
|
||||||
for (int j = 0; j < ignoreBones.size(); j++)
|
for (size_t j = 0; j < ignoreBones.size(); j++)
|
||||||
if (idx == ignoreBones[j])
|
if (idx == ignoreBones[j])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (!includeBones.empty())
|
else if (!includeBones.empty())
|
||||||
{
|
{
|
||||||
for (int j = 0; j < includeBones.size(); j++)
|
for (size_t j = 0; j < includeBones.size(); j++)
|
||||||
if (idx == includeBones[j])
|
if (idx == includeBones[j])
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1708,7 +1704,7 @@ void AnimationLayer::updateBones()
|
||||||
}
|
}
|
||||||
if (!key2->commands.empty())
|
if (!key2->commands.empty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < key2->commands.size(); i++)
|
for (size_t i = 0; i < key2->commands.size(); i++)
|
||||||
{
|
{
|
||||||
key2->commands[i].run();
|
key2->commands[i].run();
|
||||||
}
|
}
|
||||||
|
@ -1720,7 +1716,7 @@ void AnimationLayer::updateBones()
|
||||||
}
|
}
|
||||||
lastNewKey = key2;
|
lastNewKey = key2;
|
||||||
|
|
||||||
for (int i = 0; i < s->bones.size(); i++)
|
for (size_t i = 0; i < s->bones.size(); i++)
|
||||||
{
|
{
|
||||||
Bone *b = s->bones[i];
|
Bone *b = s->bones[i];
|
||||||
|
|
||||||
|
@ -1772,7 +1768,7 @@ void AnimationLayer::updateBones()
|
||||||
bkey2->strip.resize(b->changeStrip.size());
|
bkey2->strip.resize(b->changeStrip.size());
|
||||||
if (bkey1->strip.size() < b->changeStrip.size())
|
if (bkey1->strip.size() < b->changeStrip.size())
|
||||||
bkey1->strip.resize(b->changeStrip.size());
|
bkey1->strip.resize(b->changeStrip.size());
|
||||||
for (int i = 0; i < b->changeStrip.size(); i++)
|
for (size_t i = 0; i < b->changeStrip.size(); i++)
|
||||||
{
|
{
|
||||||
b->changeStrip[i] = Vector(lerp(bkey1->strip[i].x, bkey2->strip[i].x, dt, lerpType), lerp(bkey1->strip[i].y, bkey2->strip[i].y, dt, lerpType));
|
b->changeStrip[i] = Vector(lerp(bkey1->strip[i].x, bkey2->strip[i].x, dt, lerpType), lerp(bkey1->strip[i].y, bkey2->strip[i].y, dt, lerpType));
|
||||||
}
|
}
|
||||||
|
@ -1794,7 +1790,7 @@ void SkeletalSprite::updateBones()
|
||||||
{
|
{
|
||||||
if (!frozen)
|
if (!frozen)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < animLayers.size(); i++)
|
for (size_t i = 0; i < animLayers.size(); i++)
|
||||||
{
|
{
|
||||||
animLayers[i].updateBones();
|
animLayers[i].updateBones();
|
||||||
}
|
}
|
||||||
|
@ -1821,7 +1817,7 @@ Bone* SkeletalSprite::getSelectedBone(bool mouseBased)
|
||||||
float closestDist = HUGE_VALF;
|
float closestDist = HUGE_VALF;
|
||||||
Bone *b = 0;
|
Bone *b = 0;
|
||||||
Vector p = core->mouse.position;
|
Vector p = core->mouse.position;
|
||||||
for (int i = 0; i < bones.size(); i++)
|
for (size_t i = 0; i < bones.size(); i++)
|
||||||
{
|
{
|
||||||
if (bones[i]->renderQuad || core->getShiftState())
|
if (bones[i]->renderQuad || core->getShiftState())
|
||||||
{
|
{
|
||||||
|
@ -1845,7 +1841,7 @@ Bone* SkeletalSprite::getSelectedBone(bool mouseBased)
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
if (!bones.empty() && selectedBone >= 0 && selectedBone < bones.size())
|
if (!bones.empty() && selectedBone < bones.size())
|
||||||
return bones[selectedBone];
|
return bones[selectedBone];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1854,7 +1850,7 @@ Bone* SkeletalSprite::getSelectedBone(bool mouseBased)
|
||||||
|
|
||||||
void SkeletalSprite::updateSelectedBoneColor()
|
void SkeletalSprite::updateSelectedBoneColor()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bones.size(); i++)
|
for (size_t i = 0; i < bones.size(); i++)
|
||||||
{
|
{
|
||||||
bones[i]->color = Vector(1,1,1);
|
bones[i]->color = Vector(1,1,1);
|
||||||
}
|
}
|
||||||
|
@ -1871,7 +1867,7 @@ void SkeletalSprite::setSelectedBone(int b)
|
||||||
|
|
||||||
void SkeletalSprite::selectPrevBone()
|
void SkeletalSprite::selectPrevBone()
|
||||||
{
|
{
|
||||||
const int oldsel = selectedBone;
|
const size_t oldsel = selectedBone;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
selectedBone++;
|
selectedBone++;
|
||||||
|
@ -1886,13 +1882,13 @@ void SkeletalSprite::selectPrevBone()
|
||||||
|
|
||||||
void SkeletalSprite::selectNextBone()
|
void SkeletalSprite::selectNextBone()
|
||||||
{
|
{
|
||||||
const int oldsel = selectedBone;
|
const size_t oldsel = selectedBone;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
selectedBone--;
|
selectedBone--;
|
||||||
if(selectedBone == oldsel)
|
if(selectedBone == oldsel)
|
||||||
break;
|
break;
|
||||||
if (selectedBone < 0)
|
if (selectedBone >= bones.size())
|
||||||
selectedBone = bones.size()-1;
|
selectedBone = bones.size()-1;
|
||||||
}
|
}
|
||||||
while (!bones[selectedBone]->selectable);
|
while (!bones[selectedBone]->selectable);
|
||||||
|
|
|
@ -60,7 +60,8 @@ public:
|
||||||
void destroy();
|
void destroy();
|
||||||
std::string gfx;
|
std::string gfx;
|
||||||
std::string name;
|
std::string name;
|
||||||
int boneIdx, pidx, rbp;
|
size_t boneIdx;
|
||||||
|
int pidx, rbp;
|
||||||
|
|
||||||
std::string prt;
|
std::string prt;
|
||||||
std::vector<Vector> changeStrip;
|
std::vector<Vector> changeStrip;
|
||||||
|
@ -109,7 +110,8 @@ class BoneKeyframe
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {}
|
BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {}
|
||||||
int idx, x, y, rot;
|
size_t idx;
|
||||||
|
int x, y, rot;
|
||||||
float sx, sy;
|
float sx, sy;
|
||||||
bool doScale;
|
bool doScale;
|
||||||
std::vector<Vector> strip;
|
std::vector<Vector> strip;
|
||||||
|
@ -127,7 +129,7 @@ public:
|
||||||
float t;
|
float t;
|
||||||
std::string sound;
|
std::string sound;
|
||||||
std::vector<BoneKeyframe> keyframes;
|
std::vector<BoneKeyframe> keyframes;
|
||||||
BoneKeyframe *getBoneKeyframe(int idx);
|
BoneKeyframe *getBoneKeyframe(size_t idx);
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
std::vector<BoneCommand> commands;
|
std::vector<BoneCommand> commands;
|
||||||
|
|
||||||
|
@ -141,17 +143,17 @@ public:
|
||||||
std::string name;
|
std::string name;
|
||||||
typedef std::vector <SkeletalKeyframe> Keyframes;
|
typedef std::vector <SkeletalKeyframe> Keyframes;
|
||||||
Keyframes keyframes;
|
Keyframes keyframes;
|
||||||
SkeletalKeyframe *getKeyframe(int key);
|
SkeletalKeyframe *getKeyframe(size_t key);
|
||||||
SkeletalKeyframe *getLastKeyframe();
|
SkeletalKeyframe *getLastKeyframe();
|
||||||
SkeletalKeyframe *getFirstKeyframe();
|
SkeletalKeyframe *getFirstKeyframe();
|
||||||
SkeletalKeyframe *getPrevKeyframe(float t);
|
SkeletalKeyframe *getPrevKeyframe(float t);
|
||||||
SkeletalKeyframe *getNextKeyframe(float t);
|
SkeletalKeyframe *getNextKeyframe(float t);
|
||||||
void cloneKey(int key, float toffset);
|
void cloneKey(size_t key, float toffset);
|
||||||
void deleteKey(int key);
|
void deleteKey(size_t key);
|
||||||
void reorderKeyframes();
|
void reorderKeyframes();
|
||||||
float getAnimationLength();
|
float getAnimationLength();
|
||||||
int getSkeletalKeyframeIndex(SkeletalKeyframe *skey);
|
size_t getSkeletalKeyframeIndex(SkeletalKeyframe *skey);
|
||||||
int getNumKeyframes();
|
size_t getNumKeyframes();
|
||||||
void reverse();
|
void reverse();
|
||||||
bool resetPassOnEnd;
|
bool resetPassOnEnd;
|
||||||
};
|
};
|
||||||
|
@ -200,7 +202,7 @@ public:
|
||||||
//HACK: should be a lerped float
|
//HACK: should be a lerped float
|
||||||
InterpolatedVector timeMultiplier;
|
InterpolatedVector timeMultiplier;
|
||||||
float animationLength;
|
float animationLength;
|
||||||
int currentAnimation;
|
size_t currentAnimation;
|
||||||
bool animating;
|
bool animating;
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,13 +217,13 @@ public:
|
||||||
bool saveSkeletal(const std::string &fn);
|
bool saveSkeletal(const std::string &fn);
|
||||||
void loadSkin(const std::string &fn);
|
void loadSkin(const std::string &fn);
|
||||||
|
|
||||||
Bone *getBoneByIdx(int idx);
|
Bone *getBoneByIdx(size_t idx);
|
||||||
Bone *getBoneByName(const std::string &name);
|
Bone *getBoneByName(const std::string &name);
|
||||||
void animate(const std::string &animation, int loop = 0, int layer=0);
|
void animate(const std::string &animation, int loop = 0, int layer=0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setTime(float time, int layer=0);
|
void setTime(float time, size_t layer=0);
|
||||||
|
|
||||||
void updateBones();
|
void updateBones();
|
||||||
void playCurrentAnimation(int loop=0, int layer=0);
|
void playCurrentAnimation(int loop=0, int layer=0);
|
||||||
|
@ -235,7 +237,7 @@ public:
|
||||||
void setTimeMultiplier(float t, int layer=0);
|
void setTimeMultiplier(float t, int layer=0);
|
||||||
|
|
||||||
Bone* getSelectedBone(bool mouseBased = true);
|
Bone* getSelectedBone(bool mouseBased = true);
|
||||||
Animation *getCurrentAnimation(int layer=0);
|
Animation *getCurrentAnimation(size_t layer=0);
|
||||||
|
|
||||||
|
|
||||||
void nextAnimation();
|
void nextAnimation();
|
||||||
|
@ -262,9 +264,9 @@ public:
|
||||||
bool isLoaded();
|
bool isLoaded();
|
||||||
int getNumAnimLayers() const { return animLayers.size(); }
|
int getNumAnimLayers() const { return animLayers.size(); }
|
||||||
|
|
||||||
AnimationLayer* getAnimationLayer(int l);
|
AnimationLayer* getAnimationLayer(size_t l);
|
||||||
int getBoneIdx(Bone *b);
|
size_t getBoneIdx(Bone *b);
|
||||||
void toggleBone(int idx, int v);
|
void toggleBone(size_t idx, int v);
|
||||||
|
|
||||||
void setAnimationKeyNotify(RenderObject *r);
|
void setAnimationKeyNotify(RenderObject *r);
|
||||||
|
|
||||||
|
@ -277,7 +279,7 @@ protected:
|
||||||
bool frozen;
|
bool frozen;
|
||||||
RenderObject *animKeyNotify;
|
RenderObject *animKeyNotify;
|
||||||
bool loaded;
|
bool loaded;
|
||||||
int selectedBone;
|
size_t selectedBone;
|
||||||
friend class AnimationLayer;
|
friend class AnimationLayer;
|
||||||
std::vector<AnimationLayer> animLayers;
|
std::vector<AnimationLayer> animLayers;
|
||||||
Bone* initBone(int idx, std::string gfx, int pidx, int rbp=0, std::string name="", float cr=0, bool fh=false, bool fv=false);
|
Bone* initBone(int idx, std::string gfx, int pidx, int rbp=0, std::string name="", float cr=0, bool fh=false, bool fv=false);
|
||||||
|
|
|
@ -1373,8 +1373,8 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
|
||||||
f = adjustFilenameCase(f);
|
f = adjustFilenameCase(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
int loc = f.find_last_of('/');
|
size_t loc = f.find_last_of('/');
|
||||||
int loc2 = f.rfind('.');
|
size_t loc2 = f.rfind('.');
|
||||||
if (loc != std::string::npos && loc2 != std::string::npos)
|
if (loc != std::string::npos && loc2 != std::string::npos)
|
||||||
{
|
{
|
||||||
name = f.substr(loc+1, loc2-(loc+1));
|
name = f.substr(loc+1, loc2-(loc+1));
|
||||||
|
|
|
@ -68,7 +68,7 @@ StateData::StateData()
|
||||||
StateData::~StateData()
|
StateData::~StateData()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < renderObjects.size(); i++)
|
for (size_t i = 0; i < renderObjects.size(); i++)
|
||||||
{
|
{
|
||||||
removeRenderObject (renderObjects[i]);
|
removeRenderObject (renderObjects[i]);
|
||||||
delete renderObjects[i];
|
delete renderObjects[i];
|
||||||
|
@ -111,7 +111,7 @@ void StateData::eraseRenderObjects()
|
||||||
// why clear garbage here?
|
// why clear garbage here?
|
||||||
//core->clearGarbage();
|
//core->clearGarbage();
|
||||||
|
|
||||||
for (int i = 0; i < renderObjects.size(); i++)
|
for (size_t i = 0; i < renderObjects.size(); i++)
|
||||||
{
|
{
|
||||||
RenderObject *r = renderObjects[i];
|
RenderObject *r = renderObjects[i];
|
||||||
if (r && !r->isDead())
|
if (r && !r->isDead())
|
||||||
|
@ -274,7 +274,7 @@ StateObject *StateManager::addStateInstance(StateObject *s)
|
||||||
|
|
||||||
void StateManager::clearStateInstances()
|
void StateManager::clearStateInstances()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < stateInstances.size(); i++)
|
for (size_t i = 0; i < stateInstances.size(); i++)
|
||||||
{
|
{
|
||||||
StateObject *obj = stateInstances[i];
|
StateObject *obj = stateInstances[i];
|
||||||
delete obj;
|
delete obj;
|
||||||
|
|
173
BBGE/Strings.cpp
Normal file
173
BBGE/Strings.cpp
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
/*
|
||||||
|
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 "Core.h"
|
||||||
|
|
||||||
|
typedef std::map<std::string, int> InputCodeMap;
|
||||||
|
|
||||||
|
InputCodeMap inputCodeMap;
|
||||||
|
|
||||||
|
void initInputCodeMap()
|
||||||
|
{
|
||||||
|
inputCodeMap["0"] = 0;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_A"] = KEY_A;
|
||||||
|
inputCodeMap["KEY_B"] = KEY_B;
|
||||||
|
inputCodeMap["KEY_C"] = KEY_C;
|
||||||
|
inputCodeMap["KEY_D"] = KEY_D;
|
||||||
|
inputCodeMap["KEY_E"] = KEY_E;
|
||||||
|
inputCodeMap["KEY_F"] = KEY_F;
|
||||||
|
inputCodeMap["KEY_G"] = KEY_G;
|
||||||
|
inputCodeMap["KEY_H"] = KEY_H;
|
||||||
|
inputCodeMap["KEY_I"] = KEY_I;
|
||||||
|
inputCodeMap["KEY_J"] = KEY_J;
|
||||||
|
inputCodeMap["KEY_K"] = KEY_K;
|
||||||
|
inputCodeMap["KEY_L"] = KEY_L;
|
||||||
|
inputCodeMap["KEY_M"] = KEY_M;
|
||||||
|
inputCodeMap["KEY_N"] = KEY_N;
|
||||||
|
inputCodeMap["KEY_O"] = KEY_O;
|
||||||
|
inputCodeMap["KEY_P"] = KEY_P;
|
||||||
|
inputCodeMap["KEY_Q"] = KEY_Q;
|
||||||
|
inputCodeMap["KEY_R"] = KEY_R;
|
||||||
|
inputCodeMap["KEY_S"] = KEY_S;
|
||||||
|
inputCodeMap["KEY_T"] = KEY_T;
|
||||||
|
inputCodeMap["KEY_U"] = KEY_U;
|
||||||
|
inputCodeMap["KEY_V"] = KEY_V;
|
||||||
|
inputCodeMap["KEY_W"] = KEY_W;
|
||||||
|
inputCodeMap["KEY_X"] = KEY_X;
|
||||||
|
inputCodeMap["KEY_Y"] = KEY_Y;
|
||||||
|
inputCodeMap["KEY_Z"] = KEY_Z;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_1"] = KEY_1;
|
||||||
|
inputCodeMap["KEY_2"] = KEY_2;
|
||||||
|
inputCodeMap["KEY_3"] = KEY_3;
|
||||||
|
inputCodeMap["KEY_4"] = KEY_4;
|
||||||
|
inputCodeMap["KEY_5"] = KEY_5;
|
||||||
|
inputCodeMap["KEY_6"] = KEY_6;
|
||||||
|
inputCodeMap["KEY_7"] = KEY_7;
|
||||||
|
inputCodeMap["KEY_8"] = KEY_8;
|
||||||
|
inputCodeMap["KEY_9"] = KEY_9;
|
||||||
|
inputCodeMap["KEY_0"] = KEY_0;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_NUMPAD1"] = KEY_NUMPAD1;
|
||||||
|
inputCodeMap["KEY_NUMPAD2"] = KEY_NUMPAD2;
|
||||||
|
inputCodeMap["KEY_NUMPAD3"] = KEY_NUMPAD3;
|
||||||
|
inputCodeMap["KEY_NUMPAD4"] = KEY_NUMPAD4;
|
||||||
|
inputCodeMap["KEY_NUMPAD5"] = KEY_NUMPAD5;
|
||||||
|
inputCodeMap["KEY_NUMPAD6"] = KEY_NUMPAD6;
|
||||||
|
inputCodeMap["KEY_NUMPAD7"] = KEY_NUMPAD7;
|
||||||
|
inputCodeMap["KEY_NUMPAD8"] = KEY_NUMPAD8;
|
||||||
|
inputCodeMap["KEY_NUMPAD9"] = KEY_NUMPAD9;
|
||||||
|
inputCodeMap["KEY_NUMPAD0"] = KEY_NUMPAD0;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_F1"] = KEY_F1;
|
||||||
|
inputCodeMap["KEY_F2"] = KEY_F2;
|
||||||
|
inputCodeMap["KEY_F3"] = KEY_F3;
|
||||||
|
inputCodeMap["KEY_F4"] = KEY_F4;
|
||||||
|
inputCodeMap["KEY_F5"] = KEY_F5;
|
||||||
|
inputCodeMap["KEY_F6"] = KEY_F6;
|
||||||
|
inputCodeMap["KEY_F7"] = KEY_F7;
|
||||||
|
inputCodeMap["KEY_F8"] = KEY_F8;
|
||||||
|
inputCodeMap["KEY_F9"] = KEY_F9;
|
||||||
|
inputCodeMap["KEY_F10"] = KEY_F10;
|
||||||
|
inputCodeMap["KEY_F11"] = KEY_F11;
|
||||||
|
inputCodeMap["KEY_F12"] = KEY_F12;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_LEFT"] = KEY_LEFT;
|
||||||
|
inputCodeMap["KEY_RIGHT"] = KEY_RIGHT;
|
||||||
|
inputCodeMap["KEY_UP"] = KEY_UP;
|
||||||
|
inputCodeMap["KEY_DOWN"] = KEY_DOWN;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_SPACE"] = KEY_SPACE;
|
||||||
|
inputCodeMap["KEY_LCONTROL"] = KEY_LCONTROL;
|
||||||
|
inputCodeMap["KEY_RCONTROL"] = KEY_RCONTROL;
|
||||||
|
inputCodeMap["KEY_LSHIFT"] = KEY_LSHIFT;
|
||||||
|
inputCodeMap["KEY_RSHIFT"] = KEY_RSHIFT;
|
||||||
|
inputCodeMap["KEY_LMETA"] = KEY_LMETA;
|
||||||
|
inputCodeMap["KEY_RMETA"] = KEY_RMETA;
|
||||||
|
inputCodeMap["KEY_LALT"] = KEY_LALT;
|
||||||
|
inputCodeMap["KEY_RALT"] = KEY_RALT;
|
||||||
|
inputCodeMap["KEY_RETURN"] = KEY_RETURN;
|
||||||
|
inputCodeMap["KEY_TAB"] = KEY_TAB;
|
||||||
|
|
||||||
|
inputCodeMap["KEY_ESCAPE"] = KEY_ESCAPE;
|
||||||
|
|
||||||
|
inputCodeMap["MOUSE_BUTTON_LEFT"] = ActionMapper::MOUSE_BUTTON_LEFT;
|
||||||
|
inputCodeMap["MOUSE_BUTTON_RIGHT"] = ActionMapper::MOUSE_BUTTON_RIGHT;
|
||||||
|
inputCodeMap["MOUSE_BUTTON_MIDDLE"] = ActionMapper::MOUSE_BUTTON_MIDDLE;
|
||||||
|
|
||||||
|
for (int i = 0; i < 17; i++)
|
||||||
|
{
|
||||||
|
std::ostringstream os;
|
||||||
|
os << "JOY_BUTTON_" << i;
|
||||||
|
inputCodeMap[os.str()] = ActionMapper::JOY1_BUTTON_0+i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearInputCodeMap()
|
||||||
|
{
|
||||||
|
inputCodeMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getInputCodeToString(int key)
|
||||||
|
{
|
||||||
|
for (InputCodeMap::iterator i = inputCodeMap.begin(); i != inputCodeMap.end(); i++)
|
||||||
|
{
|
||||||
|
if ((*i).second == key)
|
||||||
|
{
|
||||||
|
return (*i).first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Move stringbank to BBGE and move these strings into it. -- fg
|
||||||
|
|
||||||
|
std::string getInputCodeToUserString(int key)
|
||||||
|
{
|
||||||
|
for (InputCodeMap::iterator i = inputCodeMap.begin(); i != inputCodeMap.end(); i++)
|
||||||
|
{
|
||||||
|
if ((*i).second == key)
|
||||||
|
{
|
||||||
|
std::string use = (*i).first;
|
||||||
|
size_t idx = 0;
|
||||||
|
idx = use.find("KEY_");
|
||||||
|
if (idx != std::string::npos)
|
||||||
|
{
|
||||||
|
use = use.substr(4, use.size());
|
||||||
|
}
|
||||||
|
if (use == "MOUSE_BUTTON_LEFT")
|
||||||
|
use = "Left Mouse Button";
|
||||||
|
if (use == "MOUSE_BUTTON_RIGHT")
|
||||||
|
use = "Right Mouse Button";
|
||||||
|
if (use == "MOUSE_BUTTON_MIDDLE")
|
||||||
|
use = "Middle Mouse Button";
|
||||||
|
|
||||||
|
return use;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int getStringToInputCode(const std::string &string)
|
||||||
|
{
|
||||||
|
return inputCodeMap[string];
|
||||||
|
}
|
|
@ -235,7 +235,7 @@ float TTFText::getLineHeight()
|
||||||
|
|
||||||
int TTFText::findLine(const std::string &label)
|
int TTFText::findLine(const std::string &label)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < text.size(); i++)
|
for (size_t i = 0; i < text.size(); i++)
|
||||||
{
|
{
|
||||||
if (text[i].find(label) != std::string::npos)
|
if (text[i].find(label) != std::string::npos)
|
||||||
{
|
{
|
||||||
|
@ -249,7 +249,7 @@ void TTFText::onRender()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < text.size(); i++)
|
for (size_t i = 0; i < text.size(); i++)
|
||||||
{
|
{
|
||||||
if (shadow)
|
if (shadow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,7 +147,7 @@ int Texture::getPixelWidth()
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int smallestx = -1, largestx = -1;
|
size_t smallestx = -1, largestx = 0;
|
||||||
for (unsigned int x = 0; x < unsigned(w); x++)
|
for (unsigned int x = 0; x < unsigned(w); x++)
|
||||||
{
|
{
|
||||||
for (unsigned int y = 0; y < unsigned(h); y++)
|
for (unsigned int y = 0; y < unsigned(h); y++)
|
||||||
|
@ -155,9 +155,9 @@ int Texture::getPixelWidth()
|
||||||
unsigned int p = (y*unsigned(w)*4) + (x*4) + 3;
|
unsigned int p = (y*unsigned(w)*4) + (x*4) + 3;
|
||||||
if (p < size && data[p] >= 254)
|
if (p < size && data[p] >= 254)
|
||||||
{
|
{
|
||||||
if (smallestx == -1 || x < smallestx)
|
if (x < smallestx)
|
||||||
smallestx = x;
|
smallestx = x;
|
||||||
if (largestx == -1 || x > largestx)
|
if (x > largestx)
|
||||||
largestx = x;
|
largestx = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,17 +174,17 @@ int Texture::getPixelHeight()
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int smallesty = -1, largesty = -1;
|
size_t smallesty = -1, largesty = 0;
|
||||||
for (unsigned int x = 0; x < unsigned(w); x++)
|
for (unsigned int x = 0; x < unsigned(w); x++)
|
||||||
{
|
{
|
||||||
for (unsigned int y = 0; y < unsigned(h); y++)
|
for (unsigned int y = 0; y < unsigned(h); y++)
|
||||||
{
|
{
|
||||||
int p = (y*unsigned(w)*4) + (x*4) + 3;
|
size_t p = (y*unsigned(w)*4) + (x*4) + 3;
|
||||||
if (p < size && data[p] >= 254)
|
if (p < size && data[p] >= 254)
|
||||||
{
|
{
|
||||||
if (smallesty == -1 || y < smallesty)
|
if (y < smallesty)
|
||||||
smallesty = y;
|
smallesty = y;
|
||||||
if (largesty == -1 || y > largesty)
|
if (y > largesty)
|
||||||
largesty = y;
|
largesty = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,9 +427,9 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size)
|
||||||
byte length = 0; // The length in bytes to the pixels
|
byte length = 0; // The length in bytes to the pixels
|
||||||
byte imageType = 0; // The image type (RLE, RGB, Alpha...)
|
byte imageType = 0; // The image type (RLE, RGB, Alpha...)
|
||||||
byte bits = 0; // The bits per pixel for the image (16, 24, 32)
|
byte bits = 0; // The bits per pixel for the image (16, 24, 32)
|
||||||
int channels = 0; // The channels of the image (3 = RGA : 4 = RGBA)
|
uint32_t channels = 0; // The channels of the image (3 = RGA : 4 = RGBA)
|
||||||
int stride = 0; // The stride (channels * width)
|
uint32_t stride = 0; // The stride (channels * width)
|
||||||
int i = 0; // A counter
|
size_t i = 0; // A counter
|
||||||
|
|
||||||
// This function loads in a TARGA (.TGA) file and returns its data to be
|
// This function loads in a TARGA (.TGA) file and returns its data to be
|
||||||
// used as a texture or what have you. This currently loads in a 16, 24
|
// used as a texture or what have you. This currently loads in a 16, 24
|
||||||
|
|
|
@ -179,7 +179,7 @@ void VectorPath::realPercentageCalc()
|
||||||
{
|
{
|
||||||
float totalLen = getLength();
|
float totalLen = getLength();
|
||||||
float len = 0;
|
float len = 0;
|
||||||
for (int i = 1; i < pathNodes.size(); i++)
|
for (size_t i = 1; i < pathNodes.size(); i++)
|
||||||
{
|
{
|
||||||
Vector diff = pathNodes[i].value - pathNodes[i-1].value;
|
Vector diff = pathNodes[i].value - pathNodes[i-1].value;
|
||||||
len += diff.getLength2D();
|
len += diff.getLength2D();
|
||||||
|
@ -202,7 +202,7 @@ float VectorPath::getSubSectionLength(int startIncl, int endIncl)
|
||||||
float VectorPath::getLength()
|
float VectorPath::getLength()
|
||||||
{
|
{
|
||||||
float len = 0;
|
float len = 0;
|
||||||
for (int i = 1; i < pathNodes.size(); i++)
|
for (size_t i = 1; i < pathNodes.size(); i++)
|
||||||
{
|
{
|
||||||
Vector diff = pathNodes[i].value - pathNodes[i-1].value;
|
Vector diff = pathNodes[i].value - pathNodes[i-1].value;
|
||||||
len += diff.getLength2D();
|
len += diff.getLength2D();
|
||||||
|
@ -219,7 +219,7 @@ void VectorPath::splice(const VectorPath &path, int sz)
|
||||||
{
|
{
|
||||||
std::vector<VectorPathNode> copy = pathNodes;
|
std::vector<VectorPathNode> copy = pathNodes;
|
||||||
pathNodes.clear();
|
pathNodes.clear();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < path.pathNodes.size(); i++)
|
for (i = 0; i < path.pathNodes.size(); i++)
|
||||||
pathNodes.push_back(path.pathNodes[i]);
|
pathNodes.push_back(path.pathNodes[i]);
|
||||||
for (i = sz+1; i < copy.size(); i++)
|
for (i = sz+1; i < copy.size(); i++)
|
||||||
|
@ -240,7 +240,7 @@ void VectorPath::prepend(const VectorPath &path)
|
||||||
{
|
{
|
||||||
std::vector<VectorPathNode> copy = pathNodes;
|
std::vector<VectorPathNode> copy = pathNodes;
|
||||||
pathNodes.clear();
|
pathNodes.clear();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < path.pathNodes.size(); i++)
|
for (i = 0; i < path.pathNodes.size(); i++)
|
||||||
pathNodes.push_back(path.pathNodes[i]);
|
pathNodes.push_back(path.pathNodes[i]);
|
||||||
for (i = 0; i < copy.size(); i++)
|
for (i = 0; i < copy.size(); i++)
|
||||||
|
@ -249,7 +249,7 @@ void VectorPath::prepend(const VectorPath &path)
|
||||||
|
|
||||||
void VectorPath::calculatePercentages()
|
void VectorPath::calculatePercentages()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pathNodes.size(); i++)
|
for (size_t i = 0; i < pathNodes.size(); i++)
|
||||||
{
|
{
|
||||||
pathNodes[i].percent = i/float(pathNodes.size());
|
pathNodes[i].percent = i/float(pathNodes.size());
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ void VectorPath::append(const VectorPath &path)
|
||||||
{
|
{
|
||||||
std::vector<VectorPathNode> copy = pathNodes;
|
std::vector<VectorPathNode> copy = pathNodes;
|
||||||
pathNodes.clear();
|
pathNodes.clear();
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
for (i = 0; i < copy.size(); i++)
|
for (i = 0; i < copy.size(); i++)
|
||||||
pathNodes.push_back(copy[i]);
|
pathNodes.push_back(copy[i]);
|
||||||
for (i = 0; i < path.pathNodes.size(); i++)
|
for (i = 0; i < path.pathNodes.size(); i++)
|
||||||
|
@ -270,7 +270,7 @@ void VectorPath::cut(int n)
|
||||||
{
|
{
|
||||||
std::vector<VectorPathNode> copy = pathNodes;
|
std::vector<VectorPathNode> copy = pathNodes;
|
||||||
pathNodes.clear();
|
pathNodes.clear();
|
||||||
for (int i = 0; i < copy.size(); i+=n)
|
for (size_t i = 0; i < copy.size(); i+=n)
|
||||||
{
|
{
|
||||||
pathNodes.push_back(copy[i]);
|
pathNodes.push_back(copy[i]);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ Vector VectorPath::getValue(float usePercent)
|
||||||
|
|
||||||
VectorPathNode *target = 0;
|
VectorPathNode *target = 0;
|
||||||
VectorPathNode *from = &pathNodes[0];
|
VectorPathNode *from = &pathNodes[0];
|
||||||
for (int i = 0; i < pathNodes.size(); ++i)
|
for (size_t i = 0; i < pathNodes.size(); ++i)
|
||||||
{
|
{
|
||||||
if (pathNodes[i].percent >= usePercent)
|
if (pathNodes[i].percent >= usePercent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -375,9 +375,9 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
void addPathNode(Vector v, float p);
|
void addPathNode(Vector v, float p);
|
||||||
Vector getValue(float percent);
|
Vector getValue(float percent);
|
||||||
int getNumPathNodes() { return pathNodes.size(); }
|
size_t getNumPathNodes() { return pathNodes.size(); }
|
||||||
void resizePathNodes(int sz) { pathNodes.resize(sz); }
|
void resizePathNodes(int sz) { pathNodes.resize(sz); }
|
||||||
VectorPathNode *getPathNode(int i) { if (i<getNumPathNodes() && i >= 0) return &pathNodes[i]; return 0; }
|
VectorPathNode *getPathNode(size_t i) { if (i<getNumPathNodes()) return &pathNodes[i]; return 0; }
|
||||||
void cut(int n);
|
void cut(int n);
|
||||||
void splice(const VectorPath &path, int sz);
|
void splice(const VectorPath &path, int sz);
|
||||||
void prepend(const VectorPath &path);
|
void prepend(const VectorPath &path);
|
||||||
|
|
|
@ -76,6 +76,6 @@ inline unsigned int clz(uint32 x)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}; // end namespace bithacks
|
} // end namespace bithacks
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace ByteBufferTools
|
||||||
template<typename T> void ToLittleEndian(T*); // will generate link error
|
template<typename T> void ToLittleEndian(T*); // will generate link error
|
||||||
template<typename T> void ToBigEndian(T*); // will generate link error
|
template<typename T> void ToBigEndian(T*); // will generate link error
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#ifdef BB_OLD_GNUC
|
#ifdef BB_OLD_GNUC
|
||||||
# define BB_MAKE_WRITE_OP(T) inline ByteBuffer& operator<<(T val) { appendT(&val, sizeof(T)); return *this; }
|
# define BB_MAKE_WRITE_OP(T) inline ByteBuffer& operator<<(T val) { appendT(&val, sizeof(T)); return *this; }
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ttvfs
|
||||||
{
|
{
|
||||||
class File;
|
class File;
|
||||||
class Root;
|
class Root;
|
||||||
};
|
}
|
||||||
typedef ttvfs::File VFILE;
|
typedef ttvfs::File VFILE;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue