News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: SMB2J - wind from world 1-1  (Read 1697 times)

szemigi

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
SMB2J - wind from world 1-1
« on: March 13, 2020, 07:31:53 pm »
Hello! In the source code of SMB Lost Levels, how to make it so that I can have wind from World 1-1? I tried it with a little help, but I failed.


Help me!

DanielFA

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
Re: SMB2J - wind from world 1-1
« Reply #1 on: March 14, 2020, 08:29:17 pm »
Hi,

I'm new to ASM so this isn't going to be the most helpful answer... From my research for my own project, wind routines are located in sm2data2.asm (Worlds 5-8) and sm2data4.asm (Worlds A-D), both being compiled in side 2 of the FDS file by fdswrap.asm. That's the reason why wind is only available in those worlds, so I believe you must first add all the corresponding routines in sm2main.asm. Then, I guess you should modify this part of the code:

Code: [Select]
ProcELoop:    stx ObjectOffset           ;put incremented offset in X as enemy object offset
              jsr EnemiesAndLoopsCore    ;process enemy objects
              jsr FloateyNumbersRoutine  ;process floatey numbers
              inx
              cpx #$06                   ;do these two subroutines until the whole buffer is done
              bne ProcELoop
              jsr GetPlayerOffscreenBits ;get offscreen bits for player object
              jsr RelativePlayerPosition ;get relative coordinates for player object
              jsr PlayerGfxHandler       ;draw the player
              jsr BlockObjMT_Updater     ;replace block objects with metatiles if necessary
              ldx #$01
              stx ObjectOffset           ;set offset for second
              jsr BlockObjectsCore       ;process second block object
              dex
              stx ObjectOffset           ;set offset for first
              jsr BlockObjectsCore       ;process first block object
              jsr MiscObjectsCore        ;process misc objects (hammer, jumping coins)
              jsr ProcessCannons         ;process bullet bill cannons
              jsr ProcessWhirlpools      ;process whirlpools
              jsr FlagpoleRoutine        ;process the flagpole
              jsr RunGameTimer           ;count down the game timer
              jsr ColorRotation          ;cycle one of the background colors
        → → → lda FileListNumber
        → → → beq NoWind                 ;if in worlds 1-4, skip ahead
              jsr SimulateWind           ;otherwise, simulate wind where needed

Here are the values FileListNumber can take:

Code: [Select]
LoadWorlds5Thru8:
      lda WorldNumber       ;if in worlds 1-4 or A-D
      cmp #World5           ;then leave without loading anything
      bcc ResetDiskIOTask
      lda FileListNumber    ;if worlds 5-8 were already loaded, leave
      bne ResetDiskIOTask   ;as there's no need to load anything
→ → → lda #$01
→ → → sta FileListNumber    ;otherwise set filelist number to load SM2DATA2
      jsr LoadFiles         ;and load it
      bne ReturnedError     ;if returned with error number, branch
      jsr CheckFileCount    ;check to see if loaded the correct number of files
      bne BadFileCount      ;if not, branch to return error 40/$32

Code: [Select]
LoadHardWorlds:
         lda HardWorldFlag         ;if this is not set, skip this
         beq NoLoadHW
   → → → lda #$03
   → → → sta FileListNumber        ;set filelist number to load SM2DATA4
         jsr LoadFiles
         bne ReturnedError         ;if returned with error number, branch
         jsr CheckFileCount        ;check to see if loaded the correct number of files
         bne BadFileCount          ;if not, branch to set error code

I don't know right now how to actually make it work but maybe if I put myself to work this week I could give you the solution...  :)




« Last Edit: March 14, 2020, 09:08:10 pm by DanielFA »

szemigi

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: SMB2J - wind from world 1-1
« Reply #2 on: March 14, 2020, 09:52:30 pm »
Make it work for me, until that I give a try and then let's see which of us had result. :D

DanielFA

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
Re: SMB2J - wind from world 1-1
« Reply #3 on: March 19, 2020, 08:04:41 pm »
Just made some progress on this yesterday but no success so far...

szemigi

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: SMB2J - wind from world 1-1
« Reply #4 on: March 20, 2020, 05:44:56 am »
No problem, just do what you can do.