Merge pull request #2099 from Areloch/RemoveECExperimentalFlag

Removes Entity/Component stuff from being behind an experimental flag.
This commit is contained in:
Areloch 2017-10-26 02:41:31 -05:00 committed by GitHub
commit 920a8d2edb
40 changed files with 181 additions and 837 deletions

View file

@ -330,93 +330,6 @@ void PlayerControllerComponent::updateMove()
bool doStandardMove = true;
GameConnection* con = mOwner->getControllingClient();
#ifdef TORQUE_EXTENDED_MOVE
// Work with an absolute rotation from the ExtendedMove class?
if (con && con->getControlSchemeAbsoluteRotation())
{
doStandardMove = false;
const ExtendedMove* emove = dynamic_cast<const ExtendedMove*>(move);
U32 emoveIndex = smExtendedMoveHeadPosRotIndex;
if (emoveIndex >= ExtendedMove::MaxPositionsRotations)
emoveIndex = 0;
if (emove->EulerBasedRotation[emoveIndex])
{
// Head pitch
mHead.x += (emove->rotX[emoveIndex] - mLastAbsolutePitch);
// Do we also include the relative yaw value?
if (con->getControlSchemeAddPitchToAbsRot())
{
F32 x = move->pitch;
if (x > M_PI_F)
x -= M_2PI_F;
mHead.x += x;
}
// Constrain the range of mHead.x
while (mHead.x < -M_PI_F)
mHead.x += M_2PI_F;
while (mHead.x > M_PI_F)
mHead.x -= M_2PI_F;
// Rotate (heading) head or body?
if (move->freeLook && ((isMounted() && getMountNode() == 0) || (con && !con->isFirstPerson())))
{
// Rotate head
mHead.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw);
// Do we also include the relative yaw value?
if (con->getControlSchemeAddYawToAbsRot())
{
F32 z = move->yaw;
if (z > M_PI_F)
z -= M_2PI_F;
mHead.z += z;
}
// Constrain the range of mHead.z
while (mHead.z < 0.0f)
mHead.z += M_2PI_F;
while (mHead.z > M_2PI_F)
mHead.z -= M_2PI_F;
}
else
{
// Rotate body
mRot.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw);
// Do we also include the relative yaw value?
if (con->getControlSchemeAddYawToAbsRot())
{
F32 z = move->yaw;
if (z > M_PI_F)
z -= M_2PI_F;
mRot.z += z;
}
// Constrain the range of mRot.z
while (mRot.z < 0.0f)
mRot.z += M_2PI_F;
while (mRot.z > M_2PI_F)
mRot.z -= M_2PI_F;
}
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
mLastAbsolutePitch = emove->rotX[emoveIndex];
// Head bank
mHead.y = emove->rotY[emoveIndex];
// Constrain the range of mHead.y
while (mHead.y > M_PI_F)
mHead.y -= M_2PI_F;
}
}
#endif
MatrixF zRot;
zRot.set(EulerF(0.0f, 0.0f, mOwner->getRotation().asEulerF().z));

View file

@ -34,7 +34,6 @@
#include "lighting/lightQuery.h"
#include "scene/sceneManager.h"
#include "gfx/bitmap/ddsFile.h"
#include "gfx/bitmap/ddsUtils.h"
#include "gfx/gfxTextureManager.h"
#include "materials/materialFeatureTypes.h"
#include "renderInstance/renderImposterMgr.h"

View file

@ -44,10 +44,8 @@
#include "console/engineAPI.h"
#include "math/mTransform.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/entity.h"
#include "T3D/components/coreInterfaces.h"
#endif
#ifdef TORQUE_HIFI_NET
#include "T3D/gameBase/hifi/hifiMoveList.h"
@ -785,7 +783,6 @@ bool GameConnection::getControlCameraFov(F32 * fov)
}
if (cObj)
{
#ifdef TORQUE_EXPERIMENTAL_EC
if (Entity* ent = dynamic_cast<Entity*>(cObj))
{
if (CameraInterface* camInterface = ent->getComponent<CameraInterface>())
@ -795,11 +792,9 @@ bool GameConnection::getControlCameraFov(F32 * fov)
}
else
{
*fov = cObj->getCameraFov();
*fov = cObj->getCameraFov();
}
#else
*fov = cObj->getCameraFov();
#endif
return(true);
}
@ -819,7 +814,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
if (cObj)
{
#ifdef TORQUE_EXPERIMENTAL_EC
if (Entity* ent = dynamic_cast<Entity*>(cObj))
{
if (CameraInterface* camInterface = ent->getComponent<CameraInterface>())
@ -831,9 +825,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
{
return cObj->isValidCameraFov(fov);
}
#else
return cObj->isValidCameraFov(fov);
#endif
}
return NULL;
@ -851,8 +842,6 @@ bool GameConnection::setControlCameraFov(F32 fov)
}
if (cObj)
{
#ifdef TORQUE_EXPERIMENTAL_EC
F32 newFov = 90.f;
if (Entity* ent = dynamic_cast<Entity*>(cObj))
{
@ -872,11 +861,6 @@ bool GameConnection::setControlCameraFov(F32 fov)
cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov));
newFov = cObj->getCameraFov();
}
#else
// allow shapebase to clamp fov to its datablock values
cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov));
F32 newFov = cObj->getCameraFov();
#endif
// server fov of client has 1degree resolution
if( S32(newFov) != S32(mCameraFov) || newFov != fov )

View file

@ -32,10 +32,8 @@
#include "platform/profiler.h"
#include "console/consoleTypes.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/components/coreInterfaces.h"
#include "T3D/components/component.h"
#endif
//----------------------------------------------------------------------------
ProcessObject::ProcessObject()
@ -277,12 +275,10 @@ void ProcessList::advanceObjects()
onTickObject(pobj);
}
#ifdef TORQUE_EXPERIMENTAL_EC
for (U32 i = 0; i < UpdateInterface::all.size(); i++)
{
UpdateInterface::all[i]->processTick();
}
#endif
mTotalTicks++;

View file

@ -37,10 +37,8 @@
#include "T3D/gameBase/std/stdMoveList.h"
#include "T3D/fx/cameraFXMgr.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/components/coreInterfaces.h"
#include "T3D/components/component.h"
#endif
MODULE_BEGIN( ProcessList )
@ -137,7 +135,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
obj = obj->mProcessLink.next;
}
#ifdef TORQUE_EXPERIMENTAL_EC
for (U32 i = 0; i < UpdateInterface::all.size(); i++)
{
Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]);
@ -147,7 +144,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
UpdateInterface::all[i]->interpolateTick(mLastDelta);
}
#endif
// Inform objects of total elapsed delta so they can advance
// client side animations.
@ -163,7 +159,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
obj = obj->mProcessLink.next;
}
#ifdef TORQUE_EXPERIMENTAL_EC
for (U32 i = 0; i < UpdateInterface::all.size(); i++)
{
Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]);
@ -176,7 +171,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
UpdateInterface::all[i]->advanceTime(dt);
}
#endif
return ret;
}

View file

@ -36,9 +36,7 @@
#include "gui/editor/editorFunctions.h"
#endif
#include "console/engineAPI.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/entity.h"
#endif
IMPLEMENT_CONOBJECT(GuiTreeViewCtrl);
@ -647,20 +645,6 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf)
bool GuiTreeViewCtrl::Item::isParent() const
{
#ifdef TORQUE_EXPERIMENTAL_EC
//We might have a special case with entities
//So if our entity either has children, or has some component with the EditorInspect interface, we return true
if (mInspectorInfo.mObject)
{
Entity* e = dynamic_cast<Entity*>(mInspectorInfo.mObject.getObject());
if (e)
{
if (e->size() > 0 || e->getComponentCount() != 0)
return true;
}
}
#endif
if(mState.test(VirtualParent))
{
if( !isInspectorData() )
@ -3790,7 +3774,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) )
onVirtualParentExpand(item);
#ifdef TORQUE_EXPERIMENTAL_EC
//Slightly hacky, but I'm not sure of a better setup until we get major update to the editors
//We check if our object is an entity, and if it is, we call a 'onInspect' function.
//This function is pretty much a special notifier to the entity so if it has any behaviors that do special
@ -3810,7 +3793,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
}
}
}
#endif
mFlags.set( RebuildVisible );
scrollVisible(item);
@ -4558,12 +4540,10 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item )
if ( !pItem )
continue;
#ifdef TORQUE_EXPERIMENTAL_EC
//A bit hackish, but we make a special exception here for items that are named 'Components', as they're merely
//virtual parents to act as a container to an Entity's components
if (pItem->mScriptInfo.mText == StringTable->insert("Components"))
continue;
#endif
SimObject *pObj = pItem->getObject();
@ -4628,11 +4608,10 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate)
// Go through our items and purge those that have disappeared from
// the set.
#ifdef TORQUE_EXPERIMENTAL_EC
//Entities will be a special case here, if we're an entity, skip this step
if (dynamic_cast<Entity*>(srcObj))
return true;
#endif
for( Item* ptr = item->mChild; ptr != NULL; )
{

View file

@ -29,11 +29,9 @@
#include "gui/containers/guiScrollCtrl.h"
#include "gui/editor/inspector/customField.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "gui/editor/inspector/entityGroup.h"
#include "gui/editor/inspector/mountingGroup.h"
#include "gui/editor/inspector/componentGroup.h"
#endif
IMPLEMENT_CONOBJECT(GuiInspector);
@ -589,7 +587,6 @@ void GuiInspector::refresh()
mGroups.push_back(general);
addObject(general);
#ifdef TORQUE_EXPERIMENTAL_EC
//Entity inspector group
if (mTargets.first()->getClassRep()->isSubclassOf("Entity"))
{
@ -624,7 +621,6 @@ void GuiInspector::refresh()
addObject(compGroup);
}
}
#endif
// Create the inspector groups for static fields.

