Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Dynamic weather #2

Closed
wants to merge 3 commits into from
Closed

WIP: Dynamic weather #2

wants to merge 3 commits into from

Conversation

Lihis
Copy link
Owner

@Lihis Lihis commented May 9, 2018

Tasklist and some details:

  • Weather cycles according the weather list for GTA III.
  • Verify is the above weather list same for:
    • v1.1
    • Steam version
  • Rain droplets in rainy weather
  • Weather can be controlled by opcodes and it behaves according them:
    • 01B5: Force next weather (see Dynamic weather conditions rwengine/openrw#379 (comment)). Weather does not cycle until released (via 01B7).
    • 01B6: Force weather now; weather is immediately set to requested weather. Weather does not cycle until released (via 01B7).
    • 01B7: Release weather; continue weather cycle from where it was.
    • 0251: Store weather; unused.
    • 0251: Restore weather; unused.
  • New game:
    • Weather cycle starts from array index 0?
  • Load game:
    • Clean save without weather cheats; weather cycle continues from the saved state.
    • "Dirty" save where a weather cheat used; weather does not cycle, weather is kept in the forced state.
  • Write simple SCM for testing opcode 01B5.
  • Did miss something? Yes/No: TBD


// TODO: VC and SA has more than 3 weather conditions
if (state.basic.forcedWeather > 3) {
state.basic.weatherType <= 64 ? ++state.basic.weatherType : 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird.

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 0,
0, 0, 1, 3, 3, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2,
2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 2, 1
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document wether this comes from the game files or wether it's just typed by hand by observing what the game does.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented 13c4e76

@@ -20,7 +20,7 @@ BasicState::BasicState()
, timeScale2{0}
, lastWeather{0}
, nextWeather{0}
, forcedWeather{0}
, forcedWeather{UINT16_MAX}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Personally I don't like initializing to a constant like this

Copy link

@dracc dracc May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You prefer 65535? I know I do.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's equally bad :P why not just 0 like it used to be? I did not remember your comments about weather, but can't this even be a boolean?

Copy link
Owner Author

@Lihis Lihis May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to UINT16_MAX because based on my research on save games; the forced weather value was 0xFF when weather was not forced with ie. weather cheat. If weather cheat was used then the value was for example 0x03 when forced to foggy.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then use... 0xFF or add an enum with a value like: WEATHER_CYCLING = 0xFF

Lihis pushed a commit that referenced this pull request Jul 3, 2018
Fixes rwengine#519

==13884==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000b3d954 at pc 0x0000008ba469 bp 0x7ffd7c8f9ab0 sp 0x7ffd7c8f9aa0
READ of size 4 at 0x607000b3d954 thread T0
    #0 0x8ba468 in PlayerController::isTalkingOnPayphone() const /home/maarten/programming/openrw/rwengine/src/ai/PlayerController.cpp:315
    #1 0xa148eb in CharacterObject::updateMovementAnimation(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:128
    #2 0xa185d9 in CharacterObject::updateCharacter(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:356
    rwengine#3 0xa17735 in CharacterObject::tick(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:297
    rwengine#4 0x7c7731 in RWGame::tick(float) /home/maarten/programming/openrw/rwgame/RWGame.cpp:541
    rwengine#5 0x7c6abb in RWGame::run() /home/maarten/programming/openrw/rwgame/RWGame.cpp:447
    rwengine#6 0x793b45 in main /home/maarten/programming/openrw/rwgame/main.cpp:17
    rwengine#7 0x7f154c17e18a in __libc_start_main (/lib64/libc.so.6+0x2318a)
    rwengine#8 0x793839 in _start (/home/maarten/programming/openrw/build/build/rwgame/rwgame+0x793839)
@Lihis Lihis changed the base branch from master to main December 4, 2023 17:41
@Lihis
Copy link
Owner Author

Lihis commented Jan 5, 2025

Closing as I sent this to upstream as rwengine#759.

@Lihis Lihis closed this Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants