Prev: E0B0 Up: Map Next: E0F5
E0C2: Setup game graphics
Used by the routines at BF9D, C1C0, C20F, C265, C290, C2F8, C349, C5E7, CE71, CF99, D07C, D6B0, D730, DA4D, DADC, DB1F, DEB7, E16A, E641, E6FA, E753 and E7FD.
Input
A Graphic number - offset for graphics address pointer table at 97C3. Calculated offset is ((A-1)*2) + 97C3.
Room graphics are prepared using this routine when Maroc moves into a new room/screen.
The routine is also called to prepare any additional graphics required as and when needed (e.g. a creature entering the room, the warlock appearing, or to draw the arrow on the spell menu if fire is pressed).
E0C2 LD B,A Transfer offset value to B register
Calculate graphics address pointer using offset, using table at 97C3
E0C3 LD HL,($EB6A) Pointer to graphics address list at 97C3
E0C6 DEC A Address pointers are 2 bytes long, so get offset value, subtract 1...
E0C7 LD D,$00
E0C9 RLA ...multiply by 2
E0CA RL D
E0CC AND $FE Address pointers are 2 bytes long, so filter out bit 0 (1) to ensure it's an even number
E0CE LD E,A
E0CF ADD HL,DE Add the calculated offset to the base table address, to get the right graphics address pointer
E0D0 LD ($EAB2),HL ...and store. Initially corner vertical wall section at 97E5/9E0F.
Calculate a second graphics pointer offset, that will point to the flipped/mirrored graphic's address.
E0D3 LD A,($EB50) Offset byte for address pointer for store of mirrored graphic
E0D6 DEC A Address pointers are 2 bytes long, so get offset value, subtract 1...
E0D7 RLA ...multiply by 2
E0D8 AND $1E Keep bits 1-4 (no bit 0). Address pointers are 2 bytes long, so filter out bit 0 (1) just to make sure it's an even number.
E0DA LD E,A Put offset in DE
E0DB LD D,$00
E0DD ADD HL,DE Add this to HL address graphic pointer
E0DE LD ($EB51),HL ...and store.
Point DE register pair to graphics data (HL = pointer at address table at 97C3)
E0E1 LD HL,($EAB2) Get graphics address pointer (with first offset pointing to the 'standard' graphics address)
E0E4 LD E,(HL) Point DE to the actual graphics address data e.g. 9950, 9E0F.
E0E5 INC HL
E0E6 LD D,(HL)
E0E7 DEC HL
Pre-graphics byte - see Graphic properties
E0E8 DEC DE Get pre-graphics byte
E0E9 LD A,(DE)
E0EA INC DE
E0EB LD ($EB4F),A ...and store.
The next routine checks if the graphic has a 'mirrored' version. If so, this is constructed in the following routine at E0F5.
If bit 5 (32) is set, it indicates that the graphic is 'flippable' - for example, graphics for the background right-hand side wall, which can be flipped to create the background left-hand side wall.
E0EE LD C,A Store the byte in the C register, used in the following 'flip' routine
E0EF AND $20 If bit 5 is NOT set, no need to generate 'flipped' graphics.
E0F1 CP $00
E0F3 JR Z,$E169 In which case, jump straight to the RET command at the end of the following flip/reflect routine
Prev: E0B0 Up: Map Next: E0F5