+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  SMB jump spring platform flips randomly - why?
Pages: [1]
Author Topic: SMB jump spring platform flips randomly - why?  (Read 192 times)
frantik
Guest
« on: December 14, 2007, 09:53:46 pm »

Anybody have any insight into why the jump spring platform in Super Mario Bros is sometimes rendered backwards and sometimes forwards?  Normally it doesn't matter because the default object is symmetrical but if you change the tiles then it's quite noticeable.  There is a specific section of code which handles the flipping for the block but disabling the flipping there doesn't prevent the tiles from being flipped somewhere else  :banghead:

Quote
CheckToMirrorJSpring:
      lda $ef                     ;check for jumpspring object (any frame)
      cmp #$18
      bcc SprObjectOffscrChk      ;branch if not jumpspring object at all
      lda #$82
      sta Sprite_Attributes+8,y   ;set vertical flip and palette bits of
      sta Sprite_Attributes+16,y  ;second and third row left sprites
      ora #%01000000
      sta Sprite_Attributes+12,y  ;set, in addition to those, horizontal flip
      sta Sprite_Attributes+20,y  ;for second and third row right sprites

disabling the flipping there doesn't stop the flipping elsewhere Sad  the tiles are already drawn at that point, sometimes forwards sometimes backwards.




[edit:  i see why.. the object doesn't set an sprite direction so it just uses the value that was there.  grrrr]

[edit2: and never mind i 'solved' it or at least kludged/hacked it to make it stop flipping..

Quote
CheckForJumpspring:                                                                   
      cmp #JumpspringObject        ;check for jumpspring object                       
      bne CheckForPodoboo                                                             
      ldy #$03                     ;set enemy state -2 MSB here for jumpspring object
      ldx JumpspringAnimCtrl       ;get current frame number for jumpspring object   
      lda JumpspringFrameOffsets,x ;load data using frame number as offset           

changing ldy #$03   to sty $03 will make it stop flipping.  Y is always 00 and $03 is a temporary variable for the sprite direction.  since you're not loading #03 into Y the top left tile will no longer be flipped either but whatever that just makes it cleaner in the CHR-ROM.  If you disable the rest of the flipping in the code I first quoted you can put the tiles in the CHR-ROM exactly how they appear in the game, not all flipped around and stuff.
« Last Edit: December 15, 2007, 03:22:27 am by frantik »
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC