Subversion Repositories Games.Prince of Persia

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2. SDLPoP, a port/conversion of the DOS game Prince of Persia.
  3. Copyright (C) 2013-2018  Dávid Nagy
  4.  
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  
  18. The authors of this program may be contacted at http://forum.princed.org
  19. */
  20.  
  21. #include "common.h"
  22.  
  23. #define SEQTBL_BASE 0x196E
  24. #define SEQTBL_0 (seqtbl - SEQTBL_BASE)
  25.  
  26. // This expands a two-byte number into two comma-separated bytes, used for the JMP destinations
  27. #define DW(data_word) (data_word) & 0x00FF, (((data_word) & 0xFF00) >> 8)
  28.  
  29. // Shorter notation for the sequence table instructions
  30. #define act(action) SEQ_ACTION, action
  31. #define jmp(dest) SEQ_JMP, DW(dest)
  32. #define jmp_if_feather(dest) SEQ_JMP_IF_FEATHER, DW(dest)
  33. #define dx(amount) SEQ_DX, (byte) amount
  34. #define dy(amount) SEQ_DY, (byte) amount
  35. #define snd(sound) SEQ_SOUND, sound
  36. #define set_fall(x, y) SEQ_SET_FALL, (byte) x, (byte) y
  37.  
  38. // This splits the byte array into labeled "sections" that are packed tightly next to each other
  39. // However, it only seems to work correctly in the Debug configuration...
  40. //#define LABEL(label) }; const byte label##_eventual_ptr[] __attribute__ ((aligned(1))) = {
  41. #define LABEL(label) // disable
  42. //#define OFFSET(label) label - seqtbl + SEQTBL_BASE
  43.  
  44. // Labels
  45. #define running             SEQTBL_BASE                                   // 0x196E
  46. #define startrun            5  + running            //SEQTBL_BASE + 5     // 0x1973
  47. #define runstt1             2  + startrun           //SEQTBL_BASE + 7     // 0x1975
  48. #define runstt4             3  + runstt1            //SEQTBL_BASE + 10    // 0x1978
  49. #define runcyc1             9  + runstt4            //SEQTBL_BASE + 19    // 0x1981
  50. #define runcyc7             20 + runcyc1            //SEQTBL_BASE + 39    // 0x1995
  51. #define stand               11 + runcyc7            //SEQTBL_BASE + 50    // 0x19A0
  52. #define goalertstand        6  + stand              //SEQTBL_BASE + 56    // 0x19A6
  53. #define alertstand          2  + goalertstand       //SEQTBL_BASE + 58    // 0x19A8
  54. #define arise               4  + alertstand         //SEQTBL_BASE + 62    // 0x19AC
  55. #define guardengarde        21 + arise              //SEQTBL_BASE + 83    // 0x19C1
  56. #define engarde             3  + guardengarde       //SEQTBL_BASE + 86    // 0x19C4
  57. #define ready               14 + engarde            //SEQTBL_BASE + 100   // 0x19D2
  58. #define ready_loop          6  + ready              //SEQTBL_BASE + 106   // 0x19D8
  59. #define stabbed             4  + ready_loop         //SEQTBL_BASE + 110   // 0x19DC
  60. #define strikeadv           29 + stabbed            //SEQTBL_BASE + 139   // 0x19F9
  61. #define strikeret           14 + strikeadv          //SEQTBL_BASE + 153   // 0x1A07
  62. #define advance             12 + strikeret          //SEQTBL_BASE + 165   // 0x1A13
  63. #define fastadvance         15 + advance            //SEQTBL_BASE + 180   // 0x1A22
  64. #define retreat             12 + fastadvance        //SEQTBL_BASE + 192   // 0x1A2E
  65. #define strike              14 + retreat            //SEQTBL_BASE + 206   // 0x1A3C
  66. #define faststrike          6  + strike             //SEQTBL_BASE + 212   // 0x1A42
  67. #define guy4                3  + faststrike         //SEQTBL_BASE + 215   // 0x1A45
  68. #define guy7                5  + guy4               //SEQTBL_BASE + 220   // 0x1A4A
  69. #define guy8                3  + guy7               //SEQTBL_BASE + 223   // 0x1A4D
  70. #define blockedstrike       7  + guy8               //SEQTBL_BASE + 230   // 0x1A54
  71. #define blocktostrike       6  + blockedstrike      //SEQTBL_BASE + 236   // 0x1A5A
  72. #define readyblock          4  + blocktostrike      //SEQTBL_BASE + 240   // 0x1A5E
  73. #define blocking            1  + readyblock         //SEQTBL_BASE + 241   // 0x1A5F
  74. #define striketoblock       4  + blocking           //SEQTBL_BASE + 245   // 0x1A63
  75. #define landengarde         5  + striketoblock      //SEQTBL_BASE + 250   // 0x1A68
  76. #define bumpengfwd          6  + landengarde        //SEQTBL_BASE + 256   // 0x1A6E
  77. #define bumpengback         7  + bumpengfwd         //SEQTBL_BASE + 263   // 0x1A75
  78. #define flee                7  + bumpengback        //SEQTBL_BASE + 270   // 0x1A7C
  79. #define turnengarde         7  + flee               //SEQTBL_BASE + 277   // 0x1A83
  80. #define alertturn           8  + turnengarde        //SEQTBL_BASE + 285   // 0x1A8B
  81. #define standjump           8  + alertturn          //SEQTBL_BASE + 293   // 0x1A93
  82. #define sjland              29 + standjump          //SEQTBL_BASE + 322   // 0x1AB0
  83. #define runjump             29 + sjland             //SEQTBL_BASE + 351   // 0x1ACD
  84. #define rjlandrun           46 + runjump            //SEQTBL_BASE + 397   // 0x1AFB
  85. #define rdiveroll           9  + rjlandrun          //SEQTBL_BASE + 406   // 0x1B04
  86. #define rdiveroll_crouch    18 + rdiveroll          //SEQTBL_BASE + 424   // 0x1B16
  87. #define sdiveroll           4  + rdiveroll_crouch   //SEQTBL_BASE + 428   // 0x1B1A
  88. #define crawl               1  + sdiveroll          //SEQTBL_BASE + 429   // 0x1B1B
  89. #define crawl_crouch        14 + crawl              //SEQTBL_BASE + 443   // 0x1B29
  90. #define turndraw            4  + crawl_crouch       //SEQTBL_BASE + 447   // 0x1B2D
  91. #define turn                12 + turndraw           //SEQTBL_BASE + 459   // 0x1B39
  92. #define turnrun             26 + turn               //SEQTBL_BASE + 485   // 0x1B53
  93. #define runturn             7  + turnrun            //SEQTBL_BASE + 492   // 0x1B5A
  94. #define fightfall           43 + runturn            //SEQTBL_BASE + 535   // 0x1B85
  95. #define efightfall          28 + fightfall          //SEQTBL_BASE + 563   // 0x1BA1
  96. #define efightfallfwd       30 + efightfall         //SEQTBL_BASE + 593   // 0x1BBF
  97. #define stepfall            28 + efightfallfwd      //SEQTBL_BASE + 621   // 0x1BDB
  98. #define fall1               9  + stepfall           //SEQTBL_BASE + 630   // 0x1BE4
  99. #define patchfall           22 + fall1              //SEQTBL_BASE + 652   // 0x1BFA
  100. #define stepfall2           7  + patchfall          //SEQTBL_BASE + 659   // 0x1C01
  101. #define stepfloat           5  + stepfall2          //SEQTBL_BASE + 664   // 0x1C06
  102. #define jumpfall            22 + stepfloat          //SEQTBL_BASE + 686   // 0x1C1C
  103. #define rjumpfall           28 + jumpfall           //SEQTBL_BASE + 714   // 0x1C38
  104. #define jumphangMed         28 + rjumpfall          //SEQTBL_BASE + 742   // 0x1C54
  105. #define jumphangLong        21 + jumphangMed        //SEQTBL_BASE + 763   // 0x1C69
  106. #define jumpbackhang        27 + jumphangLong       //SEQTBL_BASE + 790   // 0x1C84
  107. #define hang                29 + jumpbackhang       //SEQTBL_BASE + 819   // 0x1CA1
  108. #define hang1               3  + hang               //SEQTBL_BASE + 822   // 0x1CA4
  109. #define hangstraight        45 + hang1              //SEQTBL_BASE + 867   // 0x1CD1
  110. #define hangstraight_loop   7  + hangstraight       //SEQTBL_BASE + 874   // 0x1CD8
  111. #define climbfail           4  + hangstraight_loop  //SEQTBL_BASE + 878   // 0x1CDC
  112. #define climbdown           16 + climbfail          //SEQTBL_BASE + 894   // 0x1CEC
  113. #define climbup             24 + climbdown          //SEQTBL_BASE + 918   // 0x1D04
  114. #define hangdrop            33 + climbup            //SEQTBL_BASE + 951   // 0x1D25
  115. #define hangfall            17 + hangdrop           //SEQTBL_BASE + 968   // 0x1D36
  116. #define freefall            19 + hangfall           //SEQTBL_BASE + 987   // 0x1D49
  117. #define freefall_loop       2  + freefall           //SEQTBL_BASE + 989   // 0x1D4B
  118. #define runstop             4  + freefall_loop      //SEQTBL_BASE + 993   // 0x1D4F
  119. #define jumpup              25 + runstop            //SEQTBL_BASE + 1018  // 0x1D68
  120. #define highjump            21 + jumpup             //SEQTBL_BASE + 1039  // 0x1D7D
  121. #define superhijump         30 + highjump           //SEQTBL_BASE + 1069  // 0x1D9B
  122. #define fallhang            91 + superhijump        //SEQTBL_BASE + 1160  // 0x1DF6
  123. #define bump                6  + fallhang           //SEQTBL_BASE + 1166  // 0x1DFC
  124. #define bumpfall            10 + bump               //SEQTBL_BASE + 1176  // 0x1E06
  125. #define bumpfloat           31 + bumpfall           //SEQTBL_BASE + 1207  // 0x1E25
  126. #define hardbump            22 + bumpfloat          //SEQTBL_BASE + 1229  // 0x1E3B
  127. #define testfoot            30 + hardbump           //SEQTBL_BASE + 1259  // 0x1E59
  128. #define stepback            31 + testfoot           //SEQTBL_BASE + 1290  // 0x1E78
  129. #define step14              5  + stepback           //SEQTBL_BASE + 1295  // 0x1E7D
  130. #define step13              31 + step14             //SEQTBL_BASE + 1326  // 0x1E9C
  131. #define step12              31 + step13             //SEQTBL_BASE + 1357  // 0x1EBB
  132. #define step11              31 + step12             //SEQTBL_BASE + 1388  // 0x1EDA
  133. #define step10              29 + step11             //SEQTBL_BASE + 1417  // 0x1EF7
  134. #define step10a             5  + step10             //SEQTBL_BASE + 1422  // 0x1EFC
  135. #define step9               23 + step10a            //SEQTBL_BASE + 1445  // 0x1F13
  136. #define step8               6  + step9              //SEQTBL_BASE + 1451  // 0x1F19
  137. #define step7               26 + step8              //SEQTBL_BASE + 1477  // 0x1F33
  138. #define step6               21 + step7              //SEQTBL_BASE + 1498  // 0x1F48
  139. #define step5               21 + step6              //SEQTBL_BASE + 1519  // 0x1F5D
  140. #define step4               21 + step5              //SEQTBL_BASE + 1540  // 0x1F72
  141. #define step3               16 + step4              //SEQTBL_BASE + 1556  // 0x1F82
  142. #define step2               16 + step3              //SEQTBL_BASE + 1572  // 0x1F92
  143. #define step1               12 + step2              //SEQTBL_BASE + 1584  // 0x1F9E
  144. #define stoop               9  + step1              //SEQTBL_BASE + 1593  // 0x1FA7
  145. #define stoop_crouch        8  + stoop              //SEQTBL_BASE + 1601  // 0x1FAF
  146. #define standup             4  + stoop_crouch       //SEQTBL_BASE + 1605  // 0x1FB3
  147. #define pickupsword         23 + standup            //SEQTBL_BASE + 1628  // 0x1FCA
  148. #define resheathe           16 + pickupsword        //SEQTBL_BASE + 1644  // 0x1FDA
  149. #define fastsheathe         33 + resheathe          //SEQTBL_BASE + 1677  // 0x1FFB
  150. #define drinkpotion         14 + fastsheathe        //SEQTBL_BASE + 1691  // 0x2009
  151. #define softland            34 + drinkpotion        //SEQTBL_BASE + 1725  // 0x202B
  152. #define softland_crouch     11 + softland           //SEQTBL_BASE + 1736  // 0x2036
  153. #define landrun             4  + softland_crouch    //SEQTBL_BASE + 1740  // 0x203A
  154. #define medland             32 + landrun            //SEQTBL_BASE + 1772  // 0x205A
  155. #define hardland            66 + medland            //SEQTBL_BASE + 1838  // 0x209C
  156. #define hardland_dead       9  + hardland           //SEQTBL_BASE + 1847  // 0x20A5
  157. #define stabkill            4  + hardland_dead      //SEQTBL_BASE + 1851  // 0x20A9
  158. #define dropdead            5  + stabkill           //SEQTBL_BASE + 1856  // 0x20AE
  159. #define dropdead_dead       12 + dropdead           //SEQTBL_BASE + 1868  // 0x20BA
  160. #define impale              4  + dropdead_dead      //SEQTBL_BASE + 1872  // 0x20BE
  161. #define impale_dead         7  + impale             //SEQTBL_BASE + 1879  // 0x20C5
  162. #define halve               4  + impale_dead        //SEQTBL_BASE + 1883  // 0x20C9
  163. #define halve_dead          4  + halve              //SEQTBL_BASE + 1887  // 0x20CD
  164. #define crush               4  + halve_dead         //SEQTBL_BASE + 1891  // 0x20D1
  165. #define deadfall            3  + crush              //SEQTBL_BASE + 1894  // 0x20D4
  166. #define deadfall_loop       5  + deadfall           //SEQTBL_BASE + 1899  // 0x20D9
  167. #define climbstairs         4  + deadfall_loop      //SEQTBL_BASE + 1903  // 0x20DD
  168. #define climbstairs_loop    81 + climbstairs        //SEQTBL_BASE + 1984  // 0x212E
  169. #define Vstand              4  + climbstairs_loop   //SEQTBL_BASE + 1988  // 0x2132
  170. #define Vraise              4  + Vstand             //SEQTBL_BASE + 1992  // 0x2136
  171. #define Vraise_loop         21 + Vraise             //SEQTBL_BASE + 2013  // 0x214B
  172. #define Vwalk               4  + Vraise_loop        //SEQTBL_BASE + 2017  // 0x214F
  173. #define Vwalk1              2  + Vwalk              //SEQTBL_BASE + 2019  // 0x2151
  174. #define Vwalk2              3  + Vwalk1             //SEQTBL_BASE + 2022  // 0x2154
  175. #define Vstop               18 + Vwalk2             //SEQTBL_BASE + 2040  // 0x2166
  176. #define Vexit               7  + Vstop              //SEQTBL_BASE + 2047  // 0x216D
  177. #define Pstand              40 + Vexit              //SEQTBL_BASE + 2087  // 0x2195
  178. #define Palert              4  + Pstand             //SEQTBL_BASE + 2091  // 0x2199
  179. #define Pstepback           15 + Palert             //SEQTBL_BASE + 2106  // 0x21A8
  180. #define Pstepback_loop      16 + Pstepback          //SEQTBL_BASE + 2122  // 0x21B8
  181. #define Plie                4  + Pstepback_loop     //SEQTBL_BASE + 2126  // 0x21BC
  182. #define Pwaiting            4  + Plie               //SEQTBL_BASE + 2130  // 0x21C0
  183. #define Pembrace            4  + Pwaiting           //SEQTBL_BASE + 2134  // 0x21C4
  184. #define Pembrace_loop       30 + Pembrace           //SEQTBL_BASE + 2164  // 0x21E2
  185. #define Pstroke             4  + Pembrace_loop      //SEQTBL_BASE + 2168  // 0x21E6
  186. #define Prise               4  + Pstroke            //SEQTBL_BASE + 2172  // 0x21EA
  187. #define Prise_loop          14 + Prise              //SEQTBL_BASE + 2186  // 0x21F8
  188. #define Pcrouch             4  + Prise_loop         //SEQTBL_BASE + 2190  // 0x21FC
  189. #define Pcrouch_loop        64 + Pcrouch            //SEQTBL_BASE + 2254  // 0x223C
  190. #define Pslump              4  + Pcrouch_loop       //SEQTBL_BASE + 2258  // 0x2240
  191. #define Pslump_loop         1  + Pslump             //SEQTBL_BASE + 2259  // 0x2241
  192. #define Mscurry             4  + Pslump_loop        //SEQTBL_BASE + 2263  // 0x2245
  193. #define Mscurry1            2  + Mscurry            //SEQTBL_BASE + 2265  // 0x2247
  194. #define Mstop               12 + Mscurry1           //SEQTBL_BASE + 2277  // 0x2253
  195. #define Mraise              4  + Mstop              //SEQTBL_BASE + 2281  // 0x2257
  196. #define Mleave              4  + Mraise             //SEQTBL_BASE + 2285  // 0x225B
  197. #define Mclimb              19 + Mleave             //SEQTBL_BASE + 2304  // 0x226E
  198. #define Mclimb_loop         2  + Mclimb             //SEQTBL_BASE + 2306  // 0x2270
  199.  
  200. const word seqtbl_offsets[] = {
  201.         0x0000,         startrun,       stand,          standjump,
  202.         runjump,        turn,           runturn,        stepfall,
  203.         jumphangMed,    hang,           climbup,        hangdrop,
  204.         freefall,       runstop,        jumpup,         fallhang,
  205.         jumpbackhang,   softland,       jumpfall,       stepfall2,
  206.         medland,        rjumpfall,      hardland,       hangfall,
  207.         jumphangLong,   hangstraight,   rdiveroll,      sdiveroll,
  208.         highjump,       step1,          step2,          step3,
  209.         step4,          step5,          step6,          step7,
  210.         step8,          step9,          step10,         step11,
  211.         step12,         step13,         step14,         turnrun,
  212.         testfoot,       bumpfall,       hardbump,       bump,
  213.         superhijump,    standup,        stoop,          impale,
  214.         crush,          deadfall,       halve,          engarde,
  215.         advance,        retreat,        strike,         flee,
  216.         turnengarde,    striketoblock,  readyblock,     landengarde,
  217.         bumpengfwd,     bumpengback,    blocktostrike,  strikeadv,
  218.         climbdown,      blockedstrike,  climbstairs,    dropdead,
  219.         stepback,       climbfail,      stabbed,        faststrike,
  220.         strikeret,      alertstand,     drinkpotion,    crawl,
  221.         alertturn,      fightfall,      efightfall,     efightfallfwd,
  222.         running,        stabkill,       fastadvance,    goalertstand,
  223.         arise,          turndraw,       guardengarde,   pickupsword,
  224.         resheathe,      fastsheathe,    Pstand,         Vstand,
  225.         Vwalk,          Vstop,          Palert,         Pstepback,
  226.         Vexit,          Mclimb,         Vraise,         Plie,
  227.         patchfall,      Mscurry,        Mstop,          Mleave,
  228.         Pembrace,       Pwaiting,       Pstroke,        Prise,
  229.         Pcrouch,        Pslump,         Mraise
  230. };
  231.  
  232. // data:196E
  233. byte seqtbl[] = {
  234.  
  235.         LABEL(running) // running
  236.         act(actions_1_run_jump), jmp(runcyc1), // goto running: frame 7
  237.  
  238.         LABEL(startrun) // startrun
  239.         act(actions_1_run_jump), LABEL(runstt1) frame_1_start_run,
  240.         frame_2_start_run, frame_3_start_run, LABEL(runstt4) frame_4_start_run,
  241.         dx(8), frame_5_start_run,
  242.         dx(3), frame_6_start_run,
  243.         dx(3), LABEL(runcyc1) frame_7_run,
  244.         dx(5), frame_8_run,
  245.         dx(1), snd(SND_FOOTSTEP), frame_9_run,
  246.         dx(2), frame_10_run,
  247.         dx(4), frame_11_run,
  248.         dx(5), frame_12_run,
  249.         dx(2), LABEL(runcyc7) snd(SND_FOOTSTEP), frame_13_run,
  250.         dx(3), frame_14_run,
  251.         dx(4), jmp(runcyc1),
  252.  
  253.         LABEL(stand) // stand
  254.         act(actions_0_stand), frame_15_stand,
  255.         jmp(stand), // goto "stand"
  256.  
  257.         LABEL(goalertstand) // alert stand
  258.         act(actions_1_run_jump), LABEL(alertstand) frame_166_stand_inactive,
  259.         jmp(alertstand), // goto "alertstand"
  260.  
  261.         LABEL(arise) // arise (skeleton)
  262.         act(actions_5_bumped), dx(10), frame_177_spiked,
  263.         frame_177_spiked,
  264.         dx(-7), dy(-2), frame_178_chomped,
  265.         dx(5), dy(2), frame_166_stand_inactive,
  266.         dx(-1), jmp(ready), // goto "ready"
  267.  
  268.         // guard engarde
  269.         LABEL(guardengarde)
  270.         jmp(ready), // goto "ready"
  271.  
  272.         // engarde
  273.         LABEL(engarde)
  274.         act(actions_1_run_jump),
  275.         dx(2), frame_207_draw_1,
  276.         frame_208_draw_2,
  277.         dx(2), frame_209_draw_3,
  278.         dx(2), frame_210_draw_4,
  279.         dx(3), LABEL(ready) act(actions_1_run_jump), snd(SND_SILENT), frame_158_stand_with_sword,
  280.         frame_170_stand_with_sword,
  281.         LABEL(ready_loop) frame_171_stand_with_sword,
  282.         jmp(ready_loop), // goto ":loop"
  283.  
  284.         LABEL(stabbed)// stabbed
  285.         act(actions_5_bumped), set_fall(-1, 0), frame_172_jumpfall_2,
  286.         dx(-1), dy(1), frame_173_jumpfall_3,
  287.         dx(-1), frame_174_jumpfall_4,
  288.         dx(-1), dy(2), // frame 175 is commented out in the Apple II source
  289.         dx(-2), dy(1),
  290.         dx(-5), dy(-4),
  291.         jmp(guy8), // goto "guy8"
  292.  
  293.         // strike - advance
  294.         LABEL(strikeadv)
  295.         act(actions_1_run_jump), set_fall(1, 0), frame_155_guy_7,
  296.         dx(2), frame_165_walk_with_sword,
  297.         dx(-2), jmp(ready), // goto "ready"
  298.  
  299.         LABEL(strikeret)// strike - retreat
  300.         act(actions_1_run_jump), set_fall(-1, 0), frame_155_guy_7,
  301.         frame_156_guy_8,
  302.         frame_157_walk_with_sword,
  303.         frame_158_stand_with_sword,
  304.         jmp(retreat), // goto "retreat"
  305.  
  306.         LABEL(advance) // advance
  307.         act(actions_1_run_jump), set_fall(1, 0),
  308.         dx(2), frame_163_fighting,
  309.         dx(4), frame_164_fighting,
  310.         frame_165_walk_with_sword,
  311.         jmp(ready), // goto "ready"
  312.  
  313.         LABEL(fastadvance) // fast advance
  314.         act(actions_1_run_jump), set_fall(1, 0), dx(6), frame_164_fighting,
  315.         frame_165_walk_with_sword,
  316.         jmp(ready), // goto "ready"
  317.  
  318.         LABEL(retreat) // retreat
  319.         act(actions_1_run_jump), set_fall(-1, 0), dx(-3), frame_160_fighting,
  320.         dx(-2), frame_157_walk_with_sword,
  321.         jmp(ready), // goto "ready"
  322.  
  323.         LABEL(strike) // strike
  324.         act(actions_1_run_jump), set_fall(-1, 0), frame_168_back,
  325.         LABEL(faststrike) act(actions_1_run_jump), frame_151_strike_1,
  326.         LABEL(guy4) act(actions_1_run_jump), frame_152_strike_2,
  327.         frame_153_strike_3,
  328.         frame_154_poking,
  329.         LABEL(guy7) act(actions_5_bumped), frame_155_guy_7,
  330.         LABEL(guy8) act(actions_1_run_jump), frame_156_guy_8,
  331.         frame_157_walk_with_sword,
  332.         jmp(ready), // goto "ready"
  333.  
  334.         LABEL(blockedstrike)// blocked strike
  335.         act(actions_1_run_jump), frame_167_blocked,
  336.         jmp(guy7), // goto "guy7"
  337.  
  338.         // block to strike
  339.         LABEL(blocktostrike)// "blocktostrike"
  340.         frame_162_block_to_strike,
  341.         jmp(guy4), // goto "guy4"
  342.  
  343.         LABEL(readyblock) // ready block
  344.         frame_169_begin_block,
  345.         LABEL(blocking) frame_150_parry,
  346.         jmp(ready), // goto "ready"
  347.  
  348.         LABEL(striketoblock) // strike to block
  349.         frame_159_fighting,
  350.         frame_160_fighting,
  351.         jmp(blocking), // goto "blocking"
  352.  
  353.         LABEL(landengarde) // land en garde
  354.         act(actions_1_run_jump), SEQ_KNOCK_DOWN, jmp(ready), // goto "ready"
  355.  
  356.         LABEL(bumpengfwd) // bump en garde (forward)
  357.         act(actions_5_bumped), dx(-8), jmp(ready), // goto "ready"
  358.  
  359.         LABEL(bumpengback) // bump en garde (back)
  360.         act(actions_5_bumped), frame_160_fighting,
  361.         frame_157_walk_with_sword,
  362.         jmp(ready), // goto "ready"
  363.  
  364.         LABEL(flee) // flee
  365.         act(actions_7_turn), dx(-8), jmp(turn), // goto "turn"
  366.  
  367.         LABEL(turnengarde) // turn en garde
  368.         act(actions_5_bumped), SEQ_FLIP, dx(5), jmp(retreat), // goto "retreat"
  369.  
  370.         LABEL(alertturn) // alert turn (for enemies)
  371.         act(actions_5_bumped), SEQ_FLIP, dx(18), jmp(goalertstand), // goto "goalertstand"
  372.  
  373.         LABEL(standjump) // standing jump
  374.         act(actions_1_run_jump), frame_16_standing_jump_1,
  375.         frame_17_standing_jump_2,
  376.         dx(2), frame_18_standing_jump_3,
  377.         dx(2), frame_19_standing_jump_4,
  378.         dx(2), frame_20_standing_jump_5,
  379.         dx(2), frame_21_standing_jump_6,
  380.         dx(2), frame_22_standing_jump_7,
  381.         dx(7), frame_23_standing_jump_8,
  382.         dx(9), frame_24_standing_jump_9,
  383.         dx(5), dy(-6), /* "sjland" */ LABEL(sjland) frame_25_standing_jump_10,
  384.         dx(1), dy(6), frame_26_standing_jump_11,
  385.         dx(4), SEQ_KNOCK_DOWN, snd(SND_FOOTSTEP), frame_27_standing_jump_12,
  386.         dx(-3), frame_28_standing_jump_13,
  387.         dx(5), frame_29_standing_jump_14,
  388.         snd(SND_FOOTSTEP), frame_30_standing_jump_15,
  389.         frame_31_standing_jump_16,
  390.         frame_32_standing_jump_17,
  391.         frame_33_standing_jump_18,
  392.         dx(1), jmp(stand), // goto "stand"
  393.  
  394.         LABEL(runjump) // running jump
  395.         act(actions_1_run_jump), snd(SND_FOOTSTEP), frame_34_start_run_jump_1,
  396.         dx(5), frame_35_start_run_jump_2,
  397.         dx(6), frame_36_start_run_jump_3,
  398.         dx(3), frame_37_start_run_jump_4,
  399.         dx(5), snd(SND_FOOTSTEP), frame_38_start_run_jump_5,
  400.         dx(7), frame_39_start_run_jump_6,
  401.         dx(12), dy(-3), frame_40_running_jump_1,
  402.         dx(8), dy(-9), frame_41_running_jump_2,
  403.         dx(8), dy(-2), frame_42_running_jump_3,
  404.         dx(4), dy(11), frame_43_running_jump_4,
  405.         dx(4), dy(3), /* "rjlandrun" */ LABEL(rjlandrun) frame_44_running_jump_5,
  406.         dx(5), SEQ_KNOCK_DOWN, snd(SND_FOOTSTEP), jmp(runcyc1), // goto "runcyc1"
  407.  
  408.         LABEL(rdiveroll) // run dive roll
  409.         act(actions_1_run_jump), dx(1), frame_107_fall_land_1,
  410.         dx(2), dx(2), frame_108_fall_land_2,
  411.         dx(2), frame_109_crouch,
  412.         dx(2), frame_109_crouch,
  413.         dx(2), /* ":crouch" */ LABEL(rdiveroll_crouch) frame_109_crouch,
  414.         jmp(rdiveroll_crouch), // goto ":crouch"
  415.  
  416.         LABEL(sdiveroll)
  417.         0x00, // stand dive roll; not implemented
  418.  
  419.         LABEL(crawl) // crawl
  420.         act(actions_1_run_jump), dx(1), frame_110_stand_up_from_crouch_1,
  421.         frame_111_stand_up_from_crouch_2,
  422.         dx(2), frame_112_stand_up_from_crouch_3,
  423.         dx(2), frame_108_fall_land_2,
  424.         dx(2), /* ":crouch" */ LABEL(crawl_crouch) frame_109_crouch,
  425.         jmp(crawl_crouch), // goto ":crouch"
  426.  
  427.         LABEL(turndraw) // turn draw
  428.         act(actions_7_turn), SEQ_FLIP, dx(6), frame_45_turn,
  429.         dx(1), frame_46_turn,
  430.         jmp(engarde), // goto "engarde"
  431.  
  432.         LABEL(turn) // turn
  433.         act(actions_7_turn), SEQ_FLIP, dx(6), frame_45_turn,
  434.         dx(1), frame_46_turn,
  435.         dx(2), frame_47_turn,
  436.         dx(-1), /* "finishturn" */ frame_48_turn,
  437.         dx(1), frame_49_turn,
  438.         dx(-2), frame_50_turn,
  439.         frame_51_turn,
  440.         frame_52_turn,
  441.         jmp(stand), // goto "stand"
  442.  
  443.         LABEL(turnrun) // turnrun (from frame 48)
  444.         act(actions_1_run_jump), dx(-1), jmp(runstt1), // goto "runstt1"
  445.  
  446.         LABEL(runturn) // runturn
  447.         act(actions_1_run_jump), dx(1), frame_53_runturn,
  448.         dx(1), snd(SND_FOOTSTEP), frame_54_runturn,
  449.         dx(8) ,frame_55_runturn,
  450.         snd(SND_FOOTSTEP), frame_56_runturn,
  451.         dx(7), frame_57_runturn,
  452.         dx(3), frame_58_runturn,
  453.         dx(1), frame_59_runturn,
  454.         frame_60_runturn,
  455.         dx(2), frame_61_runturn,
  456.         dx(-1), frame_62_runturn,
  457.         frame_63_runturn,
  458.         frame_64_runturn,
  459.         dx(-1), frame_65_runturn,
  460.         dx(-14), SEQ_FLIP, jmp(runcyc7), // goto "runcyc7"
  461.  
  462.         LABEL(fightfall) // fightfall (backward)
  463.         act(actions_3_in_midair), dy(-1), frame_102_start_fall_1,
  464.         dx(-2), dy(6), frame_103_start_fall_2,
  465.         dx(-2), dy(9), frame_104_start_fall_3,
  466.         dx(-1), dy(12), frame_105_start_fall_4,
  467.         dx(-3), set_fall(0, 15), jmp(freefall), // goto "freefall"
  468.  
  469.         LABEL(efightfall) // enemy fight fall
  470.         act(actions_3_in_midair), dy(-1), dx(-2), frame_102_start_fall_1,
  471.         dx(-3), dy(6), frame_103_start_fall_2,
  472.         dx(-3), dy(9), frame_104_start_fall_3,
  473.         dx(-2), dy(12), frame_105_start_fall_4,
  474.         dx(-3), set_fall(0, 15), jmp(freefall), // goto "freefall"
  475.  
  476.         LABEL(efightfallfwd)// enemy fight fall forward
  477.         act(actions_3_in_midair), dx(1), dy(-1), frame_102_start_fall_1,
  478.         dx(2), dy(6), frame_103_start_fall_2,
  479.         dx(-1), dy(9), frame_104_start_fall_3,
  480.         dy(12), frame_105_start_fall_4,
  481.         dx(-2), set_fall(1, 15), jmp(freefall), // goto "freefall"
  482.  
  483.         LABEL(stepfall) // stepfall
  484.         act(actions_3_in_midair), dx(1), dy(3), jmp_if_feather(stepfloat), // goto "stepfloat"
  485.         /* "fall1" */ LABEL(fall1) frame_102_start_fall_1,
  486.         dx(2), dy(6), frame_103_start_fall_2,
  487.         dx(-1), dy(9), frame_104_start_fall_3,
  488.         dy(12), frame_105_start_fall_4,
  489.         dx(-2), set_fall(1, 15), jmp(freefall), // goto "freefall"
  490.  
  491.         LABEL(patchfall) // patchfall
  492.         dx(-1), dy(-3), jmp(fall1), // goto "fall1"
  493.  
  494.         LABEL(stepfall2) // stepfall2 (from frame 12)
  495.         dx(1), jmp(stepfall), // goto "stepfall"
  496.  
  497.         LABEL(stepfloat) // stepfloat
  498.         frame_102_start_fall_1,
  499.         dx(2), dy(3), frame_103_start_fall_2,
  500.         dx(-1), dy(4), frame_104_start_fall_3,
  501.         dy(5), frame_105_start_fall_4,
  502.         dx(-2), set_fall(1, 6), jmp(freefall), // goto "freefall"
  503.  
  504.         LABEL(jumpfall) // jump fall (from standing jump)
  505.         act(actions_3_in_midair), dx(1), dy(3), frame_102_start_fall_1,
  506.         dx(2), dy(6), frame_103_start_fall_2,
  507.         dx(1), dy(9), frame_104_start_fall_3,
  508.         dx(2), dy(12), frame_105_start_fall_4,
  509.         set_fall(2, 15), jmp(freefall), // goto "freefall"
  510.  
  511.         LABEL(rjumpfall) // running jump fall
  512.         act(actions_3_in_midair), dx(1), dy(3), frame_102_start_fall_1,
  513.         dx(3), dy(6), frame_103_start_fall_2,
  514.         dx(2), dy(9), frame_104_start_fall_3,
  515.         dx(3), dy(12), frame_105_start_fall_4,
  516.         set_fall(3, 15), jmp(freefall), // goto "freefall"
  517.  
  518.         LABEL(jumphangMed) // jumphang (medium: DX = 0)
  519.         act(actions_1_run_jump), frame_67_start_jump_up_1,
  520.         frame_68_start_jump_up_2, frame_69_start_jump_up_3, frame_70_jumphang, frame_71_jumphang,
  521.         frame_72_jumphang, frame_73_jumphang, frame_74_jumphang, frame_75_jumphang, frame_76_jumphang,
  522.         frame_77_jumphang,
  523.         act(actions_2_hang_climb), frame_78_jumphang, frame_79_jumphang, frame_80_jumphang,
  524.         jmp(hang), // goto "hang"
  525.  
  526.         LABEL(jumphangLong)// jumphang (long: DX = 4)
  527.         act(actions_1_run_jump), frame_67_start_jump_up_1,
  528.         frame_68_start_jump_up_2, frame_69_start_jump_up_3, frame_70_jumphang, frame_71_jumphang,
  529.         frame_72_jumphang, frame_73_jumphang, frame_74_jumphang, frame_75_jumphang, frame_76_jumphang,
  530.         frame_77_jumphang,
  531.         act(actions_2_hang_climb), dx(1), frame_78_jumphang,
  532.         dx(2), frame_79_jumphang,
  533.         dx(1), frame_80_jumphang,
  534.         jmp(hang), // goto "hang"
  535.  
  536.         LABEL(jumpbackhang) // jumpbackhang
  537.         act(actions_1_run_jump), frame_67_start_jump_up_1,
  538.         frame_68_start_jump_up_2, frame_69_start_jump_up_3, frame_70_jumphang, frame_71_jumphang,
  539.         frame_72_jumphang, frame_73_jumphang, frame_74_jumphang, frame_75_jumphang, frame_76_jumphang,
  540.         dx(-1), frame_77_jumphang,
  541.         act(actions_2_hang_climb), dx(-2), frame_78_jumphang,
  542.         dx(-1), frame_79_jumphang,
  543.         dx(-1), frame_80_jumphang,
  544.         jmp(hang), // goto "hang"
  545.  
  546.         LABEL(hang) // hang
  547.         act(actions_2_hang_climb), frame_91_hanging_5,
  548.         /* "hang1" */ LABEL(hang1) frame_90_hanging_4, frame_89_hanging_3, frame_88_hanging_2,
  549.         frame_87_hanging_1, frame_87_hanging_1, frame_87_hanging_1, frame_88_hanging_2,
  550.         frame_89_hanging_3, frame_90_hanging_4, frame_91_hanging_5, frame_92_hanging_6,
  551.         frame_93_hanging_7, frame_94_hanging_8, frame_95_hanging_9, frame_96_hanging_10,
  552.         frame_97_hanging_11, frame_98_hanging_12, frame_99_hanging_13, frame_97_hanging_11,
  553.         frame_96_hanging_10, frame_95_hanging_9, frame_94_hanging_8, frame_93_hanging_7,
  554.         frame_92_hanging_6, frame_91_hanging_5, frame_90_hanging_4, frame_89_hanging_3,
  555.         frame_88_hanging_2, frame_87_hanging_1, frame_88_hanging_2, frame_89_hanging_3,
  556.         frame_90_hanging_4, frame_91_hanging_5, frame_92_hanging_6, frame_93_hanging_7,
  557.         frame_94_hanging_8, frame_95_hanging_9, frame_96_hanging_10, frame_95_hanging_9,
  558.         frame_94_hanging_8, frame_93_hanging_7, frame_92_hanging_6,
  559.         jmp(hangdrop), // goto "hangdrop"
  560.  
  561.         LABEL(hangstraight) // hangstraight
  562.         act(actions_6_hang_straight), frame_92_hanging_6, // Apple II source has a bump sound here
  563.         frame_93_hanging_7, frame_93_hanging_7, frame_92_hanging_6, frame_92_hanging_6,
  564.         /* ":loop" */ LABEL(hangstraight_loop) frame_91_hanging_5,
  565.         jmp(hangstraight_loop), // goto ":loop"
  566.  
  567.         LABEL(climbfail) // climbfail
  568.         frame_135_climbing_1, frame_136_climbing_2, frame_137_climbing_3, frame_137_climbing_3,
  569.         frame_138_climbing_4, frame_138_climbing_4, frame_138_climbing_4, frame_138_climbing_4,
  570.         frame_137_climbing_3, frame_136_climbing_2, frame_135_climbing_1,
  571.         dx(-7), jmp(hangdrop), // goto "hangdrop"
  572.  
  573.         LABEL(climbdown) // climbdown
  574.         act(actions_1_run_jump), frame_148_climbing_14,
  575.         frame_145_climbing_11, frame_144_climbing_10, frame_143_climbing_9, frame_142_climbing_8,
  576.         frame_141_climbing_7,
  577.         dx(-5), dy(63), SEQ_DOWN, act(actions_3_in_midair), frame_140_climbing_6,
  578.         frame_138_climbing_4, frame_136_climbing_2,
  579.         frame_91_hanging_5,
  580.         act(actions_2_hang_climb), jmp(hang1), // goto "hang1"
  581.  
  582.         LABEL(climbup) // climbup
  583.         act(actions_1_run_jump), frame_135_climbing_1,
  584.         frame_136_climbing_2, frame_137_climbing_3, frame_138_climbing_4,
  585.         frame_139_climbing_5, frame_140_climbing_6,
  586.         dx(5), dy(-63), SEQ_UP, frame_141_climbing_7,
  587.         frame_142_climbing_8, frame_143_climbing_9, frame_144_climbing_10, frame_145_climbing_11,
  588.         frame_146_climbing_12, frame_147_climbing_13, frame_148_climbing_14,
  589.         act(actions_5_bumped), // to clear flags
  590.         frame_149_climbing_15,
  591.         act(actions_1_run_jump), frame_118_stand_up_from_crouch_9, frame_119_stand_up_from_crouch_10,
  592.         dx(1), jmp(stand), // goto "stand"
  593.  
  594.         LABEL(hangdrop) // hangdrop
  595.         frame_81_hangdrop_1, frame_82_hangdrop_2,
  596.         act(actions_5_bumped), frame_83_hangdrop_3,
  597.         act(actions_1_run_jump), SEQ_KNOCK_DOWN, snd(SND_SILENT),
  598.         frame_84_hangdrop_4, frame_85_hangdrop_5,
  599.         dx(3), jmp(stand), // goto "stand"
  600.  
  601.         LABEL(hangfall) // hangfall
  602.         act(actions_3_in_midair), frame_81_hangdrop_1,
  603.         dy(6), frame_81_hangdrop_1,
  604.         dy(9), frame_81_hangdrop_1,
  605.         dy(12), dx(2), set_fall(0, 12), jmp(freefall), // goto "freefall"
  606.  
  607.         LABEL(freefall) // freefall
  608.         act(actions_4_in_freefall), /* ":loop" */ LABEL(freefall_loop) frame_106_fall,
  609.         jmp(freefall_loop), // goto :loop
  610.  
  611.         LABEL(runstop) // runstop
  612.         act(actions_1_run_jump), frame_53_runturn,
  613.         dx(2), snd(SND_FOOTSTEP), frame_54_runturn,
  614.         dx(7), frame_55_runturn,
  615.         snd(SND_FOOTSTEP), frame_56_runturn,
  616.         dx(2), frame_49_turn,
  617.         dx(-2), frame_50_turn,
  618.         frame_51_turn, frame_52_turn,
  619.         jmp(stand), // goto "stand"
  620.  
  621.         LABEL(jumpup) // jump up (and touch ceiling)
  622.         act(actions_1_run_jump), frame_67_start_jump_up_1,
  623.         frame_68_start_jump_up_2, frame_69_start_jump_up_3, frame_70_jumphang, frame_71_jumphang,
  624.         frame_72_jumphang, frame_73_jumphang, frame_74_jumphang, frame_75_jumphang,
  625.         frame_76_jumphang, frame_77_jumphang, frame_78_jumphang,
  626.         act(actions_0_stand), SEQ_KNOCK_UP, frame_79_jumphang,
  627.         jmp(hangdrop), // goto "hangdrop"
  628.  
  629.         LABEL(highjump) // highjump (no ceiling above)
  630.         act(actions_1_run_jump), frame_67_start_jump_up_1,
  631.         frame_68_start_jump_up_2, frame_69_start_jump_up_3, frame_70_jumphang, frame_71_jumphang,
  632.         frame_72_jumphang, frame_73_jumphang, frame_74_jumphang, frame_75_jumphang,
  633.         frame_76_jumphang, frame_77_jumphang, frame_78_jumphang, frame_79_jumphang,
  634.         dy(-4), frame_79_jumphang,
  635.         dy(-2), frame_79_jumphang,
  636.         frame_79_jumphang,
  637.         dy(2), frame_79_jumphang,
  638.         dy(4), jmp(hangdrop), // goto "hangdrop"
  639.  
  640.         LABEL(superhijump) // superhijump (when weightless)
  641.         frame_67_start_jump_up_1, frame_68_start_jump_up_2, frame_69_start_jump_up_3, frame_70_jumphang,
  642.         frame_71_jumphang, frame_72_jumphang, frame_73_jumphang, frame_74_jumphang,
  643.         frame_75_jumphang, frame_76_jumphang,
  644.         dy(-1), frame_77_jumphang,
  645.         dy(-3), frame_78_jumphang,
  646.         dy(-4), frame_79_jumphang,
  647.         dy(-10), frame_79_jumphang,
  648.         dy(-9), frame_79_jumphang,
  649.         dy(-8), frame_79_jumphang,
  650.         dy(-7), frame_79_jumphang,
  651.         dy(-6), frame_79_jumphang,
  652.         dy(-5), frame_79_jumphang,
  653.         dy(-4), frame_79_jumphang,
  654.         dy(-3), frame_79_jumphang,
  655.         dy(-2), frame_79_jumphang,
  656.         dy(-2), frame_79_jumphang,
  657.         dy(-1), frame_79_jumphang,
  658.         dy(-1), frame_79_jumphang,
  659.         dy(-1), frame_79_jumphang,
  660.         frame_79_jumphang, frame_79_jumphang, frame_79_jumphang,
  661.         dy(1), frame_79_jumphang,
  662.         dy(1), frame_79_jumphang,
  663.         dy(2), frame_79_jumphang,
  664.         dy(2), frame_79_jumphang,
  665.         dy(3), frame_79_jumphang,
  666.         dy(4), frame_79_jumphang,
  667.         dy(5), frame_79_jumphang,
  668.         dy(6), frame_79_jumphang,
  669.         set_fall(0, 6), jmp(freefall), // goto "freefall"
  670.  
  671.         LABEL(fallhang) // fall hang
  672.         act(actions_3_in_midair), frame_80_jumphang,
  673.         jmp(hang), // goto "hang"
  674.  
  675.         LABEL(bump) // bump
  676.         act(actions_5_bumped), dx(-4), frame_50_turn,
  677.         frame_51_turn, frame_52_turn,
  678.         jmp(stand), // goto "stand"
  679.  
  680.         LABEL(bumpfall) // bumpfall
  681.         /* action is patched to 3_in_midair by FIX_WALLBUMP_TRIGGERS_TILE_BELOW */
  682.         act(actions_5_bumped), dx(1), dy(3), jmp_if_feather(bumpfloat),
  683.         frame_102_start_fall_1,
  684.         dx(2), dy(6), frame_103_start_fall_2,
  685.         dx(-1), dy(9), frame_104_start_fall_3,
  686.         dy(12), frame_105_start_fall_4,
  687.         dx(-2), set_fall(0, 15), jmp(freefall), // goto "freefall"
  688.  
  689.         LABEL(bumpfloat) // bumpfloat
  690.         frame_102_start_fall_1,
  691.         dx(2), dy(3), frame_103_start_fall_2,
  692.         dx(-1), dy(4), frame_104_start_fall_3,
  693.         dy(5), frame_105_start_fall_4,
  694.         dx(-2), set_fall(0, 6), jmp(freefall), // goto "freefall"
  695.  
  696.         LABEL(hardbump) // hard bump
  697.         act(actions_5_bumped), dx(-1), dy(-4), frame_102_start_fall_1,
  698.         dx(-1), dy(3), dx(-3), dy(1), SEQ_KNOCK_DOWN,
  699.         dx(1), snd(SND_FOOTSTEP), frame_107_fall_land_1,
  700.         dx(2), frame_108_fall_land_2,
  701.         snd(SND_FOOTSTEP), frame_109_crouch,
  702.         jmp(standup), // goto "standup"
  703.  
  704.         LABEL(testfoot) // test foot
  705.         frame_121_stepping_1,
  706.         dx(1), frame_122_stepping_2,
  707.         frame_123_stepping_3,
  708.         dx(2), frame_124_stepping_4,
  709.         dx(4), frame_125_stepping_5,
  710.         dx(3), frame_126_stepping_6,
  711.         dx(-4), frame_86_test_foot,
  712.         snd(SND_FOOTSTEP), SEQ_KNOCK_DOWN, dx(-4), frame_116_stand_up_from_crouch_7,
  713.         dx(-2), frame_117_stand_up_from_crouch_8,
  714.         frame_118_stand_up_from_crouch_9,
  715.         frame_119_stand_up_from_crouch_10,
  716.         jmp(stand), // goto "stand"
  717.  
  718.         LABEL(stepback) // step back
  719.         dx(-5), jmp(stand), // goto "stand"
  720.  
  721.         LABEL(step14) // step forward 14 pixels
  722.         act(actions_1_run_jump), frame_121_stepping_1,
  723.         dx(1), frame_122_stepping_2,
  724.         dx(1), frame_123_stepping_3,
  725.         dx(3), frame_124_stepping_4,
  726.         dx(4), frame_125_stepping_5,
  727.         dx(3), frame_126_stepping_6,
  728.         dx(-1), dx(3), frame_127_stepping_7,
  729.         frame_128_stepping_8, frame_129_stepping_9, frame_130_stepping_10,
  730.         frame_131_stepping_11, frame_132_stepping_12,
  731.         jmp(stand), // goto "stand"
  732.  
  733.         LABEL(step13) // step forward 13 pixels
  734.         act(actions_1_run_jump), frame_121_stepping_1,
  735.         dx(1), frame_122_stepping_2,
  736.         dx(1), frame_123_stepping_3,
  737.         dx(3), frame_124_stepping_4,
  738.         dx(4), frame_125_stepping_5,
  739.         dx(3), frame_126_stepping_6,
  740.         dx(-1), dx(2), frame_127_stepping_7,
  741.         frame_128_stepping_8, frame_129_stepping_9, frame_130_stepping_10,
  742.         frame_131_stepping_11, frame_132_stepping_12,
  743.         jmp(stand), // goto "stand"
  744.  
  745.         LABEL(step12) // step forward 12 pixels
  746.         act(actions_1_run_jump), frame_121_stepping_1,
  747.         dx(1), frame_122_stepping_2,
  748.         dx(1), frame_123_stepping_3,
  749.         dx(3), frame_124_stepping_4,
  750.         dx(4), frame_125_stepping_5,
  751.         dx(3), frame_126_stepping_6,
  752.         dx(-1), dx(1), frame_127_stepping_7,
  753.         frame_128_stepping_8, frame_129_stepping_9, frame_130_stepping_10,
  754.         frame_131_stepping_11, frame_132_stepping_12,
  755.         jmp(stand), // goto "stand"
  756.  
  757.         LABEL(step11) // step forward 11 pixels (normal step)
  758.         act(actions_1_run_jump), frame_121_stepping_1,
  759.         dx(1), frame_122_stepping_2,
  760.         dx(1), frame_123_stepping_3,
  761.         dx(3), frame_124_stepping_4,
  762.         dx(4), frame_125_stepping_5,
  763.         dx(3), frame_126_stepping_6,
  764.         dx(-1), frame_127_stepping_7,
  765.         frame_128_stepping_8, frame_129_stepping_9, frame_130_stepping_10,
  766.         frame_131_stepping_11, frame_132_stepping_12,
  767.         jmp(stand), // goto "stand"
  768.  
  769.         LABEL(step10) // step forward 10 pixels
  770.         act(actions_1_run_jump), frame_121_stepping_1,
  771.         dx(1), /* "step10a "*/ LABEL(step10a) frame_122_stepping_2,
  772.         dx(1), frame_123_stepping_3,
  773.         dx(3), frame_124_stepping_4,
  774.         dx(4), frame_125_stepping_5,
  775.         dx(3), frame_126_stepping_6,
  776.         dx(-)2, frame_128_stepping_8,
  777.         frame_129_stepping_9, frame_130_stepping_10, frame_131_stepping_11, frame_132_stepping_12,
  778.         jmp(stand), // goto "stand"
  779.  
  780.         LABEL(step9) // step forward 9 pixels
  781.         act(actions_1_run_jump), frame_121_stepping_1,
  782.         jmp(step10a), // goto "step10a"
  783.  
  784.         LABEL(step8) // step forward 8 pixels
  785.         act(actions_1_run_jump), frame_121_stepping_1,
  786.         dx(1), frame_122_stepping_2,
  787.         dx(1), frame_123_stepping_3,
  788.         dx(3), frame_124_stepping_4,
  789.         dx(4), frame_125_stepping_5,
  790.         dx(-1), frame_127_stepping_7,
  791.         frame_128_stepping_8, frame_129_stepping_9, frame_130_stepping_10, frame_131_stepping_11,
  792.         frame_132_stepping_12,
  793.         jmp(stand), // goto "stand"
  794.  
  795.         LABEL(step7) // step forward 7 pixels
  796.         act(actions_1_run_jump), frame_121_stepping_1,
  797.         dx(1), frame_122_stepping_2,
  798.         dx(1), frame_123_stepping_3,
  799.         dx(3), frame_124_stepping_4,
  800.         dx(2), frame_129_stepping_9,
  801.         frame_130_stepping_10, frame_131_stepping_11, frame_132_stepping_12,
  802.         jmp(stand), // goto "stand"
  803.  
  804.         LABEL(step6) // step forward 6 pixels
  805.         act(actions_1_run_jump), frame_121_stepping_1,
  806.         dx(1), frame_122_stepping_2,
  807.         dx(1), frame_123_stepping_3,
  808.         dx(2), frame_124_stepping_4,
  809.         dx(2), frame_129_stepping_9,
  810.         frame_130_stepping_10, frame_131_stepping_11, frame_132_stepping_12,
  811.         jmp(stand), // goto "stand"
  812.  
  813.         LABEL(step5) // step forward 5 pixels
  814.         act(actions_1_run_jump), frame_121_stepping_1,
  815.         dx(1), frame_122_stepping_2,
  816.         dx(1), frame_123_stepping_3,
  817.         dx(2), frame_124_stepping_4,
  818.         dx(1), frame_129_stepping_9,
  819.         frame_130_stepping_10, frame_131_stepping_11, frame_132_stepping_12,
  820.         jmp(stand), // goto "stand"
  821.  
  822.         LABEL(step4) // step forward 4 pixels
  823.         act(actions_1_run_jump), frame_121_stepping_1,
  824.         dx(1), frame_122_stepping_2,
  825.         dx(1), frame_123_stepping_3,
  826.         dx(2), frame_131_stepping_11,
  827.         frame_132_stepping_12,
  828.         jmp(stand), // goto "stand"
  829.  
  830.         LABEL(step3) // step forward 3 pixels
  831.         act(actions_1_run_jump), frame_121_stepping_1,
  832.         dx(1), frame_122_stepping_2,
  833.         dx(1), frame_123_stepping_3,
  834.         dx(1), frame_131_stepping_11,
  835.         frame_132_stepping_12,
  836.         jmp(stand), // goto "stand"
  837.  
  838.         LABEL(step2) // step forward 2 pixels
  839.         act(actions_1_run_jump), frame_121_stepping_1,
  840.         dx(1), frame_122_stepping_2,
  841.         dx(1), frame_132_stepping_12,
  842.         jmp(stand), // goto "stand"
  843.  
  844.         LABEL(step1) // step forward 1 pixel
  845.         act(actions_1_run_jump), frame_121_stepping_1,
  846.         dx(1), frame_132_stepping_12,
  847.         jmp(stand), // goto "stand"
  848.  
  849.         LABEL(stoop) // stoop
  850.         act(actions_1_run_jump), dx(1), frame_107_fall_land_1,
  851.         dx(2), frame_108_fall_land_2,
  852.         /* ":crouch" */ LABEL(stoop_crouch) frame_109_crouch,
  853.         jmp(stoop_crouch), // goto ":crouch
  854.  
  855.         LABEL(standup) // stand up
  856.         act(actions_5_bumped), dx(1), frame_110_stand_up_from_crouch_1,
  857.         frame_111_stand_up_from_crouch_2,
  858.         dx(2), frame_112_stand_up_from_crouch_3,
  859.         frame_113_stand_up_from_crouch_4,
  860.         dx(1 /*patched to 0 by FIX_STAND_ON_THIN_AIR*/), frame_114_stand_up_from_crouch_5,
  861.         frame_115_stand_up_from_crouch_6, frame_116_stand_up_from_crouch_7,
  862.         dx(-4 /*patched to -3 by FIX_STAND_ON_THIN_AIR*/), frame_117_stand_up_from_crouch_8,
  863.         frame_118_stand_up_from_crouch_9, frame_119_stand_up_from_crouch_10,
  864.         jmp(stand), // goto "stand"
  865.  
  866.         LABEL(pickupsword) // pick up sword
  867.         act(actions_1_run_jump), SEQ_GET_ITEM, 1, frame_229_found_sword,
  868.         frame_229_found_sword, frame_229_found_sword, frame_229_found_sword, frame_229_found_sword,
  869.         frame_229_found_sword, frame_230_sheathe, frame_231_sheathe, frame_232_sheathe,
  870.         jmp(resheathe), // goto "resheathe"
  871.  
  872.         LABEL(resheathe) // resheathe
  873.         act(actions_1_run_jump), dx(-5), frame_233_sheathe,
  874.         frame_234_sheathe, frame_235_sheathe, frame_236_sheathe, frame_237_sheathe,
  875.         frame_238_sheathe, frame_239_sheathe, frame_240_sheathe, frame_133_sheathe,
  876.         frame_133_sheathe, frame_134_sheathe, frame_134_sheathe, frame_134_sheathe,
  877.         frame_48_turn,
  878.         dx(1), frame_49_turn,
  879.         dx(-2), act(actions_5_bumped), frame_50_turn,
  880.         act(actions_1_run_jump), frame_51_turn,
  881.         frame_52_turn,
  882.         jmp(stand), // goto "stand"
  883.  
  884.         LABEL(fastsheathe) // fast sheathe
  885.         act(actions_1_run_jump), dx(-5), frame_234_sheathe,
  886.         frame_236_sheathe, frame_238_sheathe, frame_240_sheathe, frame_134_sheathe,
  887.         dx(-1), jmp(stand), // goto "stand"
  888.  
  889.         LABEL(drinkpotion) // drink potion
  890.         act(actions_1_run_jump), dx(4), frame_191_drink,
  891.         frame_192_drink, frame_193_drink, frame_194_drink, frame_195_drink,
  892.         frame_196_drink, frame_197_drink, snd(SND_DRINK),
  893.         frame_198_drink, frame_199_drink, frame_200_drink, frame_201_drink,
  894.         frame_202_drink, frame_203_drink, frame_204_drink, frame_205_drink,
  895.         frame_205_drink, frame_205_drink,
  896.         SEQ_GET_ITEM, 1, frame_205_drink,
  897.         frame_205_drink, frame_201_drink, frame_198_drink,
  898.         dx(-4), jmp(stand), // goto "stand"
  899.  
  900.         LABEL(softland)// soft land
  901.         act(actions_5_bumped), SEQ_KNOCK_DOWN, dx(1), frame_107_fall_land_1,
  902.         dx(2), frame_108_fall_land_2,
  903.         act(actions_1_run_jump), /* ":crouch" */ LABEL(softland_crouch) frame_109_crouch,
  904.         jmp(softland_crouch), // goto ":crouch"
  905.  
  906.         LABEL(landrun) // land run
  907.         act(actions_1_run_jump), dy(-2), dx(1), frame_107_fall_land_1,
  908.         dx(2), frame_108_fall_land_2,
  909.         frame_109_crouch,
  910.         dx(1), frame_110_stand_up_from_crouch_1,
  911.         frame_111_stand_up_from_crouch_2,
  912.         dx(2), frame_112_stand_up_from_crouch_3,
  913.         frame_113_stand_up_from_crouch_4,
  914.         dx(1), dy(1), frame_114_stand_up_from_crouch_5,
  915.         dy(1), frame_115_stand_up_from_crouch_6,
  916.         dx(-2), jmp(runstt4), // goto "runstt4"
  917.  
  918.         LABEL(medland) // medium land (1.5 - 2 stories)
  919.         act(actions_5_bumped), SEQ_KNOCK_DOWN, dy(-2), dx(1), dx(2), frame_108_fall_land_2,
  920.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  921.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  922.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  923.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  924.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  925.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  926.         frame_109_crouch, frame_109_crouch, frame_109_crouch, frame_109_crouch,
  927.         frame_109_crouch,
  928.         dx(1), frame_110_stand_up_from_crouch_1,
  929.         frame_110_stand_up_from_crouch_1, frame_110_stand_up_from_crouch_1, frame_111_stand_up_from_crouch_2,
  930.         dx(2), frame_112_stand_up_from_crouch_3,
  931.         frame_113_stand_up_from_crouch_4,
  932.         dx(1), dy(1), frame_114_stand_up_from_crouch_5,
  933.         dy(1), frame_115_stand_up_from_crouch_6,
  934.         frame_116_stand_up_from_crouch_7,
  935.         dx(-4), frame_117_stand_up_from_crouch_8,
  936.         frame_118_stand_up_from_crouch_9, frame_119_stand_up_from_crouch_10,
  937.         jmp(stand), // goto "stand"
  938.  
  939.         LABEL(hardland) // hard land (splat!; >2 stories)
  940.         act(actions_5_bumped), SEQ_KNOCK_DOWN, dy(-2), dx(3), frame_185_dead,
  941.         SEQ_DIE, /* ":dead" */ LABEL(hardland_dead) frame_185_dead,
  942.         jmp(hardland_dead), // goto ":dead"
  943.  
  944.         LABEL(stabkill) // stabkill
  945.         act(actions_5_bumped), jmp(dropdead), // goto "dropdead"
  946.  
  947.         LABEL(dropdead) // dropdead
  948.         act(actions_1_run_jump), SEQ_DIE, frame_179_collapse_1,
  949.         frame_180_collapse_2, frame_181_collapse_3, frame_182_collapse_4,
  950.         dx(1), frame_183_collapse_5,
  951.         dx(-4), /* ":dead" */ LABEL(dropdead_dead) frame_185_dead,
  952.         jmp(dropdead_dead), // goto ":dead"
  953.  
  954.         LABEL(impale) // impale
  955.         act(actions_1_run_jump), SEQ_KNOCK_DOWN, dx(4), frame_177_spiked,
  956.         SEQ_DIE, /* ":dead" */ LABEL(impale_dead) frame_177_spiked,
  957.         jmp(impale_dead), // goto ":dead"
  958.  
  959.         LABEL(halve) // halve
  960.         act(actions_1_run_jump), frame_178_chomped,
  961.         SEQ_DIE, /* ":dead" */ LABEL(halve_dead) frame_178_chomped,
  962.         jmp(halve_dead), // goto ":dead"
  963.  
  964.         LABEL(crush) // crush
  965.         jmp(medland), // goto "medland"
  966.  
  967.         LABEL(deadfall) // deadfall
  968.         set_fall(0, 0), act(actions_4_in_freefall), /* ":loop"*/ LABEL(deadfall_loop) frame_185_dead,
  969.         jmp(deadfall_loop), // goto ":loop"
  970.  
  971.         LABEL(climbstairs) // climb stairs
  972.         act(actions_5_bumped),
  973.         dx(-5), dy(-1), snd(SND_FOOTSTEP), frame_217_exit_stairs_1,
  974.         frame_218_exit_stairs_2, frame_219_exit_stairs_3,
  975.         dx(1), frame_220_exit_stairs_4,
  976.         dx(-4), dy(-3), snd(SND_FOOTSTEP), frame_221_exit_stairs_5,
  977.         dx(-4), dy(-2), frame_222_exit_stairs_6,
  978.         dx(-2), dy(-3), frame_223_exit_stairs_7,
  979.         dx(-3), dy(-8), snd(SND_LEVEL), snd(SND_FOOTSTEP), frame_224_exit_stairs_8,
  980.         dx(-1), dy(-1), frame_225_exit_stairs_9,
  981.         dx(-3), dy(-4), frame_226_exit_stairs_10,
  982.         dx(-1), dy(-5), snd(SND_FOOTSTEP), frame_227_exit_stairs_11,
  983.         dx(-2), dy(-1), frame_228_exit_stairs_12,
  984.         frame_0,
  985.         snd(SND_FOOTSTEP), frame_0, frame_0, frame_0, // these footsteps are only heard when the music is off
  986.         snd(SND_FOOTSTEP), frame_0, frame_0, frame_0,
  987.         snd(SND_FOOTSTEP), frame_0, frame_0, frame_0,
  988.         snd(SND_FOOTSTEP), SEQ_END_LEVEL, /* ":loop" */ LABEL(climbstairs_loop) frame_0,
  989.         jmp(climbstairs_loop), // goto ":loop"
  990.  
  991.         LABEL(Vstand) // Vizier: stand
  992.         alt2frame_54_Vstand,
  993.         jmp(Vstand), // goto "Vstand"
  994.  
  995.         LABEL(Vraise) // Vizier: raise arms
  996.         85, 67, 67, 67, // numbers refer to frames in the "alternate" frame sets
  997.         67, 67, 67, 67,
  998.         67, 67, 67, 68,
  999.         69, 70, 71, 72,
  1000.         73, 74, 75, 83,
  1001.         84, /* ":loop" */ LABEL(Vraise_loop) 76,
  1002.         jmp(Vraise_loop), // goto ":loop"
  1003.  
  1004.         LABEL(Vwalk) // Vizier: walk
  1005.         dx(1), /* "Vwalk1" */ LABEL(Vwalk1) 48,
  1006.         dx(2), /* "Vwalk2" */ LABEL(Vwalk2) 49,
  1007.         dx(6), 50,
  1008.         dx(1), 51,
  1009.         dx(-1), 52,
  1010.         dx(1), 53,
  1011.         dx(1), jmp(Vwalk1), // goto "Vwalk1"
  1012.  
  1013.         LABEL(Vstop) // Vizier: stop
  1014.         dx(1), 55,
  1015.         56,
  1016.         jmp(Vstand),
  1017.  
  1018.         LABEL(Vexit) // Vizier: lower arms, turn & exit ("Vexit")
  1019.         77, 78, 79, 80,
  1020.         81, 82,
  1021.         dx(1), 54,
  1022.         54, 54, 54, 54,
  1023.         54, 57, 58, 59,
  1024.         60, 61,
  1025.         dx(2), 62,
  1026.         dx(-1), 63,
  1027.         dx(-3), 64,
  1028.         65,
  1029.         dx(-1), 66,
  1030.         SEQ_FLIP, dx(16), dx(3), jmp(Vwalk2), // goto "Vwalk2"
  1031.  
  1032.         // Princess: stand
  1033.         LABEL(Pstand) 11,
  1034.         jmp(Pstand), // goto "Pstand"
  1035.  
  1036.         LABEL(Palert) // Princess: alert
  1037.         2, 3, 4, 5,
  1038.         6, 7, 8, 9,
  1039.         SEQ_FLIP, dx(8), 11,
  1040.         jmp(Pstand),
  1041.  
  1042.         LABEL(Pstepback) // Princess: step back
  1043.         SEQ_FLIP, dx(11), 12,
  1044.         dx(1), 13,
  1045.         dx(1), 14,
  1046.         dx(3), 15,
  1047.         dx(1), 16,
  1048.         /* ":loop" */ LABEL(Pstepback_loop) 17,
  1049.         jmp(Pstepback_loop), // goto ":loop"
  1050.  
  1051.         LABEL(Plie) // Princess lying on cushions ("Plie")
  1052.         19,
  1053.         jmp(Plie), // goto "Plie"
  1054.  
  1055.         LABEL(Pwaiting) // Princess: waiting
  1056.         /* ":loop" */ 20,
  1057.         jmp(Pwaiting), // goto ":loop"
  1058.  
  1059.         LABEL(Pembrace)// Princess: embrace
  1060.         21,
  1061.         dx(1), 22,
  1062.         23, 24,
  1063.         dx(1), 25,
  1064.         dx(-3), 26,
  1065.         dx(-2), 27,
  1066.         dx(-4), 28,
  1067.         dx(-3), 29,
  1068.         dx(-2), 30,
  1069.         dx(-3), 31,
  1070.         dx(-1), 32,
  1071.         /* ":loop" */ LABEL(Pembrace_loop) 33,
  1072.         jmp(Pembrace_loop), // goto ":loop"
  1073.  
  1074.         LABEL(Pstroke) // Princess: stroke mouse
  1075.         /* ":loop" */ 37,
  1076.         jmp(Pstroke), // goto ":loop"
  1077.  
  1078.         LABEL(Prise) // Princess: rise
  1079.         37, 38, 39, 40,
  1080.         41, 42, 43, 44,
  1081.         45, 46, 47,
  1082.         SEQ_FLIP, dx(12), /* ":loop" */ LABEL(Prise_loop) 11,
  1083.         jmp(Prise_loop), // goto ":loop"
  1084.  
  1085.         LABEL(Pcrouch) // Princess: crouch & stroke mouse
  1086.         11, 11,
  1087.         SEQ_FLIP, dx(13), 47,
  1088.         46, 45, 44, 43,
  1089.         42, 41, 40, 39,
  1090.         38, 37,
  1091.         36, 36, 36,
  1092.         35, 35, 35,
  1093.         34, 34, 34, 34, 34, 34, 34,
  1094.         35, 35,
  1095.         36, 36, 36,
  1096.         35, 35, 35,
  1097.         34, 34, 34, 34, 34, 34, 34,
  1098.         35, 35,
  1099.         36, 36, 36,
  1100.         35, 35, 35,
  1101.         34, 34, 34, 34, 34, 34, 34, 34, 34,
  1102.         35, 35, 35,
  1103.         /* ":loop" */ LABEL(Pcrouch_loop) 36,
  1104.         jmp(Pcrouch_loop), // goto ":loop"
  1105.  
  1106.         LABEL(Pslump) // Princess: slump shoulders
  1107.         1, /* ":loop" */ LABEL(Pslump_loop) 18,
  1108.         jmp(Pslump_loop), // goto ":loop"
  1109.  
  1110.         LABEL(Mscurry) // Mouse: scurry
  1111.         act(actions_1_run_jump), /* "Mscurry1" */ LABEL(Mscurry1) frame_186_mouse_1,
  1112.         dx(5), frame_186_mouse_1,
  1113.         dx(3), frame_187_mouse_2,
  1114.         dx(4), jmp(Mscurry1), // goto "Mscurry1"
  1115.  
  1116.         LABEL(Mstop) // Mouse: stop
  1117.         /* ":loop" */ frame_186_mouse_1,
  1118.         jmp(Mstop), // goto ":loop"
  1119.  
  1120.         LABEL(Mraise) // Mouse: raise head
  1121.         /* ":loop" */ frame_188_mouse_stand,
  1122.         jmp(Mraise), // goto ":loop"
  1123.  
  1124.         LABEL(Mleave) // Mouse: leave
  1125.         act(actions_0_stand), frame_186_mouse_1,
  1126.         frame_186_mouse_1, frame_186_mouse_1, frame_188_mouse_stand, frame_188_mouse_stand,
  1127.         frame_188_mouse_stand, frame_188_mouse_stand, frame_188_mouse_stand, frame_188_mouse_stand,
  1128.         frame_188_mouse_stand, frame_188_mouse_stand,
  1129.         SEQ_FLIP, dx(8), jmp(Mscurry1), // goto "Mscurry1"
  1130.  
  1131.         LABEL(Mclimb) // Mouse: climb
  1132.         frame_186_mouse_1, frame_186_mouse_1, /* ":loop" */ LABEL(Mclimb_loop) frame_188_mouse_stand,
  1133.         jmp(Mclimb_loop) // goto ":loop"
  1134.  
  1135. };
  1136.  
  1137. void apply_seqtbl_patches() {
  1138. #ifdef FIX_WALL_BUMP_TRIGGERS_TILE_BELOW
  1139.         if (fix_wall_bump_triggers_tile_below)
  1140.                 SEQTBL_0[bumpfall + 1] = actions_3_in_midair; // instead of actions_5_bumped
  1141. #endif
  1142. }
  1143.  
  1144. #ifdef CHECK_SEQTABLE_MATCHES_ORIGINAL
  1145.  
  1146. // unmodified original sequence table"Checking that the sequence table matches the original DOS version...\n");
  1147.         int different = 0;
  1148.         int i;
  1149.         const byte* seq = seqtbl;
  1150.         const byte* original_seq = original_seqtbl;
  1151.         for(i = 0; i < COUNT(original_seqtbl); ++i) {
  1152.                 if (seq[i] != original_seq[i]) {
  1153.                         different = 1;
  1154.                         printf("Seqtbl difference at index %d (%#x; shifted offset %#x): value is %d, should be %d\n"
  1155.                                 , i, i, i + SEQTBL_BASE, seqtbl[i], original_seqtbl[i]);
  1156.                 }
  1157.         }
  1158.         for(i = 0; i < COUNT(original_seqtbl_offsets); ++i) {
  1159.                 if (seqtbl_offsets[i] != original_seqtbl_offsets[i]) {
  1160.                         different = 1;
  1161.                         printf("Seqtbl offset difference at index %d: value is %#x, should be %#x\n"
  1162.                                 , i, seqtbl_offsets[i], original_seqtbl_offsets[i]);
  1163.                 }
  1164.         }
  1165.         if (!different) printf("All good, no differences found!\n");
  1166. }
  1167.  
  1168. #endif // CHECK_SEQTABLE_MATCHES_ORIGINAL
  1169.