View file

@ -26,9 +26,7 @@
#include "gui/editor/inspector/dynamicField.h"
#include "console/engineAPI.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/components/component.h"
#endif
IMPLEMENT_CONOBJECT(GuiInspectorDynamicGroup);
@ -126,7 +124,6 @@ bool GuiInspectorDynamicGroup::inspectGroup()
SimFieldDictionary * fieldDictionary = target->getFieldDictionary();
for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
{
#ifdef TORQUE_EXPERIMENTAL_EC
if (target->getClassRep()->isSubclassOf("Component"))
{
Component* compTarget = dynamic_cast<Component*>(target);
@ -135,7 +132,7 @@ bool GuiInspectorDynamicGroup::inspectGroup()
if (compField)
continue;
}
#endif
if( i == 0 )
{
flist.increment();

View file

@ -26,10 +26,8 @@
#include "renderInstance/renderPassManager.h"
#include "math/util/matrixSet.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/components/render/renderComponentInterface.h"
#include "T3D/components/component.h"
#endif
//-----------------------------------------------------------------------------
@ -108,7 +106,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects )
object->prepRenderImage( this );
}
#ifdef TORQUE_EXPERIMENTAL_EC
U32 interfaceCount = RenderComponentInterface::all.size();
for (U32 i = 0; i < RenderComponentInterface::all.size(); i++)
{
@ -119,7 +116,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects )
RenderComponentInterface::all[i]->prepRenderImage(this);
}
}
#endif
PROFILE_END();

View file

@ -0,0 +1,16 @@
<ModuleDefinition
ModuleId="CoreComponentsModule"
VersionId="1"
Description="Module that implements the core engine-level components for the game."
Group="Game">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="RigidBodyComponentAsset"
componentClass="RigidBodyComponent"
friendlyName="Rigid Body"
componentType="Physics"
description="Allows an entity to have rigid body physics." />

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AnimationComponentAsset"
componentClass="AnimationComponent"
friendlyName="animation"
componentType="animation"
description="Allows a mesh component to be animated." />

View file

@ -1,7 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="CameraOrbiterComponentAsset"
componentName=""
componentClass="CameraOrbiterComponent"
friendlyName="Camera Orbiter"
componentType="Game"
description="Acts as a boon arm for a camera component."/>
description="Acts as a boon arm for a camera component." />

View file

@ -1,7 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="CollisionComponentAsset"
componentName=""
componentClass="CollisionComponent"
friendlyName="Collision"
componentType="Collision"
description="Enables an entity to collide with things."/>
description="Enables an entity to collide with things." />

View file

@ -1,7 +1,9 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="CameraComponentAsset"
componentName=""
componentClass="CameraComponent"
friendlyName="Camera"
componentType="Game"
description="Allows the component owner to operate as a camera."/>
scriptFile="core/components/game/camera.cs"
description="Allows the component owner to operate as a camera." />

View file

