Skip to content

Commit 5bec0d7

Browse files
committed
Changed randomizer formula to be less correct, but consistent with the original game
1 parent a50c47d commit 5bec0d7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
120120
- Fixed a bug when some underwater objects were untinted (broken since v0.1.0).
121121
- Fixed camera stabilization in some cut scenes (broken since v0.1.0).
122122
- Fixed the "Microphone Position at Lara" setting (broken since v0.1.0).
123+
- Changed randomizer formula to be less correct, but consistent with the original game (broken since v0.1.0).
123124

124125
## [0.8.2] - 2019-05-26
125126
### TR2Main bugfixes

specific/game.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ int __cdecl GameStats(int levelID) {
334334

335335
int __cdecl GetRandomControl() {
336336
RandomControl = RandomControl * 1103515245 + 12345;
337-
return (RandomControl / 0x10000) & 0x7FFF;
338-
// NOTE: the original game code was: return (RandomControl >> 10) & 0x7FFF;
339-
// instead of the correct ANSI one: return (RandomControl >> 0x10) & 0x7FFF;
337+
return (RandomControl >> 10) & 0x7FFF;
338+
// NOTE: the shift value should be 0x10, but the original game has 10,
339+
// it left "as is" to save consistency with the original game.
340340
}
341341

342342
void __cdecl SeedRandomControl(int seed) {
@@ -345,9 +345,9 @@ void __cdecl SeedRandomControl(int seed) {
345345

346346
int __cdecl GetRandomDraw() {
347347
RandomDraw = RandomDraw * 1103515245 + 12345;
348-
return (RandomDraw / 0x10000) & 0x7FFF;
349-
// NOTE: the original game code was: return (RandomDraw >> 10) & 0x7FFF;
350-
// instead of the correct ANSI one: return (RandomDraw >> 0x10) & 0x7FFF;
348+
return (RandomDraw >> 10) & 0x7FFF;
349+
// NOTE: the shift value should be 0x10, but the original game has 10,
350+
// it left "as is" to save consistency with the original game.
351351
}
352352

353353
void __cdecl SeedRandomDraw(int seed) {

0 commit comments

Comments
 (0)