Torque3D/Engine/source/afx/ce/afxFootSwitch.cpp

117 lines
4.3 KiB
C++
Raw Normal View History

2017-07-26 08:35:44 +00:00
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "afx/arcaneFX.h"
#include "console/consoleTypes.h"
#include "core/stream/bitStream.h"
#include "afx/ce/afxFootSwitch.h"
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxFootSwitchData
IMPLEMENT_CO_DATABLOCK_V1(afxFootSwitchData);
ConsoleDocClass( afxFootSwitchData,
"@brief A datablock that specifies a Foot Switch effect.\n\n"
"A Foot Switch effect is used to disable some or all of the standard built-in footstep effects generated by Player objects."
"\n\n"
"Stock Player objects generate footprint decals, footstep sounds, and puffs of particle dust in response to special "
"animation triggers embedded in the Player's dts model. With the help of Phase Effects, AFX can substitute alternatives for "
"these built-in effects. When this is done, it is often preferable to turn off some or all of the built-in footstep effects."
"\n\n"
"Foot Switch effects are only meaningful when the primary position constraint is a Player or Player-derived object."
"\n\n"
"@ingroup afxEffects\n"
"@ingroup AFX\n"
"@ingroup Datablocks\n"
);
afxFootSwitchData::afxFootSwitchData()
{
override_all = false;
override_decals = false;
override_sounds = false;
override_dust = false;
}
afxFootSwitchData::afxFootSwitchData(const afxFootSwitchData& other, bool temp_clone) : GameBaseData(other, temp_clone)
{
override_all = other.override_all;
override_decals = other.override_decals;
override_sounds = other.override_sounds;
override_dust = other.override_dust;
}
#define myOffset(field) Offset(field, afxFootSwitchData)
void afxFootSwitchData::initPersistFields()
{
addField("overrideAll", TypeBool, myOffset(override_all),
"When true, all of a Player's footstep effects are turned off for the duration of "
"the foot-switch effect.");
addField("overrideDecals", TypeBool, myOffset(override_decals),
"Specifically selects whether the Player's footprint decals are enabled.");
addField("overrideSounds", TypeBool, myOffset(override_sounds),
"Specifically selects whether the Player's footstep sounds are enabled.");
addField("overrideDust", TypeBool, myOffset(override_dust),
"Specifically selects whether the Player's footstep puffs of dust are enabled.");
Parent::initPersistFields();
}
void afxFootSwitchData::packData(BitStream* stream)
{
Parent::packData(stream);
if (!stream->writeFlag(override_all))
{
stream->writeFlag(override_decals);
stream->writeFlag(override_sounds);
stream->writeFlag(override_dust);
}
}
void afxFootSwitchData::unpackData(BitStream* stream)
{
Parent::unpackData(stream);
override_all = stream->readFlag();
if (!override_all)
{
override_decals = stream->readFlag();
override_sounds = stream->readFlag();
override_dust = stream->readFlag();
}
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//