Pottery counts and despawning items fixed

This commit is contained in:
aerinon
2022-03-04 14:53:30 -07:00
parent 0b64b15e9e
commit a12216da0b
6 changed files with 63 additions and 33 deletions

View File

@@ -2720,9 +2720,6 @@ class Pot(object):
def copy(self):
return Pot(self.x, self.y, self.item, self.room, self.flags)
def empty(self):
return self.item == PotItem.Nothing and self.indicator is None
def pot_data(self):
high_byte = self.y
if self.flags & PotFlags.LowerRegion:

View File

@@ -31,7 +31,7 @@ from Utils import output_path, parse_player_names
from source.item.FillUtil import create_item_pool_config, massage_item_pool, district_item_pool_config
from source.tools.BPS import create_bps_from_data
__version__ = '1.0.1.8-v'
__version__ = '1.0.1.9-v'
from source.classes.BabelFish import BabelFish

View File

@@ -516,7 +516,7 @@ class PotSecretTable(object):
empty_pointer = pc_to_snes(empty_address) & 0xFFFF
data_pointer = pointer_address + pointer_offset + 2
for room in range(0, 0x128):
if room in self.room_map and any(p for p in self.room_map[room] if not p.empty()):
if room in self.room_map:
list_idx = 0
data_address = pc_to_snes(data_pointer) & 0xFFFF
rom.write_bytes(pointer_address + room * 2, int16_as_bytes(data_address))

View File

@@ -33,7 +33,7 @@ The old "Pot Shuffle" option is still available under "Pot Shuffle (Legacy)" or
#### Tracking Notes
The sram locations for pots and sprite drops have been moved, please reach out for assistance or investigate the rom changes.
The sram locations for pots and sprite drops are not yet final, please reach out for assistance or investigate the rom changes.
## Restricted Item Placement Algorithm
@@ -146,7 +146,11 @@ Same as above but both small keys and bigs keys of the dungeon are not allowed o
## Notes and Bug Fixes
#### Volatile
* 1.0.1.9
* Every pot you pick up now counts toward the location count
* A pot will de-spawn before the item under it does, error beep only plays if it still can't spawn
* Updated item counter & credits to support 4 digits
* Updated compass counter to support 3 digits (up to 255)
* 1.0.1.8
* Updated mystery_example.yml
* Fixed usestartinventory with mystery

37
Rom.py
View File

@@ -35,7 +35,7 @@ from source.item.FillUtil import valid_pot_items
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '99f4c032651bb3c773f18280a182cd8f'
RANDOMIZERBASEHASH = 'fb1887e175ebbfdbe0ceef6cc66abd18'
class JsonRom(object):
@@ -591,7 +591,6 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
if location.type == LocationType.Pot:
if location.item.name in valid_pot_items and location.item.player == player:
location.pot.item = valid_pot_items[location.item.name]
location.forced_item = True
else:
code = handle_native_dungeon(location, itemid)
standing_item_flag = 0x80
@@ -898,19 +897,32 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
write_int16(rom, 0x187010, credits_total) # dynamic credits
if credits_total != 216:
# collection rate address (hi):
cr_address = 0x238057
cr_pc = cr_address - 0x120000 # convert to pc
cr_address = 0x238055
cr_pc = snes_to_pc(cr_address) # convert to pc
first_top, first_bot = credits_digit((credits_total // 100) % 10)
mid_top, mid_bot = credits_digit((credits_total // 10) % 10)
last_top, last_bot = credits_digit(credits_total % 10)
if credits_total >= 1000:
thousands_top, thousands_bot = credits_digit((credits_total // 1000) % 10)
rom.write_byte(cr_pc, 0xa2) # slash
rom.write_byte(cr_pc+1, thousands_top)
rom.write_byte(cr_pc+0x1e, 0xc2) # slash
rom.write_byte(cr_pc+0x1f, thousands_bot)
# modify stat config
stat_address = 0x23B969
stat_pc = snes_to_pc(stat_address)
rom.write_byte(stat_pc, 0xa9) # change to pos 21 (from b1)
rom.write_byte(stat_pc+2, 0xc0) # change to 12 bits (from a0)
rom.write_byte(stat_pc+3, 0x80) # change to four digits (from 60)
# top half
rom.write_byte(cr_pc, first_top)
rom.write_byte(cr_pc+0x1, mid_top)
rom.write_byte(cr_pc+0x2, last_top)
rom.write_byte(cr_pc+2, first_top)
rom.write_byte(cr_pc+3, mid_top)
rom.write_byte(cr_pc+4, last_top)
# bottom half
rom.write_byte(cr_pc+0x1e, first_bot)
rom.write_byte(cr_pc+0x1f, mid_bot)
rom.write_byte(cr_pc+0x20, last_bot)
rom.write_byte(cr_pc+0x20, first_bot)
rom.write_byte(cr_pc+0x21, mid_bot)
rom.write_byte(cr_pc+0x22, last_bot)
# patch medallion requirements
if world.required_medallions[player][0] == 'Bombos':
@@ -2662,7 +2674,10 @@ def update_compasses(rom, dungeon_locations, world, player):
provided_dungeon = False
for name, builder in layouts.items():
dungeon_id = compass_data[name][4]
rom.write_byte(0x187000 + dungeon_id//2, len(dungeon_locations[name]))
dungeon_count = len(dungeon_locations[name])
if dungeon_count > 255:
logging.getLogger('').warning(f'{name} has more locations than 255. Need 16-bit compass counts')
rom.write_byte(0x187000 + dungeon_id//2, dungeon_count % 256)
if builder.bk_provided:
if provided_dungeon:
logging.getLogger('').warning('Multiple dungeons have forced BKs! Compass code might need updating?')

View File

@@ -7,23 +7,37 @@ DrHudOverride:
HudAdditions:
{
lda.l DRFlags : and #$0008 : beq ++
; LDA.w #$28A4 : STA !GOAL_DRAW_ADDRESS
lda $7EF423
jsr HudHexToDec4DigitCopy
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.l DRFlags : AND #$0008 : BNE + : JMP .end_item_count : +
LDA.l $7EF423 : PHA : CMP #1000 : !BLT +
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS ; draw 1000's digit
BRA .skip
+ JSL HexToDec_fast
.skip
LDA #$207F : STA !GOAL_DRAW_ADDRESS+2 : STA !GOAL_DRAW_ADDRESS+4
PLA : PHA : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
+ PLA : CMP.w #10 : !BLT +
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
+ LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDA.l DRFlags : AND #$0100 : BNE +
lda $7EF33E
jsr HudHexToDec4DigitCopy
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA ++
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12 : STA !GOAL_DRAW_ADDRESS+14
++
LDA.l $7EF33E : CMP #1000 : !BLT .three_digit_goal
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 1000's digit
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+16 ; draw 1's digit
BRA .end_item_count
.three_digit_goal
JSL HexToDec_fast
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .end_item_count
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12
STA !GOAL_DRAW_ADDRESS+14 : STA !GOAL_DRAW_ADDRESS+16
.end_item_count
LDX $1B : BNE + : RTS : + ; Skip if outdoors
ldx $040c : cpx #$ff : bne + : rts : + ; Skip if not in dungeon