Skip to content

Commit

Permalink
Changed randomizer formula to be less correct, but consistent with th…
Browse files Browse the repository at this point in the history
…e original game
  • Loading branch information
Arsunt committed Sep 20, 2021
1 parent a50c47d commit 5bec0d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed a bug when some underwater objects were untinted (broken since v0.1.0).
- Fixed camera stabilization in some cut scenes (broken since v0.1.0).
- Fixed the "Microphone Position at Lara" setting (broken since v0.1.0).
- Changed randomizer formula to be less correct, but consistent with the original game (broken since v0.1.0).

## [0.8.2] - 2019-05-26
### TR2Main bugfixes
Expand Down
12 changes: 6 additions & 6 deletions specific/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@ int __cdecl GameStats(int levelID) {

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

void __cdecl SeedRandomControl(int seed) {
Expand All @@ -345,9 +345,9 @@ void __cdecl SeedRandomControl(int seed) {

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

void __cdecl SeedRandomDraw(int seed) {
Expand Down

0 comments on commit 5bec0d7

Please sign in to comment.