afxEffectWrapper membervar cleanup

This commit is contained in:
Azaezel 2018-03-29 17:46:57 -05:00
parent 0df2cf1b9d
commit b6076c55dd
36 changed files with 531 additions and 533 deletions

View file

@ -40,7 +40,7 @@ void afxEffectVector::filter_client_server()
for (S32 i = 0; i < fx_v->size(); i++)
{
if ((*fx_v)[i]->datablock->runsHere(on_server))
if ((*fx_v)[i]->mDatablock->runsHere(on_server))
fx_v2->push_back((*fx_v)[i]);
else
{
@ -68,15 +68,15 @@ void afxEffectVector::calc_fx_dur_and_afterlife()
if (ew)
{
F32 ew_dur;
if (ew->ew_timing.lifetime < 0)
if (ew->mEW_timing.lifetime < 0)
{
if (phrase_dur > ew->ew_timing.delay)
if (phrase_dur > ew->mEW_timing.delay)
ew_dur = phrase_dur + ew->afterStopTime();
else
ew_dur = ew->ew_timing.delay + ew->afterStopTime();
ew_dur = ew->mEW_timing.delay + ew->afterStopTime();
}
else
ew_dur = ew->ew_timing.delay + ew->ew_timing.lifetime + ew->ew_timing.fade_out_time;
ew_dur = ew->mEW_timing.delay + ew->mEW_timing.lifetime + ew->mEW_timing.fade_out_time;
if (ew_dur > total_fx_dur)
total_fx_dur = ew_dur;

View file

@ -681,55 +681,55 @@ ConsoleDocClass( afxEffectWrapper,
afxEffectWrapper::afxEffectWrapper()
{
choreographer = 0;
datablock = 0;
cons_mgr = 0;
mChoreographer = 0;
mDatablock = 0;
mCons_mgr = 0;
cond_alive = true;
elapsed = 0;
life_end = 0;
life_elapsed = 0;
stopped = false;
n_updates = 0;
fade_value = 1.0f;
last_fade_value = 0.0f;
fade_in_end = 0.0;
fade_out_start = 0.0f;
in_scope = true;
is_aborted = false;
do_fade_inout = false;
do_fades = false;
full_lifetime = 0;
mCond_alive = true;
mElapsed = 0;
mLife_end = 0;
mLife_elapsed = 0;
mStopped = false;
mNum_updates = 0;
mFade_value = 1.0f;
mLast_fade_value = 0.0f;
mFade_in_end = 0.0;
mFade_out_start = 0.0f;
mIn_scope = true;
mIs_aborted = false;
mDo_fade_inout = false;
mDo_fades = false;
mFull_lifetime = 0;
time_factor = 1.0f;
prop_time_factor = 1.0f;
mTime_factor = 1.0f;
mProp_time_factor = 1.0f;
live_scale_factor = 1.0f;
live_fade_factor = 1.0f;
terrain_altitude = -1.0f;
interior_altitude = -1.0f;
mLive_scale_factor = 1.0f;
mLive_fade_factor = 1.0f;
mTerrain_altitude = -1.0f;
mInterior_altitude = -1.0f;
group_index = 0;
mGroup_index = 0;
dMemset(xfm_modifiers, 0, sizeof(xfm_modifiers));
dMemset(mXfm_modifiers, 0, sizeof(mXfm_modifiers));
}
afxEffectWrapper::~afxEffectWrapper()
{
for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++)
if (xfm_modifiers[i])
delete xfm_modifiers[i];
if (mXfm_modifiers[i])
delete mXfm_modifiers[i];
if (datablock && datablock->effect_name != ST_NULLSTRING)
if (mDatablock && mDatablock->effect_name != ST_NULLSTRING)
{
choreographer->removeNamedEffect(this);
if (datablock->use_as_cons_obj && !effect_cons_id.undefined())
cons_mgr->setReferenceEffect(effect_cons_id, 0);
mChoreographer->removeNamedEffect(this);
if (mDatablock->use_as_cons_obj && !mEffect_cons_id.undefined())
mCons_mgr->setReferenceEffect(mEffect_cons_id, 0);
}
if (datablock && datablock->isTempClone())
delete datablock;
datablock = 0;
if (mDatablock && mDatablock->isTempClone())
delete mDatablock;
mDatablock = 0;
}
#undef myOffset
@ -737,9 +737,9 @@ afxEffectWrapper::~afxEffectWrapper()
void afxEffectWrapper::initPersistFields()
{
addField("liveScaleFactor", TypeF32, myOffset(live_scale_factor),
addField("liveScaleFactor", TypeF32, myOffset(mLive_scale_factor),
"...");
addField("liveFadeFactor", TypeF32, myOffset(live_fade_factor),
addField("liveFadeFactor", TypeF32, myOffset(mLive_fade_factor),
"...");
Parent::initPersistFields();
@ -754,37 +754,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer,
AssertFatal(datablock != NULL, "Datablock is missing.");
AssertFatal(cons_mgr != NULL, "Constraint manager is missing.");
this->choreographer = choreographer;
this->datablock = datablock;
this->cons_mgr = cons_mgr;
mChoreographer = choreographer;
mDatablock = datablock;
mCons_mgr = cons_mgr;
ea_set_datablock(datablock->effect_data);
ew_timing = datablock->ewd_timing;
if (ew_timing.life_bias != 1.0f)
mEW_timing = datablock->ewd_timing;
if (mEW_timing.life_bias != 1.0f)
{
if (ew_timing.lifetime > 0)
ew_timing.lifetime *= ew_timing.life_bias;
ew_timing.fade_in_time *= ew_timing.life_bias;
ew_timing.fade_out_time *= ew_timing.life_bias;
if (mEW_timing.lifetime > 0)
mEW_timing.lifetime *= mEW_timing.life_bias;
mEW_timing.fade_in_time *= mEW_timing.life_bias;
mEW_timing.fade_out_time *= mEW_timing.life_bias;
}
pos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def);
orient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def);
aim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def);
life_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def);
mPos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def);
mOrient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def);
mAim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def);
mLife_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def);
this->time_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor;
mTime_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor;
if (datablock->propagate_time_factor)
prop_time_factor = time_factor;
mProp_time_factor = time_factor;
if (datablock->runsHere(choreographer->isServerObject()))
{
for (int i = 0; i < MAX_XFM_MODIFIERS && datablock->xfm_modifiers[i] != 0; i++)
{
xfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject());
AssertFatal(xfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()));
if (xfm_modifiers[i] == 0)
mXfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject());
AssertFatal(mXfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()));
if (mXfm_modifiers[i] == 0)
Con::errorf("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName());
}
}
@ -795,9 +795,9 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer,
choreographer->addNamedEffect(this);
if (datablock->use_as_cons_obj)
{
effect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this);
if (effect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject()))
effect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this);
mEffect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this);
if (mEffect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject()))
mEffect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this);
}
}
}
@ -805,37 +805,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer,
void afxEffectWrapper::prestart()
{
// modify timing values by time_factor
if (ew_timing.lifetime > 0)
ew_timing.lifetime *= time_factor;
ew_timing.delay *= time_factor;
ew_timing.fade_in_time *= time_factor;
ew_timing.fade_out_time *= time_factor;
if (mEW_timing.lifetime > 0)
mEW_timing.lifetime *= mTime_factor;
mEW_timing.delay *= mTime_factor;
mEW_timing.fade_in_time *= mTime_factor;
mEW_timing.fade_out_time *= mTime_factor;
if (ew_timing.lifetime < 0)
if (mEW_timing.lifetime < 0)
{
full_lifetime = INFINITE_LIFETIME;
life_end = INFINITE_LIFETIME;
mFull_lifetime = INFINITE_LIFETIME;
mLife_end = INFINITE_LIFETIME;
}
else
{
full_lifetime = ew_timing.lifetime + ew_timing.fade_out_time;
life_end = ew_timing.delay + ew_timing.lifetime;
mFull_lifetime = mEW_timing.lifetime + mEW_timing.fade_out_time;
mLife_end = mEW_timing.delay + mEW_timing.lifetime;
}
if ((ew_timing.fade_in_time + ew_timing.fade_out_time) > 0.0f)
if ((mEW_timing.fade_in_time + mEW_timing.fade_out_time) > 0.0f)
{
fade_in_end = ew_timing.delay + ew_timing.fade_in_time;
if (full_lifetime == INFINITE_LIFETIME)
fade_out_start = INFINITE_LIFETIME;
mFade_in_end = mEW_timing.delay + mEW_timing.fade_in_time;
if (mFull_lifetime == INFINITE_LIFETIME)
mFade_out_start = INFINITE_LIFETIME;
else
fade_out_start = ew_timing.delay + ew_timing.lifetime;
do_fade_inout = true;
mFade_out_start = mEW_timing.delay + mEW_timing.lifetime;
mDo_fade_inout = true;
}
if (!do_fade_inout && datablock->vis_keys != NULL && datablock->vis_keys->numKeys() > 0)
if (!mDo_fade_inout && mDatablock->vis_keys != NULL && mDatablock->vis_keys->numKeys() > 0)
{
//do_fades = true;
fade_out_start = ew_timing.delay + ew_timing.lifetime;
mFade_out_start = mEW_timing.delay + mEW_timing.lifetime;
}
}
@ -843,22 +843,22 @@ bool afxEffectWrapper::start(F32 timestamp)
{
if (!ea_is_enabled())
{
Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", datablock->getName());
Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", mDatablock->getName());
return false;
}
afxConstraint* life_constraint = getLifeConstraint();
if (life_constraint)
cond_alive = life_constraint->getLivingState();
mCond_alive = life_constraint->getLivingState();
elapsed = timestamp;
mElapsed = timestamp;
for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++)
{
if (!xfm_modifiers[i])
if (!mXfm_modifiers[i])
break;
else
xfm_modifiers[i]->start(timestamp);
mXfm_modifiers[i]->start(timestamp);
}
if (!ea_start())
@ -874,109 +874,109 @@ bool afxEffectWrapper::start(F32 timestamp)
bool afxEffectWrapper::test_life_conds()
{
afxConstraint* life_constraint = getLifeConstraint();
if (!life_constraint || datablock->life_conds == 0)
if (!life_constraint || mDatablock->life_conds == 0)
return true;
S32 now_state = life_constraint->getDamageState();
if ((datablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled)
if ((mDatablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled)
return true;
if ((datablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled)
if ((mDatablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled)
return true;
if ((datablock->life_conds & DYING) != 0)
return (cond_alive && now_state == ShapeBase::Disabled);
if ((mDatablock->life_conds & DYING) != 0)
return (mCond_alive && now_state == ShapeBase::Disabled);
return false;
}
bool afxEffectWrapper::update(F32 dt)
{
elapsed += dt;
mElapsed += dt;
// life_elapsed won't exceed full_lifetime
life_elapsed = getMin(elapsed - ew_timing.delay, full_lifetime);
mLife_elapsed = getMin(mElapsed - mEW_timing.delay, mFull_lifetime);
// update() returns early if elapsed is outside of active timing range
// (delay <= elapsed <= delay+lifetime)
// note: execution is always allowed beyond this point at least once,
// even if elapsed exceeds the lifetime.
if (elapsed < ew_timing.delay)
if (mElapsed < mEW_timing.delay)
{
setScopeStatus(false);
return false;
}
if (!datablock->requiresStop(ew_timing) && ew_timing.lifetime < 0)
if (!mDatablock->requiresStop(mEW_timing) && mEW_timing.lifetime < 0)
{
F32 afterlife = elapsed - ew_timing.delay;
if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0)))
F32 afterlife = mElapsed - mEW_timing.delay;
if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0)))
{
setScopeStatus(ew_timing.residue_lifetime > 0.0f);
setScopeStatus(mEW_timing.residue_lifetime > 0.0f);
return false;
}
}
else
{
F32 afterlife = elapsed - (full_lifetime + ew_timing.delay);
if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0)))
F32 afterlife = mElapsed - (mFull_lifetime + mEW_timing.delay);
if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0)))
{
setScopeStatus(ew_timing.residue_lifetime > 0.0f);
setScopeStatus(mEW_timing.residue_lifetime > 0.0f);
return false;
}
}
// first time here, test if required conditions for effect are met
if (n_updates == 0)
if (mNum_updates == 0)
{
if (!test_life_conds())
{
elapsed = full_lifetime + ew_timing.delay;
mElapsed = mFull_lifetime + mEW_timing.delay;
setScopeStatus(false);
n_updates++;
mNum_updates++;
return false;
}
}
setScopeStatus(true);
n_updates++;
mNum_updates++;
// calculate current fade value if enabled
if (do_fade_inout)
if (mDo_fade_inout)
{
if (ew_timing.fade_in_time > 0 && elapsed <= fade_in_end)
if (mEW_timing.fade_in_time > 0 && mElapsed <= mFade_in_end)
{
F32 t = mClampF((elapsed-ew_timing.delay)/ew_timing.fade_in_time, 0.0f, 1.0f);
fade_value = afxEase::t(t, ew_timing.fadein_ease.x,ew_timing.fadein_ease.y);
do_fades = true;
F32 t = mClampF((mElapsed - mEW_timing.delay)/ mEW_timing.fade_in_time, 0.0f, 1.0f);
mFade_value = afxEase::t(t, mEW_timing.fadein_ease.x, mEW_timing.fadein_ease.y);
mDo_fades = true;
}
else if (elapsed > fade_out_start)
else if (mElapsed > mFade_out_start)
{
if (ew_timing.fade_out_time == 0)
fade_value = 0.0f;
if (mEW_timing.fade_out_time == 0)
mFade_value = 0.0f;
else
{
F32 t = mClampF(1.0f-(elapsed-fade_out_start)/ew_timing.fade_out_time, 0.0f, 1.0f);
fade_value = afxEase::t(t, ew_timing.fadeout_ease.x,ew_timing.fadeout_ease.y);
F32 t = mClampF(1.0f-(mElapsed - mFade_out_start)/ mEW_timing.fade_out_time, 0.0f, 1.0f);
mFade_value = afxEase::t(t, mEW_timing.fadeout_ease.x, mEW_timing.fadeout_ease.y);
}
do_fades = true;
mDo_fades = true;
}
else
{
fade_value = 1.0f;
do_fades = false;
mFade_value = 1.0f;
mDo_fades = false;
}
}
else
{
fade_value = 1.0;
do_fades = false;
mFade_value = 1.0;
mDo_fades = false;
}
if (datablock->vis_keys && datablock->vis_keys->numKeys() > 0)
if (mDatablock->vis_keys && mDatablock->vis_keys->numKeys() > 0)
{
F32 vis = datablock->vis_keys->evaluate(elapsed-ew_timing.delay);
fade_value *= mClampF(vis, 0.0f, 1.0f);
do_fades = (fade_value < 1.0f);
F32 vis = mDatablock->vis_keys->evaluate(mElapsed - mEW_timing.delay);
mFade_value *= mClampF(vis, 0.0f, 1.0f);
mDo_fades = (mFade_value < 1.0f);
}
// DEAL WITH CONSTRAINTS
@ -990,17 +990,17 @@ bool afxEffectWrapper::update(F32 dt)
afxConstraint* pos_constraint = getPosConstraint();
if (pos_constraint)
{
bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.mHistory_time);
bool valid = pos_constraint->getPosition(CONS_POS, mDatablock->pos_cons_def.mHistory_time);
if (!valid)
getUnconstrainedPosition(CONS_POS);
setScopeStatus(valid);
if (valid && datablock->borrow_altitudes)
if (valid && mDatablock->borrow_altitudes)
{
F32 terr_alt, inter_alt;
if (pos_constraint->getAltitudes(terr_alt, inter_alt))
{
terrain_altitude = terr_alt;
interior_altitude = inter_alt;
mTerrain_altitude = terr_alt;
mInterior_altitude = inter_alt;
}
}
}
@ -1013,7 +1013,7 @@ bool afxEffectWrapper::update(F32 dt)
afxConstraint* orient_constraint = getOrientConstraint();
if (orient_constraint)
{
orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.mHistory_time);
orient_constraint->getTransform(CONS_XFM, mDatablock->pos_cons_def.mHistory_time);
}
else
{
@ -1022,11 +1022,11 @@ bool afxEffectWrapper::update(F32 dt)
afxConstraint* aim_constraint = getAimConstraint();
if (aim_constraint)
aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.mHistory_time);
aim_constraint->getPosition(CONS_AIM, mDatablock->pos_cons_def.mHistory_time);
else
CONS_AIM.zero();
CONS_SCALE.set(datablock->scale_factor, datablock->scale_factor, datablock->scale_factor);
CONS_SCALE.set(mDatablock->scale_factor, mDatablock->scale_factor, mDatablock->scale_factor);
/*
if (datablock->isPositional() && CONS_POS.isZero() && in_scope)
@ -1035,44 +1035,44 @@ bool afxEffectWrapper::update(F32 dt)
getBaseColor(CONS_COLOR);
params.vis = fade_value;
params.vis = mFade_value;
// apply modifiers
for (int i = 0; i < MAX_XFM_MODIFIERS; i++)
{
if (!xfm_modifiers[i])
if (!mXfm_modifiers[i])
break;
else
xfm_modifiers[i]->updateParams(dt, life_elapsed, params);
mXfm_modifiers[i]->updateParams(dt, mLife_elapsed, params);
}
// final pos/orient is determined
updated_xfm = CONS_XFM;
updated_pos = CONS_POS;
updated_aim = CONS_AIM;
updated_xfm.setPosition(updated_pos);
updated_scale = CONS_SCALE;
updated_color = CONS_COLOR;
mUpdated_xfm = CONS_XFM;
mUpdated_pos = CONS_POS;
mUpdated_aim = CONS_AIM;
mUpdated_xfm.setPosition(mUpdated_pos);
mUpdated_scale = CONS_SCALE;
mUpdated_color = CONS_COLOR;
if (params.vis > 1.0f)
fade_value = 1.0f;
mFade_value = 1.0f;
else
fade_value = params.vis;
mFade_value = params.vis;
if (last_fade_value != fade_value)
if (mLast_fade_value != mFade_value)
{
do_fades = true;
last_fade_value = fade_value;
mDo_fades = true;
mLast_fade_value = mFade_value;
}
else
{
do_fades = (fade_value < 1.0f);
mDo_fades = (mFade_value < 1.0f);
}
if (!ea_update(dt))
{
is_aborted = true;
Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", datablock->getName());
mIs_aborted = true;
Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", mDatablock->getName());
}
return true;
@ -1080,44 +1080,44 @@ bool afxEffectWrapper::update(F32 dt)
void afxEffectWrapper::stop()
{
if (!datablock->requiresStop(ew_timing))
if (!mDatablock->requiresStop(mEW_timing))
return;
stopped = true;
mStopped = true;
// this resets full_lifetime so it starts to shrink or fade
if (full_lifetime == INFINITE_LIFETIME)
if (mFull_lifetime == INFINITE_LIFETIME)
{
full_lifetime = (elapsed - ew_timing.delay) + afterStopTime();
life_end = elapsed;
if (ew_timing.fade_out_time > 0)
fade_out_start = elapsed;
mFull_lifetime = (mElapsed - mEW_timing.delay) + afterStopTime();
mLife_end = mElapsed;
if (mEW_timing.fade_out_time > 0)
mFade_out_start = mElapsed;
}
}
void afxEffectWrapper::cleanup(bool was_stopped)
{
ea_finish(was_stopped);
if (!effect_cons_id.undefined())
if (!mEffect_cons_id.undefined())
{
cons_mgr->setReferenceEffect(effect_cons_id, 0);
effect_cons_id = afxConstraintID();
mCons_mgr->setReferenceEffect(mEffect_cons_id, 0);
mEffect_cons_id = afxConstraintID();
}
}
void afxEffectWrapper::setScopeStatus(bool in_scope)
{
if (this->in_scope != in_scope)
if (mIn_scope != in_scope)
{
this->in_scope = in_scope;
mIn_scope = in_scope;
ea_set_scope_status(in_scope);
}
}
bool afxEffectWrapper::isDone()
{
if (!datablock->is_looping)
return (elapsed >= (life_end + ew_timing.fade_out_time));
if (!mDatablock->is_looping)
return (mElapsed >= (mLife_end + mEW_timing.fade_out_time));
return false;
}
@ -1136,7 +1136,7 @@ afxEffectWrapper* afxEffectWrapper::ew_create(afxChoreographer* choreograph
if (adapter)
{
adapter->group_index = (datablock->group_index != -1) ? datablock->group_index : group_index;
adapter->mGroup_index = (datablock->group_index != -1) ? datablock->group_index : group_index;
adapter->ew_init(choreographer, datablock, cons_mgr, time_factor);
}

View file

@ -255,59 +255,59 @@ private:
bool test_life_conds();
protected:
afxEffectWrapperData* datablock;
afxEffectWrapperData* mDatablock;
afxEffectTimingData ew_timing;
afxEffectTimingData mEW_timing;
F32 fade_in_end;
F32 fade_out_start;
F32 full_lifetime;
F32 mFade_in_end;
F32 mFade_out_start;
F32 mFull_lifetime;
F32 time_factor;
F32 prop_time_factor;
F32 mTime_factor;
F32 mProp_time_factor;
afxChoreographer* choreographer;
afxConstraintMgr* cons_mgr;
afxChoreographer* mChoreographer;
afxConstraintMgr* mCons_mgr;
afxConstraintID pos_cons_id;
afxConstraintID orient_cons_id;
afxConstraintID aim_cons_id;
afxConstraintID life_cons_id;
afxConstraintID mPos_cons_id;
afxConstraintID mOrient_cons_id;
afxConstraintID mAim_cons_id;
afxConstraintID mLife_cons_id;
afxConstraintID effect_cons_id;
afxConstraintID mEffect_cons_id;
F32 elapsed;
F32 life_elapsed;
F32 life_end;
bool stopped;
bool cond_alive;
F32 mElapsed;
F32 mLife_elapsed;
F32 mLife_end;
bool mStopped;
bool mCond_alive;
U32 n_updates;
U32 mNum_updates;
MatrixF updated_xfm;
Point3F updated_pos;
Point3F updated_aim;
Point3F updated_scale;
LinearColorF updated_color;
MatrixF mUpdated_xfm;
Point3F mUpdated_pos;
Point3F mUpdated_aim;
Point3F mUpdated_scale;
LinearColorF mUpdated_color;
F32 fade_value;
F32 last_fade_value;
F32 mFade_value;
F32 mLast_fade_value;
bool do_fade_inout;
bool do_fades;
bool in_scope;
bool is_aborted;
bool mDo_fade_inout;
bool mDo_fades;
bool mIn_scope;
bool mIs_aborted;
U8 effect_flags;
U8 mEffect_flags;
afxXM_Base* xfm_modifiers[MAX_XFM_MODIFIERS];
afxXM_Base* mXfm_modifiers[MAX_XFM_MODIFIERS];
F32 live_scale_factor;
F32 live_fade_factor;
F32 terrain_altitude;
F32 interior_altitude;
F32 mLive_scale_factor;
F32 mLive_fade_factor;
F32 mTerrain_altitude;
F32 mInterior_altitude;
S32 group_index;
S32 mGroup_index;
public:
/*C*/ afxEffectWrapper();
@ -316,18 +316,18 @@ public:
void ew_init(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*,
F32 time_factor);
F32 getFullLifetime() { return ew_timing.lifetime + ew_timing.fade_out_time; }
F32 getTimeFactor() { return time_factor; }
afxConstraint* getPosConstraint() { return cons_mgr->getConstraint(pos_cons_id); }
afxConstraint* getOrientConstraint() { return cons_mgr->getConstraint(orient_cons_id); }
afxConstraint* getAimConstraint() { return cons_mgr->getConstraint(aim_cons_id); }
afxConstraint* getLifeConstraint() { return cons_mgr->getConstraint(life_cons_id); }
afxChoreographer* getChoreographer() { return choreographer; }
F32 getFullLifetime() { return mEW_timing.lifetime + mEW_timing.fade_out_time; }
F32 getTimeFactor() { return mTime_factor; }
afxConstraint* getPosConstraint() { return mCons_mgr->getConstraint(mPos_cons_id); }
afxConstraint* getOrientConstraint() { return mCons_mgr->getConstraint(mOrient_cons_id); }
afxConstraint* getAimConstraint() { return mCons_mgr->getConstraint(mAim_cons_id); }
afxConstraint* getLifeConstraint() { return mCons_mgr->getConstraint(mLife_cons_id); }
afxChoreographer* getChoreographer() { return mChoreographer; }
virtual bool isDone();
virtual bool deleteWhenStopped() { return false; }
F32 afterStopTime() { return ew_timing.fade_out_time; }
bool isAborted() const { return is_aborted; }
F32 afterStopTime() { return mEW_timing.fade_out_time; }
bool isAborted() const { return mIs_aborted; }
void prestart();
bool start(F32 timestamp);
@ -345,11 +345,11 @@ public:
virtual SceneObject* ea_get_scene_object() const { return 0; }
U32 ea_get_triggers() const { return 0; }
void getUpdatedPosition(Point3F& pos) { pos = updated_pos;}
void getUpdatedTransform(MatrixF& xfm) { xfm = updated_xfm; }
void getUpdatedScale(Point3F& scale) { scale = updated_scale; }
void getUpdatedColor(LinearColorF& color) { color = updated_color; }
virtual void getUpdatedBoxCenter(Point3F& pos) { pos = updated_pos;}
void getUpdatedPosition(Point3F& pos) { pos = mUpdated_pos;}
void getUpdatedTransform(MatrixF& xfm) { xfm = mUpdated_xfm; }
void getUpdatedScale(Point3F& scale) { scale = mUpdated_scale; }
void getUpdatedColor(LinearColorF& color) { color = mUpdated_color; }
virtual void getUpdatedBoxCenter(Point3F& pos) { pos = mUpdated_pos;}
virtual void getUnconstrainedPosition(Point3F& pos) { pos.zero();}
virtual void getUnconstrainedTransform(MatrixF& xfm) { xfm.identity(); }
@ -358,9 +358,9 @@ public:
SceneObject* getSceneObject() const { return ea_get_scene_object(); }
U32 getTriggers() const { return ea_get_triggers(); }
F32 getMass() { return datablock->mass; }
Point3F getDirection() { return datablock->direction; }
F32 getSpeed() { return datablock->speed; }
F32 getMass() { return mDatablock->mass; }
Point3F getDirection() { return mDatablock->direction; }
F32 getSpeed() { return mDatablock->speed; }
virtual TSShape* getTSShape() { return 0; }
virtual TSShapeInstance* getTSShapeInstance() { return 0; }
@ -369,14 +369,14 @@ public:
virtual void resetAnimation(U32 tag) { }
virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; }
void setTerrainAltitude(F32 alt) { terrain_altitude = alt; }
void setInteriorAltitude(F32 alt) { interior_altitude = alt; }
void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = terrain_altitude; inter_alt = interior_altitude; }
void setTerrainAltitude(F32 alt) { mTerrain_altitude = alt; }
void setInteriorAltitude(F32 alt) { mInterior_altitude = alt; }
void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = mTerrain_altitude; inter_alt = mInterior_altitude; }
void setGroupIndex(S32 idx) { group_index = idx; }
S32 getGroupIndex() const { return group_index; }
void setGroupIndex(S32 idx) { mGroup_index = idx; }
S32 getGroupIndex() const { return mGroup_index; }
bool inScope() const { return in_scope; }
bool inScope() const { return mIn_scope; }
public:
static void initPersistFields();

