Merge remote-tracking branch 'upstream/DRMain' into OWMain

This commit is contained in:
codemann8
2021-04-12 13:33:04 -05:00
8 changed files with 128 additions and 16 deletions

View File

@@ -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

13
enemizer/blindboss.asm Normal file
View File

@@ -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

View File

@@ -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:

1
enemizer/hooks.asm Normal file
View File

@@ -0,0 +1 @@
incsrc blindboss_hooks.asm

35
enemizer/main.asm Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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
;--------------------------------------------------------------------------------

View File

@@ -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: