Routines |
Prev: 49415 | Up: Map | Next: 49600 |
|
||||
Find the current's room data set in the table at 25001:
|
||||
49498 | LD HL,(56055) | Pointer to series of room data sets at 25001. | ||
49501 | LD A,(60087) | Get room number | ||
49504 | LD C,A | Store in C register | ||
49505 | LD B,1 | Set incremental compare counter to compare room number against | ||
Identify data set for current room from list at 25001
|
||||
49507 | LD A,C | |||
49508 | CP B | |||
49509 | JR Z,49520 | If room data byte (A) = counter (B), we're at the right place, so skip out of the loop | ||
Not this set. Move to the end of the set (set length will vary)
|
||||
49511 | LD A,(HL) | Get byte of room data set | ||
49512 | INC HL | Increment it | ||
49513 | CP 255 | Are we at an end-of-data-set marker? | ||
49515 | JR NZ,49511 | Continue till we are | ||
49517 | INC B | We're at the end of this set. Increment the counter | ||
49518 | JR 49507 | Keep comparing until we're at the right place for the room | ||
Data set for current room identified
|
||||
49520 | LD (60282),HL | Store address pointer for current room data bank. | ||
Check if the room is a vertical tunnel
|
||||
49523 | CP 224 | Tunnel rooms are room number 224 and above | ||
49525 | JP NC,50613 | If we're in one of these, skip out of this routine as tunnel data is different from room data | ||
Identify offset for room scenery graphics.
|
||||
49528 | CP 83 | Rooms 1-82 are 'brick' style levels (e.g. Gatehouse Level). Is the room number less than 83? | ||
49530 | LD A,0 | ...If so, graphic address pointer offset is zero | ||
49532 | JR C,49536 | |||
49534 | LD A,12 | If room number is 83 or above (e.g. Mines of Madness), graphic address offset is 12 | ||
49536 | LD (60279),A | Store level type graphic address offset | ||
The next set of instructions reset the room position:
|
||||
49539 | LD HL,0 | |||
49542 | LD (60236),HL | Set horizontal (60236) & vertical (60237) movement speed to zero | ||
49545 | LD (60231),HL | Set horizontal room position to zero | ||
49548 | LD (60233),HL | Set vertical room position to zero | ||
49551 | LD A,64 | |||
49553 | LD (60235),A | This byte is set to 64 for 'standard' rooms, 254/255 for tunnels (byte 9 of data set at 31744) | ||
49556 | LD A,32 | |||
49558 | LD (60227),A | Room item type = room (general). This is the first data set stored in the room data sets at 31744 and indicates the base room position/attributes | ||
49561 | LD A,2 | Item properties byte. Because this is just the general room/viewport position & data, can just set bit 1 (2) = hidden (nothing to draw) | ||
49563 | LD (60238),A | |||
49566 | CALL 57520 | Copy the 16 bytes of room data from working buffer at 60227 to the first of the room item data sets at 31744 | ||
49569 | LD A,5 | Resets the item properties ready for the next room item. Default setting sets bits 0 (visible on-screen) and 2 (needs to be erased before re-drawing) | ||
49571 | LD (60238),A | |||
49574 | LD A,80 | Starting value for the room's vertical position (viewport), in pixels, from top of room area (room alignment) | ||
49576 | LD (60281),A | |||
49579 | LD A,4 | Starting value for the room's horizontal position (viewport), in half-character (4 pixel) steps from left of room area | ||
49581 | LD (60280),A | |||
Prepare address pointers for the start of the room's data set:
|
||||
49584 | LD HL,(60282) | Get address pointer for the room data set in the table at 25001 | ||
49587 | LD A,(HL) | Get (first) room data set byte - this indicates the room size, in sections Trivia - Setting the scene(ry) | ||
49588 | INC HL | Increment address pointer to the second byte in the table (containing scenery data) | ||
49589 | LD (60282),HL | ...and re-store the pointer. | ||
49592 | LD (60284),A | Store the first byte, which indicates room size | ||
49595 | LD A,1 | |||
49597 | LD (60285),A | Incremental counter byte starting at 1, to compare with the first data byte of the current room when positioning room scenery. Used shortly in the routine at 49632. |
Prev: 49415 | Up: Map | Next: 49600 |