Prev: AC4A Up: Map Next: AD57
AC71: Handles Wally jumping.
Used by the routine at Wally_Handler.
Input
Output
Wally_Jump AC71 LD A,(IsArcadeMode) Stop any jumping when in Arcade Mode.
AC74 OR A
AC75 JP NZ,Wally_ShootCreate
This entry point is used by the routine at Demo.
Wally_JumpDemoEntry AC78 CALL Energy_Countdown check for any energy loss.
AC7B LD A,(Wally_Dir) Either use the current direction if moving...
AC7E OR A
AC7F JR NZ,Wally_Jump_0
AC81 LD A,(Wall_LastDir) Or use the last direction if standing still...
AC84 LD (Wally_Dir),A
Wally_Jump_0 AC87 LD (Wally_JumpDir),A Store as the direction to jump.
AC8A XOR A
AC8B LD (Wally_JumpCount),A
This entry point is used by the routines at Wally_Handler and Demo.
Wally_JumpHandlerEntry AC8E LD A,(Wally_Dir) Check for jumping to the right.
AC91 CP $01
AC93 JR Z,Wally_Jump_5
Jumping Left.
AC95 XOR A Clear
AC96 LD (Wally_HeadTurned),A
AC99 LD A,(Wally_JumpCount) Get translation for next frame in jump.
AC9C LD E,A
AC9D ADD A,A
AC9E ADD A,E
AC9F LD E,A
ACA0 LD D,$00
ACA2 LD HL,Wally_JumpTable
ACA5 ADD HL,DE
ACA6 LD E,(HL) X offset.
ACA7 INC HL
ACA8 LD D,(HL) Y offset.
ACA9 INC HL
ACAA LD B,(HL) Sprite frame index.
ACAB LD A,D
ACAC DEC A
ACAD BIT 7,A See if jump direction is up or falling.
ACAF JR NZ,Wally_Jump_2
ACB1 LD A,(Wally_ATTR) If falling test to see if Wally lands on anything.
ACB4 CP $42
ACB6 JR Z,Wally_Jump_1
ACB8 CP $45
ACBA JR NZ,Wally_Jump_2
Wally_Jump_1 ACBC LD A,(Wally_Y) If on a platform see if Wally hits to bottom of the current char. cell.
ACBF AND $07
ACC1 JR NZ,Wally_Jump_2
ACC3 CALL Wally_Erase Wally is standing directly on a platform, skipp any further movement.
ACC6 JR Wally_Jump_4
Wally_Jump_2 ACC8 CALL Wally_Erase Translate X and Y for jump.
ACCB LD A,H
ACCC ADD A,D
ACCD LD H,A
ACCE LD A,L
ACCF SUB E
ACD0 CP $07
ACD2 JR NC,Wally_Jump_3
ACD4 LD A,$07 Stop Wally from going of edge of screen.
Wally_Jump_3 ACD6 LD L,A Update position.
ACD7 LD (Wally_X),HL
Wally_Jump_4 ACDA LD A,B Update sprite.
ACDB ADD A,$20
ACDD LD (Wally_Frame),A
ACE0 CALL Wally_Draw
ACE3 LD HL,Wally_JumpCount Increase the counter and check for end of jump.
ACE6 INC (HL)
ACE7 LD A,(HL)
ACE8 CP $0C
ACEA RET NZ
ACEB XOR A Jump has ended, reset the flags.
ACEC LD (Wally_Dir),A
ACEF LD (Wally_JumpDir),A
ACF2 CALL Wally_StepsIncr
ACF5 RET
Jumping right.
Wally_Jump_5 ACF6 XOR A
ACF7 LD (Wally_HeadTurned),A
ACFA LD A,(Wally_JumpCount)
ACFD LD E,A
ACFE ADD A,A
ACFF ADD A,E
AD00 LD E,A
AD01 LD D,$00
AD03 LD HL,Wally_JumpTable
AD06 ADD HL,DE
AD07 LD E,(HL)
AD08 INC HL
AD09 LD D,(HL)
AD0A INC HL
AD0B LD B,(HL)
AD0C LD A,D
AD0D DEC A
AD0E BIT 7,A
AD10 JR NZ,Wally_Jump_7
AD12 LD A,(Wally_ATTR)
AD15 CP $42
AD17 JR Z,Wally_Jump_6
AD19 CP $45
AD1B JR NZ,Wally_Jump_7
Wally_Jump_6 AD1D LD A,(Wally_Y)
AD20 AND $07
AD22 JR NZ,Wally_Jump_7
AD24 CALL Wally_Erase
AD27 JR Wally_Jump_9
Wally_Jump_7 AD29 CALL Wally_Erase
AD2C LD A,H
AD2D ADD A,D
AD2E LD H,A
AD2F LD A,L
AD30 ADD A,E
AD31 CP $E9
AD33 JR C,Wally_Jump_8
AD35 LD A,$E9
Wally_Jump_8 AD37 LD L,A
AD38 LD (Wally_X),HL
Wally_Jump_9 AD3B LD A,B
AD3C ADD A,$30
AD3E LD (Wally_Frame),A
AD41 CALL Wally_Draw
AD44 LD HL,Wally_JumpCount
AD47 INC (HL)
AD48 LD A,(HL)
AD49 CP $0C
AD4B RET NZ
AD4C XOR A
AD4D LD (Wally_Dir),A
AD50 LD (Wally_JumpDir),A
AD53 CALL Wally_StepsIncr
AD56 RET
Prev: AC4A Up: Map Next: AD57