library CameraControl import Players public struct CameraControl private static constant string FILTER_MASK = "ReplaceableTextures\\CameraMasks\\White_mask.blp" private static timer hunterFadeContinueTimer = null private static timer hunterFadeFinishTimer = null private static timer beastFadeContinueTimer = null private static timer beastFadeFinishTimer = null private static method endFadeHunter takes nothing returns nothing DestroyTimer(hunterFadeFinishTimer) hunterFadeFinishTimer = null if GetPlayerId(Players.locl) < Players.FIRST_BEAST then DisplayCineFilter(false) EnableUserUI(true) end end private static method endFadeBeast takes nothing returns nothing DestroyTimer(beastFadeFinishTimer) beastFadeFinishTimer = null if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then DisplayCineFilter(false) EnableUserUI(true) end end static method fadeInHunter takes real duration returns nothing // Fade in from the requested color. if (hunterFadeContinueTimer != null) then DestroyTimer(hunterFadeContinueTimer) end if (hunterFadeFinishTimer != null) then DestroyTimer(hunterFadeFinishTimer) end if GetPlayerId(Players.locl) < Players.FIRST_BEAST then EnableUserUI(false) SetCineFilterTexture(FILTER_MASK) SetCineFilterBlendMode(BLEND_MODE_BLEND) SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) SetCineFilterStartUV(0, 0, 1, 1) SetCineFilterEndUV(0, 0, 1, 1) SetCineFilterStartColor(0, 0, 0, 255) SetCineFilterEndColor(0, 0, 0, 0) SetCineFilterDuration(duration) DisplayCineFilter(true) end // Create a timer to end the cinematic fade. hunterFadeFinishTimer = CreateTimer() TimerStart(hunterFadeFinishTimer, duration, false, function endFadeHunter) end static method fadeInBeast takes real duration returns nothing // Fade in from the requested color. if (beastFadeContinueTimer != null) then DestroyTimer(beastFadeContinueTimer) end if (beastFadeFinishTimer != null) then DestroyTimer(beastFadeFinishTimer) end if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then EnableUserUI(false) SetCineFilterTexture(FILTER_MASK) SetCineFilterBlendMode(BLEND_MODE_BLEND) SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) SetCineFilterStartUV(0, 0, 1, 1) SetCineFilterEndUV(0, 0, 1, 1) SetCineFilterStartColor(0, 0, 0, 255) SetCineFilterEndColor(0, 0, 0, 0) SetCineFilterDuration(duration) DisplayCineFilter(true) end // Create a timer to end the cinematic fade. beastFadeFinishTimer = CreateTimer() TimerStart(beastFadeFinishTimer, duration, false, function endFadeBeast) end static method fadeOutHunter takes real duration returns nothing // Fade out to the requested color. if (hunterFadeContinueTimer != null) then DestroyTimer(hunterFadeContinueTimer) end if (hunterFadeFinishTimer != null) then DestroyTimer(hunterFadeFinishTimer) end if GetPlayerId(Players.locl) < Players.FIRST_BEAST then EnableUserUI(false) SetCineFilterTexture(FILTER_MASK) SetCineFilterBlendMode(BLEND_MODE_BLEND) SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) SetCineFilterStartUV(0, 0, 1, 1) SetCineFilterEndUV(0, 0, 1, 1) SetCineFilterStartColor(0, 0, 0, 0) SetCineFilterEndColor(0, 0, 0, 255) SetCineFilterDuration(duration) DisplayCineFilter(true) end end static method fadeOutBeast takes real duration returns nothing // Fade out to the requested color. if (beastFadeContinueTimer != null) then DestroyTimer(beastFadeContinueTimer) end if (beastFadeFinishTimer != null) then DestroyTimer(beastFadeFinishTimer) end if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then EnableUserUI(false) SetCineFilterTexture(FILTER_MASK) SetCineFilterBlendMode(BLEND_MODE_BLEND) SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) SetCineFilterStartUV(0, 0, 1, 1) SetCineFilterEndUV(0, 0, 1, 1) SetCineFilterStartColor(0, 0, 0, 0) SetCineFilterEndColor(0, 0, 0, 255) SetCineFilterDuration(duration) DisplayCineFilter(true) end end static method panHuman takes real x, real y, real duration returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then PanCameraToTimed(x, y, duration) end end static method panBeast takes real x, real y, real duration returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then PanCameraToTimed(x, y, duration) end end static method panDistanceHuman takes real dist, real duration returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, dist, duration) end end static method panDistanceBeast takes real dist, real duration returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, dist, duration) end end static method panAoaBeast takes real aoa, real duration returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, aoa, duration) end end static method snapHuman takes real x, real y returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then PanCameraToTimed(x, y, 0.) end end static method snapBeast takes real x, real y returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then PanCameraToTimed(x, y, 0.) end end static method snapAoaHuman takes real aoa returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, aoa, 0.) end end static method snapAoaBeast takes real aoa returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, aoa, 0.) end end static method snapDistanceHuman takes real d returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, d, 0.) end end static method snapDistanceBeast takes real d returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, d, 0.) end end static method snapRotationHuman takes real r returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_ROTATION, r, 0.) end end static method snapRotationBeast takes real r returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_ROTATION, r, 0.) end end static method snapFovBeast takes real aoa returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, aoa, 0.) end end static method resetHuman takes nothing returns nothing if GetPlayerId(Players.locl) < Players.FIRST_BEAST then ResetToGameCamera(0.) end end static method resetBeast takes nothing returns nothing if GetPlayerId(Players.locl) >= Players.FIRST_BEAST then ResetToGameCamera(0.) end end end endlibrary