@ -100,97 +100,86 @@ function CameraComponent::onClientDisconnect(%this, %client)
}
}
//move to the editor later
GlobalActionMap.bind("keyboard", "alt c", "toggleEditorCam");
///
///
///
function switchCamera(%client, %newCamEntity)
function VRCameraComponent::onAdd(%this)
{
if(!isObject(%client) || !isObject(%newCamEntity))
return error("SwitchCamera: No client or target camera!");
%cam = %newCamEntity.getComponent(CameraComponent);
if(!isObject(%cam))
return error("SwitchCamera: Target camera doesn't have a camera behavior!");
//TODO: Cleanup clientOwner for previous camera!
if(%cam.clientOwner == 0 || %cam.clientOwner $= "")
%cam.clientOwner = 0;
%cam.scopeToClient(%client);
%cam.setDirty();
%client.setCameraObject(%newCamEntity);
%client.setControlCameraFov(%cam.FOV);
%client.camera = %newCamEntity;
}
%this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
function buildEditorCamera()
{
if(isObject("EditorCamera"))
return EditorCamera;
%camObj = SGOManager.spawn("SpectatorObject", false);
%camObj.name = "EditorCamera";
%client = ClientGroup.getObject(0);
%camObj.getComponent(SpectatorControls).setupControls(%client);
MissionCleanup.add(%camObj);
return %camObj;
}
%test = %this.clientOwner;
//TODO: Move this somewhere else!
function toggleEditorCam(%val)
{
if(!%val)
return;
%client = ClientGroup.getObject(0);
%barf = ClientGroup.getCount();
if(!isObject(%client.camera))
return error("ToggleEditorCam: no existing camera!");
%editorCam = buildEditorCamera();
//if this is our first switch, just go to the editor camera
if(%client.lastCam $= "" || %client.camera.getId() != %editorCam.getId())
%clientID = %this.getClientID();
if(%clientID && !isObject(%clientID.camera))
{
if(%client.lastCam $= "")
{
//set up the position
%editorCam.position = %client.camera.position;
%editorCam.rotation = %client.camera.rotation;
}
%client.lastCam = %client.camera;
%client.lastController = %client.getControlObject();
switchCamera(%client, %editorCam);
switchControlObject(%client, %editorCam);
}
else
{
switchCamera(%client, %client.lastCam);
switchControlObject(%client, %client.lastController);
%client.lastCam = %editorCam;
%client.lastController = %editorCam;
%this.scopeToClient(%clientID);
%this.setDirty();
%clientID.setCameraObject(%this.owner);
%clientID.setControlCameraFov(%this.FOV);
%clientID.camera = %this.owner;
}
%res = $pref::Video::mode;
%derp = 0;
}
function serverCmdSetClientAspectRatio(%client, %width, %height)
function VRCameraComponent::onRemove(%this)
{
echo("Client: " @ %client SPC "changing screen res to: " @ %width SPC %height);
%client.screenExtent = %width SPC %height;
%cam = %client.getCameraObject();
if(!isObject(%cam))
return;
%cameraComp = %cam.getComponent(CameraComponent);
%clientID = %this.getClientID();
if(%clientID)
%clientID.clearCameraObject();
}
%cameraComp.ScreenAspect = %width SPC %height;
function CameraComponent::onInspectorUpdate(%this)
{
//if(%this.clientOwner)
//%this.clientOwner.setCameraObject(%this.owner);
}
function VRCameraComponent::getClientID(%this)
{
return ClientGroup.getObject(%this.clientOwner-1);
}
function VRCameraComponent::isClientCamera(%this, %client)
{
%clientID = ClientGroup.getObject(%this.clientOwner-1);
if(%client.getID() == %clientID)
return true;
else
return false;
}
function VRCameraComponent::onClientConnect(%this, %client)
{
//if(%this.isClientCamera(%client) && !isObject(%client.camera))
//{
%this.scopeToClient(%client);
%this.setDirty();
%client.setCameraObject(%this.owner);
%client.setControlCameraFov(%this.FOV);
%client.camera = %this.owner;
//}
//else
//{
// echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
//}
}
function VRCameraComponent::onClientDisconnect(%this, %client)
{
Parent::onClientDisconnect(%this, %client);
if(isClientCamera(%client)){
%this.clearScopeToClient(%client);
%client.clearCameraObject();
}
}

View file

@ -1,7 +1,10 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ControlObjectComponentAsset"
componentName="ControlObjectComponent"
componentClass="Component"
friendlyName="Control Object"
componentType="Game"
description="Allows the component owner to be controlled by a client."/>
scriptFile="core/components/game/controlObject.cs"
description="Allows the component owner to be controlled by a client." />

View file

@ -1,7 +1,10 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ItemRotationComponentAsset"
componentName="ItemRotationComponent"
componentClass="Component"
friendlyName="Item Rotation"
componentType="Game"
description="Rotates the entity around an axis, like an item pickup."/>
scriptFile="core/components/game/itemRotate.cs"
description="Rotates the entity around an axis, like an item pickup." />

View file

@ -1,7 +1,10 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="PlayerSpawnerComponentAsset"
componentName="PlayerSpawner"
componentClass="Component"
friendlyName="Player Spawner"
componentType="Game"
description="When a client connects, it spawns a player object for them and attaches them to it."/>
scriptFile="core/components/game/playerSpawner.cs"
description="When a client connects, it spawns a player object for them and attaches them to it." />

View file

@ -29,32 +29,40 @@ function PlayerSpawner::onAdd(%this)
%this.friendlyName = "Player Spawner";
%this.componentType = "Spawner";
%this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", string, "PlayerObject");
%this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject");
}
function PlayerSpawner::onClientConnect(%this, %client)
{
%playerObj = SGOManager.spawn(%this.GameObjectName);
%playerObj = spawnGameObject(%this.GameObjectName, false);
if(!isObject(%playerObj))
return;
%playerObj.position = %this.owner.position;
MissionCleanup.add(%playerObj);
for(%b = 0; %b < %playerObj.getComponentCount(); %b++)
{
%comp = %playerObj.getComponentByIndex(%b);
if(%comp.isMethod("onClientConnect"))
%comp.onClientConnect(%client);
}
%playerObj.notify("onClientConnect", %client);
switchControlObject(%client, %playerObj);
switchCamera(%client, %playerObj);
//%playerObj.getComponent(FPSControls).setupControls(%client);
%client.player = %playerObj;
%client.camera = %playerObj;
%inventory = %playerObj.getComponent(InventoryController);
if(isObject(%inventory))
{
for(%i=0; %i<5; %i++)
{
%arrow = spawnGameObject(ArrowProjectile, false);
%inventory.addItem(%arrow);
}
}
%playerObj.position = %this.owner.position;
%playerObj.rotation = "0 0 0";
%this.clientCount++;
}

