Unused Citadel bits

reminisce about bbc micro & electron games like chuckie egg, repton, elite & exileRelated forum: adventures


User avatar
streaks
Posts: 266
Joined: Thu Oct 13, 2005 2:08 pm
Contact:

Re: Unused Citadel bits

Post by streaks » Thu Nov 01, 2018 8:26 am

(Sorry to spam)

I'm looking at that hacked Citadel image with the screen browsing.. looking at the platform move I wonder I've noticed another characteristic that MAY be unique to it - when they're moving down and touch the floor their movement terminates at an irregular Y offset instead of when it's level with it's Y-cell offset. I don't know if the tile's small height is already accounted for in movement logics though.
streaksy (at) gmail (dot) com

Diminished
Posts: 161
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Unused Citadel bits

Post by Diminished » Thu Nov 01, 2018 3:18 pm

6502 wrote:
Tue Oct 30, 2018 11:36 pm
Bits 0,1,2,3 - Seems to selects which frames are displayed during animation sequences.
Bits 4,5,6,7 - Speed of tile flipping in animations. 0 fastest, 16 slowest.
Yeah, I mentioned this. Bits 0-3 choose an "A-type" animation subroutine for the tile from this pair of tables:

Code: Select all

; note that these are all unique
.T_ANIM_A_SUBS_LOW
  equb (witch_thing_maybe   and &ff)
  equb (L3e90               and &ff)
  equb (L3e92               and &ff)
  equb (animation_thing_1   and &ff)
  equb (L3ea6               and &ff)
  equb (L3eb4               and &ff)
  equb (L3ec5               and &ff)
  equb (temple_moose_maybe  and &ff)
  equb (L3ee2               and &ff)
  equb (L3efb               and &ff)
  equb (temple_guardians    and &ff)
  
.T_ANIM_A_SUBS_HIGH
  equb (witch_thing_maybe   div &100)
  equb (L3e90               div &100)
  equb (L3e92               div &100)
  equb (animation_thing_1   div &100)
  equb (L3ea6               div &100)
  equb (L3eb4               div &100)
  equb (L3ec5               div &100)
  equb (temple_moose_maybe  div &100)
  equb (L3ee2               div &100)
  equb (L3efb               div &100)
  equb (temple_guardians    div &100)
Meanwhile the 4-7 bits pick an animation period from this table. Note that it's not a linear relationship:

Code: Select all

.T_ANIM_SPEEDS_MASTER    equb  &01, &02, &03, &04, &05, &07, &0a, &0d, &10, &14, &19, &1e, &28, &3c, &50, &64 
Bit 0 - Tile on horizontal or vertical set movement path flag. Such as rope climbers.
Bit 1 - Tile on diagonal irregular set movement path flag. Such as flying sparklies.
Bit 2 - Tile chase flag. Such as monks.
Bit 3 - Suspect not used. Only some wall tiles (81,88) have this flag set, for no obvious reason.
Technically these four bits are just a number which just pick another pair of animation subroutines (I called them "B-type" and "C-type") from another four tables:

Code: Select all

.T_ANIM_B_SUBS_LOW
  equb (anim_B_sub_hori       and &ff)
  equb (anim_B_sub_vert       and &ff)
  equb (anim_B_sub_hori_vert  and &ff)
  equb (anim_B_sub_4          and &ff)
  equb (anim_B_sub_chase      and &ff)
  equb (anim_B_sub_mummy      and &ff)
  equb (anim_B_sub_monk       and &ff)
  equb (anim_B_sub_fires      and &ff)
.T_ANIM_B_SUBS_HIGH
  equb (anim_B_sub_hori       div &100)
  equb (anim_B_sub_vert       div &100)
  equb (anim_B_sub_hori_vert  div &100)
  equb (anim_B_sub_4          div &100)
  equb (anim_B_sub_chase      div &100)
  equb (anim_B_sub_mummy      div &100)
  equb (anim_B_sub_monk       div &100)
  equb (anim_B_sub_fires      div &100)

[...]

.T_ANIM_C_SUBS_LOW
  equb (draw_room_7         and &ff)
  equb (selfmod3_special_1  and &ff)
  equb (selfmod3_special_2  and &ff)
  equb (anim_c_sub_1a       and &ff)
  equb (anim_c_sub_1        and &ff)
  equb (anim_c_sub_1        and &ff)
  equb (anim_c_sub_1        and &ff)
  equb (draw_room_7         and &ff)
.T_ANIM_C_SUBS_HIGH
  equb (draw_room_7         div &100)
  equb (selfmod3_special_1  div &100)
  equb (selfmod3_special_2  div &100)
  equb (anim_c_sub_1a       div &100)
  equb (anim_c_sub_1        div &100)
  equb (anim_c_sub_1        div &100)
  equb (anim_c_sub_1        div &100)
  equb (draw_room_7         div &100)
The subroutines could do with some naming improvements.

Note that the subroutine used to animate the fires has bit 2 set, but they don't chase the player, so it's not quite true to call bit 2 the "chase bit".

These tables only have 8 entries each, so if bit 3 is set then that's theoretically a bug -- it will overflow the table and very quickly crash the CPU. However, if it only applies to wall tiles, they're not animated, so this situation wouldn't actually come up.

These unused bits (3 and 4) are intriguing, and I wonder if there are any clues as to what they were for in Citadel-early.
streaks wrote:
Thu Nov 01, 2018 8:02 am
Only the platform tile has byte[1] bit 4 set? I thought you meant those two-colour platforms and I thought it accounted for that mysterious splash effect. Moving platforms? Maybe it's to make it respond to levers..? Or like... maybe it means, since they respond to levers, fewer things can be taken for granted in terms of static/mobile logic and certain hard-to-define shortcuts can't be applied to it..? Or maybe like.. it means use the regular movement logic bits to define the movement, but this bit indicates that there's more involved than just HOW it moves (also WHEN it moves)... I dunno.
The lever logic is hardcoded in the final version, for example in the West Wing:

Code: Select all

                    cpy #C_RID_WEST_WING_SWITCH_MONK ; &80
                    bne L2d27
                    lda #&4
                    ; bring lift online? why does it need two anim slots?
                    ; if (t_anims_y_velocities[0] != 0) {
                    ;   t_anims_y_velocities[0] = 0;
                    ;   t_anims_y_velocities[1] = 0;
                    ; } else {
                    ;   t_anims_y_velocities[0] = 4;
                    ;   t_anims_y_velocities[1] = 4;
                    ; }
                    ldx t_anims_y_velocities
                    beq L2d21
                    lda #&0
.L2d21              sta t_anims_y_velocities
                    sta t_anims_y_velocities + 1 ;&6c
                    bpl L2d44
So the lever just sets the y-velocity for a pair of tile slots to 4, or to 0, depending on whether it's being stopped or started, but there's no general mechanism to do it; it's coded specifically for the rooms where it's used. That's not to say that there wasn't a more general mechanism for lifts earlier in development; it may be that MJ realised that it would use less RAM to special-case lift code for the rooms where it was used rather than having a general case encoded in the tile data. So it might be an artifact of that.
The mystery crystal tile... I suspect that it was a prototype tile used while developing and tweaking the tile logic, and wasn't even nessecarily intended to be a crystal. It could just be that the five crystals (that don't actually look like crystals) adopted the shape of that test sprite because the shape was pleasing or had aquired sentiment. I've done things like that many times. Since it's deadly and garbled I suggest it was just a dev guinea pig tile that was kept as a reference or testing-ground for bitplay.
As 6502 pointed out, tiles 1-5 fetch their graphical data from tile 0, so it's the other way round; tile 5 can't actually exist without tile 0's data.
streaks wrote:
Thu Nov 01, 2018 8:06 am
Speaking of that splash effect... have you tried rendering that other mystery sprite that you thought was probably a discarded splash effect, but with different width? A new, more obvious shape/pattern might emerge like with the crystal..?
IIRC I was wrong about that and the discarded splash actually turned out to be something tangible, possibly the water surface tile, but I don't have my notes on this computer so I can't check. I forget.
streaks wrote:
Thu Nov 01, 2018 8:26 am
I'm looking at that hacked Citadel image with the screen browsing.. looking at the platform move I wonder I've noticed another characteristic that MAY be unique to it - when they're moving down and touch the floor their movement terminates at an irregular Y offset instead of when it's level with it's Y-cell offset. I don't know if the tile's small height is already accounted for in movement logics though.
It probably just uses the normal collision detection mechanism to decide when to reverse. I haven't checked this though.
Last edited by Diminished on Thu Nov 01, 2018 3:59 pm, edited 3 times in total.

User avatar
streaks
Posts: 266
Joined: Thu Oct 13, 2005 2:08 pm
Contact:

Re: Unused Citadel bits

Post by streaks » Fri Nov 02, 2018 3:36 am

Has anyone ever tried to track down Jakobsen?
streaksy (at) gmail (dot) com

Diminished
Posts: 161
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Unused Citadel bits

Post by Diminished » Fri Nov 02, 2018 2:45 pm

Nope. I figured he'd chime in if he was interested in doing so.

No need to go stalking the guy.

6502
Posts: 23
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: Unused Citadel bits

Post by 6502 » Sat Nov 03, 2018 8:53 am

@Diminished

Thank you for correcting my errors. Hope you don't mind me muscling in on your thread.

I've been busy converting the tile data part of the binary file into a beebasm assembly file. This .asm file making viewing and altering the tiles much easier. Thought better to be included as an external file to citadel.asm as it's quite long.

I've checked it outputs the correct binary with a hash function, and it does. I'll post it here when ready, just needs tidying up and commenting. You can add it to your project if you like, but if you don't, that's fine with me too.

Also, found out that if tile date byte[4] is zero then the height of the tile is increased to 32px. Only the monks use this function. Byte[5] then contains info that would of been in byte[4].
Last edited by 6502 on Sat Nov 03, 2018 9:01 am, edited 1 time in total.

6502
Posts: 23
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: Unused Citadel bits

Post by 6502 » Sat Nov 03, 2018 8:56 am

streaks wrote:
Fri Nov 02, 2018 3:36 am
Has anyone ever tried to track down Jakobsen?
Personally I would of used a pseudonym name if it was me.

Diminished
Posts: 161
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Unused Citadel bits

Post by Diminished » Sat Nov 03, 2018 1:09 pm

6502 wrote:
Sat Nov 03, 2018 8:53 am
Thank you for correcting my errors. Hope you don't mind me muscling in on your thread.
Nope, not a problem. Information is free, and more eyeballs are welcome. I don't claim any right to the game. But there are certain insights that you'll only get from the asm. (Equally, there are likely to be some things I've got wrong which can be tested by fiddling with the data).

6502
Posts: 23
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: Unused Citadel bits

Post by 6502 » Tue Nov 06, 2018 1:16 pm

davidb wrote:
Sat Dec 09, 2017 1:13 pm
The second item certainly looks like a gold bar. :)
In the early version of Citadel, once you took a cyan block to Stonehenge and walked under the arch, your energy increased and the cyan block turned into this gold one. Not sure what you was suppose to do with it after that.

Diminished
Posts: 161
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Unused Citadel bits

Post by Diminished » Sun Nov 11, 2018 5:18 pm

6502 wrote:
Tue Nov 06, 2018 1:16 pm
davidb wrote:
Sat Dec 09, 2017 1:13 pm
The second item certainly looks like a gold bar. :)
In the early version of Citadel, once you took a cyan block to Stonehenge and walked under the arch, your energy increased and the cyan block turned into this gold one. Not sure what you was suppose to do with it after that.
Aha. Nice find.

I had a very quick look through Citadel-early to see if there was any clue about what the gold bar might have been for -- I didn't look too deeply into it, but quick searches don't reveal anything being done with tile 31 (&1F). So it doesn't look like MJ had any grand plan for those bars.

Here's the code (only in citadel-early) which performs the blue/gold bar swap:

