Question about FPG theory
4 years ago
Kanagawa, Japan

I already know what inputs are required for FPG, but I could not reach for the reason why FPG works. Why is not the flag lowered when Mario grabs the flagpole clipping in the block?

Edited by the author 4 years ago
Germany

FlagpoleRoutine: ldx #$05 ;set enemy object offset stx ObjectOffset ;to special use slot lda Enemy_ID,x cmp #FlagpoleFlagObject ;if flagpole flag not found, bne ExitFlagP ;branch to leave lda GameEngineSubroutine cmp #$04 ;if flagpole slide routine not running, bne SkipScore ;branch to near the end of code lda Player_State cmp #$03 ;if player state not climbing, bne SkipScore ;branch to near the end of code lda Enemy_Y_Position,x ;check flagpole flag's vertical coordinate cmp #$aa ;if flagpole flag down to a certain point, bcs GiveFPScr ;branch to end the level lda Player_Y_Position ;check player's vertical coordinate cmp #$a2 ;if player down to a certain point, bcs GiveFPScr ;branch to end the level lda Enemy_YMF_Dummy,x adc #$ff ;add movement amount to dummy variable sta Enemy_YMF_Dummy,x ;save dummy variable lda Enemy_Y_Position,x ;get flag's vertical coordinate adc #$01 ;add 1 plus carry to move flag, and sta Enemy_Y_Position,x ;store vertical coordinate lda FlagpoleFNum_YMFDummy sec ;subtract movement amount from dummy variable sbc #$ff sta FlagpoleFNum_YMFDummy ;save dummy variable lda FlagpoleFNum_Y_Pos sbc #$01 ;subtract one plus borrow to move floatey number, sta FlagpoleFNum_Y_Pos ;and store vertical coordinate here SkipScore: jmp FPGfx ;jump to skip ahead and draw flag and floatey number GiveFPScr: ldy FlagpoleScore ;get score offset from earlier (when player touched flagpole) lda FlagpoleScoreMods,y ;get amount to award player points ldx FlagpoleScoreDigits,y ;get digit with which to award points sta DigitModifier,x ;store in digit modifier jsr AddToScore ;do sub to award player points depending on height of collision lda #$05 sta GameEngineSubroutine ;set to run end-of-level subroutine on next frame FPGfx: jsr GetEnemyOffscreenBits ;get offscreen information jsr RelativeEnemyPosition ;get relative coordinates jsr FlagpoleGfxHandler ;draw flagpole flag and floatey number ExitFlagP: rts

The critical part seems to be: lda Player_Y_Position ;check player's vertical coordinate cmp #$a2 ;if player down to a certain point, bcs GiveFPScr ;branch to end the level

Jack_Hase, sweatypiranha and 4 others like this
Game stats
Followers
7,810
Runs
8,824
Players
1,793
Latest news
Requirements for High-Level Any% Runs

Any% (NTSC) runs below 4:57.000 must now fulfill additional requirements in order to be verified.

  • The run's full session must be included in the submission description.
  • For emulator runs below 4:57.000, some form of input display must be visible for the duration of the run. A hand-cam or input
4 months ago