소스 검색

LoaderTR1 Unfinished Business support. Sprint for camera movement.

Thomas Buck 9 년 전
부모
커밋
aa52606cc1
4개의 변경된 파일32개의 추가작업 그리고 5개의 파일을 삭제
  1. 4
    0
      ChangeLog.md
  2. 1
    1
      include/Camera.h
  3. 15
    3
      src/Camera.cpp
  4. 12
    1
      src/loader/LoaderTR1.cpp

+ 4
- 0
ChangeLog.md 파일 보기

2
 
2
 
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4
 
4
 
5
+    [ 20140306 ]
6
+    * Fixed LoaderTR1, can now also open the Unfinished Business levels
7
+    * Walk key can now be used to increase free-camera movement speed
8
+
5
     [ 20140305 ]
9
     [ 20140305 ]
6
     * SoundAL now has more useful error message output.
10
     * SoundAL now has more useful error message output.
7
     * Fixed TR1 color map parsing, now textures have the proper color values.
11
     * Fixed TR1 color map parsing, now textures have the proper color values.

+ 1
- 1
include/Camera.h 파일 보기

60
     static glm::mat4 projection;
60
     static glm::mat4 projection;
61
     static glm::mat4 view;
61
     static glm::mat4 view;
62
     static float rotationDeltaX, rotationDeltaY;
62
     static float rotationDeltaX, rotationDeltaY;
63
-    static bool updateViewFrustum, dirty, showOverlay;
63
+    static bool updateViewFrustum, dirty, showOverlay, movingFaster;
64
     static int room;
64
     static int room;
65
 };
65
 };
66
 
66
 

+ 15
- 3
src/Camera.cpp 파일 보기

43
 const static float controllerViewFactor = glm::pi<float>();
43
 const static float controllerViewFactor = glm::pi<float>();
44
 const static float rotationAngleClamp = glm::pi<float>() * 2.0f;
44
 const static float rotationAngleClamp = glm::pi<float>() * 2.0f;
45
 const static float rotationAngleVertMax = glm::pi<float>() / 2.0f;
45
 const static float rotationAngleVertMax = glm::pi<float>() / 2.0f;
46
+const static float runFactor = 2.5f;
46
 
47
 
47
 const static glm::vec3 rightUnit(1.0f, 0.0f, 0.0f);
48
 const static glm::vec3 rightUnit(1.0f, 0.0f, 0.0f);
48
 const static glm::vec3 upUnit(0.0f, 1.0f, 0.0f);
49
 const static glm::vec3 upUnit(0.0f, 1.0f, 0.0f);
59
 bool Camera::updateViewFrustum = true;
60
 bool Camera::updateViewFrustum = true;
60
 bool Camera::dirty = true;
61
 bool Camera::dirty = true;
61
 bool Camera::showOverlay = false;
62
 bool Camera::showOverlay = false;
63
+bool Camera::movingFaster = false;
62
 int Camera::room = -1;
64
 int Camera::room = -1;
63
 
65
 
64
 void Camera::reset() {
66
 void Camera::reset() {
96
         posSpeed += upUnit * maxSpeed * factor;
98
         posSpeed += upUnit * maxSpeed * factor;
97
     } else if (action == crouchAction) {
99
     } else if (action == crouchAction) {
98
         posSpeed -= upUnit * maxSpeed * factor;
100
         posSpeed -= upUnit * maxSpeed * factor;
101
+    } else if (action == walkAction) {
102
+        movingFaster = !isFinished;
99
     } else {
103
     } else {
100
         return;
104
         return;
101
     }
105
     }
176
     glm::quat quatX = glm::angleAxis(rot.y, glm::vec3(1.0f, 0.0f, 0.0f));
180
     glm::quat quatX = glm::angleAxis(rot.y, glm::vec3(1.0f, 0.0f, 0.0f));
177
     glm::quat quaternion = quatY * quatX;
181
     glm::quat quaternion = quatY * quatX;
178
 
182
 
179
-    glm::vec3 clampedSpeed(posSpeed);
180
-    if (glm::length(clampedSpeed) > maxSpeed) {
181
-        clampedSpeed = glm::normalize(clampedSpeed) * maxSpeed;
183
+    glm::vec3 clampedSpeed;
184
+    if (movingFaster) {
185
+        clampedSpeed = posSpeed * runFactor;
186
+        if (glm::length(clampedSpeed) > (maxSpeed * runFactor)) {
187
+            clampedSpeed = glm::normalize(clampedSpeed) * maxSpeed * runFactor;
188
+        }
189
+    } else {
190
+        clampedSpeed = posSpeed;
191
+        if (glm::length(clampedSpeed) > maxSpeed) {
192
+            clampedSpeed = glm::normalize(clampedSpeed) * maxSpeed;
193
+        }
182
     }
194
     }
183
 
195
 
184
     pos += quaternion * clampedSpeed * dT;
196
     pos += quaternion * clampedSpeed * dT;

+ 12
- 1
src/loader/LoaderTR1.cpp 파일 보기

10
 #include "Log.h"
10
 #include "Log.h"
11
 #include "SoundManager.h"
11
 #include "SoundManager.h"
12
 #include "World.h"
12
 #include "World.h"
13
+#include "utils/strings.h"
13
 #include "loader/LoaderTR1.h"
14
 #include "loader/LoaderTR1.h"
14
 
15
 
15
 int LoaderTR1::load(std::string f) {
16
 int LoaderTR1::load(std::string f) {
22
         return 2; // Not a TR1 level?!
23
         return 2; // Not a TR1 level?!
23
     }
24
     }
24
 
25
 
26
+    bool unfinishedBusiness = stringEndsWith(f, ".tub");
27
+    if (unfinishedBusiness)
28
+        Log::get(LOG_INFO) << "LoaderTR1: Detected Unfinished Business level!" << Log::endl;
29
+
25
     loadTextures();
30
     loadTextures();
26
 
31
 
27
     file.seek(file.tell() + 4); // Unused value?
32
     file.seek(file.tell() + 4); // Unused value?
33
     loadStaticMeshes();
38
     loadStaticMeshes();
34
     loadTextiles();
39
     loadTextiles();
35
     loadSprites();
40
     loadSprites();
41
+
42
+    if (unfinishedBusiness)
43
+        loadPalette();
44
+
36
     loadCameras();
45
     loadCameras();
37
     loadSoundSources();
46
     loadSoundSources();
38
     loadBoxesOverlapsZones();
47
     loadBoxesOverlapsZones();
41
 
50
 
42
     file.seek(file.tell() + 8192); // TODO light map!
51
     file.seek(file.tell() + 8192); // TODO light map!
43
 
52
 
44
-    loadPalette();
53
+    if (!unfinishedBusiness)
54
+        loadPalette();
55
+
45
     loadCinematicFrames();
56
     loadCinematicFrames();
46
     loadDemoData();
57
     loadDemoData();
47
     loadSoundMap();
58
     loadSoundMap();

Loading…
취소
저장