Prev: 52445 Up: Map Next: 52582
52513: Check for an object trade with warlock
Used by the routine at 52338.
First, check to see if any object has been traded (using the servant) with a warlock:
52513 LD A,(60333) Warlock 'aggression' byte - byte 6 of the warlock data sets at 27772.
52516 CP 0
52518 JR Z,52582 If zero, this means there's no warlock on-screen, so skip this check
52520 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
52521 LD A,(60334) Object number held by warlock
52524 CP 0
52526 JR NZ,52613 If not zero, an object has (already) just been given to the warlock, so needs to be dealt with - skip this routine
52528 CALL 57293 Run an event/collision check against this warlock (for trading an object)
52531 CP 0 A register returned with 1 = collision, or 0 = no collision
52533 JR Z,52582 If negative, skip to the next routine
Object trade made with warlock - mark the item as no longer present:
52535 LD A,(60230) Get object number (relates to room object table at 29551)
52538 LD (60334),A Copy to working data buffer
52541 LD A,0
52543 LD (60227),A Change the object's type to 0 in the working buffer, indicating it's no longer around in the room
52546 LD A,(60299)
52549 LD (60335),A Copy attribute colour of object to working data buffer
52552 LD A,(60238) Item properties byte
52555 LD C,A Temp store in C register
52556 OR %00001101 Set bits 0 (item is visible), 2 (item will need erasing) and 3 (item has been thrown/dropped by servant)
52558 AND %11101101 Reset bit 1 (item is hidden) and bit 4 (to indicate object no longer carried by servant)
52560 LD (60238),A Re-store updated object byte
52563 LD HL,(60228) Move the properties byte to byte 4 of the object data set at 29551 (objects held by warlocks are at the start of this table)
52566 INC HL
52567 INC HL
52568 INC HL
52569 LD (HL),A Store the updated item property in byte 4 of the set
52570 LD A,C Retrieve item properties byte (pre-modification)
52571 AND 16 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
52573 JR Z,52613
52575 LD A,0 If the item was carried by the servant...
52577 LD (60337),A ...Set the item-carried-by-servant status byte to 0
52580 JR 52613
There's a later check made (at 52849) to determine if a traded item is valuable enough to be worthy of a trade with each warlock.
Prev: 52445 Up: Map Next: 52582