Wednesday, August 23, 2017

The game is confused

Although dynamic resize routines are only meant for, well, dynamically resizing the level, there's nothing stopping them from handling related events. For instance, the resize routines for both Angel Island Zone 1 and Marble Garden Zone 2 manually spawn the boss object into the level once the left boundary is locked in place.
MGZ_Resize:
    moveq   #0,d0
    move.b  (Dynamic_resize_routine).w,d0
    move.w  off_1C92A(pc,d0.w),d0
    jmp     off_1C92A(pc,d0.w)
; ---------------------------------------------------------------------------
off_1C92A:
    dc.w loc_1C930-off_1C92A
    dc.w loc_1C96E-off_1C92A
    dc.w locret_1C9C8-off_1C92A
; ---------------------------------------------------------------------------
    ...

loc_1C96E:
    cmpi.w  #$3A00,(Camera_X_pos).w
    blo.s   loc_1C9A8
    move.w  #$3C80,d0
    cmp.w   (Camera_X_pos).w,d0
    bhi.s   locret_1C9C6
    move.w  d0,(Camera_min_X_pos).w
    move.w  d0,(Camera_target_min_X_pos).w
    jsr     (Create_New_Sprite).l
    bne.s   loc_1C9A2
    move.l  #Obj_A1_1_MGZ2_Boss,(a1)
    move.w  #$3D20,$10(a1)
    move.w  #$668,$14(a1)

loc_1C9A2:
    addq.b  #2,(Dynamic_resize_routine).w
    rts
I intentionally sneaked in a weird quirk in my previous post related to this. Can you figure out what it is? I'll wait.

...

...

...

Welcome back.
    dc.w MGZ_Resize-LevelResizeArray
    dc.w MGZ_Resize-LevelResizeArray
For whatever reason, Marble Garden Zone 1 uses the same set of dynamic resize routines as Marble Garden Zone 2. In practice, this does not affect act 1 at all, because act 2 is longer than act 1, and all the interesting stuff only happens beyond the natural end of act 1.


However, because the developers were lazy setting most of the level sizes, so as long as you avoid spawning the act 1 boss object, going beyond the end of the level will put you in the act 1 loopback. And sure enough, once you're there, if you make your way to the right coordinates, the act 2 boss will spawn in act 1.

This is used in the current speedrun world record in order to completely skip over Marble Garden Zone 2.

No comments:

Post a Comment