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