fix camera tick: CamTickOn on HUD; wheel zoom
This commit is contained in:
1 parent
dcdbdf8780
commit
e42b2ed66b
1 file changed
+81
-18
@@ -13,6 +13,7 @@ $RPGClient::KeyMapPushed = 0;
|
||||
$RPGClient::MoveHijacked = 0;
|
||||
$RPGClient::GlobalKeys = 0;
|
||||
$RPGClient::PlayBooted = 0;
|
||||
$RPGClient::CamTickOn = 0;
|
||||
$RPGClient::PanX = 0;
|
||||
$RPGClient::PanY = 0;
|
||||
$RPGClient::PanMax = 48;
|
||||
@@ -182,7 +183,7 @@ function RPGClient_EnsureCursor()
|
||||
function RPGClient_CameraTick()
|
||||
{
|
||||
$RPGClient::CamTickSched = 0;
|
||||
if (!$RPGClient::Active)
|
||||
if (!isObject(ServerConnection) || !$RPGClient::CamTickOn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -260,13 +261,9 @@ function RPGClient_BootPlay()
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ($RPGClient::PlayBooted)
|
||||
{
|
||||
RPGClient_EnsureOverlay();
|
||||
return;
|
||||
}
|
||||
$RPGClient::Server = 1;
|
||||
$RPGClient::Active = 1;
|
||||
$RPGClient::CamTickOn = 1;
|
||||
$RPGClient::PlayBooted = 1;
|
||||
if ($RPGClient::Dist < 6)
|
||||
{
|
||||
@@ -281,40 +278,74 @@ function RPGClient_BootPlay()
|
||||
|
||||
function RPGClient_KeyMvForward(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!isObject(ServerConnection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
moveforward(%val);
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvF = %val;
|
||||
}
|
||||
|
||||
function RPGClient_KeyMvBackward(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!isObject(ServerConnection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
movebackward(%val);
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvB = %val;
|
||||
}
|
||||
|
||||
function RPGClient_KeyMvLeft(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!isObject(ServerConnection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
moveleft(%val);
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvL = %val;
|
||||
}
|
||||
|
||||
function RPGClient_KeyMvRight(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!isObject(ServerConnection))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
moveright(%val);
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvR = %val;
|
||||
}
|
||||
|
||||
function RPGClient_RestoreMoveMap()
|
||||
{
|
||||
if (!isObject(moveMap))
|
||||
{
|
||||
return;
|
||||
}
|
||||
moveMap.bind(keyboard, w, moveforward);
|
||||
moveMap.bind(keyboard, s, movebackward);
|
||||
moveMap.bind(keyboard, a, moveleft);
|
||||
moveMap.bind(keyboard, d, moveright);
|
||||
moveMap.bind(keyboard, left, invLeft);
|
||||
moveMap.bind(keyboard, right, invRight);
|
||||
}
|
||||
|
||||
function RPGClient_EnsureGlobalKeys()
|
||||
{
|
||||
if ($RPGClient::GlobalKeys || !isObject(GlobalActionMap))
|
||||
@@ -455,7 +486,6 @@ function RPGClient_EnsureOverlay()
|
||||
PlayGui.pushToBack(RPGClient_Mouse);
|
||||
}
|
||||
RPGClient_EnsureKeyMap();
|
||||
RPGClient_HijackMoveMap();
|
||||
RPGClient_EnsureGlobalKeys();
|
||||
$enableDirectInput = 1;
|
||||
activateDirectInput();
|
||||
@@ -509,7 +539,9 @@ function RPGClient_DisableOverlay()
|
||||
$RPGClient::HudPlaced = 0;
|
||||
$RPGClient::MoveHijacked = 0;
|
||||
$RPGClient::PlayBooted = 0;
|
||||
$RPGClient::CamTickOn = 0;
|
||||
RPGClient_ClearGlobalKeys();
|
||||
RPGClient_RestoreMoveMap();
|
||||
}
|
||||
|
||||
function RPGClient_Hud_Place()
|
||||
@@ -600,8 +632,9 @@ function RPGClient_ScheduleCamera()
|
||||
|
||||
function RPGClient_YawLeft(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
invLeft(%val);
|
||||
return;
|
||||
}
|
||||
if (%val)
|
||||
@@ -616,8 +649,9 @@ function RPGClient_YawLeft(%val)
|
||||
|
||||
function RPGClient_YawRight(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
invRight(%val);
|
||||
return;
|
||||
}
|
||||
if (%val)
|
||||
@@ -632,7 +666,7 @@ function RPGClient_YawRight(%val)
|
||||
|
||||
function RPGClient_ZoomIn(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -645,7 +679,7 @@ function RPGClient_ZoomIn(%val)
|
||||
|
||||
function RPGClient_ZoomOut(%val)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
if (!$RPGClient::CamTickOn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -772,6 +806,7 @@ function clientCmdRPG_TopDown(%on, %yaw, %dist)
|
||||
$RPGClient::Yaw = %yaw;
|
||||
$RPGClient::OrbitInit = 0;
|
||||
$RPGClient::HudPlaced = 0;
|
||||
$RPGClient::CamTickOn = 1;
|
||||
RPGClient_EnsureOverlay();
|
||||
RPGClient_BindKeys();
|
||||
RPGClient_StartCameraTick();
|
||||
@@ -791,11 +826,8 @@ function clientCmdRPG_TopDown(%on, %yaw, %dist)
|
||||
}
|
||||
|
||||
function clientCmdRPG_Hud(%hp, %maxHp, %silver, %load, %cap, %skillId, %skillValue, %blocking, %tHp, %tMax)
|
||||
{
|
||||
if (!RPGClient_InPlay())
|
||||
{
|
||||
RPGClient_BootPlay();
|
||||
}
|
||||
RPGClient_Hud_Update(%hp, %maxHp, %silver, %load, %cap, %skillId, %skillValue, %tHp, %tMax);
|
||||
}
|
||||
|
||||
@@ -1028,6 +1060,35 @@ package RPGClient_Input
|
||||
}
|
||||
Parent::invRight(%val);
|
||||
}
|
||||
|
||||
function scrollInventory(%val)
|
||||
{
|
||||
if ($RPGClient::CamTickOn && %val != 0)
|
||||
{
|
||||
if (%val > 0)
|
||||
{
|
||||
$RPGClient::Dist = getMax(6, $RPGClient::Dist - 0.35 * %val);
|
||||
}
|
||||
else
|
||||
{
|
||||
$RPGClient::Dist = getMin(32, $RPGClient::Dist - 0.35 * %val);
|
||||
}
|
||||
RPGClient_ApplyCamera(1);
|
||||
return;
|
||||
}
|
||||
Parent::scrollInventory(%val);
|
||||
}
|
||||
|
||||
function yaw(%val)
|
||||
{
|
||||
if ($RPGClient::CamTickOn && %val != 0)
|
||||
{
|
||||
$sens = $pref::Input::MouseSensitivity;
|
||||
$RPGClient::Yaw += %val * %sens * 0.004;
|
||||
return;
|
||||
}
|
||||
Parent::yaw(%val);
|
||||
}
|
||||
};
|
||||
activatePackage(RPGClient_Input);
|
||||
|
||||
@@ -1122,7 +1183,9 @@ package RPGClient_Cleanup
|
||||
$RPGClient::TopDownWatchSched = 0;
|
||||
$RPGClient::Server = 0;
|
||||
$RPGClient::PlayBooted = 0;
|
||||
$RPGClient::CamTickOn = 0;
|
||||
RPGClient_ClearGlobalKeys();
|
||||
RPGClient_RestoreMoveMap();
|
||||
Parent::disconnectedCleanup(%doReconnect);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user