Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Cyber Axe

    Cyber Axe Newcomer Trialist

    Joined:
    Jun 21, 2020
    Messages:
    6
    Edit:

    Realised the below code is related to the Title Screen "Demo" of the background looping and checking to see if it should goto the demo level, and the start button check there is to start the game.

    I was pretty confident the code I'd need to insert needs to go into loc_3230 and SS_MainLoop respectively but the button presses are not registered, so there may be something about demo mode blocking input that I'm unaware of?

    ---
    So I'm currently trying to add some extra debugging stuff to Sonic 1, at the moment I'm trying to add in the ability to skip through demo scenes, with a for back and c for next, which I thought would be pretty simple, but I'm looking at the demo level code and it does not appear to be executing, as when i try commenting out the is start button pressed code as a test at loc_33E4 it doesn't effect the demo level at all it just goes back to the title screen as normal.

    If I am reading the following correctly the demo will loop to Demo_Run until either the demo time has passed or start is pressed then it will increment the demo to the next one and if more than the amount of demos put it back to zero and resets stage variables for the next run and return to the Sega Screen.

    Though I obviously have something wrong as I say when I remove the press start code it doesn't seem to effect anything, so either this code is not being run or it's specifically for the Special Stage? which I've not tested yet, or my understanding of what's going on here is erroneous.

    Code:
    GotoDemo:
            move.w    #$1E,(v_demolength).w
    
    Demo_Run: ; loc_33B6
            move.b    #4,(v_vbla_routine).w
            bsr.w    WaitForVBla
            bsr.w    DeformLayers
            bsr.w    PaletteCycle
            bsr.w    RunPLC
            move.w    (v_objspace+obX).w,d0
            addq.w    #2,d0
            move.w    d0,(v_objspace+obX).w
            cmpi.w    #$1C00,d0
            blo.s    @Demo_CheckTimer
        if TweakRemoveReduntantCode=0
            move.b    #id_Sega,(v_gamemode).w ; go to Sega screen
            rts
        else
            bsr.w    SS_ToSegaScreen
        endc
    ; ===========================================================================
    
        @Demo_CheckTimer: ; loc_33E4
        ; if EnhancedDebug>0
        ;     andi.b    #btnC,(v_jpadpress1).w                 ; is C button pressed?
        ;     bne.w    Tit_ChkLevSel                                        ; if yes, branch
        ;     ; beq.s    @Demo_CheckTimer_Skip                        ; if no, branch
        ;     ; bsr.s @Demo_Increment
        ;     ; jmp    Tit_ChkLevSel                                        ; If not Coninue to run Demo
        ; endc ; if EnhancedDebug>0
        @Demo_CheckTimer_Skip:
            andi.b    #btnStart,(v_jpadpress1).w         ; is Start button pressed?
            bne.w    Tit_ChkLevSel                                        ; if yes, branch
            tst.w    (v_demolength).w                                ; Has Demo Time Above 0?
            bne.w    Demo_Run                                                ; If so Coninue to run Demo
    
        @Demo_Increment:
            sfx    bgm_Fade,0,1,1                                         ; fade out music
            move.w    (v_demonum).w,d0                             ; load    demo number
            andi.w    #7,d0
            add.w    d0,d0
            move.w    Demo_Levels(pc,d0.w),d0                ; load level number for    demo
            move.w    d0,(v_zone).w
            addq.w    #1,(v_demonum).w                             ; add 1 to demo number
            cmpi.w    #max_demo,(v_demonum).w             ; is demo number less than max_demo?
            blo.s    @Demo_Enable                                            ; if yes, branch
            move.w    #0,(v_demonum).w                             ; reset demo number to    0
    
        @Demo_Enable: ; loc_3422
            move.w    #1,(f_demo).w                                    ; turn demo mode on
            move.b    #id_Demo,(v_gamemode).w             ; set screen mode to 08 (demo)
            cmpi.w    #$600,d0                                            ; is level number 0600 (special    stage)?
            bne.s    @Demo_Level                                            ; if not, branch
            move.b    #id_Special,(v_gamemode).w         ; set screen mode to $10 (Special Stage)
            clr.w    (v_zone).w                                            ; clear    level number
            clr.b    (v_lastspecial).w                             ; clear special stage number
    
        @Demo_Level:
            move.b    #3,(v_lives).w                                ; set lives to 3
            moveq    #0,d0
            move.w    d0,(v_rings).w                                ; clear rings
            move.l    d0,(v_time).w                                    ; clear time
            move.l    d0,(v_score).w                                ; clear score
        if Revision>0
            move.l    #5000,(v_scorelife).w                 ; extra life is awarded at 50000 points
        endc
            rts
     
    Last edited: Nov 5, 2020
  2. RandomName

    RandomName Newcomer Member

    Joined:
    Jun 3, 2020
    Messages:
    10
    Location:
    Russia
    There's a MoveSonicInDemo subroutine, that changes v_jpadhold1 to demo input, if demo mode is on.(It is executed both in special stage Main loop and level Main loop)
     
  3. Cyber Axe

    Cyber Axe Newcomer Trialist

    Joined:
    Jun 21, 2020
    Messages:
    6
    Thanks, after using btst opcode to check the buttons I got it working, added in the following for anyone interested

    Code:
    MDemo_On:
        if EnhancedDebug>0
            btst    #bitA,(v_jpadhold1).w                         ; check if A is pressed
            beq.s    @checkC                                                        ; if not, branch
    
            bra @quit
    
        @checkC:
            btst    #bitC,(v_jpadhold1).w                         ; check if C is pressed
            beq.s    @skip                                                            ; if not, branch
    
            bra @quit
    
            @skip:
        endc
     
    RandomName likes this.
  4. Iso Kilo

    Iso Kilo Is it a fox? Is it a wolf? It's Kilo! Member

    Joined:
    Oct 9, 2017
    Messages:
    347
    Location:
    A warm and lovely place~
    So, I've added a new screen mode to Sonic 1, and it works perfectly fine, but I've ran into a strange issue. When the game mode is supposed to switch to say, the title screen, it just loops back to the Sega screen. I've looked into both the code that handles screen modes and the Sega screen itself, but with no luck. Has anyone experienced this before, and if so, how can I solve it?
     
  5. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    868
    Location:
    Portland, Maine
    Are you branching to the start of the new game mode after setting $FFFFF600?
     
  6. Iso Kilo

    Iso Kilo Is it a fox? Is it a wolf? It's Kilo! Member

    Joined:
    Oct 9, 2017
    Messages:
    347
    Location:
    A warm and lovely place~
    No, I figured that the game would logically do so itself as it had before. I tried it, but felt like there'd be a better, more correct solution.
     
  7. Rivet

    Rivet Newcomer Trialist

    Joined:
    Jun 12, 2020
    Messages:
    5
    Iso Kilo and DeltaWooloo like this.
  8. Cyber Axe

    Cyber Axe Newcomer Trialist

    Joined:
    Jun 21, 2020
    Messages:
    6
    3 Questions 2 Questions.

    First does anyone know if anyone has dumped the "easy" and "normal" mode stage layouts for sonic 1/2/3 from sonic jam? I'd like to include them in future projects and if they're already available that would be great rather than having to recreate them in the level editor.

    Secondly, does anyone know the cause of the blue bars on the spring yard zone act 1 loading screen as seen below? as i'd like to fix it.

    [​IMG]

    I solved the issue below, the previous question solved it actually, I added a new game mode for the Level Select subroutine i made and extended the GameModeArray using the info in the previous post.

    I've updated with the new code, there is a graphic glitch now when it switches to the menu but i'll get that sorted.

    Thirdly, does anyone see anything wrong with the following code? I've created a subroutine to allow me to exit directly out of a level if in debug mode and press start into the level select menu, the problem is the menu loads but when I select anything it doesn't load anything it just stops executing.

    If I select marble zone it will garble the bottom of the sonic title background and animated, then if I press start again it pauses/unpauses the animation, as if it's still in the stage game mode or I've not properly cleared something out.


    In the PauseGame.asm

    Code:
    Pause_StopGame:
        if EnhancedDebug>0
            tst.b (v_debuguse).w                                                         ; Is debug mode active?
            beq.s @skip                                                                            ; if not, branch
            bra.w GotoLevelSelect
        @skip:
        endc ; if EnhancedDebug>0
    In Sonic.asm just before GM_Title:

    Code:
    GotoLevelSelect:
            move.b    #id_LevelSelect,(v_gamemode).w    ; go to title screen
            rts
    GM_Level_Select:
            bsr.w    ClearPLC
        if FeatureUseSonic2SoundDriver=0
            sfx    bgm_Fade,0,0,1                                                         ; stop music
        else
            music    bgm_Fade,0,0,1                                                     ; stop music
        endc
            bsr.w    PaletteFadeOut
            move.b (v_gamemode).w,d0                                             ; load Game Mode
            move.w d0,d1
            lsr.b #$01,d1
            add.w d1,d0
            disable_ints
            move.b    #1,(f_nobgscroll).w                                     ; clear scroll lock
            move.w    #$8004,(a6)                                                        ; 8-colour mode
            move.w    #$8200+(vram_fg>>10),(a6)                         ; set foreground nametable address
            move.w    #$8400+(vram_bg>>13),(a6)                         ; set background nametable address
            move.w    #$9001,(a6)                                                        ;    64-cell hscroll size
            move.w    #$9200,(a6)                                                        ; window vertical position
            move.w    #$8B03,(a6)
            move.w    #0,(a6)                                                                ; set background colour (palette line 2, entry 0)
            clr.b    (f_wtr_state).w
            move.b    #0,(v_lastlamp).w                                         ; clear lamppost counter
            move.w    #0,(v_debuguse).w                                            ; disable debug item placement mode
            move.w    #0,(f_demo).w                                                    ; disable debug mode
            move.w    #0,($FFFFFFEA).w                                             ; unused variable
            move.w    #(id_GHZ<<8),(v_zone).w                                ; set level to GHZ (00)
            move.w    #0,(v_pcyc_time).w                                         ; disable palette cycling
            bsr.w    ClearScreen
            lea    (v_objspace).w,a1
            moveq    #0,d0
            move.w    #$7FF,d1
        @ClrObj1:
            move.l    d0,(a1)+
            dbf    d1,@ClrObj1                                                                ; fill object space ($D000-$EFFF) with 0
            locVRAM    $4000
            lea    (Nem_TitleFg).l,a0                                                 ; load title    screen patterns
            bsr.w    NemDec
            lea    (vdp_data_port).l,a6
            locVRAM    $D000,4(a6)
            lea    (Art_Text).l,a5                                                        ; load level select font
            move.w    #$28F,d1
        @Load_LevelSelectFont:
            move.w    (a5)+,(a6)
            dbf    d1,@Load_LevelSelectFont                                    ; load level select font
            bsr.w    DrawChunks
            lea    (v_256x256).l,a1
            lea    (Eni_Title).l,a0                                                     ; load title screen mappings
            move.w    #0,d0
            bsr.w    EniDec
            copyTilemap    v_256x256,$C208,$21,$15
            moveq    #palid_LevelSel,d0
            bsr.w    PalLoad1                                                                ; load level select palette
            bsr.w    PaletteFadeIn                                                     ; Fade into Menu
            ; bra.w    Tit_LoadLevelSelect                                         ; Display Menu
            bsr.w    LevSelTextLoad
            bsr.w LevelSelect
            bra.w PlayLevel
    
    Thanks.
     
    Last edited: Nov 8, 2020
  9. DeltaWooloo

    DeltaWooloo A hacker, helper, friend and a Wooloo Member

    Joined:
    Aug 7, 2019
    Messages:
    228
    I'm trying to get the lightning shield art to load to Sonic 1. What I've done is match the SSTs to Sonic 1 and fix branches to match Hivebrain's disassembly.

    Code:
    ; ===========================================================================
    ; ---------------------------------------------------------------------------
    ; Object 38 - shield
    ; ---------------------------------------------------------------------------
    Obj38:                    ; XREF: Obj_Index
            moveq    #0,d0
            move.b    $24(a0),d0
            move.w    Obj38_Index(pc,d0.w),d1
            jmp    Obj38_Index(pc,d1.w)
    ; ===========================================================================
    Obj38_Index:   
            dc.w Obj38_Main-Obj06_Index
            dc.w loc_19732-Obj06_Index
    ;        dc.w LightningShield_FlashWater
    ; ===========================================================================   
    
    Obj38_Main:            ; DATA XREF: SpawnLevelMainSprites_SpawnPowerup+88o
                        ; ROM:0001D9B4o ...
            move.l    #ArtUnc_LightningShield_Sparks,d1
            move.w    #$A820,d2
            move.w    #$541,d3
            jsr    (QueueDMATransfer).l
            move.l    #Map_LighteningShield,$4(a0)
            move.l    #DPLC_LighteningShield,$3C(a0)
            move.l    #ArtUnc_LighteningShield,$38(a0)
            move.b    #4,1(a0)
            move.w    #$80,$18(a0)
            move.b    #$18,$19(a0)
            move.b    #$18,$16(a0)
            move.w     #$A820,$36(a0)
            move.w    #$541,2(a0)
            btst    #7,($FFFFB00A).w
            beq.s    loc_19720
            bset    #7,$A(a0)
    
    loc_19720:                ; CODE XREF: ROM:00019718j
            move.w    #1,$20(a0)
            move.b    #-1,$34(a0)
            move.l    #loc_19732,(a0)
    
    loc_19732:                ; DATA XREF: ROM:0001972Co
            movea.w    $40(a0),a2
            btst    #1,$2B(a2)
            bne.w    locret_197C4
            cmpi.b    #$1C,$20(a2)
            beq.s    locret_197C4
            btst    #0,$2B(a2)
            beq.s    loc_197CC
            btst    #6,$2A(a2)
            bne.s    loc_197C6
            move.w    $10(a2),$10(a0)
            move.w    $14(a2),$14(a0)
            move.b    $2A(a2),$2A(a0)
            andi.b    #1,$22(a0)
    
    loc_1977C:                ; CODE XREF: ROM:00019774j
            andi.w    #$7FFF,art_tile(a0)
            tst.w    $A(a2)
            bpl.s    loc_1978E
            ori.w    #$8000,2(a0)
    
    loc_1978E:                ; CODE XREF: ROM:00019786j
            tst.b    $20(a0)
            beq.s    loc_1979A
            bsr.s    LightningShield_Create_Spark
            clr.b    $20(a0)
    
    loc_1979A:                ; CODE XREF: ROM:00019792j
            lea    (Ani_LightningShield).l,a1
            jsr    AnimateSprite
            move.w    #$80,$18(a0)
            cmpi.b    #$E,$22(a0)
            bcs.s    loc_197BA
            move.w    #$200,$18(a0)
    
    loc_197BA:                ; CODE XREF: ROM:000197B2j
            bsr.w    PLCLoad_Shields
            jmp    DisplaySprite
    ; ���������������������������������������������������������������������������
    
    locret_197C4:                ; CODE XREF: ROM:0001973Cj
                        ; ROM:00019746j
            rts   
    ; ���������������������������������������������������������������������������
    
    loc_197C6:                ; CODE XREF: ROM:00019756j
            tst.w    ($FFFFF7B5).w
            beq.s    LightningShield_FlashWater
    
    loc_197CC:                ; CODE XREF: ROM:0001974Ej
            andi.b    #$8E,$2B(a2)
            move.l    #obj06,(a0)
            rts   
    ; ���������������������������������������������������������������������������
    
    LightningShield_FlashWater:        ; CODE XREF: ROM:000197CAj
            addq.b     #$5,$24(a0)
            andi.b    #$8E,$2B(a2)
            lea    ($FFFFFA80).w,a1
            lea    ($FFFFFAFF).w,a2
            move.w    #$1F,d0
    
    loc_197F2:                ; CODE XREF: ROM:000197FAj
            move.l    (a1),(a2)+
            move.l    #$EEE0EEE,(a1)+
            dbf    d0,loc_197F2
            move.w    #0,-$3C(a1)
            move.b    #3,$1E(a0)
            rts   
    
    ; ��������������� S U B    R O U T    I N E ���������������������������������������
    
    
    LightningShield_Create_Spark:        ; CODE XREF: ROM:00019794p
            moveq    #1,d2
    ; End of function LightningShield_Create_Spark
    
    ; ���������������������������������������������������������������������������
    SparkVelocities:
            dc.w  $FE00, $FE00    ; DATA XREF: HyperSonic_Create_Sparko
            dc.w   $200, $FE00
            dc.w  $FE00,  $200
            dc.w   $200,  $200
    ; ���������������������������������������������������������������������������
    
    ; ===========================================================================
    ; Lightning Shield Sparkes
    ; ===========================================================================
    Obj04:
        jsr    (ObjectFall).l
        addi.w    #$18,y_vel(a0)
        lea    (Ani_LightningShield).l,a1
        jsr    (AnimateSprite).l
        tst.b    routine(a0)            ; Changed by Animate_Sprite
        bne.s    Obj04_Delete
        jmp    (DisplaySprite).l
    ; ---------------------------------------------------------------------------
    
    Obj04_Delete:
        jmp    (DeleteObject).l
    ; ===========================================================================
    Map_LighteningShield:
        include "_maps\LShield.asm"    ; Insta-Shield mappings
    DPLC_LighteningShield:
        include "_inc\DPLC - Lightning Shield.asm"    ; Insta-Shield DPLCs
    Ani_LightningShield:
        include "_anim\Anim - Lightning Shield S3.asm"        ; Insta-Shield animations
    ArtUnc_LighteningShield:        incbin    "artunc\LShield.bin"
            even   
    ArtUnc_LightningShield_Sparks:    incbin "artunc/lightningsparksart.bin"
                    even        
    Here is the code to replace the working insta shield with the lightning shield:

    Code:
    Sonic_InstaAndShieldMoves:
            tst.b    $2F(a0)
            bne.w    locret_134D2
            move.b    (Ctrl_1_Press_Logical).w,d0
            andi.b    #$70,d0
            beq.w    locret_134D2
            bclr    #4,$2A(a0)
            tst.b    ($FFFFFE19).w
            beq.s    Sonic_LightningShield
            bne.w    Sonic_RevertToNormal
            move.b    #1,$2F(a0)       
            move.w    #$B8,d0
            jsr    (PlaySound_Special).l ;    play Sonic rolling sound           
            rts
    ; ---------------------------------------------------------------------------
    
    Sonic_LightningShield:
            btst    #0,$2B(a0)
            beq.s    Sonic_InstaShield
            move.b    #1,$2F(a0)
            tst.b    ($FFFFFE2D).w
            bne.s    Shieldrts
            tst.b    ($FFFFFE2C).w
            bne.s    Shieldrts       
            move.b    #1,($FFFFD180+anim).w
            move.b    #1,double_jump_flag(a0)
            move.w    #-$580,y_vel(a0)    ; bounce Sonic up, creating the double jump effect
            clr.b    jumping(a0)
    After multiple, countless tries on going back and checking what I went wrong, I somehow ended up with the game crashing on this:

    lastitme.PNG

    I already added PLCLoad_Shields (which operates fine) and converted the mappings to Sonic 1, so I know that's not the issue. How do I fix these bugs to make it load so I know next time when adding the other shields?
     
  10. Cofahi

    Cofahi Newcomer Prospect

    Joined:
    Dec 14, 2018
    Messages:
    10
    Have you tried to change this:
    Code:
    loc_19720:               
            move.w    #1,$20(a0)
            move.b    #-1,$34(a0)
            move.l    #loc_19732,(a0) ; change this
    To this:
    Code:
    loc_19720:                ; CODE XREF: ROM:00019718j
            move.w    #1,$20(a0)
            move.b    #-1,$34(a0)
            ;move.l    #loc_19732,(a0) ; delete or comment this line
            addq.b    #2,$24(a0) ; This routine is present in all objects in the game
     
    DeltaWooloo likes this.
  11. RandomName

    RandomName Newcomer Member

    Joined:
    Jun 3, 2020
    Messages:
    10
    Location:
    Russia
    About 2 Question:
    These blue bars are part of foreground and they're seen, because they use sonic's pallete line, which is not faded. Simplest solution is to remove these bars in foreground blocks, because they're Always(IIRC) behind Sirene sprite.
     
    Cyber Axe and DeltaWooloo like this.
  12. DeltaWooloo

    DeltaWooloo A hacker, helper, friend and a Wooloo Member

    Joined:
    Aug 7, 2019
    Messages:
    228
    The bug has been fixed, thanks a lot @Cofahi.

    My next problem is, I was modifying the code so it can load the art but unfortunately, I was stuck on another error after trial and error.

    o no.PNG

    I was modifying this code in order for it to work.

    Code:
    Sonic_LightningShield:
            btst    #0,$2B(a0)
            beq.s    Sonic_InstaShield
            move.b    #1,($FFFFD180+anim).w       
            move.b    #1,$2F(a0)
            move.w    #-$580,y_vel(a0)   
            clr.b    jumping(a0)
    I don't know what is causing the bug as the code does look fine (and the constants are the same as Sonic 1). What is the best possible choice to fix this issue?
     
  13. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    45
    Location:
    Hidden Palace Zone, Westside Island
    What is the code of "objhitceiling"?
     
  14. DeltaWooloo

    DeltaWooloo A hacker, helper, friend and a Wooloo Member

    Joined:
    Aug 7, 2019
    Messages:
    228
    Code:
    ObjHitCeiling:
            move.w    $C(a0),d2
            move.w    8(a0),d3
            moveq    #0,d0
            move.b    $16(a0),d0
            ext.w    d0
            sub.w    d0,d2
            eori.w    #$F,d2
            lea    ($FFFFF768).w,a4
            movea.w    #-$10,a3
            move.w    #$0800,d6
            moveq    #$D,d5                    ; MJ: set solid type to check
            bsr.w    FindFloor                ; MJ: check solidity
            move.b    ($FFFFF768).w,d3
            btst    #0,d3
            beq.s    locret_14FD4
            move.b    #-$80,d3
    
    locret_14FD4:
            rts   
    ; End of function ObjHitCeiling
    @Inferno The code has been modified for it to work with Project 128.
     
  15. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    85
    Hi, I'm trying to get some bounce pad type objects running in Sonic 2.

    Right now I've sort of got them running, if in a crude way. To give them collision, I tapped them to the enemy collision flag and put their effects in the Touch_Enemy routine like so:

    Code:
          cmp.b #$E6,(a1)
            bne.s Touch_Fountain
         move.b    #1,anim(a1)
         bset    #2,status(a0)
         move.b    #$E,y_radius(a0)
         move.b    #7,x_radius(a0)
         move.b    #$10,anim(a0)
         clr.w    $12(a0)                    ; clear X-velocity to move sonic directly down
         move.w    #-$800,y_vel(a0)
         bset    #1,status(a0)
         bclr    #3,status(a0)
         move.b    #2,routine(a0)
    Touch_Flower_End:
         rts
    
    Touch_Fountain:
        .......
    This kinda works though unless bounced on from directly on top, they don't propel you effectively enough unless you hold the jump button. Any idea how to fix this?


    Also one more thing. I'm trying to make it so obj40 (the spring board object) only has collision from landing on top of it. I tried branching it to platformobject instead of solidobject but it only produces buggy effects. Any idea what to do?
     
  16. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    45
    Location:
    Hidden Palace Zone, Westside Island
    So, uh, sorry for the long post in advance, but I've hit a brick wall. Objects are deloading left and right. Now, this might sound just like an object placement issue, but I'd like to show something in order to prove that it's a bug, not on me.
    This is a video of SYZ1 in my hack currently:

    And here's SYZ1 in a complied ROM of ProjectFM's disasm where he ported over the S3 object and ring manager, which I used to port them over myself:

    I've spent the last few weeks trying to trace the issues down within the object and ring manager to no avail, so this is a last resort. I'm not exactly sure where the issue is, but I'm gonna just show the current object manager and ring manager code to start with. These are on Dropbox because my PC lacks internet, and I'd rather not retype the ENTIRETY of the managers.
    https://www.dropbox.com/s/luom5vy3pcamjsp/sub_ObjectPosLoad_S3.asm?dl=0
    https://www.dropbox.com/s/j1e08ux95a912nv/sub_RingsManager.asm?dl=0
    If you need anything else, let me know. Sorry for asking for help once more, but I'm completely confused as to how this behavior popped up.
     
    RandomName and ProjectFM like this.
  17. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    868
    Location:
    Portland, Maine
    I looked to me like the objects' respawn indexes didn't have bit 7 clear, meaning the game thought they were destroyed after they were initially spawned in. I believe the issue is that you didn't apply steps 2 and 3 of this tutorial. Reverting back MarkObjGone in my Sonic 3 Object Manager disassembly to Sonic 1's recreates this issue.
     
    Inferno likes this.
  18. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    45
    Location:
    Hidden Palace Zone, Westside Island
    Just checked MarkObjGone (or rather, it's Github equalivent, RememberState). I changed it. I made it exactly equalivent to the code in your work, and for some reason it doesn't work...

    Here's the state of RememberState:
    Code:
    RememberState:
          move.w obX(a0),d0
          andi.w $FF80,d0
          move.w (v_screenposx).w,d1
          subi.w #$80,d1
          andi.w $FF80,d1
          sub.w d1,d0
          cmpi.w #$280,d0
          bhi.w @offscreen
          bra.w DisplaySprite
    
       @offscreen:
          move.w obRespawnNo(a0),d0
          beq.w DeleteObject
          movea.w d0,a2
          bclr #7,(a2)
          bra.w DeleteObject
    I hoped it was as simple as me overlooking something, but it doesn't look as such. Is there anything else you can think of? I'm still clueless, but your reasoning of Bit 7 being improperly set and cleared sounds the most correct, this just doesn't seem to be the place of fault.
     
    ProjectFM likes this.
  19. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    868
    Location:
    Portland, Maine
    There are a lot more instances that need to be fixed. I just changed MarkObjGone because it was a quick way of seeing if I can emulate your results. Again, you should reference this guide.
     
    Inferno likes this.
  20. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    45
    Location:
    Hidden Palace Zone, Westside Island
    I just double-checked every instance of the calculations between your stuff and my project. I triple-checked. It's exactly as in your stuff. I'm not sure if it's there, because of the fact that this has also been showing up in every level, regardless of object type used, I just used SYZ as it was the best example.

    Any further suggestions? Apologies if this annoys you, this sort of engine work really isn't my best field in terms of ASM work.