2017-10-20 02:00:49 +00:00
|
|
|
// HUD minigame base.
|
|
|
|
Class MX_MiniGameBase extends Object within PlayerController
|
|
|
|
config(Game)
|
|
|
|
abstract;
|
|
|
|
|
|
|
|
var config int Data;
|
|
|
|
var config float Sensitivity;
|
|
|
|
var transient Canvas Canvas;
|
|
|
|
var bool bGameStarted;
|
|
|
|
|
|
|
|
function Init()
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Sensitivity==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Sensitivity = 1;
|
|
|
|
SaveConfig();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function AdjustSensitivity(bool bUp)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bUp)
|
2017-10-20 02:00:49 +00:00
|
|
|
Sensitivity = FMin(Sensitivity+0.05,3.f);
|
|
|
|
else Sensitivity = FMax(Sensitivity-0.05,0.05f);
|
|
|
|
SetTimer(2,false,'DelayedSaveConfig',Self);
|
|
|
|
}
|
|
|
|
|
|
|
|
final function DelayedSaveConfig()
|
|
|
|
{
|
|
|
|
SaveConfig();
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function SetFXTrack(Object O);
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
function StartGame()
|
|
|
|
{
|
|
|
|
bGameStarted = true;
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function Render(float XPos, float YPos, float XSize, float YSize);
|
2017-10-20 02:00:49 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function SetMouse(float X, float Y);
|
|
|
|
function UpdateMouse(float X, float Y);
|
2017-10-20 02:00:49 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function Tick(float Delta);
|
2017-10-20 02:00:49 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function bool Box8DirTrace(vector Start, vector Dir, vector HitTest, vector Ext, vector ExtB, out vector HitNorm, out float HitTime) // free movement trace.
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local vector V;
|
|
|
|
local float tmin,tmax,tymin,tymax,tmp;
|
|
|
|
local bool bMaxY,bMinY;
|
|
|
|
|
|
|
|
V = HitTest-Start;
|
|
|
|
Ext+=ExtB;
|
|
|
|
|
|
|
|
// AABB check if start inside box.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Abs(V.X)<Ext.X && Abs(V.Y)<Ext.Y)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if ((V Dot Dir)<0.f) // Moving out from origin.
|
2017-10-20 02:00:49 +00:00
|
|
|
return false;
|
|
|
|
V = Normal2D(V);
|
|
|
|
|
|
|
|
// Check which normal axis to use.
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Abs(V.X)>Normal2D(ExtB).Y)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (V.X<0)
|
2017-10-20 02:00:49 +00:00
|
|
|
HitNorm = vect(1,0,0);
|
|
|
|
else HitNorm = vect(-1,0,0);
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (V.Y<0)
|
2017-10-20 02:00:49 +00:00
|
|
|
HitNorm = vect(0,1,0);
|
|
|
|
else HitNorm = vect(0,-1,0);
|
|
|
|
|
|
|
|
HitTime = 0.f;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Actually perform the trace check.
|
|
|
|
tmp = Dir.X==0.f ? 0.00001 : (1.f / Dir.X);
|
|
|
|
tmin = (V.X - Ext.X) * tmp;
|
|
|
|
tmax = (V.X + Ext.X) * tmp;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (tmin > tmax)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
tmp = tmax;
|
|
|
|
tmax = tmin;
|
|
|
|
tmin = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = Dir.Y==0.f ? 0.00001 : (1.f / Dir.Y);
|
|
|
|
tymin = (V.Y - Ext.Y) * tmp;
|
|
|
|
tymax = (V.Y + Ext.Y) * tmp;
|
|
|
|
|
|
|
|
if (tymin > tymax)
|
|
|
|
{
|
|
|
|
tmp = tymax;
|
|
|
|
tymax = tymin;
|
|
|
|
tymin = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fully missed.
|
2020-11-28 20:12:58 +00:00
|
|
|
if ((tmin > tymax) || (tymin > tmax))
|
2017-10-20 02:00:49 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if (tymin > tmin)
|
|
|
|
{
|
|
|
|
bMinY = true;
|
|
|
|
tmin = tymin;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tymax < tmax)
|
|
|
|
{
|
|
|
|
bMaxY = true;
|
|
|
|
tmax = tymax;
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (tmin<tmax)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
bMaxY = bMinY;
|
|
|
|
tmax = tmin;
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (tmax<0.f || tmax>1.f) // Too far away
|
2017-10-20 02:00:49 +00:00
|
|
|
return false;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bMaxY)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Dir.Y>0.f)
|
2017-10-20 02:00:49 +00:00
|
|
|
HitNorm = vect(0,-1,0);
|
|
|
|
else HitNorm = vect(0,1,0);
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
else if (Dir.X>0.f)
|
2017-10-20 02:00:49 +00:00
|
|
|
HitNorm = vect(-1,0,0);
|
|
|
|
else HitNorm = vect(1,0,0);
|
|
|
|
|
|
|
|
HitTime = tmax;
|
|
|
|
return true;
|
|
|
|
}
|