Language::Zcode::Runtime::State

Language::Zcode::Runtime::State is a Perl module to handle saving, restoring, etc. the game state.
Download

Language::Zcode::Runtime::State Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Language::Zcode::Runtime::State team
  • Publisher web site:
  • http://search.cpan.org/~akarger/Language-Zcode-0.8/lib/Language/Zcode/Runtime/State.pm

Language::Zcode::Runtime::State Tags


Language::Zcode::Runtime::State Description

Language::Zcode::Runtime::State is a Perl module to handle saving, restoring, etc. the game state. Language::Zcode::Runtime::State is a Perl module to handle saving, restoring, etc. the game state.restoringGetter/setter: currently in the process of restoring or not?start_machineStart executing the Z-machine.In the normal case (starting a new game, or restarting), this is as simple as calling the Z-machine subroutine whose address is stored in the header.If we're restoring from a save file, it's more complicated. See "resume_execution".z_callWrapper around Z-code subroutine calls. The main reason we need it is for save/restore.In the normal case, z_call just calls the Z-code subroutine at address arg0 with the given args (arg5-argn), if any. Args 1-4 aren't used by z_call, but (hack alert!) they go into the Perl call stack, which is needed for saving Z-machine state.Input: subroutine address to call, local variables & eval stack (arrayrefs), next PC, store variable, args to the Z-sub.See "The call stack" for far more detail on this sub and save/restore.save_stateImplement the @save opcode, saving the current Z-machine state (as opposed to writing a table to a file, the other use of the @save opcode)Note that this sub also gets called at the very end of the restoring process.Returns 0 for failed save, 1 for successful save, 2 for "just finished restoring".build_save_stackCreate a Z-machine call stack by peeking at the Perl call stack.When calling Z_machine subroutines, we call z_call with all the information contained in a Z stack frame. We retrieve that information from the Perl call stack and build a Z-machine call stack with it.restore_stateImplement the @restore opcode, restoring the current Z-machine state (as opposed to reading a table from a file, the other use of the @restore opcode) Requirements: · Perl


Language::Zcode::Runtime::State Related Software