Routines |
Prev: AF8E | Up: Map | Next: AFDF |
This tests for characters meeting obstacles like doors and map bounds.
Also assigns saved_pos to specified vischar's pos and sets the sprite_index.
Used by the routine at animate.
|
||||||||||||||
touch | AF8F | EX AF,AF' | Exchange A registers | |||||||||||
AF90 | LD ($81AA),A | Stash the flip flag and sprite offset | ||||||||||||
AF93 | SET 6,(IY+$07) | Set the vischar's vischar_BYTE7_DONT_MOVE_MAP flag | ||||||||||||
AF97 | SET 7,(IY+$07) | Set the vischar's vischar_DRAWABLE flag | ||||||||||||
AF9B | PUSH IY | HL = IY | ||||||||||||
AF9D | POP HL | |||||||||||||
If the hero is player controlled then check for door transitions.
|
||||||||||||||
AF9E | LD A,L | Which vischar are we processing? | ||||||||||||
AF9F | AND A | |||||||||||||
AFA0 | PUSH AF | Preserve the vischar low byte | ||||||||||||
AFA1 | JR NZ,touch_0 | Jump forward if not the hero's vischar | ||||||||||||
AFA3 | LD A,($A139) | If the automatic player counter is positive (under player control)... call door_handling | ||||||||||||
AFA6 | AND A | |||||||||||||
AFA7 | CALL NZ,door_handling | |||||||||||||
touch_0 | AFAA | POP AF | Restore vischar low byte | |||||||||||
Check bounds if this is a non-player character or the hero is not cutting the fence.
|
||||||||||||||
AFAB | AND A | If it's a non-player vischar... jump foward to bounds check | ||||||||||||
AFAC | JR NZ,touch_1 | |||||||||||||
AFAE | LD A,($8001) | OR if it's the hero's vischar and its flags (vischar_FLAGS_PICKING_LOCK | vischar_FLAGS_CUTTING_WIRE) don't equal vischar_FLAGS_CUTTING_WIRE call bounds_check | ||||||||||||
AFB1 | AND $03 | |||||||||||||
AFB3 | CP $02 | |||||||||||||
touch_1 | AFB5 | CALL NZ,bounds_check | ||||||||||||
AFB8 | RET NZ | Return if a wall was hit | ||||||||||||
Check "real" characters for collisions.
|
||||||||||||||
AFB9 | LD A,(IY+$00) | Get this vischar's character index | ||||||||||||
AFBC | CP $1A | Is it >= character_26_STOVE_1? | ||||||||||||
AFBE | JR NC,touch_2 | Jump forward if so | ||||||||||||
AFC0 | CALL collision | Call collision | ||||||||||||
AFC3 | RET NZ | Return if there was a collision | ||||||||||||
At this point we handle non-colliding characters and items only.
|
||||||||||||||
touch_2 | AFC4 | RES 6,(IY+$07) | Clear vischar_BYTE7_DONT_MOVE_MAP | |||||||||||
AFC8 | LD HL,$81A4 | Copy saved_pos to vischar's position | ||||||||||||
AFCB | PUSH IY | |||||||||||||
AFCD | POP DE | |||||||||||||
AFCE | LD A,$0F | |||||||||||||
AFD0 | ADD A,E | |||||||||||||
AFD1 | LD E,A | |||||||||||||
AFD2 | LD BC,$0006 | |||||||||||||
AFD5 | LDIR | |||||||||||||
AFD7 | LD A,($81AA) | Unstash the flip flag and sprite offset | ||||||||||||
AFDA | LD (IY+$17),A | Set it in the vischar's sprite_index field | ||||||||||||
AFDD | XOR A | Set flags to Z | ||||||||||||
AFDE | RET | Return |
Prev: AF8E | Up: Map | Next: AFDF |