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

The view of a peep in his window goes beyond the edge of the map when he's on a spiral slide. #7462

Closed
ocalhoun6 opened this issue Apr 29, 2018 · 6 comments
Labels
bug Something went wrong.

Comments

@ocalhoun6
Copy link
Contributor

ocalhoun6 commented Apr 29, 2018

OS: Windows 8
Version: e.g. 0.1.3
Commit/Build: 2512e49

If you have a window open to watch a particular peep, and that peep gets on a spiral slide, the view window will jump out beyond the edge of the map while that peep is on the slide, then jump back as soon as he's getting off it.

As far as I can tell, the spiral slide is the only ride that does this.

  • [ ? ] Reproducible in RCT2 (vanilla)?
  • [ No ] Specific to multiplayer?

Steps to reproduce:

  1. Click on a peep in the queue line for a spiral slide.
  2. Watch him through the small window while he rides the slide.

Screenshots / Video:

arid heights 2018-04-28 21-55-08
arid heights 2018-04-28 21-56-01

(In these screenshots, the main view is also way out on the edge of the map, but that's intentional and doesn't have anything to do with this bug.)

@Broxzier Broxzier added the bug Something went wrong. label Apr 29, 2018
@Gymnasiast
Copy link
Member

The spiral slide is a bit of an oddball when it comes to drawing, as all of the images are hardcoded - the .DAT only contains images for the New Ride window preview!

@duncanspumpkin
Copy link
Contributor

Spiral slide has so much special code for it. When a peep enters the ride they are moved to null location. I'll have to have a look at how this works for normal rides as they also move the peep to null. Does this happen on vanilla?

@ArDee20p
Copy link
Contributor

ArDee20p commented May 1, 2018

Vanilla treats the Spiral Slide the same as any other flatride for the peep viewport (centering view on the ride, like in the ride window viewport). I've spent enough hours in vanilla that I think I'd distinctly remember if it didn't, since that's a pretty noticeable visual bug.

@moTechPlz
Copy link
Contributor

moTechPlz commented Jun 26, 2018

OS: Windows 10

[ ? ] Reproducible in RCT2 (vanilla)?

No, vanilla renders the spiral slide building when the guest is on the ride.

I have researched this and the spiral slide is one of or the only triggering the VIEWPORT_FOCUS_TYPE_COORDINATE code. Other similar rides use VIEWPORT_FOCUS_TYPE_SPRITE.

union{
sprite_focus sprite;
coordinate_focus coordinate;
} focus = {}; // The focus will be either a sprite or a coordinate.

if (peep->x == LOCATION_NULL && final_check){
Ride *ride = get_ride(peep->current_ride);
int32_t x = ride->overall_view.x * 32 + 16;
int32_t y = ride->overall_view.y * 32 + 16;
int32_t height = tile_element_height(x, y);
height += 32;
focus.coordinate.x = x;
focus.coordinate.y = y;
focus.coordinate.z = height;
focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE;
}

This is a very weird bug. Took some time to figure out. Somehow this command

focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE;

overwrites the data in the coordinate struct of focus, specifically focus.coordinate.y. Data set just before this command.

focus.coordinate.x = x;
focus.coordinate.y = y;
focus.coordinate.z = height;

If i remove the offending command or split the focus struct in two the bug disappears.

@moTechPlz
Copy link
Contributor

moTechPlz commented Jun 26, 2018

Ok figured it out.

A union is a special data type available in C that allows storing different data types in the same memory location.

Since the function tries to store and retrieve from both the coordinate and sprite data structs it cannot be a union,

this fixes the bug

 struct{ 
     sprite_focus sprite; 
     coordinate_focus coordinate; 
 } focus = {}; // The focus will be both a sprite and a coordinate. 

do you people want me to open pull requests for these bug fixes?

@IntelOrca
Copy link
Contributor

do you people want me to open pull requests for these bug fixes?

Yes please!

duncanspumpkin added a commit to duncanspumpkin/OpenRCT2 that referenced this issue Jul 1, 2018
qqkookie added a commit to qqkookie/OpenRCT2 that referenced this issue Aug 13, 2018
…to cookie

* 'develop' of https://github.com/OpenRCT2/OpenRCT2.git: (39 commits)
  Fix part of OpenRCT2#7415: Korean scenario descriptions are mangled
  Add OpenRCT2#7882 to changelog [ci skip]
  Auto-detect RCT1 files location (OpenRCT2#7882)
  Tweak staff list name columns a little (OpenRCT2#7890)
  Merge Localisation/master into OpenRCT2/develop.
  Add Turkish translation
  Implement platform_get_locale_date_format for Linux
  Add OpenRCT2#7440 to changelog [ci skip]
  Remove the last usage of Math.hpp
  Remove Math::Clamp in favour of std::clamp
  Add OpenRCT2#7204 to changelog [ci skip]
  Remove some more strings
  Fix whitespace [ci skip]
  Remove more strings, fix error
  Remove many unused strings
  Scale mouse delta by zoom when using shift. (OpenRCT2#7868)
  Release memory from json_dumps and decrement references (OpenRCT2#7836)
  Fix OpenRCT2#7870: Tiny typo in console message (OpenRCT2#7879) [ci skip]
  Implement FootpathRemoveAction as a GameAction (OpenRCT2#7867)
  Fix OpenRCT2#7462: Guest window goes beyond the map edge on a spiral slide. (OpenRCT2#7752)
  ...

# Conflicts:
#	data/language/en-GB.txt
#	distribution/changelog.txt
#	src/openrct2/GameState.cpp
#	src/openrct2/localisation/StringIds.h
janisozaur added a commit that referenced this issue Aug 26, 2018
- Feature: [#5993] Ride window prices can now be set via text input.
- Feature: [#6998] Guests now wait for passing vehicles before crossing railway tracks.
- Feature: [#7658] Add option to always use system file browsing window.
- Feature: [#7694] Debug option to visualize paths that the game detects as wide.
- Feature: [#7713] The virtual floor now takes land ownership rights into account.
- Feature: [#7771] Danish translation.
- Feature: [#7797, #7802, #7821, #7830] Add sprite font glyphs for Danish, Norwegian, Russian, Turkish, Catalan and Romanian.
- Feature: [#7848] Add a master volume slider to audio options screen.
- Feature: [#7868] Placing scenery while holding shift now scales appropriately with zoom levels.
- Feature: [#7882] Auto-detect Steam and GOG installations of RCT1.
- Feature: [#7885] Turkish translation.
- Fix: [#3177] Wrong keys displayed in shortcut menu.
- Fix: [#4039] No sprite font glyph for German opening quotation mark.
- Fix: [#5548] platform_get_locale_date_format is not implemented for Linux.
- Fix: [#7204] Object source filters do not work for RCT1, AA and LL.
- Fix: [#7440] Memory leak. All system memory used.
- Fix: [#7462] Guest window goes beyond the map edge on a spiral slide.
- Fix: [#7533] Screenshot is incorrectly named/file is not generated in CJK language.
- Fix: [#7628] Always-researched items can be modified in the inventory list.
- Fix: [#7643] No Money scenarios with funding set to zero.
- Fix: [#7653] Finances money spinner is too narrow for big loans.
- Fix: [#7673] Vehicle names are cut off in invention list.
- Fix: [#7674] Rides show up as random numbers in guest's ride list.
- Fix: [#7678] Crash when loading or starting a new game while having object selection window open.
- Fix: [#7683] 'Arbitrary ride type' dropdown state is shared between windows.
- Fix: [#7697] Some scenery groups in RCT1 saves are never invented.
- Fix: [#7711] Inverted Hairpin Coaster allows building invisible banked pieces.
- Fix: [#7734] Title sequence not included in macOS builds as of 0.2.0 release.
- Fix: [#7756] Steam RCT2 path not correctly checked on macOS and Linux.
- Fix: [#7765] Crash when opening ride list window on Windows Vista.
- Fix: [#7773] Once research has been completed, player is still charged for research.
- Fix: [#7786] Crash when importing a track design.
- Fix: [#7793] Duplicate private keys generated.
- Fix: [#7817] No sprite font glyph for interpunct.
- Fix: [#7823] You can build mazes in pause mode.
- Fix: [#7804] Russian ride descriptions are cut off.
- Fix: [#7872] CJK tooltips are often cut off.
- Fix: [#7895] Import of Mega Park and the RCT1 title music do not work on some RCT1 sources.
- Improved: [#7899] Timestamps in the load/save screen are now displayed using local timezone instead of GMT.
- Improved: [#7918] Better RCT2 detection if both disc and GOG/Steam versions are installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something went wrong.
Projects
None yet
Development

No branches or pull requests

7 participants