Torque3D Documentation / _generateds / afxPlayerMovement.cpp

afxPlayerMovement.cpp

Engine/source/afx/ce/afxPlayerMovement.cpp

More...

Public Defines

define
myOffset(field) (field, )

Public Variables

default_movement (F32_MAX, F32_MAX, F32_MAX)

Public Functions

ConsoleDocClass(afxPlayerMovementData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> Movement <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "<a href="/coding/class/classplayer/">Player</a> Movement effects are used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> directly alter the speed and/or movement direction of <a href="/coding/class/classplayer/">Player</a> objects. The <a href="/coding/class/classplayer/">Player</a> " "Movement effect is similar <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classplayer/">Player</a> Puppet effect, but where 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/class/classplayer/">Player</a> 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. Another difference is that <a href="/coding/class/classplayer/">Player</a> Movement effects only influence the " "server instance of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Player. Puppet effects can influence both the <a href="/coding/class/classplayer/">Player</a> 's server instance and its client ghosts." "\<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>" )
ImplementEnumType(afxPlayerMovement_OpType , "Possible player movement operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">types.\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxPlayerMovemen\n\n</a>" )

Detailed Description

Public Defines

myOffset(field) (field, )

Public Variables

Point3F default_movement (F32_MAX, F32_MAX, F32_MAX)
 EndImplementEnumType 

Public Functions

ConsoleDocClass(afxPlayerMovementData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classplayer/">Player</a> Movement <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "<a href="/coding/class/classplayer/">Player</a> Movement effects are used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> directly alter the speed and/or movement direction of <a href="/coding/class/classplayer/">Player</a> objects. The <a href="/coding/class/classplayer/">Player</a> " "Movement effect is similar <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classplayer/">Player</a> Puppet effect, but where 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/class/classplayer/">Player</a> 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. Another difference is that <a href="/coding/class/classplayer/">Player</a> Movement effects only influence the " "server instance of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Player. Puppet effects can influence both the <a href="/coding/class/classplayer/">Player</a> 's server instance and its client ghosts." "\<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(afxPlayerMovementData )

ImplementEnumType(afxPlayerMovement_OpType , "Possible player movement operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">types.\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxPlayerMovemen\n\n</a>" )

  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/afxPlayerMovement.h"
 36
 37//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 38// afxPlayerMovementData
 39
 40IMPLEMENT_CO_DATABLOCK_V1(afxPlayerMovementData);
 41
 42ConsoleDocClass( afxPlayerMovementData,
 43   "@brief A datablock that specifies a Player Movement effect.\n\n"
 44
 45   "Player Movement effects are used to directly alter the speed and/or movement direction of Player objects. The Player "
 46   "Movement effect is similar to the Player Puppet effect, but where puppet effects totally take over a Player's transformation "
 47   "using the AFX constraint system, Player Movement effects 'steer' the player using the same mechanisms that allow "
 48   "Player control from mouse and keyboard input. Another difference is that Player Movement effects only influence the "
 49   "server instance of a Player. Puppet effects can influence both the Player's server instance and its client ghosts."
 50   "\n\n"
 51
 52   "@ingroup afxEffects\n"
 53   "@ingroup AFX\n"
 54   "@ingroup Datablocks\n"
 55);
 56
 57static Point3F default_movement(F32_MAX, F32_MAX, F32_MAX);
 58
 59afxPlayerMovementData::afxPlayerMovementData()
 60{
 61  speed_bias = 1.0f;
 62  movement = default_movement;
 63  movement_op = OP_MULTIPLY;
 64}
 65
 66afxPlayerMovementData::afxPlayerMovementData(const afxPlayerMovementData& other, bool temp_clone) : GameBaseData(other, temp_clone)
 67{
 68  speed_bias = other.speed_bias;
 69  movement = other.movement;
 70  movement_op = other.movement_op;
 71}
 72
 73ImplementEnumType( afxPlayerMovement_OpType, "Possible player movement operation types.\n" "@ingroup afxPlayerMovemen\n\n" )  
 74  { afxPlayerMovementData::OP_ADD,      "add",        "..." },
 75  { afxPlayerMovementData::OP_MULTIPLY, "multiply",   "..." },
 76  { afxPlayerMovementData::OP_REPLACE,  "replace",    "..." },
 77  { afxPlayerMovementData::OP_MULTIPLY, "mult",       "..." },
 78EndImplementEnumType;
 79
 80#define myOffset(field) Offset(field, afxPlayerMovementData)
 81
 82void afxPlayerMovementData::initPersistFields()
 83{
 84  addField("speedBias",     TypeF32,        myOffset(speed_bias),
 85    "A floating-point multiplier that scales the constraint Player's movement speed.");
 86  addField("movement",      TypePoint3F,    myOffset(movement),
 87    "");
 88  addField("movementOp", TYPEID<afxPlayerMovementData::OpType>(), myOffset(movement_op),
 89    "Possible values: add, multiply, or replace.");
 90
 91  Parent::initPersistFields();
 92}
 93
 94bool afxPlayerMovementData::onAdd()
 95{
 96  if (Parent::onAdd() == false)
 97    return false;
 98
 99  return true;
100}
101
102void afxPlayerMovementData::packData(BitStream* stream)
103{
104   Parent::packData(stream);
105
106  stream->write(speed_bias);
107  if (stream->writeFlag(movement != default_movement))
108  {
109    stream->write(movement.x);
110    stream->write(movement.y);
111    stream->write(movement.z);
112    stream->writeInt(movement_op, OP_BITS);
113  }
114}
115
116void afxPlayerMovementData::unpackData(BitStream* stream)
117{
118  Parent::unpackData(stream);
119
120  stream->read(&speed_bias);
121  if (stream->readFlag())
122  {
123    stream->read(&movement.x);
124    stream->read(&movement.y);
125    stream->read(&movement.z);
126    movement_op = stream->readInt(OP_BITS);
127  }
128  else
129  {
130    movement = default_movement;
131    movement_op = OP_MULTIPLY;
132  }
133}
134
135bool afxPlayerMovementData::hasMovementOverride()
136{
137  return (movement != default_movement);
138}
139
140
141//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
142