View file

@ -1,7 +1,9 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="FPSControlsComponentAsset"
componentName="FPSControls"
componentClass="Component"
friendlyName="FPS Controls"
componentType="Input"
description="First Person Shooter-type controls."/>
description="First Person Shooter-type controls." />

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="MeshComponentAsset"
componentClass="MeshComponent"
friendlyName="mesh"
componentType="Render"
description="Enables an entity to render a shape." />

View file

@ -1,7 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="PlayerControllerComponentAsset"
componentName=""
componentClass="PlayerControllerComponent"
friendlyName="Player Controller"
componentType="Game"
description="Enables an entity to move like a player object."/>
description="Enables an entity to move like a player object." />

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="SoundComponentAsset"
componentClass="SoundComponent"
friendlyName="Sound(Component)"
componentType="sound"
description="Stores up to 4 sounds for playback." />

View file

@ -1,7 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="StateMachineComponentAsset"
componentName=""
componentClass="StateMachineComponent"
friendlyName="State Machine"
componentType="Game"
description="Enables a state machine on the entity."/>
description="Enables a state machine on the entity." />

View file

@ -1,13 +0,0 @@
<ModuleDefinition
ModuleId="Art"
VersionId="1"
Description="Default module for the Full template game assets."
ScriptFile=""
CreateFunction="create"
DestroyFunction="destroy"
Group="Game"
Dependencies="">
<DeclaredAssets
Extension="asset.taml"
Recurse="true"/>
</ModuleDefinition>

View file

@ -1,3 +0,0 @@
<ShapeAsset
AssetName="SoldierPlayer"
fileName="art/shapes/actors/Soldier/soldier_rigged.DAE"/>

View file

@ -1,13 +0,0 @@
<ModuleDefinition
ModuleId="Scripts"
VersionId="1"
Description="Default module for the Full template game assets."
ScriptFile=""
CreateFunction="create"
DestroyFunction="destroy"
Group="Game"
Dependencies="">
<DeclaredAssets
Extension="asset.taml"
Recurse="true"/>
</ModuleDefinition>

View file

@ -1,7 +0,0 @@
<ComponentAsset
AssetName="AnimationComponentAsset"
componentName=""
componentClass="AnimationComponent"
friendlyName="Animation"
componentType="Animation"
description="Allows a mesh component to be animated."/>

View file

@ -1,7 +0,0 @@
<ComponentAsset
AssetName="MeshComponentAsset"
componentName=""
componentClass="MeshComponent"
friendlyName="Mesh"
componentType="Render"
description="Enables an entity to render a shape."/>

View file

@ -1,123 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
function execGameObjects()
{
//find all GameObjectAssets
%assetQuery = new AssetQuery();
if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset"))
return; //if we didn't find ANY, just exit
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
if(isFile(%gameObjectAsset.scriptFilePath))
exec(%gameObjectAsset.scriptFilePath);
}
}
function findGameObject(%name)
{
//find all GameObjectAssets
%assetQuery = new AssetQuery();
if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset"))
return 0; //if we didn't find ANY, just exit
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
if(%gameObjectAsset.gameObjectName $= %name)
{
if(isFile(%gameObjectAsset.TAMLFilePath))
{
return %gameObjectAsset;
}
}
}
return 0;
}
function spawnGameObject(%name, %addToMissionGroup)
{
if(%addToMissionGroup $= "")
%addToMissionGroup = true;
%gameObjectAsset = findGameObject(%name);
if(isObject(%gameObjectAsset))
{
%newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath);
if(%addToMissionGroup == true) //save instance when saving level
MissionGroup.add(%newSGOObject);
else // clear instance on level exit
MissionCleanup.add(%newSGOObject);
return %newSGOObject;
}
return 0;
}
function saveGameObject(%name, %tamlPath, %scriptPath)
{
%gameObjectAsset = findGameObject(%name);
//find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset
if(isObject(%gameObjectAsset))
{
%assetID = %gameObjectAsset.getAssetId();
%gameObjectAsset.TAMLFilePath = %tamlPath;
%gameObjectAsset.scriptFilePath = %scriptPath;
TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID));
AssetDatabase.refreshAsset(%assetID);
}
else
{
//Doesn't exist, so make a new one
%gameObjectAsset = new GameObjectAsset()
{
assetName = %name @ "Asset";
gameObjectName = %name;
TAMLFilePath = %tamlPath;
scriptFilePath = %scriptPath;
};
//Save it alongside the taml file
%path = filePath(%tamlPath);
TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml");
AssetDatabase.refreshAllAssets(true);
}
}

View file

@ -1,5 +0,0 @@
<GameObjectAsset
AssetName="ThirdPersonPlayerGameObjectAsset"
gameObjectName="ThirdPersonPlayer"
TAMLFilePath="scripts/server/gameObjects/ThirdPersonPlayerObject.taml"
scriptFilePath="scripts/server/gameObjects/ThirdPersonPlayerObject.cs"/>

View file

@ -1,247 +0,0 @@
function ThirdPersonPlayerObject::onAdd(%this)
{
%this.turnRate = 0.3;
%this.phys = %this.getComponent("PlayerControllerComponent");
%this.collision = %this.getComponent("CollisionComponent");
%this.cam = %this.getComponent("CameraComponent");
%this.camArm = %this.getComponent("CameraOrbiterComponent");
%this.animation = %this.getComponent("AnimationComponent");
%this.stateMachine = %this.getComponent("StateMachineComponent");
%this.mesh = %this.getComponent("MeshComponent");
%this.stateMachine.forwardVector = 0;
%this.crouch = false;
%this.firstPerson = false;
%this.crouchSpeedMod = 0.5;
%this.aimOrbitDist = 1.5;
%this.regularOrbitDist = 5;
%this.regularOrbitMaxPitch = 70;
%this.regularOrbitMinPitch = -10;
%this.aimedMaxPitch = 90;
%this.aimedMinPitch = -90;
}
function ThirdPersonPlayerObject::onRemove(%this)
{
}
function ThirdPersonPlayerObject::moveVectorEvent(%this)
{
%moveVector = %this.getMoveVector();
// forward of the camera on the x-z plane
%cameraForward = %this.cam.getForwardVector();
%cameraRight = %this.cam.getRightVector();
%moveVec = VectorAdd(VectorScale(%cameraRight, %moveVector.x), VectorScale(%cameraForward, %moveVector.y));
if(%this.aiming || %this.firstPerson)
{
%forMove = "0 0 0";
if(%moveVector.x != 0)
{
%this.phys.inputVelocity.x = %moveVector.x * 10;
}
else
{
%this.phys.inputVelocity.x = 0;
}
if(%moveVector.y != 0)
{
%this.phys.inputVelocity.y = %moveVector.y * 10;
}
else
{
%this.phys.inputVelocity.y = 0;
}
}
else
{
if(%moveVec.x == 0 && %moveVec.y == 0)
{
%this.phys.inputVelocity = "0 0 0";
%this.stateMachine.forwardVector = 0;
}
else
{
%moveVec.z = 0;
%curForVec = %this.getForwardVector();
%newForVec = VectorLerp(%curForVec, %moveVec, %this.turnRate);
%this.setForwardVector(%newForVec);
%this.phys.inputVelocity.y = 10;
%this.stateMachine.forwardVector = 1;
}
}
if(%this.crouch)
%this.phys.inputVelocity = VectorScale(%this.phys.inputVelocity, %this.crouchSpeedMod);
}
function ThirdPersonPlayerObject::moveYawEvent(%this)
{
%moveRotation = %this.getMoveRotation();
%camOrb = %this.getComponent("CameraOrbiterComponent");
if(%this.aiming || %this.firstPerson)
{
%this.rotation.z += %moveRotation.z * 10;
}
%camOrb.rotation.z += %moveRotation.z * 10;
}
function ThirdPersonPlayerObject::movePitchEvent(%this)
{
%moveRotation = %this.getMoveRotation();
%camOrb = %this.getComponent("CameraOrbiterComponent");
%camOrb.rotation.x += %moveRotation.x * 10;
}
function ThirdPersonPlayerObject::moveRollEvent(%this){}
function ThirdPersonPlayerObject::moveTriggerEvent(%this, %triggerNum, %triggerValue)
{
if(%triggerNum == 3 && %triggerValue)
{
if(%triggerValue)
{
%this.firstPerson = !%this.firstPerson;
if(%this.firstPerson)
{
%this.rotation.z = %this.cam.rotationOffset.z;
%this.camArm.orbitDistance = 0;
%this.camArm.maxPitchAngle = %this.aimedMaxPitch;
%this.camArm.minPitchAngle = %this.aimedMinPitch;
%this.cam.positionOffset = "0 0 0";
%this.cam.rotationOffset = "0 0 0";
}
else if(%this.aiming)
{
%this.camArm.orbitDistance = %this.aimOrbitDist;
%this.camArm.maxPitchAngle = %this.aimedMaxPitch;
%this.camArm.minPitchAngle = %this.aimedMinPitch;
}
else
{
%this.camArm.orbitDistance = %this.regularOrbitDist;
%this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch;
%this.camArm.minPitchAngle = %this.regularOrbitMinPitch;
}
commandToClient(localclientConnection, 'SetClientRenderShapeVisibility',
localclientConnection.getGhostID(%this.getComponent("MeshComponent")), !%this.firstPerson);
}
}
else if(%triggerNum == 2 && %triggerValue == true)
{
//get our best collision assuming up is 0 0 1
%collisionAngle = %this.collision.getBestCollisionAngle("0 0 1");
if(%collisionAngle >= 80)
{
%surfaceNormal = %this.collision.getCollisionNormal(0);
%jumpVector = VectorScale(%surfaceNormal, 200);
echo("Jump surface Angle is at: " @ %surfaceNormal);
%this.phys.applyImpulse(%this.position, %jumpVector);
%this.setForwardVector(%jumpVector);
}
else
%this.phys.applyImpulse(%this.position, "0 0 300");
}
else if(%triggerNum == 4)
{
%this.crouch = %triggerValue;
}
else if(%triggerNum == 1)
{
%this.aiming = %triggerValue;
if(%this.aiming)
{
%this.rotation.z = %this.cam.rotationOffset.z;
%this.camArm.orbitDistance = %this.aimOrbitDist;
%this.camArm.maxPitchAngle = %this.aimedMaxPitch;
%this.camArm.minPitchAngle = %this.aimedMinPitch;
}
else
{
%this.camArm.orbitDistance = %this.regularOrbitDist;
%this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch;
%this.camArm.minPitchAngle = %this.regularOrbitMinPitch;
}
}
}
function ThirdPersonPlayerObject::onCollisionEvent(%this, %colObject, %colNormal, %colPoint, %colMatID, %velocity)
{
if(!%this.phys.isContacted())
echo(%this @ " collided with " @ %colObject);
}
function ThirdPersonPlayerObject::processTick(%this)
{
%moveVec = %this.getMoveVector();
%bestFit = "";
if(%this.crouch)
{
if(%moveVec.x != 0 || %moveVec.y != 0)
%bestFit = "Crouch_Forward";
else
%bestFit = "Crouch_Root";
}
else
{
if(%moveVec.x != 0 || %moveVec.y != 0)
%bestFit = "Run";
else
%bestFit = "Root";
}
if(%this.animation.getThreadAnimation(0) !$= %bestFit)
%this.animation.playThread(0, %bestFit);
}
//Used for first person mode
function clientCmdSetClientRenderShapeVisibility(%id, %visiblilty)
{
%localID = ServerConnection.resolveGhostID(%id);
%localID.enabled = %visiblilty;
}
function serverToClientObject( %serverObject )
{
assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" );
assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" );
%ghostId = LocalClientConnection.getGhostId( %serverObject );
if ( %ghostId == -1 )
return 0;
return ServerConnection.resolveGhostID( %ghostId );
}

