Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Wanted: Back and forward buttons to go to previous locations displayed  (Read 613 times)

Dorf and Dumb

  • Bay Watcher
    • View Profile

This one _ought_ to be really simple and _ought_ to really improve gameplay a lot, while taking up maybe 256 bytes and a small utility routine.

Set up a buffer that holds all the screen locations previously displayed.  It should be really simple: every time the scene displayed ON THE SCREEN moves, the buffer logs the location and remembers it in case you want to go back.

So for example, suppose you scroll around a bit on the screen with the arrows, use F7 to look at your bedrooms,  a screen comes up "You've discovered a cavern", F5 to look at the forges, you scan up through 10 levels of mining tunnels, some bitch drops a sprog.  Then hitting back-arrow once gets you to the level (F5 + 10) you were looking at before she squatted and shot it out.  Second time puts you on F5+9, third to F5+8, etc., until the 11th press (if I counted right) gets you to the cavern you discovered, the 12th to the bedrooms, and the 13th, 14th, whatever repeat the shifts in the screen while you were arrowing around (the way I'm picturing it, it wouldn't remember every single shift of the X _on_ the screen, just the screen shifts).  Now because there were a lot of presses there you probably blew right past the cavern you were looking for, so some key next to the backarrow button (maybe = or \, should be whatever is most broadly compatible with multiple keyboards) should take you forward through the buffer again, like ^Y on a half-decent text editor reverses ^Z.  (I suppose you could _use_ ^Y and ^Z but you might prefer to reserve them for actual actions rather than viewport shifts)

I think that if done in a pretty simple-minded, low level manner this wouldn't impose a lot of maintenance (it would be tightly associated with just plain moving the screen display) and would really make the UI more convenient.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Wanted: Back and forward buttons to go to previous locations displayed
« Reply #1 on: August 15, 2014, 03:20:49 pm »

I think this ought to be fairly easy to implement.  Set aside enough space for N cursor positions and initialize them all to some "not a real location value," and set up a pointer to the first location.

When the game moves the cursor including hotkeys, or the user issues some kind of "breadcrumb" command, write the cursor location, increment the pointer by one slot, and overwrite that slot with the "not a real location value."  (Game-initiated and hotkey moves would record the location before the shift).  I don't think z-level changes, shift-arrow movements, etc. should be recorded.

On the back command, check that the previous slot is a valid cursor location.  If it is, decrement the pointer and move the game cursor to the appropriate slot.
On the forward command, check that the next slot is a valid cursor location.  If it is, increment the pointer and move the game cursor to the appropriate slot.

The list wraps around, so there's no need to shift things around in memory to avoid the edges.

One issue, which is a feature or a bug depending on your point of view, is that a new view-shift will invalidate all forward saved positions.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Dorf and Dumb

  • Bay Watcher
    • View Profile
Re: Wanted: Back and forward buttons to go to previous locations displayed
« Reply #2 on: August 15, 2014, 08:26:57 pm »

Losing the forward buffer limits a tweak on a tweak; I wouldn't care that much.  90% of the time all you want to do is go back one screen to before you were jerked around; I suggested the rest just because why not?  I don't really know, come to think of it, if it is easier to follow the cursor after all, or the screen moves I suggested, or just undo hotkeys and jerk-arounds ... whatever is easiest to do is OK.
Logged