From 6bc292c89501be4689a92446ae68b4b213527195 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Tue, 13 Feb 2024 00:02:58 +0100 Subject: [PATCH] Add original camera restriction values for specific targets --- Source/Game/CameraManager.cpp | 24 ++++++++++++++++++++---- Source/Game/Scripts/Config.cppi | 24 +++--------------------- Source/Game/Scripts/Config.hi | 11 +---------- Source/Scripts/Config.prm | 14 -------------- 4 files changed, 24 insertions(+), 49 deletions(-) diff --git a/Source/Game/CameraManager.cpp b/Source/Game/CameraManager.cpp index 2ea7c1a45..e62668f95 100644 --- a/Source/Game/CameraManager.cpp +++ b/Source/Game/CameraManager.cpp @@ -18,6 +18,23 @@ const float CAMERA_MOUSE_DEAD_THRESHOLD = 0.5f; //Multiplier of delta speed from center to edge of area const float CAMERA_MOUSE_DELTA_FACTOR = 1.5f; +const float CAMERA_ZOOM_GROUND_MAX = 100.0f; +const float CAMERA_MIN_HEIGHT = 200.0f; +#if defined(GPX) || 0 +//Original game values +const float CAMERA_MAX_HEIGHT = 2000.0f; +const float CAMERA_THETA_MIN = static_cast(XM_PI/10.0); +const float CAMERA_THETA_MAX = static_cast(XM_PI/3.0); +#else +const float CAMERA_MAX_HEIGHT = 5000.0f; +const float CAMERA_THETA_MIN = static_cast(XM_PI/5.0); +const float CAMERA_THETA_MAX = static_cast(XM_PI/2.85); +#endif +const float CAMERA_ZOOM_MAX = CAMERA_MAX_HEIGHT / 2.0f; +const float CAMERA_ZOOM_MIN = CAMERA_MIN_HEIGHT + 100.0f; +const float CAMERA_ZOOM_TERRAIN_THRESOLD1 = CAMERA_ZOOM_MIN + CAMERA_ZOOM_GROUND_MAX; +const float CAMERA_ZOOM_TERRAIN_THRESOLD2 = CAMERA_ZOOM_MAX; + void SetCameraPosition(cCamera *UCamera,const MatXf& Matrix) { MatXf ml=MatXf::ID; @@ -76,18 +93,17 @@ void CameraCoordinate::interpolateHermite(const CameraCoordinate coords[4], floa void CameraCoordinate::check(bool restricted) { - float z = FieldCluster::ZeroGround;//(float)(vMap.GetAlt(vMap.XCYCL(round(position().x)),vMap.YCYCL(xm::round(position().y))) >> VX_FRACTION); - float zm = 100; + static float z = FieldCluster::ZeroGround;//(float)(vMap.GetAlt(vMap.XCYCL(round(position().x)),vMap.YCYCL(xm::round(position().y))) >> VX_FRACTION); position_.z = z; if(distance() < CAMERA_ZOOM_TERRAIN_THRESOLD1) position_.z = z; else if(distance() > CAMERA_ZOOM_TERRAIN_THRESOLD2) - position_.z = zm; + position_.z = CAMERA_ZOOM_GROUND_MAX; else{ float t = (distance() - CAMERA_ZOOM_TERRAIN_THRESOLD1)/(CAMERA_ZOOM_TERRAIN_THRESOLD2 - CAMERA_ZOOM_TERRAIN_THRESOLD1); - position_.z = z + t*(zm - z); + position_.z = z + t*(CAMERA_ZOOM_GROUND_MAX - z); } float scroll_border = (distance() - CAMERA_ZOOM_MIN)/(CAMERA_ZOOM_MAX - CAMERA_ZOOM_MIN)*CAMERA_WORLD_SCROLL_BORDER; diff --git a/Source/Game/Scripts/Config.cppi b/Source/Game/Scripts/Config.cppi index e69fe5e3a..f3c55a19f 100644 --- a/Source/Game/Scripts/Config.cppi +++ b/Source/Game/Scripts/Config.cppi @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////////////////////// // XScript definition // Section: GameConfig -// Number of variables: 156 +// Number of variables: 147 // This is computer generated code, don't try to change it ////////////////////////////////////////////////////////////////////////////////////////////// char const* MainModelPath = "RESOURCE\\MODELS\\MAIN"; @@ -37,16 +37,7 @@ float CAMERA_ZOOM_MOUSE_MULT = 300.f; float CAMERA_ZOOM_SPEED_DAMP = 0.7f; float CAMERA_ZOOM_SPEED_MASS = 2.f; float CAMERA_FOLLOW_AVERAGE_TAU = 0.1f; -float CAMERA_MAX_HEIGHT = 5000.f; -float CAMERA_MIN_HEIGHT = 200.f; -float CAMERA_DEFAULT_HEIGHT = 500.f; float CAMERA_MOVE_ZOOM_SCALE = 500.f; -float CAMERA_ZOOM_MIN = 300.f; -float CAMERA_ZOOM_MAX = 2500.f; -float CAMERA_THETA_MIN = 0.62831853f; -float CAMERA_THETA_MAX = 1.10231321f; -float CAMERA_ZOOM_TERRAIN_THRESOLD1 = 300.f; -float CAMERA_ZOOM_TERRAIN_THRESOLD2 = 5000.f; float CAMERA_WORLD_SCROLL_BORDER = 200.f; int CAMERA_REPLAY_DURATION = 4000; float fSoundWidthPower = 0.5f; @@ -283,8 +274,8 @@ struct GameConfig_ParameterSection : ParameterSection GameConfig_ParameterSection() : ParameterSection("GameConfig") { add_dependency(".\\Scripts\\Config.prm"); - description = 911353322; - reserve(156); + description = 300575160; + reserve(147); add(&MainModelPath, "MainModelPath", 3964076972); add(&MainIconPath, "MainIconPath", 607302846); add(&MainFontPath, "MainFontPath", 2303156941); @@ -318,16 +309,7 @@ struct GameConfig_ParameterSection : ParameterSection add(&CAMERA_ZOOM_SPEED_DAMP, "CAMERA_ZOOM_SPEED_DAMP", 2872307499); add(&CAMERA_ZOOM_SPEED_MASS, "CAMERA_ZOOM_SPEED_MASS", 3904040745); add(&CAMERA_FOLLOW_AVERAGE_TAU, "CAMERA_FOLLOW_AVERAGE_TAU", 474877919); - add(&CAMERA_MAX_HEIGHT, "CAMERA_MAX_HEIGHT", 1464480313); - add(&CAMERA_MIN_HEIGHT, "CAMERA_MIN_HEIGHT", 3075093338); - add(&CAMERA_DEFAULT_HEIGHT, "CAMERA_DEFAULT_HEIGHT", 1616833279); add(&CAMERA_MOVE_ZOOM_SCALE, "CAMERA_MOVE_ZOOM_SCALE", 641674670); - add(&CAMERA_ZOOM_MIN, "CAMERA_ZOOM_MIN", 4004499475); - add(&CAMERA_ZOOM_MAX, "CAMERA_ZOOM_MAX", 581947408); - add(&CAMERA_THETA_MIN, "CAMERA_THETA_MIN", 660596487); - add(&CAMERA_THETA_MAX, "CAMERA_THETA_MAX", 3948930820); - add(&CAMERA_ZOOM_TERRAIN_THRESOLD1, "CAMERA_ZOOM_TERRAIN_THRESOLD1", 2692298187); - add(&CAMERA_ZOOM_TERRAIN_THRESOLD2, "CAMERA_ZOOM_TERRAIN_THRESOLD2", 2524526027); add(&CAMERA_WORLD_SCROLL_BORDER, "CAMERA_WORLD_SCROLL_BORDER", 293303500); add(&CAMERA_REPLAY_DURATION, "CAMERA_REPLAY_DURATION", 2253522128); add(&fSoundWidthPower, "fSoundWidthPower", 1475050467); diff --git a/Source/Game/Scripts/Config.hi b/Source/Game/Scripts/Config.hi index e3ae0c115..f9f6d2326 100644 --- a/Source/Game/Scripts/Config.hi +++ b/Source/Game/Scripts/Config.hi @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////////////////////// // XScript declaration // Section: GameConfig -// Number of variables: 156 +// Number of variables: 147 // This is computer generated code, don't try to change it ////////////////////////////////////////////////////////////////////////////////////////////// extern char const* MainModelPath; @@ -37,16 +37,7 @@ extern float CAMERA_ZOOM_MOUSE_MULT; extern float CAMERA_ZOOM_SPEED_DAMP; extern float CAMERA_ZOOM_SPEED_MASS; extern float CAMERA_FOLLOW_AVERAGE_TAU; -extern float CAMERA_MAX_HEIGHT; -extern float CAMERA_MIN_HEIGHT; -extern float CAMERA_DEFAULT_HEIGHT; extern float CAMERA_MOVE_ZOOM_SCALE; -extern float CAMERA_ZOOM_MIN; -extern float CAMERA_ZOOM_MAX; -extern float CAMERA_THETA_MIN; -extern float CAMERA_THETA_MAX; -extern float CAMERA_ZOOM_TERRAIN_THRESOLD1; -extern float CAMERA_ZOOM_TERRAIN_THRESOLD2; extern float CAMERA_WORLD_SCROLL_BORDER; extern int CAMERA_REPLAY_DURATION; extern float fSoundWidthPower; diff --git a/Source/Scripts/Config.prm b/Source/Scripts/Config.prm index bd2e349ce..acfa89827 100644 --- a/Source/Scripts/Config.prm +++ b/Source/Scripts/Config.prm @@ -45,23 +45,9 @@ float CAMERA_ZOOM_SPEED_DELTA = 10.0f; float CAMERA_ZOOM_MOUSE_MULT = 300.0f; float CAMERA_ZOOM_SPEED_DAMP = 0.7f; float CAMERA_ZOOM_SPEED_MASS = 2.0f; - float CAMERA_FOLLOW_AVERAGE_TAU = 0.1; - -//ограничения -float CAMERA_MAX_HEIGHT = 5000.0f; -float CAMERA_MIN_HEIGHT = 200.0f; -float CAMERA_DEFAULT_HEIGHT = 500.0f; float CAMERA_MOVE_ZOOM_SCALE = 500.0f; -float CAMERA_ZOOM_MIN = 300.0f; -float CAMERA_ZOOM_MAX = 2500.0f; -float CAMERA_THETA_MIN = _PI/5.0f; -float CAMERA_THETA_MAX = _PI/2.85f; - -float CAMERA_ZOOM_TERRAIN_THRESOLD1 = CAMERA_MIN_HEIGHT + 100.0f; -float CAMERA_ZOOM_TERRAIN_THRESOLD2 = CAMERA_MAX_HEIGHT; - float CAMERA_WORLD_SCROLL_BORDER = 200.0f; int CAMERA_REPLAY_DURATION = 4000;