Prev: 8CFE Up: Map Next: 8E14
8D9F: Sets up and blits the flame, if required.
Input
IX Address of torch data.
Output
Bg_TorchBlitFlame 8D9F LD A,(Camera_Compass) Make sure the camera is facing the torch, if not end routine.
8DA2 CP (IX+$0A)
8DA5 JR Z,Bg_TorchBlitFlame_1
Bg_TorchBlitFlame_0 8DA7 LD (IX+$02),$00 End.
8DAB RET
Bg_TorchBlitFlame_1 8DAC LD HL,(Coords_NS) Get correct coords of camera, along the expected axis (based on compass).
8DAF BIT 0,A
8DB1 JR NZ,Bg_TorchBlitFlame_2
8DB3 LD HL,(Coords_EW)
Bg_TorchBlitFlame_2 8DB6 LD E,(IX+$05) Get coords of torch.
8DB9 LD D,(IX+$06)
8DBC BIT 1,A
8DBE JR NZ,Bg_TorchBlitFlame_3
8DC0 EX DE,HL
Bg_TorchBlitFlame_3 8DC1 AND A Get difference between the two to see if torch is on screen.
8DC2 SBC HL,DE
8DC4 LD DE,$0021
8DC7 AND A
8DC8 ADC HL,DE
8DCA JR Z,Bg_TorchBlitFlame_0 Not visible.
8DCC JP M,Bg_TorchBlitFlame_0
8DCF LD DE,$0042
8DD2 AND A
8DD3 SBC HL,DE
8DD5 JR NC,Bg_TorchBlitFlame_0
8DD7 ADD HL,DE
8DD8 SRL H Start with attributes and colour red.
8DDA RR L
8DDC LD DE,Offscreen_Attr
8DDF ADD HL,DE
8DE0 LD A,(HL)
8DE1 AND $F8
8DE3 OR $02
8DE5 LD (HL),A
8DE6 INC HL
8DE7 LD (HL),A
8DE8 LD A,(CurrentRoom_Type) Only outside, room 0, displays torches that toggle for day and night. Indoors stay on all the time.
8DEB AND A
8DEC JR NZ,Bg_TorchBlitFlame_5
8DEE LD A,(Flag_dayNight) Check for night time.
8DF1 AND A
8DF2 JR NZ,Bg_TorchBlitFlame_4
8DF4 LD A,(IX+$0B) Test for fire frame.
8DF7 CP $15
8DF9 JR NZ,Bg_TorchBlitFlame_5
8DFB LD A,$A2 Set to fire bitmap index.
8DFD JR Bg_TorchBlitFlame_6
Bg_TorchBlitFlame_4 8DFF LD A,$15 Blank, no fire.
8E01 JR Bg_TorchBlitFlame_6
Bg_TorchBlitFlame_5 8E03 LD A,(IX+$0B) Toggle fire frame
8E06 XOR $01
Bg_TorchBlitFlame_6 8E08 LD (IX+$0B),A
8E0B LD (IX+$09),$08
8E0F LD A,$01 Set node data object type flag for blit function.
8E11 JP ObjNode_BlitShft Blit...
Prev: 8CFE Up: Map Next: 8E14