News
Welcome to NeoRHDN! This place is still a work-in-progress, so pardon the construction...

Chat on Discord
Views: 2,956,054
Main | Rules/FAQ | Discord | Memberlist | Latest posts | Stats | Ranks | Online users
03-07-26 06:51 AM
Guest: Register | Login

Main - Posts by SMB2J-2Q

Pages: 1 2 3

SMB2J-2Q
Posted on 01-26-26 03:19 AM, in Super Mario Bros. Fixes (rev. 4 of 01-26-26 03:41 AM by SMB2J-2Q) Link | ID: 1652

Red Goomba

Level: 12

Posts: 41/41
EXP: 6230
Next: 1691

Since: 08-21-24
From: Oak Grove, OR

Last post: 40 days
Last view: 39 days
In SMB2J (Lost Levels), what do you think of this fix to detect if we're on either World 8 or World D?

InitFinalWorldFlag:
lda #$00
sta FinalWorldFlag ;initialize final world flag to be incremented later
lda WorldNumber ;check world number
ldy HardWorldFlag ;also check if hard world mode is set
bne ChkWorldD ;if so, branch ahead
cmp #World8 ;otherwise check if we're on world 8
beq SetFWF ;and branch to set final world flag if so
ChkWorldD:
cmp #World4 ;branch here if hard world mode is on
bne SpriteShuffler ;if not on World D, branch to next sub
SetFWF: inc FinalWorldFlag ;set final world flag if we're in either World 8 or D


This flag will then come in handy for these subs in particular in both SMB2J and ANNSMB:

VictoryModeMain:
jsr VictoryModeSubroutines ;run victory mode subroutines in order
lda OperMode_Task ;if running bridge collapse subroutine
beq BrdgSkip ;then skip most of this
ldx FinalWorldFlag ;if not on World 8, don't bother
beq NotW8 ;to see which subroutine we're on
cmp #$05
beq VMExit ;if running disk subroutines, branch to leave
cmp #$0d ;because the screen will be blank during this
beq VMExit
NotW8: ldx #$00
stx ObjectOffset ;run code for a single enemy object
jsr EnemiesAndLoopsCore ;(either the mushroom retainer or door/princess)
BrdgSkip: jsr RelativePlayerPosition ;draw the player as usual
jmp PlayerGfxHandler

VictoryModeSubroutines:
lda FinalWorldFlag ;run different list of subroutines if on either world 8 or D
bne VMSubsForFinalWorld
lda OperMode_Task
jsr JumpEngine

.dw BridgeCollapse
.dw SetupVictoryMode
.dw PlayerVictoryWalk
.dw PrintVictoryMessages
.dw EndCastleAward
.dw EndWorld1Thru7

VMSubsForFinalWorld:
lda OperMode_Task
jsr JumpEngine

.dw BridgeCollapse
.dw SetupVictoryMode
.dw PlayerVictoryWalk
.dw StartVMDelay
.dw ContinueVMDelay
.dw VictoryModeDiskRoutines
.dw ScreenSubsForFinalRoom ;all these subs are in SM2DATA3
.dw PrintVictoryMsgsForWorld8
.dw EndCastleAward ;except this one
.dw AwardExtraLives
.dw FadeToBlue
.dw EraseLivesLines
.dw RunMushroomRetainers
.dw EndingDiskRoutines

and

VictoryMode:
...
lda HardWorldFlag ;are we playing Worlds A to D?
beq W1Thru8 ;if not, branch ahead
lda FinalWorldFlag ;otherwise check if we're doing World D
beq W1Thru8 ;if not, do same
inc FinalWorldFlag ;otherwise set flag to satisfy end of game condition for second set of victory mode subs
W1Thru8: lda #EndOfCastleMusic
sta EventMusicQueue


I also found a fix for the Buzzy Beetle for ANNSMB, when doing so while playing the Hard World mode (Worlds A to D). What we do instead is, while we are checking for Goombas, we check if the hard world flag is set first, and then if so, to make it branch to load the Buzzy Beetle directly:

BuzzyBeetleMutate:
cmp #Goomba ;if below $37, check for goomba
bne StrID ;value ($3f or more always fails)
ldy HardWorldFlag ;check if hard world mode flag (Worlds A-D) is set
bne GetBuzzyB ;if so, branch to change goomba to buzzy beetle
ldy PrimaryHardMode ;check if primary hard mode flag is set
beq StrID ;and if so, change goomba to buzzy beetle
GetBuzzyB: ;NEW LABEL to be redirected to if hard world flag is set
lda #BuzzyBeetle
StrID: sta Enemy_ID,x ;store enemy object number into buffer

and

HandleGroupEnemies:
ldy #$00 ;load value for green koopa troopa
sec
sbc #$37 ;subtract $37 from second byte read
pha ;save result in stack for now
cmp #$04 ;was byte in $3b-$3e range?
bcs SnglID ;if so, branch
pha ;save another copy to stack
ldy #Goomba ;load value for goomba enemy
lda HardWorldFlag ;if hard world flag (Worlds A-D) is set,
bne DoBuzzyB ;branch to change goomba to buzzy beetle, otherwise leave alone
lda PrimaryHardMode ;if primary hard mode flag not set,
beq PullID ;branch, otherwise change to value for buzzy beetle
DoBuzzyB: ;NEW LABEL to be redirected to if hard world flag is set
ldy #BuzzyBeetle
PullID: pla ;get second copy from stack


~Ben
Pages: 1 2 3


Main - Posts by SMB2J-2Q

Affiliates:


Acmlmboard v2.5.6+neo (2024-08-13)
© 2005-2026 Acmlm, Emuz, NinCollin, et al.

Page rendered in 0.042 seconds. (720KB of memory used)
MySQL - queries: 34, rows: 373/379, time: 0.037 seconds.