Routines |
Prev: CF58 | Up: Map | Next: D019 |
Used by the routine at CD88.
|
||||
Materialization or disintegration routine - warlocks/demons materializing, or creatures disintegrating.
This routine determines the post-materialization/disintegration actions to take. This information is held in bits 5-7 of the creature properties byte (EB4E).
|
||||
CF99 | LD A,($EB50) | Graphic frame number/offset | ||
CF9C | AND $07 | Only bits 0-2 (values 0-7) needed for the number of frames | ||
CF9E | CP $07 | There are 6 animation frames in the materialization graphics (A847). Have we reached frame #7? | ||
CFA0 | JP NZ,$D27D | If not, jump out of routine at this point | ||
Final materialization/disintegration frame has been reached.
|
||||
CFA3 | LD A,($EB4E) | Creature/room item properties byte | ||
CFA6 | LD C,A | Temp store in C register | ||
CFA7 | AND $07 | Filter out/resets bits 4-7 | ||
CFA9 | OR $05 | Set bits 0 (indicating creature is on-screen) and 2 (indicating creature will need to be erased before drawing) | ||
CFAB | LD ($EB4E),A | ...and re-store. | ||
This routine is running because bit 5, 6 or 7 of the item (creature) properties byte (EB4E) is set. This bit indicates what action to take after a creature materialization or disintegration animation.
|
||||
CFAE | LD A,C | Retrieve item (creature) properties byte | ||
CFAF | AND $80 | Bit 7 of properties byte set = trigger WARLOCK/DEMON APPEARANCE after materialization animation is complete | ||
CFB1 | JR NZ,$CFBA | |||
CFB3 | LD A,C | |||
CFB4 | AND $40 | Bit 6 of properties byte set = trigger warlock DISAPPEARANCE post-materialization animation (CE89) - e.g. successful object trade | ||
CFB6 | JR NZ,$CFC8 | |||
CFB8 | JR $CFF0 | (If not either of the above) - Bit 5 of properties byte set = trigger CREATURE REMOVAL post-disintegration animation | ||
Creature has just materialized - setup graphic for this creature:
|
||||
CFBA | LD A,$01 | Set graphic frame number/offset at 1 (first frame/no frame offset) | ||
CFBC | LD ($EB50),A | |||
CFBF | LD A,($EBAB) | Graphic number (offset for address pointers in table at 97C3) | ||
CFC2 | CALL $E0C2 | Set up creature graphics | ||
CFC5 | JP $D27D | |||
Warlock has been successfully traded with - remove warlock and initialize object trade
|
||||
CFC8 | LD A,$00 | Set creature type to 0 (nothing to setup/draw) | ||
CFCA | LD ($EB43),A | |||
CFCD | LD A,$E0 | Timer indicating how long before a warlock is likely to materialize in the current room | ||
CFCF | LD ($EBB4),A | The warlocks will still appear again after a successful trade, but it'll be some time | ||
Warlock has gone - either off-screen, or disappeared after being traded an object successfully:
|
||||
CFD2 | LD A,$00 | |||
CFD4 | LD ($EBAD),A | Set warlock 'aggression' (likelihood of firing a missile at Maroc) to 0 (as it's gone) | ||
CFD7 | LD A,($EBB6) | Count of creatures in current room | ||
CFDA | DEC A | ...reduce by 1... | ||
CFDB | LD ($EBB6),A | ...and re-store. | ||
CFDE | LD A,($EBAE) | Check if the warlock is carrying an object | ||
CFE1 | CP $00 | |||
CFE3 | JP Z,$D27D | |||
CFE6 | LD ($EB46),A | ...If so, copy the item set number into the warlock's data set | ||
CFE9 | LD A,$00 | |||
CFEB | LD ($EBAE),A | ...and set the held item data buffer byte to 0 | ||
CFEE | JR $D019 | ...then skip over to the next routine | ||
Creature has been destroyed - remove from existence:
|
||||
CFF0 | LD A,$00 | |||
CFF2 | LD ($EB43),A | Set creature type to 0 (no creature to deal with any more) | ||
CFF5 | LD HL,($EB44) | Get address pointer to relevant creature/warlock data set at 6C7C | ||
CFF8 | INC HL | |||
CFF9 | INC (HL) | Increment the second byte of the set. This byte holds the number of these creatures Maroc has destroyed | ||
CFFA | LD A,($EBB6) | Reduce count of creatures in current room by 1 | ||
CFFD | DEC A | |||
CFFE | LD ($EBB6),A | Get creature type | ||
D001 | LD A,($EB46) | |||
D004 | CP $08 | |||
D006 | JP NC,$D27D | If creature >=8, it's not a warlock so jump out of the routine here | ||
D009 | LD A,$00 | Creature destroyed is a warlock. Set warlock 'aggression' (likelihood of firing a missile at Maroc) to 0, as the warlock is no more. | ||
D00B | LD ($EBAD),A | |||
If a warlock is destroyed, it will drop the object it's carrying
|
||||
D00E | LD A,($EBA8) | Get object number carried by the warlock | ||
D011 | CP $00 | |||
D013 | LD ($EB46),A | ...Copy this value into the warlock's data buffer | ||
D016 | JP Z,$D27D | If the warlock isn't carrying anything, can jump out at this point |
Prev: CF58 | Up: Map | Next: D019 |