Hier die Zeilen aus der ui.script
Ohne Leerzeilen von 82 bis 122
function setCameraDirection($value) {
if (MAIN.$gameControls.$keyRepeat) wait 0.05;
if (!$screenShotMode) {
$cameraDir = $value & 0x7;
if (!MAIN.$gameControls.$overviewMode) {
$camera.orientation = quat(0.6 + $cameraZoom * 0.0017, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.25 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
} else {
$camera.orientation = quat($cameraTilt, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.25 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
}
} else {
$cameraDir = $value;
$camera.orientation = quat($cameraTilt, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.1 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
}
setCameraPos($cameraX, $cameraZ);
}
function setCameraTilt($value, $force = false) {
if ($screenShotMode $force) {
$cameraTilt = $value;
if (!$screenShotMode) {
$camera.orientation = quat($cameraTilt, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.25 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
} else {
$camera.orientation = quat($cameraTilt, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.1 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
MAIN.$gameUI.setCameraZoom($cameraZoom); //Just to make sure the $camera.maxDistance is set correctly
}
}
}
function setCameraZoom($value, $force = false) {
$cameraZoom = $value;
$camera.offset = vector(0.0, 0.0, $cameraZoom);
if (!$screenShotMode) {
if (!$force) {
$camera.orientation = quat(0.6 + $cameraZoom * 0.0017, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.25 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
} else {
$camera.orientation = quat($cameraTilt, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.25 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
}
} else {
$camera.orientation = quat($cameraTilt, vector(1.0, 0.0, 0.0)) * quat($cameraDir * 0.1 * PI/* + 0.001*/, vector(0.0, 1.0, 0.0));
}
MAIN.$listener.offset = vector(0.0, 0.0, $cameraZoom);
setCameraPos($cameraX, $cameraZ);
}
von 168 bis 200
function scrollKey($key) {
if ($scrollerKeys == 0) stopScrolling();
$scrollerKeys |= $key;
if ($scrollerThread == null) {
$scrollerThread = thread "gameUI" :: loop {
$delta = skip_frame * $cameraZoom;
if ($scrollerKeys == 0) break;
$x = 0;
$z = 0;
if ($scrollerKeys & 1) $x++;
if ($scrollerKeys & 2) $z++;
if ($scrollerKeys & 4) $x--;
if ($scrollerKeys & $z--;
if (!$screenShotMode) {
$xangle = $cameraDir * 0.25 * PI;
$zangle = $cameraDir * 0.25 * PI + 0.5 * PI;
} else {
$xangle = $cameraDir * 0.1 * PI;
$zangle = $cameraDir * 0.1 * PI + 0.5 * PI;
}
setCameraPos($cameraX + $delta * ($x * cos($xangle) + $z * cos($zangle)), $cameraZ + $delta * ($x * sin($xangle) + $z * sin($zangle)));
};
}
}
$panWorldPos = vector();
$panCameraPos = vector();
$panCameraZ = -100000.0;
$panning = false;
$mouseX = 0.0;
$mouseY = 0.0;
function startPanning() {
stopScrolling();
$panWorldPos = .getWorldPosition($mouseX, $mouseY);
$panCameraPos = $camera.currentPosition;
$panning = true;
}
function stopPanning() {
$panning = false;
}
event MAIN.$player.onDeactivate::() {
stopScrolling();
}
event MAIN.$player.onMouseMove::($x, $y) {
if ((MAIN.$gameControls.$rightMouseButtonDown) && (MAIN.$gameControls.$cimcam)) return;
if ($panning) {
$oldPos = $camera.currentPosition;
$camera.currentPosition = $panCameraPos;
$pos = .getWorldPosition($x, $y);
$camera.currentPosition = $oldPos;
$pos = $panWorldPos - $pos + $panCameraPos;
setCameraPos(vector_x($pos), vector_z($pos));
} else {
if ($scrollerKeys == 0) {
if ($scrollerThread) {
if ($x >= 5.0 && $y >= 5.0 && $x <= $desktop.width-5 && $y <= $desktop.height-5) stopScrolling();
} else {
if ($x < 5.0 $y < 5.0 $x > $desktop.width-5 $y > $desktop.height-5) startScrolling();
}
}
$mouseX = $x;
$mouseY = $y;
}
Gruss Andy