View file

@ -1,98 +0,0 @@
<Entity
scale="1 1 1"
class="ThirdPersonPlayerObject"
canSave="true"
canSaveDynamicFields="true"
position="0 0 0"
rotation="0 0 0">
<Component
networked="false"
enabled="true"
class="ControlObjectComponent"
clientOwner="1" />
<CollisionComponent
friendlyName="Collision(Component)"
networked="false"
enabled="true"
collisionType="Bounds"
LineOfSightType="Collision Mesh"
decalType="Collision Mesh"
CollisionMeshPrefix="Collision"
BlockCollisions="true" />
<PlayerControllerComponent
componentType="Physics"
friendlyName="Simple Physics"
description="Simple physics behavior that allows gravity and impulses."
networked="false"
enabled="true"
gravity="0 0 -9"
velocity="0 0 0"
isStatic="false" />
<MeshComponent
componentType="Render"
friendlyName="Mesh Component"
description="Causes the object to render a non-animating 3d shape using the file provided."
networked="true"
enabled="true"
MeshAsset="Art:SoldierPlayer" />
<Component
networked="false"
enabled="true"
class="FPSControls" />
<CameraComponent
networked="false"
enabled="true"
FOV="80"
MinFOV="5"
MaxFOV="175"
ScreenAspect="1024 768"
targetNode="Eye"
positionOffset="0 0 0"
rotationOffset="0 0 0"
useParentTransform="false" />
<CameraOrbiterComponent
orbitDistance="5"
maxPitchAngle="70"
minPitchAngle="-70"
networked="false"
enabled="true" />
<AnimationComponent
componentType="Render"
friendlyName="Animation Component"
description="An animation component"
networked="true"
enabled="true"/>
<SpotLight
range="10"
innerAngle="40"
outerAngle="45"
isEnabled="true"
color="1 1 1 1"
brightness="1"
castShadows="false"
priority="1"
animate="true"
animationPeriod="1"
animationPhase="1"
flareScale="1"
attenuationRatio="0 1 1"
shadowType="Spot"
texSize="512"
overDarkFactor="2000 1000 500 100"
shadowDistance="400"
shadowSoftness="0.15"
numSplits="1"
logWeight="0.91"
fadeStartDistance="0"
lastSplitTerrainOnly="false"
representedInLightmap="false"
shadowDarkenColor="0 0 0 -1"
includeLightmappedGeometryInShadow="false"
position="0 0 1.6137"
rotation="0 0 1 0"
mountNode="-1"
mountPos="0 0 1.5"
mountRot="1 0 0 0"
canSave="true"
canSaveDynamicFields="true" />
</Entity>

View file