View file

@ -89,10 +89,10 @@ bool afxEA_AnimClip::ea_start()
do_runtime_substitutions();
afxConstraint* pos_constraint = getPosConstraint();
if (full_lifetime == INFINITE_LIFETIME && pos_constraint != 0)
if (mFull_lifetime == INFINITE_LIFETIME && pos_constraint != 0)
anim_lifetime = pos_constraint->getAnimClipDuration(clip_data->clip_name);
else
anim_lifetime = full_lifetime;
anim_lifetime = mFull_lifetime;
anim_tag = 0;
lock_tag = 0;
@ -127,8 +127,8 @@ bool afxEA_AnimClip::ea_update(F32 dt)
if (go_for_it)
{
F32 rate = clip_data->rate/prop_time_factor;
F32 pos = mFmod(life_elapsed, anim_lifetime)/anim_lifetime;
F32 rate = clip_data->rate/mProp_time_factor;
F32 pos = mFmod(mLife_elapsed, anim_lifetime)/anim_lifetime;
pos = mFmod(pos + clip_data->pos_offset, 1.0);
if (clip_data->rate < 0)
pos = 1.0f - pos;
@ -164,7 +164,7 @@ void afxEA_AnimClip::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxAnimClipData* orig_db = clip_data;
clip_data = new afxAnimClipData(*orig_db, true);
orig_db->performSubstitutions(clip_data, choreographer, group_index);
orig_db->performSubstitutions(clip_data, mChoreographer, mGroup_index);
}
}

