mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-06 22:30:20 +00:00
Merge branch 'experimental' of file:///Users/User/code/coding/Aquaria_fg_clean into experimental
This commit is contained in:
commit
9a4a58a69f
13 changed files with 294 additions and 671 deletions
|
@ -263,6 +263,7 @@ void AnimationEditor::applyState()
|
||||||
|
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, clearRot), KEY_R, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, clearRot), KEY_R, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, clearPos), KEY_P, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, clearPos), KEY_P, 0);
|
||||||
|
addAction(MakeFunctionEvent(AnimationEditor, flipRot), KEY_D, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, toggleHideBone), KEY_N, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, toggleHideBone), KEY_N, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, copy), KEY_C, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, copy), KEY_C, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, paste), KEY_V, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, paste), KEY_V, 0);
|
||||||
|
@ -1155,6 +1156,58 @@ void AnimationEditor::clearRot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnimationEditor::flipRot()
|
||||||
|
{
|
||||||
|
if (dsq->isNested()) return;
|
||||||
|
|
||||||
|
updateEditingBone();
|
||||||
|
if (editingBone)
|
||||||
|
{
|
||||||
|
if (!core->getShiftState())
|
||||||
|
{
|
||||||
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
b->rot = -b->rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (bcur)
|
||||||
|
{
|
||||||
|
int rotdiff = editingBone->rotation.z - bcur->rot;
|
||||||
|
if (!core->getCtrlState())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
|
{
|
||||||
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
b->rot = -b->rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// all bones in all anims mode
|
||||||
|
for (int a = 0; a < editSprite->animations.size(); ++a)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
||||||
|
{
|
||||||
|
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
b->rot = -b->rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AnimationEditor::clearPos()
|
void AnimationEditor::clearPos()
|
||||||
{
|
{
|
||||||
if (dsq->isNested()) return;
|
if (dsq->isNested()) return;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define AQUARIA_BUILD_CONSOLE 1
|
#define AQUARIA_BUILD_CONSOLE 1
|
||||||
#define AQUARIA_BUILD_SCENEEDITOR 1
|
#define AQUARIA_BUILD_SCENEEDITOR 1
|
||||||
|
|
||||||
#define AQUARIA_CUSTOM_BUILD_ID ""
|
#define AQUARIA_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__)
|
||||||
|
|
||||||
// If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen.
|
// If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen.
|
||||||
//#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.000"
|
//#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.000"
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elementEffectMult = 1;
|
||||||
state.abilityDelay = 0;
|
state.abilityDelay = 0;
|
||||||
formAbilityDelay = 0;
|
formAbilityDelay = 0;
|
||||||
dsq->continuity.form = form;
|
dsq->continuity.form = form;
|
||||||
|
@ -1731,6 +1731,7 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
|
||||||
collideRadius = COLLIDE_RADIUS_FISH;
|
collideRadius = COLLIDE_RADIUS_FISH;
|
||||||
setCanLockToWall(false);
|
setCanLockToWall(false);
|
||||||
setCollisionAvoidanceData(COLLIDE_RANGE_FISH, COLLIDE_MOD_FISH);
|
setCollisionAvoidanceData(COLLIDE_RANGE_FISH, COLLIDE_MOD_FISH);
|
||||||
|
elementEffectMult = 0.4f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_SUN:
|
case FORM_SUN:
|
||||||
|
@ -1780,6 +1781,7 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF
|
||||||
setCanLockToWall(false);
|
setCanLockToWall(false);
|
||||||
setCanBurst(false);
|
setCanBurst(false);
|
||||||
setDamageTarget(DT_WALLHURT, false);
|
setDamageTarget(DT_WALLHURT, false);
|
||||||
|
elementEffectMult = 0;
|
||||||
|
|
||||||
if (onInit)
|
if (onInit)
|
||||||
{
|
{
|
||||||
|
@ -4076,6 +4078,7 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
||||||
_seeMapMode = SEE_MAP_DEFAULT;
|
_seeMapMode = SEE_MAP_DEFAULT;
|
||||||
|
|
||||||
blockBackFlip = false;
|
blockBackFlip = false;
|
||||||
|
elementEffectMult = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::revert()
|
void Avatar::revert()
|
||||||
|
@ -7133,6 +7136,16 @@ void Avatar::onUpdate(float dt)
|
||||||
|
|
||||||
if(canCollideWithShots())
|
if(canCollideWithShots())
|
||||||
dsq->game->handleShotCollisions(this, (activeAura == AURA_SHIELD));
|
dsq->game->handleShotCollisions(this, (activeAura == AURA_SHIELD));
|
||||||
|
|
||||||
|
|
||||||
|
if(!core->particlesPaused && elementEffectMult > 0)
|
||||||
|
{
|
||||||
|
ElementUpdateList& elems = dsq->game->elementUpdateList;
|
||||||
|
for (ElementUpdateList::iterator it = elems.begin(); it != elems.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->doInteraction(this, elementEffectMult, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -346,6 +346,7 @@ public:
|
||||||
|
|
||||||
int leaches;
|
int leaches;
|
||||||
float shieldPoints;
|
float shieldPoints;
|
||||||
|
float elementEffectMult;
|
||||||
|
|
||||||
bool blockBackFlip;
|
bool blockBackFlip;
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ ElementEffect DSQ::getElementEffectByIndex(int e)
|
||||||
|
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
Element *DSQ::getSolidElementNear(Vector pos, int rad)
|
Element *DSQ::getSolidElementNear(Vector pos, int rad)
|
||||||
{
|
{
|
||||||
Element *closestE = 0;
|
Element *closestE = 0;
|
||||||
|
@ -376,26 +376,12 @@ Element *DSQ::getSolidElementNear(Vector pos, int rad)
|
||||||
}
|
}
|
||||||
return closestE;
|
return closestE;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Vector DSQ::getCameraCenter()
|
Vector DSQ::getCameraCenter()
|
||||||
{
|
{
|
||||||
return cameraPos; //+ Vector(400*(1.0f/core->globalScale.x),300*(1.0f/core->globalScale.x));
|
return cameraPos; //+ Vector(400*(1.0f/core->globalScale.x),300*(1.0f/core->globalScale.x));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSQ::doScript(const std::string &script)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
this->script.loadScriptFile(script);
|
|
||||||
this->script.run("void main()");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSQ::print(int x, int y, const std::string &text)
|
|
||||||
{
|
|
||||||
// CTextDrawer::GetSingleton().PrintText(x, y, text.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DSQ::centerMessage(const std::string &text, float y, int type)
|
void DSQ::centerMessage(const std::string &text, float y, int type)
|
||||||
{
|
{
|
||||||
Vector pos(400,y);
|
Vector pos(400,y);
|
||||||
|
@ -4559,6 +4545,7 @@ void DSQ::onUpdate(float dt)
|
||||||
os << dsq->sound->getVolumeString() << std::endl;
|
os << dsq->sound->getVolumeString() << std::endl;
|
||||||
os << "runInBG: " << core->settings.runInBackground << " nested: " << core->getNestedMains() << std::endl;
|
os << "runInBG: " << core->settings.runInBackground << " nested: " << core->getNestedMains() << std::endl;
|
||||||
os << core->globalResolutionScale.x << ", " << core->globalResolutionScale.y << std::endl;
|
os << core->globalResolutionScale.x << ", " << core->globalResolutionScale.y << std::endl;
|
||||||
|
os << "elemu: " << game->elementUpdateList.size() << " elemi: " << game->elementInteractionList.size() << std::endl;
|
||||||
os << "Lua mem: " << scriptInterface.gcGetStats() << " KB" << std::endl;
|
os << "Lua mem: " << scriptInterface.gcGetStats() << " KB" << std::endl;
|
||||||
|
|
||||||
cmDebug->setText(os.str());
|
cmDebug->setText(os.str());
|
||||||
|
|
|
@ -1270,10 +1270,7 @@ public:
|
||||||
|
|
||||||
void setTexturePointers();
|
void setTexturePointers();
|
||||||
|
|
||||||
void doScript(const std::string &script);
|
|
||||||
|
|
||||||
void fade(float alpha, float time);
|
void fade(float alpha, float time);
|
||||||
void print(int x, int y, const std::string &text);
|
|
||||||
|
|
||||||
void applyParallaxUserSettings();
|
void applyParallaxUserSettings();
|
||||||
|
|
||||||
|
@ -1380,7 +1377,7 @@ public:
|
||||||
std::string getDialogueFilename(const std::string &f);
|
std::string getDialogueFilename(const std::string &f);
|
||||||
|
|
||||||
bool isShakingCamera();
|
bool isShakingCamera();
|
||||||
Element *getSolidElementNear(Vector pos, int rad);
|
//Element *getSolidElementNear(Vector pos, int rad);
|
||||||
|
|
||||||
std::string languagePack;
|
std::string languagePack;
|
||||||
|
|
||||||
|
|
|
@ -20,169 +20,150 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include "Element.h"
|
#include "Element.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Avatar.h"
|
|
||||||
|
ElementEffectData::ElementEffectData()
|
||||||
|
: elementEffectIndex(-1)
|
||||||
|
, wavyAngleOffset(0)
|
||||||
|
, wavyMagnitude(0)
|
||||||
|
, wavyLerpIn(0)
|
||||||
|
, wavyMin(0)
|
||||||
|
, wavyMax(0)
|
||||||
|
, hitPerc(0)
|
||||||
|
, effectMult(0)
|
||||||
|
, wavyWaving(false)
|
||||||
|
, wavyFlip(false)
|
||||||
|
, touching(false)
|
||||||
|
, elementEffectType(EFX_NONE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Element::Element() : Quad()
|
Element::Element() : Quad()
|
||||||
{
|
{
|
||||||
elementFlag = EF_NONE;
|
elementFlag = EF_NONE;
|
||||||
wavyFlip = false;
|
|
||||||
elementEffectIndex = -1;
|
|
||||||
elementActive = true;
|
elementActive = true;
|
||||||
bgLayer = 0;
|
bgLayer = 0;
|
||||||
|
|
||||||
wavyAngleOffset=0;
|
|
||||||
wavyMagnitude=0;
|
|
||||||
wavyLerpIn=0;
|
|
||||||
wavyWaving=false;
|
|
||||||
wavyFlip=false;
|
|
||||||
|
|
||||||
elementEffectType = 0;
|
|
||||||
wavyRadius = 0;
|
|
||||||
wavyMin = 0;
|
|
||||||
wavyMax = 0;
|
|
||||||
templateIdx = -1;
|
templateIdx = -1;
|
||||||
|
eff = NULL;
|
||||||
|
|
||||||
setStatic(true);
|
setStatic(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::wavyPull(int to, int from, float dt)
|
void Element::ensureEffectData()
|
||||||
{
|
{
|
||||||
Vector diff = wavy[to] - wavy[from];
|
if (!eff)
|
||||||
if (!diff.isZero())
|
eff = new ElementEffectData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Element::freeEffectData()
|
||||||
|
{
|
||||||
|
if (eff)
|
||||||
{
|
{
|
||||||
diff.capLength2D(wavyMax);
|
delete eff;
|
||||||
if (diff.isLength2DIn(wavyMin))
|
eff = NULL;
|
||||||
{
|
|
||||||
diff.setLength2D(wavyMin);
|
|
||||||
}
|
|
||||||
wavy[to] = wavy[from] + diff;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Element::doInteraction(Entity *ent, float mult, float touchWidth)
|
||||||
|
{
|
||||||
|
ElementEffectData *eff = this->eff;
|
||||||
|
Vector pos = position;
|
||||||
|
pos.y -= (height*scale.y)/2;
|
||||||
|
|
||||||
|
float hitPerc=0;
|
||||||
|
Vector p = ent->position;
|
||||||
|
if (p.x > position.x-touchWidth && p.x < position.x+touchWidth)
|
||||||
|
{
|
||||||
|
float h2 = (height*scale.y)/2.0f;
|
||||||
|
if (p.y < position.y+h2 && p.y > position.y-h2)
|
||||||
|
{
|
||||||
|
eff->touching = true;
|
||||||
|
eff->wavyWaving = true;
|
||||||
|
hitPerc = pos.y - p.y;
|
||||||
|
hitPerc /= float(height*scale.y);
|
||||||
|
hitPerc = (1.0f-hitPerc)-1.0f;
|
||||||
|
eff->hitPerc = hitPerc;
|
||||||
|
eff->touchVel = ent->vel;
|
||||||
|
eff->effectMult = mult;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//eff->touchVel = Vector(0, 0);
|
||||||
|
//eff->hitPerc = 0;
|
||||||
|
eff->touching = false;
|
||||||
|
}
|
||||||
|
|
||||||
void Element::updateEffects(float dt)
|
void Element::updateEffects(float dt)
|
||||||
{
|
{
|
||||||
switch (elementEffectType)
|
switch (eff->elementEffectType)
|
||||||
{
|
{
|
||||||
case EFX_ALPHA:
|
case EFX_ALPHA:
|
||||||
alpha.update(dt);
|
alpha.update(dt);
|
||||||
break;
|
break;
|
||||||
case EFX_WAVY:
|
case EFX_WAVY:
|
||||||
//debugLog("EXF_WAVY update");
|
//debugLog("EXF_WAVY update");
|
||||||
/// check player position
|
/// check player position
|
||||||
{
|
{
|
||||||
// if a big wavy doesn't work, this is probably why
|
// if a big wavy doesn't work, this is probably why
|
||||||
//if ((position - dsq->game->avatar->position).isLength2DIn(1024))
|
//if ((position - ent->position).isLength2DIn(1024))
|
||||||
{
|
{
|
||||||
int touchIdx = -1;
|
ElementEffectData *eff = this->eff;
|
||||||
Vector pos = position;
|
|
||||||
pos.y = position.y - (height*scale.y)/2;
|
|
||||||
|
|
||||||
float hitPerc=0;
|
if (eff->touching)
|
||||||
Vector p = dsq->game->avatar->position;// + Vector(200,0);
|
|
||||||
if (p.x > position.x-16 && p.x < position.x+16)
|
|
||||||
{
|
{
|
||||||
float h2 = (height*scale.y)/2.0f;
|
float ramp = eff->touchVel.getLength2D()/800.0f;
|
||||||
if (p.y < position.y+h2 && p.y > position.y-h2)
|
|
||||||
{
|
|
||||||
touchIdx = 0;
|
|
||||||
hitPerc = pos.y - p.y;
|
|
||||||
hitPerc /= float(height*scale.y);
|
|
||||||
hitPerc = (1.0f-hitPerc)-1.0f;
|
|
||||||
|
|
||||||
|
|
||||||
//std::cout << "hit!\n";
|
|
||||||
/*
|
|
||||||
std::ostringstream os;
|
|
||||||
os << "hit perc: " << hitPerc;
|
|
||||||
debugLog(os.str());
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < wavy.size()-1; i++)
|
|
||||||
{
|
|
||||||
if (isTouchingLine(wavy[0]+pos, wavy[i+1]+pos, dsq->game->avatar->position, wavyRadius))
|
|
||||||
{
|
|
||||||
//wavy[i+1] = dsq->game->avatar->position;
|
|
||||||
touchIdx = i+1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (touchIdx != -1)
|
|
||||||
{
|
|
||||||
// start pull
|
|
||||||
wavyWaving = true;
|
|
||||||
wavyAngleOffset = 0;
|
|
||||||
float ramp = dsq->game->avatar->vel.getLength2D()/800.0f;
|
|
||||||
if (ramp < 0) ramp = 0;
|
if (ramp < 0) ramp = 0;
|
||||||
if (ramp > 1) ramp = 1;
|
if (ramp > 1) ramp = 1;
|
||||||
|
|
||||||
wavyMagnitude = 100 * ramp + 16;
|
eff->wavyMagnitude = 100 * ramp + 16;
|
||||||
|
|
||||||
if (dsq->game->avatar->vel.x < 0)
|
if (eff->touchVel.x < 0)
|
||||||
wavyMagnitude = -wavyMagnitude;
|
eff->wavyMagnitude = -eff->wavyMagnitude;
|
||||||
|
|
||||||
/*
|
eff->wavyAngleOffset = (eff->hitPerc-0.5f)*PI;
|
||||||
if (hitPerc > 0.35f)
|
|
||||||
wavyMagnitude = -wavyMagnitude;
|
|
||||||
*/
|
|
||||||
|
|
||||||
wavyAngleOffset = (hitPerc-0.5f)*PI;
|
eff->wavySave = eff->wavy;
|
||||||
|
eff->wavyLerpIn = 0;
|
||||||
wavySave = wavy;
|
|
||||||
wavyLerpIn = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wavyWaving)
|
if (eff->wavyWaving)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
float wavyMagnitude = wavyMagnitude;
|
|
||||||
if (dsq->continuity.form == FORM_FISH)
|
|
||||||
wavyMagnitude *= 0.1f;
|
|
||||||
*/
|
|
||||||
float wavyMagMult = 1;
|
|
||||||
|
|
||||||
if (dsq->continuity.form == FORM_FISH)
|
|
||||||
wavyMagMult = 0.4;
|
|
||||||
|
|
||||||
float spd = PI*1.1f;
|
float spd = PI*1.1f;
|
||||||
float magRedSpd = 48;
|
float magRedSpd = 48;
|
||||||
float lerpSpd = 5.0;
|
float lerpSpd = 5.0;
|
||||||
for (int i = 0; i < wavy.size(); i++)
|
float wavySz = float(eff->wavy.size());
|
||||||
|
for (int i = 0; i < eff->wavy.size(); i++)
|
||||||
{
|
{
|
||||||
float weight = float(i)/float(wavy.size());
|
float weight = float(i)/wavySz;
|
||||||
if (wavyFlip)
|
if (eff->wavyFlip)
|
||||||
weight = 1.0f-weight;
|
weight = 1.0f-weight;
|
||||||
if (weight < 0.125f)
|
if (weight < 0.125f)
|
||||||
weight *= 0.5f;
|
weight *= 0.5f;
|
||||||
wavy[i].x = sinf(wavyAngleOffset + (float(i)/float(wavy.size()))*PI)*float(wavyMagnitude*wavyMagMult)*weight;
|
eff->wavy[i].x = sinf(eff->wavyAngleOffset + (float(i)/wavySz)*PI)*float(eff->wavyMagnitude*eff->effectMult)*weight;
|
||||||
if (!wavySave.empty())
|
if (!eff->wavySave.empty())
|
||||||
{
|
{
|
||||||
if (wavyLerpIn < 1)
|
if (eff->wavyLerpIn < 1)
|
||||||
wavy[i].x = wavy[i].x*wavyLerpIn + (wavySave[i].x*(1.0f-wavyLerpIn));
|
eff->wavy[i].x = eff->wavy[i].x*eff->wavyLerpIn + (eff->wavySave[i].x*(1.0f-eff->wavyLerpIn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wavyLerpIn < 1)
|
if (eff->wavyLerpIn < 1)
|
||||||
{
|
{
|
||||||
wavyLerpIn += dt*lerpSpd;
|
eff->wavyLerpIn += dt*lerpSpd;
|
||||||
if (wavyLerpIn > 1)
|
if (eff->wavyLerpIn > 1)
|
||||||
wavyLerpIn = 1;
|
eff->wavyLerpIn = 1;
|
||||||
}
|
}
|
||||||
wavyAngleOffset += dt*spd;
|
eff->wavyAngleOffset += dt*spd;
|
||||||
if (wavyMagnitude > 0)
|
if (eff->wavyMagnitude > 0)
|
||||||
{
|
{
|
||||||
wavyMagnitude -= magRedSpd*dt;
|
eff->wavyMagnitude -= magRedSpd*dt;
|
||||||
if (wavyMagnitude < 0)
|
if (eff->wavyMagnitude < 0)
|
||||||
wavyMagnitude = 0;
|
eff->wavyMagnitude = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wavyMagnitude += magRedSpd*dt;
|
eff->wavyMagnitude += magRedSpd*dt;
|
||||||
if (wavyMagnitude > 0)
|
if (eff->wavyMagnitude > 0)
|
||||||
wavyMagnitude = 0;
|
eff->wavyMagnitude = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::cout << "setting grid from wav w/ wavyWaving\n";
|
//std::cout << "setting grid from wav w/ wavyWaving\n";
|
||||||
|
@ -194,24 +175,6 @@ void Element::updateEffects(float dt)
|
||||||
//std::cout << "not waving";
|
//std::cout << "not waving";
|
||||||
setGridFromWavy();
|
setGridFromWavy();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
for (int i = touchIdx; i < wavy.size()-1; i++)
|
|
||||||
{
|
|
||||||
wavyPull(i, i+1, dt);
|
|
||||||
}
|
|
||||||
for (int i = touchIdx; i >= 0; i--)
|
|
||||||
{
|
|
||||||
wavyPull(i, i-1, dt);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// normal down pull
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < wavy.size()-1; i++)
|
|
||||||
{
|
|
||||||
wavyPull(i, i+1, dt);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -224,16 +187,16 @@ void Element::update(float dt)
|
||||||
if (!core->particlesPaused)
|
if (!core->particlesPaused)
|
||||||
{
|
{
|
||||||
updateLife(dt);
|
updateLife(dt);
|
||||||
updateEffects(dt);
|
if (eff)
|
||||||
|
updateEffects(dt);
|
||||||
if (drawGrid)
|
if (drawGrid)
|
||||||
updateGrid(dt);
|
updateGrid(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// updateCullVariables();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Element::~Element()
|
Element::~Element()
|
||||||
{
|
{
|
||||||
|
freeEffectData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::destroy()
|
void Element::destroy()
|
||||||
|
@ -243,7 +206,7 @@ void Element::destroy()
|
||||||
|
|
||||||
int Element::getElementEffectIndex()
|
int Element::getElementEffectIndex()
|
||||||
{
|
{
|
||||||
return elementEffectIndex;
|
return eff ? eff->elementEffectIndex : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::setGridFromWavy()
|
void Element::setGridFromWavy()
|
||||||
|
@ -251,16 +214,18 @@ void Element::setGridFromWavy()
|
||||||
if (drawGrid)
|
if (drawGrid)
|
||||||
{
|
{
|
||||||
//std::cout << "set grid from wavy (" << xDivs << ", " << yDivs << ")\n"
|
//std::cout << "set grid from wavy (" << xDivs << ", " << yDivs << ")\n"
|
||||||
|
const float w = float(getWidth());
|
||||||
for (int x = 0; x < xDivs-1; x++)
|
for (int x = 0; x < xDivs-1; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < yDivs; y++)
|
for (int y = 0; y < yDivs; y++)
|
||||||
{
|
{
|
||||||
int wavy_y = (yDivs - y)-1;
|
const int wavy_y = (yDivs - y)-1;
|
||||||
if (wavy_y < wavy.size())
|
const float tmp = eff->wavy[wavy_y].x / w;
|
||||||
|
if (wavy_y < eff->wavy.size())
|
||||||
{
|
{
|
||||||
drawGrid[x][y].x = (wavy[wavy_y].x/float(getWidth()) - 0.5f);
|
|
||||||
drawGrid[x+1][y].x = (wavy[wavy_y].x/float(getWidth()) + 0.5f);
|
drawGrid[x][y].x = tmp - 0.5f;
|
||||||
|
drawGrid[x+1][y].x = tmp + 0.5f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,9 +244,9 @@ void Element::setElementEffectByIndex(int eidx)
|
||||||
alpha.stop();
|
alpha.stop();
|
||||||
alpha = 1;
|
alpha = 1;
|
||||||
|
|
||||||
elementEffectIndex = eidx;
|
|
||||||
|
|
||||||
ElementEffect e = dsq->getElementEffectByIndex(eidx);
|
ElementEffect e = dsq->getElementEffectByIndex(eidx);
|
||||||
|
if(e.type != EFX_NONE)
|
||||||
|
ensureEffectData();
|
||||||
|
|
||||||
switch(e.type)
|
switch(e.type)
|
||||||
{
|
{
|
||||||
|
@ -305,37 +270,32 @@ void Element::setElementEffectByIndex(int eidx)
|
||||||
sprintf(buf, "setting wavy segsy: %d radius: %d min: %d max: %d", e.segsy, e.wavy_radius, e.wavy_min, e.wavy_max);
|
sprintf(buf, "setting wavy segsy: %d radius: %d min: %d max: %d", e.segsy, e.wavy_radius, e.wavy_min, e.wavy_max);
|
||||||
debugLog(buf);
|
debugLog(buf);
|
||||||
*/
|
*/
|
||||||
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 < wavy.size(); i++)
|
for (int i = 0; i < eff->wavy.size(); i++)
|
||||||
{
|
{
|
||||||
wavy[i] = Vector(0, -(i*bity));
|
eff->wavy[i] = Vector(0, -(i*bity));
|
||||||
}
|
}
|
||||||
//wavySave = wavy;
|
eff->wavyFlip = e.wavy_flip;
|
||||||
wavyRadius = e.wavy_radius;
|
eff->wavyMin = bity;
|
||||||
wavyFlip = e.wavy_flip;
|
eff->wavyMax = bity*1.2f;
|
||||||
wavyMin = bity;
|
|
||||||
wavyMax = bity*1.2f;
|
|
||||||
|
|
||||||
//wavyRadius = 8;
|
|
||||||
|
|
||||||
createGrid(2, e.segsy);
|
createGrid(2, e.segsy);
|
||||||
|
|
||||||
setGridFromWavy();
|
setGridFromWavy();
|
||||||
|
|
||||||
//createGrid(8,8);
|
|
||||||
/*
|
|
||||||
wavyMin = e.wavy_min;
|
|
||||||
wavyMax = e.wavy_max;
|
|
||||||
*/
|
|
||||||
setStatic(false);
|
setStatic(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
freeEffectData();
|
||||||
setStatic(true);
|
setStatic(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
elementEffectType = e.type;
|
|
||||||
|
if (eff)
|
||||||
|
{
|
||||||
|
eff->elementEffectIndex = eidx;
|
||||||
|
eff->elementEffectType = e.type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::render()
|
void Element::render()
|
||||||
|
@ -364,32 +324,8 @@ void Element::render()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (this->elementEffectType == EFX_WAVY)
|
|
||||||
{
|
|
||||||
//debugLog("rendering efx_wavy");
|
|
||||||
}
|
|
||||||
|
|
||||||
Quad::render();
|
Quad::render();
|
||||||
|
|
||||||
/*
|
|
||||||
if (!wavy.empty())
|
|
||||||
{
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
Vector pos = position;
|
|
||||||
pos.y = position.y + (getHeight()*scale.y)/2.0f;
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
for (int i = 0; i < wavy.size()-1; i++)
|
|
||||||
{
|
|
||||||
glColor4f(1, 0, 0, 1);
|
|
||||||
glVertex3f(wavy[i].x+pos.x, wavy[i].y+pos.y, 0);
|
|
||||||
glVertex3f(wavy[i+1].x+pos.x, wavy[i+1].y+pos.y, 0);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
renderBorder = false;
|
renderBorder = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,19 +352,3 @@ void Element::fillGrid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// override this functionality as needed
|
|
||||||
bool Element::canSeeAvatar(Avatar *avatar)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Element::isActive()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Element::getSortDepth()
|
|
||||||
{
|
|
||||||
return Quad::getSortDepth() - bgLayer*0.01f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../BBGE/Quad.h"
|
#include "../BBGE/Quad.h"
|
||||||
|
|
||||||
class Avatar;
|
class Entity;
|
||||||
|
|
||||||
|
|
||||||
enum ElementFlag
|
enum ElementFlag
|
||||||
|
@ -42,50 +42,48 @@ enum ElementFlag
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ElementEffectData
|
||||||
|
{
|
||||||
|
ElementEffectData();
|
||||||
|
|
||||||
|
int elementEffectType;
|
||||||
|
float wavyAngleOffset, wavyMagnitude, wavyLerpIn;
|
||||||
|
float wavyMin, wavyMax;
|
||||||
|
float hitPerc, effectMult;
|
||||||
|
bool wavyWaving, wavyFlip, touching;
|
||||||
|
Vector touchVel;
|
||||||
|
std::vector<Vector> wavy, wavySave;
|
||||||
|
int elementEffectIndex; // used by editor only
|
||||||
|
};
|
||||||
|
|
||||||
class Element : public Quad
|
class Element : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Element();
|
Element();
|
||||||
~Element();
|
~Element();
|
||||||
void destroy();
|
void destroy();
|
||||||
//void interact(Interaction::Type interactionType, Avatar *avatar);
|
|
||||||
bool canSeeAvatar(Avatar *avatar);
|
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
bool isActive();
|
|
||||||
//InteractionContainer interactions;
|
|
||||||
int templateIdx;
|
int templateIdx;
|
||||||
int bgLayer;
|
int bgLayer;
|
||||||
Element *bgLayerNext;
|
Element *bgLayerNext;
|
||||||
float getSortDepth();
|
|
||||||
void render();
|
void render();
|
||||||
//Flags elementFlags;
|
|
||||||
ElementFlag elementFlag;
|
ElementFlag elementFlag;
|
||||||
void fillGrid();
|
void fillGrid();
|
||||||
bool isElementActive() { return elementActive; }
|
bool isElementActive() { return elementActive; }
|
||||||
int getElementEffectIndex();
|
int getElementEffectIndex();
|
||||||
void setElementEffectByIndex(int e);
|
void setElementEffectByIndex(int e);
|
||||||
void setElementActive(bool v) { elementActive = v; }
|
void setElementActive(bool v) { elementActive = v; }
|
||||||
|
void doInteraction(Entity *ent, float mult, float touchWidth);
|
||||||
protected:
|
protected:
|
||||||
|
void ensureEffectData();
|
||||||
|
void freeEffectData();
|
||||||
void setGridFromWavy();
|
void setGridFromWavy();
|
||||||
float wavyAngleOffset, wavyMagnitude, wavyLerpIn;
|
ElementEffectData *eff;
|
||||||
bool wavyWaving, wavyFlip;
|
|
||||||
void wavyPull(int to, int from, float dt);
|
|
||||||
std::vector<Vector> wavy, wavySave;
|
|
||||||
float wavyRadius, wavyMin, wavyMax;
|
|
||||||
void updateEffects(float dt);
|
void updateEffects(float dt);
|
||||||
int elementEffectIndex, elementEffectType;
|
|
||||||
bool elementActive;
|
bool elementActive;
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
class BoxElement : public Element
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BoxElement(int width, int height);
|
|
||||||
//bool isOnScreen();
|
|
||||||
protected:
|
|
||||||
int ww,hh;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef std::vector<Element*> ElementContainer;
|
typedef std::vector<Element*> ElementContainer;
|
||||||
|
|
||||||
|
|
|
@ -5789,6 +5789,7 @@ void Game::rebuildElementUpdateList()
|
||||||
dsq->getRenderObjectLayer(i)->update = false;
|
dsq->getRenderObjectLayer(i)->update = false;
|
||||||
|
|
||||||
elementUpdateList.clear();
|
elementUpdateList.clear();
|
||||||
|
elementInteractionList.clear();
|
||||||
for (int i = 0; i < dsq->getNumElements(); i++)
|
for (int i = 0; i < dsq->getNumElements(); i++)
|
||||||
//for (int i = LR_ELEMENTS1; i <= LR_ELEMENTS8; i++)
|
//for (int i = LR_ELEMENTS1; i <= LR_ELEMENTS8; i++)
|
||||||
{
|
{
|
||||||
|
@ -5800,6 +5801,11 @@ void Game::rebuildElementUpdateList()
|
||||||
{
|
{
|
||||||
elementUpdateList.push_back(e);
|
elementUpdateList.push_back(e);
|
||||||
}
|
}
|
||||||
|
ElementEffect ee = dsq->getElementEffectByIndex(e->getElementEffectIndex());
|
||||||
|
if(ee.type == EFX_WAVY)
|
||||||
|
{
|
||||||
|
elementInteractionList.push_back(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,12 +341,6 @@ enum EditorStates
|
||||||
ES_MAX
|
ES_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SelectionType
|
|
||||||
{
|
|
||||||
ST_SINGLE =0,
|
|
||||||
ST_MULTIPLE ,
|
|
||||||
ST_MAX
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class EntityClass
|
class EntityClass
|
||||||
|
@ -444,9 +438,6 @@ public:
|
||||||
|
|
||||||
EditTypes editType;
|
EditTypes editType;
|
||||||
EditorStates state;
|
EditorStates state;
|
||||||
Quad *target;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Element *getElementAtCursor();
|
Element *getElementAtCursor();
|
||||||
Entity *getEntityAtCursor();
|
Entity *getEntityAtCursor();
|
||||||
|
@ -459,7 +450,6 @@ public:
|
||||||
Element *editingElement;
|
Element *editingElement;
|
||||||
Entity *editingEntity;
|
Entity *editingEntity;
|
||||||
Path *editingPath;
|
Path *editingPath;
|
||||||
SelectionType selectionType;
|
|
||||||
|
|
||||||
void toggleWarpAreaRender();
|
void toggleWarpAreaRender();
|
||||||
int selectedIdx;
|
int selectedIdx;
|
||||||
|
@ -521,19 +511,15 @@ protected:
|
||||||
void editModeElements();
|
void editModeElements();
|
||||||
void editModeEntities();
|
void editModeEntities();
|
||||||
void editModePaths();
|
void editModePaths();
|
||||||
int selectedType, possibleSelectedType;
|
|
||||||
|
|
||||||
void deleteSelected();
|
void deleteSelected();
|
||||||
void cloneSelectedElement();
|
void cloneSelectedElement();
|
||||||
void cloneSelectedElementInput();
|
|
||||||
void enterScaleState();
|
void enterScaleState();
|
||||||
void enterRotateState();
|
void enterRotateState();
|
||||||
void enterMoveState();
|
void enterMoveState();
|
||||||
|
|
||||||
Vector oldPosition, oldRotation, oldScale, cursorOffset;
|
Vector oldPosition, oldRotation, oldScale, cursorOffset;
|
||||||
|
|
||||||
RenderObject *getSelectedRenderObject();
|
|
||||||
|
|
||||||
Entity *movingEntity;
|
Entity *movingEntity;
|
||||||
void updateDrawingWarpArea(char c, int k);
|
void updateDrawingWarpArea(char c, int k);
|
||||||
char drawingWarpArea;
|
char drawingWarpArea;
|
||||||
|
@ -582,7 +568,7 @@ protected:
|
||||||
typedef std::vector<Quad*> QuadList;
|
typedef std::vector<Quad*> QuadList;
|
||||||
typedef std::vector<QuadList> QuadArray;
|
typedef std::vector<QuadList> QuadArray;
|
||||||
|
|
||||||
typedef std::list<Element*> ElementUpdateList;
|
typedef std::vector<Element*> ElementUpdateList;
|
||||||
|
|
||||||
// Note: although this is a bitmask, only one of these values may be set at a time!
|
// Note: although this is a bitmask, only one of these values may be set at a time!
|
||||||
enum ObsType
|
enum ObsType
|
||||||
|
@ -975,6 +961,7 @@ public:
|
||||||
GridRender *gridRender, *gridRender2, *gridRender3, *edgeRender, *gridRenderEnt;
|
GridRender *gridRender, *gridRender2, *gridRender3, *edgeRender, *gridRenderEnt;
|
||||||
void toggleGridRender();
|
void toggleGridRender();
|
||||||
ElementUpdateList elementUpdateList;
|
ElementUpdateList elementUpdateList;
|
||||||
|
ElementUpdateList elementInteractionList;
|
||||||
|
|
||||||
bool invinciblity;
|
bool invinciblity;
|
||||||
|
|
||||||
|
|
|
@ -574,20 +574,12 @@ void SceneEditor::init()
|
||||||
selectedElements.clear();
|
selectedElements.clear();
|
||||||
autoSaveTimer = 0;
|
autoSaveTimer = 0;
|
||||||
skinMinX = skinMinY = skinMaxX = skinMaxY = -1;
|
skinMinX = skinMinY = skinMaxX = skinMaxY = -1;
|
||||||
selectionType = ST_SINGLE;
|
|
||||||
editingElement = 0;
|
editingElement = 0;
|
||||||
editingEntity = 0;
|
editingEntity = 0;
|
||||||
pathRender = new PathRender();
|
pathRender = new PathRender();
|
||||||
core->getTopStateData()->addRenderObject(pathRender, LR_DEBUG_TEXT);
|
core->getTopStateData()->addRenderObject(pathRender, LR_DEBUG_TEXT);
|
||||||
pathRender->alpha = 0;
|
pathRender->alpha = 0;
|
||||||
|
|
||||||
selectedType = -1;
|
|
||||||
possibleSelectedType = -1;
|
|
||||||
|
|
||||||
target = new Quad;
|
|
||||||
//target->setTexture("target");
|
|
||||||
core->getTopStateData()->addRenderObject(target, LR_HUD);
|
|
||||||
target->alpha = 0;
|
|
||||||
editType = ET_ELEMENTS;
|
editType = ET_ELEMENTS;
|
||||||
state = ES_SELECTING;
|
state = ES_SELECTING;
|
||||||
drawingWarpArea = 'N';
|
drawingWarpArea = 'N';
|
||||||
|
@ -1026,7 +1018,6 @@ void SceneEditor::moveToBack()
|
||||||
void SceneEditor::editModeElements()
|
void SceneEditor::editModeElements()
|
||||||
{
|
{
|
||||||
selectedIdx = -1;
|
selectedIdx = -1;
|
||||||
target->alpha.interpolateTo(0, 0.5);
|
|
||||||
editType = ET_ELEMENTS;
|
editType = ET_ELEMENTS;
|
||||||
if (curElement < dsq->game->elementTemplates.size())
|
if (curElement < dsq->game->elementTemplates.size())
|
||||||
{
|
{
|
||||||
|
@ -1035,6 +1026,8 @@ void SceneEditor::editModeElements()
|
||||||
}
|
}
|
||||||
placer->alpha = 0.5;
|
placer->alpha = 0.5;
|
||||||
pathRender->alpha = 0;
|
pathRender->alpha = 0;
|
||||||
|
editingEntity = NULL;
|
||||||
|
editingPath = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditor::editModeEntities()
|
void SceneEditor::editModeEntities()
|
||||||
|
@ -1048,15 +1041,20 @@ void SceneEditor::editModeEntities()
|
||||||
placer->setTexture(selectedEntity.prevGfx);
|
placer->setTexture(selectedEntity.prevGfx);
|
||||||
placer->alpha = 0.5;
|
placer->alpha = 0.5;
|
||||||
pathRender->alpha = 0;
|
pathRender->alpha = 0;
|
||||||
|
selectedElements.clear();
|
||||||
|
editingElement = NULL;
|
||||||
|
editingPath = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditor::editModePaths()
|
void SceneEditor::editModePaths()
|
||||||
{
|
{
|
||||||
selectedIdx = -1;
|
selectedIdx = -1;
|
||||||
target->alpha.interpolateTo(0, 0.5);
|
|
||||||
editType = ET_PATHS;
|
editType = ET_PATHS;
|
||||||
placer->alpha = 0;
|
placer->alpha = 0;
|
||||||
pathRender->alpha = 0.5;
|
pathRender->alpha = 0.5;
|
||||||
|
selectedElements.clear();
|
||||||
|
editingElement = NULL;
|
||||||
|
editingEntity = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Element *SceneEditor::getElementAtCursor()
|
Element *SceneEditor::getElementAtCursor()
|
||||||
|
@ -1128,23 +1126,6 @@ void SceneEditor::deleteSelected()
|
||||||
editingElement = 0;
|
editingElement = 0;
|
||||||
dsq->game->reconstructGrid();
|
dsq->game->reconstructGrid();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
RenderObject *r = getSelectedRenderObject();
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
if (dynamic_cast<Element*>(r))
|
|
||||||
{
|
|
||||||
deleteSelectedElement();
|
|
||||||
}
|
|
||||||
Entity *ent = 0;
|
|
||||||
if (ent=dynamic_cast<Entity*>(r))
|
|
||||||
{
|
|
||||||
dsq->game->removeEntity(ent);
|
|
||||||
//removeEntity();
|
|
||||||
}
|
|
||||||
selectedIdx = -1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else if (editType == ET_ENTITIES)
|
else if (editType == ET_ENTITIES)
|
||||||
{
|
{
|
||||||
|
@ -1218,23 +1199,6 @@ void SceneEditor::updateSaveFileEnemyPosition(Entity *ent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderObject *SceneEditor::getSelectedRenderObject()
|
|
||||||
{
|
|
||||||
if (editType == ET_ELEMENTS)
|
|
||||||
{
|
|
||||||
if (selectedIdx > -1)
|
|
||||||
{
|
|
||||||
if (selectedType == 0)
|
|
||||||
return dsq->getElement(selectedIdx);
|
|
||||||
/*
|
|
||||||
else if (selectedType == 1)
|
|
||||||
return dsq->entities[selectedIdx];
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::checkForRebuild()
|
void SceneEditor::checkForRebuild()
|
||||||
{
|
{
|
||||||
if (editType == ET_ELEMENTS && state != ES_SELECTING && !selectedElements.empty())
|
if (editType == ET_ELEMENTS && state != ES_SELECTING && !selectedElements.empty())
|
||||||
|
@ -1276,14 +1240,6 @@ void SceneEditor::exitMoveState()
|
||||||
|
|
||||||
void SceneEditor::enterMoveState()
|
void SceneEditor::enterMoveState()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (editType == ET_ELEMENTS && state == ES_SELECTING && selectedIdx > -1)
|
|
||||||
{
|
|
||||||
state = ES_MOVING;
|
|
||||||
oldPosition = getSelectedRenderObject()->position;
|
|
||||||
cursorOffset = getSelectedRenderObject()->position - dsq->getGameCursorPosition();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (state != ES_SELECTING) return;
|
if (state != ES_SELECTING) return;
|
||||||
state = ES_MOVING;
|
state = ES_MOVING;
|
||||||
if (editType == ET_ELEMENTS)
|
if (editType == ET_ELEMENTS)
|
||||||
|
@ -1324,16 +1280,6 @@ void SceneEditor::enterMoveState()
|
||||||
|
|
||||||
void SceneEditor::enterRotateState()
|
void SceneEditor::enterRotateState()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (editType == ET_ELEMENTS && state == ES_SELECTING && selectedIdx > -1)
|
|
||||||
{
|
|
||||||
state = ES_ROTATING;
|
|
||||||
oldRotation = getSelectedRenderObject()->rotation;
|
|
||||||
//cursorOffset = getSelectedRenderObject()->position - dsq->getGameCursorPosition();
|
|
||||||
//cursorOffset = Vector(0,0);
|
|
||||||
cursorOffset = dsq->getGameCursorPosition();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (state != ES_SELECTING) return;
|
if (state != ES_SELECTING) return;
|
||||||
if (editType == ET_ENTITIES)
|
if (editType == ET_ENTITIES)
|
||||||
{
|
{
|
||||||
|
@ -1365,8 +1311,6 @@ void SceneEditor::enterRotateState()
|
||||||
{
|
{
|
||||||
state = ES_ROTATING;
|
state = ES_ROTATING;
|
||||||
oldRotation = editingElement->rotation;
|
oldRotation = editingElement->rotation;
|
||||||
//cursorOffset = getSelectedRenderObject()->position - dsq->getGameCursorPosition();
|
|
||||||
//cursorOffset = Vector(0,0);
|
|
||||||
cursorOffset = dsq->getGameCursorPosition();
|
cursorOffset = dsq->getGameCursorPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1374,15 +1318,6 @@ void SceneEditor::enterRotateState()
|
||||||
|
|
||||||
void SceneEditor::enterScaleState()
|
void SceneEditor::enterScaleState()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (editType == ET_ELEMENTS && state == ES_SELECTING && selectedIdx > -1)
|
|
||||||
{
|
|
||||||
state = ES_SCALING;
|
|
||||||
oldScale = getSelectedRenderObject()->scale;
|
|
||||||
//cursorOffset = getSelectedRenderObject()->position - dsq->getGameCursorPosition();
|
|
||||||
cursorOffset = dsq->getGameCursorPosition();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (state != ES_SELECTING) return;
|
if (state != ES_SELECTING) return;
|
||||||
if (editType == ET_ELEMENTS)
|
if (editType == ET_ELEMENTS)
|
||||||
{
|
{
|
||||||
|
@ -1523,41 +1458,11 @@ void SceneEditor::mouseButtonRightUp()
|
||||||
//dsq->game->reconstructGrid();
|
//dsq->game->reconstructGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void SceneEditor::toggleElementFlag1()
|
|
||||||
{
|
|
||||||
if (editingElement)
|
|
||||||
{
|
|
||||||
editingElement->setFlag("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::toggleElementFlag2()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::toggleElementFlag3()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::toggleElementFlag4()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::toggleElementFlag5()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void SceneEditor::toggleElementSolid()
|
void SceneEditor::toggleElementSolid()
|
||||||
{
|
{
|
||||||
if (editingElement)
|
if (editingElement)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
TileVector t(editingElement->position);
|
|
||||||
editingElement->position = t.worldVector();
|
|
||||||
*/
|
|
||||||
|
|
||||||
switch(editingElement->elementFlag)
|
switch(editingElement->elementFlag)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -1623,35 +1528,6 @@ void SceneEditor::mouseButtonLeft()
|
||||||
enterMoveState();
|
enterMoveState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (!selectedElements.empty())
|
|
||||||
{
|
|
||||||
enterMoveState();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if (state == ES_MOVING || state == ES_ROTATING || state == ES_SCALING)
|
|
||||||
{
|
|
||||||
if (selectedIdx != -1)
|
|
||||||
{
|
|
||||||
if (selectedType == 1)
|
|
||||||
{
|
|
||||||
RenderObject *r = getSelectedRenderObject();
|
|
||||||
Entity *e = dynamic_cast<Entity*>(r);
|
|
||||||
if (e)
|
|
||||||
{
|
|
||||||
updateSaveFileEnemyPosition(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state = ES_SELECTING;
|
|
||||||
//selectedIdx = -1;
|
|
||||||
}
|
|
||||||
else if (state == ES_SELECTING)
|
|
||||||
{
|
|
||||||
placeElement();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else if (editType == ET_ENTITIES)
|
else if (editType == ET_ENTITIES)
|
||||||
{
|
{
|
||||||
|
@ -1685,29 +1561,6 @@ void SceneEditor::mouseButtonLeft()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (selectedIdx != -1)
|
|
||||||
{
|
|
||||||
if (selectedIdx >= 0 && selectedIdx < dsq->game->getNumPaths())
|
|
||||||
{
|
|
||||||
Path *p = dsq->game->getPath(selectedIdx);
|
|
||||||
PathNode n;
|
|
||||||
n.position = dsq->getGameCursorPosition();
|
|
||||||
p->nodes.push_back(n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (selectedIdx != -1)
|
|
||||||
{
|
|
||||||
if (selectedIdx >= 0 && selectedIdx < dsq->game->getNumPaths())
|
|
||||||
{
|
|
||||||
Path *p = dsq->game->getPath(selectedIdx);
|
|
||||||
p->nodes[selectedNode] =
|
|
||||||
PathNode n;
|
|
||||||
n.position = dsq->getGameCursorPosition();
|
|
||||||
p->nodes.push_back(n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1746,27 +1599,6 @@ void SceneEditor::mouseButtonRight()
|
||||||
else
|
else
|
||||||
enterRotateState();
|
enterRotateState();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
switch(state)
|
|
||||||
{
|
|
||||||
case ES_SELECTING:
|
|
||||||
selectedType = possibleSelectedType;
|
|
||||||
selectedIdx = possibleSelectedIdx;
|
|
||||||
break;
|
|
||||||
case ES_MOVING:
|
|
||||||
getSelectedRenderObject()->position = oldPosition;
|
|
||||||
state = ES_SELECTING;
|
|
||||||
break;
|
|
||||||
case ES_ROTATING:
|
|
||||||
getSelectedRenderObject()->rotation = oldRotation;
|
|
||||||
state = ES_SELECTING;
|
|
||||||
break;
|
|
||||||
case ES_SCALING:
|
|
||||||
getSelectedRenderObject()->scale = oldScale;
|
|
||||||
state = ES_SELECTING;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if (editType == ET_ELEMENTS && state == ES_MOVING)
|
if (editType == ET_ELEMENTS && state == ES_MOVING)
|
||||||
{
|
{
|
||||||
|
@ -1875,11 +1707,6 @@ void SceneEditor::skinLevel(pngRawInfo *png, int minX, int minY, int maxX, int m
|
||||||
{
|
{
|
||||||
e->safeKill();
|
e->safeKill();
|
||||||
deleteElements.push_back(e);
|
deleteElements.push_back(e);
|
||||||
/*
|
|
||||||
e->setLife(0.1);
|
|
||||||
e->setDecayRate(1);
|
|
||||||
deleteElements.push_back(e);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < deleteElements.size(); i++)
|
for (i = 0; i < deleteElements.size(); i++)
|
||||||
|
@ -2260,14 +2087,6 @@ void SceneEditor::generateLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
dsq->game->addObsRow(rows[i].x1/TILE_SIZE, rows[i].y/TILE_SIZE, w/TILE_SIZE);
|
dsq->game->addObsRow(rows[i].x1/TILE_SIZE, rows[i].y/TILE_SIZE, w/TILE_SIZE);
|
||||||
/*
|
|
||||||
BoxElement *box = new BoxElement(w,h);
|
|
||||||
|
|
||||||
box->position = Vector(rows[i].x1 + int(w/2), useY);
|
|
||||||
box->position.z = boxElementZ;
|
|
||||||
dsq->game->addRenderObject(box, BLACKGROUND);
|
|
||||||
dsq->elements.push_back(box);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dsq->game->reconstructGrid(true);
|
dsq->game->reconstructGrid(true);
|
||||||
|
@ -2358,6 +2177,9 @@ void SceneEditor::scaleElement1()
|
||||||
|
|
||||||
void SceneEditor::flipElementHorz()
|
void SceneEditor::flipElementHorz()
|
||||||
{
|
{
|
||||||
|
if (editType != ET_ELEMENTS)
|
||||||
|
return;
|
||||||
|
|
||||||
if (editingElement)
|
if (editingElement)
|
||||||
editingElement->flipHorizontal();
|
editingElement->flipHorizontal();
|
||||||
else
|
else
|
||||||
|
@ -2366,6 +2188,9 @@ void SceneEditor::flipElementHorz()
|
||||||
|
|
||||||
void SceneEditor::flipElementVert()
|
void SceneEditor::flipElementVert()
|
||||||
{
|
{
|
||||||
|
if (editType != ET_ELEMENTS)
|
||||||
|
return;
|
||||||
|
|
||||||
if (editingElement)
|
if (editingElement)
|
||||||
editingElement->flipVertical();
|
editingElement->flipVertical();
|
||||||
else
|
else
|
||||||
|
@ -2687,8 +2512,6 @@ void prevEntityPage()
|
||||||
createEntityPage();
|
createEntityPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
//page = game->entityGroups.begin();
|
|
||||||
|
|
||||||
void SceneEditor::selectEntityFromGroups()
|
void SceneEditor::selectEntityFromGroups()
|
||||||
{
|
{
|
||||||
createEntityPage();
|
createEntityPage();
|
||||||
|
@ -2697,24 +2520,11 @@ void SceneEditor::selectEntityFromGroups()
|
||||||
se_changedEntityType = false;
|
se_changedEntityType = false;
|
||||||
editType = ET_SELECTENTITY;
|
editType = ET_SELECTENTITY;
|
||||||
|
|
||||||
|
|
||||||
//bool done = false;
|
|
||||||
//bool mbrd = false;
|
|
||||||
bool mbld = false;
|
bool mbld = false;
|
||||||
bool ld = false, rd = false;
|
bool ld = false, rd = false;
|
||||||
ld = core->getKeyState(KEY_E);
|
ld = core->getKeyState(KEY_E);
|
||||||
while (!se_changedEntityType)
|
while (!se_changedEntityType)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (core->mouse.buttons.right && !mbrd)
|
|
||||||
mbrd = true;
|
|
||||||
else if (!core->mouse.buttons.right && mbrd)
|
|
||||||
{
|
|
||||||
mbrd = false;
|
|
||||||
nextEntityPage();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (core->mouse.buttons.left && !mbld)
|
if (core->mouse.buttons.left && !mbld)
|
||||||
mbld = true;
|
mbld = true;
|
||||||
else if (!core->mouse.buttons.left && mbld)
|
else if (!core->mouse.buttons.left && mbld)
|
||||||
|
@ -2831,26 +2641,7 @@ void SceneEditor::nextElement()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editType == ET_ENTITIES)
|
if (editType == ET_ELEMENTS)
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (editingEntity)
|
|
||||||
{
|
|
||||||
// swap entity type up (somehow)
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curEntity++;
|
|
||||||
|
|
||||||
if (curEntity >= dsq->game->entityTypeList.size())
|
|
||||||
curEntity = 0;
|
|
||||||
|
|
||||||
updateEntityPlacer();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (editType == ET_ELEMENTS)
|
|
||||||
{
|
{
|
||||||
if (dsq->game->elementTemplates.empty()) return;
|
if (dsq->game->elementTemplates.empty()) return;
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
|
@ -2888,7 +2679,6 @@ void SceneEditor::nextElement()
|
||||||
|
|
||||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||||
{
|
{
|
||||||
//int idx = dsq->game->elementTemplates[curElement].idx;
|
|
||||||
placer->setTexture(dsq->game->elementTemplates[curElement].gfx);
|
placer->setTexture(dsq->game->elementTemplates[curElement].gfx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2912,28 +2702,8 @@ void SceneEditor::prevElement()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (editType == ET_ENTITIES)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (editingEntity)
|
|
||||||
{
|
|
||||||
// swap entity type up (somehow)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curEntity--;
|
|
||||||
|
|
||||||
if (curEntity < 0)
|
if (editType == ET_ELEMENTS)
|
||||||
curEntity = dsq->game->entityTypeList.size()-1;
|
|
||||||
|
|
||||||
updateEntityPlacer();
|
|
||||||
|
|
||||||
|
|
||||||
//dsq->game->entityTypeList
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (editType == ET_ELEMENTS)
|
|
||||||
{
|
{
|
||||||
if (dsq->game->elementTemplates.empty()) return;
|
if (dsq->game->elementTemplates.empty()) return;
|
||||||
if (!selectedElements.empty())
|
if (!selectedElements.empty())
|
||||||
|
@ -2967,7 +2737,6 @@ void SceneEditor::doPrevElement()
|
||||||
|
|
||||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||||
{
|
{
|
||||||
//int idx = dsq->game->elementTemplates[curElement].idx;
|
|
||||||
placer->setTexture(dsq->game->elementTemplates[curElement].gfx);
|
placer->setTexture(dsq->game->elementTemplates[curElement].gfx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2997,29 +2766,6 @@ void SceneEditor::moveLayer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
int realLayer1 = LR_ELEMENTS1 + fromLayer, realLayer2 = LR_ELEMENTS1 + toLayer;
|
|
||||||
std::vector<RenderObject*> move;
|
|
||||||
for (int i = 0; i < dsq->renderObjectLayers[realLayer1].renderObjects.size(); i++)
|
|
||||||
{
|
|
||||||
RenderObject *r = dsq->renderObjectLayers[realLayer1].renderObjects[i];
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
move.push_back(r);
|
|
||||||
core->removeRenderObject(r, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
|
||||||
//dsq->renderObjectLayers[realLayer1].renderObjects[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < move.size(); i++)
|
|
||||||
{
|
|
||||||
RenderObject *r = move[i];
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
r->layer = realLayer2;
|
|
||||||
dsq->addRenderObject(r, realLayer2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3070,8 +2816,6 @@ void SceneEditor::placeElement()
|
||||||
{
|
{
|
||||||
if (!core->getShiftState() && !core->getKeyState(KEY_LALT) && !drawingBox)
|
if (!core->getShiftState() && !core->getKeyState(KEY_LALT) && !drawingBox)
|
||||||
{
|
{
|
||||||
//errorLog("placeElement");
|
|
||||||
|
|
||||||
dsq->game->createElement(dsq->game->elementTemplates[curElement].idx, placer->position, bgLayer, placer);
|
dsq->game->createElement(dsq->game->elementTemplates[curElement].idx, placer->position, bgLayer, placer);
|
||||||
updateText();
|
updateText();
|
||||||
dsq->game->reconstructGrid();
|
dsq->game->reconstructGrid();
|
||||||
|
@ -3104,29 +2848,10 @@ void SceneEditor::placeElement()
|
||||||
{
|
{
|
||||||
p->addNode(selectedNode);
|
p->addNode(selectedNode);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (selectedIdx >= 0 && selectedIdx < dsq->game->getNumPaths())
|
|
||||||
{
|
|
||||||
Path *p = dsq->game->getPath(selectedIdx);
|
|
||||||
PathNode n;
|
|
||||||
n.position = dsq->getGameCursorPosition();
|
|
||||||
p->nodes.push_back(n);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditor::cloneSelectedElementInput()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (core->getShiftState())
|
|
||||||
{
|
|
||||||
cloneSelectedElement();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::cloneSelectedElement()
|
void SceneEditor::cloneSelectedElement()
|
||||||
{
|
{
|
||||||
if (editType == ET_ELEMENTS)
|
if (editType == ET_ELEMENTS)
|
||||||
|
@ -3180,15 +2905,6 @@ void SceneEditor::cloneSelectedElement()
|
||||||
newp->init();
|
newp->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (selectedIdx > -1)
|
|
||||||
{
|
|
||||||
Element *e1 = dsq->elements[selectedIdx];
|
|
||||||
Element *e = dsq->game->createElement(e1->templateIdx, placer->position, e1->layer-LR_ELEMENTS1, getSelectedRenderObject());
|
|
||||||
selectedIdx = dsq->elements.size()-1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditor::shutdown()
|
void SceneEditor::shutdown()
|
||||||
|
@ -3265,7 +2981,6 @@ void SceneEditor::toggle(bool on)
|
||||||
text->alpha.interpolateTo(0, 0.2);
|
text->alpha.interpolateTo(0, 0.2);
|
||||||
placer->alpha.interpolateTo(0, 0.2);
|
placer->alpha.interpolateTo(0, 0.2);
|
||||||
//core->flags.unset(CF_CLEARBUFFERS);
|
//core->flags.unset(CF_CLEARBUFFERS);
|
||||||
target->alpha = 0;
|
|
||||||
dsq->darkLayer.toggle(true);
|
dsq->darkLayer.toggle(true);
|
||||||
|
|
||||||
dsq->game->rebuildElementUpdateList();
|
dsq->game->rebuildElementUpdateList();
|
||||||
|
@ -3400,14 +3115,6 @@ void SceneEditor::endDrawingWarpArea(char c)
|
||||||
a.sceneName = dsq->getUserInputString("Enter map to warp to");
|
a.sceneName = dsq->getUserInputString("Enter map to warp to");
|
||||||
a.spawnOffset = dsq->getUserInputDirection("Enter warp direction");
|
a.spawnOffset = dsq->getUserInputDirection("Enter warp direction");
|
||||||
dsq->game->warpAreas.push_back(a);
|
dsq->game->warpAreas.push_back(a);
|
||||||
/*
|
|
||||||
BoxElement *boxElement = new BoxElement(boxPromo->width.getValue(), boxPromo->height.getValue());
|
|
||||||
boxElement->position = boxPromo->position;
|
|
||||||
boxElement->position.z = boxElementZ;
|
|
||||||
dsq->game->addRenderObject(boxElement, BLACKGROUND);
|
|
||||||
dsq->elements.push_back(boxElement);
|
|
||||||
dsq->game->reconstructGrid();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3482,9 +3189,6 @@ void SceneEditor::update(float dt)
|
||||||
Vector p = Vector(cursorTile.x*TILE_SIZE+TILE_SIZE/2, cursorTile.y*TILE_SIZE+TILE_SIZE/2);
|
Vector p = Vector(cursorTile.x*TILE_SIZE+TILE_SIZE/2, cursorTile.y*TILE_SIZE+TILE_SIZE/2);
|
||||||
placer->position = p;
|
placer->position = p;
|
||||||
|
|
||||||
|
|
||||||
//selectedIdx = idx;
|
|
||||||
|
|
||||||
int camSpeed = 500/zoom.x;
|
int camSpeed = 500/zoom.x;
|
||||||
if (core->getShiftState())
|
if (core->getShiftState())
|
||||||
camSpeed = 5000/zoom.x;
|
camSpeed = 5000/zoom.x;
|
||||||
|
@ -3533,19 +3237,6 @@ void SceneEditor::update(float dt)
|
||||||
dsq->cameraPos.y += mouseY/oldZoom.y - mouseY/zoom.y;
|
dsq->cameraPos.y += mouseY/oldZoom.y - mouseY/zoom.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < dsq->elements.size(); i++)
|
|
||||||
{
|
|
||||||
//dsq->elements[i]->flags.unset(RO_RENDERBORDERS);
|
|
||||||
dsq->elements[i]->renderBorders = false;
|
|
||||||
}
|
|
||||||
RenderObject *r;
|
|
||||||
if (r = getSelectedRenderObject())
|
|
||||||
{
|
|
||||||
//r->flags.set(RO_RENDERBORDERS);
|
|
||||||
r->renderBorders = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (this->editType == ET_PATHS)
|
if (this->editType == ET_PATHS)
|
||||||
{
|
{
|
||||||
switch(state)
|
switch(state)
|
||||||
|
@ -3574,23 +3265,26 @@ void SceneEditor::update(float dt)
|
||||||
break;
|
break;
|
||||||
case ES_SCALING:
|
case ES_SCALING:
|
||||||
{
|
{
|
||||||
float factor = 1;
|
if (editingPath)
|
||||||
Vector add = Vector((dsq->getGameCursorPosition().x - cursorOffset.x)*factor,
|
{
|
||||||
(dsq->getGameCursorPosition().y - cursorOffset.y)*factor);
|
float factor = 1;
|
||||||
//editingElement->scale=oldScale + add;
|
Vector add = Vector((dsq->getGameCursorPosition().x - cursorOffset.x)*factor,
|
||||||
Vector sz = oldScale + add;
|
(dsq->getGameCursorPosition().y - cursorOffset.y)*factor);
|
||||||
if (sz.x < 32)
|
Vector sz = oldScale + add;
|
||||||
sz.x = 32;
|
if (sz.x < 32)
|
||||||
if (sz.y < 32)
|
sz.x = 32;
|
||||||
sz.y = 32;
|
if (sz.y < 32)
|
||||||
editingPath->rect.x1 = -sz.x/2;
|
sz.y = 32;
|
||||||
editingPath->rect.x2 = sz.x/2;
|
editingPath->rect.x1 = -sz.x/2;
|
||||||
editingPath->rect.y1 = -sz.y/2;
|
editingPath->rect.x2 = sz.x/2;
|
||||||
editingPath->rect.y2 = sz.y/2;
|
editingPath->rect.y1 = -sz.y/2;
|
||||||
|
editingPath->rect.y2 = sz.y/2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ES_MOVING:
|
case ES_MOVING:
|
||||||
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
if (selectedIdx >= 0)
|
||||||
|
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3599,27 +3293,24 @@ void SceneEditor::update(float dt)
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
case ES_MOVING:
|
case ES_MOVING:
|
||||||
editingEntity->position = dsq->getGameCursorPosition() + cursorOffset;
|
if (editingEntity)
|
||||||
/*
|
editingEntity->position = dsq->getGameCursorPosition() + cursorOffset;
|
||||||
if (core->getShiftState())
|
|
||||||
{
|
|
||||||
TileVector t(getSelectedRenderObject()->position);
|
|
||||||
getSelectedRenderObject()->position = t.worldVector();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case ES_ROTATING:
|
case ES_ROTATING:
|
||||||
{
|
{
|
||||||
float add = (dsq->getGameCursorPosition().x - cursorOffset.x)/2.4f;
|
if (editingEntity)
|
||||||
if (core->getCtrlState())
|
|
||||||
{
|
{
|
||||||
int a = (oldRotation.z + add)/45;
|
float add = (dsq->getGameCursorPosition().x - cursorOffset.x)/2.4f;
|
||||||
add = a * 45;
|
if (core->getCtrlState())
|
||||||
editingEntity->rotation.z = add;
|
{
|
||||||
}
|
int a = (oldRotation.z + add)/45;
|
||||||
else
|
add = a * 45;
|
||||||
{
|
editingEntity->rotation.z = add;
|
||||||
editingEntity->rotation.z = oldRotation.z + add;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
editingEntity->rotation.z = oldRotation.z + add;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3640,37 +3331,12 @@ void SceneEditor::update(float dt)
|
||||||
{
|
{
|
||||||
closest = len;
|
closest = len;
|
||||||
idx = i;
|
idx = i;
|
||||||
possibleSelectedType = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
FOR_ENTITIES(i)
|
|
||||||
{
|
|
||||||
Entity *e = *i;
|
|
||||||
Vector dist = e->position - dsq->getGameCursorPosition();
|
|
||||||
int len = dist.getSquaredLength2D();
|
|
||||||
if ((len < closest || closest == -1))
|
|
||||||
{
|
|
||||||
closest = len;
|
|
||||||
idx = i;
|
|
||||||
possibleSelectedType = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
possibleSelectedIdx = idx;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ES_MOVING:
|
case ES_MOVING:
|
||||||
updateSelectedElementPosition(dsq->getGameCursorPosition() - cursorOffset);
|
updateSelectedElementPosition(dsq->getGameCursorPosition() - cursorOffset);
|
||||||
/*
|
|
||||||
if (core->getShiftState())
|
|
||||||
{
|
|
||||||
TileVector t(getSelectedRenderObject()->position);
|
|
||||||
getSelectedRenderObject()->position = t.worldVector();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case ES_ROTATING:
|
case ES_ROTATING:
|
||||||
{
|
{
|
||||||
|
@ -3808,20 +3474,6 @@ void SceneEditor::update(float dt)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RenderObject *r = getSelectedRenderObject();
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
target->position = r->position;
|
|
||||||
target->alpha = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
target->alpha = 0;
|
|
||||||
/*
|
|
||||||
if (movingEntity)
|
|
||||||
{
|
|
||||||
movingEntity->position = dsq->getGameCursorPosition();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3836,16 +3488,6 @@ void SceneEditor::nextEntityType()
|
||||||
exitMoveState();
|
exitMoveState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (editType == ET_ENTITIES)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
selectedEntityType++;
|
|
||||||
if (selectedEntityType>=dsq->game->entityTypeList.size())
|
|
||||||
{
|
|
||||||
selectedEntityType = 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (editType == ET_SELECTENTITY)
|
else if (editType == ET_SELECTENTITY)
|
||||||
{
|
{
|
||||||
nextEntityPage();
|
nextEntityPage();
|
||||||
|
@ -3863,16 +3505,6 @@ void SceneEditor::prevEntityType()
|
||||||
exitMoveState();
|
exitMoveState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (editType == ET_ENTITIES)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
selectedEntityType --;
|
|
||||||
if (selectedEntityType < 0)
|
|
||||||
{
|
|
||||||
selectedEntityType = dsq->game->entityTypeList.size()-1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (editType == ET_SELECTENTITY)
|
else if (editType == ET_SELECTENTITY)
|
||||||
{
|
{
|
||||||
prevEntityPage();
|
prevEntityPage();
|
||||||
|
|
|
@ -3572,7 +3572,7 @@ luaFunc(entity_isUnderWater)
|
||||||
bool b = false;
|
bool b = false;
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
b = e->isUnderWater();
|
b = e->isUnderWater(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3)));
|
||||||
}
|
}
|
||||||
luaReturnBool(b);
|
luaReturnBool(b);
|
||||||
}
|
}
|
||||||
|
@ -5146,6 +5146,31 @@ luaFunc(entity_applySurfaceNormalForce)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_doElementInteraction)
|
||||||
|
{
|
||||||
|
Entity *e = entity(L);
|
||||||
|
if (e)
|
||||||
|
{
|
||||||
|
float mult = lua_tonumber(L, 2);
|
||||||
|
float touchWidth = lua_tonumber(L, 3);
|
||||||
|
if (!touchWidth)
|
||||||
|
touchWidth = 16;
|
||||||
|
|
||||||
|
ElementUpdateList& elems = dsq->game->elementUpdateList;
|
||||||
|
for (ElementUpdateList::iterator it = elems.begin(); it != elems.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->doInteraction(e, mult, touchWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(avatar_setElementEffectMult)
|
||||||
|
{
|
||||||
|
dsq->game->avatar->elementEffectMult = lua_tonumber(L, 1);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(flingMonkey)
|
luaFunc(flingMonkey)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
|
@ -8636,6 +8661,9 @@ static const struct {
|
||||||
luaRegister(entity_adjustPositionBySurfaceNormal),
|
luaRegister(entity_adjustPositionBySurfaceNormal),
|
||||||
luaRegister(entity_applySurfaceNormalForce),
|
luaRegister(entity_applySurfaceNormalForce),
|
||||||
|
|
||||||
|
luaRegister(entity_doElementInteraction),
|
||||||
|
luaRegister(avatar_setElementEffectMult),
|
||||||
|
|
||||||
luaRegister(createBeam),
|
luaRegister(createBeam),
|
||||||
luaRegister(beam_setAngle),
|
luaRegister(beam_setAngle),
|
||||||
luaRegister(beam_setDamage),
|
luaRegister(beam_setDamage),
|
||||||
|
|
|
@ -189,6 +189,7 @@ public:
|
||||||
|
|
||||||
void clearRot();
|
void clearRot();
|
||||||
void clearPos();
|
void clearPos();
|
||||||
|
void flipRot();
|
||||||
void cycleLerpType();
|
void cycleLerpType();
|
||||||
|
|
||||||
void toggleHideBone();
|
void toggleHideBone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue