1
0
This commit is contained in:
2020-12-13 18:01:13 +03:00
commit dd42f84140
3764 changed files with 596895 additions and 0 deletions

View File

@ -0,0 +1,42 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CastleGame extends SimpleGame;
/** Set to true to allow attract mode */
var config bool bAllowAttractMode;
event OnEngineHasLoaded()
{
}
/**
* Don't allow dying in CastleGame!
*/
function bool PreventDeath(Pawn KilledPawn, Controller Killer, class<DamageType> DamageType, vector HitLocation)
{
return true;
}
static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
// We'll only force CastleGame game type for maps that we know were build for Epic Citadel (EpicCitadel).
// Note that ignore any possible prefix on the map file name so that PIE and Play On still work with this.
if( Right( MapName, 11 ) ~= "EpicCitadel" ||
InStr( MapName, "EpicCitadel." ) != -1 )
{
return super.SetGameType(MapName, Options, Portal);
}
return class'UDKBase.SimpleGame';
}
defaultproperties
{
PlayerControllerClass=class'UDKBase.CastlePC'
HUDType=class'UDKBase.MobileHUDExt'
}

989
UDKBase/classes/CastlePC.uc Normal file
View File

@ -0,0 +1,989 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CastlePC extends SimplePC;
/** Set to true to suppress the splash screen */
var config bool bSuppressSplash;
/** will be true once the splash screen has been shown */
var bool bSplashHasBeenShown;
/** If True then we are in attract mode */
var bool bIsInAttractMode;
/** If True then we are in benchmark mode */
var bool bIsInBenchmarkMode;
/** If True, then a full flythrough loop has been completed in benchmark mode */
var bool bBenchmarkLoopCompleted;
/** Track the number of frames and the elapsed time while in benchmark mode to get average frame rate */
var int BenchmarkNumFrames;
var float BenchmarkElapsedTime;
/** Have we triggered the initial fading out of the Controls Help Menu */
var bool bDoneInitialFade;
var MobileMenuPause PauseMenu; // The Pause menu
var MobileMenuDebug DebugMenu; // The Debug menu
var bool bPauseMenuOpen;
var bool bAutoSlide;
var float SliderStart, SliderEnd;
var float SliderTravelTime;
var float SliderTravelDuration;
var float AutoAttractTime;
var SoundCue OpenMenuSound;
var SoundCue CloseMenuSound;
var MobileMenuControls TutMenu;
/*************************************
Tap to Move
************************************/
/** How far the player must have moved within the last 0.5 seconds before we consider them 'stuck' and
abort automatic movement */
var float StuckThreshHold;
/** Scalar that sets how much the camera should pitch up and down to match the tap-to-move target */
var float TapToMoveAutoPitchAmount;
/** Mesh to use for 'tap to move' visual cue in the world */
var StaticMesh TapToMoveVisualMesh;
/** Minimum distance from destination before visual cue will vanish */
var float TapToMoveVisualMinDist;
/** How fast the visual cue should rotate every frame */
var float TapToMoveVisualRotateSpeed;
/** Length of visual cue animation effect */
var float TapToMoveVisualAnimDuration;
/** Holds the destination we are moving towards */
var vector TapToMoveDestination;
/** We use this to see if we are stuck */
var float LastDistToDestination;
/** Time that tap to move visual effect started */
var float TapToMoveVisualEffectStartTime;
/** Time that tap to move visual effect ended */
var float TapToMoveVisualEffectEndTime;
var SoundCue TapToMoveSound;
var SoundCue InvalidTapToMoveSound;
var SoundCue TapToMoveStopSound;
/** Spawned actor for 'tap to move' visual cue */
var KActorSpawnable TapToMoveVisualActor;
/*************************************
Tutorial
************************************/
enum ETutorialStage
{
ETS_None,
ETS_Tap,
ETS_Swipe,
ETS_Sticks,
ETS_Done,
};
var ETutorialStage TutorialStage;
/** Cached reference to the Tutorial Look Zone */
var MobileInputzone TutorialLookZone;
/**
* Setup the in world indicator for tap to move and some other subsystems
*/
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
// Kill existing 'tap to move' actor, if any
if( TapToMoveVisualActor != None )
{
TapToMoveVisualActor.Destroy();
}
// Spawn our 'tap to move' visual cue actor
TapToMoveVisualActor = Spawn( class'KActorSpawnable',self,,,,,true);
TapToMoveVisualActor.SetCollision( false, false, true ); // Disable collision
TapToMoveVisualActor.SetHidden( true );
TapToMoveVisualActor.SetDrawScale3D( vect( 1, 1, 5 ) );
TapToMoveVisualActor.StaticMeshComponent.SetStaticMesh( TapToMoveVisualMesh );
TapToMoveVisualActor.SetPhysics( PHYS_None );
}
/**
* Make sure we destory the visual tap actor
*/
event Destroyed()
{
// Kill existing 'tap to move' actor, if any
if( TapToMoveVisualActor != None )
{
TapToMoveVisualActor.Destroy();
}
super.Destroyed();
}
/**
* An event that is called after the first tick of GEngine. We are going to hijack this for
* initialization purposes.
*/
event OnEngineInitialTick()
{
// If we are in preview mode, then skip the flyby, splash and tutorial
if (WorldInfo.IsPlayInPreview() || WorldInfo.IsPlayInEditor())
{
// Setup some of the default states
TutorialStage = ETS_Done;
ActivateControlGroup();
ResetMenu();
}
else
{
// trigger Epic Citadel map stuff (see Kismet in EpicCitadel map)
CauseEvent('IntroCam');
ConsoleCommand("mobile playsong town_render");
}
}
/**
* The main purpose of this function is to size and reset zones. There's a lot of specific code in
* here to reposition zones based on if it's an phone vs pad.
*/
function SetupZones()
{
local MobileInputZone Zone;
local float Ratio;
Super.SetupZones();
// If we have a game class, configure the zones
if (MPI != None && WorldInfo.GRI.GameClass != none)
{
// Find the button zone that exits attract mode.
Zone = MPI.FindZone("ExitAttractModeZone");
if (Zone != none)
{
Zone.OnTapDelegate = ExitAttractTap;
}
// Find the tap to move zone and setup the tutorial
Zone = MPI.FindZone("TapTutorialZone");
if (Zone != none)
{
Zone.OnTapDelegate = TapToMoveTap;
}
else
{
`log("!!!WARNING!!! Tutorial will be broken due to Tap");
}
// Find the look zone and setup the tutorial
TutorialLookZone = MPI.FindZone("SwipeTutorialZone");
if (TutorialLookZone == none)
{
`log("!!!WARNING!!! Tutorial will be broken due to Swipe");
}
// If we aren't supressing the splash screen, setup the pause menu
if (!bSuppressSplash)
{
PauseMenu = MobileMenuPause(MPI.OpenMenuScene(class'MobileMenuPause'));
SliderZone = MPI.FindZone("MenuSlider");
if (SliderZone != none)
{
SliderZone.OnTapDelegate = MenuSliderTap;
SliderZone.OnProcessSlide = ProcessMenuSlide;
SliderZone.SizeY = PauseMenu.Height;
}
}
Ratio = ViewportSize.Y / ViewportSize.X;
// Find the zone and hook up the delegate so we can perform tap to move
Zone = MPI.FindZone("TapToMoveZone");
if (Zone != none)
{
Zone.OnTapDelegate = TapToMoveTap;
}
if (FreeLookZone != none)
{
FreeLookZone.OnTapDelegate = TapToMoveTap;
if (Ratio == 0.75 || ViewportSize.X <= 480)
{
FreeLookZone.VertMultiplier *= 1.75;
FreeLookZone.HorizMultiplier *= 3.25;
FreeLookZone.Acceleration *= 0.5;
}
}
// Setup the timer to check for inactivity / attract mode
//SetTimer(1.0,true,'CheckInactivity');
// Setup a timer that will write out controller stats every 60 seconds.
SetTimer(60.0,true,'SaveControllerStats');
// Activate the input group for the flyby (ie: no input)
if (MPI != none)
{
MPI.ActivateInputGroup("InitialFlybyGroup");
}
}
}
/**
* Saves out the controller stats for processing
*/
function SaveControllerStats()
{
if ((StickLookZone != none) && (StickMoveZone != none) && (FreeLookZone != none))
{
ConsoleCommand("mobile recordcontrolstats" @ StickMoveZone.TotalActiveTime @ StickLookZone.TotalActiveTime @ FreeLookZone.TotalActiveTime @ TotalTimeInTapToMove @ NoTapToMoves);
StickMoveZone.TotalActiveTime = 0;
StickLookZone.TotalActiveTime = 0;
FreeLookZone.TotalActiveTime = 0;
}
TotalTimeInTapToMove = 0;
NoTapToMoves = 0;
}
/**
* Every second, we look at various metrics to see if the player has been active. If they haven't been, then
* we want switch to attract mode
*/
function CheckInactivity()
{
// Quick out if we don't allow attract mode
if (CastleGame(WorldInfo.Game) == none || CastleGame(WorldInfo.Game).bAllowAttractMode == false)
{
return;
}
//if the pause menu is open, or a submenu is open
if ( LocalPlayer(Player).ViewportClient.bDisableWorldRendering || (PauseMenu != none && bPauseMenuOpen) || bIsInAttractMode || bCinematicMode || (MPI.MobileMenuStack.Length>1 && TutMenu == none))
{
MPI.MobileInactiveTime = 0;
}
// Make the call...
if (MPI.MobileInactiveTime > AutoAttractTime && !bIsInAttractMode && !bCinematicMode)
{
EnterAttractMode();
}
}
/**
* Trace, but ignore volumes and triggers unless they are blockers (i.e. BlockingVolume)
*
* @param TraceOwner is the player's pawn
* @param HitLocation holds the location were the trace ends
* @param HitNormal holds the orientation of the surface normal where it hit
* @param End is where we would like the trace to end
* @param Start is where the trace is starting from
*/
simulated function Actor TraceForTapToMove(Pawn TraceOwner, out vector HitLocation, out vector HitNormal, vector End, vector Start)
{
local Actor HitActor;
local vector HitLoc, HitNorm;
local TraceHitInfo HitInfo;
// Iterate over each actor along trace...
foreach TraceOwner.TraceActors(class'Actor', HitActor, HitLoc, HitNorm, End, Start, , HitInfo,TRACEFLAG_Bullet)
{
// if it's not a trigger or a volume, use it!
if ( (HitActor.bBlockActors || HitActor.bWorldGeometry) && (Volume(HitActor) == None && Trigger(HitActor)==None))
{
HitLocation = HitLoc;
HitNormal =HitNorm;
return HitActor;
}
}
// Found nothing non-volume or -trigger like :(
return None;
}
/**
* This is our event handler for taps.
*
* @param Zone The Zone we are managing
* @param EventType The type of event that occurred
* @param TouchLocation Where was the touch
*/
function bool TapToMoveTap(MobileInputZone Zone, ETouchType EventType, Vector2D TouchLocation)
{
local Vector2D RelLocation;
local Vector Origin, Direction, Destination;
local Vector HitLocation, HitNormal;
local Actor HitActor;
local bool bWantReverse;
local bool bValidDestination;
// Don't perform these traces if if are in attract mode, playing a cinematic or if the movement stick is
// currently active.
if( !bIsInAttractMode && !bCinematicMode && StickMoveZone.State == ZoneState_Inactive )
{
// Figure out the location relative to the current viewport
RelLocation.X = TouchLocation.X / ViewportSize.X;
RelLocation.Y = TouchLocation.Y / ViewportSize.Y;
// Check to see if the user touched near the very bottom of the viewport
bWantReverse = false; //( RelLocation.Y >= 0.85 );
// If the user clicked near the bottom of the viewport and is already moving toward a destination,
// then cancel the movement in progress. Basically, clicking near the bottom of the viewport is
// used to stop moving.
if( bWantReverse && IsInState('PlayerTapToMove') )
{
// Draw an effect on the HUD
MobileHudExt( MyHud ).StartTapToMoveEffect( TouchLocation.X, TouchLocation.Y );
// Play a 'move stopped' sound effect
PlaySound( TapToMoveStopSound );
// Cancel touch to move
GotoState('PlayerWalking');
}
else
{
NoTapToMoves++;
// If we're reversing then flip the touch point along the horizontal axis so we'll walk backwards
// in the expected direction
if( bWantReverse )
{
RelLocation.x = 1.0 - RelLocation.x;
}
// Deproject and get the world location
LocalPlayer(Player).Deproject(RelLocation, Origin, Direction);
// If we're reversing then choose a location behind the player a little bit
if( bWantReverse )
{
Direction.Z = 0.0f;
Destination = Origin - Direction * 512;
}
else
{
// Moving forward, so cast a way straight out far into the scene
Destination = Origin + (Direction * 10240);
}
// Now trace in to the world and get where to go.
HitActor = TraceForTapToMove(Pawn, HitLocation, HitNormal, Destination, Origin);
if (HitActor != none)
{
Destination = HitLocation + (HitNormal * Pawn.GetCollisionHeight() * 2);
}
if (!PointReachable(Destination))
{
// Still not reachable. Then find the ground and see if we can move there.
Origin = Destination;
Destination.Z = -65535;
HitActor = TraceForTapToMove(Pawn, HitLocation, HitNormal, Destination, Origin);
if (HitActor != none)
{
// We hit the ground, step back the collision Height;
Destination = HitLocation;
Destination.Z += Pawn.GetCollisionHeight();
}
}
// Unless we're reversing, if the desired location is somehow behind the player then fail the movement
if( bWantReverse )
{
bValidDestination = true;
}
else
{
bValidDestination = ( ( Normal( Destination - Pawn.Location ) dot Vector( Pawn.Rotation ) ) > 0.25 );
}
// If the desired location is very close to the player then fail the movement
if( ( VSize2D( Destination - Pawn.Location ) < 128.0 ) )
{
bValidDestination = false;
}
if( bValidDestination )
{
// Play a 'move succeeded' sound effect
PlaySound( TapToMoveSound );
// Draw an effect on the HUD
MobileHudExt( MyHud ).StartTapToMoveEffect( TouchLocation.X, TouchLocation.Y );
// Start moving to the new destination!
DoTapToMove( Destination, !bWantReverse ); // Don't auto-look at destination when reversing
}
else
{
// Play a 'move failed' sound effect
PlaySound( InvalidTapToMoveSound );
// Cancel an existing tap-to-move action, if there is one in progress
if( IsInState('PlayerTapToMove') )
{
GotoState('PlayerWalking');
}
}
}
}
return true;
}
/**
* The player has clicked on a spot. Start the move
*
* @param NewDestination Where do we want to move to
* @param bShouldLookAtDestination True if we should also automatically look toward the destination
*/
function DoTapToMove( vector NewDestination, bool bShouldLookAtDestination )
{
// Update position of tap to move visual cue
TapToMoveVisualActor.SetLocation( NewDestination + vect( 0, 0, 6 ) ); // Raise up a bit
TapToMoveVisualActor.SetHidden( false );
TapToMoveVisualEffectStartTime = WorldInfo.RealTimeSeconds;
TapToMoveDestination = NewDestination;
LastDistToDestination = VSize(Pawn.Location - TapToMoveDestination);
if( bShouldLookAtDestination )
{
// Start automatically orientating toward the target point
PlayerLookAtDestination();
}
GotoState('PlayerTapToMove');
}
/**
* Initialize the look at system to point to the destination.
*/
function PlayerLookAtDestination()
{
if( !bLookAtDestination )
{
// Start rotating!
bLookAtDestination = true;
}
// Reset the time of last view change so that we're guaranteed to start looking toward the destination,
// even if the user dragged the view right before touching to move
TimeOfLastUserViewChange = 0;
}
/**
* Tap to Move requires it's own special state for the player controller
*/
state PlayerTapToMove
{
/**
* Setup the auto-rotate towards the destination
*/
event BeginState(Name PreviousStateName)
{
Super.BeginState(PreviousStateName);
LastEnteredTapToMove = WorldInfo.RealTimeSeconds;
// If we are in the tutorial, skip to the next step
if (TutorialStage == ETS_Tap)
{
TutMenu.FadeOut();
TutMenu = MobileMenuControls(MPI.OpenMenuScene(class'UDKBase.MobileMenuControls'));
TutMenu.Setup(false);
MPI.ActivateInputGroup("SwipeTutorialGroup");
TutorialStage = ETS_Swipe;
}
}
/**
* Close everything down.
*/
event EndState(Name NextStateName)
{
// Track Stats
TotalTimeInTapToMove += WorldInfo.RealTimeSeconds - LastEnteredTapToMove;
Super.EndState(NextStateName);
// Turn off the check to see if we are stuck
Cleartimer('CheckIfStuck');
// Stop automatically orientating toward the target point
bLookAtDestination = false;
// Start hiding the visual cue if we haven't already
if( TapToMoveVisualEffectEndTime < TapToMoveVisualEffectStartTime )
{
TapToMoveVisualEffectEndTime = WorldInfo.RealTimeSeconds;
}
}
/**
* Check to see if the player is stuck. This is called every 1/2 second. It just looks to see if you have most past a threshold since
* the last check and if not, considers you stuck.
*
* We also use this event to determine if enough time has passed that we should start auto-rotating again
*/
event CheckIfStuck()
{
local Float DistToDestination;
DistToDestination = VSize(Pawn.Location - TapToMoveDestination);
if (LastDistToDestination - DistToDestination < StuckThreshHold)
{
GotoState('PlayerWalking');
}
else
{
LastDistToDestination = DistToDestination;
}
}
/**
* Each frame, look to see if the player has decided to use the virtual stick to move. If they have,
* we want to abort tap to move.
*/
function PlayerTick(float DeltaTime)
{
if (IsStickMoveActive())
{
GotoState('PlayerWalking');
}
Global.PlayerTick(DeltaTime);
}
Begin:
// Check to see if we're not making progress every so often
SetTimer( 0.5, true, 'CheckIfStuck' );
// while we have a valid pawn and move target, and
// we haven't reached the target yet
while (Pawn != None && !Pawn.ReachedPoint(TapToMoveDestination,none))
{
MoveToDirectNonPathPos(TapToMoveDestination,,1,true);
}
GotoState('PlayerWalking');
}
/**
* Called from PlayerMove, it's here that we adjust the viewport
*/
function ProcessViewRotation( float DeltaTime, out Rotator out_ViewRotation, Rotator DeltaRot )
{
local float AnimProgress;
local vector NewDrawScale;
// If we are looking at a desintation, preset it for the super to manage
if( bLookAtDestination )
{
LookAtDestination = TapToMoveDestination - Pawn.Location;
LookAtDestAutoPitchAmount = TapToMoveAutoPitchAmount;
}
Super.ProcessViewRotation( DeltaTime, out_ViewRotation, DeltaRot);
// Animate the tap-to-move visual cue
if( TapToMoveVisualEffectEndTime < TapToMoveVisualEffectStartTime )
{
// We're fading in!
AnimProgress = 1.0 - FMin( ( WorldInfo.RealTimeSeconds - TapToMoveVisualEffectStartTime ) / TapToMoveVisualAnimDuration, 1.0 );
AnimProgress = FInterpEaseInOut( 0.0, 1.0, AnimProgress, 1.5 );
TapToMoveVisualActor.SetRotation( TapToMoveVisualActor.Rotation + MakeRotator( 0, DeltaTime * ( TapToMoveVisualRotateSpeed + 8.0 * AnimProgress * TapToMoveVisualRotateSpeed ), 0 ) );
}
else
{
// We're fading out!
AnimProgress = FMin( ( WorldInfo.RealTimeSeconds - TapToMoveVisualEffectEndTime ) / TapToMoveVisualAnimDuration, 1.0 );
AnimProgress = FInterpEaseInOut( 0.0, 1.0, AnimProgress, 1.5 );
TapToMoveVisualActor.SetRotation( TapToMoveVisualActor.Rotation + MakeRotator( 0, DeltaTime * ( 1.0 - AnimProgress ) * TapToMoveVisualRotateSpeed, 0 ) );
if( AnimProgress >= 1.0 )
{
// Hide the actor now that we're finished transitioning
TapToMoveVisualActor.SetHidden( true );
}
}
NewDrawScale.X = 1.0 - AnimProgress * 1.0; // Squash to zero from normal size
NewDrawScale.Y = 1.0 + AnimProgress * 0.5; // Grow to slightly bigger size
NewDrawScale.Z = 1.25 - AnimProgress * 1.25; // Squash to zero from bigger size
TapToMoveVisualActor.SetDrawScale3D( NewDrawScale );
}
/**
* If we're very close to the target, then go ahead and hide the visual cue
*/
simulated function CheckDistanceToDestination(float DistToDestination)
{
if( DistToDestination < TapToMoveVisualMinDist )
{
if( TapToMoveVisualEffectEndTime < TapToMoveVisualEffectStartTime )
{
TapToMoveVisualEffectEndTime = WorldInfo.RealTimeSeconds;
}
}
}
/**
* notification when a matinee director track starts or stops controlling the ViewTarget of this PlayerController
*
* @param bNowControlling will be true if we are back in control
*/
event NotifyDirectorControl(bool bNowControlling, SeqAct_Interp CurrentMatinee)
{
super.NotifyDirectorControl(bNowControlling, CurrentMatinee);
if( bNowControlling )
{
// Make sure our tap-to-move actor is hidden
TapToMoveVisualActor.SetHidden( true );
}
}
/**
* Enter attrack mode. We need to make sure we kill any active menus/etc.
*/
exec function EnterAttractMode( bool BeginBenchmarking = false )
{
// Make sure we're not currently auto-moving to a destination
if( IsInState('PlayerTapToMove') )
{
GotoState('PlayerWalking');
}
// Kill the tutorial menu
if (TutMenu != none)
{
TutMenu.FadeOut();
TutMenu = none;
MPI.ActivateInputGroup("UberGroup");
MobileHudExt(myHUD).FlashSticks();
TutorialStage = ETS_Done;
}
// Hide the on screen help if it's there
if (PauseMenu != none)
{
PauseMenu.ReleaseHelp();
}
// Go in to attract mode
CauseEvent('PlayMatinee');
bIsInAttractMode = true;
bIsInBenchmarkMode = BeginBenchmarking;
bBenchmarkLoopCompleted = false;
BenchmarkNumFrames = 0;
BenchmarkElapsedTime = 0.0;
ResetMenu();
MPI.ActivateInputGroup("AttractGroup");
}
exec function OnFlyThroughLoopCompleted()
{
// Set the benchmark loop completed flag so that we can calculate and display the results of the benchmark fly through
bBenchmarkLoopCompleted = true;
}
/**
* Leave attract mode
*/
exec function ExitAttractMode()
{
if (bIsInBenchmarkMode)
{
PauseMenu.InputOwner.Outer.ConsoleCommand("mobile benchmark end");
}
bIsInAttractMode = false;
bIsInBenchmarkMode = false;
bBenchmarkLoopCompleted = false;
MPI.MobileInactiveTime = 0;
CauseEvent('StopMatinee');
ActivateControlGroup();
ResetMenu();
}
/**
* Delegate that gets called when the exit attact mode button is tapped
*/
function bool ExitAttractTap(MobileInputZone Zone, ETouchType EventType, Vector2D TouchLocation)
{
ExitAttractMode();
PauseMenu.SetDefaultUI(); // set the correct UI
return true;
}
/**
* Automatically slide to a new location
*/
function AutoSlide(float Destination)
{
SliderStart = SliderZone.CurrentLocation.Y;
SliderEnd = Destination;
SliderTravelTime = 0;
bAutoSlide = true;
}
/**
* Reset the pause menu
*/
function ResetMenu()
{
if (bPauseMenuOpen)
{
PauseMenu.OnResetMenu();
AutoSlide(SliderZone.Y);
bPauseMenuOpen = false;
PlaySound( CloseMenuSound );
}
}
/**
* Force the Pause Menu to open
*/
function OpenMenu()
{
if (!bPauseMenuOpen)
{
bPauseMenuOpen = true;
AutoSlide(PauseMenu.ShownSize);
PlaySound( OpenMenuSound );
}
}
/**
* Depending on the state of the pause menu, a tap on it's nub will either auto-open or auto-close it.
* This delegate manages the tap.
*/
function bool MenuSliderTap(MobileInputZone Zone, ETouchType EventType, Vector2D TouchLocation)
{
if (bPauseMenuOpen)
{
ResetMenu();
}
else
{
OpenMenu();
}
return true;
}
/**
* When you touch and drag on the nub, this code determines what to do.
*/
function bool ProcessMenuSlide(MobileInputZone Zone, ETouchType EventType, int SlideValue, Vector2D ViewportSizes)
{
// Align the menu to the touch.
PauseMenu.Top = Zone.CurrentLocation.Y - PauseMenu.Height;
// somehow the zone size is being reset (on device, but not PC), so this just fixes it. mildly hacky, but no real penalty.
Zone.SizeY = PauseMenu.Height;
// If we are releasing the menu, see if we need to reset, or if we need to open
if (EventType == Touch_Ended && !bPauseMenuOpen)
{
if (Zone.CurrentLocation.Y >= PauseMenu.ShownSize)
{
OpenMenu();
}
else
{
AutoSlide(SliderZone.Y);
}
}
return true;
}
/**
* Handle any animations and time criticl code
*/
function PlayerTick(float DeltaTime)
{
local int SettingsLocationX;
Super.PlayerTick(DeltaTime);
if (TutorialStage == ETS_Swipe)
{
if (TutorialLookZone.State != ZoneState_Inactive)
{
TutMenu.FadeOut();
TutMenu = none;
MPI.ActivateInputGroup("UberGroup");
MobileHudExt(myHUD).FlashSticks();
TutorialStage = ETS_Done;
}
}
// Trigger the fading of the Controls Help screen that we bring up on map load
if ( !bDoneInitialFade )
{
// @todo: Disabled this for intermediate demo; Consider re-enabling later.
// PauseMenu.FadeOutControlsMenu();
bDoneInitialFade = TRUE;
}
// Handle the menu sliding back in to place
if (bAutoSlide)
{
SliderZone.CurrentLocation.Y = FInterpEaseInOut(SliderStart,SliderEnd, SliderTravelTime/SliderTravelDuration,3.0);
SliderTravelTime += DeltaTime;
if (SliderTravelTime >= SliderTravelDuration)
{
SliderZone.CurrentLocation.Y = SliderEnd;
bAutoSlide = false;
if (!bPauseMenuOpen)
{
if (bIsInAttractMode)
{
PauseMenu.SetAttractModeUI(bIsInBenchmarkMode);
}
else
{
PauseMenu.SetDefaultUI();
}
}
}
PauseMenu.Top = SliderZone.CurrentLocation.Y - PauseMenu.Height;
}
// Only pull out the settings menu if it's available (only Android)
if (PauseMenu.MenuObjects.length >= 5)
{
SettingsLocationX = FInterpEaseInOut(MyHUD.SizeX, PauseMenu.Width - PauseMenu.MenuObjects[4].Width + 2, FClamp(SliderZone.CurrentLocation.Y / (PauseMenu.ShownSize - SliderZone.Y), 0.0, 1.0), 3.0);
PauseMenu.MenuObjects[4].Left = SettingsLocationX;
}
// If we are currently benchmarking, track the number of frames and elapsed time.
// Note that this assumes a TimeDilation of 1.0 and doesn't properly handle the cases where DeltaTime is clamped because it was super long or super short, but in EpicCitadel benchmark mode these shouldn't be problems in practice.
if( bIsInBenchmarkMode && !bBenchmarkLoopCompleted )
{
BenchmarkNumFrames += 1;
BenchmarkElapsedTime += DeltaTime;
}
}
/**
* Show the splash screen
*/
exec function ShowSplash()
{
// Activate the tutorial input group then show the splash
MPI.ActivateInputGroup("TapTutorialGroup");
if (!bSplashHasBeenShown && !bSuppressSplash && MPI != none)
{
bSplashHasBeenShown = true;
MPI.OpenMenuScene(class'UDKBase.MobileMenuSplash');
}
}
/**
* Display the control help on the screen
*/
exec function FlashHelp(float Duration)
{
if (!bPauseMenuOpen)
{
PauseMenu.FlashHelp(Duration);
}
}
/**
* Start the tutorials
*/
function StartTutorials()
{
TutMenu = MobileMenuControls(MPI.OpenMenuScene(class'UDKBase.MobileMenuControls'));
TutMenu.Setup(true);
TutorialStage = ETS_Tap;
}
exec function SetFootstepsToStone()
{
FootstepSounds[0]=SoundCue'CastleAudio.Player.Footstep_Walk_01_Cue';
FootstepSounds[1]=SoundCue'CastleAudio.Player.Footstep_Walk_02_Cue';
FootstepSounds[2]=SoundCue'CastleAudio.Player.Footstep_Walk_03_Cue';
FootstepSounds[3]=SoundCue'CastleAudio.Player.Footstep_Walk_04_Cue';
FootstepSounds[4]=SoundCue'CastleAudio.Player.Footstep_Walk_05_Cue';
FootstepSounds[5]=SoundCue'CastleAudio.Player.Footstep_Walk_06_Cue';
}
exec function SetFootstepsToSnow()
{
FootstepSounds[0]=SoundCue'CastleAudio.Player.Footstep_Snow01_Cue';
FootstepSounds[1]=SoundCue'CastleAudio.Player.Footstep_Snow02_Cue';
FootstepSounds[2]=SoundCue'CastleAudio.Player.Footstep_Snow03_Cue';
FootstepSounds[3]=SoundCue'CastleAudio.Player.Footstep_Snow04_Cue';
FootstepSounds[4]=SoundCue'CastleAudio.Player.Footstep_Snow05_Cue';
FootstepSounds[5]=SoundCue'CastleAudio.Player.Footstep_Snow06_Cue';
}
defaultproperties
{
StuckThreshHold=25
TapToMoveAutoPitchAmount=0.25
TapToMoveVisualMesh=StaticMesh'CastleEffects.TouchToMoveArrow'
TapToMoveVisualMinDist=230
TapToMoveVisualRotateSpeed=100000
TapToMoveVisualAnimDuration=0.3
AutoAttractTime=45
TapToMoveSound=SoundCue'CastleAudio.UI.UI_TouchToMove_Cue'
InvalidTapToMoveSound=SoundCue'CastleAudio.UI.UI_InvalidTouchToMove_Cue'
TapToMoveStopSound=SoundCue'CastleAudio.UI.UI_StopTouchToMove_Cue'
OpenMenuSound=SoundCue'CastleAudio.UI.UI_MainMenu_Cue'
CloseMenuSound=SoundCue'CastleAudio.UI.UI_OK_Cue'
bSplashHasBeenShown=false
SliderTravelDuration=0.3
TutorialStage=ETS_None
FootstepSounds(0)=SoundCue'CastleAudio.Player.Footstep_Walk_01_Cue'
FootstepSounds(1)=SoundCue'CastleAudio.Player.Footstep_Walk_02_Cue'
FootstepSounds(2)=SoundCue'CastleAudio.Player.Footstep_Walk_03_Cue'
FootstepSounds(3)=SoundCue'CastleAudio.Player.Footstep_Walk_04_Cue'
FootstepSounds(4)=SoundCue'CastleAudio.Player.Footstep_Walk_05_Cue'
FootstepSounds(5)=SoundCue'CastleAudio.Player.Footstep_Walk_06_Cue'
}

View File

@ -0,0 +1,10 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CloudGame extends SimpleGame;
defaultproperties
{
PlayerControllerClass=class'UDKBase.CloudPC'
HUDType=class'UDKBase.CloudHUD'
}

View File

@ -0,0 +1,62 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CloudHUD extends UDKHUD;
function PostRender()
{
local CloudPC PC;
local FacebookIntegration Facebook;
PC = CloudPC(PlayerOwner);
super.PostRender();
Canvas.DrawColor = class'HUD'.default.WhiteColor;
Canvas.SetPos(300 / 2, 100 / 2);
Canvas.DrawText("Exp: " $ PC.SaveData.Exp $ " -- Gold: " $ PC.SaveData.Gold);
Canvas.SetPos(900 / 2, 300 / 2);
if (PC.Slot1DocIndex == -1)
{
Canvas.DrawText("No Data");
}
else
{
Canvas.DrawText("Save Game 1");
}
Canvas.SetPos(900 / 2, 450 / 2);
if (PC.Slot2DocIndex == -1)
{
Canvas.DrawText("No Data");
}
else
{
Canvas.DrawText("Save Game 2");
}
Facebook = class'PlatformInterfaceBase'.static.GetFacebookIntegration();
Canvas.SetPos(450 / 2, Canvas.SizeY - 50);
if (Facebook.IsAuthorized())
{
Canvas.DrawText("FB authorized: " $ Facebook.Username);
}
else if (PC.bIsFBAuthenticating)
{
Canvas.DrawText("FB authenticating...");
}
else
{
Canvas.DrawText("FB not authorized");
}
}
defaultproperties
{
ButtonFont = Font'EngineFonts.SmallFont'
ButtonCaptionColor=(R=255,G=255,B=255,A=255)
}

View File

@ -0,0 +1,175 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CloudMenuMicroTrans extends MobileMenuScene;
var CloudPC PC;
var MicroTransactionBase MicroTrans;
var MobileMenuButton ProductButtons[2];
event InitMenuScene(MobilePlayerInput PlayerInput, int ScreenWidth, int ScreenHeight, bool bIsFirstInitialization)
{
super.InitMenuScene(PlayerInput, ScreenWidth, ScreenHeight, bIsFirstInitialization);
PC = CloudPC(InputOwner.Outer);
MicroTrans = class'PlatformInterfaceBase'.static.GetMicroTransactionInterface();
MicroTrans.AddDelegate(MTD_PurchaseQueryComplete, OnProductQueryComplete);
MicroTrans.AddDelegate(MTD_PurchaseComplete, OnProductPurchaseComplete);
ProductButtons[0] = MobileMenuButton(FindMenuObject("Product1"));
ProductButtons[1] = MobileMenuButton(FindMenuObject("Product2"));
}
event OnTouch(MobileMenuObject Sender, ETouchType EventType, float TouchX, float TouchY)
{
if (Sender.Tag == "Refresh")
{
MicroTrans.QueryForAvailablePurchases();
}
else if (Sender.Tag == "Close")
{
InputOwner.CloseMenuScene(self);
}
else if (Sender.Tag == "Product1")
{
MicroTrans.BeginPurchase(0);
}
else if (Sender.Tag == "Product2")
{
MicroTrans.BeginPurchase(1);
}
}
function Closed()
{
MicroTrans.ClearDelegate(MTD_PurchaseQueryComplete, OnProductQueryComplete);
MicroTrans.ClearDelegate(MTD_PurchaseComplete, OnProductPurchaseComplete);
Super.Closed();
}
function OnProductQueryComplete(const out PlatformInterfaceDelegateResult Result)
{
local int Index;
local PurchaseInfo Info;
for (Index = 0; Index < MicroTrans.AvailableProducts.length; Index++)
{
Info = MicroTrans.AvailableProducts[Index];
if (Index < 2)
{
ProductButtons[Index].bIsHidden = false;
ProductButtons[Index].Caption = Info.DisplayName;
}
`log("Purchase " $ Index $ ":");
`log(" " $ Info.Identifier $ " - " $ Info.DisplayName $ " / " $ Info.DisplayPrice $ " - " $ Info.DisplayDescription);
}
}
function OnProductPurchaseComplete(const out PlatformInterfaceDelegateResult Result)
{
`log("Purchase complete:");
`log(" Product = " $ Result.Data.StringValue);
`log(" bSuccess = " $ Result.bSuccessful);
`log(" Result = " $ Result.Data.IntValue);
if (Result.Data.IntValue == MTR_Failed)
{
`log(" Error: " $ MicroTrans.LastError);
`log(" Solution: " $ MicroTrans.LastErrorSolution);
}
}
defaultproperties
{
Top=0
Left=0
Width=1.0
Height=1.0
bRelativeWidth=true
bRelativeHeight=true
Begin Object Class=MobileMenuButton Name=Refresh
Tag="Refresh"
Caption="Refresh Products"
CaptionColor=(R=1,G=1,B=1,A=1)
Left=0.25
Top=0
Width=0.5
Height=0.15
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
// Note: These are referencing large button background textures that aren't really required.
// Images[0]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
// Images[1]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
ImagesUVs[0]=(bCustomCoords=true,U=0,V=0,UL=512,VL=512)
ImagesUVs[1]=(bCustomCoords=true,U=512,V=512,UL=512,VL=512)
End Object
MenuObjects.Add(Refresh)
Begin Object Class=MobileMenuButton Name=Close
Tag="Close"
Caption="Back"
CaptionColor=(R=1,G=1,B=1,A=1)
Left=0.25
Top=0.8
Width=0.5
Height=0.15
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
// Note: These are referencing large button background textures that aren't really required.
// Images[0]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
// Images[1]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
ImagesUVs[0]=(bCustomCoords=true,U=0,V=0,UL=512,VL=512)
ImagesUVs[1]=(bCustomCoords=true,U=512,V=512,UL=512,VL=512)
End Object
MenuObjects.Add(Close)
Begin Object Class=MobileMenuButton Name=Product1
Tag="Product1"
CaptionColor=(R=1,G=1,B=1,A=1)
bIsHidden=true
Left=0.25
Top=0.2
Width=0.5
Height=0.15
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
// Note: These are referencing large button background textures that aren't really required.
// Images[0]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
// Images[1]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
ImagesUVs[0]=(bCustomCoords=true,U=0,V=0,UL=512,VL=512)
ImagesUVs[1]=(bCustomCoords=true,U=512,V=512,UL=512,VL=512)
End Object
MenuObjects.Add(Product1)
Begin Object Class=MobileMenuButton Name=Product2
Tag="Product2"
CaptionColor=(R=1,G=1,B=1,A=1)
bIsHidden=true
Left=0.25
Top=0.4
Width=0.5
Height=0.15
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
// Note: These are referencing large button background textures that aren't really required.
// Images[0]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
// Images[1]=Texture2D'KismetGame_Assets.Effects.T_EarBuzz_01_D'
ImagesUVs[0]=(bCustomCoords=true,U=0,V=0,UL=512,VL=512)
ImagesUVs[1]=(bCustomCoords=true,U=512,V=512,UL=512,VL=512)
End Object
MenuObjects.Add(Product2)
}

524
UDKBase/classes/CloudPC.uc Normal file
View File

@ -0,0 +1,524 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CloudPC extends SimplePC;
/** Save data */
var CloudSaveData SaveData;
var int Slot1DocIndex;
var int Slot2DocIndex;
/** Cache some singletons */
var CloudStorageBase Cloud;
var FacebookIntegration Facebook;
var InGameAdManager AdManager;
var MicroTransactionBase MicroTrans;
var TwitterIntegrationBase Twitter;
/** Are we currently authenticating with facebook? */
var bool bIsFBAuthenticating;
/** Has an ingame ad been shown? */
var bool bAdHasBeenShown;
simulated function PostBeginPlay()
{
super.PostBeginPlay();
Slot1DocIndex = -1;
Slot2DocIndex = -1;
// listen for cloud storage value changes
Cloud = class'PlatformInterfaceBase'.static.GetCloudStorageInterface();
Cloud.AddDelegate(CSD_ValueChanged, CloudValueChanged);
Cloud.AddDelegate(CSD_DocumentReadComplete, CloudReadDocument);
Cloud.AddDelegate(CSD_DocumentConflictDetected, CloudConflictDetected);
AdManager = class'PlatformInterfaceBase'.static.GetInGameAdManager();
AdManager.AddDelegate(AMD_ClickedBanner, OnUserClickedAdvertisement);
AdManager.AddDelegate(AMD_UserClosedAd, OnUserClosedAdvertisement);
Facebook = class'PlatformInterfaceBase'.static.GetFacebookIntegration();
Facebook.AddDelegate(FID_AuthorizationComplete, OnFBAuthComplete);
Facebook.AddDelegate(FID_FriendsListComplete, OnFBFriendsListComplete);
Facebook.AddDelegate(FID_DialogComplete, OnFBDialogComplete);
Facebook.AddDelegate(FID_FacebookRequestComplete, OnFBRequestComplete);
MicroTrans = class'PlatformInterfaceBase'.static.GetMicroTransactionInterface();
// MicroTrans.AddDelegate(MTD_PurchaseQueryComplete, OnProductQueryComplete);
// MicroTrans.AddDelegate(MTD_PurchaseComplete, OnProductPurchaseComplete);
Twitter = class'PlatformInterfaceBase'.static.GetTwitterIntegration();
Twitter.AddDelegate(TID_TweetUIComplete, OnTweetComplete);
Twitter.AddDelegate(TID_RequestComplete, OnTwitterRequestComplete);
Twitter.AddDelegate(TID_AuthorizeComplete, OnTwitterAuthorizeComplete);
Twitter.AuthorizeAccounts();
// make a save data object
SaveData = new class'CloudSaveData';
// look for existing documents
CloudGetDocs();
}
// Cleanup
event Destroyed()
{
super.Destroyed();
Cloud.ClearDelegate(CSD_ValueChanged, CloudValueChanged);
Cloud.ClearDelegate(CSD_DocumentReadComplete, CloudReadDocument);
Cloud.ClearDelegate(CSD_DocumentConflictDetected, CloudConflictDetected);
AdManager.ClearDelegate(AMD_ClickedBanner, OnUserClickedAdvertisement);
AdManager.ClearDelegate(AMD_UserClosedAd, OnUserClosedAdvertisement);
Facebook.ClearDelegate(FID_AuthorizationComplete, OnFBAuthComplete);
Facebook.ClearDelegate(FID_FacebookRequestComplete, OnFBRequestComplete);
// MicroTrans.ClearDelegate(MTD_PurchaseQueryComplete, OnProductQueryComplete);
// MicroTrans.ClearDelegate(MTD_PurchaseComplete, OnProductPurchaseComplete);
}
exec function CloudGameFight()
{
SaveData.Exp += Rand(20);
SaveData.Gold += Rand(10);
}
exec function CloudGameSave(int Slot)
{
local int DocIndex;
Cloud = class'PlatformInterfaceBase'.static.GetCloudStorageInterface();
DocIndex = Slot == 1 ? Slot1DocIndex : Slot2DocIndex;
if (DocIndex == -1)
{
`log("Creating new save slot");
DocIndex = Cloud.CreateCloudDocument("" $ Slot $ "_Save.bin");
if (Slot == 1)
{
Slot1DocIndex = DocIndex;
}
else
{
Slot2DocIndex = DocIndex;
}
}
// save the document
Cloud.SaveDocumentWithObject(DocIndex, SaveData, 0);
Cloud.WriteCloudDocument(DocIndex);
}
exec function CloudGameLoad(int Slot)
{
local int DocIndex;
DocIndex = Slot == 1 ? Slot1DocIndex : Slot2DocIndex;
if (DocIndex == -1)
{
`log("No save data in that slot");
return;
}
// read the document
Cloud.ReadCloudDocument(DocIndex);
}
function CloudLogValue(const out PlatformInterfaceDelegateResult Result)
{
`log("Retrieved key " $ Result.Data.DataName $ ", with value:");
switch (Result.Data.Type)
{
case PIDT_Int: `log(Result.Data.IntValue); break;
case PIDT_Float: `log(Result.Data.FloatValue); break;
case PIDT_String: `log(Result.Data.StringValue); break;
case PIDT_Object: `log(Result.Data.ObjectValue); break;
}
Cloud.ClearDelegate(CSD_KeyValueReadComplete, CloudLogValue);
}
function CloudValueChanged(const out PlatformInterfaceDelegateResult Result)
{
local PlatformInterfaceDelegateResult ImmediateResult;
`log("Value " $ Result.Data.StringValue $ " changed with tag " $ Result.Data.DataName $ ". Assuming Integer typewhen reading:");
Cloud.AddDelegate(CSD_KeyValueReadComplete, CloudLogValue);
Cloud.ReadKeyValue(Result.Data.StringValue, PIDT_Int, ImmediateResult);
}
function CloudIncrementValue(const out PlatformInterfaceDelegateResult Result)
{
local PlatformInterfaceData WriteData;
`log("Retrieved value " $ Result.Data.IntValue);
WriteData = Result.Data;
WriteData.IntValue++;
Cloud.WriteKeyValue("CloudTestKey", WriteData);
Cloud.ClearDelegate(CSD_KeyValueReadComplete, CloudIncrementValue);
}
exec function CloudGetAndIncrement()
{
local PlatformInterfaceDelegateResult ImmediateResult;
Cloud.AddDelegate(CSD_KeyValueReadComplete, CloudIncrementValue);
Cloud.ReadKeyValue("CloudTestKey", PIDT_Int, ImmediateResult);
}
function CloudGotDocuments(const out PlatformInterfaceDelegateResult Result)
{
local int NumDocs, i, SlotNum;
NumDocs = Cloud.GetNumCloudDocuments();
`log("We have found " $ NumDocs $ " documents in the cloud:");
for (i = 0; i < NumDocs; i++)
{
`log(" - " $ Cloud.GetCloudDocumentName(i));
SlotNum = int(Left(Cloud.GetCloudDocumentName(i), 1));
if (SlotNum == 1)
{
Slot1DocIndex = i;
}
else if (SlotNum == 2)
{
Slot2DocIndex = i;
}
}
}
function CloudReadDocument(const out PlatformInterfaceDelegateResult Result)
{
local int DocumentIndex;
DocumentIndex = Result.Data.IntValue;
if (Result.bSuccessful)
{
SaveData = CloudSaveData(Cloud.ParseDocumentAsObject(DocumentIndex, class'CloudSaveData', 0));
}
else
{
`log("Failed to read document index " $ DocumentIndex);
}
}
function CloudConflictDetected(const out PlatformInterfaceDelegateResult Result)
{
`log("Aww, there's a conflict in " $ Cloud.GetCloudDocumentName(Result.Data.IntValue) $
" . There are " $ Cloud.GetNumCloudDocuments(true) $ " versions. Going to resolve to newest version");
// this is the easy way to resolve differences - just pick the newest one
// @todo: test reading all versions and picking largest XP version
Cloud.ResolveConflictWithNewestDocument();
}
function CloudGetDocs()
{
Cloud.AddDelegate(CSD_DocumentQueryComplete, CloudGotDocuments);
Cloud.QueryForCloudDocuments();
}
exec function CloudGameToggleAd()
{
if (bAdHasBeenShown)
{
AdManager.HideBanner();
}
else
{
AdManager.ShowBanner(true);
}
bAdHasBeenShown = !bAdHasBeenShown;
}
/**
* Called on all player controllers when an in-game advertisement has been clicked
* on by the user. Game will probably want to pause, etc, at this point
*/
function OnUserClickedAdvertisement(const out PlatformInterfaceDelegateResult Result)
{
`log("CloudPC::OnUserClickedBanner");
}
/**
* Called on all player controllers when an in-game advertisement has been closed
* down (usually when user clicks Done or similar). Game will want to unpause, etc here.
*/
event OnUserClosedAdvertisement(const out PlatformInterfaceDelegateResult Result)
{
`log("CloudPC::OnUserClosedAd");
}
function OnFBAuthComplete(const out PlatformInterfaceDelegateResult Result)
{
bIsFBAuthenticating = false;
}
function OnFBRequestComplete(const out PlatformInterfaceDelegateResult Result)
{
`if( `notdefined(FINAL_RELEASE) )
local JsonObject Root, FriendsArray, Friend;
local int Index;
if (Result.bSuccessful)
{
Root = class'JsonObject'.static.DecodeJson(Result.Data.StringValue);
// top level is "data" = [friend,friend]
FriendsArray = Root.GetObject("data");
`log("You have " $ FriendsArray.ObjectArray.length $ " friends:");
// loop over the friends
for (Index = 0; Index < FriendsArray.ObjectArray.length; Index++)
{
// get a friend object
Friend = FriendsArray.ObjectArray[Index];
// output friend info
`log("Friend " $ Friend.GetStringValue("name") $ " has ID " $ Friend.GetStringValue("id"));
}
}
`endif
}
function OnFBFriendsListComplete(const out PlatformInterfaceDelegateResult Result)
{
`log("Friendlist request complete. Success? " $ Result.bSuccessful);
}
function OnFBDialogComplete(const out PlatformInterfaceDelegateResult Result)
{
`log("Dialog complete. Success? " $ Result.bSuccessful $ ". Result = " $ Result.Data.StringValue);
}
exec function CloudGameFacebook()
{
// local JsonObject PlayerStats, EquippedArray, InventoryArray, ItemData;
// local string JsonString;
local array<string>Params;
local int i;
if (!Facebook.IsAuthorized())
{
if (Facebook.Authorize() == true)
{
bIsFBAuthenticating = true;
}
return;
}
/*
PlayerStats = new class'JsonObject';
PlayerStats.SetStringValue("accesstoken", Facebook.AccessToken);
PlayerStats.SetIntValue("level", 5);
PlayerStats.SetIntValue("currentXP", 123123);
PlayerStats.SetIntValue("nextLevelXP", 125000);
PlayerStats.SetIntValue("statHealth", 84);
PlayerStats.SetIntValue("statShield", 15);
PlayerStats.SetIntValue("statDamage", 18);
PlayerStats.SetIntValue("statMagic", 60);
PlayerStats.SetIntValue("avaiableStatPoints", 5);
PlayerStats.SetIntValue("rebalanceStatsCount", 3);
PlayerStats.SetIntValue("currentBloodline", 2);
PlayerStats.SetIntValue("currentPlaythrough", 1);
PlayerStats.SetIntValue("godKingLevel", 99);
PlayerStats.SetIntValue("currentGold", 45000);
EquippedArray = new class'JsonObject';
EquippedArray.ValueArray[0] = "\\#0";
EquippedArray.ValueArray[1] = "\\#2";
PlayerStats.SetObject("EquippedItems", EquippedArray);
InventoryArray = new class'JsonObject';
ItemData = new class'JsonObject';
ItemData.SetStringValue("itemName", "CrapSword");
ItemData.SetIntValue("xpGainedFromItem", 200);
ItemData.SetIntValue("count", 1);
ItemData.SetIntValue("numTimesMastered", 0);
InventoryArray.ObjectArray[InventoryArray.ObjectArray.length] = ItemData;
ItemData = new class'JsonObject';
ItemData.SetStringValue("itemName", "Potion");
ItemData.SetIntValue("xpGainedFromItem", 0);
ItemData.SetIntValue("count", 10);
ItemData.SetIntValue("numTimesMastered", 0);
InventoryArray.ObjectArray[InventoryArray.ObjectArray.length] = ItemData;
ItemData = new class'JsonObject';
ItemData.SetStringValue("itemName", "HornOfPlenty");
ItemData.SetIntValue("xpGainedFromItem", 100);
ItemData.SetIntValue("count", 2);
ItemData.SetIntValue("numTimesMastered", 1);
InventoryArray.ObjectArray[InventoryArray.ObjectArray.length] = ItemData;
PlayerStats.SetObject("PlayerInventory", InventoryArray);
PlayerStats.SetIntValue("maxBloodline", 4);
PlayerStats.SetIntValue("maxPlaythrough", 2);
PlayerStats.SetIntValue("maxGodKingLevelDefeated", 15);
PlayerStats.SetIntValue("fightFinishCount", 100);
PlayerStats.SetIntValue("totalGoldAcquired", 10002030);
PlayerStats.SetIntValue("totalGoldBoughtMicro", 20000);
PlayerStats.SetIntValue("totalDodges", 513);
PlayerStats.SetIntValue("totalBlocks", 290);
PlayerStats.SetIntValue("totalHits", 1459);
PlayerStats.SetIntValue("totalCombos", 672);
PlayerStats.SetIntValue("totalParries", 101);
PlayerStats.SetIntValue("totalSuperMoves", 23);
PlayerStats.SetIntValue("totalMagicCasts", 48);
// encode it to a string
JsonString = class'JsonObject'.static.EncodeJson(PlayerStats);
`log("Json = " $ JsonString);
// // upload fake stats
Facebook.WebRequest("https://ibstats.cloudapp.net/Upload/", JsonString);
Facebook.WebRequest("http://www.google.com", "get", "", 1, false, false);//true);
Facebook.WebRequest("https://www.google.com/logos/classicplus.png", "get", "", 2, true, false);
*/
`log("Facebook friends:");
// print out friends
for (i = 0; i < Facebook.FriendsList.length; i++)
{
`log(Facebook.FriendsList[i].Name @ Facebook.FriendsList[i].Id);
}
// post to wall
Params.AddItem("message"); Params.AddItem("Shouldn't see this");
Params.AddItem("link"); Params.AddItem("www.google.com");
Params.AddItem("picture"); Params.AddItem("http://yourkidsartsucks.com/wp-content/uploads/2011/10/Funny_Art_223.jpg");
Params.AddItem("name"); Params.AddItem("Yes, hotness");
Params.AddItem("caption"); Params.AddItem("This is an post");
Params.AddItem("description"); Params.AddItem("I'm playing with posting to wall from UE3. Enjoy this mightily.");
Facebook.FacebookDialog("feed", Params);
}
function OnProductQueryComplete(const out PlatformInterfaceDelegateResult Result)
{
`if( `notdefined(FINAL_RELEASE) )
local int i;
local PurchaseInfo Info;
for (i = 0; i < MicroTrans.AvailableProducts.length; i++)
{
Info = MicroTrans.AvailableProducts[i];
`log("Purchase " $ i $ ":");
`log(" " $ Info.Identifier $ " - " $ Info.DisplayName $ " / " $ Info.DisplayPrice $ " - " $ Info.DisplayDescription);
}
`endif
}
function OnProductPurchaseComplete(const out PlatformInterfaceDelegateResult Result)
{
`log("Purchase complete:");
`log(" Product = " $ Result.Data.StringValue);
`log(" bSuccess = " $ Result.bSuccessful);
`log(" Result = " $ Result.Data.IntValue);
if (Result.Data.IntValue == MTR_Failed)
{
`log(" Error: " $ MicroTrans.LastError);
`log(" Solution: " $ MicroTrans.LastErrorSolution);
}
}
exec function MicroQueryProducts()
{
MicroTrans.QueryForAvailablePurchases();
}
exec function CloudGameBuyConsumable()
{
// MicroTrans.BeginPurchase(1);
MPI.OpenMenuScene(class'CloudMenuMicroTrans');
}
exec function CloudGameTwitter()
{
`log("Twitter can show tweet ui? " $ Twitter.CanShowTweetUI());
if (Twitter.CanShowTweetUI())
{
Twitter.ShowTweetUI("Default tweet!", "http://www.epicgames.com", "Icon");
}
}
function OnTweetComplete(const out PlatformInterfaceDelegateResult Result)
{
`log("Tweet completed: " $ Result.bSuccessful);
}
function OnTwitterRequestComplete(const out PlatformInterfaceDelegateResult Result)
{
`log("Tweet request compelted: " $ Result.bSuccessful @ Result.Data.StringValue);
}
function OnTwitterAuthorizeComplete(const out PlatformInterfaceDelegateResult Result)
{
local array<string> KeyValues;
local int i;
`log("Authorization complete, num accounts: " $ Twitter.GetNumAccounts());
if (Twitter.GetNumAccounts() > 0)
{
for (i=0; i<Twitter.GetNumAccounts(); i++)
{
`log(Twitter.GetAccountName(i));
}
KeyValues.AddItem("status");
KeyValues.AddItem("UE3 auto tweet. Ignore me.");
Twitter.TwitterRequest("http://api.twitter.com/1/statuses/update.json", KeyValues, TRM_POST, 0);
}
}
defaultproperties
{
InputClass=class'GameFramework.MobilePlayerInput'
AutoRotationAccelRate=10000.0
AutoRotationBrakeDecelRate=10000.0
MaxAutoRotationVelocity=300000
BreathAutoRotationAccelRate=250.0
BreathAutoRotationBrakeDecelRate=1.0
MaxBreathAutoRotationVelocity=75
TimeBetweenCameraBreathChanges = 2.0
RangeBasedYawAccelStrength=8.0
RangeBasedAccelMaxDistance=512.0
}

View File

@ -0,0 +1,9 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class CloudSaveData extends object;
/** Dummy save data */
var int Exp;
var int Gold;

View File

@ -0,0 +1,52 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileGameCrowdAgent extends GameCrowdAgentSkeletal
ShowCategories(Collision);
/** Stop agent moving and pay death anim */
function PlayDeath(vector KillMomentum)
{
Super.PlayDeath(KillMomentum);
if ( WorldInfo.TimeSeconds - LastRenderTime > 1 )
{
LifeSpan = 0.01;
}
else
{
LifeSpan = DeadBodyDuration;
}
}
/** Called by the Kismet "SetMaterial" node */
function OnSetMaterial(SeqAct_SetMaterial Action)
{
if( SkeletalMeshComponent != None )
{
SkeletalMeshComponent.SetMaterial( Action.MaterialIndex, Action.NewMaterial );
}
}
defaultproperties
{
Health=20
bProjTarget=true
// Create a cylinder component to serve as the collision bounds for crowd actors
Begin Object Class=CylinderComponent Name=CollisionCylinder
CollisionRadius=+0034.000000
CollisionHeight=+0078.000000
BlockNonZeroExtent=true
BlockZeroExtent=true
BlockActors=true
CollideActors=true
End Object
CollisionComponent=CollisionCylinder
Components.Add(CollisionCylinder)
RotateToTargetSpeed=60000.0
MaxWalkingSpeed=200.0
}

View File

@ -0,0 +1,381 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileHUDExt extends MobileHUD native;
/** Texture to use for 'tap-to-move' screen space effect */
var Texture2D TapToMoveTexture;
/** Last time that we were asked to draw the tap to move effect */
var float LastTapToMoveEffectTime;
var Vector2D TapToMoveEffectPos;
var bool bFlashJoysticks;
var float FlashTime;
/** The font to use for displaying benchmark results */
var font BenchmarkFont;
/** Background texture for displaying the benchmark results */
var Texture2D BenchmarkBackground;
var TextureUVs BenchmarkBackgroundUVs;
var float BenchmarkResolutionScale;
var int BenchmarkFeatureLevel;
native function UpdateBenchmarkInformation();
/** Starts drawing a transparent circle at the specified location for a brief moment (with animation) */
function StartTapToMoveEffect( float X, float Y )
{
// Store time that we were asked to draw the effect. This effectively "turns on" the effect.
LastTapToMoveEffectTime = WorldInfo.RealTimeSeconds;
TapToMoveEffectPos.X = X;
TapToMoveEffectPos.Y = Y;
}
/** Draws the tap to move effect if we need to */
function ConditionallyDrawTapToMoveEffect()
{
local float EffectDuration;
local float EffectSize;
local float EffectOpacity;
local float FadeInPercent;
local float FadeOutPercent;
local float EffectProgress;
local float AnimatedSize;
local float AnimatedOpacity;
// How long the effect should last
EffectDuration = 0.25;
FadeInPercent = 0.1;
FadeOutPercent = 0.6;
// How big the effect should be
EffectSize = 64.0;
// Maximum opacity of the effect
EffectOpacity = 0.3;
// Is it time to draw the effect?
if( WorldInfo.RealTimeSeconds - LastTapToMoveEffectTime < EffectDuration )
{
EffectProgress = FClamp( ( WorldInfo.RealTimeSeconds - LastTapToMoveEffectTime ) / EffectDuration, 0.0, 1.0 );
EffectProgress = FInterpEaseIn( 0.0, 1.0, EffectProgress, 1.5 );
AnimatedSize = EffectSize * 0.15 + EffectSize * EffectProgress * 0.85;
AnimatedOpacity = EffectOpacity;
// Fade in over the first bit of the effect
if( EffectProgress < FadeInPercent )
{
AnimatedOpacity *= ( EffectProgress / FadeInPercent );
}
// Fade out over the tail end of the effect
if( EffectProgress > ( 1.0 - FadeOutPercent ) )
{
AnimatedOpacity *= 1.0 - ( EffectProgress - ( 1.0 - FadeOutPercent ) ) / FadeOutPercent;
}
Canvas.SetPos( TapToMoveEffectPos.X - AnimatedSize * 0.5, TapToMoveEffectPos.Y - AnimatedSize * 0.5 );
Canvas.SetDrawColor( 255, 255, 255, AnimatedOpacity * 255.0 );
Canvas.DrawTile( TapToMoveTexture, AnimatedSize, AnimatedSize, 0.0, 0.0, TapToMoveTexture.GetSurfaceWidth(), TapToMoveTexture.GetSurfaceHeight() );
}
}
function bool ShowMobileHud()
{
// Show the mobile HUD if we are allowed to and if we don't have the HUD disabled via cinematic mode.
return bShowMobileHud && bShowHud;
}
function PostRender()
{
local CastlePC PC;
Instigator = PlayerOwner.Pawn;
super.PostRender();
PC = CastlePC(PlayerOwner);
if (PC.bIsInAttractMode)
{
PostRenderAttractMode();
}
// Display benchmark information
if (PC.bIsInBenchmarkMode)
{
// If the benchmark loop has completed, then display the results of the benchmark loop
if( PC.bBenchmarkLoopCompleted )
{
PostRenderBenchmarkModeCompleted();
}
else
{
PostRenderBenchmarkModeRunning();
}
}
if ( bShowHud && !PC.bIsInAttractMode)
return;
// Draw the tap to move HUD animation, if we need to
ConditionallyDrawTapToMoveEffect();
}
function PostRenderAttractMode()
{
local float Scale,w,h;
Scale = Canvas.ClipX / 960;
w = 124 * Scale;
h = w * 1.193548387096774;
Canvas.SetPos(Canvas.ClipX - 192*Scale, Canvas.ClipY - 171*Scale);
Canvas.DrawColor = WhiteColor;
Canvas.DrawTile(Texture2D'CastleUI.menus.T_CastleMenu2',w,h,0,1518,248,296);
}
function PostRenderBenchmarkModeCompleted()
{
local CastlePC PC;
local int fps, ScreenCenterX, BGTop, BGWidth, BGHeight, ScaledWindowWidth, ScaledWindowHeight;
local float StringWidth, StringHeight, TextScale;
local string PerformanceString;
UpdateBenchmarkInformation();
Canvas.Font = BenchmarkFont;
PC = CastlePC(PlayerOwner);
TextScale = 1.5f;
ScreenCenterX = PC.ViewportSize.X / 2;
BGTop = PC.ViewportSize.Y * 0.28;
BGWidth = PC.ViewportSize.Y * 1.0;
BGHeight = PC.ViewportSize.Y * 0.55;
// Draw background
Canvas.SetPos(ScreenCenterX - BGWidth/2, BGTop);
Canvas.DrawTile(BenchmarkBackground, BGWidth, BGHeight, BenchmarkBackgroundUVs.U, BenchmarkBackgroundUVs.V, BenchmarkBackgroundUVs.UL, BenchmarkBackgroundUVs.VL);
// Draw benchmark results header
Canvas.DrawColor = WhiteColor;
Canvas.StrLen( "Benchmark Results", StringWidth, StringHeight );
Canvas.SetPos( ScreenCenterX - StringWidth/2 * TextScale, BGTop + BGHeight * 0.1 );
Canvas.DrawText( "Benchmark Results", true, TextScale, TextScale );
// Draw result fields here
fps = 10 * PC.BenchmarkNumFrames / PC.BenchmarkElapsedTime;
Canvas.StrLen( "Average FPS: " $ (fps/10) $ "." $ (fps%10), StringWidth, StringHeight );
Canvas.SetPos( ScreenCenterX - StringWidth/2 * TextScale, BGTop + (BGHeight * 0.25) );
Canvas.DrawText( "Average FPS: " $ (fps/10) $ "." $ (fps%10), false, TextScale, TextScale );
// Draw benchmark information
ScaledWindowWidth = SizeX * BenchmarkResolutionScale;
ScaledWindowHeight = SizeY * BenchmarkResolutionScale;
Canvas.StrLen( "Resolution: " $ ScaledWindowWidth $ "x" $ ScaledWindowHeight, StringWidth, StringHeight );
Canvas.SetPos( ScreenCenterX - StringWidth/2 * TextScale, BGTop + (BGHeight * 0.4) );
Canvas.DrawText( "Resolution: " $ ScaledWindowWidth $ "x" $ ScaledWindowHeight, false, TextScale, TextScale );
Canvas.StrLen( "Performance Level: ", StringWidth, StringHeight );
Canvas.SetPos( ScreenCenterX - StringWidth/2 * TextScale, BGTop + (BGHeight * 0.55) );
Canvas.DrawText( "Performance Level: ", false, TextScale, TextScale );
switch (BenchmarkFeatureLevel)
{
case 1:
PerformanceString = "High Quality";
break;
case 0:
default:
PerformanceString = "High Performance";
break;
}
Canvas.StrLen( PerformanceString, StringWidth, StringHeight );
Canvas.SetPos( ScreenCenterX - StringWidth/2 * TextScale, BGTop + (BGHeight * 0.7) );
Canvas.DrawText( PerformanceString, false, TextScale, TextScale );
}
function PostRenderBenchmarkModeRunning()
{
local CastlePC PC;
local float Scale;
local int fps, ScreenCenterX;
local float StringWidth, StringHeight, MaxFPSWidth, FpsY;
Canvas.Font = BenchmarkFont;
PC = CastlePC(PlayerOwner);
Scale = PC.PauseMenu.Scale;
ScreenCenterX = PC.ViewportSize.X / 2;
// Draw the frame rate of the current frame
fps = 1 / WorldInfo.DeltaSeconds;
Canvas.StrLen( "Benchmarking...", StringWidth, StringHeight );
Canvas.SetPos( ScreenCenterX - (StringWidth / 2), PC.PauseMenu.Height );
Canvas.DrawColor = WhiteColor;
Canvas.DrawText( "Benchmarking...", false );
// Draw fps information
Canvas.StrLen( "100", MaxFPSWidth, StringHeight );
Canvas.StrLen( fps, StringWidth, StringHeight );
FpsY = PC.ViewportSize.Y - StringHeight * Scale - 20 * Scale;
Canvas.SetPos( 30 * Scale - StringWidth + MaxFPSWidth, FpsY );
Canvas.DrawText( fps, false );
Canvas.SetPos( 45 * Scale + MaxFPSWidth, FpsY );
Canvas.DrawText( "FPS", false );
}
function DrawMobileZone_Slider(MobileInputZone Zone)
{
local TextureUVs UVs;
local Texture2D Tex;
local float Ofs,Scale;
// First, look up the Texture
Tex = SliderImages[int(Zone.SlideType)];
UVs = SliderUVs[int(Zone.SlideType)];
// Now, figure out where we have to draw.
Scale = CastlePC(PlayerOwner).PauseMenu.Scale;
Ofs = 16 *Scale;
Canvas.SetPos(Zone.CurrentLocation.X, Zone.CurrentLocation.Y-Ofs);
Canvas.DrawTile(Tex,Zone.ActiveSizeX, Zone.ActiveSizeY, UVs.U, UVs.V, UVs.UL, UVs.VL);
}
function DrawMobileZone_Joystick(MobileInputZone Zone)
{
local int X, Y, Width, Height;
local Color LineColor;
local float ClampedX, ClampedY, Scale;
local Color TempColor;
local float FlashScale;
if (bFlashJoysticks)
{
FlashScale = FInterpEaseOut(3.0,1.0,FlashTime/0.75,2);
FlashTime += RenderDelta;
if (FlashTime > 0.75)
{
bFlashJoysticks = false;
}
}
else
{
FlashScale = 1.0;
}
if (JoystickBackground != none)
{
Width = Zone.ActiveSizeX * FlashScale;
Height = Zone.ActiveSizeY * FlashScale;
X = Zone.CurrentCenter.X - (Width /2);
Y = Zone.CurrentCenter.Y - (Height /2);
Canvas.SetPos(X,Y);
Canvas.DrawTile(JoystickBackground, Width, Height, JoystickBackgroundUVs.U, JoystickBackgroundUVs.V, JoystickBackgroundUVs.UL, JoystickBackgroundUVs.VL);
}
// Draw the Hat
if (JoystickHat != none)
{
// Compute X and Y clamped to the size of the zone for the joystick
ClampedX = Zone.CurrentLocation.X - Zone.CurrentCenter.X;
ClampedY = Zone.CurrentLocation.Y - Zone.CurrentCenter.Y;
Scale = 1.0f;
if ( ClampedX != 0 || ClampedY != 0 )
{
Scale = Min( Zone.ActiveSizeX, Zone.ActiveSizeY ) / ( 2.0 * Sqrt(ClampedX * ClampedX + ClampedY * ClampedY) );
Scale = FMin( 1.0, Scale );
}
ClampedX = ClampedX * Scale + Zone.CurrentCenter.X;
ClampedY = ClampedY * Scale + Zone.CurrentCenter.Y;
if (Zone.bRenderGuides)
{
TempColor = Canvas.DrawColor;
LineColor.R = 128;
LineColor.G = 128;
LineColor.B = 128;
LineColor.A = 255;
Canvas.Draw2DLine(Zone.CurrentCenter.X, Zone.CurrentCenter.Y, ClampedX, ClampedY, LineColor);
Canvas.DrawColor = TempColor;
}
// The size of the indicator will be a fraction of the background's total size
Width = Zone.ActiveSizeX * 0.65 * FlashScale;
Height = Zone.ActiveSizeY * 0.65 * FlashScale;
Canvas.SetPos( ClampedX - Width / 2, ClampedY - Height / 2);
Canvas.DrawTile(JoystickHat, Width, Height, JoystickHatUVs.U, JoystickHatUVs.V, JoystickHatUVs.UL, JoystickHatUVs.VL);
}
}
function FlashSticks()
{
bFlashJoysticks = true;
FlashTime = 0;
}
defaultproperties
{
JoystickBackground=Texture2D'MobileResources.T_MobileControls_texture'
JoystickBackgroundUVs=(U=0,V=0,UL=126,VL=126)
JoystickHat=Texture2D'MobileResources.T_MobileControls_texture'
JoystickHatUVs=(U=128,V=0,UL=78,VL=78)
ButtonImages(0)=Texture2D'MobileResources.HUD.MobileHUDButton3'
ButtonImages(1)=Texture2D'MobileResources.HUD.MobileHUDButton3'
ButtonUVs(0)=(U=0,V=0,UL=32,VL=32)
ButtonUVs(1)=(U=0,V=0,UL=32,VL=32)
TrackballBackground=none
TrackballTouchIndicator=Texture2D'MobileResources.T_MobileControls_texture'
TrackballTouchIndicatorUVs=(U=160,V=0,UL=92,VL=92)
ButtonFont = Font'EngineFonts.SmallFont'
ButtonCaptionColor=(R=0,G=0,B=0,A=255);
SliderImages(0)=Texture2D'CastleUI.menus.T_CastleMenu2'
SliderImages(1)=Texture2D'CastleUI.menus.T_CastleMenu2'
SliderImages(2)=Texture2D'CastleUI.menus.T_CastleMenu2'
SliderImages(3)=Texture2D'CastleUI.menus.T_CastleMenu2'
SliderUVs(0)=(U=1282,V=440,UL=322,VL=150)
SliderUVs(1)=(U=1282,V=440,UL=322,VL=150)
SliderUVs(2)=(U=1282,V=440,UL=322,VL=150)
SliderUVs(3)=(U=1282,V=440,UL=322,VL=150)
LastTapToMoveEffectTime=-99999.0
TapToMoveTexture=Texture2D'CastleHUD.HUD_TouchToMove'
BenchmarkFont=Font'UI_Fonts.MultiFonts.MF_LargeFont'
BenchmarkBackground=Texture2D'CastleUIExt.T_CastleMenu2Ext'
BenchmarkBackgroundUVs=(U=19,V=335,UL=996,VL=322)
}

View File

@ -0,0 +1,62 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileMenuBase extends MobileMenuScene;
var Texture2D iPadBackgroundTexture;
var MobileMenuObject.UVCoords iPadBackgroundCoords;
/** Controls the scene fade */
var float FadeTime, FadeDuration;
var bool bFadeOut;
var bool bCloseOnFadeOut;
function Fade(bool bIsFadeOut, float FadeDur)
{
local int i;
FadeTime = 0;
FadeDuration = FadeDur;
bFadeOut = bIsFadeOut;
if (bIsFadeOut)
{
for (i=0;i<MenuObjects.Length;i++)
{
MenuObjects[i].bIsActive = false;
}
}
}
function RenderScene(Canvas Canvas,float RenderDelta)
{
if (FadeDuration > 0)
{
Opacity = bFadeOut ? FInterpEaseOut(1,0,FadeTime/FadeDuration,2.0) : FInterpEaseOut(0,1,FadeTime/FadeDuration,2.0);
FadeTime += RenderDelta;
if (FadeTime > FadeDuration)
{
FadeDuration = 0;
if (bFadeOut && bCloseOnFadeOut)
{
InputOwner.CloseMenuScene(self);
}
}
}
Super.RenderScene(Canvas,RenderDelta);
}
defaultproperties
{
Left=0
Top=0
Width=1.0
Height=1.0
bRelativeWidth=true
bRelativeHeight=true
UITouchSound=SoundCue'CastleAudio.UI.UI_OK_Cue'
UIUnTouchSound=SoundCue'CastleAudio.UI.UI_OK_Cue'
}

View File

@ -0,0 +1,158 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileMenuControls extends MobileMenuScene;
var float FadeTime, FadeDuration;
var float AnimTime;
var bool bFadeOut;
var bool bAnimate;
var MobileMenuImage Icon;
var MobileMenuImage Msg;
var float Scale;
function FadeOut()
{
FadeTime = 0;
FadeDuration = 0.5;
bFadeOut = true;
}
function Setup(bool bTap)
{
Icon = MobileMenuImage(MenuObjects[0]);
Msg = MobileMenuImage(MenuObjects[1]);
Scale = Width / 960;
FadeTime = 0;
FadeDuration = 0.5;
bFadeOut = false;
if (bTap)
{
bAnimate = true;
Icon.Width = 84 * Scale;
Icon.Height = 84 * Scale;
Icon.Left = (Width * 0.5) - (Icon.Width * 0.5);
Icon.Top = Height * 0.50;
Icon.ImageUVs.U = 1306;
Icon.ImageUVs.V = 634;
Icon.ImageUVs.UL = 168;
Icon.ImageUVs.VL = 168;
Msg.Width = 373 * Scale;
Msg.Height = 59 * Scale;
Msg.Left = Width * 0.5 - Msg.Width * 0.5;
Msg.Top = Height - Msg.Height * 2;
Msg.ImageUVs.U = 1076;
Msg.ImageUVs.V = 1836;
Msg.ImageUVs.UL = 746;
Msg.ImageUVs.VL = 118;
}
else
{
bAnimate = false;
Icon.Width = 586 * Scale;
Icon.Height = 133 * Scale;
Icon.Left = (Width * 0.5) - (Icon.Width * 0.5);
Icon.Top = Height * 0.25;
Icon.ImageUVs.U = 492;
Icon.ImageUVs.V = 856;
Icon.ImageUVs.UL = 1172;
Icon.ImageUVs.VL = 266;
Msg.Width = 373 * Scale;
Msg.Height = 59 * Scale;
Msg.Left = (Width * 0.5) - (Msg.Width * 0.5);
Msg.Top = Height - (Msg.Height * 2);
Msg.ImageUVs.U = 256;
Msg.ImageUVs.V = 1836;
Msg.ImageUVs.UL = 746;
Msg.ImageUVs.VL = 118;
}
}
function RenderScene(Canvas Canvas,float RenderDelta)
{
local float alpha;
if (bAnimate)
{
Alpha = 1 - AnimTime/0.75;
AnimTime += RenderDelta;
if (AnimTime > 0.75)
{
AnimTime = 0;
}
Icon.Width = 84 * Scale * (1 + 1-Alpha);
Icon.Height = 84 * Scale * (1 + 1-Alpha);
Icon.Left = (Width * 0.5) - (Icon.Width * 0.5);
Icon.Top = Height * 0.50 - (Icon.Height * 0.5);
Icon.Opacity = Alpha;
}
if (FadeDuration > 0)
{
Opacity = bFadeOut ? FInterpEaseIn(1,0,FadeTime/FadeDuration,2.0) : FInterpEaseOut(0,1,FadeTime/FadeDuration,2.0);
FadeTime += RenderDelta;
if (FadeTime > FadeDuration)
{
FadeDuration = 0;
if (bFadeOut)
{
InputOwner.CloseMenuScene(self);
}
}
}
Super.RenderScene(Canvas,RenderDelta);
}
defaultproperties
{
Left=0
Top=0
Width=1.0
Height=1.0
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
Begin Object Class=MobileMenuImage Name=Icon
Tag="Background"
Left=0
Top=0
Width=1
Height=1
bRelativeWidth=true
bRelativeHeight=true
Image=Texture2D'CastleUI.menus.T_CastleMenu2'
ImageDrawStyle=IDS_Stretched
ImageUVs=(bCustomCoords=true,U=0,V=0,UL=1920,VL=1280)
bIsActive=false
End Object
MenuObjects(0)=Icon
Begin Object Class=MobileMenuImage Name=Msg
Tag="Background"
Left=0
Top=0
Width=1
Height=1
bRelativeWidth=true
bRelativeHeight=true
Image=Texture2D'CastleUI.menus.T_CastleMenu2'
ImageDrawStyle=IDS_Stretched
ImageUVs=(bCustomCoords=true,U=0,V=0,UL=1920,VL=1280)
bIsActive=false
End Object
MenuObjects(1)=Msg
bSceneDoesNotRequireInput=true
Opacity=0
}

View File

@ -0,0 +1,92 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileMenuDebug extends MobileMenuBase;
/**
* Handle menu input
*
* @param Sender The object clicked on
* @param TouchX X location in screen space
* @param TouchY Y location in screen space
*/
event OnTouch(MobileMenuObject Sender, ETouchType EventType, float TouchX, float TouchY)
{
if (Sender == none)
{
return;
}
if (EventType == Touch_Cancelled)
{
return;
}
if (Sender.Tag ~= "FPS")
{
InputOwner.Outer.ConsoleCommand("stat fps");
}
else if (Sender.Tag ~= "MSAA")
{
InputOwner.Outer.ConsoleCommand("es2 msaa");
}
else if (Sender.Tag ~= "UNIT")
{
InputOwner.Outer.ConsoleCOmmand("stat unit");
}
else if (Sender.Tag ~= "Close")
{
InputOwner.CloseMenuScene(self);
}
}
defaultproperties
{
Begin Object Class=MobileMenuButton Name=CloseButton
Tag="Close"
bRelativeLeft=true
Left=0.1
Top=20
Width=100
Height=100
Caption="Close"
CaptionColor=(R=0.0,G=0.5,B=1.0,A=1.0)
End Object
MenuObjects.Add(CloseButton)
Begin Object Class=MobileMenuButton Name=ShowFPSButton
Tag="FPS"
bRelativeLeft=true
Left=0.1
Top=120
Width=100
Height=100
Caption="Toggle FPS"
CaptionColor=(R=0.0,G=0.5,B=1.0,A=1.0)
End Object
MenuObjects.Add(ShowFPSButton)
Begin Object Class=MobileMenuButton Name=StatUnitButton
Tag="UNIT"
bRelativeLeft=true
Left=0.6
Top=120
Width=100
Height=100
Caption="Toggle StatUnit"
CaptionColor=(R=0.0,G=0.5,B=1.0,A=1.0)
End Object
MenuObjects.Add(StatUnitButton)
Begin Object Class=MobileMenuButton Name=ShowMSAAButton
Tag="MSAA"
bRelativeLeft=true
Left=0.1
Top=220
Width=100
Height=100
Caption="Toggle MSAA"
CaptionColor=(R=0.0,G=0.5,B=1.0,A=1.0)
End Object
MenuObjects.Add(ShowMSAAButton)
}

View File

@ -0,0 +1,335 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileMenuPause extends MobileMenuScene
dependson(SimpleGame);
// A reference to the help screen that we will fade out as the player enters the game
var MobileMenuControls FadingControlsMenu;
var bool bHelpFadingOut;
var float HelpFadeTime;
var float HelpFadeDuration;
/** Holds how much of the menu is shown. */
var float ShownSize;
var float Scale;
var bool bFlashHelp;
var float FlashDuration;
var float FlashTime;
event InitMenuScene(MobilePlayerInput PlayerInput, int ScreenWidth, int ScreenHeight, bool bIsFirstInitialization)
{
local int i;
Super.InitMenuScene(PlayerInput, 960, 640, bIsFirstInitialization);
Scale = /*(ScreenWidth >= 960) ? 1.0 : */Float(ScreenWidth) / 960.0;
for(i=1;i<MenuObjects.Length;i++)
{
MenuObjects[i].Left *= Scale;
MenuObjects[i].Top *= Scale;
MenuObjects[i].Width *= Scale;
MenuObjects[i].Height *= Scale;
}
MenuObjects[0].Height *= Scale;
MenuObjects[0].Width *= Float(ScreenWidth) / 960.0;
if (ScreenWidth == 1024)
{
MenuObjects[0].Width = 2048;
}
else if (ScreenWidth < 960)
{
MobileMenuImage(MenuObjects[0]).ImageDrawStyle=IDS_Stretched;
}
// Handle the main window
Width = ScreenWidth;
Height *= Scale;
// Position the buttons..
if (class'WorldInfo'.static.IsConsoleBuild(CONSOLE_IPhone))
{
MenuObjects[1].Left = (ScreenWidth / 4) - (MenuObjects[2].Width/2);
MenuObjects[2].Left = ScreenWidth - (ScreenWidth / 4) - (MenuObjects[2].Width/2);
MenuObjects.length = 3;
}
else
{
MenuObjects[3].Left = (ScreenWidth / 2) - (MenuObjects[3].Width/2); // Put the benchmark button in the middle... note there isn't quite room for it here, will have to get an artist to help clean this up...
MenuObjects[1].Left = (MenuObjects[3].Left/2) - (MenuObjects[1].Width/2);
MenuObjects[2].Left = (MenuObjects[3].Left/2) + MenuObjects[3].Left + MenuObjects[3].Width - (MenuObjects[2].Width/2);
MenuObjects[4].Left = Width;
}
Top = -Height;
ShownSize = Height - MenuObjects[1].Top + (8 * Scale); // @ToDo Make the top border size config.
}
event OnTouch(MobileMenuObject Sender, ETouchType EventType, float TouchX, float TouchY)
{
local CastlePC PC;
if (Sender == none)
{
return;
}
if (EventType != Touch_Began)
{
return;
}
PC = CastlePC(InputOwner.Outer);
if (Sender.Tag == "BIRDSEYE")
{
// start or stop the matinee
if (PC.bIsInAttractMode)
{
PC.ExitAttractMode();
}
else
{
PC.EnterAttractMode();
}
}
else if (Sender.Tag == "ABOUT")
{
if (PC.bIsInBenchmarkMode)
{
PC.ExitAttractMode();
}
InputOwner.Outer.ConsoleCommand("mobile about technology/epic-citadel");
}
else if (Sender.Tag == "BENCHMARK")
{
// Enter benchmark mode if we're not already in it
if (!PC.bIsInBenchmarkMode)
{
InputOwner.Outer.ConsoleCommand("mobile benchmark begin");
PC.EnterAttractMode( true );
}
}
else if (Sender.Tag == "SETTINGS")
{
// Open up the settings menu
InputOwner.Outer.ConsoleCommand("mobile SettingsMenu");
}
}
function OnResetMenu()
{
}
/**
* When the submenu is open, force the freelook zone to have a full opaque inactive color so we
* can see it in the input samples.
*/
function HackInactiveAlpha(float NewValue)
{
local MobileInputZone Zone;
Zone = MobilePlayerInput(CastlePC(InputOwner.Outer).PlayerInput).FindZone("FreeMoveZone");
Zone.InactiveAlpha=NewValue;
}
function RenderScene(Canvas Canvas,float RenderDelta)
{
if (InputOwner == none)
{
return;
}
// Set the right UVs
if (CastlePC(InputOwner.Outer).bIsInAttractMode)
{
MobileMenuButton(MenuObjects[2]).ImagesUVs[0].U = 610;
MobileMenuButton(MenuObjects[2]).ImagesUVs[0].V = 440;
MobileMenuButton(MenuObjects[2]).ImagesUVs[1].U = 610;
MobileMenuButton(MenuObjects[2]).ImagesUVs[1].V = 542;
}
else
{
MobileMenuButton(MenuObjects[2]).ImagesUVs[0].U = 256;
MobileMenuButton(MenuObjects[2]).ImagesUVs[0].V = 1230;
MobileMenuButton(MenuObjects[2]).ImagesUVs[1].U = 256;
MobileMenuButton(MenuObjects[2]).ImagesUVs[1].V = 1344;
}
Super.RenderScene(Canvas, RenderDelta);
}
function bool OnSceneTouch(ETouchType EventType, float X, float Y, bool bInside)
{
local CastlePC PC;
PC = CastlePC(InputOwner.Outer);
if (PC.bPauseMenuOpen)
{
if (EventType == Touch_Began)
{
if( PC.SliderZone != none &&
( X >= PC.SliderZone.CurrentLocation.X && X < PC.SliderZone.CurrentLocation.X + PC.SliderZone.ActiveSizeX &&
Y >= PC.SliderZone.CurrentLocation.Y && Y < PC.SliderZone.CurrentLocation.Y + PC.SliderZone.ActiveSizeY ) )
{
PC.ResetMenu();
return true;
}
}
}
return bInside;
}
function FlashHelp(float Duration)
{
bFlashHelp = true;
FlashDuration = Duration;
FlashTime = 0;
bHelpFadingOut = false;
HelpFadeTime = 0;
}
function ReleaseHelp()
{
if (bFlashHelp)
{
bFlashHelp = false;
bHelpFadingOut = true;
HelpFadeTime = HelpFadeDuration;
HelpFadeTime = HelpFadeDuration - HelpFadeTime;
}
}
function SetAttractModeUI( bool bIsInBenchmarkMode )
{
// nothing to do if we don't have these extra controls
if (MenuObjects.length < 5)
{
return;
}
MenuObjects[3].bIsHidden = true;
MenuObjects[3].bIsActive = false;
if (bIsInBenchmarkMode)
{
// Hide settings button if in benchmark mode only
MenuObjects[4].bIsHidden = true;
MenuObjects[4].bIsActive = false;
}
// Position the buttons
MenuObjects[1].Left = (Width/4) - (MenuObjects[2].Width/2);
MenuObjects[2].Left = Width - (Width/4) - (MenuObjects[2].Width/2);
}
function SetDefaultUI()
{
// nothing to do if we don't have these extra controls
if (MenuObjects.length < 5)
{
return;
}
MenuObjects[3].bIsHidden = false;
MenuObjects[3].bIsActive = true;
MenuObjects[4].bIsHidden = false;
MenuObjects[4].bIsActive = true;
// Position the buttons
MenuObjects[3].Left = (Width / 2) - (MenuObjects[3].Width/2);
MenuObjects[1].Left = (MenuObjects[3].Left/2) - (MenuObjects[1].Width/2);
MenuObjects[2].Left = (MenuObjects[3].Left/2) + MenuObjects[3].Left + MenuObjects[3].Width - (MenuObjects[2].Width/2);
}
defaultproperties
{
SceneCaptionFont=MultiFont'CastleFonts.Positec'
Left=0
Top=0
Width=1.0
bRelativeLeft=true
bRelativeWidth=true
Height=180;
Begin Object Class=MobileMenuImage Name=Background
Tag="Background"
Left=0
Top=0
Width=1.5
Height=1.0
bRelativeWidth=true
bRelativeHeight=true
Image=Texture2D'CastleUI.menus.T_CastleMenu2'
ImageDrawStyle=IDS_Stretched
ImageUVs=(bCustomCoords=true,U=0,V=60,UL=2048,VL=360)
End Object
MenuObjects(0)=Background
Begin Object Class=MobileMenuButton Name=AboutButton
Tag="ABOUT"
Left=0
Top=-85
Width=281
Height=48
TopLeeway=20
Images(0)=Texture2D'CastleUI.menus.T_CastleMenu2'
Images(1)=Texture2D'CastleUI.menus.T_CastleMenu2'
ImagesUVs(0)=(bCustomCoords=true,U=708,V=1124,UL=620,VL=96)
ImagesUVs(1)=(bCustomCoords=true,U=1352,V=1124,UL=620,VL=96)
End Object
MenuObjects(1)=AboutButton
Begin Object Class=MobileMenuButton Name=AttractButton
Tag="BIRDSEYE"
Left=0
Top=-85
Width=310
Height=48
TopLeeway=20
Images(0)=Texture2D'CastleUI.menus.T_CastleMenu2'
Images(1)=Texture2D'CastleUI.menus.T_CastleMenu2'
ImagesUVs(0)=(bCustomCoords=true,U=256,V=1230,UL=620,VL=96)
ImagesUVs(1)=(bCustomCoords=true,U=256,V=1338,UL=620,VL=96)
End Object
MenuObjects(2)=AttractButton
Begin Object Class=MobileMenuButton Name=BenchmarkButton
Tag="BENCHMARK"
Left=0
Top=-85
Width=310
Height=48
TopLeeway=20
Images(0)=Texture2D'CastleUIExt.T_CastleMenu2Ext'
Images(1)=Texture2D'CastleUIExt.T_CastleMenu2Ext'
ImagesUVs(0)=(bCustomCoords=true,U=6,V=0,UL=620,VL=96)
ImagesUVs(1)=(bCustomCoords=true,U=6,V=118,UL=620,VL=96)
End Object
MenuObjects(3)=BenchmarkButton
Begin Object Class=MobileMenuButton Name=SettingsButton
Tag="SETTINGS"
Left=0
Top=-15
Width=138
Height=64
TopLeeway=20
Images(0)=Texture2D'CastleUIExt.T_CastleMenu2Ext'
Images(1)=Texture2D'CastleUIExt.T_CastleMenu2Ext'
ImagesUVs(0)=(bCustomCoords=true,U=740,V=3 ,UL=284,VL=134)
ImagesUVs(1)=(bCustomCoords=true,U=740,V=137,UL=284,VL=134)
End Object
MenuObjects(4)=SettingsButton
UITouchSound=SoundCue'CastleAudio.UI.UI_ChangeSelection_Cue'
UIUnTouchSound=SoundCue'CastleAudio.UI.UI_ChangeSelection_Cue'
HelpFadeDuration=0.3
}

View File

@ -0,0 +1,103 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileMenuSplash extends MobileMenuScene;
var float HelpFlashDuration;
event InitMenuScene(MobilePlayerInput PlayerInput, int ScreenWidth, int ScreenHeight, bool bIsFirstInitialization)
{
local float scale;
if (ScreenWidth < 960)
{
MenuObjects[0].Width = 0.95;
}
super.InitMenuScene(PlayerInput, ScreenWidth, ScreenHeight, bIsFirstInitialization);
Scale = /*(ScreenWidth >= 960) ? 1.0 : */Float(ScreenWidth) / 960;
MenuObjects[1].Width = 574 * Scale;
MenuObjects[1].Height = 574 * Scale * 0.1393728222996516;
MenuObjects[1].Left = (ScreenWidth/2) - 40*Scale;
}
event OnTouch(MobileMenuObject Sender, ETouchType EventType, float TouchX, float TouchY)
{
local CastlePC PC;
if (Sender.Tag == "CATCHALL")
{
if (EventType != Touch_Cancelled)
{
PC = CastlePC(InputOwner.Outer);
InputOwner.CloseMenuScene(self);
PC.FlashHelp(HelpFlashDuration);
}
}
}
function Closed()
{
CastlePC(InputOwner.Outer).StartTutorials();
Super.Closed();
}
defaultproperties
{
Top=0
Left=0
Width=1.0
Height=1.0
bRelativeWidth=true
bRelativeHeight=true
Begin Object Class=MobileMenuImage Name=INFO
Tag="INFO"
Left=0.5
Top=0.5
Width=0.6927083
Height=0.2601503759398496
bHeightRelativeToWidth=true
XOffset=0.5
YOffset=0.5
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
Image=Texture2D'CastleUI.menus.T_CastleMenu2'
ImageDrawStyle=IDS_Stretched
ImageUVs=(bCustomCoords=true,U=264,V=1464,UL=1330,VL=346)
End Object
MenuObjects(0)=INFO
Begin Object Class=MobileMenuImage Name=Highlight
Tag="HIGHLIGHT"
Left=0
Top=0
Width=587
Height=84
Image=Texture2D'CastleUI.menus.T_CastleMenu2'
ImageDrawStyle=IDS_Stretched
ImageUVs=(bCustomCoords=true,U=898,V=1224,UL=1148,VL=160)
End Object
MenuObjects(1)=Highlight
Begin Object Class=MobileMenuButton Name=CATCHALL
Tag="CATCHALL"
Left=0
Top=0
Width=1
Height=1
bRelativeLeft=true
bRelativeTop=true
bRelativeWidth=true
bRelativeHeight=true
bIsActive=true;
End Object
MenuObjects(2)=CATCHALL
HelpFlashDuration=2
}

View File

@ -0,0 +1,124 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobilePlaceablePawn extends GamePawn
placeable;
var bool bFixedView;
var vector FixedViewLoc;
var rotator FixedViewRot;
var() const editconst LightEnvironmentComponent LightEnvironment;
exec function FixedView()
{
if (!bFixedView)
{
FixedViewLoc = Location;
FixedViewRot = Controller.Rotation;
}
bFixedView = !bFixedView;
}
// overwrite this function to avoid animsets to be be overwritten by default
simulated event bool RestoreAnimSetsToDefault()
{
return FALSE;
}
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
// Override camera FOV for first person castle player
out_FOV = 65.0;
// Handle the fixed camera
if (bFixedView)
{
out_CamLoc = FixedViewLoc;
out_CamRot = FixedViewRot;
}
else
{
return Super.CalcCamera(fDeltaTime, out_CamLoc, out_CamRot, out_FOV);
}
return true;
}
/**
* GetPawnViewLocation()
*
* Called by PlayerController to determine camera position in first person view. Returns
* the location at which to place the camera
*/
simulated function Vector GetPawnViewLocation()
{
return Location + EyeHeight * vect(0,0,1);
}
defaultproperties
{
Begin Object Name=CollisionCylinder
CollisionRadius=+0021.000000
CollisionHeight=+0044.000000
End Object
CylinderComponent=CollisionCylinder
ViewPitchMin=-10000
ViewPitchMax=12000
// @todo: When touching to move while already moving, walking physics may be applied for a single frame.
// This means that if WalkingPct is not 1.0, brakes will be applied and movement will appear to stutter.
// Until we can figure out how to avoid the state transition glitch, we're forcing WalkingPct to 1.0
WalkingPct=+1.0
CrouchedPct=+0.4
BaseEyeHeight=60.0 // 38.0
EyeHeight=60.0 // 38.0
GroundSpeed=440.0
AirSpeed=440.0
WaterSpeed=220.0
AccelRate=2048.0
JumpZ=322.0
CrouchHeight=29.0
CrouchRadius=21.0
WalkableFloorZ=0.78
AlwaysRelevantDistanceSquared=+1960000.0
RotationRate=(Pitch=20000,Yaw=20000,Roll=20000)
AirControl=+0.35
bCanCrouch=true
bCanClimbLadders=True
bCanPickupInventory=True
SightRadius=+12000.0
MaxStepHeight=26.0
MaxJumpHeight=49.0
bScriptTickSpecial=true
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
bSynthesizeSHLight=TRUE
bUseBooleanEnvironmentShadowing=FALSE
ModShadowFadeoutTime=0.75f
bIsCharacterLightEnvironment=TRUE
bAllowDynamicShadowsOnTranslucency=TRUE
End Object
Components.Add(MyLightEnvironment)
LightEnvironment=MyLightEnvironment
Physics = PHYS_Falling
bDontPossess = TRUE
bRunPhysicsWithNoController = TRUE
Begin Object Class=SkeletalMeshComponent Name=PawnMesh
LightEnvironment=MyLightEnvironment
End Object
Mesh=PawnMesh
Components.Add(PawnMesh)
}

View File

@ -0,0 +1,310 @@
/**
* This is our base mobile projectile class.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class MobileProjectile extends Projectile;
/** Acceleration magnitude. By default, acceleration is in the same direction as velocity. */
var(Projectile) float AccelRate;
/** if true, the shutdown function has been called and 'new' effects shouldn't happen */
var bool bShuttingDown;
/**
* If TRUE, initializes the projectile immediately when spawned using it rotation.
* This is required if you use an Actor Factory in Kismet to spawn the projectile.
*/
var(Projectile) bool bInitOnSpawnWithRotation;
/** Effects */
/** This is the effect that is played while in flight */
var ParticleSystemComponent ProjEffects;
/** Effects Template */
/** Effect template for the projectile while it is in flight. */
var(Projectile) ParticleSystem ProjFlightTemplate;
/** Effect template when the projectile explodes. Projectile only explodes if Damage Radius is non-zero. */
var(Projectile) ParticleSystem ProjExplosionTemplate;
/** This value sets the cap how far away the explosion effect of this projectile can be seen */
var(Projectile) float MaxEffectDistance;
/** The sound that is played when it explodes. Projectile only explodes if Damage Radius is non-zero. */
var(Projectile) SoundCue ExplosionSound;
/** Actor types to ignore if the projectile hits them */
var(Projectile) array<class<Actor> > ActorsToIgnoreWhenHit;
/** used to prevent effects when projectiles are destroyed (see LimitationVolume) */
var bool bSuppressExplosionFX;
/**
* Explode when the projectile comes to rest on the floor. It's called from the native physics processing functions. By default,
* when we hit the floor, we just explode.
*/
simulated event Landed( vector HitNormal, actor FloorActor )
{
HitWall(HitNormal, FloorActor, None);
}
/**
* When this actor begins its life, play any ambient sounds attached to it
*/
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
if ( bDeleteMe || bShuttingDown)
return;
// Spawn any effects needed for flight
SpawnFlightEffects();
if (bInitOnSpawnWithRotation)
{
Init( vector(Rotation) );
}
}
simulated event SetInitialState()
{
bScriptInitialized = true;
if (Role < ROLE_Authority && AccelRate != 0.f)
{
GotoState('WaitingForVelocity');
}
else
{
GotoState((InitialState != 'None') ? InitialState : 'Auto');
}
}
/**
* Initialize the Projectile
*/
function Init(vector Direction)
{
SetRotation(rotator(Direction));
Velocity = Speed * Direction;
Acceleration = AccelRate * Normal(Velocity);
}
/**
*
*/
simulated function ProcessTouch(Actor Other, Vector HitLocation, Vector HitNormal)
{
if( ActorsToIgnoreWhenHit.Find(Other.Class) != INDEX_NONE )
{
// The hit actor is one that should be ignored
return;
}
if (DamageRadius > 0.0)
{
Explode(HitLocation, HitNormal);
}
else
{
PlaySound(ImpactSound);
Other.TakeDamage(Damage,InstigatorController,HitLocation,MomentumTransfer * Normal(Velocity), MyDamageType,, self);
Shutdown();
}
}
/**
* Explode this Projectile
*/
simulated function Explode(vector HitLocation, vector HitNormal)
{
if (Damage>0 && DamageRadius>0)
{
if ( Role == ROLE_Authority )
MakeNoise(1.0);
if ( !bShuttingDown )
{
ProjectileHurtRadius(HitLocation, HitNormal);
}
SpawnExplosionEffects(HitLocation, HitNormal);
}
else
{
PlaySound(ImpactSound);
}
ShutDown();
}
/**
* Spawns any effects needed for the flight of this projectile
*/
simulated function SpawnFlightEffects()
{
if (WorldInfo.NetMode != NM_DedicatedServer && ProjFlightTemplate != None)
{
ProjEffects = WorldInfo.MyEmitterPool.SpawnEmitterCustomLifetime(ProjFlightTemplate, true);
ProjEffects.SetAbsolute(false, false, false);
ProjEffects.SetLODLevel(WorldInfo.bDropDetail ? 1 : 0);
ProjEffects.OnSystemFinished = MyOnParticleSystemFinished;
ProjEffects.bUpdateComponentInTick = true;
ProjEffects.SetTickGroup(TG_EffectsUpdateWork);
AttachComponent(ProjEffects);
ProjEffects.ActivateSystem(true);
}
if (SpawnSound != None)
{
PlaySound(SpawnSound);
}
}
/** sets any additional particle parameters on the explosion effect required by subclasses */
simulated function SetExplosionEffectParameters(ParticleSystemComponent ProjExplosion);
/**
* Spawn Explosion Effects
*/
simulated function SpawnExplosionEffects(vector HitLocation, vector HitNormal)
{
local ParticleSystemComponent ProjExplosion;
local Actor EffectAttachActor;
if (WorldInfo.NetMode != NM_DedicatedServer)
{
if (EffectIsRelevant(Location, false, MaxEffectDistance))
{
if (ProjExplosionTemplate != None)
{
EffectAttachActor = ImpactedActor;
ProjExplosion = WorldInfo.MyEmitterPool.SpawnEmitter(ProjExplosionTemplate, HitLocation, rotator(HitNormal), EffectAttachActor);
SetExplosionEffectParameters(ProjExplosion);
}
if (ExplosionSound != None)
{
PlaySound(ExplosionSound, true);
}
}
bSuppressExplosionFX = true; // so we don't get called again
}
}
/**
* Clean up
*/
simulated function Shutdown()
{
local vector HitLocation, HitNormal;
bShuttingDown=true;
HitNormal = normal(Velocity * -1);
Trace(HitLocation,HitNormal,(Location + (HitNormal*-32)), Location + (HitNormal*32),true,vect(0,0,0));
SetPhysics(PHYS_None);
if (ProjEffects!=None)
{
ProjEffects.DeactivateSystem();
}
HideProjectile();
SetCollision(false,false);
Destroy();
}
// If this actor
event TornOff()
{
ShutDown();
Super.TornOff();
}
/**
* Hide any meshes/etc.
*/
simulated function HideProjectile()
{
local MeshComponent ComponentIt;
foreach ComponentList(class'MeshComponent',ComponentIt)
{
ComponentIt.SetHidden(true);
}
}
simulated function Destroyed()
{
if (ProjEffects != None)
{
DetachComponent(ProjEffects);
WorldInfo.MyEmitterPool.OnParticleSystemFinished(ProjEffects);
ProjEffects = None;
}
super.Destroyed();
}
simulated function MyOnParticleSystemFinished(ParticleSystemComponent PSC)
{
if (PSC == ProjEffects)
{
// clear component and return to pool
DetachComponent(ProjEffects);
WorldInfo.MyEmitterPool.OnParticleSystemFinished(ProjEffects);
ProjEffects = None;
}
}
/** state used only on the client for projectiles with AccelRate > 0 to wait for Velocity to be replicated so we can use it to set Acceleration
* the alternative would be to make Velocity repnotify in Actor.uc, but since many Actors (such as Pawns) change their
* velocity very frequently, that would have a greater performance hit
*/
state WaitingForVelocity
{
simulated function Tick(float DeltaTime)
{
if (!IsZero(Velocity))
{
Acceleration = AccelRate * Normal(Velocity);
GotoState((InitialState != 'None') ? InitialState : 'Auto');
}
}
}
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
out_CamLoc = Location + (CylinderComponent.CollisionHeight * Vect(0,0,1));
return true;
}
/** called when this Projectile is the ViewTarget of a local player
* @return the Pawn to use for rendering HUD displays
*/
simulated function Pawn GetPawnOwner();
defaultproperties
{
Speed=2000
MaxSpeed=5000
AccelRate=15000
Damage=10
DamageRadius=0
MomentumTransfer=500
LifeSpan=2.0
bCollideWorld=true
DrawScale=2.0
bInitOnSpawnWithRotation=true
bShuttingDown=false
}

View File

@ -0,0 +1,60 @@
/*=============================================================================
ParticleModuleTypeDataPhysX.uc: PhysX Emitter Source.
Copyright 2007-2008 AGEIA Technologies.
=============================================================================*/
class ParticleModuleTypeDataSnow extends ParticleModuleTypeDataBase
native
editinlinenew
collapsecategories
hidecategories(Object);
var(Spawn) rawdistributionvector StartSize;
var(Spawn) rawdistributionvector StartVelocity;
var(Spawn) rawdistributionvector StartLocation;
var(Lifetime) rawdistributionvector ColorOverLife;
var(Lifetime) rawdistributionfloat AlphaOverLife;
var(Lifetime) rawdistributionfloat Lifetime;
var(Lifetime) float KillHeight;
/** Distance from player to bounds at which the particles will start to fade out */
var(Rendering) float FadeStart;
/** Distance from player to bounds at which the particles will be totally faded out. SHOULD MATCH MAXDRAWDISTANCE OF THE EMITTER ACTOR! */
var(Rendering) float FadeStop;
cpptext
{
virtual FParticleEmitterInstance *CreateInstance(UParticleEmitter *InEmitterParent, UParticleSystemComponent *InComponent);
virtual void Spawn(FParticleEmitterInstance* Owner, INT Offset, FLOAT SpawnTime);
}
defaultproperties
{
Begin Object Class=DistributionVectorUniform Name=DistributionStartSize
Min=(X=1,Y=1,Z=1)
Max=(X=1,Y=1,Z=1)
End Object
StartSize=(Distribution=DistributionStartSize)
Begin Object Class=DistributionVectorUniform Name=DistributionStartLocation
End Object
StartLocation=(Distribution=DistributionStartLocation)
Begin Object Class=DistributionVectorUniform Name=DistributionStartVelocity
End Object
StartVelocity=(Distribution=DistributionStartVelocity)
Begin Object Class=DistributionVectorConstantCurve Name=DistributionColorOverLife
End Object
ColorOverLife=(Distribution=DistributionColorOverLife)
Begin Object Class=DistributionFloatConstant Name=DistributionAlphaOverLife
Constant=1.0f;
End Object
AlphaOverLife=(Distribution=DistributionAlphaOverLife)
Begin Object Class=DistributionFloatUniform Name=DistributionLifetime
End Object
Lifetime=(Distribution=DistributionLifetime)
}

View File

@ -0,0 +1,11 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class SeqAct_MobileCrowdSpawner extends SeqAct_GameCrowdSpawner;
defaultproperties
{
ObjName="Mobile Crowd Spawner"
ObjCategory="Crowd"
}

View File

@ -0,0 +1,96 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class SimpleGame extends FrameworkGame
native;
/**
* Strips the "play on X" prefixes added to autsaved maps.
*/
static function string StripPlayOnPrefix( String MapName )
{
if (Left(MapName, 6) ~= "UEDPIE")
{
return Right(MapName, Len(MapName) - 6);
}
else if ( Left(MapName, 5) ~= "UEDPC" )
{
return Right(MapName, Len(MapName) - 5);
}
else if (Left(MapName, 6) ~= "UEDPS3")
{
return Right(MapName, Len(MapName) - 6);
}
else if (Left(MapName, 6) ~= "UED360")
{
return Right(MapName, Len(MapName) - 6);
}
else if (Left(MapName, 6) ~= "UEDIOS")
{
return Right(MapName, Len(MapName) - 6);
}
return MapName;
}
static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
local string NewMapName,GameTypeName,ThisMapPrefix,GameOption;
local int PrefixIndex, MapPrefixPos,GameTypePrefixPos;
local class<GameInfo> UTGameType;
// Let UTGame decide the mode for UT entry maps.
if (Left(MapName, 9) ~= "EnvyEntry" || Left(MapName, 14) ~= "UDKFrontEndMap" )
{
UTGameType = class<GameInfo>(DynamicLoadObject("UTGame.UTGame",class'Class'));
if( UTGameType != None )
{
return UTGameType.static.SetGameType( MapName, Options, Portal );
}
}
// allow commandline to override game type setting
GameOption = ParseOption( Options, "Game");
if ( GameOption != "" )
{
return Default.class;
}
// strip the "play on" prefixes from the filename, if it exists (meaning this is a Play in Editor game)
NewMapName = StripPlayOnPrefix( MapName );
// Get the prefix for this map
MapPrefixPos = InStr(NewMapName,"-");
ThisMapPrefix = left(NewMapName,MapPrefixPos);
// Change game type
for ( PrefixIndex=0; PrefixIndex<Default.DefaultMapPrefixes.Length; PrefixIndex++ )
{
GameTypePrefixPos = InStr(Default.DefaultMapPrefixes[PrefixIndex].GameType ,".");
GameTypeName = left(Default.DefaultMapPrefixes[PrefixIndex].GameType,GameTypePrefixPos);
if ( Default.DefaultMapPrefixes[PrefixIndex].Prefix ~= ThisMapPrefix && ( GameTypeName ~= "UTGame" || GameTypeName ~= "UTGameContent" ) )
{
// If this is a UTGame type, let UTGame figure out the name
UTGameType = class<GameInfo>(DynamicLoadObject("UTGame.UTGame",class'Class'));
if( UTGameType != None )
{
return UTGameType.static.SetGameType( MapName, Options, Portal );
}
}
}
return Default.class;
}
defaultproperties
{
PlayerControllerClass=class'UDKBase.SimplePC'
DefaultPawnClass=class'UDKBase.SimplePawn'
PopulationManagerClass=class'GameFramework.GameCrowdPopulationManager'
HUDType=class'UDKBase.UDKHUD'
bRestartLevel=false
bWaitingToStartMatch=true
bDelayedStart=false
}

647
UDKBase/classes/SimplePC.uc Normal file
View File

@ -0,0 +1,647 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class SimplePC extends GamePlayerController;
/** How fast to increase the rate of rotation toward the target */
var float AutoRotationAccelRate;
/** How quickly to decelerate when no rotation is applied */
var float AutoRotationBrakeDecelRate;
/** Maximum auto rotation velocity */
var float MaxAutoRotationVelocity;
/** How fast to increase the rate of rotation toward the target */
var float BreathAutoRotationAccelRate;
/** How quickly to decelerate when no rotation is applied */
var float BreathAutoRotationBrakeDecelRate;
/** Maximum auto rotation velocity */
var float MaxBreathAutoRotationVelocity;
/** When rotating to a touch-to-move target, how much to increase yaw acceleration when the target is nearby */
var float RangeBasedYawAccelStrength;
/** Distance at which we start to change rotation acceleration rate based on distance to touch-to-move target */
var float RangeBasedAccelMaxDistance;
/** True if we should look at our click-to-move destination. */
var bool bLookAtDestination;
/** Holds the location we are looking at */
var vector LookAtDestination;
var float LookAtDestAutoPitchAmount;
/** Is camera breathing engaged yet*/
var bool bCameraBreathing;
/** The location that the camera was approximately looking at when breathing began*/
var vector CameraBreathCenterLocation;
/** Delta from the desired rotation*/
var Rotator CameraBreathRotator;
/** Last location where breathing began */
var vector CameraBreathSampleLocation;
/** Time of the last random breath rotator sampling */
var float LastCameraBreathDeltaSelectTime;
/** Time between direction changes*/
var float TimeBetweenCameraBreathChanges;
/** How fast we're currently rotating toward the target (yaw, pitch) */
var vector2d AutoRotationVelocity;
/** Holds the dimensions of the viewport */
var vector2D ViewportSize;
/** List of footstep sounds, chosen at random to play while the player is walking */
var array<SoundCue> FootstepSounds;
/** How far we should move before playing the next footstep sound */
var float DistanceUntilNextFootstepSound;
/** Commandline to run when being a server */
var config string ServerCommandline;
/** Used for turn smoothing */
var float OldTurn, OldLookup;
/** How much to smooth rotation. */
var config float RotationSmoothingFactor;
/** Whether to use rotation smoothing */
var config bool bSmoothRotation;
var config int DefaultInputGroup;
/** Cache a reference to the MobilePlayerInput */
var MobilePlayerInput MPI;
/** Cache a reference to various zones */
var MobileInputZone SliderZone;
var MobileInputZone StickMoveZone;
var MobileInputZone StickLookZone;
var MobileInputZone FreeLookZone;
/** Used for stats tracking */
var int NoTapToMoves;
/** Used for stats tracking */
var float LastEnteredTapToMove;
/** Used for stats tracking */
var float TotalTimeInTapToMove;
/** Holds the time of the last movement/look change */
var float TimeOfLastUserViewChange;
/** If true, apply an offset to the view target during a matinee */
var bool bApplyBackTouchToViewOffset;
var bool bFingerIsDown;
var Vector2D TouchCenter;
var Rotator LastOffset;
var Rotator MatineeOffset;
/**
* When we init the input system, find the TapToMove zone and hook up the delegate
*/
event InitInputSystem()
{
Super.InitInputSystem();
SetupZones();
}
/**
* Kismet hook to trigger console events
*/
function OnConsoleCommand( SeqAct_ConsoleCommand inAction )
{
local string Command;
foreach inAction.Commands(Command)
{
// don't allow music before startmatch
if ( WorldInfo.Game.bWaitingToStartMatch && (Left(Command,15) ~= "mobile playsong") )
{
continue;
}
// prevent "set" commands from ever working in Kismet as they are e.g. disabled in netplay
if (!(Left(Command, 4) ~= "set ") && !(Left(Command, 9) ~= "setnopec "))
{
ConsoleCommand(Command);
}
}
}
/**
* Zones have to be setup on both sides of the network pond. This function is a good place to do that from.
*
* @param GameClass holds the class that's being setup.
*/
simulated function ReceivedGameClass(class<GameInfo> GameClass)
{
Super.ReceivedGameClass(GameClass);
// Setup the zones
SetupZones();
}
/**
* The main purpose of this function is to size and reset zones. There's a lot of specific code in
* here to reposition zones based on if it's an phone vs pad.
*/
function SetupZones()
{
// Cache the MPI
MPI = MobilePlayerInput(PlayerInput);
LocalPlayer(Player).ViewportClient.GetViewportSize(ViewportSize);
StickMoveZone = MPI.FindZone("UberStickMoveZone");
StickLookZone = MPI.FindZone("UberStickLookZone");
FreeLookZone = MPI.FindZone("UberLookZone");
}
/**
* Setup the in world indicator for Touch to move and some other subsystems
*/
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
// Time of the last target sampling
LastCameraBreathDeltaSelectTime = 0;
// Setup footstep sounds
SetNextFootstepDistance();
}
/**
* Checks to see if we are moving via the virtual stick
*
* @returns true if the virtual stick is being used to move the player
*/
function bool IsStickMoveActive()
{
return StickMoveZone.State != ZoneState_Inactive;
}
/** Sets the distance until the next footstep sound plays */
function SetNextFootstepDistance()
{
// Determine how far to go until the next foot step (with a bit of randomness!)
DistanceUntilNextFootstepSound = 200 + FRand() * 32;
}
/**
* PlayerMove is called each frame to manage the input. We will use it to hook in and
* see if the player has changed their view. If they do, then stop auto-rotating
*/
function PlayerMove( float DeltaTime )
{
Super.PlayerMove(DeltaTime);
// @todo: Is this needed?
UpdateRotation( DeltaTime );
}
/**
* Optionally smooth rotation
*/
function UpdateRotation( float DeltaTime )
{
local float Smooth;
if ( bSmoothRotation )
{
Smooth = 1.0 - FMin(0.9, RotationSmoothingFactor*DeltaTime);
OldTurn = PlayerInput.aTurn * (1.0 - Smooth) + OldTurn * Smooth;
OldLookup = PlayerInput.aLookup * (1.0 - Smooth) + OldLookup * Smooth;
PlayerInput.aLookup = OldLookup;
PlayerInput.aTurn = OldTurn;
}
Super.UpdateRotation(DeltaTime);
}
/**
* Called from PlayerMove, it's here that we adjust the viewport
*/
function ProcessViewRotation( float DeltaTime, out Rotator out_ViewRotation, Rotator DeltaRot )
{
// Accumulate a desired new rotation.
local float DistToDestination;
local Vector2D MaxVelocityScalar;
local float YawRotationSign;
local float PitchRotationSign;
local float FinalYawAccelRate;
local float FinalPitchAccelRate;
local vector VectorToTarget;
local vector TargetDirection;
local Rotator NewRotation;
local Rotator CameraRotationYawOnly;
local Rotator CameraRotationPitchOnly;
local Rotator TargetRotationYawOnly;
local Rotator TargetRotationPitchOnly;
//values to use during calculation
local float RotationAccelRate;
local float RotationBreakDecelRate;
local float MaxRotationVelocity;
//Using a fixed time delta to avoid stutters on device
DeltaTime = FMin(DeltaTime, 1/25.0);
Super.ProcessViewRotation(DeltaTime, out_ViewRotation, DeltaRot);
if (PlayerInput.aTurn != 0.0 || PlayerInput.aLookUp != 0.0)
{
TimeOfLastUserViewChange = WorldInfo.RealTimeSeconds;
}
// If the player has moved the camera recently, then forcibly disable auto-rotation
if ( WorldInfo.RealTimeSeconds - TimeOfLastUserViewChange < 0.1 )
{
bLookAtDestination = false;
//reset camera breath
bCameraBreathing = false;
LastCameraBreathDeltaSelectTime = 0;
}
//Update camera breathing
UpdateCameraBreathing();
if (bLookAtDestination || !bCameraBreathing)
{
RotationAccelRate = AutoRotationAccelRate;
RotationBreakDecelRate = AutoRotationBrakeDecelRate;
MaxRotationVelocity = MaxAutoRotationVelocity;
}
else
{
RotationAccelRate = BreathAutoRotationAccelRate;
RotationBreakDecelRate = BreathAutoRotationBrakeDecelRate;
MaxRotationVelocity = MaxBreathAutoRotationVelocity;
}
MaxVelocityScalar.X = 1.0;
MaxVelocityScalar.Y = 1.0;
if( bLookAtDestination || bCameraBreathing)
{
CameraRotationYawOnly = out_ViewRotation;
CameraRotationYawOnly.Pitch = 0;
CameraRotationYawOnly.Roll = 0;
CameraRotationPitchOnly = out_ViewRotation;
CameraRotationPitchOnly.Yaw = 0;
CameraRotationPitchOnly.Roll = 0;
if( bLookAtDestination )
{
VectorToTarget = LookAtDestination;
}
else //breathing
{
VectorToTarget = CameraBreathCenterLocation - Pawn.Location;
}
TargetDirection = Normal( VectorToTarget );
TargetRotationYawOnly = Rotator( TargetDirection ) + CameraBreathRotator;
TargetRotationPitchOnly = TargetRotationYawOnly;
TargetRotationYawOnly.Pitch = 0;
TargetRotationYawOnly.Roll = 0;
TargetRotationPitchOnly.Yaw = 0;
TargetRotationPitchOnly.Roll = 0;
if( bLookAtDestination )
{
// For click to move, we limit the amount of pitching the camera will do since usually the height
// of the target isn't that interesting, however sometimes a bit of pitching helps with slope-alignment
TargetRotationPitchOnly = RLerp( CameraRotationPitchOnly, TargetRotationPitchOnly, LookAtDestAutoPitchAmount, true /* Take shortest route? */ );
}
// How close is the current camera rotation to the target orientation? We'll rotate more quickly if
// we're further off course, and more slowly as we approach the desired angle. This makes the rotation
// appear to ease-out as we approach the desired orientation.
if (!bCameraBreathing)
{
MaxVelocityScalar.x *= 1.0 - FMax( 0.0, Vector( CameraRotationYawOnly ) dot Vector( TargetRotationYawOnly ) );
MaxVelocityScalar.y *= 1.0 - FMax( 0.0, Vector( CameraRotationPitchOnly ) dot Vector( TargetRotationPitchOnly ) );
}
DistToDestination = VSize2D( VectorToTarget );
// For destination-look at, allow distance to affect speed. (Note, we take the 2D distance here)
FinalYawAccelRate = RotationAccelRate;
FinalPitchAccelRate = RotationAccelRate;
if( bLookAtDestination )
{
// Increase the yaw rate as we get closer to the target (up to 1.0 + RangeBasedYawAccelStrength).
// This is because the yaw angle relative to the target may still be very wide as we approach
// (especially if the user touched a location near the player) we want to get most of the horizontal
// turning out of the way early so the player can see where they're going
FinalYawAccelRate *= 1.0 + ( 1.0 - FMin( DistToDestination, RangeBasedAccelMaxDistance ) / RangeBasedAccelMaxDistance ) * RangeBasedYawAccelStrength;
// Decrease the pitch rate as we get closed to the target. This is because the pitch angle relative
// to the target will usually become steeper as we approach the target and we won't want to pitch
// up and down erratically as we're arriving
FinalPitchAccelRate *= FMin( DistToDestination, RangeBasedAccelMaxDistance ) / RangeBasedAccelMaxDistance;
}
CheckDistanceToDestination(DistToDestination);
// Accelerate yaw
YawRotationSign = ( out_ViewRotation.Yaw ClockwiseFrom TargetRotationYawOnly.Yaw ) ? -1.0 : 1.0;
AutoRotationVelocity.x += YawRotationSign * FinalYawAccelRate * DeltaTime;
// Accelerate pitch
PitchRotationSign = ( out_ViewRotation.Pitch ClockwiseFrom TargetRotationPitchOnly.Pitch ) ? -1.0 : 1.0;
AutoRotationVelocity.y += PitchRotationSign * FinalPitchAccelRate * DeltaTime;
}
else
{
// Yaw brake
if( AutoRotationVelocity.x > 0.01 )
{
AutoRotationVelocity.x = FMax( 0.0, AutoRotationVelocity.x - RotationBreakDecelRate * DeltaTime );
}
else if( AutoRotationVelocity.x < -0.01 )
{
AutoRotationVelocity.x = FMin( 0.0, AutoRotationVelocity.x + RotationBreakDecelRate * DeltaTime );
}
else
{
AutoRotationVelocity.x = 0.0;
}
// Pitch brake
if( AutoRotationVelocity.y > 0.01 )
{
AutoRotationVelocity.y = FMax( 0.0, AutoRotationVelocity.y - RotationBreakDecelRate * DeltaTime );
}
else if( AutoRotationVelocity.y < -0.01 )
{
AutoRotationVelocity.y = FMin( 0.0, AutoRotationVelocity.y + RotationBreakDecelRate * DeltaTime );
}
else
{
AutoRotationVelocity.y = 0.0;
}
}
// Clamp max velocity
if( AutoRotationVelocity.x > MaxRotationVelocity * MaxVelocityScalar.x )
{
AutoRotationVelocity.x = MaxRotationVelocity * MaxVelocityScalar.x;
}
else if( AutoRotationVelocity.x < -MaxRotationVelocity * MaxVelocityScalar.x )
{
AutoRotationVelocity.x = -MaxRotationVelocity * MaxVelocityScalar.x;
}
if( AutoRotationVelocity.y > MaxRotationVelocity * MaxVelocityScalar.y )
{
AutoRotationVelocity.y = MaxRotationVelocity * MaxVelocityScalar.y;
}
else if( AutoRotationVelocity.y < -MaxRotationVelocity * MaxVelocityScalar.y )
{
AutoRotationVelocity.y = -MaxRotationVelocity * MaxVelocityScalar.y;
}
if( Abs( AutoRotationVelocity.X ) > 0.01 || Abs( AutoRotationVelocity.Y ) > 0.01 )
{
// Rotate!
NewRotation.Yaw = fixedTurn(out_ViewRotation.Yaw, out_ViewRotation.Yaw + AutoRotationVelocity.x * DeltaTime, Abs( AutoRotationVelocity.x * DeltaTime ));
NewRotation.Pitch = fixedTurn(out_ViewRotation.Pitch, out_ViewRotation.Pitch + AutoRotationVelocity.y * DeltaTime, Abs( AutoRotationVelocity.y * DeltaTime ));
NewRotation.Roll = out_ViewRotation.Roll;
// Set new rotation
out_ViewRotation = NewRotation;
}
}
/**
* Stub Function. It get's called by ProcessViewRotation and allows children to perform actions based on the
* distance to a destination.
*/
simulated function CheckDistanceToDestination(float DistToDestination)
{
}
/**Function that selects a slightly offset direction to look and will trend the camera towards that*/
simulated function UpdateCameraBreathing()
{
local Vector PawnX, PawnY, PawnZ;
local float DegreeDelta;
local float YawSign;
local float PitchDegrees;
local float YawDegrees;
if ( Pawn == None )
{
bCameraBreathing = false;
LastCameraBreathDeltaSelectTime = 0;
return;
}
//if we've just moved
if (IsInState('PlayerClickToMove') || (CameraBreathSampleLocation != Pawn.Location))
{
bCameraBreathing = false;
LastCameraBreathDeltaSelectTime = 0;
CameraBreathSampleLocation = Pawn.Location;
return;
}
//if it's time to try to breath again
if (WorldInfo.TimeSeconds - LastCameraBreathDeltaSelectTime >= TimeBetweenCameraBreathChanges)
{
DegreeDelta = 0.5;
PitchDegrees = ((FRand() * 2.f) - 1.f);
YawSign = (FRand() >= 0.5f) ? 1.0f : -1.0f;
YawDegrees = YawSign * (Sqrt(1.0f - PitchDegrees*PitchDegrees));
//+ or - DegreeDeltas
CameraBreathRotator.Pitch = (PitchDegrees*DegreeDelta*65536/360);
CameraBreathRotator.Yaw = (YawDegrees*DegreeDelta*65536/360);
CameraBreathRotator.Roll = 0.0;
//if we're not actively tracking something, set a new desired look location relative to where we are already looking
if (!bLookAtDestination && !bCameraBreathing)
{
//`log("NOTE: Chosen a new look at dest"@CameraBreathRotator);
GetAxes(Rotation, PawnX, PawnY, PawnZ);
CameraBreathCenterLocation = Pawn.Location + PawnX*1000.0;
bCameraBreathing = true;
}
LastCameraBreathDeltaSelectTime = WorldInfo.TimeSeconds;
}
}
function ActivateControlGroup()
{
MPI.ActivateInputGroup("UberGroup");
}
/** Offset matinee via back touch */
function OffsetMatineeTouch(int Handle, ETouchType Type, Vector2D TouchLocation, float DeviceTimestamp, int TouchpadIndex)
{
// only first finger on back panel
if (Handle != 0 || TouchpadIndex != 1)
{
return;
}
if (Type == Touch_Began)
{
TouchCenter = TouchLocation;
bFingerIsDown = true;
}
else if (Type == Touch_Ended)
{
LastOffset = MatineeOffset;
bFingerIsDown = false;
}
else if (bFingerIsDown)
{
MatineeOffset.Yaw = LastOffset.Yaw + 60 * (TouchLocation.X - TouchCenter.X);
MatineeOffset.Pitch = LastOffset.Pitch + -60 * (TouchLocation.Y - TouchCenter.Y);
}
}
event NotifyDirectorControl(bool bNowControlling, SeqAct_Interp CurrentMatinee)
{
super.NotifyDirectorControl(bNowControlling, CurrentMatinee);
if (bNowControlling)
{
MPI.OnInputTouch = OffsetMatineeTouch;
}
else
{
MPI.OnInputTouch = none;
LastOffset.Yaw = 0;
LastOffset.Pitch = 0;
MatineeOffset.Yaw = 0;
MatineeOffset.Pitch = 0;
bFingerIsDown = false;
}
// remember if we are controlling or not
bApplyBackTouchToViewOffset = bNowControlling;
}
simulated event GetPlayerViewPoint( out vector out_Location, out Rotator out_Rotation )
{
super.GetPlayerViewPoint(out_Location, out_Rotation);
if (bApplyBackTouchToViewOffset)
{
out_Rotation += MatineeOffset;
}
}
/**
* Handle footsteps
*/
function PlayerTick(float DeltaTime)
{
local float CurrentWalkSpeed;
local int FootstepSoundIndex;
local TraceHitInfo HitInfo;
local Vector TraceStart;
local Vector TraceEnd;
local Vector TraceExtent;
local Vector OutHitLocation, OutHitNormal;
local Actor TraceActor;
if (bApplyBackTouchToViewOffset && !bFingerIsDown)
{
MatineeOffset.Yaw *= 0.99;
MatineeOffset.Pitch *= 0.99;
LastOffset.Yaw *= 0.99;
LastOffset.Pitch *= 0.99;
}
// Only play footsteps if we're actually walking at a decent speed
if ( Pawn != None )
{
CurrentWalkSpeed = VSize2D( Pawn.Velocity );
}
if ( CurrentWalkSpeed > 32.0 )
{
// Update distance until the next foot step
DistanceUntilNextFootstepSound -= CurrentWalkSpeed * DeltaTime;
if( DistanceUntilNextFootstepSound < 0.0 )
{
TraceStart = Pawn.Location;
// @todo probably need a better way to get the end location instead of a magic number
TraceEnd = Pawn.Location;
TraceEnd.Z -= 100.0f;
// trace down and see what we are standing on.
TraceActor = Trace(OutHitLocation, OutHitNormal, TraceEnd, TraceStart, TRUE, TraceExtent, HitInfo, TRACEFLAG_Bullet|TRACEFLAG_Blocking|TRACEFLAG_SkipMovers);
if( TraceActor != None && HitInfo.PhysMaterial != None && HitInfo.PhysMaterial.ImpactSound != None )
{
// Play the sound from the hit physical material if it exists
PlaySound( HitInfo.PhysMaterial.ImpactSound );
}
else if (FootstepSounds.Length > 0)
{
// Play a random footstep sound if we couldnt find a physical material to get a sound from.
FootstepSoundIndex = Rand( FootstepSounds.Length );
PlaySound( FootstepSounds[ FootstepSoundIndex ] );
}
// Queue up the next footstep
SetNextFootstepDistance();
}
}
else
{
// We stopped walking so reset time until next footstep
SetNextFootstepDistance();
}
Super.PlayerTick(DeltaTime);
}
exec function SetFootstepsToStone();
exec function SetFootstepsToSnow();
defaultproperties
{
InputClass=class'GameFramework.MobilePlayerInput'
AutoRotationAccelRate=10000.0
AutoRotationBrakeDecelRate=10000.0
MaxAutoRotationVelocity=300000
BreathAutoRotationAccelRate=250.0
BreathAutoRotationBrakeDecelRate=1.0
MaxBreathAutoRotationVelocity=75
TimeBetweenCameraBreathChanges = 2.0
RangeBasedYawAccelStrength=8.0
RangeBasedAccelMaxDistance=512.0
}

View File

@ -0,0 +1,205 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class SimplePawn extends GamePawn;
var bool bFixedView;
var vector FixedViewLoc;
var rotator FixedViewRot;
/** view bob properties */
var float Bob;
var float AppliedBob;
var float BobTime;
var vector WalkBob;
var float OldZ;
/** Speed modifier for castle pawn */
var config float CastlePawnSpeed;
var config float CastlePawnAccel;
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
OldZ = Location.Z;
}
exec function FixedView()
{
if (!bFixedView)
{
FixedViewLoc = Location;
FixedViewRot = Controller.Rotation;
}
bFixedView = !bFixedView;
}
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local float Radius, Height;
// Override camera FOV for first person castle player
out_FOV = 65.0;
// Handle the fixed camera
if (bFixedView)
{
out_CamLoc = FixedViewLoc;
out_CamRot = FixedViewRot;
return true;
}
GetBoundingCylinder(Radius, Height);
out_CamLoc = Location - vector(out_CamRot) * Radius * 20;
return false;
}
/**
* Updates the player's eye height using BaseEyeHeight and (head) Bob settings; called every tick
*/
event TickSpecial( float DeltaTime )
{
// NOTE: The following was pulled from UT's head bobbing features
local bool bAllowBob;
local float smooth, Speed2D;
local vector X, Y, Z;
// Set ground speed
GroundSpeed = CastlePawnSpeed;
AccelRate = CastlePawnAccel;
bAllowBob = true;
if ( abs(Location.Z - OldZ) > 15 )
{
// if position difference too great, don't do head bob
bAllowBob = false;
BobTime = 0;
WalkBob = Vect(0,0,0);
}
if ( bAllowBob )
{
// normal walking around
// smooth eye position changes while going up/down stairs
smooth = FMin(0.9, 10.0 * DeltaTime/CustomTimeDilation);
if( Physics == PHYS_Walking || Controller.IsInState('PlayerClickToMove') )
{
EyeHeight = FMax((EyeHeight - Location.Z + OldZ) * (1 - smooth) + BaseEyeHeight * smooth,
-0.5 * CylinderComponent.CollisionHeight);
}
else
{
EyeHeight = EyeHeight * ( 1 - smooth) + BaseEyeHeight * smooth;
}
// Add walk bob to movement
Bob = FClamp(Bob, -0.15, 0.15);
if (Physics == PHYS_Walking )
{
GetAxes(Rotation,X,Y,Z);
Speed2D = VSize(Velocity);
if ( Speed2D < 10 )
{
BobTime += 0.2 * DeltaTime;
}
else
{
BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/GroundSpeed);
}
WalkBob = Y * Bob * Speed2D * sin(8 * BobTime);
AppliedBob = AppliedBob * (1 - FMin(1, 16 * deltatime));
WalkBob.Z = AppliedBob;
if ( Speed2D > 10 )
{
WalkBob.Z = WalkBob.Z + 0.75 * Bob * Speed2D * sin(16 * BobTime);
}
}
else if ( Physics == PHYS_Swimming )
{
GetAxes(Rotation,X,Y,Z);
BobTime += DeltaTime;
Speed2D = Sqrt(Velocity.X * Velocity.X + Velocity.Y * Velocity.Y);
WalkBob = Y * Bob * 0.5 * Speed2D * sin(4.0 * BobTime);
WalkBob.Z = Bob * 1.5 * Speed2D * sin(8.0 * BobTime);
}
else
{
BobTime = 0;
WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime));
}
WalkBob *= 0.1;
}
OldZ = Location.Z;
}
/**
* GetPawnViewLocation()
*
* Called by PlayerController to determine camera position in first person view. Returns
* the location at which to place the camera
*/
simulated function Vector GetPawnViewLocation()
{
return Location + EyeHeight * vect(0,0,1) + WalkBob;
}
defaultproperties
{
Components.Remove(Sprite)
Begin Object Name=CollisionCylinder
CollisionRadius=+0021.000000
CollisionHeight=+0044.000000
End Object
CylinderComponent=CollisionCylinder
ViewPitchMin=-10000
ViewPitchMax=12000
// How much to bob the camera when walking
Bob=0.12
// @todo: When touching to move while already moving, walking physics may be applied for a single frame.
// This means that if WalkingPct is not 1.0, brakes will be applied and movement will appear to stutter.
// Until we can figure out how to avoid the state transition glitch, we're forcing WalkingPct to 1.0
WalkingPct=+1.0
CrouchedPct=+0.4
BaseEyeHeight=60.0 // 38.0
EyeHeight=60.0 // 38.0
GroundSpeed=440.0
AirSpeed=440.0
WaterSpeed=220.0
AccelRate=2048.0
JumpZ=322.0
CrouchHeight=29.0
CrouchRadius=21.0
WalkableFloorZ=0.78
AlwaysRelevantDistanceSquared=+1960000.0
RotationRate=(Pitch=20000,Yaw=20000,Roll=20000)
AirControl=+0.35
bCanCrouch=true
bCanClimbLadders=True
bCanPickupInventory=True
SightRadius=+12000.0
MaxStepHeight=26.0
MaxJumpHeight=49.0
bScriptTickSpecial=true
}

View File

@ -0,0 +1,23 @@
/**
* when this component gets triggered, it calls its owner UTBot's ExecuteWhatToDoNext() in its next tick.
* This is so the AI's state code, timers, etc happen in TG_PreAsyncWork while the decision logic happens
* in TG_DuringAsyncWork for improved parallelism ("during async work" executes in parallel with physics update)
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAIDecisionComponent extends ActorComponent
native;
/** bTriggered is true while bot is waiting for DecisionComponent to call back event ExecuteWhatToDoNext() */
var bool bTriggered;
cpptext
{
virtual void Tick(FLOAT DeltaTime);
}
defaultproperties
{
TickGroup=TG_DuringAsyncWork
}

View File

@ -0,0 +1,35 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendBase extends AnimNodeBlendList
native(Animation);
/** How fast show a given child blend in. */
var(Animation) float BlendTime;
/** Also allow for Blend Overrides */
var(Animation) array<float> ChildBlendTimes;
/** Whether this AnimBlend wants a script TickAnim event called (for script extensibility) */
var bool bTickAnimInScript;
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
// AnimTree editor interface
virtual void HandleSliderMove(INT SliderIndex, INT ValueIndex, FLOAT NewSliderValue);
}
native final function float GetBlendTime(int ChildIndex, optional bool bGetDefault);
/** If child is an AnimNodeSequence, find its duration at current play rate. */
native final function float GetAnimDuration(int ChildIndex);
/** Use to implement custom anim blend functionality in script */
event TickAnim(FLOAT DeltaSeconds);
defaultproperties
{
BlendTime=0.25
}

View File

@ -0,0 +1,21 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByDriving extends AnimNodeBlend
native(Animation);
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
}
/** Force an update of the driving state now. */
native function UpdateDrivingState();
defaultproperties
{
Children(0)=(Name="Not-Driving",Weight=1.0)
Children(1)=(Name="Driving")
bFixNumChildren=true
}

View File