View file

@ -133,7 +133,7 @@ void afxEA_AreaDamage::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxAreaDamageData* orig_db = damage_data;
damage_data = new afxAreaDamageData(*orig_db, true);
orig_db->performSubstitutions(damage_data, choreographer, group_index);
orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index);
}
}
@ -204,8 +204,8 @@ void afxEA_AreaDamage::notify_damage_source(ShapeBase* damaged, F32 damage, cons
char *posArg = Con::getArgBuffer(64);
dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z);
Con::executef(choreographer->getDataBlock(), "onInflictedAreaDamage",
choreographer->getIdString(),
Con::executef(mChoreographer->getDataBlock(), "onInflictedAreaDamage",
mChoreographer->getIdString(),
damaged->getIdString(),
Con::getFloatArg(damage),
flavor,
@ -221,7 +221,7 @@ void afxEA_AreaDamage::apply_damage(ShapeBase* shape, F32 damage, const char* fl
dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z);
Con::executef(shape, "damage",
choreographer->getIdString(),
mChoreographer->getIdString(),
posArg,
Con::getFloatArg(damage),
flavor);

View file

@ -125,8 +125,8 @@ bool afxEA_AudioBank::ea_update(F32 dt)
if (sound_handle)
{
sound_handle->setTransform(updated_xfm);
sound_handle->setVolume(updated_scale.x*fade_value);
sound_handle->setTransform(mUpdated_xfm);
sound_handle->setVolume(mUpdated_scale.x*mFade_value);
}
return true;
@ -143,7 +143,7 @@ void afxEA_AudioBank::ea_finish(bool was_stopped)
void afxEA_AudioBank::do_runtime_substitutions()
{
sound_bank = sound_bank->cloneAndPerformSubstitutions(choreographer, group_index);
sound_bank = sound_bank->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -108,18 +108,18 @@ bool afxEA_Billboard::ea_update(F32 dt)
deleteNotify(bb);
///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor);
bb->setSortPriority(datablock->sort_priority);
bb->setSortPriority(mDatablock->sort_priority);
}
if (bb)
{
bb->live_color = updated_color;
if (do_fades)
bb->live_color = mUpdated_color;
if (mDo_fades)
{
bb->setFadeAmount(fade_value);
bb->setFadeAmount(mFade_value);
}
bb->setTransform(updated_xfm);
bb->setScale(updated_scale);
bb->setTransform(mUpdated_xfm);
bb->setScale(mUpdated_scale);
}
return true;
@ -162,7 +162,7 @@ void afxEA_Billboard::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxBillboardData* orig_db = bb_data;
bb_data = new afxBillboardData(*orig_db, true);
orig_db->performSubstitutions(bb_data, choreographer, group_index);
orig_db->performSubstitutions(bb_data, mChoreographer, mGroup_index);
}
}

View file

@ -83,8 +83,8 @@ bool afxEA_CameraPuppet::ea_start()
do_runtime_substitutions();
afxConstraintID obj_id = cons_mgr->getConstraintId(puppet_data->cam_def);
cam_cons = cons_mgr->getConstraint(obj_id);
afxConstraintID obj_id = mCons_mgr->getConstraintId(puppet_data->cam_def);
cam_cons = mCons_mgr->getConstraint(obj_id);
SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0;
if (obj && obj->isClientObject())
@ -105,9 +105,9 @@ bool afxEA_CameraPuppet::ea_update(F32 dt)
{
SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0;
if (obj && in_scope)
if (obj && mIn_scope)
{
obj->setTransform(updated_xfm);
obj->setTransform(mUpdated_xfm);
}
return true;
@ -153,7 +153,7 @@ void afxEA_CameraPuppet::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxCameraPuppetData* orig_db = puppet_data;
puppet_data = new afxCameraPuppetData(*orig_db, true);
orig_db->performSubstitutions(puppet_data, choreographer, group_index);
orig_db->performSubstitutions(puppet_data, mChoreographer, mGroup_index);
}
}

View file

@ -91,7 +91,7 @@ bool afxEA_CameraShake::ea_start()
if (aim_constraint && pos_constraint)
{
if (full_lifetime <= 0 || full_lifetime == INFINITE_LIFETIME)
if (mFull_lifetime <= 0 || mFull_lifetime == INFINITE_LIFETIME)
{
Con::errorf("afxEA_CameraShake::ea_start() -- effect requires a finite lifetime.");
return false;
@ -106,7 +106,7 @@ bool afxEA_CameraShake::ea_start()
if (dist < shake_data->camShakeRadius)
{
camera_shake = new CameraShake;
camera_shake->setDuration(full_lifetime);
camera_shake->setDuration(mFull_lifetime);
camera_shake->setFrequency(shake_data->camShakeFreq);
F32 falloff = dist/shake_data->camShakeRadius;
@ -161,7 +161,7 @@ void afxEA_CameraShake::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxCameraShakeData* orig_db = shake_data;
shake_data = new afxCameraShakeData(*orig_db, true);
orig_db->performSubstitutions(shake_data, choreographer, group_index);
orig_db->performSubstitutions(shake_data, mChoreographer, mGroup_index);
}
}

View file

@ -107,16 +107,16 @@ bool afxEA_CollisionEvent::ea_update(F32 dt)
afxConstraint* pos_constraint = getPosConstraint();
set_shape((pos_constraint) ? dynamic_cast<ShapeBase*>(pos_constraint->getSceneObject()) : 0);
if (choreographer && trigger_mask != 0)
if (mChoreographer && trigger_mask != 0)
{
if (triggered)
{
choreographer->setTriggerMask(trigger_mask | choreographer->getTriggerMask());
mChoreographer->setTriggerMask(trigger_mask | mChoreographer->getTriggerMask());
triggered = false;
}
else
{
choreographer->setTriggerMask(~trigger_mask & choreographer->getTriggerMask());
mChoreographer->setTriggerMask(~trigger_mask & mChoreographer->getTriggerMask());
}
}
@ -136,7 +136,7 @@ void afxEA_CollisionEvent::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxCollisionEventData* orig_db = script_data;
script_data = new afxCollisionEventData(*orig_db, true);
orig_db->performSubstitutions(script_data, choreographer, group_index);
orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index);
}
}
@ -162,7 +162,7 @@ void afxEA_CollisionEvent::set_shape(ShapeBase* new_shape)
void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel)
{
if (obj0 != shape || !choreographer || !choreographer->getDataBlock())
if (obj0 != shape || !mChoreographer || !mChoreographer->getDataBlock())
return;
if (script_data->method_name != ST_NULLSTRING)
@ -171,8 +171,8 @@ void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1,
dSprintf(arg_buf, 256, "%g %g %g", vel.x, vel.y, vel.z);
// CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity)
Con::executef(choreographer->getDataBlock(), script_data->method_name,
choreographer->getIdString(),
Con::executef(mChoreographer->getDataBlock(), script_data->method_name,
mChoreographer->getIdString(),
(obj0) ? obj0->getIdString() : "",
(obj1) ? obj1->getIdString() : "",
arg_buf,

View file

@ -98,7 +98,7 @@ void afxEA_ConsoleMessage::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxConsoleMessageData* orig_db = message_data;
message_data = new afxConsoleMessageData(*orig_db, true);
orig_db->performSubstitutions(message_data, choreographer, group_index);
orig_db->performSubstitutions(message_data, mChoreographer, mGroup_index);
}
}

View file

@ -101,7 +101,7 @@ bool afxEA_Damage::ea_start()
if (damage_data->repeats > 1)
{
dot_delta_ms = full_lifetime/(damage_data->repeats - 1);
dot_delta_ms = mFull_lifetime /(damage_data->repeats - 1);
next_dot_time = dot_delta_ms;
}
@ -122,15 +122,15 @@ bool afxEA_Damage::ea_update(F32 dt)
if (aim_cons && aim_cons->getSceneObject())
impacted_obj_id = aim_cons->getSceneObject()->getId();
if (choreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
if (mChoreographer)
mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, damage_data->ad_amount, damage_data->radius, impact_pos,
damage_data->impulse);
repeat_cnt++;
}
else if (repeat_cnt < damage_data->repeats)
{
if (next_dot_time <= life_elapsed)
if (next_dot_time <= mLife_elapsed)
{
// CONSTRAINT REMAPPING <<
afxConstraint* aim_cons = getAimConstraint();
@ -138,8 +138,8 @@ bool afxEA_Damage::ea_update(F32 dt)
impacted_obj_id = aim_cons->getSceneObject()->getId();
// CONSTRAINT REMAPPING >>
if (choreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
if (mChoreographer)
mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, 0, 0, impact_pos, 0);
next_dot_time += dot_delta_ms;
repeat_cnt++;
@ -153,10 +153,10 @@ void afxEA_Damage::ea_finish(bool was_stopped)
{
if (started && (repeat_cnt < damage_data->repeats))
{
if (next_dot_time <= life_elapsed)
if (next_dot_time <= mLife_elapsed)
{
if (choreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
if (mChoreographer)
mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, 0, 0, impact_pos, 0);
}
}
@ -172,7 +172,7 @@ void afxEA_Damage::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxDamageData* orig_db = damage_data;
damage_data = new afxDamageData(*orig_db, true);
orig_db->performSubstitutions(damage_data, choreographer, group_index);
orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index);
}
}

View file

@ -78,7 +78,7 @@ afxEA_Debris::~afxEA_Debris()
bool afxEA_Debris::isDone()
{
return (datablock->use_as_cons_obj) ? debris_done : exploded;
return (mDatablock->use_as_cons_obj) ? debris_done : exploded;
}
void afxEA_Debris::ea_set_datablock(SimDataBlock* db)
@ -106,21 +106,21 @@ bool afxEA_Debris::ea_update(F32 dt)
{
if (exploded && debris)
{
if (in_scope)
if (mIn_scope)
{
updated_xfm = debris->getRenderTransform();
updated_xfm.getColumn(3, &updated_pos);
mUpdated_xfm = debris->getRenderTransform();
mUpdated_xfm.getColumn(3, &mUpdated_pos);
}
}
if (!exploded && debris)
{
if (in_scope)
if (mIn_scope)
{
Point3F dir_vec(0,1,0);
updated_xfm.mulV(dir_vec);
mUpdated_xfm.mulV(dir_vec);
debris->init(updated_pos, dir_vec);
debris->init(mUpdated_pos, dir_vec);
if (!debris->registerObject())
{
delete debris;
@ -165,7 +165,7 @@ void afxEA_Debris::do_runtime_substitutions()
// clone the datablock and perform substitutions
DebrisData* orig_db = debris_data;
debris_data = new DebrisData(*orig_db, true);
orig_db->performSubstitutions(debris_data, choreographer, group_index);
orig_db->performSubstitutions(debris_data, mChoreographer, mGroup_index);
}
}

View file

@ -81,7 +81,7 @@ bool afxEA_Explosion::ea_start()
do_runtime_substitutions();
explosion = new Explosion();
explosion->setSubstitutionData(choreographer, group_index);
explosion->setSubstitutionData(mChoreographer, mGroup_index);
explosion->setDataBlock(explosion_data);
return true;
@ -91,10 +91,10 @@ bool afxEA_Explosion::ea_update(F32 dt)
{
if (!exploded && explosion)
{
if (in_scope)
if (mIn_scope)
{
Point3F norm(0,0,1); updated_xfm.mulV(norm);
explosion->setInitialState(updated_pos, norm);
Point3F norm(0,0,1); mUpdated_xfm.mulV(norm);
explosion->setInitialState(mUpdated_pos, norm);
if (!explosion->registerObject())
{
delete explosion;
@ -117,7 +117,7 @@ void afxEA_Explosion::ea_finish(bool was_stopped)
void afxEA_Explosion::do_runtime_substitutions()
{
explosion_data = explosion_data->cloneAndPerformSubstitutions(choreographer, group_index);
explosion_data = explosion_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -145,7 +145,7 @@ void afxEA_FootSwitch::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxFootSwitchData* orig_db = footfall_data;
footfall_data = new afxFootSwitchData(*orig_db, true);
orig_db->performSubstitutions(footfall_data, choreographer, group_index);
orig_db->performSubstitutions(footfall_data, mChoreographer, mGroup_index);
}
}

View file

@ -146,7 +146,7 @@ bool afxEA_GuiController::ea_update(F32 dt)
if (ts_ctrl && !controller_data->preserve_pos)
{
Point3F screen_pos;
if (ts_ctrl->project(updated_pos, &screen_pos))
if (ts_ctrl->project(mUpdated_pos, &screen_pos))
{
const Point2I ext = gui_control->getExtent();
Point2I newpos(screen_pos.x - ext.x/2, screen_pos.y - ext.y/2);
@ -155,12 +155,12 @@ bool afxEA_GuiController::ea_update(F32 dt)
}
if (progress_base)
progress_base->setProgress((ew_timing.lifetime > 0.0) ? life_elapsed/ew_timing.lifetime : 0.0f);
progress_base->setProgress((mEW_timing.lifetime > 0.0) ? mLife_elapsed / mEW_timing.lifetime : 0.0f);
else if (progress_ctrl)
progress_ctrl->setScriptValue((ew_timing.lifetime > 0.0) ? avar("%g", life_elapsed/ew_timing.lifetime) : 0);
progress_ctrl->setScriptValue((mEW_timing.lifetime > 0.0) ? avar("%g", mLife_elapsed / mEW_timing.lifetime) : 0);
if (do_fades)
gui_control->setFadeAmount(fade_value);
if (mDo_fades)
gui_control->setFadeAmount(mFade_value);
return true;
}
@ -182,7 +182,7 @@ void afxEA_GuiController::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxGuiControllerData* orig_db = controller_data;
controller_data = new afxGuiControllerData(*orig_db, true);
orig_db->performSubstitutions(controller_data, choreographer, group_index);
orig_db->performSubstitutions(controller_data, mChoreographer, mGroup_index);
}
}

View file

@ -105,9 +105,9 @@ bool afxEA_GuiText::ea_update(F32 dt)
case USER_TEXT:
{
LinearColorF temp_clr = text_clr;
if (do_fades)
temp_clr.alpha = fade_value;
afxGuiTextHud::addTextItem(updated_pos, text_data->text_str, temp_clr);
if (mDo_fades)
temp_clr.alpha = mFade_value;
afxGuiTextHud::addTextItem(mUpdated_pos, text_data->text_str, temp_clr);
}
break;
case SHAPE_NAME:
@ -127,9 +127,9 @@ bool afxEA_GuiText::ea_update(F32 dt)
if (name && name[0] != '\0')
{
LinearColorF temp_clr = text_clr;
if (do_fades)
temp_clr.alpha = fade_value;
afxGuiTextHud::addTextItem(updated_pos, name, temp_clr, cons_obj);
if (mDo_fades)
temp_clr.alpha = mFade_value;
afxGuiTextHud::addTextItem(mUpdated_pos, name, temp_clr, cons_obj);
}
}
break;
@ -146,7 +146,7 @@ void afxEA_GuiText::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxGuiTextData* orig_db = text_data;
text_data = new afxGuiTextData(*orig_db, true);
orig_db->performSubstitutions(text_data, choreographer, group_index);
orig_db->performSubstitutions(text_data, mChoreographer, mGroup_index);
}
}

