Torque3D Documentation / _generateds / afxPlayerPuppet.cpp

afxPlayerPuppet.cpp

Engine/source/afx/ce/afxPlayerPuppet.cpp

More...

Public Defines

define
myOffset(field) (field, )

Public Functions

ConsoleDocClass(afxPlayerPuppetData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> Puppet <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "<a href="/coding/class/classplayer/">Player</a> Puppet effects are defined using the <a href="/coding/class/classafxplayerpuppetdata/">afxPlayerPuppetData</a> datablock and are used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the movement of " "<a href="/coding/class/classplayer/">Player</a> objects with the AFX constraint system. The <a href="/coding/class/classplayer/">Player</a> Puppet effect is similar <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classplayer/">Player</a> Movement effect, but " "where movement effects 'steer' the player using the same mechanisms that allow <a href="/coding/class/classplayer/">Player</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> from mouse and keyboard " " input, <a href="/coding/class/classplayer/">Player</a> Puppet effects totally take over <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> 's transformation using the AFX constraint system." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "<a href="/coding/class/classplayer/">Player</a> Puppet can be configured <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> directly move <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> 's client ghosts as well as its server instance. When doing this, " "it is important <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> keep the general motion of the <a href="/coding/class/classplayer/">Player</a> object and its ghosts somewhat consistent. Otherwise, obvious " "discontinuities in the motion will result when the <a href="/coding/class/classplayer/">Player</a> Puppet ends and <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is restored <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the server Player." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

Detailed Description

Public Defines

myOffset(field) (field, )

Public Functions

ConsoleDocClass(afxPlayerPuppetData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> Puppet <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "<a href="/coding/class/classplayer/">Player</a> Puppet effects are defined using the <a href="/coding/class/classafxplayerpuppetdata/">afxPlayerPuppetData</a> datablock and are used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the movement of " "<a href="/coding/class/classplayer/">Player</a> objects with the AFX constraint system. The <a href="/coding/class/classplayer/">Player</a> Puppet effect is similar <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classplayer/">Player</a> Movement effect, but " "where movement effects 'steer' the player using the same mechanisms that allow <a href="/coding/class/classplayer/">Player</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> from mouse and keyboard " " input, <a href="/coding/class/classplayer/">Player</a> Puppet effects totally take over <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> 's transformation using the AFX constraint system." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "<a href="/coding/class/classplayer/">Player</a> Puppet can be configured <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> directly move <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> 's client ghosts as well as its server instance. When doing this, " "it is important <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> keep the general motion of the <a href="/coding/class/classplayer/">Player</a> object and its ghosts somewhat consistent. Otherwise, obvious " "discontinuities in the motion will result when the <a href="/coding/class/classplayer/">Player</a> Puppet ends and <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is restored <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the server Player." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

IMPLEMENT_CO_DATABLOCK_V1(afxPlayerPuppetData )

  1
  2
  3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  5// Copyright (C) 2015 Faust Logic, Inc.
  6//
  7// Permission is hereby granted, free of charge, to any person obtaining a copy
  8// of this software and associated documentation files (the "Software"), to
  9// deal in the Software without restriction, including without limitation the
 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 11// sell copies of the Software, and to permit persons to whom the Software is
 12// furnished to do so, subject to the following conditions:
 13//
 14// The above copyright notice and this permission notice shall be included in
 15// all copies or substantial portions of the Software.
 16//
 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 23// IN THE SOFTWARE.
 24//
 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 26
 27#include "afx/arcaneFX.h"
 28
 29#include "console/consoleTypes.h"
 30#include "core/stream/bitStream.h"
 31#include "scene/sceneRenderState.h"
 32#include "math/mathIO.h"
 33
 34#include "afx/afxChoreographer.h"
 35#include "afx/ce/afxPlayerPuppet.h"
 36
 37//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 38// afxPlayerPuppetData
 39
 40IMPLEMENT_CO_DATABLOCK_V1(afxPlayerPuppetData);
 41
 42ConsoleDocClass( afxPlayerPuppetData,
 43   "@brief A datablock that specifies a Player Puppet effect.\n\n"
 44
 45   "Player Puppet effects are defined using the afxPlayerPuppetData datablock and are used to control the movement of "
 46   "Player objects with the AFX constraint system. The Player Puppet effect is similar to the Player Movement effect, but "
 47   "where movement effects 'steer' the player using the same mechanisms that allow Player control from mouse and keyboard "
 48   "input, Player Puppet effects totally take over a Player's transformation using the AFX constraint system."
 49   "\n\n"
 50
 51   "Player Puppet can be configured to directly move a Player's client ghosts as well as its server instance. When doing this, "
 52   "it is important to keep the general motion of the Player object and its ghosts somewhat consistent. Otherwise, obvious "
 53   "discontinuities in the motion will result when the Player Puppet ends and control is restored to the server Player."
 54   "\n\n"
 55
 56   "@ingroup afxEffects\n"
 57   "@ingroup AFX\n"
 58   "@ingroup Datablocks\n"
 59);
 60
 61afxPlayerPuppetData::afxPlayerPuppetData()
 62{
 63  obj_spec = ST_NULLSTRING;
 64  networking = SERVER_ONLY;
 65}
 66
 67afxPlayerPuppetData::afxPlayerPuppetData(const afxPlayerPuppetData& other, bool temp_clone) : GameBaseData(other, temp_clone)
 68{
 69  obj_spec = other.obj_spec;
 70  networking = other.networking;
 71}
 72
 73#define myOffset(field) Offset(field, afxPlayerPuppetData)
 74
 75void afxPlayerPuppetData::initPersistFields()
 76{
 77  addField("objectSpec",      TypeString,   myOffset(obj_spec),
 78    "...");
 79  addField("networking",      TypeS8,       myOffset(networking),
 80    "...");
 81
 82  Parent::initPersistFields();
 83
 84  // disallow some field substitutions
 85  disableFieldSubstitutions("objectSpec");
 86  disableFieldSubstitutions("networking");
 87}
 88
 89bool afxPlayerPuppetData::onAdd()
 90{
 91  if (Parent::onAdd() == false)
 92    return false;
 93
 94  bool runs_on_s = ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0);
 95  bool runs_on_c = ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0);
 96  obj_def.parseSpec(obj_spec, runs_on_s, runs_on_c);
 97
 98  return true;
 99}
100
101void afxPlayerPuppetData::packData(BitStream* stream)
102{
103   Parent::packData(stream);
104
105  stream->writeString(obj_spec);
106  stream->write(networking);
107}
108
109void afxPlayerPuppetData::unpackData(BitStream* stream)
110{
111  Parent::unpackData(stream);
112
113  obj_spec = stream->readSTString();
114  stream->read(&networking);
115}
116
117void afxPlayerPuppetData::gather_cons_defs(Vector<afxConstraintDef>& defs)
118{ 
119  if (obj_def.isDefined())
120    defs.push_back(obj_def);
121};
122
123//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
124