NCHEFHIT.S 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ; CHEFHIT.S
  2. ; THIS ROUTINE TESTS TO SEE IF CHUCK HAS DIED DUE TO HITTING A CHEF.
  3. GLBL HEROKILL
  4. GLBL MKDIE
  5. GLBL MKAREJOY
  6. GLBL CHEFHIT
  7. GLBL SCRAPALL,TUNIN
  8. GLBL FALLING,DYHERO,DXHERO,CHEFSTRT
  9. GLBL STATDIE,AFDERASE,NULLCHAR
  10. GLBL CSTAMP,CCRUNL,CINFO
  11. GLBL PL0LIVES
  12. GLBL IRCHTIME,IRDXHERO,IRDYHERO
  13. GLBL HELDFOOD,CARRYING
  14. GLBL HYCENTER,DYHCHAR
  15. DXHCHEF EQU $02
  16. DYHCHEF EQU $06
  17. DRIPSTRT EQU $1F
  18. RAMDEF ; ZERO PAGE
  19. RSEG CODE2
  20. PRINT GEN
  21. CHEFHIT
  22. LDX #12 ; #CHEFSTRT + #NUMCHEFS - 3
  23. LDY #3 ; INDEX TO CENTER AND DELTA TABLES
  24. LDA CSTATE If the hero is falling, no
  25. CMP #FALLING intersection with chefs
  26. BMI ZCHEFH0
  27. RTS
  28. ZCHEFH0 LDA CSTATE,X ; CHEF'S STATE
  29. CMP #FALLING ; IF RISING OR FALLING, IGNORE
  30. BPL NXTCHTST
  31. LDA #0 ; TELLS ME THIS IS THE NEARNESS TEST
  32. STA TEMP2
  33. AAAA LDA #IRDXHERO ; NEARNESS TEST FIRST
  34. STA TEMP0
  35. LDA #IRDYHERO
  36. STA TEMP1
  37. JMP IRLOOP2
  38. IRLOOP1 LDA #DXHERO+DXHCHEF ; COME HERE IF NEARNESS TEST IS
  39. STA TEMP0 ; SUCCESSFUL-- TEST FOR REAL
  40. LDA DYHCHAR,Y
  41. STA TEMP1
  42. IRLOOP2 LDA CYPOS,X ; TEST Y COORD.
  43. BEQ NXTCHTST ; IF HE'S NOT ON SCREEN
  44. SEC
  45. SBC CYPOS ; HERO'S Y
  46. SEC
  47. SBC HYCENTER,Y ; CHEFS ARE SHORTER- ADD TO NORMALIZE
  48. BPL CHHYPOS ; Y DIFF POSITIVE
  49. EOR #$FF ; ELSE, 2'S COMPLEMENT
  50. CLC
  51. ADC #1
  52. CHHYPOS CMP TEMP1 ; IR CLOSENESS OR CHEF
  53. BMI CHXTST ; TEST X DIFFERENCE
  54. JMP NXTCHTST ; ELSE, GO ON TO NEXT CHEF
  55. CHXTST LDA CXPOS,X
  56. SEC
  57. SBC CXPOS ; HERO'S X
  58. BPL CHHXPOS ; POSITIVE X DIFFERENCE
  59. EOR #$FF ; ELSE, 2'S COMPLEMENT
  60. CLC
  61. ADC #1
  62. CHHXPOS CMP TEMP0
  63. BMI CHNEAR
  64. JMP NXTCHTST
  65. CHNEAR LDA TEMP2
  66. BNE CHKILL
  67. INC IRCHTIME
  68. INC TEMP2
  69. JMP IRLOOP1
  70. CHKILL JSR HEROKILL
  71. JMP CHHITBYE
  72. NXTCHTST DEX
  73. DEX
  74. DEX
  75. DEY ; DELTA TABLE INDEX
  76. BPL ZCHEFH0
  77. CHHITBYE RTS
  78. *************** END OF CHEFHIT ROUTINE ************************
  79. ; THIS ROUTINE IS CALLED FROM "CHEFHIT", "HOLEHIT", AND "FOODHIT"
  80. ; IF THE HERO IS KILLED BY ONE OF THESE THINGS.
  81. ; IT SETS THE HERO APPROPRIATELY AND DOES SUITABLE ANIMATIONS.
  82. HEROKILL LDA #STATDIE
  83. STA STATUS
  84. JSR SCRAPALL
  85. LDA CXPOS ; USED BY "FOODMOVE" TO GO FOR CHUCK
  86. STA GOALX
  87. LDA CYPOS
  88. STA GOALY
  89. LDA CYCLECNT
  90. CLC
  91. ADC #02
  92. STA CINFO ; ANIMATE TIMER
  93. LDA #70
  94. STA SYSCOUNT
  95. JSR MKDIE ; HANDLE DEATH STUFF
  96. LDX CURRENT
  97. LDA PL0LIVES,X
  98. CMP #1
  99. BEQ ZHKLASTS ; LAST DEATH THIS GAME
  100. LDA #1
  101. JSR TUNIN
  102. LDA #2
  103. JMP TUNIN jsr followed by rts
  104. ZHKLASTS LDA #10
  105. JSR TUNIN
  106. LDA #11
  107. JMP TUNIN jsr followed by rts
  108. ; THIS ROUTINE IS CALLED FROM "MKHFALL" AND "HEROKILL"
  109. MKDIE
  110. LDA #1
  111. STA MAXCYCLE
  112. LDA #0 ; MAKE CONE DRIP GO AWAY
  113. STA CYPOS+DRIPSTRT
  114. LDA CSTATE
  115. CMP #CARRYING
  116. BNE MKSKIP
  117. LDA #0
  118. STA CYPOS+2
  119. LDX HELDFOOD
  120. STA CYPOS,X
  121. MKSKIP
  122. LDA CCRUNL ; GIVE CHUCK A BODY
  123. STA CSTAMP+1
  124. ; FOR FINAL VERSION, MOVE "MKAREJOY" INTO THIS ROUTINE--
  125. JSR MKAREJOY ; IN "HOLEHIT.S"
  126. RTS
  127. END