View file

@ -110,15 +110,15 @@ bool afxEA_MachineGun::ea_update(F32 dt)
{
if (!shooting)
{
start_time = elapsed;
start_time = mElapsed;
shooting = true;
}
else
{
F32 next_shot = start_time + (shot_count+1)*shot_gap;
while (next_shot < elapsed)
while (next_shot < mElapsed)
{
if (in_scope)
if (mIn_scope)
launch_projectile();
next_shot += shot_gap;
shot_count++;
@ -141,7 +141,7 @@ void afxEA_MachineGun::launch_projectile()
if (bullet_data->getSubstitutionCount() > 0)
{
next_bullet = new ProjectileData(*bullet_data, true);
bullet_data->performSubstitutions(next_bullet, choreographer, group_index);
bullet_data->performSubstitutions(next_bullet, mChoreographer, mGroup_index);
}
projectile->onNewDataBlock(next_bullet, false);
@ -151,10 +151,10 @@ void afxEA_MachineGun::launch_projectile()
afxConstraint* pos_cons = getPosConstraint();
ShapeBase* src_obj = (pos_cons) ? (dynamic_cast<ShapeBase*>(pos_cons->getSceneObject())) : 0;
Point3F dir_vec = updated_aim - updated_pos;
Point3F dir_vec = mUpdated_aim - mUpdated_pos;
dir_vec.normalizeSafe();
dir_vec *= muzzle_vel;
projectile->init(updated_pos, dir_vec, src_obj);
projectile->init(mUpdated_pos, dir_vec, src_obj);
if (!projectile->registerObject())
{
delete projectile;
@ -162,7 +162,7 @@ void afxEA_MachineGun::launch_projectile()
Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register.");
}
if (projectile)
projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString());
projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString());
}
void afxEA_MachineGun::do_runtime_substitutions()
@ -173,7 +173,7 @@ void afxEA_MachineGun::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxMachineGunData* orig_db = gun_data;
gun_data = new afxMachineGunData(*orig_db, true);
orig_db->performSubstitutions(gun_data, choreographer, group_index);
orig_db->performSubstitutions(gun_data, mChoreographer, mGroup_index);
}
}

View file

@ -119,18 +119,18 @@ bool afxEA_Model::ea_update(F32 dt)
}
deleteNotify(model);
model->setSequenceRateFactor(datablock->rate_factor/prop_time_factor);
model->setSortPriority(datablock->sort_priority);
model->setSequenceRateFactor(mDatablock->rate_factor/ mProp_time_factor);
model->setSortPriority(mDatablock->sort_priority);
}
if (model)
{
if (do_fades)
if (mDo_fades)
{
model->setFadeAmount(fade_value);
model->setFadeAmount(mFade_value);
}
model->setTransform(updated_xfm);
model->setScale(updated_scale);
model->setTransform(mUpdated_xfm);
model->setScale(mUpdated_scale);
}
return true;
@ -141,10 +141,10 @@ void afxEA_Model::ea_finish(bool was_stopped)
if (!model)
return;
if (in_scope && ew_timing.residue_lifetime > 0)
if (mIn_scope && mEW_timing.residue_lifetime > 0)
{
clearNotify(model);
afxResidueMgr::add(ew_timing.residue_lifetime, ew_timing.residue_fadetime, model);
afxResidueMgr::add(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, model);
model = 0;
}
else
@ -203,7 +203,7 @@ void afxEA_Model::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxModelData* orig_db = model_data;
model_data = new afxModelData(*orig_db, true);
orig_db->performSubstitutions(model_data, choreographer, group_index);
orig_db->performSubstitutions(model_data, mChoreographer, mGroup_index);
}
}

View file

@ -92,11 +92,11 @@ bool afxEA_Mooring::ea_update(F32 dt)
{
if (!obj)
{
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING)
if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
{
obj = new afxMooring(mooring_data->networking,
choreographer->getChoreographerId(),
datablock->effect_name);
mChoreographer->getChoreographerId(),
mDatablock->effect_name);
}
else
{
@ -116,7 +116,7 @@ bool afxEA_Mooring::ea_update(F32 dt)
if (obj)
{
obj->setTransform(updated_xfm);
obj->setTransform(mUpdated_xfm);
}
return true;
@ -142,7 +142,7 @@ void afxEA_Mooring::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxMooringData* orig_db = mooring_data;
mooring_data = new afxMooringData(*orig_db, true);
orig_db->performSubstitutions(mooring_data, choreographer, group_index);
orig_db->performSubstitutions(mooring_data, mChoreographer, mGroup_index);
}
}

View file

@ -84,28 +84,28 @@ bool afxEA_ParticleEmitter::ea_start()
{
afxParticleEmitterVector* pe = new afxParticleEmitterVector();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data))
{
afxParticleEmitterCone* pe = new afxParticleEmitterCone();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data))
{
afxParticleEmitterPath* pe = new afxParticleEmitterPath();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data))
{
afxParticleEmitterDisc* pe = new afxParticleEmitterDisc();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
}
@ -120,7 +120,7 @@ bool afxEA_ParticleEmitter::ea_start()
// here we find or create any required particle-pools
if (emitter_data->pool_datablock)
{
afxParticlePool* pool = choreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index);
afxParticlePool* pool = mChoreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index);
if (!pool)
{
afxParticlePoolData* pool_data = emitter_data->pool_datablock;
@ -129,7 +129,7 @@ bool afxEA_ParticleEmitter::ea_start()
// clone the datablock and perform substitutions
afxParticlePoolData* orig_db = pool_data;
pool_data = new afxParticlePoolData(*orig_db, true);
orig_db->performSubstitutions(pool_data, choreographer, group_index);
orig_db->performSubstitutions(pool_data, mChoreographer, mGroup_index);
}
pool = new afxParticlePool();
@ -143,8 +143,8 @@ bool afxEA_ParticleEmitter::ea_start()
}
if (pool)
{
pool->setChoreographer(choreographer);
choreographer->registerParticlePool(pool);
pool->setChoreographer(mChoreographer);
mChoreographer->registerParticlePool(pool);
}
}
if (pool)
@ -160,12 +160,12 @@ bool afxEA_ParticleEmitter::ea_start()
return false;
}
if (datablock->forced_bbox.isValidBox())
if (mDatablock->forced_bbox.isValidBox())
{
do_bbox_update = true;
}
emitter->setSortPriority(datablock->sort_priority);
emitter->setSortPriority(mDatablock->sort_priority);
deleteNotify(emitter);
return true;
@ -173,26 +173,26 @@ bool afxEA_ParticleEmitter::ea_start()
bool afxEA_ParticleEmitter::ea_update(F32 dt)
{
if (emitter && in_scope)
if (emitter && mIn_scope)
{
if (do_bbox_update)
{
Box3F bbox = emitter->getObjBox();
bbox.minExtents = updated_pos + datablock->forced_bbox.minExtents;
bbox.maxExtents = updated_pos + datablock->forced_bbox.maxExtents;
bbox.minExtents = mUpdated_pos + mDatablock->forced_bbox.minExtents;
bbox.maxExtents = mUpdated_pos + mDatablock->forced_bbox.maxExtents;
emitter->setForcedObjBox(bbox);
emitter->setTransform(emitter->getTransform());
if (!datablock->update_forced_bbox)
if (!mDatablock->update_forced_bbox)
do_bbox_update = false;
}
if (do_fades)
emitter->setFadeAmount(fade_value);
if (mDo_fades)
emitter->setFadeAmount(mFade_value);
emitter->emitParticlesExt(updated_xfm, updated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000));
emitter->emitParticlesExt(mUpdated_xfm, mUpdated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000));
}
return true;
@ -209,7 +209,7 @@ void afxEA_ParticleEmitter::ea_finish(bool was_stopped)
// note - fully faded particles are not always
// invisible, so they are still kept alive and
// deleted via deleteWhenEmpty().
if (ew_timing.fade_out_time > 0.0f)
if (mEW_timing.fade_out_time > 0.0f)
emitter->setFadeAmount(0.0f);
if (dynamic_cast<afxParticleEmitter*>(emitter))
((afxParticleEmitter*)emitter)->setAFXOwner(0);
@ -240,32 +240,32 @@ void afxEA_ParticleEmitter::do_runtime_substitutions()
{
afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data;
emitter_data = new afxParticleEmitterVectorData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data))
{
afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data;
emitter_data = new afxParticleEmitterConeData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data))
{
afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data;
emitter_data = new afxParticleEmitterPathData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data))
{
afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data;
emitter_data = new afxParticleEmitterDiscData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
}
else
{
ParticleEmitterData* orig_db = emitter_data;
emitter_data = new ParticleEmitterData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
if (clone_particles)
@ -277,7 +277,7 @@ void afxEA_ParticleEmitter::do_runtime_substitutions()
// clone the datablock and perform substitutions
ParticleData* orig_db = emitter_data->particleDataBlocks[i];
emitter_data->particleDataBlocks[i] = new ParticleData(*orig_db, true);
orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], choreographer, group_index);
orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], mChoreographer, mGroup_index);
}
}
}

View file

@ -137,7 +137,7 @@ void afxEA_PhraseEffect::grab_player_triggers(U32& trigger_mask)
bool afxEA_PhraseEffect::ea_update(F32 dt)
{
if (fade_value >= 1.0f)
if (mFade_value >= 1.0f)
{
//
// Choreographer Triggers:
@ -145,7 +145,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt)
// They must be set explicitly by calls to afxChoreographer
// console-methods, setTriggerBit(), or clearTriggerBit().
//
U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : choreographer->getTriggerMask();
U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : mChoreographer->getTriggerMask();
//
// Constraint Triggers:
@ -191,7 +191,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt)
{
for (S32 i = 0; i < active_phrases->size(); i++)
{
(*active_phrases)[i]->stop(life_elapsed);
(*active_phrases)[i]->stop(mLife_elapsed);
}
}
}
@ -240,7 +240,7 @@ void afxEA_PhraseEffect::ea_finish(bool was_stopped)
{
for (S32 i = 0; i < active_phrases->size(); i++)
{
(*active_phrases)[i]->stop(life_elapsed);
(*active_phrases)[i]->stop(mLife_elapsed);
}
}
@ -252,7 +252,7 @@ void afxEA_PhraseEffect::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPhraseEffectData* orig_db = phrase_fx_data;
phrase_fx_data = new afxPhraseEffectData(*orig_db, true);
orig_db->performSubstitutions(phrase_fx_data, choreographer, group_index);
orig_db->performSubstitutions(phrase_fx_data, mChoreographer, mGroup_index);
}
}
@ -260,8 +260,8 @@ void afxEA_PhraseEffect::trigger_new_phrase()
{
//afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), /*willStop=*/false);
bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS;
afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), will_stop);
phrase->init(phrase_fx_data->fx_list, datablock->ewd_timing.lifetime, choreographer, time_factor, phrase_fx_data->n_loops, group_index);
afxPhrase* phrase = new afxPhrase(mChoreographer->isServerObject(), will_stop);
phrase->init(phrase_fx_data->fx_list, mDatablock->ewd_timing.lifetime, mChoreographer, mTime_factor, phrase_fx_data->n_loops, mGroup_index);
phrase->start(0, 0);
if (phrase->isEmpty())
{
@ -272,10 +272,10 @@ void afxEA_PhraseEffect::trigger_new_phrase()
if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING)
{
char obj_str[32];
dStrcpy(obj_str, Con::getIntArg(choreographer->getId()), 32);
dStrcpy(obj_str, Con::getIntArg(mChoreographer->getId()), 32);
char index_str[32];
dStrcpy(index_str, Con::getIntArg(group_index), 32);
dStrcpy(index_str, Con::getIntArg(mGroup_index), 32);
char buffer[1024];
char* b = buffer;
@ -331,9 +331,9 @@ void afxEA_PhraseEffect::update_active_phrases(F32 dt)
for (S32 i = 0; i < active_phrases->size(); i++)
{
afxPhrase* phrase = (*active_phrases)[i];
if (phrase->expired(life_elapsed))
phrase->recycle(life_elapsed);
phrase->update(dt, life_elapsed);
if (phrase->expired(mLife_elapsed))
phrase->recycle(mLife_elapsed);
phrase->update(dt, mLife_elapsed);
}
}

View file

@ -127,9 +127,9 @@ bool afxEA_PhysicalZone::ea_update(F32 dt)
set_cons_object((pos_constraint) ? pos_constraint->getSceneObject() : 0);
}
if (do_fades)
physical_zone->setFadeAmount(fade_value);
physical_zone->setTransform(updated_xfm);
if (mDo_fades)
physical_zone->setFadeAmount(mFade_value);
physical_zone->setTransform(mUpdated_xfm);
}
return true;
@ -172,7 +172,7 @@ void afxEA_PhysicalZone::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPhysicalZoneData* orig_db = zone_data;
zone_data = new afxPhysicalZoneData(*orig_db, true);
orig_db->performSubstitutions(zone_data, choreographer, group_index);
orig_db->performSubstitutions(zone_data, mChoreographer, mGroup_index);
}
}

View file

@ -136,7 +136,7 @@ void afxEA_PlayerMovement::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPlayerMovementData* orig_db = movement_data;
movement_data = new afxPlayerMovementData(*orig_db, true);
orig_db->performSubstitutions(movement_data, choreographer, group_index);
orig_db->performSubstitutions(movement_data, mChoreographer, mGroup_index);
}
}

View file

@ -80,8 +80,8 @@ bool afxEA_PlayerPuppet::ea_start()
do_runtime_substitutions();
afxConstraintID obj_id = cons_mgr->getConstraintId(mover_data->obj_def);
obj_cons = cons_mgr->getConstraint(obj_id);
afxConstraintID obj_id = mCons_mgr->getConstraintId(mover_data->obj_def);
obj_cons = mCons_mgr->getConstraint(obj_id);
Player* player = dynamic_cast<Player*>((obj_cons) ? obj_cons->getSceneObject() : 0);
if (player)
@ -94,9 +94,9 @@ bool afxEA_PlayerPuppet::ea_update(F32 dt)
{
SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0;
if (obj && in_scope)
if (obj && mIn_scope)
{
obj->setTransform(updated_xfm);
obj->setTransform(mUpdated_xfm);
}
return true;
@ -138,7 +138,7 @@ void afxEA_PlayerPuppet::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPlayerPuppetData* orig_db = mover_data;
mover_data = new afxPlayerPuppetData(*orig_db, true);
orig_db->performSubstitutions(mover_data, choreographer, group_index);
orig_db->performSubstitutions(mover_data, mChoreographer, mGroup_index);
}
}

View file

@ -203,12 +203,12 @@ bool afxEA_T3DPointLight::ea_update(F32 dt)
light->setConstraintObject(cons_obj);
#endif
light->setLiveColor(updated_color);
light->setLiveColor(mUpdated_color);
if (do_fades)
light->setFadeAmount(fade_value*updated_scale.x);
if (mDo_fades)
light->setFadeAmount(mFade_value*mUpdated_scale.x);
light->updateTransform(updated_xfm);
light->updateTransform(mUpdated_xfm);
// scale should not be updated this way. It messes up the culling.
//light->setScale(updated_scale);
@ -254,7 +254,7 @@ void afxEA_T3DPointLight::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxT3DPointLightData* orig_db = light_data;
light_data = new afxT3DPointLightData(*orig_db, true);
orig_db->performSubstitutions(light_data, choreographer, group_index);
orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index);
}
}

View file

@ -92,7 +92,7 @@ afxEA_Projectile::~afxEA_Projectile()
bool afxEA_Projectile::isDone()
{
return (datablock->use_as_cons_obj || datablock->use_ghost_as_cons_obj) ? projectile_done : impacted;
return (mDatablock->use_as_cons_obj || mDatablock->use_ghost_as_cons_obj) ? projectile_done : impacted;
}
void afxEA_Projectile::ea_set_datablock(SimDataBlock* db)
@ -117,8 +117,8 @@ bool afxEA_Projectile::ea_start()
}
else
{
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING)
projectile = new afxProjectile(afx_projectile_data->networking, choreographer->getChoreographerId(), datablock->effect_name);
if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
projectile = new afxProjectile(afx_projectile_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name);
else
projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING);
projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout;
@ -127,8 +127,8 @@ bool afxEA_Projectile::ea_start()
projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask;
projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask;
}
afxConstraintID launch_pos_id = cons_mgr->getConstraintId(afx_projectile_data->launch_pos_def);
launch_cons = cons_mgr->getConstraint(launch_pos_id);
afxConstraintID launch_pos_id = mCons_mgr->getConstraintId(afx_projectile_data->launch_pos_def);
launch_cons = mCons_mgr->getConstraint(launch_pos_id);
launch_dir_bias = afx_projectile_data->launch_dir_bias;
}
@ -141,7 +141,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
{
if (!launched && projectile)
{
if (in_scope)
if (mIn_scope)
{
afxConstraint* pos_cons = getPosConstraint();
ShapeBase* src_obj = (pos_cons) ? (dynamic_cast<ShapeBase*>(pos_cons->getSceneObject())) : 0;
@ -155,19 +155,19 @@ bool afxEA_Projectile::ea_update(F32 dt)
{
case afxProjectileData::OrientConstraint:
dir_vec.set(0,0,1);
updated_xfm.mulV(dir_vec);
mUpdated_xfm.mulV(dir_vec);
break;
case afxProjectileData::LaunchDirField:
dir_vec.set(0,0,1);
break;
case afxProjectileData::TowardPos2Constraint:
default:
dir_vec = updated_aim - updated_pos;
dir_vec = mUpdated_aim - mUpdated_pos;
break;
}
}
else
dir_vec = updated_aim - updated_pos;
dir_vec = mUpdated_aim - mUpdated_pos;
dir_vec.normalizeSafe();
if (!launch_dir_bias.isZero())
@ -184,7 +184,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
projectile->init(launch_pos, dir_vec, (launch_obj) ? launch_obj : src_obj);
}
else
projectile->init(updated_pos, dir_vec, src_obj);
projectile->init(mUpdated_pos, dir_vec, src_obj);
if (!projectile->registerObject())
{
@ -197,7 +197,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
deleteNotify(projectile);
if (projectile)
projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString());
projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString());
}
launched = true;
@ -205,10 +205,10 @@ bool afxEA_Projectile::ea_update(F32 dt)
if (launched && projectile)
{
if (in_scope)
if (mIn_scope)
{
updated_xfm = projectile->getRenderTransform();
updated_xfm.getColumn(3, &updated_pos);
mUpdated_xfm = projectile->getRenderTransform();
mUpdated_xfm.getColumn(3, &mUpdated_pos);
}
}
@ -247,7 +247,7 @@ void afxEA_Projectile::do_runtime_substitutions()
afxProjectileData* orig_db = (afxProjectileData*)projectile_data;
afx_projectile_data = new afxProjectileData(*orig_db, true);
projectile_data = afx_projectile_data;
orig_db->performSubstitutions(projectile_data, choreographer, group_index);
orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index);
}
else
{
@ -255,7 +255,7 @@ void afxEA_Projectile::do_runtime_substitutions()
ProjectileData* orig_db = projectile_data;
afx_projectile_data = 0;
projectile_data = new ProjectileData(*orig_db, true);
orig_db->performSubstitutions(projectile_data, choreographer, group_index);
orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index);
}
}
}

View file

@ -91,10 +91,10 @@ bool afxEA_ScriptEvent::ea_start()
bool afxEA_ScriptEvent::ea_update(F32 dt)
{
if (!ran_script && choreographer != NULL)
if (!ran_script && mChoreographer != NULL)
{
afxConstraint* pos_constraint = getPosConstraint();
choreographer->executeScriptEvent(script_data->method_name, pos_constraint, updated_xfm,
mChoreographer->executeScriptEvent(script_data->method_name, pos_constraint, mUpdated_xfm,
script_data->script_data);
ran_script = true;
}
@ -115,7 +115,7 @@ void afxEA_ScriptEvent::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxScriptEventData* orig_db = script_data;
script_data = new afxScriptEventData(*orig_db, true);
orig_db->performSubstitutions(script_data, choreographer, group_index);
orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index);
}
}

View file