@ -0,0 +1,80 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByFall extends UDKAnimBlendBase
native(Animation);
enum EBlendFallTypes
{
FBT_Up, // jump
FBT_Down,
FBT_PreLand,
FBT_Land,
// variants for double jump
FBT_DblJumpUp,
FBT_DblJumpDown,
FBT_DblJumpPreLand,
FBT_DblJumpLand,
FBT_None
};
/** If TRUE, double jump versions of the inputs will be ignored. */
var() bool bIgnoreDoubleJumps;
/** Time before predicted landing to trigger pre-land animation. */
var() float PreLandTime;
/** Time before landing we should start becoming upright again. */
var() float PreLandStartUprightTime;
/** Time to become upright when executing double jump. */
var() float ToDblJumpUprightTime;
/** True if a double jump was performed and we should use the DblJump states. */
var transient bool bDidDoubleJump;
/**
* This fall is used for dodging. When it's true, the Falling node progress through
* it's states in an alternate manner
*/
var bool bDodgeFall;
/** The current state this node believes the pawn to be in */
var const EBlendFallTypes FallState;
/** Set internally, this variable holds the size of the velocity at the last tick */
var const float LastFallingVelocity;
/** Cached pointer to parent leaning node. */
var const UDKAnimNodeJumpLeanOffset CachedLeanNode;
cpptext
{
virtual void DeferredInitAnim();
virtual void TickAnim(FLOAT DeltaSeconds);
virtual void SetActiveChild( INT ChildIndex, FLOAT BlendTime );
virtual void OnChildAnimEnd(UAnimNodeSequence* Child, FLOAT PlayedTime, FLOAT ExcessTime);
virtual void ChangeFallState(EBlendFallTypes NewState);
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent);
virtual void RenameChildConnectors();
virtual void OnCeaseRelevant();
}
defaultproperties
{
FallState=FBT_None
bDodgeFall=false
Children(0)=(Name="Up",Weight=1.0)
Children(1)=(Name="Down")
Children(2)=(Name="Pre-Land")
Children(3)=(Name="Land")
Children(4)=(Name="DoubleJump Up")
Children(5)=(Name="DoubleJump Down")
Children(6)=(Name="DoubleJump Pre-Land")
Children(7)=(Name="DoubleJump Land")
bFixNumChildren=true
}

View File

@ -0,0 +1,58 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByFlying extends UDKAnimBlendBase
native(Animation);
//Order is important here (corresponds to blendlist node children)
var const enum EFlyingState
{
Flying_NotFlying,
Flying_OpeningWings,
Flying_Flying,
Flying_ClosingWings
} FlyingState;
/** Access to the flying pawn */
var UDKPawn Pawn;
/** Access to the state of the flying animation */
var UDKAnimBlendBase FlyingMode;
/** Access to the aim offset controlling flight direction */
var AnimNodeAimOffset FlyingDir;
/** Does this pawn have a special start anim to play */
var() name StartingAnimName;
var bool bHasStartingAnim;
/** Does this pawn have a special end anim to play */
var() name EndingAnimName;
var bool bHasEndingAnim;
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
void InitAnim(USkeletalMeshComponent* MeshComp, UAnimNodeBlendBase* Parent );
/** Notification to this blend that a child UAnimNodeSequence has reached the end and stopped playing. Not called if child has bLooping set to true or if user calls StopAnim. */
virtual void OnChildAnimEnd(UAnimNodeSequence* Child, FLOAT PlayedTime, FLOAT ExcessTime);
void TestBlend();
}
/** Force an update of the flying state now. */
native function UpdateFlyingState();
defaultproperties
{
Children(0)=(Name="Not Flying",Weight=0.8)
Children(1)=(Name="Flying",Weight=0.2)
bFixNumChildren=true
StartingAnimName=Wings_Open
EndingAnimName=Wings_Close
}

View File

@ -0,0 +1,20 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByHoverJump extends UDKAnimBlendByFall
Native(Animation);
var const transient Pawn OwnerP;
var const transient UDKVehicle OwnerHV;
cpptext
{
virtual void InitAnim(USkeletalMeshComponent* MeshComp, UAnimNodeBlendBase* Parent );
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
bIgnoreDoubleJumps=true
}

View File

@ -0,0 +1,39 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByHoverboardTilt extends AnimNodeBlendBase
native(Animation);
cpptext
{
// AnimNode interface
virtual void TickAnim(FLOAT DeltaSeconds);
virtual INT GetNumSliders() const { return 1; }
virtual ESliderType GetSliderType(INT InIndex) const { return ST_2D; }
virtual FLOAT GetSliderPosition(INT SliderIndex, INT ValueIndex);
virtual void HandleSliderMove(INT SliderIndex, INT ValueIndex, FLOAT NewSliderValue);
virtual FString GetSliderDrawValue(INT SliderIndex);
}
var vector UpVector;
var() float TiltScale;
var() float TiltDeadZone;
var() float TiltYScale;
var name UpperBodyName;
defaultproperties
{
TiltYScale=1.0
Children(0)=(Name="Flat",Weight=1.0)
Children(1)=(Name="Forward")
Children(2)=(Name="Backward")
Children(3)=(Name="Left")
Children(4)=(Name="Right")
bFixNumChildren=true
UpperBodyName=UpperBody
}

View File

@ -0,0 +1,26 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByHoverboardTurn extends AnimNodeBlendBase
native(Animation);
cpptext
{
// AnimNode interface
virtual void TickAnim(FLOAT DeltaSeconds);
}
var() float TurnScale;
var() float MaxBlendPerSec;
var float CurrentAnimWeight;
defaultproperties
{
Children(0)=(Name="Straight",Weight=1.0)
Children(1)=(Name="TurnLeft")
Children(2)=(Name="TurnRight")
bFixNumChildren=true
MaxBlendPerSec=1.0
}

View File

@ -0,0 +1,44 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByHoverboarding extends UDKAnimBlendBase
native(Animation);
var int LastActiveChildIndex;
var float BoardLeanAmount;
var() float FallTimeBeforeAnim;
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
virtual void SetActiveChild( INT ChildIndex, FLOAT BlendTime );
}
defaultproperties
{
Children(0)=(Name="Standing"),Weight=1.0
Children(1)=(Name="TurnLeft")
Children(2)=(Name="TurnRight")
Children(3)=(Name="LeanLeft")
Children(4)=(Name="LeanRight")
Children(5)=(Name="StrafeLeft")
Children(6)=(Name="StrafeRight")
Children(7)=(Name="Crouching")
Children(8)=(Name="Jumping")
Children(9)=(Name="Falling")
Children(10)=(Name="Landed")
Children(11)=(Name="GrabTrick")
Children(12)=(Name="Spinning")
Children(13)=(Name="SpinWarmupLeft")
Children(14)=(Name="SpinWarmupRight")
Children(15)=(Name="Trick1")
Children(16)=(Name="Trick2")
Children(17)=(Name="Trick3")
bPlayActiveChild=false
bFixNumChildren=true
FallTimeBeforeAnim=0.3
}

View File

@ -0,0 +1,18 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByIdle extends UDKAnimBlendBase
native(Animation);
cpptext
{
// AnimNode interface
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
Children(0)=(Name="Idle",Weight=1.0)
Children(1)=(Name="Moving")
bFixNumChildren=true
}

View File

@ -0,0 +1,45 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByPhysics extends UDKAnimBlendBase
native(Animation);
/** Maps the PSY_enums to child nodes */
var(Animations) int PhysicsMap[12];
/** Holds the last known physics type for the tree's owner. */
var int LastPhysics; // Track the last physics
var() float LandBlendDelay;
var int PendingChildIndex;
var float PendingTimeToGo;
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
PhysicsMap(0)=-1
PhysicsMap(1)=-1
PhysicsMap(2)=-1
PhysicsMap(3)=-1
PhysicsMap(4)=-1
PhysicsMap(5)=-1
PhysicsMap(6)=-1
PhysicsMap(7)=-1
PhysicsMap(8)=-1
PhysicsMap(9)=-1
PhysicsMap(10)=-1
PhysicsMap(11)=-1
Children(0)=(Name="PHYS_Walking",Weight=1.0)
Children(1)=(Name="PHYS_Falling")
Children(2)=(Name="PHYS_Swimming")
}

View File

@ -0,0 +1,64 @@
/** selects child based on parameters of the owner's current physics volume
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByPhysicsVolume extends UDKAnimBlendBase
native(Animation);
struct native PhysicsVolumeParams
{
/** index of child that should become active when the owner's physics volume matches these parameters */
var() int ChildIndex;
/** whether the volume is a water volume */
var() bool bWaterVolume;
/** whether we care about the volume's gravity */
var() bool bCheckGravity;
/** gravity thresholds for bCheckGravity */
var() float MinGravity, MaxGravity;
};
var() array<PhysicsVolumeParams> PhysicsParamList;
/** last volume owner was using, to detect changes */
var transient PhysicsVolume LastPhysicsVolume;
cpptext
{
virtual void RenameChildConnectors();
virtual void TickAnim(FLOAT DeltaSeconds);
}
/** called when this node detects that its Owner's PhysicsVolume has been changed
* choose the appropriate child here
*/
event PhysicsVolumeChanged(PhysicsVolume NewVolume)
{
local int i, DesiredChild;
local float GravityZ;
for (i = 0; i < PhysicsParamList.length; i++)
{
if (PhysicsParamList[i].bWaterVolume == NewVolume.bWaterVolume)
{
if (!PhysicsParamList[i].bCheckGravity)
{
DesiredChild = PhysicsParamList[i].ChildIndex;
break;
}
else
{
GravityZ = NewVolume.GetGravityZ();
if (GravityZ >= PhysicsParamList[i].MinGravity && GravityZ <= PhysicsParamList[i].MaxGravity)
{
DesiredChild = PhysicsParamList[i].ChildIndex;
break;
}
}
}
}
SetActiveChild(DesiredChild, GetBlendTime(DesiredChild));
}
defaultproperties
{
Children[0]=(Name="Default",Weight=1.0)
}

View File

@ -0,0 +1,18 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByPosture extends UDKAnimBlendBase
native(Animation);
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
Children(0)=(Name="Run",Weight=1.0)
Children(1)=(Name="Crouch")
bFixNumChildren=true
}

View File

@ -0,0 +1,22 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendBySlotActive extends AnimNodeBlendPerBone
native(Animation);
/** Cached pointer to slot node that we'll be monitoring. */
var AnimNodeSlot ChildSlot;
cpptext
{
virtual void InitAnim(USkeletalMeshComponent* MeshComp, UAnimNodeBlendBase* Parent);
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
Children(0)=(Name="Default",Weight=1.0)
Children(1)=(Name="Slot")
}

View File

@ -0,0 +1,26 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendBySpeed extends AnimNodeBlend
native(Animation);
/** minimum speed; at this or below the "Slow" anim is used completely */
var() float MinSpeed;
/** maximum speed; at this or above the "Fast" anim is used completely */
var() float MaxSpeed;
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
MinSpeed=100.0
MaxSpeed=1000.0
Children(0)=(Name="Slow",Weight=1.0)
Children(1)=(Name="Fast")
}

View File

@ -0,0 +1,23 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByTurnInPlace extends UDKAnimBlendBase
native(Animation);
var() float RootYawSpeedThresh;
var() float TurnInPlaceBlendSpeed;
var const transient UDKPawn OwnerUTP;
cpptext
{
// AnimNode interface
virtual void InitAnim(USkeletalMeshComponent* MeshComp, UAnimNodeBlendBase* Parent);
virtual void TickAnim(FLOAT DeltaSeconds);
}
defaultproperties
{
Children(0)=(Name="Idle",Weight=1.0)
Children(1)=(Name="TurnInPlace")
bFixNumChildren=true
}

View File

@ -0,0 +1,25 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByVehicle extends UDKAnimBlendBase
native(Animation);
var bool bLastPawnDriving;
var Vehicle LastVehicle;
cpptext
{
virtual void TickAnim(FLOAT DeltaSeconds);
}
/** Force an update of the vehicle state now. */
native function UpdateVehicleState();
defaultproperties
{
Children(0)=(Name="Default",Weight=1.0)
Children(1)=(Name="UTVehicle_Hoverboard")
bFixNumChildren=true
}

View File

@ -0,0 +1,18 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
* This node blends in the 'Weapon' branch when anything other than the rifle is being used.
*/
class UDKAnimBlendByWeapType extends AnimNodeBlendPerBone
native(Animation);
cpptext
{
void WeapTypeChanged(FName NewAimProfileName);
}
defaultproperties
{
Children(0)=(Name="Default",Weight=1.0)
Children(1)=(Name="Weapon")
}

View File

@ -0,0 +1,81 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimBlendByWeapon extends AnimNodeBlendPerBone
native(Animation);
/** Is this weapon playing a looped anim */
var(Animation) bool bLooping;
/** If set, after the fire anim completes this anim is looped instead of looping the fire anim */
var(Animation) name LoopingAnim;
/** Blend Times */
var(Animation) float BlendTime;
cpptext
{
virtual void OnChildAnimEnd(UAnimNodeSequence* Child, FLOAT PlayedTime, FLOAT ExcessTime);
}
/** Call to trigger the fire sequence. It will blend to the fire animation.
If bAutoFire is specified, if LoopSequence is 'None' or unspecified, FireSequence will be looped, otherwise FireSequence
will be played once and LoopSequence will be looped after that */
function AnimFire(name FireSequence, bool bAutoFire, optional float AnimRate, optional float SpecialBlendTime, optional name LoopSequence = LoopingAnim)
{
local AnimNodeSequence FireNode;
// Fix the rate
if (AnimRate == 0)
{
AnimRate = 1.0;
}
if (SpecialBlendTime == 0.0f)
{
SpecialBlendtime = BlendTime;
}
// Activate the child node
SetBlendTarget(1, SpecialBlendtime);
// Restart the sequence
FireNode = AnimNodeSequence(Children[1].Anim);
if (FireNode != None)
{
FireNode.SetAnim(FireSequence);
FireNode.PlayAnim(bAutoFire && LoopSequence == 'None', AnimRate);
}
bLooping = bAutoFire;
LoopingAnim = LoopSequence;
}
/** Blends out the fire animation
This event is called automatically for non-looping fire animations; otherwise it must be called manually */
event AnimStopFire(optional float SpecialBlendTime)
{
local AnimNodeSequence FireNode;
if (SpecialBlendTime == 0.0f)
{
SpecialBlendTime = BlendTime;
}
SetBlendTarget(0, SpecialBlendTime);
FireNode = AnimNodeSequence(Children[1].Anim);
if (FireNode != None)
{
FireNode.StopAnim();
}
bLooping = false;
}
defaultproperties
{
BlendTime=0.15
Children(0)=(Name="Not-Firing",Weight=1.0)
Children(1)=(Name="Firing")
bFixNumChildren=true
}

View File

@ -0,0 +1,52 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimNodeCopyBoneTranslation extends AnimNodeBlendBase
native(Animation);
/** Structure for duplicating bone information */
struct native BoneCopyInfo
{
var() Name SrcBoneName;
var() Name DstBoneName;
var const INT SrcBoneIndex;
var const INT DstBoneIndex;
};
var AnimNodeAimOffset CachedAimNode;
var name OldAimProfileName;
var() Array<BoneCopyInfo> DefaultBoneCopyArray;
var() Array<BoneCopyInfo> DualWieldBoneCopyArray;
var Array<BoneCopyInfo> ActiveBoneCopyArray;
/** Internal, array of required bones. Selected bones and their parents for local to component space transformation. */
var Array<byte> RequiredBones;
/** Cached list of UDKAnimNodeSeqWeap nodes - this node will call WeapTypeChanged when weapon type changes. */
var Array<UDKAnimNodeSeqWeap> SeqWeaps;
/** Cached list of UDKAnimBlendByWeapType nodes - this node will call WeapTypeChanged when weapon type changes. */
var Array<UDKAnimBlendByWeapType> WeapTypeBlends;
cpptext
{
// UObject interface
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent);
/** Update cached list of required bones, use to transform skeleton from parent space to component space. */
void UpdateListOfRequiredBones(FName AimProfileName);
// AnimNode interface
virtual void InitAnim(USkeletalMeshComponent* MeshComp, UAnimNodeBlendBase* Parent);
virtual void TickAnim(FLOAT DeltaSeconds);
virtual void GetBoneAtoms(FBoneAtomArray& Atoms, const TArray<BYTE>& DesiredBones, FBoneAtom& RootMotionDelta, INT& bHasRootMotion, FCurveKeyArray& CurveKeys);
}
defaultproperties
{
Children(0)=(Name="Input",Weight=1.0)
bFixNumChildren=TRUE
}

View File

@ -0,0 +1,13 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimNodeFramePlayer extends AnimNodeSequence
native(Animation);
native function SetAnimation(name Sequence, float RateScale);
native function SetAnimPosition(float Perc);
defaultproperties
{
}

View File

@ -0,0 +1,52 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimNodeJumpLeanOffset extends AnimNodeAimOffset
native(Animation);
/** Amount to activate the 'jump lean' node. */
var() float JumpLeanStrength;
/** How quickly the leaning can change. */
var() float MaxLeanChangeSpeed;
/** If we should invert the leaning when coming down. */
var() bool bMultiplyByZVelocity;
var AnimNodeAimOffset CachedAimNode;
var name OldAimProfileName;
/** Desired 'aim' to use, before being blended in/out by LeanWeight. */
var vector2D PreBlendAim;
var() bool bDodging;
var bool bOldDodging;
var() bool bDoubleJumping;
var bool bOldDoubleJumping;
/** Strength of leaning applied by this node. Updated over time based on LeanWeightTarget. */
var float LeanWeight;
/** Used for blending leaning in and out over time */
var float LeanWeightTarget;
/** Time to finish blending to LeanWeightTarget (seconds) */
var float BlendTimeToGo;
cpptext
{
virtual void InitAnim(USkeletalMeshComponent* meshComp, UAnimNodeBlendBase* Parent);
virtual void TickAnim(FLOAT DeltaSeconds);
}
/** Allows blending in and out of leaning over time. */
native final function SetLeanWeight( float WeightTarget, float BlendTime );
defaultproperties
{
LeanWeight=1.0
LeanWeightTarget=1.0
}

View File

@ -0,0 +1,21 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
* AnimNodeSequence which changes its animation based on the weapon anim type.
*/
class UDKAnimNodeSeqWeap extends UDKAnimNodeSequence
native(Animation);
var() name DefaultAnim;
var() name DualPistolAnim;
var() name SinglePistolAnim;
var() name ShoulderRocketAnim;
var() name StingerAnim;
cpptext
{
virtual FString GetNodeTitle();
void WeapTypeChanged(FName NewAimProfileName);
}

View File

@ -0,0 +1,37 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimNodeSequence extends AnimNodeSequence
native(Animation);
/** If true, this node will automatically start playing */
var() bool bAutoStart;
/** When a given sequence is finished, it will continue to select new sequences from this list */
var array<name> SeqStack;
/** If true, when the last sequence in the stack is reached, it will be looped */
var bool bLoopLastSequence;
cpptext
{
virtual void OnAnimEnd(FLOAT PlayedTime, FLOAT ExcessTime);
}
native function PlayAnimation(name Sequence, float SeqRate, bool bSeqLoop);
native function PlayAnimationSet(array<name> Sequences, float SeqRate, bool bLoopLast);
event OnInit()
{
Super.OnInit();
if (bAutoStart)
{
PlayAnim(bLooping, Rate);
}
}
defaultproperties
{
bCallScriptEventOnInit=TRUE
}

View File

@ -0,0 +1,67 @@
/**
* when this node becomes relevant, it selects an animation from its list based on the rotation of
* the given bone relative to the rotation of the owning actor
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKAnimNodeSequenceByBoneRotation extends AnimNodeSequence;
/** bone whose direction should be tested */
var() name BoneName;
/** axis of that bone to check */
var() EAxis BoneAxis;
/** list of animations to choose from */
struct AnimByRotation
{
/** desired rotation of the bone to play this animation */
var() rotator DesiredRotation;
/** the animation to play */
var() name AnimName;
};
var() array<AnimByRotation> AnimList;
event OnBecomeRelevant()
{
local vector BoneDirection;
local int i;
local float Diff, BestDiff;
local name BestAnim;
if (SkelComponent.Owner == None)
{
`warn("SkeletalMeshComponent has no Owner");
}
else if (BoneAxis == AXIS_NONE || BoneAxis == AXIS_BLANK)
{
`warn("Invalid Axis specified");
}
else
{
// get the bone's rotation relative to the owning actor
BoneDirection = SkelComponent.GetBoneAxis(BoneName, BoneAxis) >> SkelComponent.Owner.Rotation;
// find the animation in the list whose rotation is closest to the bone's
BestDiff = -1.0;
for (i = 0; i < AnimList.length; i++)
{
Diff = BoneDirection Dot vector(AnimList[i].DesiredRotation);
if (Diff > BestDiff)
{
BestAnim = AnimList[i].AnimName;
BestDiff = Diff;
}
}
// set to the best animation and make sure it starts from the beginning
SetAnim(BestAnim);
SetPosition(0.0f, false);
}
}
defaultproperties
{
BoneAxis=AXIS_X
bCallScriptEventOnBecomeRelevant=TRUE
}

322
UDKBase/classes/UDKBot.uc Normal file
View File

@ -0,0 +1,322 @@
/**
* AI Controller that simulates the behavior of a human player
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKBot extends AIController
native;
/** Squad this bot is in. Squads share the same goal, and handle AI planning. */
var UDKSquadAI Squad;
/** component that handles delayed calls ExecuteWhatToDoNext() to when triggered */
var UDKAIDecisionComponent DecisionComponent;
/** temporarily look at this actor (for e.g. looking at shock ball for combos) - only used when looking at enemy */
var Actor TemporaryFocus;
/** set when in ExecuteWhatToDoNext() so we can detect bugs where
* it calls WhatToDoNext() again and causes decision-making to happen every tick
*/
var bool bExecutingWhatToDoNext;
/** script flags that cause various events to be called to override C++ functionality */
var bool bScriptSpecialJumpCost;
/** used with route reuse to force the next route finding attempt to do the full path search */
var bool bForceRefreshRoute;
/** if set pass bRequestAlternateLoc = TRUE to GetTargetLocation() when determining FocalPoint from Focus */
var bool bTargetAlternateLoc;
var bool bEnemyInfoValid; // false when change enemy, true when LastSeenPos etc updated
var bool bEnemyIsVisible; /** Result of last enemy LineOfSightTo() check */
var bool bLeadTarget; // lead target with projectile attack
var bool bJumpOverWall; // true when jumping to clear obstacle
var bool bPlannedJump; // set when doing voluntary jump
/** bInDodgeMove is true if a bot is currently executing a dodge, and has not yet landed from it */
var bool bInDodgeMove;
/** bEnemyAcquired is true if the bot has been able to face the enemy directly. The bot has improved tracking after acquiring an enemy (uses AcquisitionYawRate instead of RotationRate to track enemy before acquired). */
var bool bEnemyAcquired;
/** triggers the bot to call DelayedLeaveVehicle() during its next tick - used in the 'non-blocking' case of LeaveVehicle() */
var bool bNeedDelayedLeaveVehicle;
/** if true, when pathfinding to the same RouteGoal as the last time, use old RouteCache if it's still valid and all paths on it usable */
var bool bAllowRouteReuse;
/** if not 255, bot always uses this fire mode - for scripting bot actions */
var byte ScriptedFireMode;
// caching visibility of enemies
var float EnemyVisibilityTime; /** When last enemy LineOfSightTo() check was done */
var pawn VisibleEnemy; /** Who the enemy was for the last LineOfSightTo() check */
/** Last vehicle which blocked the path of this bot */
var Vehicle LastBlockingVehicle;
/** Normally the current enemy. Reset SavedPositions if this changes. */
var Pawn CurrentlyTrackedEnemy;
struct native EnemyPosition
{
var vector Position;
var vector Velocity;
var float Time;
};
/** Position and velocity of enemy at previous ticks.
Used for smooth bot aiming prediction - bots aim at where they think the target is based on his position and velocity a few 100 msec ago, like a player. */
var array<EnemyPosition> SavedPositions;
/** velocity added while falling (bot tries to correct for it) */
var vector ImpactVelocity;
/** The bot uses AcquisitionYawRate instead of RotationRate to track enemy before acquired. */
var int AcquisitionYawRate;
/** distance at which bot will notice noises. */
var float HearingThreshold;
/** How long ahead to predict inventory respawns */
var float RespawnPredictionTime;
/** delay before act on warning about being shot at by InstantWarnTarget() or ReceiveProjectileWarning() */
var float WarningDelay;
/** Projectile bot has been warned about and will react to (should set in ReceiveProjectileWarning()) */
var Projectile WarningProjectile;
/** for monitoring the position of a pawn. Will receive a MonitoredPawnAlert() event if the MonitoredPawn is killed or no longer possessed,
or moves too far away from either MonitorStartLoc or the bot's position */
var vector MonitorStartLoc; // Location checked versus current MonitoredPawn position to see if it has moved too far
var Pawn MonitoredPawn; // Pawn being monitored
var float MonitorMaxDistSq; // Maximum distance the Monitored pawn can move before being considered too far away.
// enemy position information
var vector LastSeenPos; // enemy position when I last saw enemy (auto updated if EnemyNotVisible() enabled)
var vector LastSeeingPos; // position where I last saw enemy (auto updated if EnemyNotVisible() enabled)
var float LastSeenTime; // time at which last seen information was last updated.
/** Enemy tracking - bots use this for targeting their current enemy. Bots actually aim at a position based that's predicted based on the
target's position TrackingReactionTime ago, extrapolated using the target's velocity at that time.
This means, for example, that if a target suddenly changes directions, bots will miss because they'll fire at where they thought he was going
(until their reactio delay catches up */
var float TrackingReactionTime; /** How far back in time is bots model of enemy position based on */
var float BaseTrackingReactionTime; /** Base value, modified by skill to set TrackingReactionTime */
var vector TrackedVelocity; /** Current velocity estimate (lagged) of tracked enemy */
/** whether bot is currently using the squad alternate route - if false, FindPathToSquadRoute() just calls FindPathToward(Squad.RouteObjective) */
var bool bUsingSquadRoute;
/** if true, this bot uses the SquadAI's PreviousObjectiveRouteCache instead (used when the route changes while bot is following it) */
var bool bUsePreviousSquadRoute;
/** goal along squad's route, used when moving along alternate path via FindPathToSquadRoute() */
var NavigationPoint SquadRouteGoal;
/** Iterative aim correction in progress if set */
var pawn BlockedAimTarget;
/** pct lead for last targeting check */
var float LastIterativeCheck;
/* Aim update frequency. How frequently bots check whether their tracking aim needs to be adjusted for obstacles, etc. */
var float AimUpdateFrequency;
/** Last time tracking aim was updated */
var float LastAimUpdateTime;
/** how often aim error is updated when bot has a visible enemy */
var float ErrorUpdateFrequency;
/** last time aim error was updated */
var float LastErrorUpdateTime;
/** aim error value currently being used */
var float CurrentAimError;
/** expected min landing height of dodge. Hint used by bots to track whether they are about to miss their planned landing spot (if bInDodgeMove is true).
If so, the MissedDodge() event is triggered. */
var float DodgeLandZ;
/** avoid these spots when moving - used for very short term stationary hazards like bio goo or sticky grenades. */
var Actor FearSpots[2];
/** Likelihood that MayDodgeToMoveTarget() event is called when starting MoveToGoal(). */
var float DodgeToGoalPct;
/** jump Z velocity bot can gain using multijumps (not counting first jump) */
var float MultiJumpZ;
cpptext
{
DECLARE_FUNCTION(execPollWaitToSeeEnemy);
DECLARE_FUNCTION(execPollLatentWhatToDoNext);
UBOOL Tick( FLOAT DeltaSeconds, ELevelTick TickType );
virtual void UpdateEnemyInfo(APawn* AcquiredEnemy);
virtual void PrePollMove();
virtual void PostPollMove();
void CheckFears();
virtual void PreAirSteering(FLOAT DeltaTime);
virtual void PostAirSteering(FLOAT DeltaTime);
virtual void PostPhysFalling(FLOAT DeltaTime);
virtual UBOOL AirControlFromWall(FLOAT DeltaTime, FVector& RealAcceleration);
virtual UReachSpec* PrepareForMove(ANavigationPoint *NavGoal, UReachSpec* CurrentPath);
virtual void AdjustFromWall(FVector HitNormal, AActor* HitActor);
virtual void JumpOverWall(FVector WallNormal);
virtual void NotifyJumpApex();
virtual FRotator SetRotationRate(FLOAT deltaTime);
virtual DWORD LineOfSightTo(const AActor* Other, INT bUseLOSFlag = 0, const FVector* chkLocation = NULL, UBOOL bTryAlternateTargetLoc = FALSE);
FLOAT SpecialJumpCost(FLOAT RequiredJumpZ);
virtual UBOOL ForceReached(ANavigationPoint *Nav, const FVector& TestPosition);
virtual void UpdatePawnRotation();
virtual void MarkEndPoints(ANavigationPoint* EndAnchor, AActor* Goal, const FVector& GoalLocation);
virtual UBOOL OverridePathTo(ANavigationPoint* EndAnchor, AActor* Goal, const FVector& GoalLocation, UBOOL bWeightDetours, FLOAT& BestWeight);
virtual void FailMove();
// Seeing and hearing checks
virtual UBOOL ShouldCheckVisibilityOf(AController* C);
virtual DWORD SeePawn(APawn* Other, UBOOL bMaySkipChecks = TRUE);
virtual UBOOL CanHear(const FVector& NoiseLoc, FLOAT Loudness, AActor *Other);
virtual void HearNoise(AActor* NoiseMaker, FLOAT Loudness, FName NoiseType);
}
/**
* Used to determine which actor should be the focus of this bot (that he looks at while moving)
*/
function Actor FaceActor(float StrafingModifier);
/** entry point for AI decision making
* this gets executed during the physics tick so actions that could change the physics state (e.g. firing weapons) are not allowed
*/
protected event ExecuteWhatToDoNext();
/**
* Warning from vehicle that bot is about to be run over.
*/
event ReceiveRunOverWarning(UDKVehicle V, float projSpeed, vector VehicleDir);
/** return when looking directly at visible enemy */
native final latent function WaitToSeeEnemy();
/** encapsulates calling WhatToDoNext() and waiting for the tick-delayed decision making process to occur using UDKAIDecisionComponent */
native final latent function LatentWhatToDoNext();
/** assumes valid CurrentPath, tries to see if CurrentPath can be combined with path to A */
native final function bool CanMakePathTo(Actor A);
/**
* Searches the navigation network for a path that leads
* to nearby inventory pickups.
*/
native final function actor FindBestInventoryPath(out float MinWeight);
/**
* Returns shortest path to squad route (UTSquadAI.ObjectiveRouteCache), or next node along route
* if already on squad route
*/
native final function actor FindPathToSquadRoute(optional bool bWeightDetours);
/**
* Called by squadleader. Fills the squad's ObjectiveRouteCache.
* Builds upon previous attempts by adding cost to the routes
* in the SquadAI's SquadRoutes array, up to a maximum
* of MaxSquadRoutes iterations.
*/
native final function BuildSquadRoute();
/**
* Sets all available "super pickups" as possible destinations, and determines best one
* based on the value of and distance to the pickup (distance must be less than MaxDist).
* A super pickup is a PickupFactory with bIsSuperItem==true
* To be valid, it must be ready to pick up, or about to respawn (within this bot's RespawnPredictionTime)
* not blocked by a vehicle, and desireable to this bot (based on the SuperDesireability() event).
*/
native function Actor FindBestSuperPickup(float MaxDist);
/** triggers ExecuteWhatToDoNext() to occur during the next tick
* this is also where logic that is unsafe to do during the physics tick should be added
* @note: in state code, you probably want LatentWhatToDoNext() so the state is paused while waiting for ExecuteWhatToDoNext() to be called
*/
event WhatToDoNext();
/**
* Will receive a MonitoredPawnAlert() event if the MonitoredPawn is killed or no longer possessed,
* or moves too far away from either MonitorStartLoc or the bot's position
*/
event MonitoredPawnAlert();
/**
* If bot gets stuck trying to jump, then bCanDoubleJump is set false for the pawn
* Set a timer to reset the ability to double jump once the bot is clear.
*/
event TimeDJReset();
/*
Called when starting MoveToGoal(), based on DodgeToGoalPct
Know have CurrentPath, with end lower than start
*/
event MayDodgeToMoveTarget();
/** Called when bScriptSpecialJumpCost is true and the bot is considering a path to DestinationActor
* that requires a jump with JumpZ greater than the bot's normal capability, but less than MaxSpecialJumpZ
* calculates any additional distance that should be applied to this path to take into account preparation, etc
* @return true to override the cost with the value in the Cost out param, false to use the default natively-calculated cost
*/
event bool SpecialJumpCost(float RequiredJumpZ, out float Cost);
/*
* Called from native FindBestSuperPickup() to determine how desireable a specific super pickup
* is to this bot.
*/
event float SuperDesireability(PickupFactory P);
/*
* Aiming code requests an update to the aiming error periodically when tracking a target, based on ErrorUpdateFrequency.
*/
event float AdjustAimError(float TargetDist, bool bInstantProj );
/**
* If DodgeLandZ (expected min landing height of dodge) is missed when bInDodgeMove is true,
* the MissedDodge() event is triggered.
*/
event MissedDodge();
/* If ReceiveWarning caused WarningDelay to be set, this will be called when it times out
*/
event DelayedWarning();
/** called just before the AI's next tick if bNeedDelayedLeaveVehicle is true */
event DelayedLeaveVehicle();
defaultproperties
{
RotationRate=(Pitch=30000,Yaw=30000,Roll=2048)
RemoteRole=ROLE_None
Begin Object Class=UDKAIDecisionComponent Name=TheDecider
End Object
DecisionComponent=TheDecider
Components.Add(TheDecider)
AimUpdateFrequency=0.2
LastIterativeCheck=1.0
ErrorUpdateFrequency=0.45
bLeadTarget=True
AcquisitionYawRate=20000
TrackingReactionTime=+0.25
BaseTrackingReactionTime=+0.25
bUsingSquadRoute=true
bAllowRouteReuse=true
HearingThreshold=2800.0
}

View File

