Server applies camera on CamSync; WASD sync fix
This commit is contained in:
1 parent
e42b2ed66b
commit
79e042d719
1 file changed
+25
-12
@@ -230,7 +230,7 @@ function RPGClient_CameraTick()
|
||||
$RPGClient::Dist = getMin(32, $RPGClient::Dist + %zoom * $RPGClient::MvB);
|
||||
%changed = 1;
|
||||
}
|
||||
RPGClient_ApplyCamera(%changed);
|
||||
RPGClient_ApplyCamera(%changed || $RPGClient::MvF || $RPGClient::MvB || $RPGClient::MvL || $RPGClient::MvR);
|
||||
$RPGClient::CamTickSched = schedule(32, 0, RPGClient_CameraTick);
|
||||
}
|
||||
|
||||
@@ -288,6 +288,10 @@ function RPGClient_KeyMvForward(%val)
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvF = %val;
|
||||
if (%val)
|
||||
{
|
||||
RPGClient_ApplyCamera(1);
|
||||
}
|
||||
}
|
||||
|
||||
function RPGClient_KeyMvBackward(%val)
|
||||
@@ -302,6 +306,10 @@ function RPGClient_KeyMvBackward(%val)
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvB = %val;
|
||||
if (%val)
|
||||
{
|
||||
RPGClient_ApplyCamera(1);
|
||||
}
|
||||
}
|
||||
|
||||
function RPGClient_KeyMvLeft(%val)
|
||||
@@ -316,6 +324,10 @@ function RPGClient_KeyMvLeft(%val)
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvL = %val;
|
||||
if (%val)
|
||||
{
|
||||
RPGClient_ApplyCamera(1);
|
||||
}
|
||||
}
|
||||
|
||||
function RPGClient_KeyMvRight(%val)
|
||||
@@ -330,6 +342,10 @@ function RPGClient_KeyMvRight(%val)
|
||||
return;
|
||||
}
|
||||
$RPGClient::MvR = %val;
|
||||
if (%val)
|
||||
{
|
||||
RPGClient_ApplyCamera(1);
|
||||
}
|
||||
}
|
||||
|
||||
function RPGClient_RestoreMoveMap()
|
||||
@@ -575,6 +591,13 @@ function RPGClient_ApplyCamera(%forceSync)
|
||||
{
|
||||
return;
|
||||
}
|
||||
%now = getSimTime();
|
||||
if (!%forceSync && %now - $RPGClient::LastCamSync < 40)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$RPGClient::LastCamSync = %now;
|
||||
commandToServer('RPG_CamSync', $RPGClient::Yaw, $RPGClient::Dist, 0, 0);
|
||||
%body = %conn.Player;
|
||||
if (!isObject(%body))
|
||||
{
|
||||
@@ -584,15 +607,11 @@ function RPGClient_ApplyCamera(%forceSync)
|
||||
{
|
||||
return;
|
||||
}
|
||||
%cam = %conn.getControlObject();
|
||||
if (!isObject(%cam) || %cam.getClassName() !$= "Camera")
|
||||
{
|
||||
%cam = %conn.Camera;
|
||||
if (!isObject(%cam))
|
||||
{
|
||||
%cam = %conn.camera;
|
||||
}
|
||||
}
|
||||
if (!isObject(%cam))
|
||||
{
|
||||
return;
|
||||
@@ -605,19 +624,13 @@ function RPGClient_ApplyCamera(%forceSync)
|
||||
if (!$RPGClient::OrbitInit)
|
||||
{
|
||||
%cam.setMode("Corpse", %body);
|
||||
%cam.setOrbitMode(%body, %xfm, 0, 32, $RPGClient::Dist);
|
||||
%cam.mode = "Corpse";
|
||||
%cam.thirdPersonOnly = 1;
|
||||
$RPGClient::OrbitInit = 1;
|
||||
}
|
||||
%cam.setTransform(%xfm);
|
||||
%cam.setOrbitMode(%body, %xfm, 0, 32, $RPGClient::Dist);
|
||||
%cam.setOrbitDist($RPGClient::Dist);
|
||||
%now = getSimTime();
|
||||
if (%forceSync || %now - $RPGClient::LastCamSync > 120)
|
||||
{
|
||||
$RPGClient::LastCamSync = %now;
|
||||
commandToServer('RPG_CamSync', $RPGClient::Yaw, $RPGClient::Dist, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function RPGClient_ScheduleCamera()
|
||||
|
||||
Reference in new issue
Block a user