@ -108,15 +108,15 @@ bool afxEA_Sound::ea_update(F32 dt)
{
if (!sound_handle)
{
sound_handle = SFX->createSource(sound_prof, &updated_xfm, 0);
sound_handle = SFX->createSource(sound_prof, &mUpdated_xfm, 0);
if (sound_handle)
sound_handle->play();
}
if (sound_handle)
{
sound_handle->setTransform(updated_xfm);
sound_handle->setVolume((in_scope) ? updated_scale.x*fade_value : 0.0f);
sound_handle->setTransform(mUpdated_xfm);
sound_handle->setVolume((mIn_scope) ? mUpdated_scale.x*mFade_value : 0.0f);
deleteNotify(sound_handle);
}
@ -134,7 +134,7 @@ void afxEA_Sound::ea_finish(bool was_stopped)
void afxEA_Sound::do_runtime_substitutions()
{
sound_prof = sound_prof->cloneAndPerformSubstitutions(choreographer, group_index);
sound_prof = sound_prof->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
sound_desc = sound_prof->getDescription();
}

View file

@ -207,12 +207,12 @@ bool afxEA_T3DSpotLight::ea_update(F32 dt)
light->setConstraintObject(cons_obj);
#endif
light->setLiveColor(updated_color);
light->setLiveColor(mUpdated_color);
if (do_fades)
light->setFadeAmount(fade_value);
if (mDo_fades)
light->setFadeAmount(mFade_value);
light->updateTransform(updated_xfm);
light->updateTransform(mUpdated_xfm);
// scale should not be updated this way. It messes up the culling.
//light->setScale(updated_scale);
@ -258,7 +258,7 @@ void afxEA_T3DSpotLight::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxT3DSpotLightData* orig_db = light_data;
light_data = new afxT3DSpotLightData(*orig_db, true);
orig_db->performSubstitutions(light_data, choreographer, group_index);
orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index);
}
}

View file

@ -97,7 +97,7 @@ bool afxEA_StaticShape::ea_start()
do_runtime_substitutions();
// fades are handled using startFade() calls.
do_fades = false;
mDo_fades = false;
return true;
}
@ -108,8 +108,8 @@ bool afxEA_StaticShape::ea_update(F32 dt)
{
// create and register effect
static_shape = new afxStaticShape();
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING)
static_shape->init(choreographer->getChoreographerId(), datablock->effect_name);
if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
static_shape->init(mChoreographer->getChoreographerId(), mDatablock->effect_name);
static_shape->onNewDataBlock(shape_data, false);
if (!static_shape->registerObject())
@ -122,26 +122,26 @@ bool afxEA_StaticShape::ea_update(F32 dt)
deleteNotify(static_shape);
registerForCleanup(static_shape);
if (ew_timing.fade_in_time > 0.0f)
static_shape->startFade(ew_timing.fade_in_time, 0, false);
if (mEW_timing.fade_in_time > 0.0f)
static_shape->startFade(mEW_timing.fade_in_time, 0, false);
}
if (static_shape)
{
if (!fade_out_started && elapsed > fade_out_start)
if (!fade_out_started && mElapsed > mFade_out_start)
{
if (!do_spawn)
{
if (ew_timing.fade_out_time > 0.0f)
static_shape->startFade(ew_timing.fade_out_time, 0, true);
if (mEW_timing.fade_out_time > 0.0f)
static_shape->startFade(mEW_timing.fade_out_time, 0, true);
}
fade_out_started = true;
}
if (in_scope)
if (mIn_scope)
{
static_shape->setTransform(updated_xfm);
static_shape->setScale(updated_scale);
static_shape->setTransform(mUpdated_xfm);
static_shape->setScale(mUpdated_scale);
}
}
@ -155,7 +155,7 @@ void afxEA_StaticShape::ea_finish(bool was_stopped)
if (do_spawn)
{
Con::executef(shape_data, "onSpawn", static_shape->getIdString(), datablock->effect_name);
Con::executef(shape_data, "onSpawn", static_shape->getIdString(), mDatablock->effect_name);
clearNotify(static_shape);
}
else
@ -204,13 +204,13 @@ void afxEA_StaticShape::do_runtime_substitutions()
{
afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data;
shape_data = new afxStaticShapeData(*orig_db, true);
orig_db->performSubstitutions(shape_data, choreographer, group_index);
orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index);
}
else
{
StaticShapeData* orig_db = shape_data;
shape_data = new StaticShapeData(*orig_db, true);
orig_db->performSubstitutions(shape_data, choreographer, group_index);
orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index);
}
}
}

View file

@ -108,16 +108,16 @@ F32 afxEA_Zodiac::calc_facing_angle()
inline F32 afxEA_Zodiac::calc_terrain_alt_bias()
{
if (terrain_altitude >= zode_data->altitude_max)
if (mTerrain_altitude >= zode_data->altitude_max)
return 0.0f;
return 1.0f - (terrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
return 1.0f - (mTerrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
}
inline F32 afxEA_Zodiac::calc_interior_alt_bias()
{
if (interior_altitude >= zode_data->altitude_max)
if (mInterior_altitude >= zode_data->altitude_max)
return 0.0f;
return 1.0f - (interior_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
return 1.0f - (mInterior_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
}
afxEA_Zodiac::afxEA_Zodiac()
@ -170,13 +170,13 @@ bool afxEA_Zodiac::ea_start()
bool afxEA_Zodiac::ea_update(F32 dt)
{
if (!in_scope)
if (!mIn_scope)
return true;
//~~~~~~~~~~~~~~~~~~~~//
// Zodiac Color
zode_color = updated_color;
zode_color = mUpdated_color;
if (live_color_factor > 0.0)
{
@ -190,15 +190,15 @@ bool afxEA_Zodiac::ea_update(F32 dt)
//Con::printf("LIVE-COLOR-FACTOR is ZERO");
}
if (do_fades)
if (mDo_fades)
{
if (fade_value < 0.01f)
if (mFade_value < 0.01f)
return true; // too transparent
if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE)
zode_color *= fade_value*live_fade_factor;
zode_color *= mFade_value * mLive_fade_factor;
else
zode_color.alpha *= fade_value*live_fade_factor;
zode_color.alpha *= mFade_value * mLive_fade_factor;
}
if (zode_color.alpha < 0.01f)
@ -208,22 +208,22 @@ bool afxEA_Zodiac::ea_update(F32 dt)
// Zodiac
// scale and grow zode
zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate;
zode_radius = zode_data->radius_xy*mUpdated_scale.x + mLife_elapsed *zode_data->growth_rate;
// zode is growing
if (life_elapsed < zode_data->grow_in_time)
if (mLife_elapsed < zode_data->grow_in_time)
{
F32 t = life_elapsed/zode_data->grow_in_time;
F32 t = mLife_elapsed /zode_data->grow_in_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f);
}
// zode is shrinking
else if (full_lifetime - life_elapsed < zode_data->shrink_out_time)
else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time)
{
F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time;
F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f);
}
zode_radius *= live_scale_factor;
zode_radius *= mLive_scale_factor;
if (zode_radius < 0.001f)
return true; // too small
@ -238,7 +238,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
//~~~~~~~~~~~~~~~~~~~~//
// Zodiac Position
zode_pos = updated_pos;
zode_pos = mUpdated_pos;
//~~~~~~~~~~~~~~~~~~~~//
// Zodiac Rotation
@ -249,7 +249,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
if (orient_constraint)
{
VectorF shape_vec;
updated_xfm.getColumn(1, &shape_vec);
mUpdated_xfm.getColumn(1, &shape_vec);
shape_vec.z = 0.0f;
shape_vec.normalize();
F32 pitch, yaw;
@ -258,14 +258,14 @@ bool afxEA_Zodiac::ea_update(F32 dt)
}
}
zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor);
zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor);
zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f);
//~~~~~~~~~~~~~~~~~~~~//
// post zodiac
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0)
{
if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_terrain_alt_bias();
if (alt_bias > 0.0f)
@ -287,7 +287,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0)
{
if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_interior_alt_bias();
if (alt_bias > 0.0f)
@ -310,17 +310,17 @@ bool afxEA_Zodiac::ea_update(F32 dt)
void afxEA_Zodiac::ea_finish(bool was_stopped)
{
if (in_scope && ew_timing.residue_lifetime > 0)
if (mIn_scope && mEW_timing.residue_lifetime > 0)
{
if (do_fades)
if (mDo_fades)
{
if (fade_value < 0.01f)
if (mFade_value < 0.01f)
return;
zode_color.alpha *= fade_value;
zode_color.alpha *= mFade_value;
}
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0)
{
if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_terrain_alt_bias();
if (alt_bias > 0.0f)
@ -332,20 +332,20 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (zode_data->altitude_fades)
zode_color.alpha *= alt_bias;
became_residue = true;
afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, alt_rad,
afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, alt_rad,
alt_clr, zode_angle);
}
}
else
{
became_residue = true;
afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, zode_radius,
afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, zode_radius,
zode_color, zode_angle);
}
}
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0)
{
if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_interior_alt_bias();
if (alt_bias > 0.0f)
@ -361,7 +361,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (became_residue)
temp_zode = new afxZodiacData(*zode_data, true);
became_residue = true;
afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, alt_rad,
afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, alt_rad,
zode_vrange, alt_clr, zode_angle);
}
@ -372,7 +372,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (became_residue)
temp_zode = new afxZodiacData(*zode_data, true);
became_residue = true;
afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, zode_radius,
afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, zode_radius,
zode_vrange, zode_color, zode_angle);
}
}
@ -387,7 +387,7 @@ void afxEA_Zodiac::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxZodiacData* orig_db = zode_data;
zode_data = new afxZodiacData(*orig_db, true);
orig_db->performSubstitutions(zode_data, choreographer, group_index);
orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index);
}
}

View file

@ -174,42 +174,42 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
if (pzode)
{
//LinearColorF zode_color = zode_data->color;
LinearColorF zode_color = updated_color;
LinearColorF zode_color = mUpdated_color;
if (live_color_factor > 0.0)
zode_color.interpolate(zode_color, live_color, live_color_factor);
if (do_fades)
if (mDo_fades)
{
if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE)
zode_color *= fade_value*live_fade_factor;
zode_color *= mFade_value *mLive_fade_factor;
else
zode_color.alpha *= fade_value*live_fade_factor;
zode_color.alpha *= mFade_value * mLive_fade_factor;
}
// scale and grow zode
//F32 zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate;
F32 zode_radius = zode_data->radius_xy + life_elapsed*zode_data->growth_rate;
F32 zode_radius = zode_data->radius_xy + mLife_elapsed *zode_data->growth_rate;
// zode is growing
if (life_elapsed < zode_data->grow_in_time)
if (mLife_elapsed < zode_data->grow_in_time)
{
F32 t = life_elapsed/zode_data->grow_in_time;
F32 t = mLife_elapsed /zode_data->grow_in_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f);
}
// zode is shrinking
else if (full_lifetime - life_elapsed < zode_data->shrink_out_time)
else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time)
{
F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time;
F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f);
}
zode_radius *= live_scale_factor;
zode_radius *= mLive_scale_factor;
if (zode_data->respect_ori_cons && !zode_data->use_full_xfm)
{
VectorF shape_vec;
updated_xfm.getColumn(1, &shape_vec);
mUpdated_xfm.getColumn(1, &shape_vec);
shape_vec.normalize();
F32 ang;
@ -246,7 +246,7 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
zode_angle_offset = mRadToDeg(ang);
}
F32 zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor);
F32 zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor);
zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f);
aa_rot.angle = mDegToRad(zode_angle);
@ -258,13 +258,13 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
pzode->setRadius(zode_radius);
if (zode_data->use_full_xfm)
{
updated_xfm.mul(spin_xfm);
pzode->setTransform(updated_xfm);
mUpdated_xfm.mul(spin_xfm);
pzode->setTransform(mUpdated_xfm);
}
else
pzode->setTransform(spin_xfm);
pzode->setPosition(updated_pos);
pzode->setScale(updated_scale);
pzode->setPosition(mUpdated_pos);
pzode->setScale(mUpdated_scale);
}
return true;
@ -307,7 +307,7 @@ void afxEA_ZodiacPlane::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxZodiacPlaneData* orig_db = zode_data;
zode_data = new afxZodiacPlaneData(*orig_db, true);
orig_db->performSubstitutions(zode_data, choreographer, group_index);
orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index);
}
}

