-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Mapified pos_bub, posx, and posy in the talker class hierarchy #79753
base: master
Are you sure you want to change the base?
Conversation
Edit: Edit 2: Edit 3: |
Summary
None
Purpose of change
Make map dependencies explicit. This time a bit of the talker class hierarchy and users.
Edit:
Made the 'pos_x' and 'pos_y' JSON talker operations absolute, not reality bubble relative. JSON doesn't know anything about the reality bubble, and certainly not where its anchor point happens to be. All position operations used from JSON will have to be relative to talkers, so it's better if those talker positions are better absolute (it also makes it possible for future talkers to operate on a map other than "the" reality bubble).
Also updated the tests for those to be more in line with what might actually be used when this functionality is used outside of the tests (didn't bother with the reading tests, those are still silly).
Describe the solution
Add a map parameter to pos_bub, posx, and posy in the talker class hierarchy and adjust callers accordingly.
It resulted in a whole lost of definitions of local constants of various pos_bub() calls and usage of the constants rather than repeated calls. It also led to most posx() and posy() usages disappearing because the constants could be used instead.
I encountered some weird code in glide_activity_actor::do_turn(), where the visibility cache is updated with both x, y, and z coordinates, which doesn't make any sense at all, since the parameter is the z parameter. Thus, I removed the x and y calls.
Describe alternatives you've considered
I tried to get rid of the JSON usages of pos_x, pos_y, and pos_z, but those were cleverly hidden by 'pos_x' rather than "pos_x", so I had to restore that functionality (with ugly get_map() calls). Fortunately, it blew up immediately when I tried to test it.
Testing
Apart from the weird visibility cache update, no functionality should have changed.
Load save, walk up ramp, jump into car, run through hay bales, run over zombie corpse with inventory, run over turkeys, smash into stationary vehicle. Nothing odd seen.
Additional context
Why does 'talker' have 'set_pos' and everyone else(?) 'setpos'? Is it to intentionally to not override the operation, or should it be changed to 'setpos' and be overridden?