Code: Select all

    2ECD: C9 65       CMP #65
    2ECF: D0 13       BNE 2EE4
    2ED1: A5 24       LDA 24
    2ED3: C9 32       CMP #32
    2ED5: D0 0C       BNE 2EE3
    2ED7: A9 1E       LDA #1E <- stone bar
    2ED9: A2 1F       LDX #1F <- gold bar
    2EDB: 20 34 40    JSR 4034 <- item consumption subroutine
    2EDE: 90 03       BCC 2EE3
    2EE0: 4C 0F 30    JMP 300F
    2EE3: 60          RTS
In the retail version it looks like this:

Code: Select all

                    ; CONSTANT: 0x65 is Stonehenge
.Lnot_witch         cmp #C_RID_STONEHENGE ; &65
                    bne Lnot_stonehenge
                    lda player_x
                    cmp #C_X_STONEHENGE ; &32
                    bne L2edb ; return
                    lda #C_TID_STONE_SLAB ;&1e
                    jsr consume_item_a
                    bcc L2edb ; return
                    ; CONSTANT: stone slabs are worth +40 energy? NOTE BCD
                    lda #C_E_STONEHENGE ; &40
                    jmp add_remove_energy_d
.L2edb              rts
Last edited by Diminished on Sun Nov 11, 2018 5:20 pm, edited 1 time in total.

6502
Posts: 23
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: Unused Citadel bits

Post by 6502 » Sun Nov 11, 2018 5:48 pm

Any clues in Citadel-early what the barrel was supposed to be for?

Diminished
Posts: 161
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Unused Citadel bits

Post by Diminished » Sun Nov 11, 2018 6:52 pm

I always thought the barrel was intended for jumping onto the roof of the Witch's House. Trampolines may have been added later on (tile ID &3a for the trampos but &18 for the barrel); so I suspect this was the originally intended solution and the trampolines were added to the game later.

User avatar
Kecske Bak
Posts: 703
Joined: Wed Jul 13, 2005 7:03 am
Location: Treddle's Wharf, Chigley
Contact:

Re: Unused Citadel bits

Post by Kecske Bak » Mon Nov 12, 2018 8:46 am

I believe the barrel was originally intended for getting the crown in the cellar.

avengahM
Posts: 8
Joined: Mon May 28, 2018 4:07 am
Contact:

Re: Unused Citadel bits

Post by avengahM » Wed Jun 12, 2019 7:36 pm

Wow, I just found a second Crown in Citadel-early!

The Witch's House in this version has a green crown instead of a yellow one. But there's actually a yellow one in screen (5,3)! Access it by putting a trampoline at the top right of the East Tower, on the very end of the wall. Then use that trampoline to jump to the right as high as possible. I used Escape to slow my fall down a couple of times but that may not be necessary.

So that means there are two Crowns in this version of the game, giving a possible total of 102 points if the game didn't automatically end at 99 (crowns are worth 3 points in this version).

There's also an annoying glitch whereby some items don't respawn when you start a new game. Crystals, the chicken, Egyptian heads, the skull and bones are amongst the items that don't respawn, this being after I completed the game with 99 points on the playthrough before I found the extra crown.
Last edited by avengahM on Wed Jun 12, 2019 7:45 pm, edited 2 times in total.

Diminished
Posts: 161
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Unused Citadel bits

Post by Diminished » Wed Jun 12, 2019 8:06 pm

Cool find.

I sort of want to have a trawl through Citadel-early and identify what bits of code are different; there might be some interesting artifacts in there and I'm guessing the rendering code is probably identical since you'd have to have that working long before you could start putting a game together, but I'm probably too lazy to do it. That, and I don't really want to deal with the WFDIS disassembler again.

6502
Posts: 23
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: Unused Citadel bits

Post by 6502 » Fri Jun 14, 2019 6:30 pm

avengahM wrote:
Wed Jun 12, 2019 7:36 pm
But there's actually a yellow one in screen (5,3)! Access it by putting a trampoline at the top right of the East Tower, on the very end of the wall. Then use that trampoline to jump to the right as high as possible.
How on earth did you manage to find that little gem?
I can't imagine any scenario I would happen to be jumping that direction on a trampoline.

Post Reply