Routines |
Prev: E11F | Up: Map | Next: E22D |
Used by the routine at Handler_Animals.
|
||||
*PlayerBooty starts at 0000 and counts up for every item of booty collected. This means that, the chance that animals appear increases when the player has collected over 100 items (of booty, not treasure - which counts down from 007D).
|
||||
AnimalsEventTiming | E12A | LD BC,($5BF4) | If the player has collected over 100 items of booty (in *PlayerBooty) then jump to IncreasedFrequencyAnimalsEventTiming. | |
E12E | LD A,C | |||
E12F | CP $64 | |||
E131 | JR NC,IncreasedFrequencyAnimalsEventTiming | |||
E133 | LD HL,($5C78) | Return if *FRAMES is lower than 0578. | ||
E136 | LD DE,$0578 | |||
E139 | SBC HL,DE | |||
E13B | RET C | |||
Use FRAMES as a counter.
|
||||
StartAnimalsEvent | E13C | LD HL,$0000 | Reset *FRAMES to 0000 to start a new event cycle. | |
E13F | LD ($5C78),HL | |||
E142 | CALL GetRandomNumber | Call GetRandomNumber. | ||
E145 | AND %00000011 | Ensure the random number is between 00 and 03. | ||
E147 | LD HL,$F317 | HL=F317+the random number. | ||
E14A | LD E,A | |||
E14B | LD D,$00 | |||
E14D | ADD HL,DE | |||
E14E | PUSH HL | Stash HL on the stack. | ||
E14F | INC HL | Increment HL by one. | ||
E150 | LD A,(HL) | A=*HL. | ||
E151 | LD IX,($5BDA) | IX=*ReferenceKeysAndLockedDoors. | ||
E155 | LD B,A | B=A. | ||
AnimalsEventTiming_0 | E156 | LD A,(IX+$00) | Jump to AnimalsEventTiming_2 if *IX+00 is equal to FF. | |
E159 | CP $FF | |||
E15B | JR Z,AnimalsEventTiming_2 | |||
E15D | LD A,(IX+$01) | Jump to AnimalsEventTiming_1 if *IX+01 is not equal to B. | ||
E160 | CP B | |||
E161 | JR NZ,AnimalsEventTiming_1 | |||
E163 | LD A,(IX+$05) | Jump to E118 if *IX+05 is not equal to 00. | ||
E166 | CP $00 | |||
E168 | JP NZ,$E118 | |||
AnimalsEventTiming_1 | E16B | LD DE,$0006 | IX+=0006. | |
E16E | ADD IX,DE | |||
E170 | JR AnimalsEventTiming_0 | Jump to AnimalsEventTiming_0. | ||
AnimalsEventTiming_2 | E172 | LD IX,$F31C | IX=F31C. | |
E176 | CALL GetRandomNumber | Call GetRandomNumber. | ||
E179 | BIT 3,A | Test bit 3 of A. | ||
E17B | JR Z,AnimalsEventTiming_3 | Jump to AnimalsEventTiming_3 if {} is zero. | ||
E17D | LD (IX+$00),$02 | Write 02 to *IX+00. | ||
E181 | LD (IX+$02),$01 | Write 01 to *IX+02. | ||
E185 | LD (IX+$04),$01 | Write 01 to *IX+04. | ||
E189 | LD (IX+$05),$00 | Write 00 to *IX+05. | ||
E18D | LD (IX+$0B),$01 | Write 01 to *IX+0B. | ||
E191 | LD (IX+$0D),$02 | Write 02 to *IX+0D. | ||
E195 | JR AnimalsEventTiming_4 | Jump to AnimalsEventTiming_4. | ||
AnimalsEventTiming_3 | E197 | LD (IX+$00),$25 | Write 25 to *IX+00. | |
E19B | LD (IX+$02),$00 | Write 00 to *IX+02. | ||
E19F | LD (IX+$04),$FF | Write FF to *IX+04. | ||
E1A3 | LD (IX+$05),$00 | Write 00 to *IX+05. | ||
E1A7 | LD (IX+$0B),$00 | Write 00 to *IX+0B. | ||
E1AB | LD (IX+$0D),$24 | Write 24 to *IX+0D. | ||
AnimalsEventTiming_4 | E1AF | CALL GetRandomNumber | Call GetRandomNumber. | |
E1B2 | BIT 5,A | Test bit 5 of A. | ||
E1B4 | JR Z,AnimalsEventTiming_6 | Jump to AnimalsEventTiming_6 if {} is zero. | ||
E1B6 | POP HL | Restore HL from the stack. | ||
E1B7 | PUSH HL | Stash HL on the stack. | ||
E1B8 | LD A,(HL) | Set up the screen buffer location 21/*HL using CL_SET. | ||
E1B9 | LD B,A | |||
E1BA | LD C,$21 | |||
E1BC | CALL $0DD9 | |||
E1BF | LD HL,($5C84) | HL=*DF_CC. | ||
E1C2 | LD B,$20 | B=20. | ||
AnimalsEventTiming_5 | E1C4 | LD A,(HL) | A=*HL. | |
E1C5 | INC HL | Increment HL by one. | ||
E1C6 | CP $FF | Jump to E118 if A is not equal to FF. | ||
E1C8 | JP NZ,$E118 | |||
E1CB | DJNZ AnimalsEventTiming_5 | Decrease counter by one and loop back to AnimalsEventTiming_5 until counter is zero. | ||
E1CD | POP HL | Restore HL from the stack. | ||
E1CE | LD A,(HL) | A=*HL. | ||
E1CF | INC A | Increment A by one. | ||
E1D0 | LD (IX+$01),A | Write A to *IX+01. | ||
E1D3 | LD (IX+$0E),A | Write A to *IX+0E. | ||
E1D6 | LD (IX+$03),$03 | Write 03 to *IX+03. | ||
E1DA | LD (IX+$0F),$03 | Write 03 to *IX+0F. | ||
E1DE | LD (IX+$06),$20 | Write 20 to *IX+06. | ||
E1E2 | LD (IX+$09),$03 | Write 03 to *IX+09. | ||
E1E6 | LD (IX+$07),$04 | Write 04 to *IX+07. | ||
E1EA | LD (IX+$08),$01 | Write 01 to *IX+08. | ||
E1EE | LD A,$01 | Write 01 to *SoundFlag_Animal. | ||
E1F0 | LD ($FFFF),A | |||
E1F3 | LD A,(IX+$04) | Return if *IX+04 is equal to 01. | ||
E1F6 | CP $01 | |||
E1F8 | RET Z | |||
E1F9 | LD (IX+$06),$24 | Write 24 to *IX+06. | ||
E1FD | RET | Return. | ||
AnimalsEventTiming_6 | E1FE | POP HL | Restore HL from the stack. | |
E1FF | LD A,(HL) | A=*HL. | ||
E200 | INC A | Increment A by three. | ||
E201 | INC A | |||
E202 | INC A | |||
E203 | LD (IX+$01),A | Write A to *IX+01. | ||
E206 | LD (IX+$0E),A | Write A to *IX+0E. | ||
E209 | LD (IX+$03),$03 | Write 03 to *IX+03. | ||
E20D | LD (IX+$06),$28 | Write 28 to *IX+06. | ||
E211 | LD (IX+$09),$06 | Write 06 to *IX+09. | ||
E215 | LD (IX+$07),$02 | Write 02 to *IX+07. | ||
E219 | LD (IX+$08),$02 | Write 02 to *IX+08. | ||
E21D | LD A,$02 | Write 02 to *SoundFlag_Animal. | ||
E21F | LD ($FFFF),A | |||
E222 | LD A,(IX+$04) | Return if *IX+04 is equal to FF. | ||
E225 | CP $FF | |||
E227 | RET Z | |||
E228 | LD (IX+$06),$2C | Write 2C to *IX+06. | ||
E22C | RET | Return. |
Prev: E11F | Up: Map | Next: E22D |