untangle patch_game
parent
afde644b38
commit
707a7b70a1
|
@ -2646,8 +2646,7 @@ def patch_game():
|
|||
for line in symFile:
|
||||
x = line.split()
|
||||
if len(x) > 1 and re.search('^[a-zA-Z]', x[1]):
|
||||
sym.update({
|
||||
x[1]: x[0][2:] })
|
||||
sym.update({ x[1]: x[0][2:] })
|
||||
os.remove(os.path.join('.', 'data', 'asm', 'temp.sym'))
|
||||
roomEventOffset = int(sym.get('t_bossanddownloadevents'), 16)
|
||||
itemEventOffset = int(sym.get('t_obtainitemevents'), 16)
|
||||
|
@ -2655,6 +2654,7 @@ def patch_game():
|
|||
print('roomEventOffset: 0x{:06X}'.format(roomEventOffset))
|
||||
print('itemEventOffset: 0x{:06X}'.format(itemEventOffset))
|
||||
print('securityOffset: 0x{:06X}'.format(securityOffset))
|
||||
else:
|
||||
roomEventOffset = 8326320
|
||||
itemEventOffset = 5726112
|
||||
securityOffset = 479192
|
||||
|
@ -2729,6 +2729,7 @@ def patch_game():
|
|||
blockValue += 1
|
||||
clipValue = ItemList.index(itemName)
|
||||
if clipValue < 2:
|
||||
# Energy Tank or Missile Tank
|
||||
clipValue = clipValue ^ 99
|
||||
if 'Hidden' in nodeType:
|
||||
clipValue += 2
|
||||
|
@ -2741,7 +2742,7 @@ def patch_game():
|
|||
elif 'Underwater' in nodeType:
|
||||
clipValue += 2
|
||||
elif clipValue >= 3:
|
||||
clipValue = (clipValue - 3) * 3 + 120
|
||||
clipValue = (clipValue - 3)*3 + 120
|
||||
if 'Hidden' in nodeType:
|
||||
clipValue += 1
|
||||
elif 'Underwater' in nodeType:
|
||||
|
@ -2757,7 +2758,7 @@ def patch_game():
|
|||
slot = BossDataList.index(name)
|
||||
roomEvent = roomEventOffset
|
||||
if roomEvent != None:
|
||||
roomEvent = roomEvent + 3 + slot * 4
|
||||
roomEvent = roomEvent + 3 + slot*4
|
||||
if itemValue < 3:
|
||||
itemValue += 1
|
||||
else:
|
||||
|
@ -2771,14 +2772,16 @@ def patch_game():
|
|||
patchedGame.write(itemValue.to_bytes(1, 'little'))
|
||||
if name == 'Data S5':
|
||||
roomEvent = roomEventOffset
|
||||
roomEvent = roomEvent + 3 + (slot + 1) * 4
|
||||
roomEvent = roomEvent + 3 + (slot + 1)*4
|
||||
patchedGame.seek(roomEvent)
|
||||
patchedGame.write(itemValue.to_bytes(1, 'little'))
|
||||
|
||||
if itemName in MajorItems:
|
||||
offset = CreditsOffsets.get(itemName)
|
||||
if 'Boss' in nodeType:
|
||||
location = name
|
||||
elif 'S0' in name:
|
||||
else:
|
||||
if 'S0' in name:
|
||||
location = 'Main Deck : '
|
||||
else:
|
||||
location = 'Sector {} : '.format(name[6:7])
|
||||
|
@ -2787,7 +2790,7 @@ def patch_game():
|
|||
else:
|
||||
location = location + nodeType + ' Room'
|
||||
spaces = ceiling(30 - len(location), 2)
|
||||
location = ' ' * spaces + location
|
||||
location = ' '*spaces + location
|
||||
patchedGame.seek(offset)
|
||||
patchedGame.write(location.encode('ascii'))
|
||||
for x in range(len(location), 35):
|
||||
|
@ -2830,6 +2833,7 @@ def patch_game():
|
|||
doorData = unpacked[0] - 134217728
|
||||
patchedGame.seek(doorData, 0)
|
||||
doorNumber = 0
|
||||
while True:
|
||||
connectionType = int.from_bytes(patchedGame.read(1), 'little')
|
||||
patchedGame.seek(5, 1)
|
||||
offset = patchedGame.tell()
|
||||
|
@ -2837,7 +2841,7 @@ def patch_game():
|
|||
patchedGame.seek(5, 1)
|
||||
resume = patchedGame.tell()
|
||||
if connectionType == 0 and connectedDoor == 0:
|
||||
continue
|
||||
break
|
||||
sourceDoor = 'S{}-{:02X}'.format(currentArea, doorNumber)
|
||||
targetDoorStr = World.doorConnections.get(sourceDoor)
|
||||
connectedArea = World.areaConnections.get(sourceDoor, currentArea)
|
||||
|
@ -2855,7 +2859,6 @@ def patch_game():
|
|||
if areaByte != targetArea:
|
||||
patchedGame.seek(offset)
|
||||
patchedGame.write(targetArea.to_bytes(1, 'little'))
|
||||
continue
|
||||
for target in World.patcher:
|
||||
value = World.patcher.get(target)
|
||||
patchedGame.seek(target)
|
||||
|
@ -2875,6 +2878,7 @@ def patch_game():
|
|||
iterable = diff_bytearrays(blocksize, sourcedata, targetdata)
|
||||
write_bps(bps_progress(iterable), patch)
|
||||
print('')
|
||||
|
||||
ItemNames = [
|
||||
'Missile Data',
|
||||
'Morph Ball',
|
||||
|
@ -2896,65 +2900,43 @@ def patch_game():
|
|||
'Ice Beam']
|
||||
if SeedSettings['RaceSeed'] == False:
|
||||
spoilerLog = dict()
|
||||
spoilerLog.update({
|
||||
'MFOR Version': version })
|
||||
spoilerLog.update({
|
||||
'Seed': SeedValue })
|
||||
spoilerLog.update({ 'MFOR Version': version })
|
||||
spoilerLog.update({ 'Seed': SeedValue })
|
||||
settingsDict = dict()
|
||||
settingsDict.update({
|
||||
'Difficulty': SeedSettings['Difficulty'] })
|
||||
settingsDict.update({ 'Difficulty': SeedSettings['Difficulty'] })
|
||||
if SeedSettings['MajorMinor'] == False:
|
||||
settingsDict.update({
|
||||
'Item pool': 'Major items anywhere' })
|
||||
settingsDict.update({ 'Item pool': 'Major items anywhere' })
|
||||
else:
|
||||
settingsDict.update({
|
||||
'Item pool': 'Limited major item locations' })
|
||||
settingsDict.update({
|
||||
'Missile upgrades enable Missiles': SeedSettings['MissilesWithoutMainData'] })
|
||||
settingsDict.update({
|
||||
'Power Bombs without normal Bombs': SeedSettings['PowerBombsWithoutBombs'] })
|
||||
settingsDict.update({
|
||||
'Allow logical damage runs': SeedSettings['DamageRuns'] })
|
||||
settingsDict.update({
|
||||
'Separated security levels': SeedSettings['SplitSecurity'] })
|
||||
settingsDict.update({
|
||||
'Sector shuffle': SeedSettings['SectorShuffle'] })
|
||||
settingsDict.update({ 'Item pool': 'Limited major item locations' })
|
||||
settingsDict.update({ 'Missile upgrades enable Missiles': SeedSettings['MissilesWithoutMainData'] })
|
||||
settingsDict.update({ 'Power Bombs without normal Bombs': SeedSettings['PowerBombsWithoutBombs'] })
|
||||
settingsDict.update({ 'Allow logical damage runs': SeedSettings['DamageRuns'] })
|
||||
settingsDict.update({ 'Separated security levels': SeedSettings['SplitSecurity'] })
|
||||
settingsDict.update({ 'Sector shuffle': SeedSettings['SectorShuffle'] })
|
||||
if SeedSettings['SectorShuffle'] == True:
|
||||
sectorLayout = str()
|
||||
for x in areaLayout:
|
||||
sectorLayout = sectorLayout.strip() + ' {}'.format(x)
|
||||
settingsDict.update({
|
||||
'Sector layout:': sectorLayout })
|
||||
settingsDict.update({
|
||||
'Hide item graphics': SeedSettings['HideItems'] })
|
||||
settingsDict.update({
|
||||
'E-Tanks': PlacedETanks })
|
||||
settingsDict.update({
|
||||
'Missile Tanks': PlacedMissiles })
|
||||
settingsDict.update({
|
||||
'Power Bomb Tanks': PlacedPowerBombs })
|
||||
spoilerLog.update({
|
||||
'Settings': settingsDict })
|
||||
settingsDict.update({ 'Sector layout:': sectorLayout })
|
||||
settingsDict.update({ 'Hide item graphics': SeedSettings['HideItems'] })
|
||||
settingsDict.update({ 'E-Tanks': PlacedETanks })
|
||||
settingsDict.update({ 'Missile Tanks': PlacedMissiles })
|
||||
settingsDict.update({ 'Power Bomb Tanks': PlacedPowerBombs })
|
||||
spoilerLog.update({ 'Settings': settingsDict })
|
||||
itemProgression = dict()
|
||||
for x in range(len(PlacedItems)):
|
||||
if PlacedItems[x] in MajorItems:
|
||||
namedItem = ItemNames[MajorItems.index(PlacedItems[x])]
|
||||
PlacedItems[x] = namedItem
|
||||
itemProgression.update({
|
||||
UsedLocations[x]: PlacedItems[x] })
|
||||
continue
|
||||
spoilerLog.update({
|
||||
'Item order': itemProgression })
|
||||
itemProgression.update({ UsedLocations[x]: PlacedItems[x] })
|
||||
spoilerLog.update({ 'Item order': itemProgression })
|
||||
itemDict = dict()
|
||||
World.itemLocations.sort()
|
||||
for x in range(0, len(World.itemLocations)):
|
||||
itemDict.update({
|
||||
World.itemLocations[x]: 0 })
|
||||
itemDict.update({ World.itemLocations[x]: 0 })
|
||||
for x in range(0, len(PlacedItems)):
|
||||
itemDict.update({
|
||||
UsedLocations[x]: PlacedItems[x] })
|
||||
spoilerLog.update({
|
||||
'Items': itemDict })
|
||||
itemDict.update({ UsedLocations[x]: PlacedItems[x] })
|
||||
spoilerLog.update({ 'Items': itemDict })
|
||||
with open(os.path.join('.', 'spoilers', '{}.json'.format(FileName)), 'w') as spoiler:
|
||||
json.dump(spoilerLog, spoiler, indent=4)
|
||||
|
||||
|
|
Loading…
Reference in New Issue