Prev: AD86 Up: Map Next: AE26
AD88: Update the onscreen inventory.
Used by the routines at Game_Init, Obj_Take, Obj_Drop and Inv_Select.
Pockets_UpdateInv AD88 LD HL,$0000
AD8B LD (Obj_SelectedDescrStr),HL
AD8E LD A,$01
AD90 CALL $1601
AD93 LD C,$01 Count number of objects carried.
AD95 LD HL,Hero_Pocket1 Tidy up pockets by shuffling objects, removing any gaps.
AD98 LD E,L
AD99 LD D,H
AD9A LD B,$04
Pockets_UpdateInv_0 AD9C LD A,(DE)
AD9D AND A
AD9E JR Z,Pockets_UpdateInv_1
ADA0 LD (HL),A
ADA1 INC HL
ADA2 INC C
Pockets_UpdateInv_1 ADA3 INC DE
ADA4 DJNZ Pockets_UpdateInv_0
ADA6 LD A,$05 Clear all the remaining pockets after shuffling everything up.
ADA8 SUB C
ADA9 JR Z,Pockets_UpdateInv_3
ADAB LD B,A
Pockets_UpdateInv_2 ADAC LD (HL),$00
ADAE INC HL
ADAF DJNZ Pockets_UpdateInv_2
Pockets_UpdateInv_3 ADB1 LD A,(HL) Get current selection, reset if out of bounds.
ADB2 CP C
ADB3 JR C,Pockets_UpdateInv_4
ADB5 LD (HL),$01
Pockets_UpdateInv_4 ADB7 LD HL,$5A41 Colour the onscreen inventory (green/green)
ADBA LD A,$04
Pockets_UpdateInv_5 ADBC LD (HL),$64
ADBE LD E,L
ADBF LD D,H
ADC0 INC DE
ADC1 LD BC,$0009
ADC4 LDIR
ADC6 LD BC,$0017
ADC9 ADD HL,BC
ADCA DEC A
ADCB JR NZ,Pockets_UpdateInv_5
ADCD CALL Print_StringOnStack Set up colour for PRINT
ADD0 DEFM $10,$00,$11,$04,$13,$01,$5E INK black, PAPER Green, BRIGHT on
ADD7 LD DE,(Hero_Pocket4)
ADDB LD E,$07 Start row position for text on screen.
ADDD LD IX,$BD3A Address just before the pockets.
Pockets_UpdateInv_6 ADE1 INC IX
ADE3 LD A,E Check for end of pockets.
ADE4 CP $0B
ADE6 JP NC,Pockets_UpdateInv_9
ADE9 LD A,(IX+$00) Get index of object in next pocket
ADEC AND A End if null object (0)
ADED JP Z,Pockets_UpdateInv_9
ADF0 PUSH DE
ADF1 CALL ObjStr_FindByIndex Get the description string.
ADF4 POP DE
ADF5 INC E
ADF6 LD A,$16 PRINT AT o,16
ADF8 RST $10
ADF9 LD A,E
ADFA RST $10
ADFB LD A,$01
ADFD RST $10
ADFE DEC D See if object is selected.
ADFF JR NZ,Pockets_UpdateInv_7
AE01 LD A,$2A Print an '*' if it is.
AE03 CALL Print_Character
AE06 JR Pockets_UpdateInv_8
Pockets_UpdateInv_7 AE08 LD A,$20 Else print a gap if not selected.
AE0A CALL Print_Character
Pockets_UpdateInv_8 AE0D CALL Print_TermString Print the objects description.
AE10 CP $2B Check for newline character.
AE12 JR NZ,Pockets_UpdateInv_6
AE14 LD A,D and if object is select
AE15 AND A
AE16 JR NZ,Pockets_UpdateInv_6
AE18 LD (Obj_SelectedDescrStr),HL Store second line of text, to be displayed on the description line.
AE1B JR Pockets_UpdateInv_6
Pockets_UpdateInv_9 AE1D LD HL,(Obj_SelectedDescrStr) See if the selected object has further text to display on the descprion line.
AE20 LD A,L
AE21 OR H
AE22 JP NZ,Print_AdditionalText
AE25 RET
Prev: AD86 Up: Map Next: AE26