Here is the relevant part from EQ.S: (// comments by me)
Code: Select all
dum blueprnt
BLUETYPE ds 24*30 // tiles
BLUESPEC ds 24*30 // modifiers
LINKLOC ds 256 // door links 1
LINKMAP ds 256 // door links 2
MAP ds 24*4 // room links
INFO ds 256 // see below
And the INFO part detailed: (// comments by me)
Code: Select all
dum INFO
ds 64 // unknown I
KidStartScrn ds 1 // start room
KidStartBlock ds 1 // start tile
KidStartFace ds 1 // start direction
ds 1 // unknown II
SwStartScrn ds 1 // maybe Sw means shadow?, these are not used anywhere
SwStartBlock ds 1
ds 1 // unknown III
GdStartBlock ds 24 // guard tile
GdStartFace ds 24 // guard direction
GdStartX ds 24 // unknown IV (a)
GdStartSeqL ds 24 // unknown IV (b)
GdStartProg ds 24 // guard skill
GdStartSeqH ds 24 // unknown IV (c)
// guard color and unknown IV (d) are missing
GdStartX and GdStartSeqH are initialized when the level is loaded, so their initial values are not used:
SUBS.S:
Code: Select all
*-------------------------------
*
* Set initial guard posns for entire level (call once)
*
*-------------------------------
INITIALGUARDS
ldy #24 ;screen #
:loop
lda GdStartBlock-1,y
cmp #30
bcs :nogd
jsr unindex ;A = blockx
jsr getblockej
clc
adc #angle+7
sta GdStartX-1,y
lda #0
sta GdStartSeqH-1,y
:nogd dey
bne :loop
]rts rts
from COMMENTS.S: (// comments by me)
Code: Select all
* INFO
*
* Bytes 0-63: reserved for editor // unknown I
*
* Bytes 64-255: Information about starting positions
* of player & other characters on this level.
* (See GAMEEQ for details.) // actually, it's EQ.S
from BUILDER.S (part of the level editor): (// comments by me)
Code: Select all
readblue lda MATX
pha
lda MATY
pha
lda INFO ;next available block #
sta NUMNEXT
ldx #1
ldy #0
:loop jsr getinfo
bmi :skip ;255 = nonexistent block
jsr CALCMAT
txa
sta (ZTEMP),y
:skip inx
cpx NUMNEXT
bcc :loop
:done pla
sta MATY
pla
sta MATX
rts
getinfo lda INFO,x
sta MATX
lda INFO+MAXBLOX,x // MAXBLOX=24
sta MATY
]rts rts
So, byte 0 stores the number of the first unused room. Bytes 1..24 store the X coordinates and bytes 25..48 store the Y coordinates.
Byte 0 is also used in the game:
from SUBS.S: (// comments by me)
Code: Select all
*-------------------------------
*
* S E T I N I T I A L S
*
* Set initial states of gadgets
*
*-------------------------------
SETINITIALS
lda INFO ;number of screens +1
sec
sbc #1
sta SCRNUM
:loop jsr DoScrn ;for every screen
dec SCRNUM
bne :loop
rts
*-------------------------------
DoScrn
lda SCRNUM
jsr calcblue
ldy #29
:loop jsr getinitobj // for every tile in the room
bcc :skip
sta (BlueSpec),y
:skip dey
bpl :loop
rts
getinitobj from FRAMEADV.S: (// comments by me)
Code: Select all
*-------------------------------
*
* Get initial state of object
*
* In: BlueType, BlueSpec, Y
*
* Return cs if it matters, else cc // cs=carry set, cc=carry clear
*
*-------------------------------
GETINITOBJ
lda (BlueType),y
and #idmask ;get objid // #idmask=0x1F
getinitobj1
cmp #gate
beq :okgate
cmp #loose
beq :okloose
cmp #flask
beq :okflask
bne :skip ;if it isn't a gadget, leave it alone
:okgate lda (BlueSpec),y ;1=gate up, 2=gate down, etc.
tax
lda initsettings-1,x // see below
sec
rts
:okloose lda #0 ;loose floor
rts
:okflask lda (BlueSpec),y
asl
asl
asl
asl
asl ;5x
sec
rts
:skip clc
]rts rts
The referenced initsettings:
from BGDATA.S: (// comments by me)
Code: Select all
gmaxval = 47*4 // open gate
gminval = 0 // closed gate
The modifiers of certain objects are changed after the level is loaded.
Gate: on disk, 1=open, 2=closed. In memory, the modifier stores how much the gate is open, in 1/4 pixels. (Probably because when the gate is closing, it moves 1 pixel in 4 frames.)
Loose floor: the modifier is zeroed out. In memory, the modifier tells which frame to show.
Potion: the modifier is shifted 5 bits left, i.e. the bottom 3 bits become the top 3 bits, and the bottom 5 bits store which bubble image should be shown.
An interesting thing is that the unused rooms of level 14 contain parts of level 2, but the modifiers have these changed values.
For example the potions in room 8, 12, 13, 18 have modifier 32, in room 20 (big potion) modifier 64, in room 13 (hurt potion) modifier 160.
Room 13 also has an open door with modifier 188(=47*4).