mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-28 07:45:40 +00:00
Additional cleanup and add-in of files that were missed.
This commit is contained in:
parent
ea595143e8
commit
c74242309a
11 changed files with 382 additions and 8 deletions
|
|
@ -38,6 +38,7 @@ function FPSGameplay::create( %this )
|
|||
exec("./scripts/server/vehicleWheeled.cs");
|
||||
exec("./scripts/server/VolumetricFog.cs");
|
||||
exec("./scripts/server/weapon.cs");
|
||||
exec("./scripts/server/physicsShape.cs");
|
||||
|
||||
//add DBs
|
||||
if(isObject(DatablockFilesList))
|
||||
|
|
@ -89,8 +90,10 @@ function FPSGameplay::create( %this )
|
|||
exec("./scripts/gui/chatHud.gui");
|
||||
exec("./scripts/gui/playerList.gui");
|
||||
exec("./scripts/gui/playGui.gui");
|
||||
exec("./scripts/gui/hudlessGui.gui");
|
||||
|
||||
exec("./scripts/gui/playGui.cs");
|
||||
exec("data/FPSGameplay/scripts/client/playGui.cs");
|
||||
exec("data/FPSGameplay/scripts/client/hudlessGui.cs");
|
||||
|
||||
exec("data/FPSGameplay/scripts/client/message.cs");
|
||||
exec("data/FPSGameplay/scripts/client/chatHud.cs");
|
||||
|
|
@ -99,6 +102,8 @@ function FPSGameplay::create( %this )
|
|||
exec("data/FPSGameplay/scripts/client/playerList.cs");
|
||||
exec("data/FPSGameplay/scripts/client/centerPrint.cs");
|
||||
exec("data/FPSGameplay/scripts/client/recordings.cs");
|
||||
|
||||
exec("data/FPSGameplay/scripts/client/screenshot.cs");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
42
Templates/Modules/FPSGameplay/scripts/client/hudlessGui.cs
Normal file
42
Templates/Modules/FPSGameplay/scripts/client/hudlessGui.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 HudlessPlayGui::onWake(%this)
|
||||
{
|
||||
// just update the action map here
|
||||
moveMap.push();
|
||||
}
|
||||
|
||||
function HudlessPlayGui::onSleep(%this)
|
||||
{
|
||||
// pop the keymaps
|
||||
moveMap.pop();
|
||||
}
|
||||
|
||||
function HudlessPlayGui::toggle(%this)
|
||||
{
|
||||
if (%this.isAwake())
|
||||
Canvas.setContent(PlayGui);
|
||||
else
|
||||
Canvas.setContent(HudlessPlayGui);
|
||||
}
|
||||
143
Templates/Modules/FPSGameplay/scripts/client/screenshot.cs
Normal file
143
Templates/Modules/FPSGameplay/scripts/client/screenshot.cs
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// formatImageNumber
|
||||
// Preceeds a number with zeros to make it 6 digits long.
|
||||
//---------------------------------------------------------------------------------------------
|
||||
function formatImageNumber(%number)
|
||||
{
|
||||
if(%number < 10)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 100)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 1000)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 10000)
|
||||
%number = "0" @ %number;
|
||||
return %number;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// formatSessionNumber
|
||||
// Preceeds a number with zeros to make it 4 digits long.
|
||||
//---------------------------------------------------------------------------------------------
|
||||
function formatSessionNumber(%number)
|
||||
{
|
||||
if(%number < 10)
|
||||
%number = "0" @ %number;
|
||||
if(%number < 100)
|
||||
%number = "0" @ %number;
|
||||
return %number;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// recordMovie
|
||||
// Records a movie file from the Canvas content using the specified fps.
|
||||
// Possible encoder values are "PNG" and "THEORA" (default).
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
$RecordingMovie = false;
|
||||
|
||||
function recordMovie(%movieName, %fps, %encoder)
|
||||
{
|
||||
// If the canvas doesn't exist yet, setup a flag so it'll
|
||||
// start capturing as soon as it's created
|
||||
if (!isObject(Canvas))
|
||||
return;
|
||||
|
||||
if (%encoder $= "")
|
||||
%encoder = "THEORA";
|
||||
%resolution = Canvas.getVideoMode();
|
||||
|
||||
// Start the movie recording
|
||||
ChatHud.AddLine( "\c4Recording movie file to [\c2" @ %movieName @ "\cr].ogv.");
|
||||
echo("Recording movie to: " @ %movieName);
|
||||
startVideoCapture(Canvas, %movieName, %encoder, %fps);
|
||||
|
||||
$RecordingMovie = true;
|
||||
}
|
||||
|
||||
function stopMovie()
|
||||
{
|
||||
// Stop the current recording
|
||||
ChatHud.AddLine( "\c4Recording movie file finished.");
|
||||
echo("Stopped movie recording");
|
||||
|
||||
stopVideoCapture();
|
||||
|
||||
$RecordingMovie = false;
|
||||
}
|
||||
|
||||
/// This is bound in initializeCommon() to take
|
||||
/// a screenshot on a keypress.
|
||||
function doScreenShot( %val )
|
||||
{
|
||||
// This can be bound, so skip key up events.
|
||||
if ( %val == 0 )
|
||||
return;
|
||||
|
||||
_screenShot( 1 );
|
||||
}
|
||||
|
||||
/// A counter for screen shots used by _screenShot().
|
||||
$screenshotNumber = 0;
|
||||
|
||||
/// Internal function which generates unique filename
|
||||
/// and triggers a screenshot capture.
|
||||
function _screenShot( %tiles, %overlap )
|
||||
{
|
||||
if ( $pref::Video::screenShotSession $= "" )
|
||||
$pref::Video::screenShotSession = 0;
|
||||
|
||||
if ( $screenshotNumber == 0 )
|
||||
$pref::Video::screenShotSession++;
|
||||
|
||||
if ( $pref::Video::screenShotSession > 999 )
|
||||
$pref::Video::screenShotSession = 1;
|
||||
|
||||
%name = "screenshot_" @ formatSessionNumber($pref::Video::screenShotSession) @ "-" @
|
||||
formatImageNumber($screenshotNumber);
|
||||
%name = expandFileName( %name );
|
||||
|
||||
$screenshotNumber++;
|
||||
|
||||
if ( ( $pref::Video::screenShotFormat $= "JPEG" ) ||
|
||||
( $pref::video::screenShotFormat $= "JPG" ) )
|
||||
screenShot( %name, "JPEG", %tiles, %overlap );
|
||||
else
|
||||
screenShot( %name, "PNG", %tiles, %overlap );
|
||||
}
|
||||
|
||||
/// This will close the console and take a large format
|
||||
/// screenshot by tiling the current backbuffer and save
|
||||
/// it to the root game folder.
|
||||
///
|
||||
/// For instance a tile setting of 4 with a window set to
|
||||
/// 800x600 will output a 3200x2400 screenshot.
|
||||
function tiledScreenShot( %tiles, %overlap )
|
||||
{
|
||||
// Pop the console off before we take the shot.
|
||||
Canvas.popDialog( ConsoleDlg );
|
||||
|
||||
_screenShot( %tiles, %overlap );
|
||||
}
|
||||
27
Templates/Modules/FPSGameplay/scripts/gui/hudlessGui.gui
Normal file
27
Templates/Modules/FPSGameplay/scripts/gui/hudlessGui.gui
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GameTSCtrl(HudlessPlayGui) {
|
||||
canSaveDynamicFields = "1";
|
||||
isContainer = "1";
|
||||
Profile = "GuiContentProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "1024 768";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
cameraZRot = "0";
|
||||
forceFOV = "0";
|
||||
Enabled = "1";
|
||||
helpTag = "0";
|
||||
noCursor = "1";
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
68
Templates/Modules/FPSGameplay/scripts/server/physicsShape.cs
Normal file
68
Templates/Modules/FPSGameplay/scripts/server/physicsShape.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 PhysicsShapeData::damage(%this, %obj, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
// Order of operations is extremely important here!
|
||||
// Verify that any changes will not cause this method to overflow the stack
|
||||
// recursively calling itself.
|
||||
|
||||
// Note that invulerable, damageRadius, areaImpulse, radiusDamage, and damageType
|
||||
// are only dynamic fields... This is fine so long as you are only calling
|
||||
// this method server-side, just keep in mind these fields are NOT networked.
|
||||
|
||||
if ( %this.invulnerable ||
|
||||
%amount < 0 ||
|
||||
( %this.minDamageAmount != 0 && %amount < %this.minDamageAmount ) )
|
||||
return;
|
||||
|
||||
// We cannot destroy things twice.
|
||||
if ( %obj.isDestroyed() )
|
||||
return;
|
||||
|
||||
// This sets a maskbit on the server PhysicsShape which will cause the
|
||||
// client object to destroy ( spawn debris ) during the next ghost update.
|
||||
%obj.destroy();
|
||||
|
||||
// Single-player hack...
|
||||
// In a single-player situation the radial impulse NetEvent will
|
||||
// be applied client-side immediately when we call it, which means it will
|
||||
// happen before the next ghost update and the debris won't even exist yet!
|
||||
//
|
||||
// So we are explicitly calling destroy on the client-side object first,
|
||||
// before sending the event.
|
||||
//
|
||||
if ( %obj.getClientObject() )
|
||||
%obj.getClientObject().destroy();
|
||||
|
||||
if ( %this.damageRadius > 0 )
|
||||
{
|
||||
// Send impulse event to affect objects from the explosion of this object.
|
||||
// Happens server-side and client-side.
|
||||
if ( %this.areaImpulse > 0 )
|
||||
RadialImpulseEvent::send( %position, %this.damageRadius, %this.areaImpulse );
|
||||
|
||||
// Apply damage to objects from the explosion of this object.
|
||||
if ( %this.radiusDamage > 0 )
|
||||
radiusDamage( %obj, %position, %this.damageRadius, %this.radiusDamage, %this.damageType );
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue