Routines |
Prev: 29513 | Up: Map | Next: 29696 |
Used by the routine at 31110. Returns with the carry flag set if the character about to speak is off-screen. Returns with the zero flag reset if somebody else is speaking at the moment.
|
||||||||
29518 | LD A,(32512) | A=leftmost column of the skool on screen (0-64) | ||||||
29521 | LD B,A | |||||||
29522 | LD L,98 | Byte 98 of a character's buffer holds his x-coordinate | ||||||
29524 | LD A,(HL) | Pick this up in A | ||||||
29525 | INC A | Return with the carry flag set if the character is off-screen to the left | ||||||
29526 | LD E,A | |||||||
29527 | SUB B | |||||||
29528 | RET C | |||||||
29529 | CP 32 | Return with the carry flag set if the character is off-screen to the right | ||||||
29531 | CCF | |||||||
29532 | RET C | |||||||
29533 | LD C,A | C=screen x-coordinate (0-31) of the spot above the character's head (where the speech bubble lip will be) | ||||||
29534 | LD A,(32613) | A=current speech bubble lip x-coordinate (if any) | ||||||
29537 | AND A | Is somebody else speaking at the moment? | ||||||
29538 | RET NZ | Return with the zero flag reset if so | ||||||
The character is on-screen and no one else is speaking at the moment.
|
||||||||
29539 | LD L,96 | |||||||
29541 | LD A,H | A=character number (152-169) | ||||||
29542 | INC L | L=97 | ||||||
29543 | CP 167 | Set the carry flag unless EINSTEIN is the speaker | ||||||
29545 | SBC A,A | A=0 if EINSTEIN is speaking, 255 otherwise | ||||||
29546 | ADD A,(HL) | D=y if EINSTEIN is speaking, y-1 otherwise (where y is the speaker's y-coordinate) | ||||||
29547 | LD D,A | |||||||
29548 | LD (32612),DE | Store the speech bubble lip coordinates at 32612 | ||||||
29552 | SUB 152 | Get the attribute file address of the speech bubble lip in BC | ||||||
29554 | RRCA | |||||||
29555 | RRCA | |||||||
29556 | RRCA | |||||||
29557 | LD B,A | |||||||
29558 | AND 224 | |||||||
29560 | ADD A,C | |||||||
29561 | LD C,A | |||||||
29562 | LD A,B | |||||||
29563 | AND 3 | |||||||
29565 | ADD A,88 | |||||||
29567 | LD B,A | |||||||
29568 | LD A,(DE) | A=UDG reference of the character square under the speech bubble lip | ||||||
29569 | LD (32614),A | Store this in 32614 | ||||||
29572 | LD A,239 | 239=UDG reference for the speech bubble lip | ||||||
29574 | LD (DE),A | Replace the skool UDG with the speech bubble lip UDG | ||||||
29575 | SET 7,E | Pick up the skool attribute byte of the character square under the speech bubble lip and store it in 32615 | ||||||
29577 | LD A,(DE) | |||||||
29578 | LD (32615),A | |||||||
29581 | LD A,56 | 56=PAPER 7: INK 0 | ||||||
29583 | LD (DE),A | Replace the skool attribute byte | ||||||
29584 | LD (BC),A | Set the new attribute on-screen | ||||||
The skool UDG reference and attribute byte for the location of the speech bubble lip have been adjusted. Now for the speech bubble itself.
|
||||||||
29585 | LD A,E | Get the x-coordinate of the left edge of the speech bubble in E | ||||||
29586 | AND 120 | |||||||
29588 | LD E,A | |||||||
29589 | DEC D | The speech bubble is two character squares high | ||||||
29590 | DEC D | |||||||
29591 | PUSH HL | |||||||
29592 | LD HL,65472 | Set HL to the attribute file address for the top-left corner of the speech bubble | ||||||
29595 | ADD HL,BC | |||||||
29596 | LD A,L | |||||||
29597 | AND 248 | |||||||
29599 | LD L,A | |||||||
29600 | LD B,8 | Fill in the top row of 8 character squares with the speech bubble attribute (56=PAPER 7: INK 0) | ||||||
29602 | LD (HL),56 | |||||||
29604 | INC HL | |||||||
29605 | DJNZ 29602 | |||||||
29607 | LD C,24 | Set HL to the attribute file address for the bottom-left corner of the speech bubble | ||||||
29609 | ADD HL,BC | |||||||
29610 | LD B,8 | Fill in the bottom row of 8 character squares with the speech bubble attribute (56=PAPER 7: INK 0) | ||||||
29612 | LD (HL),56 | |||||||
29614 | INC L | |||||||
29615 | DJNZ 29612 | |||||||
29617 | LD HL,32616 | Store the UDG references for the part of the skool that will be overwritten by the top row of the speech bubble at 32616 | ||||||
29620 | EX DE,HL | |||||||
29621 | LD A,L | |||||||
29622 | LD C,8 | |||||||
29624 | LDIR | |||||||
29626 | LD L,A | Replace the 8 UDG references for the part of the skool that will be overwritten by the top row of the speech bubble with the appropriate speech bubble UDG references (240-247) | ||||||
29627 | LD BC,2288 | |||||||
29630 | LD (HL),C | |||||||
29631 | INC L | |||||||
29632 | INC C | |||||||
29633 | DJNZ 29630 | |||||||
29635 | LD L,A | Store the UDG references for the part of the skool that will be overwritten by the bottom row of the speech bubble at 32624 | ||||||
29636 | INC H | |||||||
29637 | LD C,8 | |||||||
29639 | LDIR | |||||||
29641 | LD L,A | Replace the 8 UDG references for the part of the skool that will be overwritten by the bottom row of the speech bubble with the appropriate speech bubble UDG references (248-255) | ||||||
29642 | LD BC,2296 | |||||||
29645 | LD (HL),C | |||||||
29646 | INC L | |||||||
29647 | INC C | |||||||
29648 | DJNZ 29645 | |||||||
29650 | ADD A,128 | Store the 8 attribute bytes for the part of the skool that will be overwritten by the top row of the speech bubble at 32632 | ||||||
29652 | LD L,A | |||||||
29653 | LD C,8 | |||||||
29655 | DEC H | |||||||
29656 | LDIR | |||||||
29658 | LD L,A | Replace the 8 attribute bytes for the part of the skool that will be overwritten by the top row of the speech bubble with the appropriate speech bubble attribute byte (C=56=PAPER 7: INK 0) | ||||||
29659 | LD BC,2104 | |||||||
29662 | LD (HL),C | |||||||
29663 | INC L | |||||||
29664 | DJNZ 29662 | |||||||
29666 | LD L,A | Store the 8 attribute bytes for the part of the skool that will be overwritten by the bottom row of the speech bubble at 32640 | ||||||
29667 | LD C,8 | |||||||
29669 | INC H | |||||||
29670 | LDIR | |||||||
29672 | LD L,A | Replace the 8 attribute bytes for the part of the skool that will be overwritten by the bottom row of the speech bubble with the appropriate speech bubble attribute byte (C=56=PAPER 7: INK 0) | ||||||
29673 | LD BC,2104 | |||||||
29676 | LD (HL),C | |||||||
29677 | INC L | |||||||
29678 | DJNZ 29676 | |||||||
29680 | LD DE,(32612) | Copy the speech bubble lip coordinates from 32612 to DE | ||||||
29684 | CALL 28807 | Update the SRB for the lip of speech bubble | ||||||
29687 | CALL 62714 | Open the lip of the speech bubble | ||||||
29690 | CALL 29735 | Update the SRB for the speech bubble | ||||||
29693 | POP HL | |||||||
29694 | INC A | Set the zero flag | ||||||
29695 | RET | Return with the zero flag set to indicate success |
Prev: 29513 | Up: Map | Next: 29696 |