Re: Sprite Noob Question
Posted: Thu Apr 16, 2015 4:03 pm
I partially fixed it, it was a "hack".
Anyway i have found this too:

Anyway i have found this too:
Yes, it is important to fix the rendering without changing the logic behind it. However I understand that this is difficult to do for emulators where the rendering is done directly by the PPU module.tepples wrote:It turns out this bug in SMB1 isn't easily fixable, as the fix ShaneM tried caused the player to get stuck in the wall when attempting the walk through walls glitch. He had to back out the fix.
tepples wrote:It turns out this bug in SMB1 isn't easily fixable, as the fix ShaneM tried caused the player to get stuck in the wall when attempting the walk through walls glitch. He had to back out the fix.
Code: Select all
LDY Player_OffscreenBits,
CPY #$F0 ;are we at a specific point at the left of the screen?
BCS ImpedePlayerMove ;if so, branchCode: Select all
RenderPlayerSub:
sta $07 ;store number of rows of sprites to draw
ldy Player_Rel_XPos ;SHANEM CODE
cpy #$FF ;SHANEM CODE
bne label ;SHANEM CODE
iny ;SHANEM CODE
label: sty Player_Pos_ForScroll ;SHANEM CODE store player's relative horizontal position
sty $05 ;store it here also
lda Player_Rel_YPos
sta $02 ;store player's vertical position
lda PlayerFacingDir
sta $03 ;store player's facing direction
lda Player_SprAttrib
sta $04 ;store player's sprite attributes
ldx PlayerGfxOffset ;load graphics table offset
ldy Player_SprDataOffset ;get player's sprite data offsetCode: Select all
RenderPlayerSub:
sta $07 ;store number of rows of sprites to draw
ldy Player_Rel_XPos ;SHANEM CODE
cpy #$FD ;SHANEM CODE SMB:TLL different
bcc label ;SHANEM CODE SMB:TLL different
ldy #$00 ;SHANEM CODE SMB:TLL different
label: sty Player_Pos_ForScroll ;SHANEM CODE store player's relative horizontal position
sty $05 ;store it here also
lda Player_Rel_YPos
sta $02 ;store player's vertical position
lda PlayerFacingDir
sta $03 ;store player's facing direction
lda Player_SprAttrib
sta $04 ;store player's sprite attributes
ldx PlayerGfxOffset ;load graphics table offset
ldy Player_SprDataOffset ;get player's sprite data offsetCode: Select all
;original
ProcessPlayerAction:
lda Player_State ;get player's state
cmp #$03
beq ActionClimbing ;if climbing, branch here
cmp #$02
beq ActionFalling ;if falling, branch here
cmp #$01
bne ProcOnGroundActs ;if not jumping, branch here
;optimized
RenderPlayerSub:
lda Player_State ;get player's state
beq ProcOnGroundActs ;if not jumping, branch here
cmp #$03
beq ActionClimbing ;if climbing, branch here
cmp #$02
beq ActionFalling ;if falling, branch here
;saves 2 bytes of PRG