curiousdannii / parchment

The Interactive Fiction web app
https://iplayif.com
MIT License
429 stars 60 forks source link

Refreshing the window doesn't resize Z-machine status line #156

Open dfabulich opened 1 day ago

dfabulich commented 1 day ago

Z-machine games can't resize their status lines while input is pending, which is a known issue.

https://github.com/curiousdannii/parchment/issues/84#issuecomment-982075835

I think all Z-Machine terps have that limitation - Gargoyle and Windows Frotz do at least. Each time it draws the status line, after an input, it will use the current width. Unlike Glulx, the Z-Machine doesn't have the opportunity to redraw the status line while input is pending.

But, to my surprise, it won't even resize status lines when you refresh the page.

To repro: Navigate to https://iplayif.com/?story=https%3A%2F%2Fifarchive.org%2Fif-archive%2Fgames%2Fzcode%2Fanchor.z8 set your browser window very narrow, and restart the game. (I used Chrome Dev Tools to make the window 200 pixels wide.)

The status line wraps weird, because that's much too narrow.

image

Now, resize the browser window back to full size. The status line remains oddly wrapped, which is expected, because input is still pending. Now, refresh the page.

Expected: Refreshing the page should redraw the screen Actual: Refreshing the page doesn't redraw the screen; the status line remains oddly wrapped

curiousdannii commented 1 day ago

I'm not sure there's anything we can do here. When you auto restore a game it sends a screen resize event, but for ZCode you still need to wait for the next input to be processed for it to be redrawn. The point of auto restoring is to put it back into as identical a state as possible, so this situation is functionally identical to you making the window smaller and then bigger again without refreshing. The game doesn't get a chance to redraw the status window until you actually send a keyboard event.

Only Z3 could perhaps redraw it after resizing, because the interpreter is responsible rather than the game. It might even already do that, I don't remember.