@ -0,0 +1,82 @@
/**
* Gameplay relevant carried object (such as a CTF Flag)
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKCarriedObject extends Actor
native
abstract
notplaceable;
/** Team this CarriedObject is associated with */
var repnotify TeamInfo Team;
/** Recent nearest path */
var const NavigationPoint LastAnchor;
/** last time a valid anchor was found */
var float LastValidAnchorTime;
/** The Skeletal Mesh of the flag */
var SkeletalMeshComponent SkelMesh;
/** Replicated to indicate whether this CarriedObject is in its HomeBase */
var repnotify bool bHome;
/** Game objective which acts as home base for this CarriedObject */
var UDKGameObjective HomeBase;
/** offset for placing object when at home */
var vector HomeBaseOffset;
// Keep track of our base-most actor.
var Actor OldBase;
var Actor OldBaseBase;
/** HUD Rendering (for minimap) - updated in SetHUDLocation() */
var vector HUDLocation;
cpptext
{
/*
* Special handling of network replication
*/
virtual void PostNetReceiveBase(AActor* NewBase);
virtual void PostNetReceiveLocation();
/*
* Route finding notifications (sent to target)
*/
virtual ANavigationPoint* SpecifyEndAnchor(APawn* RouteFinder);
virtual void NotifyAnchorFindingResult(ANavigationPoint* EndAnchor, APawn* RouteFinder);
virtual void TickSpecial(FLOAT DeltaSeconds);
virtual void ForceUpdateComponents(UBOOL bCollisionUpdate = FALSE,UBOOL bTransformOnly = TRUE);
}
replication
{
if (Role == ROLE_Authority)
bHome, HomeBase, Team;
}
/** function used to update where icon for this actor should be rendered on the HUD
* @param NewHUDLocation is a vector whose X and Y components are the X and Y components of this actor's icon's 2D position on the HUD
*/
simulated native function SetHUDLocation(vector NewHUDLocation);
/**
* Called from C++ if this carried object can't be reached by Pawn P
*/
event NotReachableBy(Pawn P);
/**
* Event called when there is a change in the base chain (base or the base of the base, etc.)
*/
simulated event OnBaseChainChanged();
/** GetTeamNum()
* returns teamindex of team with which this UDKCarriedObject is associated.
*/
simulated native function byte GetTeamNum();

View File

@ -0,0 +1,120 @@
/**
* UDK specific data store base class for online game searches.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKDataStore_GameSearchBase extends UIDataStore_OnlineGameSearch
native
abstract;
cpptext
{
/**
* Initializes the dataproviders for all of the various character parts.
*/
virtual void InitializeDataStore();
}
/** Reference to the dataprovider that will provide details for a specific search result. */
var transient UDKUIDataProvider_ServerDetails ServerDetailsProvider;
/**
* Registers the delegate with the online subsystem
*/
event Init()
{
Super.Init();
// since we have two game search data stores active at the same time, we'll need to register this delegate only when
// we're actively performing a search..
if ( GameInterface != None )
{
GameInterface.ClearFindOnlineGamesCompleteDelegate(OnSearchComplete);
}
}
/**
* Called to kick off an online game search and set up all of the delegates needed
*
* @param ControllerIndex the ControllerId for the player to perform the search for
* @param bInvalidateExistingSearchResults specify FALSE to keep previous searches (i.e. for other gametypes) in memory; default
* behavior is to clear all search results when switching to a different item in the game search list
*
* @return TRUE if the search call works, FALSE otherwise
*/
event bool SubmitGameSearch(byte ControllerIndex, optional bool bInvalidateExistingSearchResults=true)
{
local bool bResult;
// Set the function to call when the search is done
GameInterface.AddFindOnlineGamesCompleteDelegate(OnSearchComplete);
bResult = Super.SubmitGameSearch(ControllerIndex, bInvalidateExistingSearchResults);
if ( !bResult )
{
// should never return false, but just to be safe
GameInterface.ClearFindOnlineGamesCompleteDelegate(OnSearchComplete);
}
return bResult;
}
/**
* Called by the online subsystem when the game search has completed
*
* @param bWasSuccessful true if the async action completed without error, false if there was an error
*/
function OnSearchComplete(bool bWasSuccessful)
{
// regardless of whether the query was successful, if we don't have any queries pending, unregister the delegate
// so that we don't receive callbacks when the other game search data store is performing a query
if ( !HasOutstandingQueries(true) )
{
GameInterface.ClearFindOnlineGamesCompleteDelegate(OnSearchComplete);
}
Super.OnSearchComplete(bWasSuccessful);
}
/**
* @param bRestrictCheckToSelf if TRUE, will not check related game search data stores for outstanding queries.
*
* @return TRUE if a server list query was started but has not completed yet.
*/
function bool HasOutstandingQueries( optional bool bRestrictCheckToSelf )
{
local bool bResult;
local int i;
for ( i = 0; i < GameSearchCfgList.Length; i++ )
{
if ( GameSearchCfgList[i].Search != None && GameSearchCfgList[i].Search.bIsSearchInProgress )
{
bResult = true;
break;
}
}
return bResult;
}
/**
* @return TRUE if the current game search has completed a query.
*/
function bool HasExistingSearchResults()
{
local bool bQueryCompleted;
// ok, this is imprecise - we may have already issued a query, but no servers were found...
// could add a bool
if ( SelectedIndex >=0 && SelectedIndex < GameSearchCfgList.Length )
{
bQueryCompleted = GameSearchCfgList[SelectedIndex].Search.Results.Length > 0;
}
return bQueryCompleted;
}
defaultproperties
{
}

View File

@ -0,0 +1,62 @@
/**
* Base class for emitters which should be attached to the camera (for example blood effects across the screen)
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKEmitCameraEffect extends Emitter
abstract
native;
/** How far in front of the camera this emitter should live. */
var() protected float DistFromCamera;
/** Camera this emitter is attached to, will be notified when emitter is destroyed */
var protected UDKPlayerController Cam;
simulated event PostBeginPlay()
{
// render in front of all in world objects
ParticleSystemComponent.SetDepthPriorityGroup(SDPG_Foreground);
super.PostBeginPlay();
}
/**
* Tell camera to remove this effect when destroyed
*/
function Destroyed()
{
Cam.RemoveCameraEffect(self);
super.Destroyed();
}
/** Tell the emitter what camera it is attached to. */
function RegisterCamera( UDKPlayerController inCam )
{
Cam = inCam;
}
/** Given updated camera information, adjust this effect to display appropriately. */
native function UpdateLocation( const out vector CamLoc, const out rotator CamRot, float CamFOVDeg );
defaultproperties
{
Begin Object Name=ParticleSystemComponent0
End Object
// makes sure I tick after the camera
TickGroup=TG_DuringAsyncWork
DistFromCamera=90
LifeSpan=10.0f
bDestroyOnSystemFinish=true
bNetInitialRotation=true
bNoDelete=false
}

View File

@ -0,0 +1,121 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKEmitterPool extends EmitterPool
native;
/** info about attached explosion lights */
struct native AttachedExplosionLight
{
var UDKExplosionLight Light;
var Actor Base;
var vector RelativeLocation;
};
var array<AttachedExplosionLight> RelativeExplosionLights;
cpptext
{
virtual void TickSpecial(FLOAT DeltaTime);
}
/**
* Support for particle emitter LOD based on "drop detail" (when frame rate is low) and distance.
*/
function ParticleSystemComponent SpawnEmitter(ParticleSystem EmitterTemplate, vector SpawnLocation, optional rotator SpawnRotation, optional Actor AttachToActor, optional Actor InInstigator, optional int MaxDLEPooledReuses, optional bool bInheritScaleFromBase)
{
local PlayerController PC;
local int LODLevel;
local ParticleSystemComponent PSC;
if( EmitterTemplate == none )
{
`log( "UDKEmitterPool was passed a none EmitterTemplate" );
// ScriptTrace();
return none;
}
PSC = Super.SpawnEmitter(EmitterTemplate, SpawnLocation, SpawnRotation, AttachToActor, InInstigator, MaxDLEPooledReuses, bInheritScaleFromBase);
// reduce detail if low framerate
if (WorldInfo.bDropDetail)
{
LODLevel = 1;
}
// NVCHANGE_BEGIN: JCAO - Fix on override particle systems LOD settings
// Do not use EmitterTemplate any more, because it may be replaced by PhysX particle system override
else if (PSC.Template.LODDistances.length > 1)
{
// also reduce detail if all local players are too far away or effect is behind them
LODLevel = 1;
foreach LocalPlayerControllers(class'PlayerController', PC)
{
if ( PC.ViewTarget != None && VSize(PC.ViewTarget.Location - SpawnLocation) * PC.LODDistanceFactor < PSC.Template.LODDistances[1] &&
vector(PC.Rotation) dot (SpawnLocation - PC.ViewTarget.Location) >= 0.0 )
{
LODLevel = 0;
break;
}
}
}
// NVCHANGE_END: JCAO - Fix on Mutated particle systems LOD settings
PSC.SetLODLevel(LODLevel);
PSC.SetDepthPriorityGroup(SDPG_World);
return PSC;
}
/** hooked up to UDKExplosionLight's OnLightFinished delegate to clean it up */
function OnExplosionLightFinished(UDKExplosionLight Light)
{
local int i;
DetachComponent(Light);
i = RelativeExplosionLights.Find('Light', Light);
if (i != INDEX_NONE)
{
RelativeExplosionLights.Remove(i, 1);
}
}
/** creates an explosion light (currently not pooled) */
function UDKExplosionLight SpawnExplosionLight(class<UDKExplosionLight> LightClass, vector SpawnLocation, optional Actor AttachToActor)
{
local UDKExplosionLight Light;
local int i;
// AttachToActor is only for movement, so if it can't move, then there is no point in using it
if (AttachToActor != None && (AttachToActor.bStatic || !AttachToActor.bMovable))
{
AttachToActor = None;
}
Light = new(self) LightClass;
Light.SetTranslation(SpawnLocation);
Light.OnLightFinished = OnExplosionLightFinished;
AttachComponent(Light);
if (AttachToActor != None)
{
i = RelativeExplosionLights.length;
RelativeExplosionLights.length = i + 1;
RelativeExplosionLights[i].Light = Light;
RelativeExplosionLights[i].Base = AttachToActor;
RelativeExplosionLights[i].RelativeLocation = SpawnLocation - AttachToActor.Location;
}
return Light;
}
defaultproperties
{
Begin Object Name=ParticleSystemComponent0
bAcceptsLights=false
SecondsBeforeInactive=0
bOverrideLODMethod=true
LODMethod=PARTICLESYSTEMLODMETHOD_DirectSet
End Object
MaxActiveEffects=200
SMC_MIC_ReductionTime=2.0
IdealStaticMeshComponents=200
IdealMaterialInstanceConstants=200
}

View File

@ -0,0 +1,58 @@
/**
* Light that changes its radius, brightness, and color over its lifespan based on user specified points.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKExplosionLight extends PointLightComponent
native;
/** set false after frame rate dependent properties have been tweaked. */
var bool bCheckFrameRate;
/** used to initialize light properties from TimeShift on spawn so you don't have to update initial values in two places */
var bool bInitialized;
/** HighDetailFrameTime - if frame time is less than this (means high frame rate), force super high detail. */
var float HighDetailFrameTime;
/** Lifetime - how long this explosion has been going */
var float Lifetime;
/** Index into TimeShift array */
var int TimeShiftIndex;
struct native LightValues
{
var float StartTime;
var float Radius;
var float Brightness;
var color LightColor;
};
/** Specifies brightness, radius, and color of light at various points in its lifespan */
var() array<LightValues> TimeShift;
/**
* Reset light timeline position to start
*/
final native function ResetLight();
/** called when the light has burnt out */
delegate OnLightFinished(UDKExplosionLight Light);
cpptext
{
virtual void Attach();
virtual void Tick(FLOAT DeltaTime);
}
defaultproperties
{
HighDetailFrameTime=+0.015
bCheckFrameRate=true
Brightness=8
Radius=256
CastShadows=false
LightColor=(R=255,G=255,B=255,A=255)
}

View File

@ -0,0 +1,138 @@
//=============================================================================
// used to force UDKVehicles [of a certain class if wanted] in a certain direction
//
// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
//=============================================================================
class UDKForcedDirectionVolume extends PhysicsVolume
placeable
native;
/** Allows the ForceDirectionVolume to be limited to certain types of vehicles */
var() class<UDKVehicle> TypeToForce;
/** If true, doesn't affect hoverboards */
var() bool bIgnoreHoverboards;
/** For editing - specifies the forced direction */
var() const ArrowComponent Arrow;
/** if the vehicle is being affected by a force volume with this flag set, the player cannot exit the vehicle. */
var() bool bDenyExit;
/** Whether non-vehicle pawns should be blocked by this volume */
var() bool bBlockPawns;
/** Whether spectators should be blocked by this volume. */
var() bool bBlockSpectators;
/** Direction arrow is pointing */
var vector ArrowDirection;
/** Array of vehicles currently touching this volume */
var array<UDKVehicle> TouchingVehicles;
cpptext
{
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent);
UBOOL IgnoreBlockingBy( const AActor *Other ) const;
virtual void TickSpecial(FLOAT DeltaSeconds );
}
simulated function PostBeginPlay()
{
super.PostBeginPlay();
if ( !bBlockSpectators && (BrushComponent != None) )
{
BrushComponent.SetTraceBlocking(false,true);
}
}
event ActorEnteredVolume(Actor Other)
{
if ( PlayerController(Other) != None )
{
Other.FellOutOfWorld(None);
}
}
simulated event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
{
local UDKVehicle V;
Super.Touch(Other, OtherComp, HitLocation, HitNormal);
V = UDKVehicle(Other);
if ((V != None) && ClassIsChildOf(V.Class, TypeToForce) && V.OnTouchForcedDirVolume(self))
{
TouchingVehicles.AddItem(V);
if (bDenyExit)
{
V.bAllowedExit = false;
}
}
}
simulated event UnTouch(Actor Other)
{
local bool bInAnotherVolume;
local UDKForcedDirectionVolume AnotherVolume;
if (ClassIsChildOf(Other.class, TypeToForce))
{
TouchingVehicles.RemoveItem(UDKVehicle(Other));
if (bDenyExit)
{
foreach Other.TouchingActors(class'UDKForcedDirectionVolume', AnotherVolume)
{
if (AnotherVolume.bDenyExit)
{
bInAnotherVolume = true;
break;
}
}
if (!bInAnotherVolume)
{
UDKVehicle(Other).bAllowedExit = UDKVehicle(Other).default.bAllowedExit;
}
}
}
}
simulated function bool StopsProjectile(Projectile P)
{
return false;
}
defaultproperties
{
Begin Object Class=ArrowComponent Name=AC
ArrowColor=(R=150,G=100,B=150)
ArrowSize=5.0
AbsoluteRotation=true
bDisableAllRigidBody=false
End Object
Components.Add(AC)
Arrow=AC
TypeToForce=class'UDKVehicle'
Begin Object Name=BrushComponent0
CollideActors=true
BlockActors=true
BlockZeroExtent=true
BlockNonZeroExtent=true
BlockRigidBody=TRUE
RBChannel=RBCC_Untitled4
End Object
bPushedByEncroachers=FALSE
bMovable=FALSE
bWorldGeometry=false
bCollideActors=true
bBlockActors=true
bBlockSpectators=true
bStatic=false
bNoDelete=true
}

View File

@ -0,0 +1,16 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKGame extends SimpleGame
native;
cpptext
{
/**
* Initializes the supported game types for a level (its GameTypesSupportedOnThisMap) based on the level filename
* and the DefaultMapPrefixes array. Avoids LDs having to set supported game types up manually (needed for knowing what to cook).
*/
virtual void AddSupportedGameTypes(AWorldInfo* Info, const TCHAR* WorldFilename, TArray<FString>& AdditionalPackagesToCook) const;
}

View File

@ -0,0 +1,95 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKGameInteraction extends UIInteraction
native;
/** Semaphore for blocking UI input. */
var int BlockUIInputSemaphore;
cpptext
{
/**
* Check a key event received by the viewport.
*
* @param Viewport - The viewport which the key event is from.
* @param ControllerId - The controller which the key event is from.
* @param Key - The name of the key which an event occured for.
* @param Event - The type of event which occured.
* @param AmountDepressed - For analog keys, the depression percent.
* @param bGamepad - input came from gamepad (ie xbox controller)
*
* @return True to consume the key event, false to pass it on.
*/
virtual UBOOL InputKey(INT ControllerId,FName Key,EInputEvent Event,FLOAT AmountDepressed=1.f,UBOOL bGamepad=FALSE);
/**
* Check an axis movement received by the viewport.
*
* @param Viewport - The viewport which the axis movement is from.
* @param ControllerId - The controller which the axis movement is from.
* @param Key - The name of the axis which moved.
* @param Delta - The axis movement delta.
* @param DeltaTime - The time since the last axis update.
*
* @return True to consume the axis movement, false to pass it on.
*/
virtual UBOOL InputAxis(INT ControllerId,FName Key,FLOAT Delta,FLOAT DeltaTime, UBOOL bGamepad=FALSE);
/**
* Check a character input received by the viewport.
*
* @param Viewport - The viewport which the axis movement is from.
* @param ControllerId - The controller which the axis movement is from.
* @param Character - The character.
*
* @return True to consume the character, false to pass it on.
*/
virtual UBOOL InputChar(INT ControllerId,TCHAR Character);
}
/**
* @return Whether or not we should process input.
*/
native final function bool ShouldProcessUIInput() const;
/**
* Calls all of the UI input blocks and sees if we can unblock ui input.
*/
event ClearUIInputBlocks()
{
BlockUIInputSemaphore = 0;
}
/** Tries to block the input for the UI. */
event BlockUIInput(bool bBlock)
{
if(bBlock)
{
BlockUIInputSemaphore++;
}
else if(BlockUIInputSemaphore > 0)
{
BlockUIInputSemaphore--;
}
}
/* === Interaction interface === */
/**
* Called when the current map is being unloaded. Cleans up any references which would prevent garbage collection.
*/
function NotifyGameSessionEnded()
{
Super.NotifyGameSessionEnded();
// if a scene is closed before its opening animation completes, it can result in unmatched calls to BlockUIInput
// which will prevent the game from processing any input; so if we don't have any scenes open, make sure the
// semaphore is reset to 0
if ( !SceneClient.IsUIActive() )
{
ClearUIInputBlocks();
}
}

View File

@ -0,0 +1,87 @@
/**
*
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKGameObjective extends NavigationPoint
abstract
hidecategories(VehicleUsage)
native
nativereplication;
/** pre-calculated list of nearby NavigationPoints this objective is shootable from */
var array<NavigationPoint> ShootSpots;
/** if true, allow this objective to be unreachable as long as we could find some ShootSpots for it */
var bool bAllowOnlyShootable;
/** HUD Rendering (for minimap) - updated in SetHUDLocation() */
var vector HUDLocation;
/** Texture from which minimap icon for this objective should be grabbed */
var const Texture2D IconHudTexture;
/** Coordinates on IconHudTextures for this objective's minimap icon */
var TextureCoordinates IconCoords;
/** TeamIndex of team which defends this objective */
var repnotify byte DefenderTeamIndex;
/** Replicated notification of whether this objective is currently under attack */
var repnotify bool bUnderAttack;
cpptext
{
#if WITH_EDITOR
virtual void CheckForErrors();
virtual void SetNetworkID(INT InNetworkID);
#endif
INT* GetOptimizedRepList(BYTE* Recent, FPropertyRetirement* Retire, INT* Ptr, UPackageMap* Map, UActorChannel* Channel);
virtual void AddForcedSpecs(AScout* Scout);
}
replication
{
if ( (Role==ROLE_Authority) && bNetDirty )
DefenderTeamIndex, bUnderAttack;
}
/**
* Used for a notification chain when an objective changes
*/
function ObjectiveChanged();
/**
* Returns the actual viewtarget for this actor. Should be subclassed
*/
event actor GetBestViewTarget()
{
return self;
}
/**
* Should return true if bot controlled by C is considered "near" this objective
*/
function bool BotNearObjective(AIController C);
function TriggerFlagEvent(name EventType, Controller EventInstigator);
/** function used to update where icon for this actor should be rendered on the HUD
* @param NewHUDLocation is a vector whose X and Y components are the X and Y components of this actor's icon's 2D position on the HUD
*/
simulated native function SetHUDLocation(vector NewHUDLocation);
/**
* Draw this objective's icon on the HUD minimap
*/
simulated native function DrawIcon(Canvas Canvas, vector IconLocation, float IconWidth, float IconAlpha, UDKPlayerController PlayerOwner, LinearColor DrawColor);
/**
* Returns TeamIndex of Team currently associated with (defending) this objective.
*/
simulated native function byte GetTeamNum();
defaultproperties
{
bMustBeReachable=true
}

View File

@ -0,0 +1,26 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
/** Holds the settings that are common to all match types */
class UDKGameSettingsCommon extends OnlineGameSettings
native;
/**
* Converts a string to a hexified blob.
*
* @param InString String to convert.
* @param OutBlob Resulting blob
*
* @return Returns whether or not the string was converted.
*/
native static function bool StringToBlob(const out string InString, out string OutBlob);
/**
* Converts a hexified blob to a normal string.
*
* @param InBlob String to convert back.
*
* @return Returns whether or not the string was converted.
*/
native static function string BlobToString(const out string InBlob);

View File

@ -0,0 +1,24 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKGameViewportClient extends GameViewportClient
native
config(Game);
/** Name of localized files containing hints */
var string HintLocFileName;
/**
* Locates a random localized hint message string for the specified two categories.
* See UTGameViewportClient implementation, and UTGameUI.int for an example of use.
* In the localization file, the section will be LoadingHints_CategoryName
* For each category section, Hint_Count must be specified
* Each hit message should be prefixed by Hint_, followed by the index of that hint
*
* @param Category1Name Name of the first hint category we're interested in
* @param Category2Name Name of the second hint category we're interested in
*
* @return Returns random hint string for the specified game types
*/
native final function string LoadRandomLocalizedHintMessage( string Category1Name, string Category2Name );

65
UDKBase/classes/UDKHUD.uc Normal file
View File

@ -0,0 +1,65 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKHUD extends MobileHUD
native;
var font GlowFonts[2]; // 0 = the Glow, 1 = Text
/** How long should the pulse take total */
var float PulseDuration;
/** When should the pulse switch from Out to in */
var float PulseSplit;
/** How much should the text pulse - NOTE this will be added to 1.0 (so PulseMultipler 0.5 = 1.5) */
var float PulseMultiplier;
var FontRenderInfo TextRenderInfo;
/** Holds a reference to the font to use for a given console */
var font ConsoleIconFont;
/** Font used to display input binds when they aren't represented by an icon in ConsoleIconFont. */
var font BindTextFont;
/**
* Draw a glowing string
*/
native function DrawGlowText(string Text, float X, float Y, optional float MaxHeightInPixels=0.0, optional float PulseTime=-100.0, optional bool bRightJustified);
/** Convert a string with potential escape sequenced data in it to a font and the string that should be displayed */
native static function TranslateBindToFont(string InBindStr, out Font DrawFont, out string OutBindStr);
defaultproperties
{
JoystickBackground=Texture2D'MobileResources.T_MobileControls_texture'
JoystickBackgroundUVs=(U=0,V=0,UL=126,VL=126)
JoystickHat=Texture2D'MobileResources.T_MobileControls_texture'
JoystickHatUVs=(U=128,V=0,UL=78,VL=78)
ButtonImages(0)=Texture2D'MobileResources.HUD.MobileHUDButton3'
ButtonImages(1)=Texture2D'MobileResources.HUD.MobileHUDButton3'
ButtonUVs(0)=(U=0,V=0,UL=32,VL=32)
ButtonUVs(1)=(U=0,V=0,UL=32,VL=32)
TrackballBackground=none
TrackballTouchIndicator=Texture2D'MobileResources.T_MobileControls_texture'
TrackballTouchIndicatorUVs=(U=160,V=0,UL=92,VL=92)
SliderImages(0)=Texture2D'MobileResources.HUD.MobileHUDButton3'
SliderImages(1)=Texture2D'MobileResources.HUD.MobileHUDButton3'
SliderImages(2)=Texture2D'MobileResources.HUD.MobileHUDButton3'
SliderImages(3)=Texture2D'MobileResources.HUD.MobileHUDButton3'
SliderUVs(0)=(U=0,V=0,UL=32,VL=32)
SliderUVs(1)=(U=0,V=0,UL=32,VL=32)
SliderUVs(2)=(U=0,V=0,UL=32,VL=32)
SliderUVs(3)=(U=0,V=0,UL=32,VL=32)
ButtonFont = Font'EngineFonts.SmallFont'
ButtonCaptionColor=(R=0,G=0,B=0,A=255);
PulseDuration=0.33
PulseSplit=0.25
PulseMultiplier=0.5
}

View File

@ -0,0 +1,143 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
//=============================
// UDKJumppad - bounces players/bots up
//
//=============================
class UDKJumpPad extends NavigationPoint
native
hidecategories(VehicleUsage);
/** Pre-calculated initial jumping velocity to reach JumpTarget */
var vector JumpVelocity;
/** Target of jumppad - jumppad bounces you to this */
var() PathNode JumpTarget;
/** Sound that plays when jumppad is triggered */
var() SoundCue JumpSound;
/** How long the jump should take. Altering this value changes the JumpVelocity. */
var() float JumpTime;
/** How much air control the player should have while in the air off this pad. Less air control (even 0.0) is desireable for tight landings, since players will often accidentally air control themselves away from the target destination. */
var() float JumpAirControl;
/** Ambient sound associated with this jumppad. */
var AudioComponent JumpAmbientSound;
cpptext
{
#if WITH_EDITOR
virtual void addReachSpecs(AScout *Scout, UBOOL bOnlyChanged=0);
#endif
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent);
virtual void PostEditMove(UBOOL bFinished);
UBOOL CalculateJumpVelocity(AScout *Scout);
}
/**
* Touch called during move - Set PendingTouch so PostTouch() will be called after physics completes
*/
event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
{
if ( (UDKPawn(Other) == None) || (Other.Physics == PHYS_None) )
return;
PendingTouch = Other.PendingTouch;
Other.PendingTouch = self;
}
/**
* Update velocity after movement has completed, so it doesn't get stomped by physics update in progress.
*/
event PostTouch(Actor Other)
{
local UDKPawn P;
P = UDKPawn(Other);
if (P == None || P.Physics == PHYS_None || P.DrivenVehicle != None)
{
return;
}
if ( P.bNotifyStopFalling )
{
P.StoppedFalling();
}
// adjust facing direction and movetarget of bots
if ( UDKBot(P.Controller) != None )
{
if ( Other.GetGravityZ() > WorldInfo.DefaultGravityZ )
UDKBot(P.Controller).Focus = UDKBot(P.Controller).FaceActor(2);
else
P.Controller.Focus = JumpTarget;
P.Controller.Movetarget = JumpTarget;
if ( P.Physics != PHYS_Flying )
P.Controller.MoveTimer = 2.0;
P.DestinationOffset = 50;
}
if ( P.Physics == PHYS_Walking )
{
P.SetPhysics(PHYS_Falling);
P.bReadyToDoubleJump = true;
}
P.Velocity = JumpVelocity;
// adjust jumpvelocity if gravity is altered
if ( (WorldInfo.WorldGravityZ != WorldInfo.DefaultGravityZ) && (Other.GetGravityZ() == WorldInfo.WorldGravityZ) )
{
P.Velocity *= sqrt(Other.GetGravityZ()/WorldInfo.DefaultGravityZ);
}
P.AirControl = JumpAirControl;
P.Acceleration = vect(0,0,0);
if ( JumpSound != None )
P.PlaySound(JumpSound);
}
/**
* Hint for bots which want to use this jumppad
*/
event bool SuggestMovePreparation(Pawn Other)
{
local Vehicle V;
// can't use jumppad while in a vehicle
V = Vehicle(Other);
if (V != None)
{
V.DriverLeave(false);
}
return false;
}
defaultproperties
{
bDestinationOnly=true
bCollideActors=true
JumpTime=2.0
JumpAirControl=0.05
bHidden=false
bBlockedForVehicles=true
bMovable=false
bNoDelete=true
bStatic=false
bSpecialMove=true
Components.Remove(Sprite)
Components.Remove(Sprite2)
GoodSprite=None
BadSprite=None
Begin Object Name=CollisionCylinder
CollideActors=true
End Object
Begin Object Class=DynamicLightEnvironmentComponent Name=JumpPadLightEnvironment
bDynamic=FALSE
bCastShadows=FALSE
End Object
Components.Add(JumpPadLightEnvironment)
}

View File

@ -0,0 +1,12 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
* Reachspec class used by UDKJumpPads.
*/
class UDKJumpPadReachSpec extends UDKTrajectoryReachSpec
native;
cpptext
{
virtual FVector GetInitialVelocity();
virtual INT CostFor(APawn* P);
}

View File

@ -0,0 +1,121 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKKActorBreakable extends KActor
native;
/** If true, this vehicle has health */
var() bool bHasHealth;
/** If true, this will cause Damage on Encroachment (DOE) */
var() bool bDamageOnEncroachment;
/** If true bDamageOnEncroachment will reset when this actor sleeps or falls below a threshold */
var() bool bResetDOEWhenAsleep;
/** Should this KActor take damage when it encroaches*/
var() bool bTakeDamageOnEncroachment;
/** If true, this KActor will break when it causes damage */
var() bool bBreakWhenCausingDamage;
/** How much health this actor has before it's destroyed */
var() int Health;
/** How much damage this actor does upon contact */
var() int EncroachDamage_Other;
/** How much should it take */
var() int EncroachDamage_Self;
/** When causing damage, use this damage type */
var() class<DamageType> DmgTypeClass;
/** This is the velocity threshhold at which the DOE will reset. If set to 0, it will only reset on sleep */
var() int DOEResetThreshold;
/** Emitter template to use when this object breaks */
var() ParticleSystem BrokenTemplate;
/** Allows things to pass along a damage instigator */
var controller InstigatorController;
/** If true, this actor is broken and no longer functional */
var repnotify bool bBroken;
cpptext
{
// AActor interface
virtual void physRigidBody(FLOAT DeltaTime);
}
/**
* This delegate is called when this UDKKActorBreakable breaks
*/
delegate OnBreakApart();
/**
* This delegate is called when this UDKKActorBreakable encroaches on another actor
*/
delegate bool OnEncroach(actor Other);
event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
if ( bHasHealth )
{
Health -= Damage;
if ( Health < 0 )
{
BreakApart();
}
}
}
function bool EncroachingOn(Actor Other)
{
if ( OnEncroach(Other) )
return Super.EncroachingOn(Other);
if ( bDamageOnEncroachment && Other != InstigatorController && Other != InstigatorController.Pawn )
{
Other.TakeDamage(EncroachDamage_Other, InstigatorController, Location, Velocity, DmgTypeClass);
}
if ( bTakeDamageOnEncroachment && bHasHealth)
{
TakeDamage(EncroachDamage_Self, none ,Location, vect(0,0,0), DmgTypeClass);
}
return Super.EncroachingOn(Other);
}
function BreakApart()
{
SetPhysics(PHYS_None);
SetCollision(false,false,false);
StaticMeshComponent.SetHidden(true);
OnBreakApart();
if (WorldInfo.NetMode != NM_DedicatedServer && BrokenTemplate != none)
{
WorldInfo.MyEmitterPool.SpawnEmitter(BrokenTemplate, Location, Rotation);
}
bBroken = true;
bNetDirty = true;
}
simulated event ReplicatedEvent(name VarName)
{
if (VarName == 'bBroken')
{
BreakApart();
}
}
defaultproperties
{
DmgTypeClass=class'DmgType_Crushed'
DOEResetThreshold=40
}

View File

@ -0,0 +1,14 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKMapInfo extends MapInfo
native;
/** modifier to visibility/range calculations for AI (range is 0.0 to 1.0) */
var() float VisibilityModifier;
defaultproperties
{
VisibilityModifier=1.0
}

View File

@ -0,0 +1,89 @@
/**
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKMapMusicInfo extends Object
native
hidecategories(Object)
editinlinenew;
enum ECrossfadeType
{
CFT_BeginningOfMeasure,
CFT_EndOfMeasure
};
struct native MusicSegment
{
/** Tempo in Beats per Minute. This allows for the specific segement to have a different BPM **/
var() float TempoOverride;
/** crossfading always begins at the beginning of the measure **/
var ECrossfadeType CrossfadeRule;
/**
* How many measures it takes to crossfade to this MusicSegment
* (e.g. No matter which MusicSegement we are currently in when we crossfade to this one we will
* fade over this many measures.
**/
var() int CrossfadeToMeNumMeasuresDuration;
var() SoundCue TheCue;
structdefaultproperties
{
CrossfadeRule=CFT_BeginningOfMeasure;
CrossfadeToMeNumMeasuresDuration=1
}
};
struct native StingersForAMap
{
var() SoundCue Died;
var() SoundCue DoubleKill;
var() SoundCue EnemyGrabFlag;
var() SoundCue FirstKillingSpree;
var() SoundCue FlagReturned;
var() SoundCue GrabFlag;
var() SoundCue Kill;
var() SoundCue LongKillingSpree;
var() SoundCue MajorKill;
var() SoundCue MonsterKill;
var() SoundCue MultiKill;
var() SoundCue ReturnFlag;
var() SoundCue ScoreLosing;
var() SoundCue ScoreTie;
var() SoundCue ScoreWinning;
};
struct native MusicForAMap
{
/** Default Tempo in Beats per Minute. **/
var() float Tempo;
var() MusicSegment Action;
var() MusicSegment Ambient;
var() MusicSegment Intro;
var() MusicSegment Suspense;
var() MusicSegment Tension;
var() MusicSegment Victory;
};
/**
* This is the music for the map. Content folk will pick from the various sets of music that exist
* and then specify the music the map should have.
**/
var() MusicForAMap MapMusic;
/** These are the stingers for the map **/
var() StingersForAMap MapStingers;
defaultproperties
{
}

View File

@ -0,0 +1,186 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKMobileInputZone extends MobileInputZone;
/** Range around player that is considered a player touch */
var const float HoldPlayerDistance;
/** touches that are still being pressed down */
struct ActivePress
{
var int Handle;
var vector2d TouchLocation;
var float TouchTime;
};
var array<ActivePress> CurrentPresses;
/** The location that was traced to when deprojecting the screen position to the world */
var transient Vector TraceHitLocation;
/** last thing we tapped (for detecting double tap) */
var transient Actor LastTappedActor;
/** The time in seconds of the last time we performed an untouch event */
var transient float TimeOfLastUntouch;
/** Amount of time that a touch has been held on the player pawn */
var transient float PlayerTouchStartTime;
/** Returns true if we are touching the player pawn */
function bool IsTouchingPlayerPawn()
{
// HACK to check if we've touched the player pawn
return (InputOwner.Outer.Pawn != None && VSize2D(TraceHitLocation - InputOwner.Outer.Pawn.Location) < HoldPlayerDistance);
}
/** Returns the actor that was traced to from projecting to the world */
function TraceFromScreenToWorld(Vector2D ScreenPos, out Actor outHitActor, out vector OutHitLocation, optional vector Extent = vect(32,32,32))
{
local Actor HitActor, TestHitActor;
local vector CameraLoc, CameraDir, HitLocation, TestHitLocation, HitNormal;
LocalPlayer(InputOwner.Outer.Player).DeProject(ScreenPos, CameraLoc, CameraDir);
// see what is underneath the tap location in the world
foreach InputOwner.Outer.TraceActors(class'Actor', TestHitActor, TestHitLocation, HitNormal, CameraLoc + CameraDir * 8000.0, CameraLoc, Extent)
{
if (((!TestHitActor.bWorldGeometry && BlockingVolume(TestHitActor) == None) || HitActor == None) &&
(TestHitActor.bBlockActors || TestHitActor.bProjTarget || TouchableElement3D(TestHitActor) != None) &&
(Trigger(TestHitActor) == None) &&
(Pawn(TestHitActor) == None || Pawn(TestHitActor).Health > 0))
{
HitActor = TestHitActor;
HitLocation = TestHitLocation;
if (!HitActor.bWorldGeometry && BlockingVolume(TestHitActor) == None)
{
break;
}
}
}
outHitActor = HitActor;
OutHitLocation = HitLocation;
}
/** Handler for touch input */
function bool ProcessGameplayInput(MobileInputZone Zone, float DeltaTime, int Handle, ETouchType EventType, Vector2D TouchLocation)
{
local Vector2D RelLocation, ViewportSize;
local Actor TraceHitActor;
local int PressIndex;
local bool bRedundantInput;
LocalPlayer(InputOwner.Outer.Player).ViewportClient.GetViewportSize(ViewportSize);
// Get the screen space in terms of 0 to 1
RelLocation.X = TouchLocation.X / ViewportSize.X;
RelLocation.Y = TouchLocation.Y / ViewportSize.Y;
// Project and trace to see what we hit
TraceFromScreenToWorld(RelLocation, TraceHitActor, TraceHitLocation);
// If this is a touch we don't want to do anything except do some bookkeeping
// for delayed movement or double tapping
if (EventType == Touch_Began)
{
PressIndex = CurrentPresses.Add(1);
CurrentPresses[PressIndex].Handle = Handle;
CurrentPresses[PressIndex].TouchLocation = TouchLocation;
CurrentPresses[PressIndex].TouchTime = InputOwner.Outer.WorldInfo.TimeSeconds;
if (CurrentPresses.length > 1)
{
PlayerTouchStartTime = -1.f;
}
else
{
// Check if we are touching the player pawn
if (IsTouchingPlayerPawn())
{
PlayerTouchStartTime = InputOwner.Outer.WorldInfo.TimeSeconds;
}
else
{
PlayerTouchStartTime = -1.f;
}
}
}
else if (EventType == Touch_Ended || EventType == Touch_Cancelled)
{
PressIndex = CurrentPresses.Find('Handle', Handle);
`Log(LastTappedActor @ TraceHitActor @ TimeOfLastUntouch @ InputOwner.MobileDoubleTapTime @ PressIndex);
if (PressIndex != INDEX_NONE)
{
CurrentPresses.Remove(PressIndex, 1);
// See if we tapped on something we can interact with
if ( TraceHitActor != None && (TraceHitActor.bBlockActors || TraceHitActor.bProjTarget || TouchableElement3D(TraceHitActor) != None) &&
Trigger(TraceHitActor) == None && (Pawn(TraceHitActor) == None || Pawn(TraceHitActor).Health > 0) )
{
// send double tap on world geometry for area skills but not single tap
if ( LastTappedActor == TraceHitActor &&
InputOwner.Outer.WorldInfo.TimeSeconds < TimeOfLastUntouch + InputOwner.MobileDoubleTapTime )
{
if (TouchableElement3D(TraceHitActor) != None)
{
TouchableElement3D(TraceHitActor).HandleDoubleClick();
}
}
else if (!TraceHitActor.bWorldGeometry && BlockingVolume(TraceHitActor) == None)
{
if (PlayerTouchStartTime < 0.f)
{
if (TouchableElement3D(TraceHitActor) != None)
{
TouchableElement3D(TraceHitActor).HandleClick();
}
}
}
}
PlayerTouchStartTime = -1.f;
}
TimeOfLastUntouch = InputOwner.Outer.WorldInfo.TimeSeconds;
}
else if (EventType == Touch_Moved || EventType == Touch_Stationary)
{
PressIndex = CurrentPresses.Find('Handle', Handle);
if (PressIndex != INDEX_NONE)
{
// if this is a duplicate input, ignore it
if (CurrentPresses[PressIndex].TouchLocation == TouchLocation && CurrentPresses[PressIndex].TouchTime == InputOwner.Outer.WorldInfo.TimeSeconds)
{
bRedundantInput = true;
}
else
{
CurrentPresses[PressIndex].TouchLocation = TouchLocation;
CurrentPresses[PressIndex].TouchTime = InputOwner.Outer.WorldInfo.TimeSeconds;
}
}
if (!bRedundantInput)
{
// Next see if we tapped on something we can interact with
if ( EventType == Touch_Moved && TouchableElement3D(TraceHitActor) != None )
{
TouchableElement3D(TraceHitActor).HandleDragOver();
}
}
}
LastTappedActor = TraceHitActor;
// If we aren't touching the player pawn, clear PlayerTouchStartTime
if ( !IsTouchingPlayerPawn() )
{
PlayerTouchStartTime = -1.f;
}
return false;
}
defaultproperties
{
OnProcessInputDelegate=ProcessGameplayInput
HoldPlayerDistance=150.f
}

View File

@ -0,0 +1,34 @@
/**
* Special Particle system component that can handle rendering at a different FOV than the the world.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKParticleSystemComponent extends ParticleSystemComponent
native;
/** Used when a custom FOV is set to make sure the particles render properly using the custom FOV */
var public{private} const float FOV;
var public{private} const bool bHasSavedScale3D;
var public{private} const vector SavedScale3D;
cpptext
{
private:
/** Override LocalToWorld with custom FOV changes */
virtual void SetTransformedToWorld();
virtual void InitParticles();
}
/** This changes the FOV used for rendering the particle system component. A value of 0 means to use the default. */
native final function SetFOV(float NewFOV);
defaultproperties
{
bAcceptsLights=false
bOverrideLODMethod=true
LODMethod=PARTICLESYSTEMLODMETHOD_DirectSet
SecondsBeforeInactive=1.0f
}

542
UDKBase/classes/UDKPawn.uc Normal file
View File

@ -0,0 +1,542 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKPawn extends GamePawn
nativereplication
native;
var bool bReadyToDoubleJump;
var bool bRequiresDoubleJump; /** set by suggestjumpvelocity() */
var bool bCanDoubleJump;
var bool bNoJumpAdjust; // set to tell controller not to modify velocity of a jump/fall
var float MaxDoubleJumpHeight;
var int MultiJumpRemaining;
var int MaxMultiJump;
var int MultiJumpBoost;
var bool bIsHoverboardAnimPawn;
/** true when in ragdoll due to feign death */
var repnotify bool bFeigningDeath;
/*********************************************************************************************
* Custom gravity support
********************************************************************************************* */
var float CustomGravityScaling; // scaling factor for this pawn's gravity - reset when pawn lands/changes physics modes
var bool bNotifyStopFalling; // if true, StoppedFalling() is called when the physics mode changes from falling
/** whether this Pawn is invisible. Affects AI and also causes shadows to be disabled */
var repnotify bool bIsInvisible;
/** struct for list to map material types supported by an actor to impact sounds and effects */
struct native MaterialImpactEffect
{
var name MaterialType;
var SoundCue Sound;
var array<MaterialInterface> DecalMaterials;
/** How long the decal should last before fading out **/
var float DurationOfDecal;
/** MaterialInstance param name for dissolving the decal **/
var name DecalDissolveParamName;
var float DecalWidth;
var float DecalHeight;
var ParticleSystem ParticleTemplate;
StructDefaultProperties
{
DurationOfDecal=24.0
DecalDissolveParamName="DissolveAmount"
}
};
/** Struct for list to map materials to sounds, for sound only applications (e.g. tires) */
struct native MaterialSoundEffect
{
var name MaterialType;
var SoundCue Sound;
};
/** Struct for list to map materials to a particle effect */
struct native MaterialParticleEffect
{
var name MaterialType;
var ParticleSystem ParticleTemplate;
};
/** this is used for a few special cases where we wanted a completely new particle system at certain distances
* instead of just turning off an emitter or two inside a single one
*/
struct native DistanceBasedParticleTemplate
{
/** the template to use */
var ParticleSystem Template;
/** the minimum distance all local players must be from the spawn location for this template to be used */
var float MinDistance;
};
/** Struct used for communicating info to play an emote from server to clients. */
struct native PlayEmoteInfo
{
var name EmoteTag;
var int EmoteID;
var bool bNewData;
};
/** replicated information on a hit we've taken */
struct native UTTakeHitInfo
{
/** the amount of damage */
var int Damage;
/** the location of the hit */
var vector HitLocation;
/** how much momentum was imparted */
var vector Momentum;
/** the damage type we were hit with */
var class<DamageType> DamageType;
/** the bone that was hit on our Mesh (if any) */
var name HitBone;
};
/** Structure containing information about a specific emote */
struct native EmoteInfo
{
/** Category to which this emote belongs. */
var name CategoryName;
/** This is a unique tag used to look up this emote */
var name EmoteTag;
/** Friendly name of this emote (eg for menu) */
var localized string EmoteName;
/** Name of animation to play. Should be in AnimSets above. */
var name EmoteAnim;
/** Indicates that this is a whole body 'victory' emote which should only be offered at the end of the game. */
var bool bVictoryEmote;
/** Emote should only be played on top half of body. */
var bool bTopHalfEmote;
/** The command that goes with this emote */
var name Command;
/** if true, the command requires a PRI */
var bool bRequiresPlayer;
};
/** Used to replicate on emote to play. */
var repnotify PlayEmoteInfo EmoteRepInfo;
/** Last time emote was played. */
var float LastEmoteTime;
/** Controls how often you can send an emote. */
var float MinTimeBetweenEmotes;
/** Use to replicate to clients when someone goes through a big teleportation. */
var repnotify byte BigTeleportCount;
var repnotify UTTakeHitInfo LastTakeHitInfo;
/** stop considering LastTakeHitInfo for replication when world time passes this (so we don't replicate out-of-date hits when pawns become relevant) */
var float LastTakeHitTimeout;
var repnotify float FireRateMultiplier; /** affects firing rate of all weapons held by this pawn. */
var repnotify float HeadScale;
/** Whether to smoothly interpolate pawn position corrections on clients based on received location updates */
var bool bSmoothNetUpdates;
/** Maximum location correction distance for which other pawn positions on a client will be smoothly updated */
var float MaxSmoothNetUpdateDist;
/** If the updated location is more than NoSmoothNetUpdateDist from the current pawn position on the client, pop it to the updated location.
If it is between MaxSmoothNetUpdateDist and NoSmoothNetUpdateDist, pop to MaxSmoothNetUpdateDist away from the updated location */
var float NoSmoothNetUpdateDist;
/** How long to take to smoothly interpolate from the old pawn position on the client to the corrected one sent by the server. Must be > 0.0 */
var float SmoothNetUpdateTime;
/** Used for position smoothing in net games */
var vector MeshTranslationOffset;
var float OldZ; // Old Z Location - used for eyeheight smoothing
/** The weapon overlay meshes need to be controlled by the pawn due to replication. We use */
/** a bitmask to describe what effect needs to be overlay. */
/** */
/** 0x00 = No Overlays */
/** bit 0 (0x01) = Damage Amp */
/** bit 1 (0x02) = Berserk */
/** */
/** Use SetWeaponOverlayFlag() / ClearWeaponOverlayFlag to adjust */
var repnotify byte WeaponOverlayFlags;
/** set when pawn is putting away its current weapon, for playing 3p animations - access with Set/GetPuttingDownWeapon() */
var protected repnotify bool bPuttingDownWeapon;
/** pawn ambient sound (for powerups and such) */
var protected AudioComponent PawnAmbientSound;
/** ambient cue played on PawnAmbientSound component; automatically replicated and played on clients. Access via SetPawnAmbientSound() / GetPawnAmbientSound() */
var protected repnotify SoundCue PawnAmbientSoundCue;
/** base vehicle pawn is in, used when the pawn is driving a UTWeaponPawn as those don't get replicated to non-owning clients */
struct native DrivenWeaponPawnInfo
{
/** base vehicle we're in */
var UDKVehicle BaseVehicle;
/** seat of that vehicle */
var byte SeatIndex;
/** ref to PRI since our PlayerReplicationInfo variable will be None while in a vehicle */
var PlayerReplicationInfo PRI;
};
var repnotify DrivenWeaponPawnInfo DrivenWeaponPawn;
/** separate replicated ambient sound for weapon firing - access via SetWeaponAmbientSound() / GetWeaponAmbientSound() */
var protected AudioComponent WeaponAmbientSound;
var protected repnotify SoundCue WeaponAmbientSoundCue;
var repnotify Material ReplicatedBodyMaterial;
/** This is the actual Material Instance that is used to affect the colors */
var protected array<MaterialInstanceConstant> BodyMaterialInstances;
/** material that is overlayed on the pawn via a separate slightly larger scaled version of the pawn's mesh
* Use SetOverlayMaterial() / GetOverlayMaterial() to access. */
var protected repnotify MaterialInterface OverlayMaterialInstance;
var SkelControlSingleBone RootRotControl;
var AnimNodeAimOffset AimNode;
var GameSkelCtrl_Recoil GunRecoilNode;
var GameSkelCtrl_Recoil LeftRecoilNode;
var GameSkelCtrl_Recoil RightRecoilNode;
/** Bots which are currently tracking this pawn, and need their target position history (SavedPositions array) updated */
var array<UDKBot> Trackers;
/** How long will it take for the current Body Material to fade out */
var float BodyMatFadeDuration;
/** This is the current Body Material Color with any fading applied in */
var LinearColor CurrentBodyMatColor;
/** how much time is left on this material */
var float RemainingBodyMatDuration;
/** This variable is used for replication of the value to remove clients */
var repnotify float ClientBodyMatDuration;
/** This is the color that will be applied */
var LinearColor BodyMatColor;
/** Replicate BodyMatColor as rotator to save bandwidth */
var repnotify rotator CompressedBodyMatColor;
/** true while playing feign death recovery animation */
var bool bPlayingFeignDeathRecovery;
/** Whether this pawn can play a falling impact. Set to false upon the fall, but getting up should reset it */
var bool bCanPlayFallingImpacts;
/** time above bool was set to true (for time out)*/
var float StartFallImpactTime;
/** name of the torso bone for playing impacts*/
var name TorsoBoneName;
/** sound to be played by Falling Impact*/
var SoundCue FallImpactSound;
/** Speed change that must be realized to trigger a fall sound*/
var float FallSpeedThreshold;
/** Temp blob shadow */
var StaticMeshComponent BlobShadow;
/** mesh for overlay - should not be added to Components array in defaultproperties */
var protected SkeletalMeshComponent OverlayMesh;
/*********************************************************************************************
* Foot placement IK system
********************************************************************************************* */
var name LeftFootBone, RightFootBone;
var name LeftFootControlName, RightFootControlName;
var float BaseTranslationOffset;
var float CrouchTranslationOffset;
var float OldLocationZ;
var bool bEnableFootPlacement;
var const float ZSmoothingRate;
/** if the pawn is farther than this away from the viewer, foot placement is skipped */
var float MaxFootPlacementDistSquared;
/** cached references to skeletal controllers for foot placement */
var SkelControlFootPlacement LeftLegControl, RightLegControl;
/** cached references to skeletal control for hand IK */
var SkelControlLimb LeftHandIK;
var SkelControlLimb RightHandIK;
/** material parameter containing damage overlay color */
var name DamageParameterName;
/** material parameter containing color saturation multiplier (for reducing to account for zoom) */
var name SaturationParameterName;
/** If true, call postrenderfor() even if on different team */
var bool bPostRenderOtherTeam;
/** Last time trace test check for drawing postrender beacon was performed */
var float LastPostRenderTraceTime;
/** Maximum distance from camera position for this pawn to have its beacon displayed on the HUD */
var(TeamBeacon) float TeamBeaconMaxDist;
/** last time Pawn was falling and had non-zero velocity
* used to detect a rare bug where pawns get just barely embedded in a mesh and fall forever
*/
var float StartedFallingTime;
/** Slope boosting is allowed on surfaces with a physical material whose friction is lower than this value.
Slope boosting is the ability to slide up steep slopes that the pawn jumps into. */
var float SlopeBoostFriction;
/*********************************************************************************************
Animation
********************************************************************************************* */
/** Used by UDKAnimBlendByFlying */
var AnimNodeAimOffset FlyingDirOffset;
/** how much pawn should lean into turns */
var int MaxLeanRoll;
/** speed at which physics is blended out when bPlayingFeignDeathRecovery is true (amount subtracted from PhysicsWeight per second) */
var float FeignDeathPhysicsBlendOutSpeed;
/** Translation applied to skeletalmesh when swimming */
var(Swimming) float SwimmingZOffset;
/** Speed to apply swimming z translation. */
var(Swimming) float SwimmingZOffsetSpeed;
var float CrouchMeshZOffset;
/** if set, blend Mesh PhysicsWeight to 0.0 in C++ and call TakeHitBlendedOut() event when finished */
var bool bBlendOutTakeHitPhysics;
/** speed at which physics is blended out when bBlendOutTakeHitPhysics is true (amount subtracted from PhysicsWeight per second) */
var float TakeHitPhysicsBlendOutSpeed;
/*********************************************************************************************
First person view
********************************************************************************************* */
/** First person view left and right arm meshes */
var UDKSkeletalMeshComponent ArmsMesh[2];
/*********************************************************************************************
Aiming
********************************************************************************************* */
/** Current yaw of the mesh root. This essentially lags behind the actual Pawn rotation yaw. */
var int RootYaw;
/** Output - how quickly RootYaw is changing (unreal rot units per second). */
var float RootYawSpeed;
/** How far RootYaw differs from Rotation.Yaw before it is rotated to catch up. */
var() int MaxYawAim;
/** 2D vector indicating aim direction relative to Pawn rotation. +/-1.0 indicating 180 degrees. */
var vector2D CurrentSkelAim;
/** if true, UpdateEyeheight() will get called every tick */
var bool bUpdateEyeheight;
/* Replicated when torn off body should gib */
var bool bTearOffGibs;
/** HUD Rendering (for minimap) - updated in SetHUDLocation() */
var vector HUDLocation;
cpptext
{
virtual UBOOL TryJumpUp(FVector Dir, FVector Destination, DWORD TraceFlags, UBOOL bNoVisibility);
virtual ETestMoveResult FindJumpUp(FVector Direction, FVector &CurrentPosition);
virtual INT calcMoveFlags();
virtual FLOAT DampenNoise(AActor* NoiseMaker, FLOAT Loudness, FName NoiseType=NAME_None );
void RequestTrackingFor(AUDKBot *Bot);
virtual void TickSpecial( FLOAT DeltaSeconds );
virtual void TickSimulated( FLOAT DeltaSeconds );
virtual UBOOL SetHighJumpFlag();
UBOOL UseFootPlacementThisTick();
void EnableFootPlacement(UBOOL bEnabled);
void DoFootPlacement(FLOAT DeltaSeconds);
FLOAT GetGravityZ();
void setPhysics(BYTE NewPhysics, AActor *NewFloor, FVector NewFloorV);
virtual FVector CalculateSlopeSlide(const FVector& Adjusted, const FCheckResult& Hit);
virtual UBOOL ShouldTrace(UPrimitiveComponent* Primitive, AActor* SourceActor, DWORD TraceFlags);
virtual UBOOL IgnoreBlockingBy(const AActor* Other) const;
virtual void performPhysics(FLOAT DeltaSeconds);
virtual void physFalling(FLOAT deltaTime, INT Iterations);
virtual UBOOL HasAudibleAmbientSound(const FVector& SrcLocation);
INT* GetOptimizedRepList( BYTE* InDefault, FPropertyRetirement* Retire, INT* Ptr, UPackageMap* Map, UActorChannel* Channel );
// camera
virtual void UpdateEyeHeight(FLOAT DeltaSeconds);
virtual void physicsRotation(FLOAT deltaTime, FVector OldVelocity);
virtual void SmoothCorrection(const FVector& OldLocation);
protected:
virtual void CalcVelocity(FVector &AccelDir, FLOAT DeltaTime, FLOAT MaxSpeed, FLOAT Friction, INT bFluid, INT bBrake, INT bBuoyant);
}
replication
{
// replicated properties
if ( bNetOwner && bNetDirty )
FireRateMultiplier;
if ( bNetDirty )
bFeigningDeath,
HeadScale, WeaponAmbientSoundCue, ReplicatedBodyMaterial,
WeaponOverlayFlags,BigTeleportCount,
CustomGravityScaling, bIsInvisible, ClientBodyMatDuration, CompressedBodyMatColor, PawnAmbientSoundCue, OverlayMaterialInstance;
if(bNetDirty && WorldInfo.TimeSeconds - LastEmoteTime <= MinTimeBetweenEmotes)
EmoteRepInfo;
if (bNetDirty && WorldInfo.TimeSeconds < LastTakeHitTimeout)
LastTakeHitInfo;
if (bNetDirty && !bNetOwner)
DrivenWeaponPawn, bPuttingDownWeapon;
// variable sent to all clients when Pawn has been torn off. (bTearOff)
if( bTearOff && bNetDirty )
bTearOffGibs;
}
/**
* Get height/radius of big cylinder around this actors colliding components.
* UDKPawn version returns its CylinderComponent's CollisionRadius and Collision Height, rather than calling GetComponentsBoundingBox().
*/
native function GetBoundingCylinder(out float CollisionRadius, out float CollisionHeight) const;
/**
* Go back to using CollisionComponent in use before ragdolling. Uses saved PreRagdollCollisionComponent property
*/
native function RestorePreRagdollCollisionComponent();
/** Util that makes sure the overlay component is last in the AllComponents array. */
native function EnsureOverlayComponentLast();
/**
* @param RequestedBy - the Actor requesting the target location
* @param bRequestAlternateLoc (optional) - return a secondary target location if there are multiple
* @return the optimal location to fire weapons at this actor
*/
native simulated function vector GetTargetLocation(optional actor RequestedBy, optional bool bRequestAlternateLoc) const;
/**
@RETURN true if pawn is invisible to AI
*/
native function bool IsInvisible();
/**
* Attach GameObject to mesh.
* @param GameObj : Game object to hold
*/
simulated event HoldGameObject(UDKCarriedObject UDKGameObj);
event StoppedFalling()
{
CustomGravityScaling = 1.0;
bNotifyStopFalling = false;
}
/**
* Event called from native code when Pawn stops crouching.
* Called on non owned Pawns through bIsCrouched replication.
* Network: ALL
*
* @param HeightAdjust height difference in unreal units between default collision height, and actual crouched cylinder height.
*/
simulated event EndCrouch(float HeightAdjust)
{
OldZ += HeightAdjust;
Super.EndCrouch(HeightAdjust);
// offset mesh by height adjustment
CrouchMeshZOffset = 0.0;
}
/**
* Event called from native code when Pawn starts crouching.
* Called on non owned Pawns through bIsCrouched replication.
* Network: ALL
*
* @param HeightAdjust height difference in unreal units between default collision height, and actual crouched cylinder height.
*/
simulated event StartCrouch(float HeightAdjust)
{
OldZ -= HeightAdjust;
Super.StartCrouch(HeightAdjust);
// offset mesh by height adjustment
CrouchMeshZOffset = HeightAdjust;
}
/**
SuggestJumpVelocity()
returns true if succesful jump from start to destination is possible
returns a suggested initial falling velocity in JumpVelocity
Uses GroundSpeed and JumpZ as limits
*/
native function bool SuggestJumpVelocity(out vector JumpVelocity, vector Destination, vector Start, optional bool bRequireFallLanding);
/** function used to update where icon for this actor should be rendered on the HUD
* @param NewHUDLocation is a vector whose X and Y components are the X and Y components of this actor's icon's 2D position on the HUD
*/
simulated native function SetHUDLocation(vector NewHUDLocation);
/**
* Hook to allow actors to render HUD overlays for themselves.
* Assumes that appropriate font has already been set
*/
simulated native function NativePostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir);
/**
* Stub to allow changing the visibility of the third person weapon attachment
*/
simulated function SetWeaponAttachmentVisibility(bool bAttachmentVisible);
/** Stub: implement functionality to enable or disable IK that keeps hands on IK bones. */
simulated function SetHandIKEnabled(bool bEnabled);
/** called when bPlayingFeignDeathRecovery and interpolating our Mesh's PhysicsWeight to 0 has completed
* starts the recovery anim playing
*/
simulated event StartFeignDeathRecoveryAnim();
/** called when bBlendOutTakeHitPhysics is true and our Mesh's PhysicsWeight has reached 0.0 */
simulated event TakeHitBlendedOut();
/* UpdateEyeHeight()
* Update player eye position, based on smoothing view while moving up and down stairs, and adding view bobs for landing and taking steps.
* Called every tick only if bUpdateEyeHeight==true.
*/
event UpdateEyeHeight( float DeltaTime );
/** called when we have been stuck falling for a long time with zero velocity
* and couldn't find a place to move to get out of it
*/
event StuckFalling();
defaultproperties
{
CustomGravityScaling=1.0
MaxYawAim=7000
bSmoothNetUpdates=true
MaxSmoothNetUpdateDist=84.0
NoSmoothNetUpdateDist=128.0
SmoothNetUpdateTime=0.125
}

View File

@ -0,0 +1,119 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKPickupFactory extends PickupFactory
abstract
native
nativereplication
hidecategories(Display,Collision,PickupFactory);
var repnotify bool bIsRespawning;
/** When set to true, this base will begin pulsing its emissive */
var repnotify bool bPulseBase;
/** In disabled state */
var repnotify bool bIsDisabled;
/** pickup base mesh */
var transient StaticMeshComponent BaseMesh;
/** Used to pulse the emissive on the base */
var MaterialInstanceConstant BaseMaterialInstance;
/** The baseline material colors */
var LinearColor BaseBrightEmissive; // When the pickup is on the base
var LinearColor BaseDimEmissive; // When the pickup isn't on the base
/** How fast does the base pulse */
var float BasePulseRate;
/** How much time left in the current pulse */
var float BasePulseTime;
/** This pickup base will begin pulsing when there are PulseThreshold seconds left before respawn. */
var float PulseThreshold;
/** The TargetEmissive Color */
var LinearColor BaseTargetEmissive;
var LinearColor BaseEmissive;
/** This material instance parameter for adjusting the emissive */
var name BaseMaterialParamName;
var bool bFloatingPickup; // if true, the pickup mesh floats (bobs) slightly
var bool bRandomStart; // if true, this pickup will start at a random height
var float BobTimer; // Tracks the bob time. Used to create the position
var float BobOffset; // How far to bob. It will go from +/- this number
var float BobSpeed; // How fast should it bob
var float BobBaseOffset; // The base offset (Translation.Y) cached
var bool bRotatingPickup; // if true, the pickup mesh rotates
var float YawRotationRate;
/** whether this pickup is updating */
var bool bUpdatingPickup;
/** Translation of pivot point */
var vector PivotTranslation;
/** Determines whether this pickup fades in or not when respawning. */
var bool bDoVisibilityFadeIn;
var name VisibilityParamName;
/** holds the pickups material so parameters can be set **/
var MaterialInstanceConstant MIC_Visibility;
/** holds the pickups 2nd material so parameters can be set **/
var MaterialInstanceConstant MIC_VisibilitySecondMaterial;
/** the glowing effect that comes from the base on spawn. */
var ParticleSystemComponent Glow;
var name GlowEmissiveParam;
/** extra spinning component (rotated in C++ when visible) */
var PrimitiveComponent Spinner;
/** spinning particles (rotated in C++ when visible) */
var UDKParticleSystemComponent SpinningParticleEffects;
cpptext
{
virtual void TickSpecial( FLOAT DeltaSeconds );
virtual void PostEditMove(UBOOL bFinished);
virtual void Spawned();
INT* GetOptimizedRepList( BYTE* InDefault, FPropertyRetirement* Retire, INT* Ptr, UPackageMap* Map, UActorChannel* Channel );
}
replication
{
if ( bNetDirty && (Role == Role_Authority) )
bPulseBase,bIsRespawning;
if (bNetInitial && ROLE==ROLE_Authority )
bIsDisabled;
}
/**
* Make pickup mesh and associated effects visible.
*/
simulated function SetPickupVisible()
{
if(SpinningParticleEffects != none)
{
SpinningParticleEffects.SetActive(true);
}
super.SetPickupVisible();
}
/**
* Make pickup mesh and associated effects hidden.
*/
simulated function SetPickupHidden()
{
if(SpinningParticleEffects != none)
SpinningParticleEffects.DeactivateSystem();
super.SetPickupHidden();
}

View File

@ -0,0 +1,141 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKPlayerController extends GamePlayerController
native;
/** plays camera animations (mostly used for viewshakes) */
var CameraAnimInst CameraAnimPlayer;
/** The effect to play on the camera **/
var UDKEmitCameraEffect CameraEffect;
/** indicates whether this player is a dedicated server spectator (so disable rendering and don't allow it to participate at all) */
var bool bDedicatedServerSpectator;
/** makes playercontroller hear much better (used to magnify hit sounds caused by player) */
var bool bAcuteHearing;
/** current offsets applied to the camera due to camera anims, etc */
var vector ShakeOffset; // current magnitude to offset camera position from shake
var rotator ShakeRot; // current magnitude to offset camera rotation from shake
/** stores post processing settings applied by the camera animation
* applied additively to the default post processing whenever a camera anim is playing
*/
var PostProcessSettings CamOverridePostProcess;
/** additional post processing settings modifier that can be applied
* @note: defaultproperties for this are hardcoded to zeroes in C++
*/
var PostProcessSettings PostProcessModifier;
/** Actors which may be hidden dynamically when rendering (by adding to PlayerController.HiddenActors array) */
var array<Actor> PotentiallyHiddenActors;
/** If true, player is on a console (used by C++) */
var bool bConsolePlayer;
/** Custom scaling for vehicle check radius. Used by UTConsolePlayerController for example */
var float VehicleCheckRadiusScaling;
var float PulseTimer;
var bool bPulseTeamColor;
/** if true, rotate smoothly to desiredrotation */
var bool bUsePhysicsRotation;
struct native ObjectiveAnnouncementInfo
{
/** the default announcement sound to play (can be None) */
var() SoundNodeWave AnnouncementSound;
/** text displayed onscreen for this announcement */
var() localized string AnnouncementText;
};
cpptext
{
virtual UBOOL Tick( FLOAT DeltaSeconds, ELevelTick TickType );
// WWISEMODIF_START
virtual UBOOL HearSound(UAkBaseSoundObject* InSoundCue, AActor* SoundPlayer, const FVector& SoundLocation, UBOOL bStopWhenOwnerDestroyed);
// WWISEMODIF_END
virtual UBOOL MoveWithInterpMoveTrack(UInterpTrackMove* MoveTrack, UInterpTrackInstMove* MoveInst, FLOAT CurTime, FLOAT DeltaTime);
virtual void BlendPostProcessSettings(FPostProcessSettings& PPSettings, const FPostProcessSettings& PPSettingsA, const FPostProcessSettings& PPSettingsB, const FLOAT BlendWeight) const;
virtual void AddPostProcessSettings(FPostProcessSettings& PPSettings, const FPostProcessSettings& PPSettingsA) const;
virtual void ModifyPostProcessSettings(FPostProcessSettings& PPSettings) const;
virtual void UpdateHiddenActors(const FVector& ViewLocation);
virtual void PreSave();
/**
* This will score both Adhesion and Friction targets. We want the same scoring function as we
* don't want the two different systems fighting over targets that are close.
**/
virtual FLOAT ScoreTargetAdhesionFrictionTarget( const APawn* P, FLOAT MaxDistance, const FVector& CamLoc, const FRotator& CamRot ) const;
/** Determines whether this Pawn can be used for TargetAdhesion **/
virtual UBOOL IsValidTargetAdhesionFrictionTarget( APawn* P, FLOAT MaxDistance );
}
/**
* Sets the current gamma value.
*
* @param New Gamma Value, must be between 0.0 and 1.0
*/
native function SetGamma(float GammaValue);
// NVCHANGE_BEGIN_TURB: TSC - can't change this at runtime
/**
* Sets whether or not hardware physics are enabled.
*
* @param bEnabled Whether to enable the physics or not.
*/
//native function SetHardwarePhysicsEnabled(bool bEnabled);
// NVCHANGE_BEGIN_TURB: TSC - can't change this at runtime
/** @return Whether or not the user has a keyboard plugged-in. */
native simulated function bool IsKeyboardAvailable() const;
/** @return Whether or not the user has a mouse plugged-in. */
native simulated function bool IsMouseAvailable() const;
/** @param CamEmitter Clear the CameraEffect if it is the one passed in */
function RemoveCameraEffect( UDKEmitCameraEffect CamEmitter )
{
if (CameraEffect == CamEmitter)
{
CameraEffect = None;
}
}
/** Spawn ClientSide Camera Effects **/
unreliable client function ClientSpawnCameraEffect(class<UDKEmitCameraEffect> CameraEffectClass)
{
local vector CamLoc;
local rotator CamRot;
if (CameraEffectClass != None && CameraEffect == None)
{
CameraEffect = Spawn(CameraEffectClass, self);
if (CameraEffect != None)
{
GetPlayerViewPoint(CamLoc, CamRot);
CameraEffect.RegisterCamera(self);
CameraEffect.UpdateLocation(CamLoc, CamRot, FOVAngle);
}
}
}
function ClearCameraEffect()
{
if( CameraEffect != None )
{
CameraEffect.Destroy();
CameraEffect = none;
}
}
/**
* This will find the best AdhesionFriction target based on the params passed in.
**/
native function Pawn GetTargetAdhesionFrictionTarget( FLOAT MaxDistance, const out vector CamLoc, const out Rotator CamRot );

View File

@ -0,0 +1,11 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKPlayerInput extends MobilePlayerInput within UDKPlayerController
native;
/** Will return the BindName based on the BindCommand
* Adds check for gamepad bindings which have _Gamepad appended to them (for the special cases where a bind was modified to work special on the gamepad.)
*/
native function String GetUDKBindNameFromCommand( String BindCommand );

View File

@ -0,0 +1,26 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
/**
* List of profile settings for UT
*/
class UDKProfileSettings extends OnlineProfileSettings
native;
/**
* Sets the specified profile id back to its default value.
*
* @param ProfileId Profile setting to reset to default.
*/
native function ResetToDefault(int ProfileId);
/**
* Resets the current keybindings for the specified playerowner to the defaults specified in the INI.
*
* @param InPlayerOwner Player to get the default keybindings for.
*/
native static function ResetKeysToDefault(optional LocalPlayer InPlayerOwner);

View File

@ -0,0 +1,87 @@
/**
* This is our base projectile class.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKProjectile extends Projectile
abstract
native
nativereplication;
/** for console games (wider collision w/ enemy players) */
var bool bWideCheck;
var float CheckRadius;
/** Acceleration magnitude. By default, acceleration is in the same direction as velocity */
var float AccelRate;
/** if true, the shutdown function has been called and 'new' effects shouldn't happen */
var bool bShuttingDown;
//=======================================================
// Seeking Projectile Support
/** Currently tracked target - if set, projectile will seek it */
var actor SeekTarget;
/** Tracking strength for normal targets.*/
var float BaseTrackingStrength;
/** Tracking strength for vehicle targets with bHomingTarget=true */
var float HomingTrackingStrength;
/** Initial direction of seeking projectile */
var vector InitialDir;
/** The last time a lock message was sent (to vehicle with bHomingTarget=true) */
var float LastLockWarningTime;
/** How long before re-sending the next Lock On message update */
var float LockWarningInterval;
/** TerminalVelocity for this projectile when falling */
var float TerminalVelocity;
/** Water buoyancy. A ratio (1.0 = neutral buoyancy, 0.0 = no buoyancy) */
var float Buoyancy;
/** custom gravity multiplier */
var float CustomGravityScaling;
/** if this projectile is fired by a vehicle passenger gun, this is the base vehicle
* considered the same as Instigator for purposes of bBlockedByInstigator
*/
var Vehicle InstigatorBaseVehicle;
/** Make true if want to spawn ProjectileLight. Set false in TickSpecial() once it's been determined whether Instigator is local player. Done there to make sure instigator has been replicated */
var bool bCheckProjectileLight;
/** if true, not blocked by vehicle shields with bIgnoreFlaggedProjectiles*/
var bool bNotBlockedByShield;
cpptext
{
virtual void TickSpecial( FLOAT DeltaSeconds );
virtual void GetNetBuoyancy(FLOAT &NetBuoyancy, FLOAT &NetFluidFriction);
virtual FLOAT GetGravityZ();
virtual UBOOL IgnoreBlockingBy(const AActor* Other) const;
virtual INT* GetOptimizedRepList(BYTE* InDefault, FPropertyRetirement* Retire, INT* Ptr, UPackageMap* Map, UActorChannel* Channel);
}
replication
{
if (bNetInitial)
bWideCheck, SeekTarget, InitialDir;
if (bNetDirty && bReplicateInstigator)
InstigatorBaseVehicle;
}
/** returns terminal velocity (max speed while falling) for this actor. Unless overridden, it returns the TerminalVelocity of the PhysicsVolume in which this actor is located.
*/
native function float GetTerminalVelocity();
/** CreateProjectileLight() called from TickSpecial() once if Instigator is local player
*/
simulated event CreateProjectileLight();

View File

@ -0,0 +1,52 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKScout extends Scout
native
transient;
/** Set during path calculation if double jump is required to traverse this path */
var bool bRequiresDoubleJump;
/** Should be set in Scout's default properties to specify max height off ground reached at apex of double jump */
var float MaxDoubleJumpHeight;
/* UDKScout uses the properties from this class (jump height etc.) to override UDKScout default settings */
var class<UDKPawn> PrototypePawnClass;
/** Name (in PathSizes[] array) associated with size that should be used for calculating JumpPad paths */
var name SizePersonFindName;
cpptext
{
virtual ETestMoveResult FindJumpUp(FVector Direction, FVector &CurrentPosition);
virtual UBOOL SetHighJumpFlag();
virtual void SetPrototype();
virtual ETestMoveResult FindBestJump(FVector Dest, FVector &CurrentPosition);
virtual void SetPathColor(UReachSpec* ReachSpec)
{
FVector CommonSize = GetSize(FName(TEXT("Common"),FNAME_Find));
if ( ReachSpec->CollisionRadius >= CommonSize.X )
{
FVector MaxSize = GetSize(FName(TEXT("Vehicle"),FNAME_Find));
ReachSpec->PathColorIndex = ( ReachSpec->CollisionRadius >= MaxSize.X ) ? 2 : 1;
}
else
{
ReachSpec->PathColorIndex = 0;
}
}
}
/**
SuggestJumpVelocity()
returns true if succesful jump from start to destination is possible
returns a suggested initial falling velocity in JumpVelocity
Uses GroundSpeed and JumpZ as limits
*/
native function bool SuggestJumpVelocity(out vector JumpVelocity, vector Destination, vector Start, optional bool bRequireFallLanding);
defaultproperties
{
}

View File

@ -0,0 +1,42 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
/** Navigation points with pathing interface exposed to script */
class UDKScriptedNavigationPoint extends NavigationPoint
native
abstract;
/** If true, calls script event SpecifyEndAnchor() */
var bool bScriptSpecifyEndAnchor;
/** If true, calls script event NotifyAnchorFindingResult() */
var bool bScriptNotifyAnchorFindingResult;
/** Whether path anchor must be reachable by route finder to even try to path toward it */
var bool bAnchorMustBeReachable;
cpptext
{
virtual class ANavigationPoint* SpecifyEndAnchor(APawn* RouteFinder);
virtual void NotifyAnchorFindingResult(ANavigationPoint* EndAnchor, APawn* RouteFinder);
virtual UBOOL AnchorNeedNotBeReachable();
}
/**
* Returns the end anchor to use for path finding when this actor is the goal.
* Called from C++ if bScriptSpecifyEndAnchor is true.
*/
event NavigationPoint SpecifyEndAnchor(Pawn RouteFinder);
/**
* Notify actor of anchor finding result.
* Called from C++ if bScriptNotifyAnchorFindingResult is true.
* @PARAM EndAnchor is the anchor found
* @PARAM RouteFinder is the pawn which requested the anchor finding
*/
event NotifyAnchorFindingResult(NavigationPoint EndAnchor, Pawn RouteFinder);
defaultproperties
{
bAnchorMustBeReachable=true
}

View File

@ -0,0 +1,40 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_CantileverBeam extends SkelControlLookAt
native(Animation);
/** The TargetLocation's goal (e.g. where it wants to be) */
var vector WorldSpaceGoal;
/** from the initial bone, where to go to get the starting location for WorldSpaceGoal (in localbonespace) */
var(LookAt) vector InitialWorldSpaceGoalOffset;
/** Current Velocity that TargetLocation is travelling at*/
var vector Velocity;
var(Spring) float SpringStiffness;
var(Spring) float SpringDamping;
/** how much we want the tip of the beam to get of the base velocity */
var() float PercentBeamVelocityTransfer;
/** the speed the entire beam is travelling at. (a delegate for cases like a tank, where we want the whole tank to effect less than the turret moving) */
delegate vector EntireBeamVelocity()
{
return Vect(0,0,0);
}
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
SpringStiffness=0
SpringDamping=0
WorldSpaceGoal=(X=0,Y=0,Z=0)
Velocity=(X=0,Y=0,Z=0)
PercentBeamVelocityTransfer = 0.9;
}

View File

@ -0,0 +1,155 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_Damage extends SkelControlSingleBone
native(Animation);
/** Is this control initialized */
var bool bInitialized;
/** Quick link to the owning UDKVehicle */
var UDKVehicle OwnerVehicle;
/** Which morph Target to use for health. If none, use the main vehicle health */
var float HealthPerc;
/** Whether the OnDamage functionality is active **/
var(Damage) bool bOnDamageActive;
/** Value to scale this bone to on death **/
var(Damage) float DamageBoneScale;
/** How much damage the control can take */
var(Damage) int DamageMax;
/** If the health target is above this threshold, this control will be inactive */
var(Damage) float ActivationThreshold;
/** Once activated, does we generate the control strength as a product of the health remaining, or is it always full */
var(Damage) bool bControlStrFollowsHealth;
/** The Static Mesh component to display when it breaks off */
var(Damage) StaticMesh BreakMesh;
/** The threshold at which the spring will begin looking to break */
var(Damage) float BreakThreshold;
/** This is the amount of time to go from breaking to broken */
var(Damage) float BreakTime;
/** When breaking off, use this to build the vector */
var(Damage) vector DefaultBreakDir;
/**
* The scale to use for the spawned piece. (i.e. we have one static mesh asset but it is being spawned from different locations on a vehicle
* which is mirrored down the center.
**/
var(Damage) vector DamageScale;
/** ParticleSystem to spawn when this piece breaks */
var(Damage) ParticleSystem PS_DamageOnBreak;
/** ParticleSystem to attach when this piece flies off (i.e. a dark acrid trailing smoke trail!) */
var(Damage) ParticleSystem PS_DamageTrail;
/** Is this control broken */
var transient bool bIsBroken;
/** This is set to true when Break() is called. It signals the control is breaking but not yet broken */
var transient bool bIsBreaking;
/** This holds the name of the bone that was broken */
var transient name BrokenBone;
/** This holds the real-time at which this should break */
var transient float BreakTimer;
/** cached MaxDamage for a vehicle */
var transient float OwnerVehicleMaxHealth;
/** force that pushes the part up when the part is broken off to clear the vehicle. */
var() vector BreakSpeed;
/** Whether the OnDeath functionality is active **/
var(OnDeath) bool bOnDeathActive;
/** Whether the OnDeath functionality is active for the secondary explosion **/
var(OnDeath) bool bOnDeathUseForSecondaryExplosion;
/** This is the percent that this piece will actually spawn if OnDeath is active **/
var(OnDeath) float DeathPercentToActuallySpawn;
/** Value to scale this bone to on death **/
var(OnDeath) float DeathBoneScale;
/** The static mesh to spawn on death **/
var(OnDeath) StaticMesh DeathStaticMesh;
/** This is the direction which the spawned vehicle piece will fly **/
var(OnDeath) vector DeathImpulseDir;
/**
* The scale to use for the spawned piece. (i.e. we have one static mesh asset but it is being spawned from different locations on a vehicle
* which is mirrored down the center.
**/
var(OnDeath) vector DeathScale;
/** ParticleSystem to spawn when this piece breaks */
var(OnDeath) ParticleSystem PS_DeathOnBreak;
/** ParticleSystem to attach when this piece flies off (i.e. a dark acrid trailing smoke trail!) */
var(OnDeath) ParticleSystem PS_DeathTrail;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
virtual void CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms);
virtual FLOAT GetBoneScale(INT BoneIndex, USkeletalMeshComponent* SkelComp);
virtual UBOOL InitializeControl(USkeletalMeshComponent* SkelComp);
}
/**
* This event is triggered when the spring has decided to break.
*
* Network - Called everywhere except on a dedicated server.
*/
simulated event BreakApart(vector PartLocation, bool bIsVisible)
{
BoneScale = DamageBoneScale;
bIsBreaking = FALSE;
bIsBroken = TRUE;
}
simulated event BreakApartOnDeath(vector PartLocation, bool bIsVisible)
{
BoneScale = DeathBoneScale;
bIsBroken = TRUE;
}
simulated event float RestorePart()
{
BoneScale = 1.0f;
HealthPerc = 1.0f;
return HealthPerc;
}
defaultproperties
{
bOnDamageActive=TRUE
bControlStrFollowsHealth=FALSE
BreakThreshold=1.1
BreakTime=0.0
HealthPerc=1.f
DamageMax=25
bIgnoreWhenNotRendered=TRUE
DamageScale=(X=1.0f,Y=1.0f,Z=1.0f)
DeathScale=(X=1.0f,Y=1.0f,Z=1.0f)
DeathPercentToActuallySpawn=1.0f
}

View File

@ -0,0 +1,40 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_DamageHinge extends UDKSkelControl_Damage
hidecategories(Translation, Rotation, Adjustments)
native(Animation);
/** The Maximum size of the angle this hinge can open to in Degrees */
var(Hinge) float MaxAngle;
/** Which axis this hinge opens around */
var(Hinge) EAxis PivotAxis;
/** The angular velocity that is used to calculate the angle of the hinge will be multipled by this value.
* NOTE: This should be negative
*/
var(Hinge) float AVModifier;
/** The current angle of the hinge */
var transient float CurrentAngle;
/** How stiff is the spring */
var float SpringStiffness;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
MaxAngle=45.0
AVModifier=-1.5
PivotAxis=AXIS_Y
SpringStiffness=-0.035
bApplyRotation=true
BoneRotationSpace=BCS_ActorSpace
}

View File

@ -0,0 +1,54 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_DamageSpring extends UDKSkelControl_Damage
native(Animation);
/** The Maximum size of the angle this spring can open to in Degrees */
var(Spring) rotator MaxAngle;
/** The Minmum size of the angle this spring can open to in Degrees */
var(Spring) rotator MinAngle;
/** How fast does it return to normal */
var(Spring) float Falloff;
/** How stiff is the spring */
var(Spring) float SpringStiffness;
var(Spring) float AVModifier;
/** The current angle of the hinge */
var transient rotator CurrentAngle;
/** % of movement decided randomly */
var float RandomPortion;
// to add momentum from breaking due to a damage hit
var vector LastHitMomentum;
var float LastHitTime;
var float MomentumPortion;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
virtual INT CalcAxis(INT &InAngle, FLOAT CurVelocity, FLOAT MinAngle, FLOAT MaxAngle);
virtual UBOOL InitializeControl(USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
BreakTime=0.0
SpringStiffness=-0.035
bApplyRotation=TRUE
BoneRotationSpace=BCS_ActorSpace
Falloff=0.975
AVModifier=1.0
bControlStrFollowsHealth=TRUE
ActivationThreshold=1.0
RandomPortion=0.2f
MomentumPortion=0.75f
}

View File

@ -0,0 +1,39 @@
/**
* Controller used by hoverboard for moving lower part in response to wheel movements.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_HoverboardSuspension extends SkelControlSingleBone
hidecategories(Translation,Rotation)
native(Animation);
cpptext
{
// SkelControl interface
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
var() float TransIgnore;
var() float TransScale;
var() float TransOffset;
var() float MaxTrans;
var() float MinTrans;
var() float RotScale;
var() float MaxRot;
var() float MaxRotRate;
var float CurrentRot;
defaultproperties
{
bApplyTranslation=true
bAddTranslation=true
BoneTranslationSpace=BCS_BoneSpace
bApplyRotation=true
bAddRotation=true
BoneRotationSpace=BCS_BoneSpace
MaxRotRate=0.5
}

View File

@ -0,0 +1,32 @@
/**
* Controller used by hoverboard for moving lower part in response to wheel movements.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_HoverboardSwing extends SkelControlSingleBone
hidecategories(Translation,Rotation)
native(Animation);
cpptext
{
// SkelControlWheel interface
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
virtual void CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms);
}
var() int SwingHistoryWindow;
var int SwingHistorySlot;
var array<float> SwingHistory;
var() float SwingScale;
var() float MaxSwing;
var() float MaxUseVel;
var float CurrentSwing;
defaultproperties
{
bApplyRotation=true
bAddRotation=true
BoneRotationSpace=BCS_BoneSpace
SwingHistoryWindow=15
}

View File

@ -0,0 +1,30 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*
* Controller used by hoverboard for moving lower part in response to wheel movements.
*/
class UDKSkelControl_HoverboardVibration extends SkelControlSingleBone
hidecategories(Translation,Rotation)
native(Animation);
cpptext
{
// SkelControlWheel interface
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
virtual void CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms);
}
var() float VibFrequency;
var() float VibSpeedAmpScale;
var() float VibTurnAmpScale;
var() float VibMaxAmplitude;
var float VibInput;
defaultproperties
{
bApplyTranslation=true
bAddTranslation=true
BoneTranslationSpace=BCS_BoneSpace
}

View File

@ -0,0 +1,43 @@
/**
* skeletal controller that tries to keep a bone within a certain distance of the ground within its constraints
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_HugGround extends SkelControlSingleBone
native(Animation)
hidecategories(Translation, Rotation, Adjustment);
/** desired distance from bone to ground */
var() float DesiredGroundDist;
/** maximum distance the bone may be moved from its normal location */
var() float MaxDist;
/** optional name of a bone that the controlled bone will always be rotated towards */
var() name ParentBone;
/** if true, rotate the bone in the opposite direction of the parent instead of in the same direction */
var() bool bOppositeFromParent;
/** if ParentBone is specified and this is greater than zero always keep the controlled bone exactly this many units from it */
var() float XYDistFromParentBone;
var() float ZDistFromParentBone;
/** maximum amount the BoneTranslation may change per second */
var() float MaxTranslationPerSec;
/** time bone transforms were last updated */
var transient float LastUpdateTime;
cpptext
{
virtual void CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms);
}
defaultproperties
{
DesiredGroundDist=60.0
MaxDist=60.0
bApplyTranslation=true
bAddTranslation=true
// bApplyRotation = (ParentBone != 'None')
BoneRotationSpace=BCS_BoneSpace
BoneTranslationSpace=BCS_ActorSpace
bIgnoreWhenNotRendered=true
MaxTranslationPerSec=150.0
}

View File

@ -0,0 +1,34 @@
/**
* skeletal controller that locks one or more components of the bone's rotation to a specified value
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_LockRotation extends SkelControlBase
native(Animation);
/** which components of the bone rotation to affect */
var() bool bLockPitch, bLockYaw, bLockRoll;
/** the rotation to lock to */
var() rotator LockRotation;
/** the maximum amount the original rotation can be altered to reach LockRotation */
var() rotator MaxDelta;
/** the space that rotation is in */
var() EBoneControlSpace LockRotationSpace;
/** name of bone used if LockRotationSpace is BCS_OtherBoneSpace */
var() name RotationSpaceBoneName;
cpptext
{
virtual void GetAffectedBones(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<INT>& OutBoneIndices);
virtual void CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms);
}
defaultproperties
{
MaxDelta=(Pitch=65535,Yaw=65535,Roll=65535)
}

View File

@ -0,0 +1,36 @@
/**
* Controller that rotates a single bone to 'look at' a given target.
* Extends engine functionality to add per-axis rotation limits.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_LookAt extends SkelControlLookat
native(Animation);
cpptext
{
protected:
virtual UBOOL ApplyLookDirectionLimits(FVector& DesiredLookDir, const FVector &CurrentLookDir, INT BoneIndex, USkeletalMeshComponent* SkelComp);
public:
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
virtual void DrawSkelControl3D(const FSceneView* View, FPrimitiveDrawInterface* PDI, USkeletalMeshComponent* SkelComp, INT BoneIndex);
}
/** If TRUE, apply limits to specified axis. Ignore limits otherwise. */
var() protected bool bLimitYaw;
var() protected bool bLimitPitch;
var() protected bool bLimitRoll;
/** Angular limits for pitch, roll, yaw, in degrees */
var() protected float YawLimit;
var() protected float PitchLimit;
var() protected float RollLimit;
/** If TRUE, draw cone representing per-axis limits. */
var() protected bool bShowPerAxisLimits;
defaultproperties
{
}

View File

@ -0,0 +1,29 @@
/**
* skeletal controller that provides a cleaner and more efficient way to handle scaling for many bones in a mesh
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_MassBoneScaling extends SkelControlBase
native(Animation);
/** bone scales - indices match mesh's bone indices */
var() array<float> BoneScales;
cpptext
{
virtual void GetAffectedBones(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<INT>& OutBoneIndices);
virtual void CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms);
virtual FLOAT GetBoneScale(INT BoneIndex, USkeletalMeshComponent* SkelComp);
}
/** sets the given bone to the given scale
* @note this controller must be hooked up to the specified bone in the AnimTree for this to have any effect
*/
native final function SetBoneScale(name BoneName, float Scale);
/** returns the scale this control has for the given bone
* @note does not take into account any other controls that are affecting the bone's scale
*/
native final function float GetBoneScale(name BoneName);

View File

@ -0,0 +1,28 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_PropellerBlade extends SkelControlSingleBone
hidecategories(Translation, Adjustment)
native(Animation);
var(Manta) float MaxRotationsPerSecond;
var(Manta) float SpinUpTime;
var(Manta) bool bCounterClockwise;
var float RotationsPerSecond, DesiredRotationsPerSecond;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
bAddRotation=true
MaxRotationsPerSecond=20
SpinUptime=1.2
bApplyRotation=true
BoneRotationSpace=BCS_ActorSpace
bIgnoreWhenNotRendered=true
}

View File

@ -0,0 +1,26 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_Rotate extends SkelControlSingleBone
native(Animation);
/** Where we wish to get to */
var(Desired) rotator DesiredBoneRotation;
/** The Rate we wish to rotate */
var(Desired) rotator DesiredBoneRotationRate;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
bApplyTranslation=false
bApplyRotation=true
bAddRotation=true
BoneRotationSpace=BCS_BoneSpace
}

View File

@ -0,0 +1,27 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_SpinControl extends SkelControlSingleBone
native(Animation)
hidecategories(Adjustments,Translation,Rotation);
/** How fast is the core to spin at max health */
var(Spin) float DegreesPerSecond;
var(Spin) vector Axis;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
bApplyTranslation=false
bAddTranslation=false
bApplyRotation=true
bAddRotation=true
BoneRotationSpace=BCS_ActorSpace
DegreesPerSecond=180
}

View File

@ -0,0 +1,89 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_TurretConstrained extends SkelControlSingleBone
native(Animation);
var(Constraint) bool bConstrainPitch;
var(Constraint) bool bConstrainYaw;
var(Constraint) bool bConstrainRoll;
var(Constraint) bool bInvertPitch;
var(Constraint) bool bInvertYaw;
var(Constraint) bool bInvertRoll;
struct native TurretConstraintData
{
var() int PitchConstraint;
var() int YawConstraint;
var() int RollConstraint;
};
var(Constraint) TurretConstraintData MaxAngle; // Max. angle in Degrees
var(Constraint) TurretConstraintData MinAngle; // Min. angle in Degrees
/**
* Allow each turret to have various steps in which to contrain the data.
*/
struct native TurretStepData
{
var() int StepStartAngle;
var() int StepEndAngle;
var() TurretConstraintData MaxAngle;
var() TurretConstraintData MinAngle;
};
var(Constraints) array<TurretStepData> Steps;
var(Turret) float LagDegreesPerSecond;
var(Turret) float PitchSpeedScale;
var(Turret) rotator DesiredBoneRotation;
/** If true, this turret won't update if the seat it is associated with is firing */
var(Turret) bool bFixedWhenFiring;
/** The Seat Index this control is associated with */
var(Turret) int AssociatedSeatIndex;
/** If true, this turret will reset to 0,0,0 when there isn't a driver */
var(Turret) bool bResetWhenUnattended;
var bool bIsInMotion;
/** This is the world space rotation after constraints have been applied
* We set Bone rotation to this value by default in GetAffectedBones
*/
var transient Rotator ConstrainedBoneRotation;
cpptext
{
/** handles constraining the passed in local space rotator based on the turret's parameters */
FRotator GetClampedLocalDesiredRotation(const FRotator& UnclampedLocalDesired);
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
delegate OnTurretStatusChange(bool bIsMoving);
/** Initialises turret, so its current direction is the way it wants to point. */
native final function InitTurret(Rotator InitRot, SkeletalMeshComponent SkelComp);
/** @return if the given pitch would be limited by this controller */
native final function bool WouldConstrainPitch(int TestPitch, SkeletalMeshComponent SkelComp);
defaultproperties
{
bConstrainPitch=false;
bConstrainYaw=false;
bConstrainRoll=false;
LagDegreesPerSecond=360
PitchSpeedScale=1.0
bApplyRotation=true
BoneRotationSpace=BCS_ActorSpace
bIsInMotion=false
}

View File

@ -0,0 +1,39 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkelControl_VehicleFlap extends SkelControlSingleBone
hidecategories(Translation, Rotation, Adjustment)
native(Animation);
var(Manta) float MaxPitch;
var float OldZPitch;
/** 1/MaxPitchTime is minimum time to go from 0 to max pitch */
var float MaxPitchTime;
/** Max pitch change per second */
var float MaxPitchChange;
var name RightFlapControl;
var name LeftFlapControl;
cpptext
{
virtual void TickSkelControl(FLOAT DeltaSeconds, USkeletalMeshComponent* SkelComp);
}
defaultproperties
{
MaxPitch=30
MaxPitchTime=4.0
MaxPitchChange=10000.0
bApplyRotation=true
BoneRotationSpace=BCS_ActorSpace
ControlStrength=1.0
bIgnoreWhenNotRendered=true
RightFlapControl=right_flap
LeftFlapControl=left_flap
}

View File

@ -0,0 +1,49 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSkeletalMeshComponent extends SkeletalMeshComponent
native;
cpptext
{
/** Creates a FUDKSkeletalMeshSceneProxy (defined in UTWeapon.cpp) */
virtual FPrimitiveSceneProxy* CreateSceneProxy();
virtual void Tick(FLOAT DeltaTime);
}
/** This changes the FOV used for rendering the skeletal mesh component. A value of 0 means to use the default. */
var() const float FOV;
/** whether textures are currently forced loaded */
var bool bForceLoadTextures;
/** when to clear forced streaming */
var float ClearStreamingTime;
/**
* Force streamed textures to be loaded. Used to get MIPS streamed in before weapon comes up
* @PARAM bForcePreload if true causes streamed textures to be force loaded, if false, clears force loading
*/
simulated event PreloadTextures(bool bForcePreload, float ClearTime)
{
local int idx;
bForceLoadTextures = bForcePreload;
ClearStreamingTime = ClearTime;
for (Idx = 0; Idx < Materials.Length; Idx++)
{
if (Materials[Idx] != None)
{
Materials[Idx].SetForceMipLevelsToBeResident(true, bForcePreload, -1.0f);
}
}
}
/** changes the value of FOV */
native final function SetFOV(float NewFOV);
DefaultProperties
{
FOV=0.0
}

View File

@ -0,0 +1,41 @@
/**
* operational AI control for TeamGame
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKSquadAI extends UDKTeamOwnedInfo
native;
var UDKGameObjective SquadObjective;
// Alternate path support
var NavigationPoint RouteObjective;
var array<NavigationPoint> ObjectiveRouteCache;
/** when generating a new ObjectiveRouteCache for the same objective, the previous is stored here so bots still following it don't get disrupted */
var array<NavigationPoint> PreviousObjectiveRouteCache;
/** bot that we want to use to generate the route (usually SquadLeader) */
var UDKBot PendingSquadRouteMaker;
/** current alternate route iteration (loops back to start after reaching MaxSquadRoutes) */
var int SquadRouteIteration;
struct native AlternateRoute
{
var array<NavigationPoint> RouteCache;
};
/** list of alternate routes. Each one higher in the list was created by first adding cost to the nodes in all previous routes */
var array<AlternateRoute> SquadRoutes;
/** maximum size of SquadRoutes list */
var int MaxSquadRoutes;
replication
{
if ( Role == ROLE_Authority )
SquadObjective;
}

View File

@ -0,0 +1,10 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKTeamOwnedInfo extends ReplicationInfo
native;
/** Team associated with this info */
var TeamInfo Team;
simulated native function byte GetTeamNum();

View File

@ -0,0 +1,20 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKTeamPlayerStart extends PlayerStart
native;
cpptext
{
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent);
virtual void Spawned();
}
// Players on different teams are not spawned in areas with the
// same TeamNumber unless there are more teams in the level than
// team numbers.
var() byte TeamNumber; // what team can spawn at this start
// sprites used for this actor in the editor, depending on which team it's on
var editoronly array<Texture2D> TeamSprites;

View File

@ -0,0 +1,123 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKTeleporterBase extends Teleporter
native
abstract
config(Game);
/** the component that captures the portal scene */
var(SceneCapture) editconst SceneCaptureComponent PortalCaptureComponent;
/** the texture that the component renders to */
var TextureRenderTarget2D TextureTarget;
/** resolution parameters */
var(SceneCapture) int TextureResolutionX, TextureResolutionY;
/** actor that the portal view is based on (used for updating Controllers' VisiblePortals array) */
var Actor PortalViewTarget;
/** materials for the portal effect */
var MaterialInterface PortalMaterial;
var MaterialInstanceConstant PortalMaterialInstance;
/** material parameter that we assign the rendered texture to */
var name PortalTextureParameter;
/** Sound to be played when someone teleports in*/
var SoundCue TeleportingSound;
cpptext
{
virtual void TickSpecial(FLOAT DeltaTime);
}
simulated event PostBeginPlay()
{
local Teleporter Dest;
Super.PostBeginPlay();
if (WorldInfo.NetMode != NM_DedicatedServer)
{
// try to find a teleporter to view
foreach WorldInfo.AllNavigationPoints(class'Teleporter', Dest)
{
if (string(Dest.Tag) ~= URL && Dest != Self)
{
break;
}
}
if (WorldInfo.IsConsoleBuild(CONSOLE_PS3) || WorldInfo.IsConsoleBuild(CONSOLE_Mobile))
{
SetHidden(Dest == None);
}
else
{
InitializePortalEffect(Dest);
}
}
}
simulated function InitializePortalEffect(Actor Dest)
{
local bool bStaticCapture;
if (PortalCaptureComponent != None)
{
if (Dest != None)
{
// only get realtime capture in high detail mode
bStaticCapture = (WorldInfo.GetDetailMode() < DM_High);
PortalViewTarget = Dest;
// set up the portal effect
PortalMaterialInstance = new(self) class'MaterialInstanceConstant';
PortalMaterialInstance.SetParent(PortalMaterial);
TextureTarget = class'TextureRenderTarget2D'.static.Create( TextureResolutionX, TextureResolutionY,,
MakeLinearColor(0.0, 0.0, 0.0, 1.0), bStaticCapture );
if (bStaticCapture)
{
PortalCaptureComponent.SetFrameRate(0);
}
PortalMaterialInstance.SetTextureParameterValue(PortalTextureParameter, TextureTarget);
AttachComponent(PortalCaptureComponent);
}
else
{
SetHidden(true);
}
}
}
simulated event bool Accept( actor Incoming, Actor Source )
{
if (Super.Accept(Incoming,Source))
{
PlaySound(TeleportingSound);
return true;
}
else
{
return false;
}
}
defaultproperties
{
Begin Object Name=CollisionCylinder
CollisionRadius=50.0
CollisionHeight=30.0
End Object
bStatic=false
bMovable=false
PortalTextureParameter=RenderToTextureMap
TextureResolutionX=256
TextureResolutionY=256
}

View File

@ -0,0 +1,18 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKTrajectoryReachSpec extends AdvancedReachSpec
native
abstract;
cpptext
{
virtual void AddToDebugRenderProxy(class FDebugRenderSceneProxy* DRSP);
virtual FVector GetInitialVelocity() { return FVector(0.f,0.f,0.f); };
}
defaultproperties
{
bAddToNavigationOctree=false
bCheckForObstructions=false
}

View File

@ -0,0 +1,28 @@
/**
* Provides data for a UT3 map.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKUIDataProvider_MapInfo extends UDKUIResourceDataProvider
native
PerObjectConfig;
/** Unique ID for maps. */
var config int MapId;
/** Actual map name to load */
var config string MapName;
/** String describing how many players the map is good for. */
var config localized string NumPlayers;
/** Localized description of the map */
var config localized string Description;
/** Markup text used to display the preview image for the map. */
var config string PreviewImageMarkup;
defaultproperties
{
bSearchAllInis=true
}

View File

@ -0,0 +1,58 @@
/**
* Provides an option for a UI menu item.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKUIDataProvider_MenuOption extends UDKUIResourceDataProvider
native
PerObjectConfig;
enum EUTOptionType
{
UTOT_ComboReadOnly,
UTOT_ComboNumeric,
UTOT_CheckBox,
UTOT_Slider,
UTOT_Spinner,
UTOT_EditBox,
UTOT_CollectionCheckBox
};
var config EUTOptionType OptionType;
/** Name of the option set that this option belongs to. */
var config array<name> OptionSet;
/** Markup for the option */
var config string DataStoreMarkup;
/** Game mode required for this option to appear. */
var config name RequiredGameMode;
/** Script settable friendly name. */
var string CustomFriendlyName;
/** Localized description of the option */
var config localized string Description;
/** Whether or not the options presented to the user are the only options they can choose from, used on PC only for setting whether combobox edit boxes are read only or not. */
var config bool bEditableCombo;
/** Whether or not the combobox is numeric. */
var config bool bNumericCombo;
/** Maximum length of the editbox property. */
var config int EditBoxMaxLength;
/** Range data for the option, only used if its a slider type. */
var config UIRangeData RangeData;
/** Whether the option is a keyboard or mouse option. */
var config bool bKeyboardOrMouseOption;
/** Whether the option is a online only option or not. */
var config bool bOnlineOnly;
/** Whether the option is a offline only option or not. */
var config bool bOfflineOnly;

View File

@ -0,0 +1,37 @@
/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*
* UT specific search result that exposes some extra fields to the server browser.
*/
class UDKUIDataProvider_SearchResult extends UIDataProvider_Settings
native;
/** data field tags - cached for faster lookup */
var const name PlayerRatioTag;
var const name GameModeFriendlyNameTag;
var const name ServerFlagsTag;
var const name MapNameTag;
/** the path name to the font containing the icons used to display the server flags */
var const string IconFontPathName;
cpptext
{
/**
* @return TRUE if server corresponding to this search result allows players to use keyboard & mouse.
*/
UBOOL AllowsKeyboardMouse();
}
/**
* @return TRUE if server corresponding to this search result is password protected.
*/
native function bool IsPrivateServer();
defaultproperties
{
PlayerRatioTag="PlayerRatio"
GameModeFriendlyNameTag="GameModeFriendlyName"
ServerFlagsTag="ServerFlags"
MapNameTag="CustomMapName"
}

View File

@ -0,0 +1,23 @@
/**
* Dataprovider that gives a key/value list of details for a server given its search result row.
*
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
class UDKUIDataProvider_ServerDetails extends UDKUIDataProvider_SimpleElementProvider
native;
cpptext
{
public:
/**
* Determines whether the specified field should be included when the user requests to see a list of this server's details.
*/
static UBOOL ShouldDisplayField( FName FieldName );
}
/** Provider that has server information. */
var transient int SearchResultsRow;
DefaultProperties
{
}

Some files were not shown because too many files have changed in this diff Show More