@ -58,23 +58,3 @@ exec("./turret.cs");
// Load our gametypes
exec("./gameCore.cs"); // This is the 'core' of the gametype functionality.
exec("./gameDM.cs"); // Overrides GameCore with DeathMatch functionality.
//Entity/Component stuff
if(isFile("./components/game/camera.cs"))
exec("./components/game/camera.cs");
if(isFile("./components/game/controlObject.cs"))
exec("./components/game/controlObject.cs");
if(isFile("./components/game/itemRotate.cs"))
exec("./components/game/itemRotate.cs");
if(isFile("./components/game/playerSpawner.cs"))
exec("./components/game/playerSpawner.cs");
if(isFile("./components/input/fpsControls.cs"))
exec("./components/input/fpsControls.cs");
if(isFile("./components/input/inputManager.cs"))
exec("./components/input/inputManager.cs");
if(isFile("./gameObjects/GameObjectManager.cs"))
{
exec("./gameObjects/GameObjectManager.cs");
execGameObjects();
}

View file

@ -143,9 +143,6 @@ if(WIN32)
option(TORQUE_D3D11 "Allow Direct3D 11 render" ON)
endif()
option(TORQUE_EXPERIMENTAL_EC "Experimental Entity/Component systems" OFF)
mark_as_advanced(TORQUE_EXPERIMENTAL_EC)
option(TORQUE_DEDICATED "Torque dedicated" OFF)
mark_as_advanced(TORQUE_DEDICATED)
@ -316,9 +313,6 @@ addPath("${srcDir}/physics")
addPath("${srcDir}/gui/3d")
addPath("${srcDir}/postFx")
if(NOT TORQUE_EXPERIMENTAL_EC)
set(BLACKLIST "entity.cpp;entity.h" )
endif()
addPath("${srcDir}/T3D")
set(BLACKLIST "" )
@ -331,16 +325,13 @@ addPath("${srcDir}/T3D/decal")
addPath("${srcDir}/T3D/sfx")
addPath("${srcDir}/T3D/gameBase")
addPath("${srcDir}/T3D/turret")
if( TORQUE_EXPERIMENTAL_EC )
addPath("${srcDir}/T3D/components/")
addPath("${srcDir}/T3D/components/animation")
addPath("${srcDir}/T3D/components/camera")
addPath("${srcDir}/T3D/components/collision")
addPath("${srcDir}/T3D/components/game")
addPath("${srcDir}/T3D/components/physics")
addPath("${srcDir}/T3D/components/render")
endif()
addPath("${srcDir}/T3D/components/")
addPath("${srcDir}/T3D/components/animation")
addPath("${srcDir}/T3D/components/camera")
addPath("${srcDir}/T3D/components/collision")
addPath("${srcDir}/T3D/components/game")
addPath("${srcDir}/T3D/components/physics")
addPath("${srcDir}/T3D/components/render")
addPath("${srcDir}/main/")
addPath("${srcDir}/assets")
@ -422,9 +413,6 @@ if(TORQUE_TOOLS)
addPath("${srcDir}/environment/editors")
addPath("${srcDir}/forest/editor")
addPath("${srcDir}/gui/editor")
if(NOT TORQUE_EXPERIMENTAL_EC)
set(BLACKLIST "entityGroup.cpp;entityGroup.h;mountingGroup.cpp;mountingGroup.h;componentGroup.cpp;componentGroup.h" )
endif()
addPath("${srcDir}/gui/editor/inspector")
set(BLACKLIST "" )
endif()
@ -502,10 +490,6 @@ if(TORQUE_DEDICATED)
addDef(TORQUE_DEDICATED)
endif()
if(TORQUE_EXPERIMENTAL_EC)
addDef(TORQUE_EXPERIMENTAL_EC)
endif()
#modules dir
file(GLOB modules "modules/*.cmake")
foreach(module ${modules})
@ -855,26 +839,6 @@ if(TORQUE_TEMPLATE)
message("Prepare Template(${TORQUE_TEMPLATE}) install...")
file(GLOB_RECURSE INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/*")
IF( NOT TORQUE_EXPERIMENTAL_EC)
list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/art.module.taml")
list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/shapes/actors/Soldier/soldier.asset.taml")
list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/scripts.module.taml")
foreach(ITEM ${INSTALL_FILES_AND_DIRS})
get_filename_component( dir ${ITEM} DIRECTORY )
get_filename_component( fileName ${ITEM} NAME )
if( ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components
OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/game
OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/input
OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/gameObjects
OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor
OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/gui
OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/scripts )
list(REMOVE_ITEM INSTALL_FILES_AND_DIRS ${dir}/${fileName})
ENDIF()
endforeach()
ENDIF()
foreach(ITEM ${INSTALL_FILES_AND_DIRS})
get_filename_component( dir ${ITEM} DIRECTORY )
STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/" "${TORQUE_APP_DIR}/" INSTALL_DIR ${dir})