mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-20 11:55:33 +00:00
afx footswitch membervar cleanups
This commit is contained in:
parent
fa3839f11c
commit
fa6b65a981
1 changed files with 29 additions and 29 deletions
|
|
@ -40,8 +40,8 @@ class afxEA_FootSwitch : public afxEffectWrapper
|
||||||
{
|
{
|
||||||
typedef afxEffectWrapper Parent;
|
typedef afxEffectWrapper Parent;
|
||||||
|
|
||||||
afxFootSwitchData* footfall_data;
|
afxFootSwitchData* mFootfall_data;
|
||||||
Player* player;
|
Player* mPlayer;
|
||||||
|
|
||||||
void do_runtime_substitutions();
|
void do_runtime_substitutions();
|
||||||
|
|
||||||
|
|
@ -62,38 +62,38 @@ public:
|
||||||
|
|
||||||
afxEA_FootSwitch::afxEA_FootSwitch()
|
afxEA_FootSwitch::afxEA_FootSwitch()
|
||||||
{
|
{
|
||||||
footfall_data = 0;
|
mFootfall_data = 0;
|
||||||
player = 0;
|
mPlayer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void afxEA_FootSwitch::set_overrides(Player* player)
|
inline void afxEA_FootSwitch::set_overrides(Player* player)
|
||||||
{
|
{
|
||||||
if (footfall_data->override_all)
|
if (mFootfall_data->override_all)
|
||||||
player->overrideFootfallFX();
|
player->overrideFootfallFX();
|
||||||
else
|
else
|
||||||
player->overrideFootfallFX(footfall_data->override_decals,
|
player->overrideFootfallFX(mFootfall_data->override_decals,
|
||||||
footfall_data->override_sounds,
|
mFootfall_data->override_sounds,
|
||||||
footfall_data->override_dust);
|
mFootfall_data->override_dust);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void afxEA_FootSwitch::clear_overrides(Player* player)
|
inline void afxEA_FootSwitch::clear_overrides(Player* player)
|
||||||
{
|
{
|
||||||
if (footfall_data->override_all)
|
if (mFootfall_data->override_all)
|
||||||
player->restoreFootfallFX();
|
player->restoreFootfallFX();
|
||||||
else
|
else
|
||||||
player->restoreFootfallFX(footfall_data->override_decals,
|
player->restoreFootfallFX(mFootfall_data->override_decals,
|
||||||
footfall_data->override_sounds,
|
mFootfall_data->override_sounds,
|
||||||
footfall_data->override_dust);
|
mFootfall_data->override_dust);
|
||||||
}
|
}
|
||||||
|
|
||||||
void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db)
|
void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db)
|
||||||
{
|
{
|
||||||
footfall_data = dynamic_cast<afxFootSwitchData*>(db);
|
mFootfall_data = dynamic_cast<afxFootSwitchData*>(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool afxEA_FootSwitch::ea_start()
|
bool afxEA_FootSwitch::ea_start()
|
||||||
{
|
{
|
||||||
if (!footfall_data)
|
if (!mFootfall_data)
|
||||||
{
|
{
|
||||||
Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock.");
|
Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock.");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -102,25 +102,25 @@ bool afxEA_FootSwitch::ea_start()
|
||||||
do_runtime_substitutions();
|
do_runtime_substitutions();
|
||||||
|
|
||||||
afxConstraint* pos_cons = getPosConstraint();
|
afxConstraint* pos_cons = getPosConstraint();
|
||||||
player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
|
mPlayer = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
|
||||||
if (player)
|
if (mPlayer)
|
||||||
set_overrides(player);
|
set_overrides(mPlayer);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool afxEA_FootSwitch::ea_update(F32 dt)
|
bool afxEA_FootSwitch::ea_update(F32 dt)
|
||||||
{
|
{
|
||||||
if (!player)
|
if (!mPlayer)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
afxConstraint* pos_cons = getPosConstraint();
|
afxConstraint* pos_cons = getPosConstraint();
|
||||||
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
|
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
|
||||||
if (temp_player && temp_player != player)
|
if (temp_player && temp_player != mPlayer)
|
||||||
{
|
{
|
||||||
player = temp_player;
|
mPlayer = temp_player;
|
||||||
if (player)
|
if (mPlayer)
|
||||||
set_overrides(player);
|
set_overrides(mPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -128,24 +128,24 @@ bool afxEA_FootSwitch::ea_update(F32 dt)
|
||||||
|
|
||||||
void afxEA_FootSwitch::ea_finish(bool was_stopped)
|
void afxEA_FootSwitch::ea_finish(bool was_stopped)
|
||||||
{
|
{
|
||||||
if (!player)
|
if (!mPlayer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
afxConstraint* pos_cons = getPosConstraint();
|
afxConstraint* pos_cons = getPosConstraint();
|
||||||
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
|
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
|
||||||
if (temp_player == player)
|
if (temp_player == mPlayer)
|
||||||
clear_overrides(player);
|
clear_overrides(mPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void afxEA_FootSwitch::do_runtime_substitutions()
|
void afxEA_FootSwitch::do_runtime_substitutions()
|
||||||
{
|
{
|
||||||
// only clone the datablock if there are substitutions
|
// only clone the datablock if there are substitutions
|
||||||
if (footfall_data->getSubstitutionCount() > 0)
|
if (mFootfall_data->getSubstitutionCount() > 0)
|
||||||
{
|
{
|
||||||
// clone the datablock and perform substitutions
|
// clone the datablock and perform substitutions
|
||||||
afxFootSwitchData* orig_db = footfall_data;
|
afxFootSwitchData* orig_db = mFootfall_data;
|
||||||
footfall_data = new afxFootSwitchData(*orig_db, true);
|
mFootfall_data = new afxFootSwitchData(*orig_db, true);
|
||||||
orig_db->performSubstitutions(footfall_data, mChoreographer, mGroup_index);
|
orig_db->performSubstitutions(mFootfall_data, mChoreographer, mGroup_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue