The International Simutrans Forum

 

Author Topic: Clipping failure  (Read 1231 times)

0 Members and 1 Guest are viewing this topic.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Clipping failure
« on: September 02, 2013, 02:27:23 AM »
Dings on tiles displayed at the bottom of the screen are not being height clipped correctly.
Three screen shots to illustrate: (from the yoshi game @231,295)
01: What the area looks like with proper clipping.
02: Same area with simple_drawing activated showing buildings/trees through the bridge. As expected for this mode.
03: simple_drawing is off, screen scrolled so tile containing the building/trees is just off the bottom edge. It's now drawing through the bridge incorrectly.
I've had no luck finding the correct parameter tweak to fix.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Clipping failure
« Reply #1 on: September 02, 2013, 06:00:17 AM »
No idea about this bug.

The clipping of stuff under bridges happens in planquadrat_t::display_dinge, lines 440+. It uses the clipping region from simgraph to clip horizontally. Maybe this clipping region is altered in between if near the screen border?

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Clipping failure
« Reply #2 on: September 02, 2013, 06:10:32 PM »
Code: [Select]
if(  yh >= p_cr.y   &&  yh < p_cr.y+p_cr.h  ) {fails when the top of the tile containing the tall building is below the bottom of the clipping rect. Can't quite wrap my head around what the logic is here... Removing the if entirely solves the problem, but surely it's for a reason?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Clipping failure
« Reply #3 on: September 02, 2013, 08:12:09 PM »
I cannot remember what the purpose of the if-clause is. Maybe to ensure that the clipping region is not enlarged?

I think the second condition was wrong, please check r6670.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1443
Re: Clipping failure
« Reply #4 on: September 03, 2013, 12:31:02 AM »
Dropping half the if seems to work just fine.