View file

@ -95,7 +95,7 @@ bool afxEA_Force::ea_start()
do_runtime_substitutions();
force_set_mgr = choreographer->getForceSetMgr();
force_set_mgr = mChoreographer->getForceSetMgr();
return true;
}
@ -109,7 +109,7 @@ bool afxEA_Force::ea_update(F32 dt)
{
delete force;
force = 0;
Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", datablock->getName());
Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", mDatablock->getName());
return false;
}
force->onNewDataBlock(force_data, false);
@ -123,8 +123,8 @@ bool afxEA_Force::ea_update(F32 dt)
if (force) // && in_scope)
{
if (do_fades)
force->setFadeAmount(fade_value);
if (mDo_fades)
force->setFadeAmount(mFade_value);
force->update(dt);
}
@ -145,7 +145,7 @@ void afxEA_Force::ea_finish(bool was_stopped)
void afxEA_Force::do_runtime_substitutions()
{
force_data = force_data->cloneAndPerformSubstitutions(choreographer, group_index);
force_data = force_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -60,13 +60,13 @@ class afxXM_AltitudeConform : public afxXM_WeightedBase
{
typedef afxXM_WeightedBase Parent;
afxXM_AltitudeConformData* db;
SceneContainer* container;
bool do_freeze;
bool is_frozen;
F32 terrain_alt;
F32 interior_alt;
Point3F conformed_pos;
afxXM_AltitudeConformData* mConformData;
SceneContainer* mContainer;
bool mDo_freeze;
bool mIs_frozen;
F32 mTerrain_alt;
F32 mInterior_alt;
Point3F mConformed_pos;
public:
/*C*/ afxXM_AltitudeConform(afxXM_AltitudeConformData*, afxEffectWrapper*, bool on_server);
@ -157,24 +157,24 @@ afxXM_Base* afxXM_AltitudeConformData::create(afxEffectWrapper* fx, bool on_serv
afxXM_AltitudeConform::afxXM_AltitudeConform(afxXM_AltitudeConformData* db, afxEffectWrapper* fxw, bool on_server)
: afxXM_WeightedBase(db, fxw)
{
this->db = db;
container = (on_server) ? &gServerContainer : &gClientContainer;
do_freeze = db->do_freeze;
is_frozen = false;
terrain_alt = -1.0f;
interior_alt = -1.0f;
conformed_pos.zero();
mConformData = db;
mContainer = (on_server) ? &gServerContainer : &gClientContainer;
mDo_freeze = db->do_freeze;
mIs_frozen = false;
mTerrain_alt = -1.0f;
mInterior_alt = -1.0f;
mConformed_pos.zero();
}
void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params)
{
if (is_frozen)
if (mIs_frozen)
{
if (terrain_alt >= 0.0f)
fx_wrapper->setTerrainAltitude(terrain_alt);
if (interior_alt >= 0.0f)
fx_wrapper->setInteriorAltitude(interior_alt);
params.pos = conformed_pos;
if (mTerrain_alt >= 0.0f)
fx_wrapper->setTerrainAltitude(mTerrain_alt);
if (mInterior_alt >= 0.0f)
fx_wrapper->setInteriorAltitude(mInterior_alt);
params.pos = mConformed_pos;
return;
}
@ -185,53 +185,51 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para
// find primary ground
Point3F above_pos(params.pos); above_pos.z += 0.1f;
Point3F below_pos(params.pos); below_pos.z -= 10000;
hit1 = container->castRay(above_pos, below_pos, db->interior_types | db->terrain_types, &rInfo1);
hit1 = mContainer->castRay(above_pos, below_pos, mConformData->interior_types | mConformData->terrain_types, &rInfo1);
// find secondary ground
if (hit1 && rInfo1.object)
{
hit1_is_interior = ((rInfo1.object->getTypeMask() & db->interior_types) != 0);
U32 mask = (hit1_is_interior) ? db->terrain_types : db->interior_types;
Point3F above_pos(params.pos); above_pos.z += 0.1f;
Point3F below_pos(params.pos); below_pos.z -= 10000;
hit2 = container->castRay(above_pos, below_pos, mask, &rInfo2);
hit1_is_interior = ((rInfo1.object->getTypeMask() & mConformData->interior_types) != 0);
U32 mask = (hit1_is_interior) ? mConformData->terrain_types : mConformData->interior_types;
hit2 = mContainer->castRay(above_pos, below_pos, mask, &rInfo2);
}
if (hit1)
{
F32 wt_factor = calc_weight_factor(elapsed);
F32 incoming_z = params.pos.z;
F32 ground1_z = rInfo1.point.z + db->height;
F32 ground1_z = rInfo1.point.z + mConformData->height;
F32 pos_z = ground1_z + (1.0f - wt_factor)*(incoming_z - ground1_z);
if (hit1_is_interior)
{
interior_alt = incoming_z - pos_z;
fx_wrapper->setInteriorAltitude(interior_alt);
if (db->do_interiors)
mInterior_alt = incoming_z - pos_z;
fx_wrapper->setInteriorAltitude(mInterior_alt);
if (mConformData->do_interiors)
params.pos.z = pos_z;
}
else
{
terrain_alt = incoming_z - pos_z;
fx_wrapper->setTerrainAltitude(terrain_alt);
if (db->do_terrain)
mTerrain_alt = incoming_z - pos_z;
fx_wrapper->setTerrainAltitude(mTerrain_alt);
if (mConformData->do_terrain)
params.pos.z = pos_z;
}
if (hit2)
{
F32 ground2_z = rInfo2.point.z + db->height;
F32 ground2_z = rInfo2.point.z + mConformData->height;
F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z);
if (hit1_is_interior)
{
terrain_alt = incoming_z - z2;
fx_wrapper->setTerrainAltitude(terrain_alt);
mTerrain_alt = incoming_z - z2;
fx_wrapper->setTerrainAltitude(mTerrain_alt);
}
else
{
interior_alt = incoming_z - z2;
fx_wrapper->setInteriorAltitude(interior_alt);
mInterior_alt = incoming_z - z2;
fx_wrapper->setInteriorAltitude(mInterior_alt);
}
}
@ -241,19 +239,19 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para
RayInfo rInfo0;
Point3F lookup_from_pos(params.pos); lookup_from_pos.z -= 0.1f;
Point3F lookup_to_pos(params.pos); lookup_to_pos.z += 10000;
if (container->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0))
if (mContainer->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0))
{
F32 ground2_z = rInfo0.point.z + db->height;
F32 ground2_z = rInfo0.point.z + mConformData->height;
F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z);
terrain_alt = z2 - incoming_z;
fx_wrapper->setTerrainAltitude(terrain_alt);
mTerrain_alt = z2 - incoming_z;
fx_wrapper->setTerrainAltitude(mTerrain_alt);
}
}
if (do_freeze)
if (mDo_freeze)
{
conformed_pos = params.pos;
is_frozen = true;
mConformed_pos = params.pos;
mIs_frozen = true;
}
}
}

View file

@ -63,11 +63,11 @@ class afxXM_MountedImageNode : public afxXM_Base
{
typedef afxXM_Base Parent;
StringTableEntry node_name;
U32 image_slot;
S32 node_ID;
ShapeBase* shape;
afxConstraint* cons;
StringTableEntry mNode_name;
U32 mImage_slot;
S32 mNode_ID;
ShapeBase* mShape;
afxConstraint* mCons;
afxConstraint* find_constraint();
@ -163,11 +163,11 @@ afxXM_Base* afxXM_MountedImageNodeData::create(afxEffectWrapper* fx, bool on_ser
afxXM_MountedImageNode::afxXM_MountedImageNode(afxXM_MountedImageNodeData* db, afxEffectWrapper* fxw)
: afxXM_Base(db, fxw)
{
image_slot = db->image_slot;
node_name = db->node_name;
cons = 0;
node_ID = -1;
shape = 0;
mImage_slot = db->image_slot;
mNode_name = db->node_name;
mCons = 0;
mNode_ID = -1;
mShape = 0;
}
// find the first constraint with a shape by checking pos
@ -189,41 +189,41 @@ void afxXM_MountedImageNode::start(F32 timestamp)
{
// constraint won't change over the modifier's
// lifetime so we find it here in start().
cons = find_constraint();
if (!cons)
mCons = find_constraint();
if (!mCons)
Con::errorf(ConsoleLogEntry::General,
"afxXM_MountedImageNode: failed to find a ShapeBase derived constraint source.");
}
void afxXM_MountedImageNode::updateParams(F32 dt, F32 elapsed, afxXM_Params& params)
{
if (!cons)
if (!mCons)
return;
// validate shape
// The shape must be validated in case it gets deleted
// of goes out scope.
SceneObject* scene_object = cons->getSceneObject();
if (scene_object != (SceneObject*)shape)
SceneObject* scene_object = mCons->getSceneObject();
if (scene_object != (SceneObject*)mShape)
{
shape = dynamic_cast<ShapeBase*>(scene_object);
if (shape && node_name != ST_NULLSTRING)
mShape = dynamic_cast<ShapeBase*>(scene_object);
if (mShape && mNode_name != ST_NULLSTRING)
{
node_ID = shape->getNodeIndex(image_slot, node_name);
if (node_ID < 0)
mNode_ID = mShape->getNodeIndex(mImage_slot, mNode_name);
if (mNode_ID < 0)
{
Con::errorf(ConsoleLogEntry::General,
"afxXM_MountedImageNode: failed to find nodeName, \"%s\".",
node_name);
mNode_name);
}
}
else
node_ID = -1;
mNode_ID = -1;
}
if (shape)
if (mShape)
{
shape->getImageTransform(image_slot, node_ID, &params.ori);
mShape->getImageTransform(mImage_slot, mNode_ID, &params.ori);
params.pos = params.ori.getPosition();
}
}