Prev: BEE9 Up: Map Next: BFCF
BF17: Thief encounter
Thief steps out of the door. Hero can press '0' immediately to shoot.
Otherwise the thief asks for a light (checks FRAMES as entropy): if timer < $80 → lighter path (thief_lighter): thief asks "Tem lume?", hero says "Não fumo", thief leaves.
Otherwise → robbery: thief draws gun, says "Passe a carteira" (frame_bubble_street_r2c17). Hero hands over wallet, money zeroed, bubble cleared, thief leaves.
If hero had gun: shows "Não tens pistola?" (frame_bubble_hero_r1c2). If no gun: "Não tenho pistola" (frame_bubble_hero_r1c1_thief).
Setup
thief_encounter BF17 CALL door_open Open door (door_open)
BF1A LD A,$00 Clear LAST K
BF1C LD ($5C08),A
BF1F CALL thief_exit_door Walk thief out of door (thief_exit_door)
BF22 CALL thief_face_left Turn thief to face left (thief_face_left)
BF25 LD HL,$BFE0 Erase standing-pose remnant at (17,16) (frame_thief_erase_standing_remnant)
BF28 CALL draw_frame
BF2B CALL prng_tick Advance PRNG (prng_tick)
BF2E LD A,($C34D) Delay (var_prng1) ticks
BF31 CALL delay_a
BF34 LD A,($5C08) If '0' pressed → shoot thief (shoot_thief)
BF37 CP $30
BF39 JP Z,shoot_thief Jump to shoot (shoot_thief)
Thief decides: lighter or robbery
thief_encounter_0 BF3C LD A,($5C78) If FRAMES < $80 → lighter path (thief_lighter)
BF3F SUB $80
BF41 JP C,thief_lighter Jump to lighter path (thief_lighter)
BF44 CALL reset_encounter_flag Reset lighter flag and clear LAST K (reset_encounter_flag)
BF47 NOP NOP × 2 (padding)
BF48 NOP
BF49 LD DE,$D389 Set CHARS=$D389 (thief gun tileset)
BF4C CALL set_chars
Robbery — thief draws gun
BF4F LD HL,$BFE7 Draw thief drawing gun (LBFE7)
BF52 CALL draw_frame
BF55 LD C,$60 C = $60 (timeout outer loop)
thief_encounter_1 BF57 LD B,$00 B = 0 (256 inner iterations)
thief_encounter_2 BF59 LD A,($5C08) Poll LAST K
BF5C CP $30 If '0' pressed → shoot (shoot_robbery)
BF5E JP Z,shoot_robbery Jump to shoot (shoot_robbery)
BF61 DJNZ thief_encounter_2 DJNZ inner loop
BF63 DEC C DEC C — outer timeout
BF64 JR NZ,thief_encounter_1
Robbery — "Passe a carteira"
thief_encounter_3 BF66 LD DE,$D4B9 Set CHARS=$D4B9 (thief wallet tileset)
BF69 CALL set_chars
BF6C LD HL,$C00F Draw "Passe a carteira" bubble (frame_bubble_street_r2c17, CHARS=$D519)
BF6F CALL draw_frame
BF72 CALL reset_money_thief Zero money (reset_money_thief) — wallet stolen
BF75 LD A,$00 A = 0
BF77 LD ($C33C),A Clear wallet flag (var_inv_wallet)
BF7A LD A,$08 Delay 8
BF7C CALL delay_a
BF7F LD HL,$C026 Clear "Mãos ao ar!" bubble (frame_clear_street_r2c17)
BF82 CALL draw_frame
BF85 LD HL,$BFCF Erase thief feet after robbery (frame_thief_erase_feet)
BF88 CALL draw_frame
Thief leaves
BF8B CALL thief_enter_door Thief enters door (thief_enter_door)
BF8E LD A,$02 Delay 2
BF90 CALL delay_a
BF93 CALL door_close Close door (door_close)
BF96 LD A,$02 Delay 2
BF98 CALL delay_a
BF9B CALL face_forward Something (face_forward)
Post-robbery — gun complaint
BF9E LD A,($C33D) If hero has gun (var_inv_gun != 0) → skip complaint (thief_encounter_5)
BFA1 CP $00
BFA3 JP Z,thief_encounter_5
BFA6 CALL score_deduct_1 Deduct 1 from score (score_deduct_1)
BFA9 LD DE,$D459 Set CHARS=$D459, draw "Não tenho pistola" (frame_bubble_hero_r1c1_thief)
BFAC CALL set_chars
BFAF LD HL,$C03B
thief_encounter_4 BFB2 CALL draw_frame
BFB5 CALL wait_keypress Wait for keypress (wait_keypress)
BFB8 LD HL,$C052 Clear bubble (frame_clear_hero_r1c1_thief)
BFBB CALL draw_frame
BFBE CALL draw_hero Redraw hero (draw_hero)
BFC1 JP main_1 Return to main loop (main_1)
Thief had gun — hero complaint
thief_encounter_5 BFC4 LD DE,$D639 Set CHARS=$D639
BFC7 CALL set_chars
BFCA LD HL,$C067 Draw "Merda" bubble (frame_bubble_hero_r1c2, CHARS=$D639)
BFCD JR thief_encounter_4 Jump to wait for keypress (thief_encounter_4)
Prev: BEE9 Up: Map Next: BFCF