Prev: CCDD Up: Map Next: CD66
CD21: Check for an object trade with warlock
Used by the routine at CC72.
First, check to see if any object has been traded (using the servant) with a warlock:
CD21 LD A,($EBAD) Warlock 'aggression' byte - byte 6 of the warlock data sets at 6C7C.
CD24 CP $00
CD26 JR Z,$CD66 If zero, this means there's no warlock on-screen, so skip this check
CD28 LD C,A Temp store this byte in C register, as it's used in the upcoming CALL as the event value to check for a trade
CD29 LD A,($EBAE) Object number held by warlock
CD2C CP $00
CD2E JR NZ,$CD85 If not zero, an object has (already) just been given to the warlock, so needs to be dealt with - skip this routine
CD30 CALL $DFCD Run an event/collision check against this warlock (for trading an object)
CD33 CP $00 A register returned with 1 = collision, or 0 = no collision
CD35 JR Z,$CD66 If negative, skip to the next routine
Object trade made with warlock - mark the item as no longer present:
CD37 LD A,($EB46) Get object number (relates to room object table at 736F)
CD3A LD ($EBAE),A Copy to working data buffer
CD3D LD A,$00
CD3F LD ($EB43),A Change the object's type to 0 in the working buffer, indicating it's no longer around in the room
CD42 LD A,($EB8B)
CD45 LD ($EBAF),A Copy attribute colour of object to working data buffer
CD48 LD A,($EB4E) Item properties byte
CD4B LD C,A Temp store in C register
CD4C OR %00001101 Set bits 0 (item is visible), 2 (item will need erasing) and 3 (item has been thrown/dropped by servant)
CD4E AND %11101101 Reset bit 1 (item is hidden) and bit 4 (to indicate object no longer carried by servant)
CD50 LD ($EB4E),A Re-store updated object byte
CD53 LD HL,($EB44) Move the properties byte to byte 4 of the object data set at 736F (objects held by warlocks are at the start of this table)
CD56 INC HL
CD57 INC HL
CD58 INC HL
CD59 LD (HL),A Store the updated item property in byte 4 of the set
CD5A LD A,C Retrieve item properties byte (pre-modification)
CD5B AND $10 Check bit 4 (16) - if set, indicates object carried by servant. Normally this will be set, but it is possible for the servant to 'throw' the item to the warlock
CD5D JR Z,$CD85
CD5F LD A,$00 If the item was carried by the servant...
CD61 LD ($EBB1),A ...Set the item-carried-by-servant status byte to 0
CD64 JR $CD85
There's a later check made (at CE71) to determine if a traded item is valuable enough to be worthy of a trade with each warlock.
Prev: CCDD Up: Map Next: CD66