From b2942cd6357d4afa8c36cdb0b38e9340e71259c1 Mon Sep 17 00:00:00 2001 From: Pepperpow Date: Sun, 21 Jun 2020 20:50:20 -0500 Subject: [PATCH] landmark commit #3 --- smb2-custom.chr | Bin 131072 -> 131072 bytes src/extras/char-switch-overworld.asm | 34 +++ src/extras/controller-2-3-debug.asm | 115 +++++++++ src/extras/custom-player-render.asm | 5 + src/extras/flag-set.asm | 66 +---- src/extras/health-revamp-3.asm | 13 +- src/extras/jump-attack.asm | 53 ++++ src/extras/jump-routine-bonus.asm | 64 +++++ src/extras/lose-a-life-independent-check.asm | 17 ++ src/extras/player-defines.asm | 57 ++++- src/extras/player-mods.asm | 31 +-- src/extras/player-stuff.asm | 235 +++++++++++------- src/extras/power-throw-logic.asm | 34 +++ src/prg-0-1.asm | 247 ++++++++++--------- src/prg-2-3.asm | 121 +-------- src/prg-c-d.asm | 35 +++ src/prg-e-f.asm | 71 +++++- 17 files changed, 789 insertions(+), 409 deletions(-) create mode 100644 src/extras/char-switch-overworld.asm create mode 100644 src/extras/controller-2-3-debug.asm create mode 100644 src/extras/jump-attack.asm create mode 100644 src/extras/jump-routine-bonus.asm create mode 100644 src/extras/lose-a-life-independent-check.asm create mode 100644 src/extras/power-throw-logic.asm diff --git a/smb2-custom.chr b/smb2-custom.chr index 6b1ca69757f58798054ad564ccd3bba19513ff42..bc22e35dfa2596c4d42157c433267e275025d1d3 100644 GIT binary patch delta 55 zcmV-70LcG|o{^cEonO|Pfsu)cg+oZCK04f4TZE6%Atj^6MxLLMfuW({z=s=u lK(vE_2Fty7-`@SXVemjnh)Ybw;=_aH1E;qiIL+u_0szqO9HsyO diff --git a/src/extras/char-switch-overworld.asm b/src/extras/char-switch-overworld.asm new file mode 100644 index 00000000..f56ef34b --- /dev/null +++ b/src/extras/char-switch-overworld.asm @@ -0,0 +1,34 @@ + +HandlePlayer_ChangeChar: ; make this less dumb + LDA CharSelectAnytime + BEQ ++ + LDA PlayerInAir + BNE + + LDA Player1JoypadHeld + AND #ControllerInput_Select + BEQ + + LDA Player1JoypadPress + AND #ControllerInput_Left + BEQ ++ +- INC CurrentCharacter + JSR ChkToNextValidCharacter + BNE - + BEQ + +++ + LDA Player1JoypadPress + AND #ControllerInput_Right + BEQ + +- DEC CurrentCharacter + JSR ChkToNextValidCharacter + BNE - ++ + LDA CurrentCharacter + CMP PreviousCharacter + BEQ ++ + STA PreviousCharacter + LDA PlayerCurrentSize + EOR #$1 + STA PlayerCurrentSize + JSR CustomCopyChar +++ + RTS \ No newline at end of file diff --git a/src/extras/controller-2-3-debug.asm b/src/extras/controller-2-3-debug.asm new file mode 100644 index 00000000..adc90eea --- /dev/null +++ b/src/extras/controller-2-3-debug.asm @@ -0,0 +1,115 @@ + +; Copies all character stats to RAM for hot-swapping the current character +; +CopyCarryYOffsets: + LDX #(AreaMainRoutine - CarryYOffsets - 1) +CopyCarryYOffsets_Loop: + LDA CarryYOffsets, X + STA CarryYOffsetsRAM, X + DEX + BPL CopyCarryYOffsets_Loop + + RTS + +AreaDebugRoutine: + LDA CreateObjectType + BEQ AreaDebugRoutine_Exit + + JSR DebugCreateObject + +AreaDebugRoutine_Exit: + RTS + +; +; Input +; CreateObjectType = object type +; +DebugCreateObject: + JSR CreateEnemy + + BMI AreaDebugRoutine_Exit + + LDX byte_RAM_0 + LDA CreateObjectType + STA ObjectType, X + LDA ScreenBoundaryLeftLo + ADC #$80 + STA ObjectXLo, X + LDA ScreenBoundaryLeftHi + ADC #$00 + STA ObjectXHi, X + LDA ScreenYLo + STA ObjectYLo, X + LDA ScreenYHi + ADC #$00 + STA ObjectYHi, X + + JSR InitializeEnemy + + LDA CreateObjectAttributes + BEQ DebugCreateObject_ClearObjectType + +DebugCreateObject_ObjectCarried: + ROL CreateObjectAttributes + BCC DebugCreateObject_ObjectTimer + + LDA #$01 + STA HoldingItem + STA ObjectBeingCarriedTimer, X + STX ObjectBeingCarriedIndex + + LDA #SoundEffect1_CherryGet + STA SoundEffectQueue1 + +DebugCreateObject_ObjectTimer: + ROL CreateObjectAttributes + BCC DebugCreateObject_ObjectBottomScreen + + LDA #$FF + STA EnemyTimer, X + +DebugCreateObject_ObjectBottomScreen: + ROL CreateObjectAttributes + BCC DebugCreateObject_Bit4 + + LDA ObjectYLo, X + CLC + ADC #$E0 + STA ObjectYLo, X + LDA ObjectYHi, X + ADC #$00 + STA ObjectYHi, X + +DebugCreateObject_Bit4: + ROL CreateObjectAttributes + BCC DebugCreateObject_Bit3 + +DebugCreateObject_Bit3: + ROL CreateObjectAttributes + BCC DebugCreateObject_Bit2 + +DebugCreateObject_Bit2: + ROL CreateObjectAttributes + BCC DebugCreateObject_ObjectThrown + +DebugCreateObject_ObjectThrown: + ROL CreateObjectAttributes + BCC DebugCreateObject_ObjectNoVelocityReset + + LDA #$01 + STA EnemyArray_42F, X + +DebugCreateObject_ObjectNoVelocityReset: + ROL CreateObjectAttributes + BCS DebugCreateObject_ClearObjectType + + LDA #$00 + STA ObjectXVelocity, X + STA ObjectYVelocity, X + +DebugCreateObject_ClearObjectType: + LDA #$00 + STA CreateObjectType + +DebugCreateObject_Exit: + RTS \ No newline at end of file diff --git a/src/extras/custom-player-render.asm b/src/extras/custom-player-render.asm index d5d2517f..8294cdf8 100644 --- a/src/extras/custom-player-render.asm +++ b/src/extras/custom-player-render.asm @@ -521,6 +521,11 @@ CharacterExtraSheets: .db $3D .db $3E .db $3F +CharacterExtraSheetsSmall: + .db $80 + .db $81 + .db $82 + .db $83 ExtraFramesOne: .db $FB, $FB .db $FB, $FB diff --git a/src/extras/flag-set.asm b/src/extras/flag-set.asm index 78c4239d..23295ddd 100644 --- a/src/extras/flag-set.asm +++ b/src/extras/flag-set.asm @@ -1,49 +1,5 @@ ; Flag Set ; Takes PTR, -Level_Bit_Flags = $7300 -World_Bit_Flags = $73D2 -Level_Count_Discovery = $73E0 -Level_Count_MushCount = $73E1 -Level_Count_Coins = $73E2 -Level_Count_1ups = $73E3 -Level_Count_SubspaceVisits = $73E4 -Level_Count_Unlocks = $73E5 -Level_Count_BigKill = $73E6 -Level_Count_KillCnt = $73E6 -Level_Count_LivesLost = $73E7 -Level_Count_Crystals = $73E8 -Level_Count_Cherries = $73E9 -World_Count_Bosses = $73EF -CurrentLevelAreaIndex = $73F0 -StatPrintOffset = $73F1 -StatPrintCurOffset = $73F2 -StatPrintDec = $73F3 -StatPrintDecRow = $73F4 - -PlayerIndependentLives = $73F8 -PlayerIndependentMaxHealth = $73FC - -CustomBitFlag_Boss_Defeated = %00000010 - -CustomBitFlag_Visited = %00000001 -CustomBitFlag_Mush1 = %00000010 -CustomBitFlag_Mush2 = %00000100 -CustomBitFlag_1up = %00001000 -CustomBitFlag_Sub1 = %00010000 -CustomBitFlag_Sub2 = %00100000 -CustomBitFlag_Key = %01000000 -CustomBitFlag_Crystal = %10000000 - -CustomCharFlag_Shrinking = %00000001 -CustomCharFlag_Running = %00000010 -CustomCharFlag_Fluttering = %00000100 -CustomCharFlag_PeachWalk = %00001000 -CustomCharFlag_WeaponCherry = %00010000 -CustomCharFlag_StoreCherry = %00100000 -CustomCharFlag_AirControl = %01000000 -CustomCharFlag_WideSprite = %10000000 - -CustomCharFlag_StandStill = %00000001 DokiMode: .db %0011 ;; doki @@ -95,26 +51,16 @@ AccelReduction: .db $0 .db $0 .db $0 -GBreaker: - .db $0 ;; gbreak -DebugSet: - .db $1 ;; debug -ResetHealth: - .db $06 ;; reset health (after slots/boss) -StartHealth: - .db $08 ;; start health MaxedHealth: .db $ff ;; maxed health IndependentLives: - .db $1 ;; elimination mode + .db $0 ;; elimination mode IndependentPlayers: .db $0 ;; powerups per player CharSelectDeath: .db $1 ;; select death (0, no select, 1, always select, 2, random select) CharSelectAnytime: .db $1 ;; select death -FluteVisit: - .db $0 BossMushroom: .db $1 ;; select death StartingInventory: @@ -130,6 +76,10 @@ StartingInventory: .db $0 ;; select death .db $0 ;; select death .db $0 ;; select death +StartingEquipment: + .db $0 ;; select death + .db $0 ;; select death + .db $0 ;; select death StartingProjectile: .db $0 ;; select death .db $0 ;; select death @@ -148,9 +98,11 @@ RescueCondition: .db $0 ;; ok WinLevel: .db $FF ;; bosses +FreeHealth: + .db $00 ChampionChance: .db $10 -CharLockVar: +CharacterInitialLock: .BYTE 0 BonusChanceText_PUSH_OTHER_BUTTON: @@ -561,7 +513,7 @@ CharSelectInitialize: LDA CharacterLock_Variable ; check lock var, if 0 load new var CMP #$F BNE + - LDA CharLockVar + LDA CharacterInitialLock STA CharacterLock_Variable + RTS diff --git a/src/extras/health-revamp-3.asm b/src/extras/health-revamp-3.asm index c720d7a7..dc79627e 100644 --- a/src/extras/health-revamp-3.asm +++ b/src/extras/health-revamp-3.asm @@ -5,12 +5,13 @@ NewHealthRender: PHA LDA PlayerHealth BEQ ++ -; LDX ProjectileType -; LDA ProjectileTileHealth, X -; STA SpriteDMAArea + 1, Y -; PLA -; TAX -; JMP +++ + LDA CherryCount + BEQ ++ + LDA #$a1 + STA SpriteDMAArea + 1, Y + PLA + TAX + JMP +++ ++ PLA TAX DrawHealthPip: diff --git a/src/extras/jump-attack.asm b/src/extras/jump-attack.asm new file mode 100644 index 00000000..c69f8166 --- /dev/null +++ b/src/extras/jump-attack.asm @@ -0,0 +1,53 @@ +JumpAttack: + LDA PlayerYVelocity + BMI + + CMP #$10 + BCC + + JSR LoadFlagPlayer3 + LDY CurrentCharacter + LDA ($c5), Y + AND #CustomBitFlag_BounceAll + BNE +ok + LDA ($c5), Y + AND #CustomBitFlag_BounceJump + BEQ +o + LDA PlayerAnimationFrame + CMP #SpriteAnimation_Jumping + BEQ +ok + JMP + ++o + LDA ($c5), Y + AND #CustomBitFlag_GroundPound + BEQ +o + LDA Player1JoypadHeld + AND #ControllerInput_Down + BEQ + + LDA CrushTimer + CMP #$08 + BCS +ok + LDA #$0 + STA CrushTimer + JMP + ++o + JMP + ++ok + LDA #$0 + STA CrushTimer + LDA Player1JoypadHeld + AND #ControllerInput_A + BEQ ++ + LDA #$A0 + STA PlayerYVelocity + BNE +++ +++ LDA #$C0 + STA PlayerYVelocity ++++ LDX byte_RAM_12 + INX + LDY #$14 + JSR DamageEnemySingle + LDX byte_RAM_ED + PLA + PLA + RTS ++ + RTS diff --git a/src/extras/jump-routine-bonus.asm b/src/extras/jump-routine-bonus.asm new file mode 100644 index 00000000..87732666 --- /dev/null +++ b/src/extras/jump-routine-bonus.asm @@ -0,0 +1,64 @@ + + LDA Player1JoypadPress + BPL +++ ; branch if not pressing A Button + LDA PlayerInAir + CMP #1 + BCC +++ + CMP #2 + BEQ + + LDX #CustomBitFlag_AirHop + JSR ChkFlagPlayer2 + BNE + + LDA HoldingItem + BEQ + + JSR SkipToThrowCheck + LDA HoldingItem + BNE + + LDA #$0 + STA ObjectXVelocity, X + LDA #$20 + STA ObjectYVelocity, X + INC PlayerInAir + JSR PlayerStartJump + LDA #SoundEffect2_Jump + STA SoundEffectQueue2 + LDA Player1JoypadPress + EOR #ControllerInput_A + STA Player1JoypadPress + JMP +++ ++ + LDX #CustomBitFlag_SpaceJump + JSR ChkFlagPlayer3 + BNE + + LDA PlayerYVelocity + BMI + + LDA PlayerYVelocity + CMP #$30 + BCS + + JSR PlayerStartJump + INC PlayerInAir + LDA #SoundEffect2_Jump + STA SoundEffectQueue2 + LDA Player1JoypadPress + EOR #ControllerInput_A + STA Player1JoypadPress + JMP +++ ++ + LDX #CustomBitFlag_KirbyJump + JSR ChkFlagPlayer3 + BNE +++ + JSR PlayerStartJump + INC PlayerInAir + LDA PlayerYVelocity + ASL + ROR PlayerYVelocity + LDA #SoundEffect2_Jump + STA SoundEffectQueue2 + LDA Player1JoypadPress + EOR #ControllerInput_A + STA Player1JoypadPress + JMP +++ ++++ + JSR Player_FloatJump + JSR Player_GroundPound + LDA PlayerInAir \ No newline at end of file diff --git a/src/extras/lose-a-life-independent-check.asm b/src/extras/lose-a-life-independent-check.asm new file mode 100644 index 00000000..36d2bdf1 --- /dev/null +++ b/src/extras/lose-a-life-independent-check.asm @@ -0,0 +1,17 @@ + + LDX IndependentLives + BEQ + + LDX CurrentCharacter + DEC PlayerIndependentLives, X + LDA PlayerIndependentLives, X + STA ExtraLives + BNE ++ + LDA CharLookupTable, X + ORA CharacterLock_Variable + STA CharacterLock_Variable + CMP #$F + BNE ++ + INY + JMP SetGameModeAfterDeath ++ LDA ExtraLives +++ \ No newline at end of file diff --git a/src/extras/player-defines.asm b/src/extras/player-defines.asm index cb02011d..18b6e977 100644 --- a/src/extras/player-defines.asm +++ b/src/extras/player-defines.asm @@ -3,6 +3,51 @@ CustomSolid = $77a0 CharacterLock_Variable = $7610 PlayerIntermediateValue = $76cd +Level_Bit_Flags = $7300 +World_Bit_Flags = $73D2 +Level_Count_Discovery = $73E0 +Level_Count_MushCount = $73E1 +Level_Count_Coins = $73E2 +Level_Count_1ups = $73E3 +Level_Count_SubspaceVisits = $73E4 +Level_Count_Unlocks = $73E5 +Level_Count_BigKill = $73E6 +Level_Count_KillCnt = $73E6 +Level_Count_LivesLost = $73E7 +Level_Count_Crystals = $73E8 +Level_Count_Cherries = $73E9 +World_Count_Bosses = $73EF +CurrentLevelAreaIndex = $73F0 +StatPrintOffset = $73F1 +StatPrintCurOffset = $73F2 +StatPrintDec = $73F3 +StatPrintDecRow = $73F4 + +PlayerIndependentLives = $73F8 +PlayerIndependentMaxHealth = $73FC + +CustomBitFlag_Boss_Defeated = %00000010 + +CustomBitFlag_Visited = %00000001 +CustomBitFlag_Mush1 = %00000010 +CustomBitFlag_Mush2 = %00000100 +CustomBitFlag_1up = %00001000 +CustomBitFlag_Sub1 = %00010000 +CustomBitFlag_Sub2 = %00100000 +CustomBitFlag_Key = %01000000 +CustomBitFlag_Crystal = %10000000 + +CustomCharFlag_Shrinking = %00000001 +CustomCharFlag_Running = %00000010 +CustomCharFlag_Fluttering = %00000100 +CustomCharFlag_PeachWalk = %00001000 +CustomCharFlag_WeaponCherry = %00010000 +CustomCharFlag_StoreCherry = %00100000 +CustomCharFlag_AirControl = %01000000 +CustomCharFlag_WideSprite = %10000000 + +CustomCharFlag_StandStill = %00000001 + PlayerLevelPowerup_1 = $7600 PlayerLevelPowerup_2 = $7601 @@ -31,8 +76,8 @@ CrushTimer = $76F7 MushroomFragments = $76F8 SpriteTableCustom1 = $7700 SpriteTableCustom2 = $7780 -LastWarpLoc = $7D0E -LastMusicChoice = $7D0F +PlayerInventory = $7D00 +ReplaceItemSlot = $7D0F ShopInfo = $7D10 WarpDestinationRam = $76cd @@ -46,7 +91,7 @@ GameMode_Shop = #GameMode_Warp + 2 CustomBitFlag_PowerThrow = %00000001 CustomBitFlag_PowerCharge = %00000010 -CustomBitFlag_PowerWalk = %00000100 +CustomBitFlag_PowerGrip = %00000100 CustomBitFlag_StoreItem = %00001000 CustomBitFlag_FallDefense = %00010000 CustomBitFlag_ImmuneFire = %00100000 @@ -58,8 +103,8 @@ CustomBitFlag_HiJumpBoot = %00000010 CustomBitFlag_FloatBoots = %00000100 CustomBitFlag_MasterKey = %00001000 CustomBitFlag_AirHop = %00010000 -CustomBitFlag_WarpWhistle = %00100000 -CustomBitFlag_WarpSigil = %00100000 +CustomBitFlag_BombGlove = %00100000 +CustomBitFlag_EggGlove = %01000000 CustomBitFlag_Map = %10000000 CustomBitFlag_KirbyJump = %00000001 @@ -69,4 +114,4 @@ CustomBitFlag_BounceJump = %00001000 CustomBitFlag_BounceAll = %00010000 CustomBitFlag_GroundPound = %00100000 CustomBitFlag_WallCling = %01000000 -CustomBitFlag_WallJump = %10000000 +CustomBitFlag_WallJump = %10000000 \ No newline at end of file diff --git a/src/extras/player-mods.asm b/src/extras/player-mods.asm index 7c56d5ad..864811d1 100644 --- a/src/extras/player-mods.asm +++ b/src/extras/player-mods.asm @@ -1,31 +1,5 @@ ;; future proof this file by adding extended tables and space for external abilities ;; place "ability checks" in places where applicable, as easy injection sites -CustomBitFlag_PowerThrow = %00000001 -CustomBitFlag_PowerCharge = %00000010 -CustomBitFlag_PowerWalk = %00000100 -CustomBitFlag_StoreItem = %00001000 -CustomBitFlag_FallDefense = %00010000 -CustomBitFlag_ImmuneFire = %00100000 -CustomBitFlag_ImmuneElec = %01000000 -CustomBitFlag_Secret = %10000000 - -CustomBitFlag_AllTerrain = %00000001 -CustomBitFlag_HiJumpBoot = %00000010 -CustomBitFlag_FloatBoots = %00000100 -CustomBitFlag_MasterKey = %00001000 -CustomBitFlag_AirHop = %00010000 -CustomBitFlag_BombGlove = %00100000 -CustomBitFlag_EggGlove = %01000000 -CustomBitFlag_Map = %10000000 - -CustomBitFlag_KirbyJump = %00000001 -CustomBitFlag_Grapple = %00000010 -CustomBitFlag_SpaceJump = %00000100 -CustomBitFlag_BounceJump = %00001000 -CustomBitFlag_BounceAll = %00010000 -CustomBitFlag_GroundPound = %00100000 -CustomBitFlag_WallCling = %01000000 -CustomBitFlag_WallJump = %10000000 CheckMaxHealth: LDA PlayerMaxHealth @@ -53,7 +27,7 @@ Player_PowerWalkInvincibility: LDY CrouchJumpTimer CPY #$3C BNE + - LDX #CustomBitFlag_PowerWalk + LDX #CustomBitFlag_PowerGrip LDA #$0 JSR ChkFlagPlayer BNE + @@ -69,6 +43,9 @@ Player_PowerWalkInvincibility: Player_HiJump: LDX #CustomBitFlag_HiJumpBoot JSR ChkFlagPlayer2 + BNE + + LDA Player1JoypadHeld ; holding jump button to fight physics + AND #ControllerInput_Down BNE + LDA PlayerYVelocity SBC #$10 diff --git a/src/extras/player-stuff.asm b/src/extras/player-stuff.asm index 3d38db61..ac899646 100644 --- a/src/extras/player-stuff.asm +++ b/src/extras/player-stuff.asm @@ -16,14 +16,29 @@ ChampSet: + CMP ChampionChance BCS ++ + INC EnemyHP, X LDA #ObjAttrib_Palette3 EOR ObjectAttributes, X STA ObjectAttributes, X +IFDEF CUSTOM_MUSH LDA EnemyArray_46E_Data, Y - ORA #$42 + EOR #$40 + STA EnemyArray_46E, X + TXA + PHA + LDX #CustomBitFlag_PowerGrip + JSR ChkFlagPlayer + BNE + + PLA + TAX + RTS ++ + PLA + TAX +ENDIF + LDA EnemyArray_46E, X + ORA #$02 STA EnemyArray_46E, X - INC EnemyHP, X - SEC RTS ++ RTS @@ -147,22 +162,23 @@ ProcessCustomPowerupAward_NoLookup: JSR JumpToTableAfterJump .dw Normal_Mushroom_BEH ; Mushroom - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag - .dw CustomBeh_Flag2 - .dw CustomBeh_Flag2 - .dw CustomBeh_Flag2 - .dw CustomBeh_Flag2 ;;key - .dw CustomBeh_Flag2 - .dw CustomBeh_Flag2 - .dw Normal_Mushroom_BEH - .dw Normal_Mushroom_BEH + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem ; wow + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem + .dw PlaceInventoryItem ; mushinventory ; .dw CustomBeh_Fireball ; $11 ; .dw CustomBeh_Egg ; $12 ; .dw CustomBeh_Bomb @@ -184,6 +200,102 @@ ProcessCustomPowerupAward_NoLookup: ; JSR RemoveFromPlayfield ; JSR PlayMushGet ; RTS +PlaceInventoryItem: + TXA + LDY #$FF +- INY + CPY #$3 + BEQ PlaceInventoryItem_Full + LDA PlayerInventory, Y + BNE - + TXA + STA PlayerInventory, Y + CMP #$11 ; undo mushroom, make this less specific + BNE + + JSR Normal_Mushroom_BEH ++ + BNE ResetPlayerAbility + +PlaceInventoryItem_Full: + LDY ReplaceItemSlot + CPY #$3 + BCC + + LDY #$0 + + + LDA PlayerInventory, Y + PHA + TXA + STA PlayerInventory, Y + CMP #$11 ; add mushroom, make this less specific + BNE + + JSR Normal_Mushroom_BEH ++ + PLA + CMP #$11 ; undo mushroom, make this less specific + BNE + + DEC PlayerMaxHealth + PHA + JSR RestorePlayerToFullHealth + PLA ++ + INY + STY ReplaceItemSlot + PHA + JSR ProcessCustomPowerup_NoLookup + LDX byte_RAM_12 + LDA #EnemyState_Alive + STA EnemyState, X + LDA #Enemy_Mushroom + STA ObjectType, X + LDA #$D0 + STA ObjectYVelocity, X + STA SubspaceTimer + LDA EnemyVariable, X + TAY + PLA + STA MushroomEffect, Y +; this sucks this sucks applying a flag uses every register!! ahhH +ResetPlayerAbility: + LDY #$8 + LDA #$0 +- DEY + STA Player_Bit_Flags, Y + BNE - + LDX PlayerInventory + JSR ApplyPlayerAbility + LDX PlayerInventory + 1 + JSR ApplyPlayerAbility + LDX PlayerInventory + 2 + JSR ApplyPlayerAbility + RTS + +ApplyPlayerAbility: + BEQ ++ + CPX #$8 + BCS + + JSR CustomBeh_Flag + RTS ++ CPX #$11 + BNE + + ; INC PlayerMaxHealth + BEQ ++ ++ JSR CustomBeh_Flag2 +++ RTS + +LoadStartingInventory: + LDY #$0 +- LDA StartingEquipment, Y + STA PlayerInventory, Y + CMP #$11 ; add mushroom, make this less specific + BNE + + JSR Normal_Mushroom_BEH ++ INY + CPY #$3 + BNE - + JSR ResetPlayerAbility + RTS + + CustomBeh_Mushroom_Fragment: INC MushroomFragments @@ -213,7 +325,7 @@ Normal_Mushroom_BEH: BMI ++ INC PlayerMaxHealth INC Level_Count_MushCount - JSR RemoveFromPlayfield + ;JSR RemoveFromPlayfield LDA PlayerMaxHealth CMP MaxedHealth BCC + @@ -259,7 +371,6 @@ CustomBeh_Flag: JSR ShiftBit TAX JSR ApplyFlagPlayer - JSR RemoveFromPlayfield RTS CustomBeh_Flag2: @@ -269,64 +380,8 @@ CustomBeh_Flag2: JSR ShiftBit TAX JSR ApplyFlagPlayer2 - JSR RemoveFromPlayfield RTS -JumpAttack: - LDA PlayerYVelocity - BMI + - CMP #$10 - BCC + - JSR LoadFlagPlayer3 - LDY CurrentCharacter - LDA ($c5), Y - AND #CustomBitFlag_BounceAll - BNE +ok - LDA ($c5), Y - AND #CustomBitFlag_BounceJump - BEQ +o - LDA PlayerAnimationFrame - CMP #SpriteAnimation_Jumping - BEQ +ok - JMP + -+o - LDA ($c5), Y - AND #CustomBitFlag_GroundPound - BEQ +o - LDA Player1JoypadHeld - AND #ControllerInput_Down - BEQ + - LDA CrushTimer - CMP #$08 - BCS +ok - LDA #$0 - STA CrushTimer - JMP + -+o - JMP + -+ok - LDA #$0 - STA CrushTimer - LDA Player1JoypadHeld - AND #ControllerInput_A - BEQ ++ - LDA #$A0 - STA PlayerYVelocity - BNE +++ -++ LDA #$C0 - STA PlayerYVelocity -+++ LDX byte_RAM_12 - INX - LDY #$14 - JSR DamageEnemySingle - LDX byte_RAM_ED - PLA - PLA - RTS -+ - RTS - - CustomCopyChar: LDA #PRGBank_A_B @@ -434,7 +489,7 @@ ProcessCustomPowerup_NoLookup: ;; setup enum for extra options on compile .dw Normal_Mushroom .dw CustomObject_PowerItem .dw CustomObject_PowerItem - .dw CustomObject_PowerItem ; REPLACE THIS + .dw CustomObject_PowerItem ; GRIP .dw CustomObject_PowerItem .dw CustomObject_PowerItem .dw CustomObject_PowerItem @@ -445,9 +500,10 @@ ProcessCustomPowerup_NoLookup: ;; setup enum for extra options on compile .dw CustomObject_PowerItem .dw CustomObject_PowerItem .dw CustomObject_PowerItem - .dw CustomObject_PowerItem ; UNUSED - .dw Normal_Mushroom - .dw Normal_Mushroom + .dw CustomObject_PowerItem ; BOMB + .dw CustomObject_PowerItem ; EGG + .dw CustomObject_PowerItem ; Ocarina + .dw Normal_Mushroom ; Inventory Mushroom ; .dw CustomObject_PowerItem_NoChrSwitch ;; fire ; .dw CustomObject_PowerItem_NoChrSwitch ;; egg ; .dw CustomObject_PowerItem_NoChrSwitch ;; bomb @@ -488,8 +544,10 @@ EnemyCustom_Attributes: .db ObjAttrib_Palette1 | ObjAttrib_FrontFacing ; $3F Enemy_Mushroom .db ObjAttrib_Palette1 | ObjAttrib_FrontFacing | ObjAttrib_Mirrored ; $3F Enemy_Mushroom .db ObjAttrib_Palette1 | ObjAttrib_FrontFacing ; $3F Enemy_Mushroom + .db ObjAttrib_Palette2 | ObjAttrib_FrontFacing ; $3F Enemy_Mushroom .db ObjAttrib_Palette2 | ObjAttrib_FrontFacing | ObjAttrib_Mirrored ; $3F Enemy_Mushroom - .db ObjAttrib_Palette2 | ObjAttrib_FrontFacing | ObjAttrib_Mirrored ; $3F Enemy_Mushroom + + .db ObjAttrib_Palette1 | ObjAttrib_Mirrored ; $3F Enemy_Mushroom ; .db ObjAttrib_Palette1 | ObjAttrib_FrontFacing | ObjAttrib_Mirrored ; $3F Enemy_Mushroom ; .db ObjAttrib_Palette2 | ObjAttrib_FrontFacing ; $3F Enemy_Mushroom @@ -519,7 +577,7 @@ EnemyCustom_TableSprites: .db $e0, $e2 .db $f2, $f2 - .db $f8, $fa + .db $c0, $f8 .db $c8, $ca .db $cc, $cc .db $a8, $a8 @@ -531,10 +589,11 @@ EnemyCustom_TableSprites: .db $d0, $d2 .db $c4, $c6 .db $fe, $fe + .db $c0, $f0 + .db $c0, $c2 .db $f4, $f6 - .db $a5, $a5 - .db $a5, $a5 + .db $a5, $a5 ; .db $a4, $a4 ; .db $b5, $b9 ; .db $db, $db @@ -602,6 +661,8 @@ Normal_Mushroom_Spawn: STA SpriteTableCustom1, Y LDA EnemyCustom_TableSprites + 1, X STA SpriteTableCustom1 + 1, Y + LDA #$0 + STA EnemyMovementDirection, Y RTS CustomObject_RescueHalf: @@ -627,6 +688,8 @@ CustomObject_MushHalf: RTS CustomDestroyAll: + TXA + PHA LDA #PRGBank_2_3 JSR ChangeMappedPRGBankWithoutSaving LDA byte_RAM_E @@ -636,7 +699,7 @@ CustomDestroyAll: STA byte_RAM_E LDA MMC3PRGBankTemp JSR ChangeMappedPRGBank - LDA MushroomEffect, X + PLA TAX RTS diff --git a/src/extras/power-throw-logic.asm b/src/extras/power-throw-logic.asm new file mode 100644 index 00000000..d692ec44 --- /dev/null +++ b/src/extras/power-throw-logic.asm @@ -0,0 +1,34 @@ + + STA PlayerIntermediateValue + TXA ;; preserve obj position + PHA + LDX #CustomBitFlag_PowerThrow + LDA #$0 + JSR ChkFlagPlayer + BNE + + LDA CrouchJumpTimer ; check if crouch jump is charged + CMP #$3C + BCC + + LDA #0 ; success + STA CrouchJumpTimer + LDA #SoundEffect1_HawkOpen_WartBarf + STA SoundEffectQueue1 + LDA PlayerDirection + BEQ ++ + LDA #$70 + STA PlayerIntermediateValue + JMP + +++ LDA #$90 + STA PlayerIntermediateValue ++ PLA ;; resume obj position + TAX + LDA byte_RAM_1 + ASL A + ORA PlayerDirection + TAY ;; pretty sure this accidentally sets something incorrectly to not reduce object speed + LDA #$0 + CLC + ADC PlayerIntermediateValue + STA ObjectXVelocity, X + LDA #$0 + STA PlayerIntermediateValue \ No newline at end of file diff --git a/src/prg-0-1.asm b/src/prg-0-1.asm index 9b808c2c..b17e663f 100644 --- a/src/prg-0-1.asm +++ b/src/prg-0-1.asm @@ -1978,8 +1978,14 @@ loc_BANK0_8A26: .dw HandlePlayerState_Dying ; Dying .dw HandlePlayerState_ChangingSize ; Changing size +IFDEF CUSTOM_MUSH + .include "src/extras/char-switch-overworld.asm" +ENDIF HandlePlayerState_Normal: +IFDEF CUSTOM_MUSH + JSR HandlePlayer_ChangeChar +ENDIF JSR PlayerGravity ; player animation frame, crouch jump charging @@ -2042,22 +2048,7 @@ LoseALife: LDY #$01 ; Set game mode to title card DEC ExtraLives IFDEF FLAG_SYSTEM - LDX IndependentLives - BEQ + - LDX CurrentCharacter - DEC PlayerIndependentLives, X - LDA PlayerIndependentLives, X - STA ExtraLives - BNE ++ - LDA CharLookupTable, X - ORA CharacterLock_Variable - STA CharacterLock_Variable - CMP #$F - BNE ++ - INY - JMP SetGameModeAfterDeath -+ LDA ExtraLives -++ + .include "src/extras/lose-a-life-independent-check.asm" ENDIF BNE SetGameModeAfterDeath @@ -2108,6 +2099,14 @@ loc_BANK0_8AB5: loc_BANK0_8AB8: STA PlayerStateTimer +IFDEF CUSTOM_MUSH + LDX #CustomBitFlag_PowerGrip + JSR ChkFlagPlayer + BNE + + LDA #$0 + STA PlayerStateTimer ++ +ENDIF RTS ; --------------------------------------------------------------------------- @@ -2466,69 +2465,7 @@ PlayerControlAcceleration: sub_BANK0_8C1A: JSR PlayerWalkJumpAnim IFDEF CUSTOM_MUSH - LDA Player1JoypadPress - BPL +++ ; branch if not pressing A Button - LDA PlayerInAir - CMP #1 - BCC +++ - CMP #2 - BEQ + - LDX #CustomBitFlag_AirHop - JSR ChkFlagPlayer2 - BNE + - LDA HoldingItem - BEQ + - JSR SkipToThrowCheck - LDA HoldingItem - BNE + - LDA #$0 - STA ObjectXVelocity, X - LDA #$20 - STA ObjectYVelocity, X - INC PlayerInAir - JSR PlayerStartJump - LDA #SoundEffect2_Jump - STA SoundEffectQueue2 - LDA Player1JoypadPress - EOR #ControllerInput_A - STA Player1JoypadPress - JMP +++ -+ - LDX #CustomBitFlag_SpaceJump - JSR ChkFlagPlayer3 - BNE + - LDA PlayerYVelocity - BMI + - LDA PlayerYVelocity - CMP #$30 - BCS + - JSR PlayerStartJump - INC PlayerInAir - LDA #SoundEffect2_Jump - STA SoundEffectQueue2 - LDA Player1JoypadPress - EOR #ControllerInput_A - STA Player1JoypadPress - JMP +++ -+ - LDX #CustomBitFlag_KirbyJump - JSR ChkFlagPlayer3 - BNE +++ - JSR PlayerStartJump - INC PlayerInAir - LDA PlayerYVelocity - ASL - ROR PlayerYVelocity - LDA #SoundEffect2_Jump - STA SoundEffectQueue2 - LDA Player1JoypadPress - EOR #ControllerInput_A - STA Player1JoypadPress - JMP +++ -+++ - JSR Player_FloatJump - JSR Player_GroundPound - LDA PlayerInAir + .include "src/extras/jump-routine-bonus.asm" ENDIF LDA PlayerInAir @@ -2639,6 +2576,12 @@ PlayerStartJump: CMP #$02 BCC PlayerStartJump_LoadXVelocity +IFDEF CUSTOM_MUSH + LDX #CustomBitFlag_AllTerrain + JSR ChkFlagPlayer2 + BEQ PlayerStartJump_LoadXVelocity +ENDIF + ; Quicksand LDA JumpHeightQuicksand STA PlayerYVelocity @@ -2688,6 +2631,9 @@ PlayerStartJump_SetYVelocity: TAY LDA JumpHeightStanding, Y STA PlayerYVelocity +IFDEF CUSTOM_MUSH + JSR Player_HiJump +ENDIF LDA JumpFloatLength STA JumpFloatTimer @@ -2710,6 +2656,12 @@ PlayerGravity: CMP #$02 BCC loc_BANK0_8CE5 +IFDEF CUSTOM_MUSH + LDX #CustomBitFlag_AllTerrain + JSR ChkFlagPlayer2 + BEQ loc_BANK0_8CE5 +ENDIF + LDA GravityQuicksand BNE loc_BANK0_8D13 @@ -3087,39 +3039,7 @@ loc_BANK0_8E89: TAY LDA ThrowXVelocity, Y IFDEF CUSTOM_MUSH - STA PlayerIntermediateValue - TXA ;; preserve obj position - PHA - LDX #CustomBitFlag_PowerThrow - LDA #$0 - JSR ChkFlagPlayer - BNE + - LDA CrouchJumpTimer ; check if crouch jump is charged - CMP #$3C - BCC + - LDA #0 ; success - STA CrouchJumpTimer - LDA #SoundEffect1_HawkOpen_WartBarf - STA SoundEffectQueue1 - LDA PlayerDirection - BEQ ++ - LDA #$70 - STA PlayerIntermediateValue - JMP + -++ LDA #$90 - STA PlayerIntermediateValue -+ PLA ;; resume obj position - TAX - LDA byte_RAM_1 - ASL A - ORA PlayerDirection - TAY ;; pretty sure this accidentally sets something incorrectly to not reduce object speed - LDA #$0 - CLC - ADC PlayerIntermediateValue - STA ObjectXVelocity, X - LDA #$0 - STA PlayerIntermediateValue + .include "src/extras/power-throw-logic.asm" ENDIF IFNDEF CUSTOM_MUSH STA ObjectXVelocity, X @@ -3343,6 +3263,17 @@ PlayerTileCollision_CheckInteractiveTiles: AND #$F0 STA PlayerYLo +IFDEF CUSTOM_MUSH + LDA byte_RAM_A + ORA byte_RAM_C + BEQ PlayerTileCollision_CheckJar + LDX #CustomBitFlag_AllTerrain + JSR ChkFlagPlayer2 + BNE + + BEQ PlayerTileCollision_CheckJar ++ +ENDIF + PlayerTileCollision_CheckConveyorTile: LSR byte_RAM_A BCC PlayerTileCollision_CheckSlipperyTile @@ -3517,6 +3448,15 @@ CheckPlayerTileCollision_CheckSpikes: LDA InteractiveTileCollisionTable, X STA byte_RAM_E +IFDEF CUSTOM_MUSH + LDX #CustomBitFlag_AllTerrain + JSR ChkFlagPlayer2 + BNE + + LDA #$0 + STA byte_RAM_E ++ + LDX byte_RAM_7 +ENDIF BNE CheckPlayerTileCollision_UpdatePlayerCollision CheckPlayerTileCollision_CheckIce: @@ -3784,6 +3724,23 @@ loc_BANK0_9080: LDA #$20 STA EnemyTimer, X +IFDEF CUSTOM_MUSH + TXA + PHA + LDX #CustomBitFlag_PowerGrip + JSR ChkFlagPlayer + BNE + + PLA + TAX + DEC HoldingItem + LDA #$10 + STA PlayerYVelocity + LDA #EnemyState_Sand + BNE loc_BANK0_90AE ++ + PLA + TAX +ENDIF LDA #EnemyState_Sand loc_BANK0_90AE: @@ -5337,7 +5294,7 @@ IFDEF PLAYER_STUFF_TITLE .BYTE $22,$66,4,$FC,$FC,$FC,$20 .BYTE $22,$86,4,$76,$76,$76,$21 FunkyLittleSeedBlock: - .BYTE $22, $B, $0F, $DD, $E8, $E8, $EB, $FB, $EB, $DA, $E7, $DD, $E8, $E6, $E2, $F3, $DE, $EB; + .BYTE $22, $B, $0F, 'OPEN' + $99, $FB, $EB, $DA, $E7, $DD, $E8, $E6, $E2, $F3, $DE, $EB; FunkyLittleSeedBlock2: .BYTE $22, $2B, $0F, $e7, $e8, $fb, $e8, $db, $e3, $de, $dc, $ed, $e2, $ef, $de, $fb, $fb, $fb; FunkyLittleSeedBlock3: @@ -6915,6 +6872,34 @@ EndingScreenUpdateIndex: ContributorSpriteZeroOAMData: .db $8C, $FC, $20, $94 +IFDEF TEST_FLAG +ContributorCharacterOAMData: + ; Mario + .db $4F, $00, $20, $50 + .db $4F, $02, $20, $58 + .db $5F, $04, $20, $50 + .db $5F, $06, $20, $58 + ; Luigi + .db $4F, $08, $21, $68 + .db $4F, $0a, $21, $70 + .db $5F, $0c, $21, $68 + .db $5F, $0e, $21, $70 + ; Toad + .db $4F, $10, $22, $88 + .db $4F, $12, $22, $90 + .db $5F, $14, $22, $88 + .db $5F, $16, $22, $90 + ; Princess1 + .db $4F, $18, $23, $A0 + .db $4F, $1a, $23, $A8 + .db $5F, $1c, $23, $A0 + .db $5F, $1e, $23, $A8 +CharLookupTable_Ordered: + .db $01 ; Mio + .db $02 ; Lug + .db $04 ; Tod + .db $08 ; Pch +ELSE ContributorCharacterOAMData: ; Mario .db $4F, $61, $20, $50 @@ -6936,6 +6921,7 @@ ContributorCharacterOAMData: .db $4F, $8D, $23, $A8 .db $5F, $8F, $23, $A0 .db $5F, $91, $23, $A8 +ENDIF ; @@ -6984,10 +6970,35 @@ ContributorScene_SpriteZeroLoop: LDY #$3F ContributorScene_CharacterLoop: +IFNDEF TEST_FLAG LDA ContributorCharacterOAMData, Y STA SpriteDMAArea + $10, Y DEY BPL ContributorScene_CharacterLoop +ENDIF +IFDEF TEST_FLAG + LDA #$31 + STA SpriteCHR1 +- TYA + LSR + LSR + LSR + LSR + TAX + LDA CharLookupTable_Ordered, X + AND CharacterLock_Variable + BEQ + + LDA #$FF + STA SpriteDMAArea + $10, Y + DEY + BPL - + JMP ++ ++ LDA ContributorCharacterOAMData, Y + STA SpriteDMAArea + $10, Y + DEY + BPL - +++ +ENDIF LDA #$FF STA PlayerXHi @@ -8138,6 +8149,16 @@ loc_BANK1_BA9B: CPY #$0C BCC loc_BANK1_BAB4 +IFDEF CUSTOM_MUSH + LDX #CustomBitFlag_AllTerrain + JSR ChkFlagPlayer2 + BNE + + LDA #$0 + STA QuicksandDepth + BEQ loc_BANK1_BAB4 ++ +ENDIF + LDA #$00 STA PlayerStateTimer JSR KillPlayer diff --git a/src/prg-2-3.asm b/src/prg-2-3.asm index 525b1e40..9876a253 100644 --- a/src/prg-2-3.asm +++ b/src/prg-2-3.asm @@ -3435,10 +3435,10 @@ EnemyBehavior_PickUpNotCrystalBall: EnemyBehavior_PickUpMushroom: IFDEF CUSTOM_MUSH - JSR ProcessCustomPowerupAward LDX byte_RAM_12 LDA #Enemy_MushroomBlock STA ObjectType, X + JSR ProcessCustomPowerupAward ELSE LDX EnemyVariable INC Mushroom1Pulled, X @@ -3844,8 +3844,11 @@ IFDEF CUSTOM_MUSH LDA ObjectAttributes, X EOR #$1 STA ObjectAttributes, X + JMP +++ ++ LDX byte_RAM_12 + JSR EnemyBehavior_CheckDamagedInterrupt ++++ ENDIF JSR EnemyBehavior_CheckBeingCarriedTimerInterrupt @@ -11108,7 +11111,6 @@ CheckCollisionWithPlayer_StandingOnHead: LDA EnemyArray_46E, X AND #%00000010 BNE CheckCollisionWithPlayer_NoLift - ; check B button BIT Player1JoypadPress BVC CheckCollisionWithPlayer_NoLift @@ -12508,121 +12510,14 @@ ENDIF IFDEF CONTROLLER_2_DEBUG -; -; Copies all character stats to RAM for hot-swapping the current character -; -CopyCarryYOffsets: - LDX #(AreaMainRoutine - CarryYOffsets - 1) -CopyCarryYOffsets_Loop: - LDA CarryYOffsets, X - STA CarryYOffsetsRAM, X - DEX - BPL CopyCarryYOffsets_Loop - - RTS - -AreaDebugRoutine: - LDA CreateObjectType - BEQ AreaDebugRoutine_Exit - - JSR DebugCreateObject - -AreaDebugRoutine_Exit: - RTS - -; -; Input -; CreateObjectType = object type -; -DebugCreateObject: - JSR CreateEnemy - - BMI AreaDebugRoutine_Exit - - LDX byte_RAM_0 - LDA CreateObjectType - STA ObjectType, X - LDA ScreenBoundaryLeftLo - ADC #$80 - STA ObjectXLo, X - LDA ScreenBoundaryLeftHi - ADC #$00 - STA ObjectXHi, X - LDA ScreenYLo - STA ObjectYLo, X - LDA ScreenYHi - ADC #$00 - STA ObjectYHi, X - - JSR InitializeEnemy - LDA CreateObjectAttributes - BEQ DebugCreateObject_ClearObjectType +.include "src/extras/controller-2-3-debug.asm" -DebugCreateObject_ObjectCarried: - ROL CreateObjectAttributes - BCC DebugCreateObject_ObjectTimer - LDA #$01 - STA HoldingItem - STA ObjectBeingCarriedTimer, X - STX ObjectBeingCarriedIndex - - LDA #SoundEffect1_CherryGet - STA SoundEffectQueue1 - -DebugCreateObject_ObjectTimer: - ROL CreateObjectAttributes - BCC DebugCreateObject_ObjectBottomScreen - - LDA #$FF - STA EnemyTimer, X - -DebugCreateObject_ObjectBottomScreen: - ROL CreateObjectAttributes - BCC DebugCreateObject_Bit4 - - LDA ObjectYLo, X - CLC - ADC #$E0 - STA ObjectYLo, X - LDA ObjectYHi, X - ADC #$00 - STA ObjectYHi, X - -DebugCreateObject_Bit4: - ROL CreateObjectAttributes - BCC DebugCreateObject_Bit3 - -DebugCreateObject_Bit3: - ROL CreateObjectAttributes - BCC DebugCreateObject_Bit2 - -DebugCreateObject_Bit2: - ROL CreateObjectAttributes - BCC DebugCreateObject_ObjectThrown - -DebugCreateObject_ObjectThrown: - ROL CreateObjectAttributes - BCC DebugCreateObject_ObjectNoVelocityReset - - LDA #$01 - STA EnemyArray_42F, X - -DebugCreateObject_ObjectNoVelocityReset: - ROL CreateObjectAttributes - BCS DebugCreateObject_ClearObjectType - - LDA #$00 - STA ObjectXVelocity, X - STA ObjectYVelocity, X - -DebugCreateObject_ClearObjectType: - LDA #$00 - STA CreateObjectType +ENDIF -DebugCreateObject_Exit: - RTS +IFDEF CUSTOM_MUSH +.include "src/extras/jump-attack.asm" ENDIF diff --git a/src/prg-c-d.asm b/src/prg-c-d.asm index 9706ef5b..bea4dbc9 100644 --- a/src/prg-c-d.asm +++ b/src/prg-c-d.asm @@ -501,6 +501,21 @@ sub_BANKC_8493: BNE loc_BANKC_84A5 loc_BANKC_849B: +IFDEF PLAYER_STUFF +- TYA + LSR + LSR + TAX + LDA CharLookupTable_Ordered_Dream, X + AND CharacterLock_Variable + BEQ + + LDA #$FF + STA SpriteDMAArea + $10, Y + DEY + BPL - + RTS ++ +ENDIF LDA MarioDream_BubbleSprites, Y STA SpriteDMAArea, Y DEY @@ -511,6 +526,26 @@ loc_BANKC_849B: ; --------------------------------------------------------------------------- loc_BANKC_84A5: +IFDEF PLAYER_STUFF +- TYA + LSR + LSR + TAX + LDA CharLookupTable_Ordered_Dream, X + AND CharacterLock_Variable + BEQ + + LDA #$FF + STA SpriteDMAArea + $10, Y + DEY + BPL - + RTS +CharLookupTable_Ordered_Dream: + .db $01 ; Mio + .db $02 ; Lug + .db $08 ; Pch + .db $04 ; Tod ++ +ENDIF LDA byte_BANKC_8308, Y STA SpriteDMAArea, Y DEY diff --git a/src/prg-e-f.asm b/src/prg-e-f.asm index fed75422..6ac8a1b3 100644 --- a/src/prg-e-f.asm +++ b/src/prg-e-f.asm @@ -207,6 +207,7 @@ WorldStartingLevel: .db $12 .db $14 +IFNDEF TEST_FLAG PlayerSelectMarioSprites1: .db $8F, $00, $00, $48 .db $8F, $00, $40, $50 @@ -254,6 +255,56 @@ PlayerSelectPrincessSprites2: .db $8F, $2A, $03, $B0 .db $9F, $2C, $03, $A8 .db $9F, $2E, $03, $B0 +ENDIF +IFDEF TEST_FLAG +PlayerSelectMarioSprites1: + .db $8F, $00, $00, $48 + .db $8F, $02, $00, $50 + .db $9F, $04, $00, $48 + .db $9F, $06, $00, $50 + +PlayerSelectLuigiSprites1: + .db $8F, $08, $01, $68 + .db $8F, $0a, $01, $70 + .db $9F, $0c, $01, $68 + .db $9F, $0e, $01, $70 + +PlayerSelectToadSprites1: + .db $8F, $10, $02, $88 + .db $8F, $12, $02, $90 + .db $9F, $14, $02, $88 + .db $9F, $16, $02, $90 + +PlayerSelectPrincessSprites1: + .db $8F, $18, $03, $A8 + .db $8F, $1a, $03, $B0 + .db $9F, $1c, $03, $A8 + .db $9F, $1e, $03, $B0 + +PlayerSelectMarioSprites2: + .db $8F, $20, $00, $48 + .db $8F, $22, $00, $50 + .db $9F, $24, $00, $48 + .db $9F, $26, $00, $50 + +PlayerSelectLuigiSprites2: + .db $8F, $28, $01, $68 + .db $8F, $2A, $01, $70 + .db $9F, $2C, $01, $68 + .db $9F, $2E, $01, $70 + +PlayerSelectToadSprites2: + .db $8F, $30, $02, $88 + .db $8F, $32, $02, $90 + .db $9F, $34, $02, $88 + .db $9F, $36, $02, $90 + +PlayerSelectPrincessSprites2: + .db $8F, $38, $03, $A8 + .db $8F, $3A, $03, $B0 + .db $9F, $3C, $03, $A8 + .db $9F, $3E, $03, $B0 +ENDIF PlayerSelectSpriteIndexes: .db $00, $30, $20, $10 @@ -585,6 +636,12 @@ DisplayLevelTitleCardAndMore_TitleCardPaletteLoop: JSR WaitForNMI_TurnOnPPU JSR RestorePlayerToFullHealth +IFDEF FLAG_SYSTEM + LDA PlayerHealth + CLC + ADC FreeHealth + STA PlayerHealth +ENDIF ; Pause for the title card LDA #$50 @@ -825,6 +882,11 @@ CharacterSelectMenuLoop: AND #ControllerInput_A BNE loc_BANKF_E3AE +IFDEF FLAG_SYSTEM + LDA CurrentCharacter + STA PreviousCharacter +ENDIF + JMP loc_BANKF_E2E8 ; --------------------------------------------------------------------------- @@ -900,6 +962,9 @@ StartGame: SetNumContinues: LDA #$02 ; Number of continues on start STA Continues +IFDEF CUSTOM_MUSH + JSR LoadStartingInventory +ENDIF ; We return here after picking "CONTINUE" from the game over menu. ContinueGame: @@ -911,6 +976,8 @@ ResetPlayer_Lives: - STA PlayerIndependentLives, Y DEY BPL - + LDA #$F + STA CharacterLock_Variable JSR CharSelectInitialize ENDIF @@ -926,12 +993,14 @@ IFNDEF NO_CONTINUE JSR InitializeSomeLevelStuff ENDIF IFDEF NO_CONTINUE +StartingTransition: LDA #TransitionType_Door STA TransitionType STA TransitionType_Init LDA #$00 STA PlayerState STA PlayerState_Init + STA InSubspaceOrJar STA StopwatchTimer STA PlayerCurrentSize JSR DoCharacterSelectMenu @@ -2561,7 +2630,7 @@ IFDEF DEBUG DebugHook: ; Hook into debug routine if select is pressed LDA Player1JoypadPress - CMP #ControllerInput_Select + CMP #ControllerInput_Select | ControllerInput_Start BNE NMI_Exit LDA #>Debug_Init PHA