Prepare fixtures
This commit is contained in:
parent
797e5ea192
commit
9c94356263
6021 changed files with 722805 additions and 22 deletions
14
kf_sources/UTV2004c/Classes/index.html
Normal file
14
kf_sources/UTV2004c/Classes/index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<head><title>Index of /kf_sources/UTV2004c/Classes/</title></head>
|
||||
<body>
|
||||
<h1>Index of /kf_sources/UTV2004c/Classes/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="utvInputPage.uc">utvInputPage.uc</a> 06-Oct-2019 10:27 1824
|
||||
<a href="utvInteraction.uc">utvInteraction.uc</a> 06-Oct-2019 10:27 12108
|
||||
<a href="utvMutator.uc">utvMutator.uc</a> 06-Oct-2019 10:27 5240
|
||||
<a href="utvPrimaryMenu.uc">utvPrimaryMenu.uc</a> 06-Oct-2019 10:27 11523
|
||||
<a href="utvReplication.uc">utvReplication.uc</a> 06-Oct-2019 10:27 17507
|
||||
<a href="utvReplicationInfo.uc">utvReplicationInfo.uc</a> 06-Oct-2019 10:27 1518
|
||||
<a href="utvSpectator.uc">utvSpectator.uc</a> 06-Oct-2019 10:27 346
|
||||
<a href="utvWatcherMenu.uc">utvWatcherMenu.uc</a> 06-Oct-2019 10:27 7022
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
90
kf_sources/UTV2004c/Classes/utvInputPage.uc
Normal file
90
kf_sources/UTV2004c/Classes/utvInputPage.uc
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvInputPage extends ut2k3guIPage;
|
||||
|
||||
var string TypedStr;
|
||||
var bool bIgnoreKeys;
|
||||
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
super.InitComponent(MyController, MyOwner);
|
||||
|
||||
bIgnoreKeys = true;
|
||||
TypedStr = "";
|
||||
}
|
||||
|
||||
function bool MyOnDraw (Canvas canvas)
|
||||
{
|
||||
local PlayerController pc;
|
||||
|
||||
pc = PlayerOwner();
|
||||
|
||||
if ((pc != none) && (pc.myhud != none)) {
|
||||
pc.myhud.DrawTypingPrompt (Canvas, "UTVSAY " $ TypedStr);
|
||||
}
|
||||
else {
|
||||
Log ("rotv: Current player has no hud, closing chat");
|
||||
Controller.CloseMenu ();
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool MyOnKeyType(out byte Key, optional string Unicode)
|
||||
{
|
||||
if (bIgnoreKeys)
|
||||
return true;
|
||||
|
||||
if (Key >= 0x20) {
|
||||
if (Unicode != "")
|
||||
TypedStr = TypedStr $ Unicode;
|
||||
else
|
||||
TypedStr = TypedStr $ Chr (Key);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function bool MyOnKeyEvent(out byte Key, out byte Action, float delta)
|
||||
{
|
||||
if (Action == 1) { //press
|
||||
bIgnoreKeys = false;
|
||||
}
|
||||
if (Key == 0x1b) { //escape
|
||||
Controller.CloseMenu ();
|
||||
return true;
|
||||
}
|
||||
else if (Action != 1) {
|
||||
return false;
|
||||
}
|
||||
else if (Key == 0x0d) { //enter
|
||||
if (TypedStr != "") {
|
||||
class'utvReplication'.default.ChatString = TypedStr;
|
||||
}
|
||||
Controller.CloseMenu ();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (Key == 0x08 || Key == 0x25) { //backspace, left
|
||||
if (Len (TypedStr) > 0)
|
||||
TypedStr = Left (TypedStr, Len (TypedStr) - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
bRequire640x480=false
|
||||
bAllowedAsLast=true
|
||||
OpenSound=none
|
||||
bRenderWorld=true
|
||||
|
||||
OnDraw=MyOnDraw
|
||||
OnKeyType=MyOnKeyType
|
||||
OnKeyEvent=MyOnKeyEvent
|
||||
}
|
||||
493
kf_sources/UTV2004c/Classes/utvInteraction.uc
Normal file
493
kf_sources/UTV2004c/Classes/utvInteraction.uc
Normal file
|
|
@ -0,0 +1,493 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvInteraction extends Interaction;
|
||||
|
||||
//P should always be set.. up is not set for the primary spectator
|
||||
var PlayerController p;
|
||||
var utvReplication UtvRep;
|
||||
//var utvPlayer up;
|
||||
|
||||
var bool shownWelcome;
|
||||
var float WelcomeWidth;
|
||||
var float WelcomeMargin;
|
||||
var float WelcomePos;
|
||||
var int WelcomeStart[2];
|
||||
var int WelcomeEnd[2];
|
||||
var string WelcomeMsg[12];
|
||||
|
||||
var string WarnMsg;
|
||||
var int Clients;
|
||||
var int Delay;
|
||||
var int RestartIn;
|
||||
|
||||
//primary only
|
||||
var string ServerAddress;
|
||||
var int ServerPort;
|
||||
var int ListenPort;
|
||||
var string JoinPassword;
|
||||
var string PrimaryPassword;
|
||||
var string VipPassword;
|
||||
var string NormalPassword;
|
||||
//var float Delay;
|
||||
var int MaxClients;
|
||||
|
||||
|
||||
//Remove ourselves if the level changes
|
||||
event NotifyLevelChange()
|
||||
{
|
||||
Log ("utv: Removed interaction");
|
||||
Master.RemoveInteraction (self);
|
||||
}
|
||||
|
||||
simulated function SetState (bool primary)
|
||||
{
|
||||
if (primary)
|
||||
GotoState ('Primary');
|
||||
else
|
||||
GotoState ('Secondary');
|
||||
}
|
||||
|
||||
simulated function SetWarning (string msg)
|
||||
{
|
||||
WarnMsg = msg;
|
||||
}
|
||||
|
||||
function bool globalKeyEvent( out EInputKey Key, out EInputAction Action, FLOAT Delta )
|
||||
{
|
||||
local string tmp;
|
||||
|
||||
if ((!shownWelcome) && (Action == IST_Press)) {
|
||||
shownWelcome = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Is it the key that would invoke say?
|
||||
if (Action == IST_Press) {
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYNAME " $ key);
|
||||
if (tmp ~= "F8") {
|
||||
ShowMenu ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//stub, overriden in states
|
||||
function DrawWelcome (Canvas canvas)
|
||||
{
|
||||
}
|
||||
|
||||
function DrawTextBox (Canvas canvas, string text, bool sizing, float X, out float Y, float XW)
|
||||
{
|
||||
local float LineSpace;
|
||||
local float WordSpace;
|
||||
local string cur;
|
||||
local float xl, yl;
|
||||
local int i;
|
||||
local float curx;
|
||||
|
||||
Canvas.TextSize("A", XL, YL);
|
||||
LineSpace = (YL * 1.1) / Canvas.ClipY;
|
||||
Canvas.TextSize(" ", XL, YL);
|
||||
WordSpace = XL * 1.1;
|
||||
|
||||
//Replace color tags with the codes that DrawText recognizes
|
||||
text = Repl(text, "<1>", chr(27) $ chr(255) $ chr(255) $ chr(255));
|
||||
text = Repl(text, "<2>", chr(27) $ "àà`");
|
||||
text = Repl(text, "<3>", chr(27) $ "à@@");
|
||||
|
||||
curx = 0;
|
||||
|
||||
while (len (text) > 0) {
|
||||
i = InStr (text, " ");
|
||||
if (i == -1) {
|
||||
cur = text;
|
||||
text = "";
|
||||
} else {
|
||||
cur = Mid (text, 0, i);
|
||||
text = Mid (text, i + 1);
|
||||
}
|
||||
|
||||
Canvas.TextSize (cur, xl, yl);
|
||||
if (curx + xl > xw * Canvas.ClipX) {
|
||||
Y+=LineSpace;
|
||||
Curx = 0;
|
||||
}
|
||||
|
||||
if (!sizing) {
|
||||
Canvas.SetPos ((Canvas.ClipX * x) + curx, Canvas.ClipY * y);
|
||||
Canvas.DrawText (cur, false);
|
||||
}
|
||||
|
||||
curx += xl + wordspace;
|
||||
}
|
||||
Y+=LineSpace;
|
||||
}
|
||||
|
||||
function DrawWelcomeText (Canvas canvas, int index)
|
||||
{
|
||||
local float x, y, xw, yw;
|
||||
local int i;
|
||||
|
||||
Canvas.Font = class'UT2MidGameFont'.static.GetMidGameFont(Canvas.ClipX); // Update which font to use.
|
||||
|
||||
yw = 0;
|
||||
xw = WelcomeWidth - WelcomeMargin*2;
|
||||
|
||||
//Check sizing
|
||||
for (i = WelcomeStart[index]; i <= WelcomeEnd[index]; ++i) {
|
||||
DrawTextBox (canvas, WelcomeMsg[i], true, 0, yw, xw);
|
||||
}
|
||||
|
||||
//Now draw it
|
||||
x = (1 - WelcomeWidth) / 2;
|
||||
y = ((1 - yw) / 2) - 0.1; //kind of looks better with - 0.1
|
||||
|
||||
Canvas.SetDrawColor(255,255,255,255);
|
||||
Canvas.SetPos(Canvas.ClipX * x, Canvas.ClipY * y);
|
||||
//Canvas.DrawTileStretched(texture 'InterfaceContent.Menu.BorderBoxD', Canvas.ClipX * WelcomeWidth, Canvas.ClipY * (yw + WelcomeMargin * 2));
|
||||
// if _RO_
|
||||
Canvas.DrawTileStretched(Texture'InterfaceArt_tex.Menu.AltComboTickBlurry', Canvas.ClipX * WelcomeWidth, Canvas.ClipY * (yw + WelcomeMargin * 2));
|
||||
// else
|
||||
// Canvas.DrawTileStretched(texture 'InterfaceContent.Menu.EditBoxDown', Canvas.ClipX * WelcomeWidth, Canvas.ClipY * (yw + WelcomeMargin * 2));
|
||||
// end if _RO_
|
||||
|
||||
//cPlayerHightlight ScoreBoxB/C ButtonFocus
|
||||
y += WelcomeMargin;
|
||||
x += WelcomeMargin;
|
||||
|
||||
for (i = WelcomeStart[index]; i <= WelcomeEnd[index]; ++i) {
|
||||
DrawTextBox (canvas, WelcomeMsg[i], false, x, y, xw);
|
||||
}
|
||||
}
|
||||
|
||||
function DrawWarnMsg (Canvas canvas, string m)
|
||||
{
|
||||
local float xl, yl;
|
||||
|
||||
//Canvas.Font = class'HUD'.static.GetMediumFontFor (Canvas); //hm funka inte.. noo
|
||||
Canvas.Font = class'UT2MidGameFont'.static.GetMidGameFont(Canvas.ClipX);
|
||||
|
||||
Canvas.StrLen(m,XL,YL);
|
||||
Canvas.DrawColor = class'HUD'.default.GoldColor;
|
||||
|
||||
Canvas.SetPos(0.5*(Canvas.ClipX-XL), Canvas.ClipY * 0.15);
|
||||
Canvas.DrawText(m, true);
|
||||
}
|
||||
|
||||
function DrawStats (Canvas canvas)
|
||||
{
|
||||
/*
|
||||
local float xl, yl;
|
||||
|
||||
Canvas.Font = class'HUD'.static.GetConsoleFont (Canvas);
|
||||
Canvas.DrawColor = class'HUD'.default.WhiteColor;
|
||||
Canvas.StrLen("o_O", xl, yl);
|
||||
Canvas.SetPos(0.01 * (Canvas.ClipX), Canvas.ClipY * 0.25);
|
||||
Canvas.DrawText("UTV Clients: " $ Clients, true);
|
||||
Canvas.SetPos(0.01 * (Canvas.ClipX), Canvas.ClipY * 0.25 + yl * 1.1);
|
||||
Canvas.DrawText("UTV Delay: " $ Delay $ " seconds", true);
|
||||
*/
|
||||
}
|
||||
|
||||
function PostRender( canvas Canvas )
|
||||
{
|
||||
if (p == none) {
|
||||
Log ("utv: Interaction setting playercontroller to " $ viewportowner.actor);
|
||||
p = ViewPortOwner.Actor;
|
||||
}
|
||||
|
||||
Canvas.Style = p.ERenderStyle.STY_Alpha;
|
||||
|
||||
if (!shownWelcome) {
|
||||
DrawWelcome (canvas);
|
||||
}
|
||||
|
||||
//Anything important to tell the client?
|
||||
if (RestartIn > 0) {
|
||||
DrawWarnMsg (Canvas, "The ROTV Proxy will restart in about " $ RestartIn $ " seconds");
|
||||
}
|
||||
else {
|
||||
if (WarnMsg != "") {
|
||||
DrawWarnMsg (Canvas, WarnMsg);
|
||||
}
|
||||
}
|
||||
|
||||
DrawStats (Canvas);
|
||||
}
|
||||
|
||||
function ShowChat (string msg)
|
||||
{
|
||||
Viewportowner.Actor.ClientMessage (msg);
|
||||
}
|
||||
|
||||
function ShowMenu ()
|
||||
{
|
||||
}
|
||||
|
||||
simulated function GotStatus (string s)
|
||||
{
|
||||
local string tmps;
|
||||
local int i;
|
||||
|
||||
//Parse out the values
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
clients = int (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
delay = int (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
restartin = int (s);
|
||||
|
||||
Log ("utv: Got status - " $ clients $ " - " $ delay $ " - " $ restartin);
|
||||
}
|
||||
|
||||
simulated function GotBigStatus (string s)
|
||||
{
|
||||
local string tmps;
|
||||
local int i;
|
||||
|
||||
//Parse out the values
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
ServerAddress = tmps;
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
ServerPort = int (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
ListenPort = int (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
JoinPassword = tmps;
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
PrimaryPassword = tmps;
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
VipPassword = tmps;
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
NormalPassword = tmps;
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
Delay = float (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
MaxClients = int (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
}
|
||||
|
||||
state Primary
|
||||
{
|
||||
function bool KeyEvent( out EInputKey Key, out EInputAction Action, FLOAT Delta )
|
||||
{
|
||||
local string tmp;
|
||||
|
||||
if (GlobalKeyEvent (Key, Action, Delta))
|
||||
return true;
|
||||
|
||||
//Check stuff
|
||||
if (Action == IST_Press) {
|
||||
//teamsay key?
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYNAME " $ key);
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYBINDING " $ tmp);
|
||||
|
||||
if (tmp ~= "TeamTalk") {
|
||||
p.ClientOpenMenu (class'utvReplication'.default.UtvPackage $ ".utvInputPage");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ShowMenu ()
|
||||
{
|
||||
if(ListenPort!=0){
|
||||
//StopForceFeedback();
|
||||
p.ClientMessage ("Opening menu");
|
||||
p.ClientOpenMenu(class'utvReplication'.default.UtvPackage $ ".utvPrimaryMenu");
|
||||
} else {
|
||||
p.ClientMessage ("Waiting for info from proxy");
|
||||
}
|
||||
}
|
||||
|
||||
function DrawWelcome (canvas canvas)
|
||||
{
|
||||
DrawWelcomeText (canvas, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
state Secondary
|
||||
{
|
||||
function ShowMenu ()
|
||||
{
|
||||
//StopForceFeedback();
|
||||
p.ClientMessage ("Opening menu");
|
||||
p.ClientOpenMenu(class'utvReplication'.default.UtvPackage $ ".utvWatcherMenu");
|
||||
}
|
||||
|
||||
function bool KeyEvent( out EInputKey Key, out EInputAction Action, FLOAT Delta )
|
||||
{
|
||||
local string tmp;
|
||||
|
||||
if (GlobalKeyEvent (Key, Action, Delta))
|
||||
return true;
|
||||
|
||||
//Check stuff
|
||||
if (Action == IST_Press) {
|
||||
|
||||
//Right mouse pressed?
|
||||
if (Key == IK_RightMouse) {
|
||||
if(utvRep.FollowPrimary){
|
||||
if(utvRep.SeeAll){
|
||||
utvRep.FollowPrimary=false;
|
||||
utvRep.FreeFlight=true;
|
||||
p.ClientMessage ("Free flight mode");
|
||||
} else {
|
||||
if (class'utvReplication'.default.wantBehindview)
|
||||
class'utvReplication'.default.wantBehindview = false;
|
||||
else
|
||||
class'utvReplication'.default.wantBehindview = true;
|
||||
}
|
||||
} else {
|
||||
if(utvRep.FreeFlight || class'utvReplication'.default.wantBehindview){
|
||||
utvRep.FreeFlight=false;
|
||||
if(utvRep.LastTargetName=="")
|
||||
utvRep.GetNextPlayer();
|
||||
if(class'utvReplication'.default.wantBehindview){
|
||||
p.ClientMessage ("Following player in 1st person view");
|
||||
class'utvReplication'.default.wantBehindview = false;
|
||||
} else {
|
||||
p.ClientMessage ("Following player with behindview");
|
||||
class'utvReplication'.default.wantBehindview = true;
|
||||
}
|
||||
} else {
|
||||
if(utvRep.NoPrimary){
|
||||
utvRep.FollowPrimary=false;
|
||||
utvRep.FreeFlight=true;
|
||||
p.ClientMessage ("Free flight mode");
|
||||
} else {
|
||||
class'utvReplication'.default.wantBehindview = false;
|
||||
utvRep.FollowPrimary=true;
|
||||
p.ClientMessage ("Following primary");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (Key == IK_LeftMouse) {
|
||||
if(!utvRep.FollowPrimary){
|
||||
utvRep.GetNextPlayer();
|
||||
utvRep.FreeFlight=false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Or the say key?
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYNAME " $ key);
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYBINDING " $ tmp);
|
||||
|
||||
if (tmp ~= "Talk") {
|
||||
p.ClientOpenMenu (class'utvReplication'.default.UtvPackage $ ".utvInputPage");
|
||||
return true;
|
||||
}
|
||||
if (tmp ~= "MoveForward") {
|
||||
utvRep.MoveForward=true;
|
||||
}
|
||||
if (tmp ~= "MoveBackward") {
|
||||
utvRep.MoveBackward=true;
|
||||
}
|
||||
if (tmp ~= "StrafeLeft") {
|
||||
utvRep.MoveLeft=true;
|
||||
}
|
||||
if (tmp ~= "StrafeRight") {
|
||||
utvRep.MoveRight=true;
|
||||
}
|
||||
if (tmp ~= "Jump") {
|
||||
utvRep.MoveUp=true;
|
||||
}
|
||||
if (tmp ~= "Duck") {
|
||||
utvRep.MoveDown=true;
|
||||
}
|
||||
}
|
||||
if (Action == IST_Release) {
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYNAME " $ key);
|
||||
tmp = Viewportowner.Actor.ConsoleCommand ("KEYBINDING " $ tmp);
|
||||
|
||||
if (tmp ~= "MoveForward") {
|
||||
utvRep.MoveForward=false;
|
||||
}
|
||||
if (tmp ~= "MoveBackward") {
|
||||
utvRep.MoveBackward=false;
|
||||
}
|
||||
if (tmp ~= "StrafeLeft") {
|
||||
utvRep.MoveLeft=false;
|
||||
}
|
||||
if (tmp ~= "StrafeRight") {
|
||||
utvRep.MoveRight=false;
|
||||
}
|
||||
if (tmp ~= "Jump") {
|
||||
utvRep.MoveUp=false;
|
||||
}
|
||||
if (tmp ~= "Duck") {
|
||||
utvRep.MoveDown=false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function DrawWelcome (canvas canvas)
|
||||
{
|
||||
DrawWelcomeText (canvas, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
bActive=true
|
||||
bVisible=true
|
||||
WelcomeWidth=0.4
|
||||
WelcomeMargin=0.02
|
||||
WelcomePos=0.2
|
||||
WelcomeStart[0]=0
|
||||
WelcomeEnd[0]=4
|
||||
WelcomeMsg[0]="Welcome to <2>ROTV<1> Primary Client!"
|
||||
WelcomeMsg[1]=""
|
||||
WelcomeMsg[2]="You are now broadcasting a game to people over the net! To configure settings and control the ROTV server, press <2>F8<1> to bring up the configuration menu."
|
||||
WelcomeMsg[3]=""
|
||||
WelcomeMsg[4]="Press any key to close this window.."
|
||||
WelcomeStart[1]=5
|
||||
WelcomeEnd[1]=11
|
||||
WelcomeMsg[5]="Welcome to <2>ROTV<1> Watcher Client!"
|
||||
WelcomeMsg[6]=""
|
||||
WelcomeMsg[7]="You are watching a live broadcast of a game! To configure watcher settings press <2>F8<1> to bring up the configuration menu."
|
||||
WelcomeMsg[8]=""
|
||||
WelcomeMsg[9]="To toggle between first and third person view, press the <2>right<1> mouse button."
|
||||
WelcomeMsg[10]=""
|
||||
WelcomeMsg[11]="Press any key to close this window.."
|
||||
}
|
||||
170
kf_sources/UTV2004c/Classes/utvMutator.uc
Normal file
170
kf_sources/UTV2004c/Classes/utvMutator.uc
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvMutator extends Mutator;
|
||||
|
||||
var string origcontroller;
|
||||
var class<PlayerController> origcclass;
|
||||
|
||||
var array<int> utvId;
|
||||
|
||||
//C is the owner
|
||||
function CreateInitialUtvReplication(Controller c)
|
||||
{
|
||||
local utvReplicationInfo uri;
|
||||
local Controller p;
|
||||
|
||||
foreach dynamicactors(class'Controller', p) {
|
||||
if (p != c) {
|
||||
//Log("Initially spawning utvReplicationInfo for player " $ p.PlayerReplicationInfo.PlayerName $ " owner " $ c.PlayerReplicationInfo.PlayerName);
|
||||
uri = Spawn(class'utvReplicationInfo', c);
|
||||
uri.OwnerCtrl = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//C is the possible new player
|
||||
function CreateUtvReplication(Controller c)
|
||||
{
|
||||
local utvReplicationInfo uri;
|
||||
local PlayerController pc;
|
||||
local bool found;
|
||||
|
||||
foreach dynamicactors(class'PlayerController', pc) {
|
||||
//Only spawn these for controllers that are utv in seeall mode
|
||||
if (!pc.bAllActorsRelevant)
|
||||
continue;
|
||||
|
||||
found = false;
|
||||
foreach dynamicactors(class'utvReplicationInfo', uri) {
|
||||
if ((uri.OwnerPlayer == c.PlayerReplicationInfo) && (uri.Owner == pc)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
//Log("Spawning utvReplicationInfo for player " $ c.PlayerReplicationInfo.PlayerName $ " owner " $ pc.PlayerReplicationInfo.PlayerName);
|
||||
uri = Spawn(class'utvReplicationInfo', pc);
|
||||
uri.OwnerCtrl = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Tick(float deltaTime)
|
||||
{
|
||||
local PlayerController pc;
|
||||
local int i;
|
||||
|
||||
super.Tick(deltaTime);
|
||||
|
||||
if (utvId.Length > 0) {
|
||||
foreach dynamicactors(class'PlayerController', pc) {
|
||||
for (i = 0; i < utvId.Length; ++i) {
|
||||
if (pc.PlayerReplicationInfo.PlayerID == utvId[i]) {
|
||||
CreateInitialUtvReplication(pc);
|
||||
Log(FriendlyName $ ": Found new ROTV player: " $ pc.PlayerReplicationInfo.PlayerName);
|
||||
utvId.Remove(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Returns a suitable UTV-spectator class. Knows about UTComp and TTM
|
||||
function string GetNewController()
|
||||
{
|
||||
local string cur;
|
||||
local string newc;
|
||||
cur = Level.Game.PlayerControllerClassName;
|
||||
|
||||
//Utcomp?
|
||||
if (InStr(cur, "BS_") > 0) {
|
||||
newc = Repl(cur, "BS_", "UTV_BS_", false);
|
||||
Log(FriendlyName $ ": UTComp detected, using class " $ newc);
|
||||
}
|
||||
else if (InStr(cur, "TTM_PlayerController") > 0) {
|
||||
newc = Repl(cur, "TTM_PlayerController", "TTM_UTV_Spectator", false);
|
||||
Log(FriendlyName $ ": TTM detected, using class " $ newc);
|
||||
}
|
||||
else {
|
||||
newc = FriendlyName $ ".utvSpectator";
|
||||
Log(FriendlyName $ ": Using class " $ newc);
|
||||
}
|
||||
|
||||
return newc;
|
||||
}
|
||||
|
||||
function ModifyLogin(out string Portal, out string Options)
|
||||
{
|
||||
local bool bSeeAll;
|
||||
local bool bSpectator;
|
||||
|
||||
super.ModifyLogin (Portal, Options);
|
||||
|
||||
if (Level.game == none) {
|
||||
Log (FriendlyName $ ": Level.game is none?");
|
||||
return;
|
||||
}
|
||||
|
||||
//If we replaced the controller last time round, make sure to restore it
|
||||
if (origcontroller != "") {
|
||||
Level.Game.PlayerControllerClassName = origcontroller;
|
||||
Level.Game.PlayerControllerClass = origcclass;
|
||||
origcontroller = "";
|
||||
}
|
||||
|
||||
bSpectator = ( Level.Game.ParseOption( Options, "SpectatorOnly" ) ~= "1" );
|
||||
bSeeAll = ( Level.Game.ParseOption( Options, "UTVSeeAll" ) ~= "1" );
|
||||
|
||||
if (bSeeAll && bSpectator) {
|
||||
Log(FriendlyName $ ": Player with id " $ Level.Game.CurrentID $ " is requesting SeeAll");
|
||||
|
||||
utvId[utvId.Length] = Level.Game.CurrentID;
|
||||
|
||||
origcontroller = Level.Game.PlayerControllerClassName;
|
||||
origcclass = Level.Game.PlayerControllerClass;
|
||||
Level.Game.PlayerControllerClassName = GetNewController();
|
||||
Level.Game.PlayerControllerClass = none;
|
||||
}
|
||||
}
|
||||
|
||||
function ModifyPlayer(Pawn Other)
|
||||
{
|
||||
super.ModifyPlayer(Other);
|
||||
|
||||
CreateUtvReplication(Other.Controller);
|
||||
}
|
||||
|
||||
function NotifyLogout(Controller Exiting)
|
||||
{
|
||||
local utvReplicationInfo uri;
|
||||
local PlayerController pc;
|
||||
|
||||
super.NotifyLogout(Exiting);
|
||||
|
||||
//Log if seeall players leave
|
||||
pc = PlayerController(Exiting);
|
||||
if ((pc != none) && (pc.bAllActorsRelevant)) {
|
||||
Log(FriendlyName $ ": SeeAll enabled player " $ Exiting.PlayerReplicationInfo.PlayerName $ " (" $ Exiting.PlayerReplicationInfo.PlayerID $ ") leaving");
|
||||
}
|
||||
|
||||
//Remove all utvReplicationInfos associated with the leaving player
|
||||
foreach dynamicactors(class'utvReplicationInfo', uri) {
|
||||
if ((uri.OwnerCtrl == Exiting) || (uri.Owner == Exiting)) {
|
||||
//Log("Removing utvReplication for pawn " $ Exiting $ " player " $ uri.Owner);
|
||||
uri.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
bAddToServerPackages=true
|
||||
IconMaterialName="MutatorArt.nosym"
|
||||
ConfigMenuClassName=""
|
||||
GroupName=""
|
||||
FriendlyName="UTV2004S"
|
||||
Description="Required to support ROTV SeeAll mode"
|
||||
bAlwaysTick=true
|
||||
}
|
||||
446
kf_sources/UTV2004c/Classes/utvPrimaryMenu.uc
Normal file
446
kf_sources/UTV2004c/Classes/utvPrimaryMenu.uc
Normal file
|
|
@ -0,0 +1,446 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvPrimaryMenu extends ut2k3guIPage;
|
||||
|
||||
var float BoxHeight;
|
||||
var float BoxWidth;
|
||||
var float MarginWidth;
|
||||
var float ItemHeight;
|
||||
var float ItemGap;
|
||||
|
||||
var utvInteraction ui;
|
||||
var utvReplication ur;
|
||||
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
local int a, prev, mark;
|
||||
local utvInteraction tui;
|
||||
local utvReplication tur;
|
||||
|
||||
super.InitComponent(MyController, MyOwner);
|
||||
|
||||
//The window
|
||||
Controls[0].WinHeight = BoxHeight;
|
||||
Controls[0].WinWidth = BoxWidth;
|
||||
Controls[0].WinTop = 0.5 - (0.5 * BoxHeight);
|
||||
Controls[0].WinLeft = 0.5 - (0.5 * BoxWidth);
|
||||
|
||||
//Headline
|
||||
Controls[1].WinHeight = ItemHeight;
|
||||
Controls[1].WinWidth = BoxWidth - (MarginWidth * 2);
|
||||
Controls[1].WinTop = Controls[0].WinTop + 0.002; // + ItemGap * 5;
|
||||
Controls[1].WinLeft = Controls[0].WinLeft + MarginWidth;
|
||||
|
||||
//label total clients
|
||||
Controls[2].WinHeight = ItemHeight;
|
||||
Controls[2].WinWidth = BoxWidth*0.4;
|
||||
Controls[2].WinTop = Controls[1].WinTop + ItemGap + ItemHeight;
|
||||
Controls[2].WinLeft = Controls[1].WinLeft + MarginWidth;
|
||||
|
||||
|
||||
///mmuuu
|
||||
|
||||
//label mute
|
||||
Controls[24].WinHeight = ItemHeight;
|
||||
Controls[24].WinWidth = BoxWidth*0.4;
|
||||
Controls[24].WinTop = Controls[2].WinTop + ItemGap + ItemHeight;
|
||||
Controls[24].WinLeft = Controls[2].WinLeft;
|
||||
|
||||
//divider
|
||||
Controls[26].WinHeight = 0.005;
|
||||
Controls[26].WinWidth = BoxWidth - (MarginWidth * 2);
|
||||
Controls[26].WinTop = Controls[24].WinTop + ItemGap + ItemHeight;
|
||||
Controls[26].WinLeft = Controls[1].WinLeft;
|
||||
|
||||
|
||||
|
||||
//label serveraddress
|
||||
Controls[3].WinHeight = ItemHeight;
|
||||
Controls[3].WinWidth = Controls[24].WinWidth;
|
||||
Controls[3].WinTop = Controls[24].WinTop + ItemGap * 3 + ItemHeight;
|
||||
Controls[3].WinLeft = Controls[24].WinLeft;
|
||||
|
||||
//rest of the labels
|
||||
prev=3;
|
||||
mark=0;
|
||||
for(a=4;a<11;++a){
|
||||
if ((a == 8) && (mark == 0)) { //would renumbering have been easier? :)
|
||||
a = 22;
|
||||
mark = 1;
|
||||
}
|
||||
Controls[a].WinHeight = ItemHeight;
|
||||
Controls[a].WinWidth = Controls[prev].WinWidth;
|
||||
Controls[a].WinTop = Controls[prev].WinTop + ItemGap + ItemHeight;
|
||||
Controls[a].WinLeft = Controls[prev].WinLeft;
|
||||
|
||||
prev=a;
|
||||
if ((a == 22) && (mark == 1))
|
||||
a = 7;
|
||||
}
|
||||
|
||||
//ok button
|
||||
Controls[11].WinHeight = ItemHeight;
|
||||
Controls[11].WinWidth = Controls[10].WinWidth;
|
||||
Controls[11].WinTop = Controls[10].WinTop + ItemHeight * 2;
|
||||
Controls[11].WinLeft = Controls[10].WinLeft;
|
||||
|
||||
//textbox total clients
|
||||
Controls[12].WinHeight = ItemHeight;
|
||||
Controls[12].WinWidth = BoxWidth*0.5;
|
||||
Controls[12].WinTop = Controls[1].WinTop + ItemGap * 2 + ItemHeight;
|
||||
Controls[12].WinLeft = Controls[0].WinLeft+BoxWidth*0.5;
|
||||
|
||||
|
||||
//muu
|
||||
//checkbox mute chat
|
||||
Controls[25].WinHeight = ItemHeight;
|
||||
Controls[25].WinWidth = ItemHeight;
|
||||
Controls[25].WinTop = Controls[12].WinTop + ItemHeight;
|
||||
Controls[25].WinLeft = Controls[12].WinLeft;
|
||||
|
||||
//textbox serveraddress
|
||||
Controls[13].WinHeight = ItemHeight;
|
||||
Controls[13].WinWidth = BoxWidth*0.4;
|
||||
Controls[13].WinTop = Controls[25].WinTop + ItemGap * 3 + ItemHeight;
|
||||
Controls[13].WinLeft = Controls[25].WinLeft;
|
||||
|
||||
//rest of the textboxes
|
||||
prev=13;
|
||||
mark=0;
|
||||
for(a=14;a<21;++a){
|
||||
if ((a == 18) && (mark == 0)) {
|
||||
a = 23;
|
||||
mark = 1;
|
||||
}
|
||||
Controls[a].WinHeight = ItemHeight;
|
||||
Controls[a].WinWidth = Controls[prev].WinWidth;
|
||||
Controls[a].WinTop = Controls[prev].WinTop + ItemGap + ItemHeight;
|
||||
Controls[a].WinLeft = Controls[prev].WinLeft;
|
||||
Controls[a].TabOrder = Controls[prev].TabOrder + 1;
|
||||
|
||||
prev=a;
|
||||
if ((a == 23) && (mark == 1))
|
||||
a = 17;
|
||||
}
|
||||
|
||||
//reset button
|
||||
Controls[21].WinHeight = ItemHeight;
|
||||
Controls[21].WinWidth = Controls[20].WinWidth;
|
||||
Controls[21].WinTop = Controls[20].WinTop + ItemHeight * 2;
|
||||
Controls[21].WinLeft = Controls[20].WinLeft;
|
||||
|
||||
foreach AllObjects (class'utvInteraction', tui) {
|
||||
ui = tui;
|
||||
}
|
||||
foreach AllObjects (class'utvReplication', tur) {
|
||||
ur = tur;
|
||||
}
|
||||
|
||||
GUILabel(Controls[12]).Caption=string(ui.Clients);
|
||||
GUIEditBox(Controls[13]).TextStr=ui.ServerAddress;
|
||||
GUIEditBox(Controls[14]).TextStr=string(ui.ServerPort);
|
||||
GUIEditBox(Controls[15]).TextStr=string(ui.ListenPort);
|
||||
GUIEditBox(Controls[16]).TextStr=ui.JoinPassword;
|
||||
GUIEditBox(Controls[17]).TextStr=ui.PrimaryPassword;
|
||||
GUIEditBox(Controls[18]).TextStr=ui.NormalPassword;
|
||||
GUIEditBox(Controls[19]).TextStr=string(ui.Delay);
|
||||
GUIEditBox(Controls[20]).TextStr=string(ui.MaxClients);
|
||||
GUIEditBox(Controls[23]).TextStr=ui.VipPassword;
|
||||
GUICheckBoxButton(Controls[25]).bChecked=!ur.MuteChat;
|
||||
|
||||
OnClose = InternalOnClose;
|
||||
|
||||
RemapComponents();
|
||||
}
|
||||
|
||||
function InternalOnClose(optional bool bCanceled)
|
||||
{
|
||||
local PlayerController pc;
|
||||
|
||||
pc = PlayerOwner();
|
||||
|
||||
if(pc != None && pc.Level.Pauser != None)
|
||||
pc.SetPause(false);
|
||||
|
||||
Super.OnClose(bCanceled);
|
||||
}
|
||||
|
||||
function bool InternalOnClick(GUIComponent Sender)
|
||||
{
|
||||
if (Sender == Controls[11]) //Ok button
|
||||
{
|
||||
ur.MuteChat=!GUICheckBoxButton(Controls[25]).bChecked;
|
||||
SendChanges ();
|
||||
Controller.CloseMenu ();
|
||||
}
|
||||
if (Sender == Controls[21]) //Reset button
|
||||
{
|
||||
ui.p.ClientMessage ("Resetting server");
|
||||
SendChanges ();
|
||||
ResetServer ();
|
||||
Controller.CloseMenu ();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function InternalOnChange(GUIComponent Sender)
|
||||
{
|
||||
}
|
||||
|
||||
function SendChanges ()
|
||||
{
|
||||
local string s;
|
||||
|
||||
ui.ServerAddress=GUIEditBox(Controls[13]).TextStr;
|
||||
ui.ServerPort=int(GUIEditBox(Controls[14]).TextStr);
|
||||
ui.ListenPort=int(GUIEditBox(Controls[15]).TextStr);
|
||||
ui.JoinPassword=GUIEditBox(Controls[16]).TextStr;
|
||||
ui.PrimaryPassword=GUIEditBox(Controls[17]).TextStr;
|
||||
ui.NormalPassword=GUIEditBox(Controls[18]).TextStr;
|
||||
ui.Delay=float(GUIEditBox(Controls[19]).TextStr);
|
||||
ui.MaxClients=int(GUIEditBox(Controls[20]).TextStr);
|
||||
ui.VipPassword=GUIEditBox(Controls[23]).TextStr;
|
||||
|
||||
s="5 serveraddress=" $ ui.ServerAddress;
|
||||
s=s $ " serverport=" $ ui.ServerPort;
|
||||
s=s $ " listenport=" $ ui.ListenPort;
|
||||
s=s $ " joinpassword=" $ ui.JoinPassword;
|
||||
s=s $ " primarypassword=" $ ui.PrimaryPassword;
|
||||
s=s $ " vippassword=" $ ui.VipPassword;
|
||||
s=s $ " normalpassword=" $ ui.NormalPassword;
|
||||
s=s $ " delay=" $ ui.Delay;
|
||||
s=s $ " maxclients=" $ ui.maxclients;
|
||||
|
||||
ur.SendToServer(s);
|
||||
}
|
||||
|
||||
function ResetServer ()
|
||||
{
|
||||
local string s;
|
||||
|
||||
s="6 ";
|
||||
ur.SendToServer(s);
|
||||
}
|
||||
|
||||
/*
|
||||
Begin Object Class=GUIButton name=Background
|
||||
bAcceptsInput=false
|
||||
bNeverFocus=true
|
||||
StyleName="SquareBar"
|
||||
End Object
|
||||
*/
|
||||
|
||||
//display95 99
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object Class=GUIImage name=Background
|
||||
bAcceptsInput=false
|
||||
bNeverFocus=true
|
||||
// if _RO_
|
||||
Image=Texture'InterfaceArt_tex.Menu.RODisplay'
|
||||
// else
|
||||
// Image=material'2K4Menus.NewControls.Display95'
|
||||
// end if _RO_
|
||||
ImageStyle=ISTY_Stretched
|
||||
End Object
|
||||
Controls(0)=GUIImage'Background'
|
||||
|
||||
Begin Object class=GUILabel Name=TitleText
|
||||
Caption="ROTV Primary settings"
|
||||
TextAlign=TXTA_Center
|
||||
TextColor=(R=255,G=255,B=0,A=255)
|
||||
bTransparent=true
|
||||
Name="TitleText"
|
||||
End Object
|
||||
Controls(1)=GUILabel'TitleText'
|
||||
|
||||
Begin Object class=GUILabel name=Label1
|
||||
Caption="Total clients"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(2)=GUILabel'Label1'
|
||||
|
||||
Begin Object class=GUILabel name=LabelSA
|
||||
Caption="Server address"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(3)=GUILabel'LabelSA'
|
||||
|
||||
Begin Object class=GUILabel name=LabelSP
|
||||
Caption="Server port"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(4)=GUILabel'LabelSP'
|
||||
|
||||
Begin Object class=GUILabel name=LabelLP
|
||||
Caption="Listen port"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(5)=GUILabel'LabelLP'
|
||||
|
||||
Begin Object class=GUILabel name=LabelJP
|
||||
Caption="Join password"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(6)=GUILabel'LabelJP'
|
||||
|
||||
Begin Object class=GUILabel name=LabelPP
|
||||
Caption="Primary password"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(7)=GUILabel'LabelPP'
|
||||
|
||||
Begin Object class=GUILabel name=LabelVP
|
||||
Caption="VIP password"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(22)=GUILabel'LabelVP'
|
||||
|
||||
Begin Object class=GUILabel name=LabelNP
|
||||
Caption="Normal password"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(8)=GUILabel'LabelNP'
|
||||
|
||||
Begin Object class=GUILabel name=LabelD
|
||||
Caption="Delay"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(9)=GUILabel'LabelD'
|
||||
|
||||
Begin Object class=GUILabel name=LabelMC
|
||||
Caption="Max clients"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(10)=GUILabel'LabelMC'
|
||||
|
||||
Begin Object Class=GUIButton Name=OkButton
|
||||
StyleName="MidGameButton"
|
||||
OnClick=InternalOnClick
|
||||
Caption="OK"
|
||||
TabOrder=50
|
||||
End Object
|
||||
Controls(11)=GUIButton'OkButton'
|
||||
|
||||
Begin Object class=GUILabel name=LabelTC
|
||||
Caption="tc"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
bMultiLine=true
|
||||
End Object
|
||||
Controls(12)=GUILabel'LabelTC'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxSA
|
||||
Caption=""
|
||||
TabOrder=1
|
||||
End Object
|
||||
Controls(13)=GUIEditBox'BoxSA'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxSP
|
||||
Caption=""
|
||||
bIntOnly=true;
|
||||
End Object
|
||||
Controls(14)=GUIEditBox'BoxSP'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxLP
|
||||
Caption=""
|
||||
bIntOnly=true;
|
||||
End Object
|
||||
Controls(15)=GUIEditBox'BoxLP'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxJP
|
||||
Caption=""
|
||||
End Object
|
||||
Controls(16)=GUIEditBox'BoxJP'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxPP
|
||||
Caption=""
|
||||
End Object
|
||||
Controls(17)=GUIEditBox'BoxPP'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxVP
|
||||
Caption=""
|
||||
End Object
|
||||
Controls(23)=GUIEditBox'BoxVP'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxNP
|
||||
Caption=""
|
||||
End Object
|
||||
Controls(18)=GUIEditBox'BoxNP'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxD
|
||||
Caption=""
|
||||
bFloatOnly=true;
|
||||
End Object
|
||||
Controls(19)=GUIEditBox'BoxD'
|
||||
|
||||
Begin Object class=GUIEditBox name=BoxMC
|
||||
Caption=""
|
||||
bIntOnly=true;
|
||||
End Object
|
||||
Controls(20)=GUIEditBox'BoxMC'
|
||||
|
||||
Begin Object Class=GUIButton Name=ResetButton
|
||||
StyleName="MidGameButton"
|
||||
OnClick=InternalOnClick
|
||||
Caption="Reset"
|
||||
TabOrder=51
|
||||
End Object
|
||||
Controls(21)=GUIButton'ResetButton'
|
||||
|
||||
Begin Object class=GUILabel name=LabelMute
|
||||
Caption="Show ROTV Chat"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
End Object
|
||||
Controls(24)=GUILabel'LabelMute'
|
||||
|
||||
Begin Object class=GUICheckBoxButton name=MuteButton
|
||||
TabOrder=100
|
||||
End Object
|
||||
Controls(25)=GUICheckBoxButton'MuteButton'
|
||||
|
||||
Begin Object Class=GUIEditBox name=HorizLine
|
||||
bAcceptsInput=false
|
||||
bNeverFocus=true
|
||||
Caption=""
|
||||
End Object
|
||||
Controls(26)=GUIButton'HorizLine'
|
||||
|
||||
bRequire640x480=false
|
||||
bAllowedAsLast=true
|
||||
bRenderWorld=true
|
||||
|
||||
BoxHeight=0.74
|
||||
BoxWidth=0.5
|
||||
MarginWidth=0.02
|
||||
ItemHeight=0.04
|
||||
ItemGap=0.01
|
||||
|
||||
OpenSound=none
|
||||
}
|
||||
741
kf_sources/UTV2004c/Classes/utvReplication.uc
Normal file
741
kf_sources/UTV2004c/Classes/utvReplication.uc
Normal file
|
|
@ -0,0 +1,741 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvReplication extends Actor;
|
||||
|
||||
//A constant of sorts
|
||||
var config string UtvPackage;
|
||||
|
||||
//Configuration things
|
||||
var config int ViewMode; //0 = locked on freeflight, 1 = free, 2 = locked
|
||||
|
||||
struct Movement {
|
||||
var float time;
|
||||
var vector loc;
|
||||
var rotator rot;
|
||||
};
|
||||
|
||||
var Movement moves[1000]; //Around 10 should be enough.. :)
|
||||
var int movehead;
|
||||
var int movetail;
|
||||
|
||||
var bool viewingSelf;
|
||||
var int lastViewedSelf;
|
||||
|
||||
var bool SeeAll;
|
||||
var bool NoPrimary;
|
||||
var bool FollowPrimary;
|
||||
var bool OldFollow;
|
||||
var bool IsDemo;
|
||||
var bool MuteChat;
|
||||
var string LastTargetName;
|
||||
var bool FreeFlight;
|
||||
var Vector LocalPos;
|
||||
var bool LocalPosSet;
|
||||
var bool moveForward,moveBackward,moveLeft,moveRight,moveUp,moveDown; //shouldnt be needed but playercontroller aForward etc always 0 ?
|
||||
|
||||
struct TInterpol
|
||||
{
|
||||
var float k1;
|
||||
var float k2; //slope
|
||||
var float y1;
|
||||
var float y2; //cur & next value
|
||||
var float g1;
|
||||
var float c1;
|
||||
var float dy;
|
||||
var float h1;
|
||||
};
|
||||
|
||||
struct TPlayerInterpol
|
||||
{
|
||||
var float x1; //cur & next timevalue
|
||||
var float x2;
|
||||
|
||||
var bool noinfo; //if true, do linear extrapolation instead
|
||||
|
||||
var TInterpol cords[7]; //x, y, z, rot.pitch, rot.yaw, viewrot.pitch, viewrot.yaw
|
||||
};
|
||||
|
||||
var TPlayerInterpol interpol;
|
||||
|
||||
var config string ChatString;
|
||||
var config bool wantBehindview;
|
||||
|
||||
replication
|
||||
{
|
||||
//Things the server calls on us
|
||||
reliable if (Role == ROLE_Authority)
|
||||
GetFromServer, GetTarget;
|
||||
|
||||
//Things we can call on the server
|
||||
reliable if (Role<ROLE_Authority)
|
||||
SendToServer, SendTarget;
|
||||
}
|
||||
|
||||
var utvInteraction uti;
|
||||
|
||||
var float currentTime;
|
||||
var float lastSend;
|
||||
|
||||
var bool wasEnded;
|
||||
|
||||
simulated event PostBeginPlay()
|
||||
{
|
||||
local PlayerController p;
|
||||
|
||||
Log ("utv: PostBeginPlay in replication");
|
||||
|
||||
p = level.GetLocalPlayerController ();
|
||||
lastViewedSelf = 2;
|
||||
class'utvReplication'.default.wantBehindview = true;
|
||||
|
||||
//Onslaught fixes
|
||||
OnslaughtFix();
|
||||
}
|
||||
|
||||
//Onslaught relies on RPC's to receive the current powerlink setup.
|
||||
//Unfortunately it is not ready to receive them until after the
|
||||
//first tick. UTV sometimes send them too soon, so this function makes sure
|
||||
//that the onslaught hud has run one tick before it happens.
|
||||
simulated function OnslaughtFix()
|
||||
{
|
||||
// Commented out UT2k4Merge - Ramm
|
||||
/* local PlayerController p;
|
||||
local ONSHUDOnslaught oh;
|
||||
|
||||
p = level.GetLocalPlayerController ();
|
||||
|
||||
//Sometimes this can't be found, so use alternative method
|
||||
if (p == none) {
|
||||
Log("utv: Level.GetLocalPlayerController was false, trying alternate method");
|
||||
oh = none;
|
||||
foreach dynamicactors(class'ONSHUDOnslaught', oh) {
|
||||
Log("utv: Found onslaught hud with alternate method");
|
||||
break;
|
||||
}
|
||||
if (oh == none)
|
||||
Log("utv: Alternate Onslaught node fix failed");
|
||||
}
|
||||
else {
|
||||
oh = ONSHUDOnslaught(p.myHUD);
|
||||
}
|
||||
|
||||
if (oh != none) {
|
||||
Log("utv: Preparing onslaught HUD for powerlink reception");
|
||||
oh.LinkActors();
|
||||
oh.Tick(0.1);
|
||||
}*/
|
||||
}
|
||||
|
||||
simulated event Tick (float deltatime)
|
||||
{
|
||||
local PlayerController p;
|
||||
local string s;
|
||||
local string cc, w;
|
||||
|
||||
super.Tick (deltatime);
|
||||
|
||||
currentTime += deltaTime;
|
||||
|
||||
//Wait with creating the interaction until we know our role
|
||||
if ((GetStateName () != 'Secondary') && (GetStateName() != 'Primary')) {
|
||||
log ("utv: Waiting for role information");
|
||||
return;
|
||||
}
|
||||
|
||||
p = Level.GetLocalPlayerController();
|
||||
if(p!=none && !LocalPosSet){
|
||||
localPosSet=true;
|
||||
localPos=p.location;
|
||||
}
|
||||
if (uti == none) {
|
||||
if ((p != none) && (p.Player != none) && (p.Player.InteractionMaster != none)) {
|
||||
Log ("utv: Creating utvInteraction");
|
||||
uti = utvInteraction (p.player.InteractionMaster.AddInteraction (class'utvReplication'.default.UtvPackage $ ".utvInteraction", p.player));
|
||||
uti.SetState (GetStateName () == 'Primary');
|
||||
uti.utvRep=self;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if the player has used utvsay
|
||||
if (class'utvReplication'.default.ChatString != "") {
|
||||
//If you don't watch chat you are not allowed to send either
|
||||
if (!MuteChat) {
|
||||
//Make sure message color is set to prevent colornicks to interfere
|
||||
w = chr(27)$chr(255)$chr(255)$chr(255);
|
||||
cc = "";
|
||||
if (GetStateName() == 'Primary')
|
||||
cc = chr(27)$"àà`";
|
||||
s = GetUrlOption ("Name") $ w $ ": " $ cc $ class'utvReplication'.default.ChatString;
|
||||
uti.ShowChat (s);
|
||||
SendToServer ("1 " $ s);
|
||||
Log ("utv: Sending chat: " $ s);
|
||||
}
|
||||
class'utvReplication'.default.ChatString = "";
|
||||
}
|
||||
}
|
||||
|
||||
function SendToServer (string s)
|
||||
{
|
||||
}
|
||||
|
||||
function SendTarget (Actor t)
|
||||
{
|
||||
}
|
||||
|
||||
simulated function GetTarget (Actor t)
|
||||
{
|
||||
local PlayerController p;
|
||||
|
||||
//In seeall mode, we don't want to mess with what the client is looking at
|
||||
if (!FollowPrimary)
|
||||
return;
|
||||
|
||||
//Always update, since this one is guaranteed to be correct
|
||||
p = level.GetLocalPlayerController ();
|
||||
if(p==t || t==p.pawn){
|
||||
if(lastViewedSelf>2){
|
||||
if (p.ViewTarget != t)
|
||||
p.SetViewTarget (t);
|
||||
viewingSelf=true;
|
||||
}else{
|
||||
lastViewedSelf++;
|
||||
}
|
||||
}else{
|
||||
viewingSelf=false;
|
||||
lastViewedSelf=0;
|
||||
if (p.ViewTarget != t)
|
||||
p.SetViewTarget (t);
|
||||
}
|
||||
}
|
||||
|
||||
simulated function GotInitMsg (string s)
|
||||
{
|
||||
local string tmps;
|
||||
local int i,a;
|
||||
|
||||
//Parse out the values
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
a = int (tmps);
|
||||
if (a == 1)
|
||||
GotoState ('Primary');
|
||||
else
|
||||
GotoState ('Secondary');
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
a = int (s);
|
||||
|
||||
if (a == 3) { //Looking at a server demo
|
||||
NoPrimary=true;
|
||||
IsDemo=true;
|
||||
OldFollow=false;
|
||||
FollowPrimary=false;
|
||||
SeeAll=true;
|
||||
FreeFlight=true;
|
||||
}
|
||||
else if (a == 4) { //Client demo
|
||||
IsDemo=true;
|
||||
SeeAll=false;
|
||||
NoPrimary=false;
|
||||
}
|
||||
|
||||
else if (a == 2){ //Noprimary and seeall
|
||||
SeeAll=true;
|
||||
NoPrimary=true;
|
||||
OldFollow=false;
|
||||
FollowPrimary=false;
|
||||
FreeFlight=true;
|
||||
} else if (a == 1){ //Seeall with primary
|
||||
SeeAll=true;
|
||||
NoPrimary=false;
|
||||
}else{ //Regular primary
|
||||
SeeAll=false;
|
||||
NoPrimary=false;
|
||||
}
|
||||
}
|
||||
|
||||
simulated function GetFromServer (string s)
|
||||
{
|
||||
local int i, cmd;
|
||||
local string tmp;
|
||||
|
||||
//Find the command number
|
||||
i = InStr (s, " ");
|
||||
tmp = Mid (s, 0, i);
|
||||
cmd = int (tmp);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
switch (cmd) {
|
||||
case 8:
|
||||
Log("utv: Got init " $ s);
|
||||
GotInitMsg(s);
|
||||
break;
|
||||
}
|
||||
|
||||
//No need to check the following if we are not initialized yet
|
||||
if (uti == none)
|
||||
return;
|
||||
|
||||
switch (cmd) {
|
||||
case 1:
|
||||
if (!MuteChat)
|
||||
uti.ShowChat (s);
|
||||
break;
|
||||
case 2:
|
||||
ReceiveMovement (s);
|
||||
break;
|
||||
case 4:
|
||||
uti.GotStatus (s);
|
||||
break;
|
||||
case 7:
|
||||
uti.GotBigStatus (s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Stub function
|
||||
simulated function ReceiveMovement (string s)
|
||||
{
|
||||
}
|
||||
|
||||
exec function utvsay (string s)
|
||||
{
|
||||
Log ("utv: Got utvsay: " $ s);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
state Primary {
|
||||
|
||||
simulated function BeginState ()
|
||||
{
|
||||
log ("utv: Entering primary state");
|
||||
}
|
||||
|
||||
simulated function CheckGameEnd ()
|
||||
{
|
||||
local PlayerController p;
|
||||
|
||||
if (!wasEnded) {
|
||||
p = Level.GetLocalPlayerController();
|
||||
if (p.IsInState('GameEnded')) {
|
||||
wasEnded = true;
|
||||
SendToServer ("3");
|
||||
Log ("utv: Send gameend to server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
simulated function SendInterpolValues ()
|
||||
{
|
||||
local string s;
|
||||
local playercontroller p;
|
||||
|
||||
p = level.GetLocalPlayerController ();
|
||||
s = "2 " /* $ currentTime $ " " */ $ p.Location $ " " $ p.Rotation;
|
||||
SendToServer (s);
|
||||
}
|
||||
|
||||
simulated function Tick (float delta)
|
||||
{
|
||||
local PlayerController p;
|
||||
|
||||
global.tick (delta);
|
||||
|
||||
//Send out values for interpolation
|
||||
if (currentTime - LastSend > 0.5) {
|
||||
p = level.GetLocalPlayerController ();
|
||||
SendInterpolValues ();
|
||||
LastSend = currentTime;
|
||||
|
||||
SendTarget (p.ViewTarget);
|
||||
}
|
||||
|
||||
//Check if the game has started
|
||||
CheckGameEnd ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
state Secondary
|
||||
{
|
||||
//Either x2 or both x2 and x3 can be zero, and indicates no known info at that time
|
||||
simulated function CalculateInterpol (int cord, float x1, float x2, float x3, float y1, float y2, float y3)
|
||||
{
|
||||
local TInterpol p;
|
||||
|
||||
//Retrieve last one
|
||||
p = interpol.cords[cord];
|
||||
|
||||
//Just stop if we don't even have two points
|
||||
if (x2 == 0) {
|
||||
x2 = x1;
|
||||
y2 = y1;
|
||||
}
|
||||
|
||||
p.y1 = y1;
|
||||
p.y2 = y2;
|
||||
|
||||
//Calculate start and endslope
|
||||
p.k1 = p.k2;
|
||||
|
||||
//If no info at x3, make the derivative zero
|
||||
if (x3 == 0)
|
||||
p.k2 = 0;
|
||||
else
|
||||
p.k2 = (y3 - y1) / (x3 - x1);
|
||||
|
||||
p.h1 = x2 - x1;
|
||||
p.dy = y2 - y1;
|
||||
|
||||
p.g1 = p.h1 * p.k1 - p.dy;
|
||||
p.c1 = 2 * p.dy - p.h1 * (p.k1 + p.k2);
|
||||
|
||||
interpol.cords[cord] = p;
|
||||
|
||||
//doh
|
||||
interpol.x1 = x1;
|
||||
interpol.x2 = x2;
|
||||
|
||||
interpol.noinfo = ((x2 == 0) || (x3 == 0));
|
||||
}
|
||||
|
||||
//Get position according to timestamp variable
|
||||
simulated function float GetInterpolatedPos (int cord)
|
||||
{
|
||||
local TInterpol p;
|
||||
local float h1;
|
||||
local float t;
|
||||
local float x1;
|
||||
local float x2;
|
||||
local float res;
|
||||
|
||||
p = interpol.cords [cord];
|
||||
x1 = interpol.x1;
|
||||
x2 = interpol.x2;
|
||||
|
||||
h1 = x2 - x1;
|
||||
|
||||
//assert: x1 < timestamp < x2
|
||||
if (x2 == x1)
|
||||
return 0;
|
||||
|
||||
t = (currentTime - x1) / (x2 - x1);
|
||||
|
||||
res = p.y1 + t * (p.dy) + t * (1 - t) * p.g1 + t*t * (1 - t) * p.c1;
|
||||
return res;
|
||||
}
|
||||
|
||||
//Makes sure the absolute differences between pitch & yaw isn't more than 32k (since it's mod 65k anyway)
|
||||
simulated function FixRotDist (out int t1, out int t2, optional bool down)
|
||||
{
|
||||
if (Abs (t1 - t2) > 32768) {
|
||||
if (t1 > 32768)
|
||||
t2 += 65536;
|
||||
else
|
||||
t2 -= 65536;
|
||||
}
|
||||
}
|
||||
|
||||
simulated function CheckGameEnd ()
|
||||
{
|
||||
local PlayerController p;
|
||||
|
||||
if (!wasEnded) {
|
||||
p = Level.GetLocalPlayerController();
|
||||
if (p.IsInState('GameEnded')) {
|
||||
wasEnded = true;
|
||||
SendToServer ("3");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
simulated function Tick (float delta)
|
||||
{
|
||||
local vector pos;
|
||||
local rotator rot;
|
||||
local string WarnMsg;
|
||||
local PlayerController p, it;
|
||||
local Pawn target;
|
||||
|
||||
global.tick (delta);
|
||||
|
||||
if(NoPrimary)
|
||||
CheckGameEnd();
|
||||
|
||||
p = Level.GetLocalPlayerController ();
|
||||
|
||||
//This saves bandwidth for the server because the client stops
|
||||
//sending ServerMove all the time
|
||||
if ((p != none) && (p.Role < ROLE_Authority)) {
|
||||
log("utv: Changing controller role to ROLE_Authority");
|
||||
p.Role = ROLE_Authority;
|
||||
}
|
||||
|
||||
//If watching a demo, do dilation adjustment for smoothness
|
||||
if ((IsDemo) && (Level.TimeDilation > 1.0)) {
|
||||
//Log("utv: Setting timedilation to 1.0");
|
||||
//Level.TimeDilation = 1.0;
|
||||
}
|
||||
|
||||
//When watching a server demo, the view rotation is not updated correctly
|
||||
if ((IsDemo) && (SeeAll)) {
|
||||
if ((p.ViewTarget != none) && (p.ViewTarget != p)) {
|
||||
target = Pawn(p.ViewTarget);
|
||||
if (target.Controller != none) {
|
||||
p.TargetViewRotation = target.Controller.Rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//A clientside demo needs to be adjusted as well
|
||||
if ((IsDemo) && (!SeeAll)) {
|
||||
Log("search");
|
||||
foreach dynamicactors(class'PlayerController', it) {
|
||||
it.SetViewTarget(p.Pawn);
|
||||
}
|
||||
}
|
||||
|
||||
ProcessMovement ();
|
||||
|
||||
//Server will filter packets for us if we don't follow primary, so check if it has changed
|
||||
if (FollowPrimary != OldFollow) {
|
||||
OldFollow = FollowPrimary;
|
||||
if (FollowPrimary)
|
||||
SendToServer("A");
|
||||
else
|
||||
SendToServer("B");
|
||||
}
|
||||
|
||||
if(FollowPrimary){
|
||||
//Do we have interpolation data to act on?
|
||||
if ((interpol.x2 < currentTime) || (interpol.x1 == interpol.x2)) {
|
||||
WarnMsg = "Waiting on movement interpolation data";
|
||||
}
|
||||
else {
|
||||
//Calculate interpolated position and rotation
|
||||
pos.x = GetInterpolatedPos (0);
|
||||
pos.y = GetInterpolatedPos (1);
|
||||
pos.z = GetInterpolatedPos (2);
|
||||
|
||||
rot.pitch = GetInterpolatedPos (3);
|
||||
rot.yaw = GetInterpolatedPos (4);
|
||||
rot.roll = 0;
|
||||
|
||||
//Always set the location
|
||||
if(viewingSelf)
|
||||
p.SetLocation (pos);
|
||||
|
||||
//Force behindview depending on user pref when speccing something
|
||||
if ((p.viewtarget == none) || (p.ViewTarget == p)) {
|
||||
p.bBehindView = false;
|
||||
}
|
||||
else {
|
||||
p.bBehindView = class'utvReplication'.default.wantBehindview;
|
||||
}
|
||||
|
||||
//Now determine what to do with the rotation
|
||||
switch (class'utvReplication'.default.ViewMode) {
|
||||
case 0:
|
||||
if ((p.ViewTarget == none) || (p.ViewTarget == p)) {
|
||||
p.SetRotation (rot);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
p.SetRotation (rot);
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { //not following primary
|
||||
if(FreeFlight){
|
||||
|
||||
//LocalPos+=p.aForward*delta*0.15*Vector(p.rotation);
|
||||
//LocalPos-=p.aStrafe*delta*0.15*Vector(p.rotation) Cross Vect(0,0,1);
|
||||
if(MoveForward)
|
||||
LocalPos+=delta*1000*Vector(p.rotation);
|
||||
if(MoveBackward)
|
||||
LocalPos-=delta*1000*Vector(p.rotation);
|
||||
if(MoveRight)
|
||||
LocalPos-=delta*1000*Vector(p.rotation) Cross Vect(0,0,1);
|
||||
if(MoveLeft)
|
||||
LocalPos+=delta*1000*Vector(p.rotation) Cross Vect(0,0,1);
|
||||
if(MoveUp)
|
||||
LocalPos+=delta*1000*Vect(0,0,1);
|
||||
if(MoveDown)
|
||||
LocalPos-=delta*1000*Vect(0,0,1);
|
||||
|
||||
//p.ClientMessage ("Move " $ MoveForward $ " - " $ LocalPos $ " - " $ delta);
|
||||
|
||||
p.bBehindView=false;
|
||||
if (p.ViewTarget != p)
|
||||
p.SetViewTarget(p);
|
||||
p.SetLocation(LocalPos);
|
||||
if(p.pawn!=none){
|
||||
p.Pawn.SetLocation(LocalPos);
|
||||
}
|
||||
} else {
|
||||
p.bBehindView = class'utvReplication'.default.wantBehindview;
|
||||
target=GetPawnFromName(LastTargetName);
|
||||
if(target!=none){
|
||||
if (p.ViewTarget != target)
|
||||
p.SetViewTarget(target);
|
||||
p.TargetEyeHeight = target.BaseEyeHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
uti.SetWarning (WarnMsg);
|
||||
}
|
||||
|
||||
simulated function Movement GetNextMovement (int num)
|
||||
{
|
||||
local int i;
|
||||
local int index;
|
||||
|
||||
index = movetail;
|
||||
for (i = 0; i < num; ++i) {
|
||||
index++;
|
||||
if (index == 1000)
|
||||
index = 0;
|
||||
}
|
||||
|
||||
return moves [index];
|
||||
}
|
||||
|
||||
simulated function ProcessMovement ()
|
||||
{
|
||||
local Movement m1, m2, m3;
|
||||
|
||||
if (movetail == movehead)
|
||||
return;
|
||||
|
||||
if (moves[movetail].time < currentTime) {
|
||||
m1 = moves[movetail];
|
||||
//log ("Processing move to: " $ tmp.loc $ " - " $ tmp.rot);
|
||||
|
||||
movetail++;
|
||||
if (movetail == 1000)
|
||||
movetail = 0;
|
||||
|
||||
//Calculate new interpolation values
|
||||
|
||||
m2 = GetNextMovement (0);
|
||||
m3 = GetNextMovement (1);
|
||||
|
||||
//Log ("processing moves from: " $ m1.time $ " - " $ m2.time $ " - " $ m3.time);
|
||||
|
||||
FixRotDist (m1.rot.pitch, m2.rot.pitch);
|
||||
FixRotDist (m2.rot.pitch, m3.rot.pitch, true);
|
||||
FixRotDist (m1.rot.yaw, m2.rot.yaw);
|
||||
FixRotDist (m2.rot.yaw, m3.rot.yaw, true);
|
||||
|
||||
//Coordinates
|
||||
CalculateInterpol (0, m1.time, m2.time, m3.time, m1.loc.x, m2.loc.x, m3.loc.x);
|
||||
CalculateInterpol (1, m1.time, m2.time, m3.time, m1.loc.y, m2.loc.y, m3.loc.y);
|
||||
CalculateInterpol (2, m1.time, m2.time, m3.time, m1.loc.z, m2.loc.z, m3.loc.z);
|
||||
|
||||
//Rotation
|
||||
CalculateInterpol (3, m1.time, m2.time, m3.time, m1.rot.pitch, m2.rot.pitch, m3.rot.pitch);
|
||||
CalculateInterpol (4, m1.time, m2.time, m3.time, m1.rot.yaw, m2.rot.yaw, m3.rot.yaw);
|
||||
}
|
||||
}
|
||||
|
||||
simulated function ReceiveMovement (string s)
|
||||
{
|
||||
local Movement tmp;
|
||||
local string tmps;
|
||||
local int i;
|
||||
|
||||
//Parse out the values
|
||||
i = InStr (s, " ");
|
||||
tmps = Mid (s, 0, i);
|
||||
tmp.loc = vector (tmps);
|
||||
s = Mid (s, i + 1);
|
||||
|
||||
tmp.rot = rotator (s);
|
||||
|
||||
//Log ("Got movement: " $ tmp.time $ " - " $ tmp.loc $ " - " $ tmp.rot);
|
||||
|
||||
//test
|
||||
tmp.time = currentTime + 5;
|
||||
|
||||
//And insert it into the queue
|
||||
if (movehead == movetail) {
|
||||
moves[movehead] = tmp;
|
||||
movehead++;
|
||||
if (movehead == 1000)
|
||||
movehead = 0;
|
||||
}
|
||||
else {
|
||||
//Make sure we only insert newer things
|
||||
i = movehead - 1;
|
||||
if (i < 0)
|
||||
i = 999;
|
||||
if (tmp.time > moves[i].time) {
|
||||
moves[movehead] = tmp;
|
||||
movehead++;
|
||||
if (movehead == 1000)
|
||||
movehead = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
simulated function BeginState ()
|
||||
{
|
||||
log ("utv: Entering secondary state");
|
||||
}
|
||||
}
|
||||
|
||||
simulated function GetNextPlayer()
|
||||
{
|
||||
local Pawn tempPawn;
|
||||
local string targetName;
|
||||
local bool getNext;
|
||||
|
||||
getNext=true;
|
||||
foreach AllActors(class'Pawn',tempPawn){
|
||||
if(tempPawn.PlayerReplicationInfo!=none){
|
||||
if(GetNext){
|
||||
GetNext=false;
|
||||
TargetName=tempPawn.PlayerReplicationInfo.PlayerName;
|
||||
}
|
||||
|
||||
if(tempPawn.PlayerReplicationInfo.PlayerName==LastTargetName){
|
||||
GetNext=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
LastTargetName=TargetName;
|
||||
}
|
||||
|
||||
simulated function Pawn GetPawnFromName(string name)
|
||||
{
|
||||
local Pawn tempPawn;
|
||||
|
||||
foreach AllActors(class'Pawn',tempPawn){
|
||||
if(tempPawn.PlayerReplicationInfo!=none && tempPawn.PlayerReplicationInfo.PlayerName==name){
|
||||
return tempPawn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return none;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
RemoteRole=ROLE_SimulatedProxy
|
||||
bHidden=true
|
||||
bTearoff=false
|
||||
bSkipActorPropertyReplication=true
|
||||
UtvPackage="UTV2004C"
|
||||
seeAll=false
|
||||
NoPrimary=false
|
||||
IsDemo=false
|
||||
followPrimary=true
|
||||
OldFollow=true
|
||||
freeFlight=true
|
||||
LocalPosSet=false
|
||||
}
|
||||
53
kf_sources/UTV2004c/Classes/utvReplicationInfo.uc
Normal file
53
kf_sources/UTV2004c/Classes/utvReplicationInfo.uc
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvReplicationInfo extends ReplicationInfo;
|
||||
|
||||
var Controller OwnerCtrl; //Only valid on server side
|
||||
var PlayerReplicationInfo OwnerPlayer;
|
||||
var rotator TargetViewRotation;
|
||||
|
||||
replication
|
||||
{
|
||||
reliable if (Role == Role_Authority)
|
||||
OwnerPlayer;
|
||||
unreliable if (Role == Role_Authority)
|
||||
TargetViewRotation;
|
||||
}
|
||||
|
||||
simulated function Tick(float deltaTime)
|
||||
{
|
||||
local PlayerController p;
|
||||
local Pawn curTarget;
|
||||
|
||||
if (Level.NetMode != NM_Client) {
|
||||
|
||||
if (OwnerPlayer == none)
|
||||
if (OwnerCtrl.PlayerReplicationInfo != none)
|
||||
OwnerPlayer = OwnerCtrl.PlayerReplicationInfo;
|
||||
|
||||
//This should not happen unless something breaks
|
||||
if (OwnerCtrl == none)
|
||||
return;
|
||||
|
||||
TargetViewRotation = OwnerCtrl.Rotation;
|
||||
//Log("Player " $ OwnerPlayer.PlayerName $ " has rotation " $ TargetViewRotation);
|
||||
}
|
||||
else {
|
||||
p = Level.GetLocalPlayerController();
|
||||
curTarget = Pawn(p.ViewTarget);
|
||||
if (curTarget != none) {
|
||||
if (curTarget.PlayerReplicationInfo == OwnerPlayer) {
|
||||
p.TargetViewRotation = TargetViewRotation;
|
||||
//Log("Updating rotation for target " $ OwnerPlayer.PlayerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
NetUpdateFrequency=100
|
||||
bAlwaysRelevant=false
|
||||
bAlwaysTick=true
|
||||
}
|
||||
12
kf_sources/UTV2004c/Classes/utvSpectator.uc
Normal file
12
kf_sources/UTV2004c/Classes/utvSpectator.uc
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvSpectator extends xPlayer;
|
||||
|
||||
//All extra stuff that was here in previous versions is now handled
|
||||
//by UTV instead. So this is all that is required.
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
bAllActorsRelevant=true
|
||||
}
|
||||
251
kf_sources/UTV2004c/Classes/utvWatcherMenu.uc
Normal file
251
kf_sources/UTV2004c/Classes/utvWatcherMenu.uc
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
//-----------------------------------------------------------
|
||||
//
|
||||
//-----------------------------------------------------------
|
||||
class utvWatcherMenu extends GUIPage;
|
||||
|
||||
var float BoxHeight;
|
||||
var float BoxWidth;
|
||||
var float MarginWidth;
|
||||
var float ItemHeight;
|
||||
var float ItemGap;
|
||||
|
||||
var utvInteraction ui;
|
||||
var utvReplication ur;
|
||||
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
local utvInteraction tui;
|
||||
local utvReplication tur;
|
||||
|
||||
super.InitComponent(MyController, MyOwner);
|
||||
|
||||
//The window
|
||||
Controls[0].WinHeight = BoxHeight;
|
||||
Controls[0].WinWidth = BoxWidth;
|
||||
Controls[0].WinTop = 0.5 - (0.5 * BoxHeight);
|
||||
Controls[0].WinLeft = 0.5 - (0.5 * BoxWidth);
|
||||
|
||||
//Headline
|
||||
Controls[1].WinHeight = ItemHeight;
|
||||
Controls[1].WinWidth = BoxWidth - (MarginWidth * 2);
|
||||
Controls[1].WinTop = Controls[0].WinTop + 0.01; //+ ItemGap * 2;
|
||||
Controls[1].WinLeft = Controls[0].WinLeft + MarginWidth;
|
||||
|
||||
//label
|
||||
Controls[2].WinHeight = ItemHeight;
|
||||
Controls[2].WinWidth = Controls[1].WinWidth;
|
||||
Controls[2].WinTop = Controls[1].WinTop + ItemGap * 2 + ItemHeight;
|
||||
Controls[2].WinLeft = Controls[1].WinLeft;
|
||||
|
||||
//combobox
|
||||
Controls[3].WinHeight = ItemHeight;
|
||||
Controls[3].WinWidth = Controls[1].WinWidth;
|
||||
Controls[3].WinTop = Controls[2].WinTop + ItemHeight - ItemGap;
|
||||
Controls[3].WinLeft = Controls[1].WinLeft;
|
||||
moComboBox (Controls[3]).AddItem ("Locked during free flight");
|
||||
moComboBox (Controls[3]).AddItem ("Completely locked");
|
||||
moComboBox (Controls[3]).AddItem ("Completely free");
|
||||
moComboBox (Controls[3]).ReadOnly (true);
|
||||
moComboBox (Controls[3]).SetIndex (class'utvReplication'.default.ViewMode);
|
||||
|
||||
//label delay
|
||||
Controls[4].WinHeight = ItemHeight;
|
||||
Controls[4].WinWidth = Controls[3].WinWidth;
|
||||
Controls[4].WinTop = Controls[3].WinTop + ItemGap * 2 + ItemHeight;
|
||||
Controls[4].WinLeft = Controls[3].WinLeft;
|
||||
|
||||
//label clients
|
||||
Controls[5].WinHeight = ItemHeight;
|
||||
Controls[5].WinWidth = Controls[4].WinWidth;
|
||||
Controls[5].WinTop = Controls[4].WinTop + ItemGap + ItemHeight;
|
||||
Controls[5].WinLeft = Controls[4].WinLeft;
|
||||
|
||||
//ok button
|
||||
Controls[6].WinHeight = ItemHeight;
|
||||
Controls[6].WinWidth = Controls[1].WinWidth / 2;
|
||||
Controls[6].WinTop = Controls[5].WinTop + ItemHeight * 4 + ItemGap;
|
||||
Controls[6].WinLeft = 0.5 - (0.5 * Controls[6].WinWidth);
|
||||
|
||||
//label follow primary
|
||||
Controls[7].WinHeight = ItemHeight;
|
||||
Controls[7].WinWidth = Controls[5].WinWidth;
|
||||
Controls[7].WinTop = Controls[5].WinTop + ItemGap + ItemHeight;
|
||||
Controls[7].WinLeft = Controls[5].WinLeft;
|
||||
|
||||
//button follow primary
|
||||
Controls[8].WinHeight = ItemHeight;
|
||||
Controls[8].WinWidth = ItemHeight;
|
||||
Controls[8].WinTop = Controls[5].WinTop + ItemHeight;
|
||||
Controls[8].WinLeft = Controls[5].WinLeft+Controls[5].WinWidth/2;
|
||||
|
||||
//label show utv chat
|
||||
Controls[9].WinHeight = ItemHeight;
|
||||
Controls[9].WinWidth = Controls[7].WinWidth;
|
||||
Controls[9].WinTop = Controls[7].WinTop + ItemGap + ItemHeight;
|
||||
Controls[9].WinLeft = Controls[7].WinLeft;
|
||||
|
||||
//button show utv chat
|
||||
Controls[10].WinHeight = ItemHeight;
|
||||
Controls[10].WinWidth = ItemHeight;
|
||||
Controls[10].WinTop = Controls[7].WinTop + ItemHeight;
|
||||
Controls[10].WinLeft = Controls[7].WinLeft+Controls[7].WinWidth/2;
|
||||
|
||||
OnClose = InternalOnClose;
|
||||
|
||||
foreach AllObjects (class'utvInteraction', tui) {
|
||||
ui = tui;
|
||||
}
|
||||
foreach AllObjects (class'utvReplication', tur) {
|
||||
ur = tur;
|
||||
}
|
||||
|
||||
GUILabel(Controls[4]).Caption='Delay ' $ string(ui.Delay);
|
||||
GUILabel(Controls[5]).Caption='Total clients ' $ string(ui.Clients);
|
||||
GUICheckBoxButton(Controls[8]).bChecked=ur.FollowPrimary;
|
||||
GUICheckBoxButton(Controls[10]).bChecked=!ur.MuteChat;
|
||||
if(!ur.SeeAll){
|
||||
GUILabel(Controls[7]).Caption="See all mode disabled";
|
||||
Controls[8].WinHeight = 0;
|
||||
Controls[8].WinWidth = 0;
|
||||
}
|
||||
if(ur.NoPrimary){
|
||||
GUILabel(Controls[7]).Caption="See all mode without primary client";
|
||||
Controls[8].WinHeight = 0;
|
||||
Controls[8].WinWidth = 0;
|
||||
}
|
||||
|
||||
if (ur.IsDemo) {
|
||||
if (ur.SeeAll)
|
||||
GUILabel(Controls[7]).Caption="Watching server side demo";
|
||||
else
|
||||
GUILabel(Controls[7]).Caption="Watching client side demo";
|
||||
Controls[8].WinHeight = 0;
|
||||
Controls[8].WinWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function InternalOnClose(optional bool bCanceled)
|
||||
{
|
||||
local PlayerController pc;
|
||||
|
||||
pc = PlayerOwner();
|
||||
|
||||
if(pc != None && pc.Level.Pauser != None)
|
||||
pc.SetPause(false);
|
||||
|
||||
Super.OnClose(bCanceled);
|
||||
}
|
||||
|
||||
function bool InternalOnClick(GUIComponent Sender)
|
||||
{
|
||||
if (Sender == Controls[6]) //Ok button
|
||||
{
|
||||
if(!ur.NoPrimary) {
|
||||
ur.FollowPrimary=GUICheckBoxButton(Controls[8]).bChecked;
|
||||
}
|
||||
ur.MuteChat=!GUICheckBoxButton(Controls[10]).bChecked;
|
||||
SaveDefaults ();
|
||||
Controller.CloseMenu ();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function InternalOnChange(GUIComponent Sender)
|
||||
{
|
||||
}
|
||||
|
||||
function SaveDefaults ()
|
||||
{
|
||||
class 'utvReplication'.default.ViewMode = moComboBox(Controls[3]).GetIndex ();
|
||||
class 'utvReplication'.static.StaticSaveConfig ();
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object Class=GUIImage name=Background
|
||||
bAcceptsInput=false
|
||||
bNeverFocus=true
|
||||
// if _RO_
|
||||
Image=Texture'InterfaceArt_tex.Menu.RODisplay'
|
||||
// else
|
||||
// Image=material'2K4Menus.NewControls.Display95'
|
||||
// end if _RO_
|
||||
ImageStyle=ISTY_Stretched
|
||||
End Object
|
||||
Controls(0)=GUIImage'Background'
|
||||
|
||||
Begin Object class=GUILabel Name=TitleText
|
||||
Caption="ROTV Watcher settings"
|
||||
TextAlign=TXTA_Center
|
||||
TextColor=(R=255,G=255,B=0,A=255)
|
||||
bTransparent=true
|
||||
bMultiLine=true
|
||||
Name="TitleText"
|
||||
End Object
|
||||
Controls(1)=GUILabel'TitleText'
|
||||
|
||||
Begin Object class=GUILabel name=Label1
|
||||
Caption="View rotation"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
bMultiLine=true
|
||||
End Object
|
||||
Controls(2)=GUILabel'Label1'
|
||||
|
||||
Begin Object class=moComboBox Name=ComboBox
|
||||
Caption=""
|
||||
CaptionWidth=0.0
|
||||
OnChange=InternalOnChange
|
||||
End Object
|
||||
Controls(3)=moComboBox'ComboBox'
|
||||
|
||||
Controls(4)=GUILabel'Label1'
|
||||
Controls(5)=GUILabel'Label1'
|
||||
|
||||
Begin Object Class=GUIButton Name=OkButton
|
||||
StyleName="MidGameButton"
|
||||
OnClick=InternalOnClick
|
||||
Caption="OK"
|
||||
End Object
|
||||
Controls(6)=GUIButton'OkButton'
|
||||
|
||||
Begin Object class=GUILabel name=Label2
|
||||
Caption="Follow primary"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
bMultiLine=true
|
||||
End Object
|
||||
Controls(7)=GUILabel'Label2'
|
||||
|
||||
Begin Object class=GUICheckBoxButton name=Button2
|
||||
End Object
|
||||
Controls(8)=GUICheckBoxButton'Button2'
|
||||
|
||||
Begin Object class=GUILabel name=Label3
|
||||
Caption="Show ROTV Chat"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
TextFont="UT2MidGameFont"
|
||||
bTransparent=true
|
||||
bMultiLine=true
|
||||
End Object
|
||||
Controls(9)=GUILabel'Label3'
|
||||
|
||||
Begin Object class=GUICheckBoxButton name=Button3
|
||||
End Object
|
||||
Controls(10)=GUICheckBoxButton'Button3'
|
||||
|
||||
bRequire640x480=false
|
||||
bAllowedAsLast=true
|
||||
bRenderWorld=true
|
||||
|
||||
BoxHeight=0.47
|
||||
BoxWidth=0.5
|
||||
MarginWidth=0.02
|
||||
ItemHeight=0.04
|
||||
ItemGap=0.01
|
||||
|
||||
OpenSound=none
|
||||
}
|
||||
7
kf_sources/UTV2004c/index.html
Normal file
7
kf_sources/UTV2004c/index.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<head><title>Index of /kf_sources/UTV2004c/</title></head>
|
||||
<body>
|
||||
<h1>Index of /kf_sources/UTV2004c/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="Classes/">Classes/</a> 29-Jun-2025 19:43 -
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue