Advertisement
ZoriaRPG

ZC Timing Sequence

Jan 20th, 2017
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. //=======================================================
  2. //--- Instruction Processing Order and General Timing ---
  3. =========================================================
  4.  
  5. 1. Instructions in Global script Init (if starting a new game)
  6. 2. Instructions in Global Script OnContinue (is resuming a game)
  7. 3. Instructions immediately inside the run() function of a global active script.
  8. 4. Instructions in the global active script's infinite loop prior to Waitdraw,
  9. if (5) does not exist, or on the first frame of the game.
  10. 5. Instructions from an ffc script positioned after (an illegal)
  11. Waitdraw() instruction in that script from the previous frame.
  12. Note: Requires being on at least the second frame of a game session.
  13. 6. Instructions in the global active script prior to Waitdraw().
  14. 7. Instructions in an ffc script, other than (5), excluding draw commands.
  15. 8. Screen Scrolling (2.50.2, or later)
  16. 9. Instructions from item scripts.
  17. 10. Waitdraw() in a global active script.
  18. 11. Engine writing to Link->Dir and Link->Tile.
  19. 12. Instructions in the global active script, called after Waitdraw()
  20. 12(b). Screen Scrolling ( 2.50.0, and 2.50.1 )
  21. 13. Drawing from FFCs
  22. 14. Instructions in an OnExit script, if the game is exiting.
  23. 15. Return to (5).
  24.  
  25.  
  26. void Waitdraw(); ZASM Instruction:
  27. WAITDRAW
  28. /**
  29. * Halts execution of the script until ZC's internal code has been run (movement,
  30. * collision detection, etc.), but before the screen is drawn. This can only
  31. * be used in the active global script.
  32. * Waitdraw() may only be called from the global active script; not from FFC scripts.
  33. * The sequence of ZC actions is as follows:
  34.  
  35. * FFCs (in numerical sequence, from FFC 01, to FFC 32)
  36. * Enemies
  37. * EWeapons
  38. * Link
  39. * LWeapons
  40. * Hookshot
  41. * Collision Checking
  42. * Store Link->Input / Link->Press
  43. * Waitdraw()
  44. * Drawing
  45. * Rendering of the Screen
  46. * Screen Scrolling
  47. * Drawing from FFCs
  48. *
  49. * Note: Drawing from FFCs technically occurs with other Drawing, but as it is issued after Waitdraw(),
  50. * it is offset (a frame late) and renders after screen scrolling, and after any other drawing in the same
  51. * frame as draw instructions from ffcs are called. To ensure that drawing done by ffcs is in sync with
  52. * other drawing, it is imperative to call it from your global script, using the ffc to trigger global
  53. * conditions that cause global drawing instructions that are called before Waitdraw() in your global
  54. * active script to evaluate true.
  55. *
  56. * Anything placed after Waitdraw() will not present graphical effects until the next frame.
  57. * It is possible { ! CHECK } to read/store Link->Tile, Link->Dir and other variables *after* Waitdraw()
  58. * in one frame, and then use these values to modify other pointer members so that they are drawn correctly
  59. * at the next execution of Waitdraw().
  60. *
  61. *
  62. */ Example Use:
  63.  
  64. Waitdraw();
  65.  
  66. //! Submit bug report that Link->Dir and Link->Tile are incorrect before Waitdraw.
  67.  
  68. * Waitdraw() in ffc scripts ///
  69. * --------------------------///
  70. * Althouth technically illegal, it is possible to call Waitdraw() in an *ffc script*. Doing this has the
  71. * following effects, and/or consequences:
  72. *
  73. * 1. The Compiler will report an error, and print the error to Allegro log:
  74. * 'Warning: Waitdraw() may only be used in global scripts.'
  75. * 2. Any instruction sint he ffc script that are called before the Waitdraw() instruction in the ffc script
  76. * will run this frame, after Waitdraw() in your global active script.
  77. * 3. Any instructions called *after* Waitdraw() in the ffc script, will run BEFORE BOTH Waitdraw() in your
  78. * global active script, and BEFORE any other instructions in your global active script's infinite loop.
  79. *
  80. * This behaviour may change in future versions of ZC, and using Waitdraw() in ffc scripts is not advised.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement