So most of the week was spent on rewritting the game loop to implement animations as shown above and fixing the bugs introduced by it..
The animation system is simply implemented by setting a timer that when it expires causes the room specific animation() function to be called. (1, 2, 3, 4)
Besides that,
- definitions for the remaining rooms were added
- initializes game state on startup (brought more surprises than anticipated)
- implement monitor scene
An interesting discovery for me was that although the text rendering code is correct it shows artifacts when drawing umlauts. As the game strings were copied directly from the cp437 encoded source I expected the character value to be encoded in a single byte as characters in extended ASCII don’t exceed 0xFF. What I didn’t consider is that UTF8 is only backwards compatible to basic ASCII (0x00 – 0x7F) and anything above takes at least two bytes, what causes the corruption as seen above (“Triebwerke funktionsunfähig”). That’s why umlauts in the German original will be substituted by their equivalent octal value as already done here.
For the coming days the first act should be made playable by implementing edit() so the sleeping cabin section works correctly and adjust the game loop for dying and implement the ‘death screen’.
After that implementing the remaining game logic takes priority especially now that the animation system is working.