diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index a92d2af..95c9ad4 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -223,7 +223,9 @@ incsrc contrib.asm org $A38000 incsrc stats/main.asm -incsrc doorrando.asm +incsrc doorrando.asm ; bank 27 likely A7 in the future +;bank 28/A8 for keydropshuffle +incsrc enemizer/main.asm ; this is originally in bank 36, but is currently in migratory status in bank 37 org $308000 ; bank #$30 incsrc tables.asm diff --git a/enemizer/blindboss.asm b/enemizer/blindboss.asm new file mode 100644 index 0000000..fee7b37 --- /dev/null +++ b/enemizer/blindboss.asm @@ -0,0 +1,13 @@ +;================================================================================ +; Blind Boss fight +;-------------------------------------------------------------------------------- + +print "Blind Spawn Code Check: ", pc +check_blind_boss_room: + LDA $A0 ; load room index (low byte) + CMP #172 : BNE + ; Is is Thieve Town Boss Room + LDA $09DE81 : BEQ + ; Blind maiden does not need rescuing + + LDA $7EF3CC : JML Check_for_Blind_Fight + + + JML Initialize_Blind_Fight diff --git a/enemizer/blindboss_hooks.asm b/enemizer/blindboss_hooks.asm new file mode 100644 index 0000000..3ed2538 --- /dev/null +++ b/enemizer/blindboss_hooks.asm @@ -0,0 +1,13 @@ + +;================================================================================ +; Blind Boss fight +;-------------------------------------------------------------------------------- + +org $1DA081 ; Original Code + JML check_blind_boss_room +Check_for_Blind_Fight: + + + +org $1DA090 +Initialize_Blind_Fight: \ No newline at end of file diff --git a/enemizer/hooks.asm b/enemizer/hooks.asm new file mode 100644 index 0000000..4cb43b4 --- /dev/null +++ b/enemizer/hooks.asm @@ -0,0 +1 @@ +incsrc blindboss_hooks.asm \ No newline at end of file diff --git a/enemizer/main.asm b/enemizer/main.asm new file mode 100644 index 0000000..b24bef1 --- /dev/null +++ b/enemizer/main.asm @@ -0,0 +1,35 @@ +; Intended to be a migration of code generated by enemizer + +lorom + +;================================================================================ + +!ADD = "CLC : ADC" +!SUB = "SEC : SBC" +!BLT = "BCC" +!BGE = "BCS" + +;=Constants====================================================================== + +!BUSHES_FLAG = "$368100" +!BLIND_DOOR_FLAG = "$368101" +!MOLDORM_EYES_FLAG = "$368102" +!RANDOM_SPRITE_FLAG = "$368103" +!AGAHNIM_FUN_BALLS = "$368104" +!ENABLE_MIMIC_OVERRIDE = "$368105" +!ENABLE_TERRORPIN_AI_FIX = "$368106" + +; Enemizer reserved memory +; $7F50B0 - $7F50BF - Downstream Reserved (Enemizer) +!SHELL_DMA_FLAG = "$7F50B0" +!SOUNDFX_LOADED = "$7F50B1" +;================================================================================ + +incsrc hooks.asm + +org $B78000 ; the original org is 368000, but I'm putting this here for migration purposes, and I think B6 is the same bank but fastrom +EnemizerTablesStart: +;none migrated yet + +EnemizerCodeStart: +incsrc blindboss.asm \ No newline at end of file diff --git a/hooks.asm b/hooks.asm index 9e58cfb..26c0654 100755 --- a/hooks.asm +++ b/hooks.asm @@ -1189,11 +1189,14 @@ JSL.l DrawMushroom org $05EE97 ; <- 2EE97 - sprite_mushroom.asm : 81 NOP #14 ;-------------------------------------------------------------------------------- -org $05F529 ; <- 2F52C - sprite_potion_shop.asm -JSL SpritePrep_ShopKeeper -LDX #$0 -JSR $F539 ; <- powder spawn here -RTS +org $06C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_PotionShopLong) +JSL SpritePrep_ShopKeeper_PotionShop + +org $05F521 +SpritePrep_PotionShopLong: + +org $05F539 +SpawnMagicPowder: ;-------------------------------------------------------------------------------- org $05F568 ; <- 2F568 - sprite_potion_shop.asm LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item @@ -1201,12 +1204,15 @@ LDA #$21 : STA $0D20, Y : LDA #$12 : STA $0D30, Y JMP $F61D ;-------------------------------------------------------------------------------- org $05F633 ; <- 2F633 - sprite_potion_shop.asm -LDA $0E80, X : BNE + -JSL Sprite_ShopKeeperPotion ;; TODO: i don't remember prices being set on top of the player -JSR $F893 ; <- witch behavior here -RTS : + -JSR $F644 ; <- powder behavior here -RTS +JSL Sprite_ShopKeeperPotion : RTS : NOP ;; TODO: i don't remember prices being set on top of the player +PotionShopkeeperJumpTable: + +org $05F893 ; <- witch behavior here +Sprite_WitchAssistant: + +org $05F644 ; <- powder behavior here +Sprite_MagicPowderItem: + ;-------------------------------------------------------------------------------- org $05EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158 JSL.l Multiworld_BottleVendor_GiveBottle diff --git a/inventory.asm b/inventory.asm index 37d39cd..041d61d 100644 --- a/inventory.asm +++ b/inventory.asm @@ -989,7 +989,6 @@ RTL !REDRAW = "$7F5000" ;-------------------------------------------------------------------------------- DrawPowder: -; this fights with the shopkeep code, so had to move the powder draw there LDA $02DA : BNE .defer ; defer if link is buying a potion LDA.l !REDRAW : BEQ + LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID @@ -998,8 +997,10 @@ DrawPowder: LDA #$00 : STA.l !REDRAW ; reset redraw flag BRA .defer + -; LDA $0DA0, X ; Retrieve stored item type -; JSL.l DrawDynamicTile + ; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom + LDA !SHOP_TYPE : CMP.b #$FF : BNE .defer + LDA $0DA0, X ; Retrieve stored item type + JSL.l DrawDynamicTile .defer RTL ;-------------------------------------------------------------------------------- diff --git a/shopkeeper.asm b/shopkeeper.asm index f789078..526ac26 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -128,6 +128,19 @@ dw $0230, $0231, $0202, $0203, $0212, $0213, $0222, $0223, $0232, $0233 .digit_offsets dw 4, 0, -4, -8 ;-------------------------------------------------------------------------------- +SpritePrep_ShopKeeper_PotionShop: + JSL SpritePrep_ShopKeeper + LDA.l !SHOP_TYPE : CMP.b #$FF : BNE + + JSL SpritePrep_PotionShopLong + RTL + + LDX #$0 + PHK : PEA.w .jslrtsreturn-1 + PEA.w $05f527 ; an rtl address - 1 in Bank05 + JML SpawnMagicPowder + .jslrtsreturn + RTL + + SpritePrep_ShopKeeper: PHX : PHY : PHP @@ -252,7 +265,9 @@ SpritePrep_ShopKeeper: PLP : PLY : PLX LDA.l !SHOP_TYPE : CMP.b #$FF : BNE + - PLA : PLA : PLA + LDA $A0 : CMP.b #$09 : BNE ++ + RTL + ++ PLA : PLA : PLA INC $0BA0, X LDA $0E40, X JML.l ShopkeeperFinishInit @@ -381,6 +396,16 @@ Shopkeeper_UploadVRAMTiles: PLA : STA $4301 ; restore DMA parameters PLA : STA $4300 ; restore DMA parameters RTS +;-------------------------------------------------------------------------------- +ShopkepeerPotion_CallOriginal: + PLA : PLA : PLA + LDA.b #PotionShopkeeperJumpTable>>16 : PHA + LDA.b #PotionShopkeeperJumpTable>>8 : PHA + LDA.b #PotionShopkeeperJumpTable : PHA + LDA $0E80, X + JML.l UseImplicitRegIndexedLocalJumpTable +;-------------------------------------------------------------------------------- + ;-------------------------------------------------------------------------------- Shopkepeer_CallOriginal: PLA : PLA : PLA @@ -394,12 +419,28 @@ Shopkepeer_CallOriginal: ;!SHOP_CAPACITY = "$7F5020" ;!SCRATCH_TEMP_X = "$7F5021" Sprite_ShopKeeperPotion: + LDA.l !SHOP_TYPE : CMP.b #$FF : BNE + : JMP.w ShopkepeerPotion_CallOriginal : + + TXA : BEQ + + PHK : PEA.w .jslrtsreturn2-1 + PEA.w $05f527 ; an rtl address - 1 in Bank05 + JML Sprite_MagicPowderItem + .jslrtsreturn2 + RTL + + + PHB : PHK : PLB ;; we can just call the default shopkeeper but the potion shopkeeper refills your health LDA $A0 : CMP.b #$09 : BNE + JSR.w Shopkeeper_DrawItems JSR.w Shopkeeper_SetupHitboxes + PLB + + LDA $0E80, X : BNE + + PHK : PEA.w .jslrtsreturn-1 + PEA.w $05f527 ; an rtl address - 1 in Bank05 + JML Sprite_WitchAssistant + .jslrtsreturn + + RTL Sprite_ShopKeeper: