-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yoshi's Island: Implement New Game #2141
Merged
Merged
Changes from 250 commits
Commits
Show all changes
273 commits
Select commit
Hold shift + click to select a range
1878873
Add files via upload
PinkSwitch 8adbc90
Add files via upload
PinkSwitch 0a7de67
Add files via upload
PinkSwitch e19ce09
Add files via upload
PinkSwitch 02df087
Add files via upload
PinkSwitch 8c96f0f
Add files via upload
PinkSwitch 51ca2ae
Add files via upload
PinkSwitch cb508d8
Add files via upload
PinkSwitch 3b874e9
Add files via upload
PinkSwitch 6a4cd91
Delete worlds/yoshisisland/docs directory
PinkSwitch 98e8716
Add files via upload
PinkSwitch 83bcd47
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 6930a64
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a6ef920
Add files via upload
PinkSwitch 7e204cb
Add files via upload
PinkSwitch 7616889
Add files via upload
PinkSwitch 5fb2a18
Add files via upload
PinkSwitch 483e590
Add files via upload
PinkSwitch 4131633
Add files via upload
PinkSwitch 20f59e3
Add files via upload
PinkSwitch 409f62c
Add files via upload
PinkSwitch b3daa4f
Add files via upload
PinkSwitch 10399e1
Add files via upload
PinkSwitch bc9686e
Add files via upload
PinkSwitch 8cd897a
Delete LogicExtensions.py
PinkSwitch ad8e8b0
Add files via upload
PinkSwitch 263e33e
Add files via upload
PinkSwitch fdeebb6
Add files via upload
PinkSwitch ad67b89
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a5af333
Add files via upload
PinkSwitch c4c3a96
Add files via upload
PinkSwitch f79295c
Add files via upload
PinkSwitch f9d9fbc
Add files via upload
PinkSwitch ad8b4a2
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch b216528
Update SetupGame.py
PinkSwitch 8316cbe
Update SetupGame.py
PinkSwitch 65192c8
Update SetupGame.py
PinkSwitch 26af9a6
Update Client.py
PinkSwitch 573b1a9
Update worlds/yoshisisland/Client.py
PinkSwitch add4058
Update worlds/yoshisisland/SetupGame.py
PinkSwitch 9fd1046
Update worlds/yoshisisland/SetupGame.py
PinkSwitch 58cdbd7
Update worlds/yoshisisland/__init__.py
PinkSwitch 70b5e21
Add files via upload
PinkSwitch 85d93ba
Add files via upload
PinkSwitch 8c3c924
Add files via upload
PinkSwitch 1c8ea72
Add files via upload
PinkSwitch ed471c8
Add files via upload
PinkSwitch 159b9b6
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 73e6be0
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a17b5cd
Add files via upload
PinkSwitch 0cda57f
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4fb656f
Add files via upload
PinkSwitch 8f7e03b
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a8f44a2
Add files via upload
PinkSwitch b6645e0
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 2c31105
Add files via upload
PinkSwitch 5a5d77e
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 7318106
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 56361ac
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch bdeb91c
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 9e7cc60
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch daee1f9
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch e5bfba0
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 1736671
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch d9beb74
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4cdf2c4
Level access logic fixes
PinkSwitch 5e1cf5b
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 8981704
Add files via upload
PinkSwitch 25820ca
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 3991733
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 91f8723
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4a7eb82
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 6129c2a
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 1792f38
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 7cf893b
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a5ebc5f
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a0cd45c
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4905a97
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 9f55884
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 6f9f5a9
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 0444dc1
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 72c6bbd
Add files via upload
PinkSwitch 59d6007
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 292d2ea
Add files via upload
PinkSwitch 6184e58
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4be7634
Add files via upload
PinkSwitch a694ff9
Add files via upload
PinkSwitch ca180f9
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 86b8267
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch c93981c
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 52b4c8f
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 0c7d7a4
Add files via upload
PinkSwitch 243172b
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch cedabe9
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 354415a
Merge branch 'main' into Yoshi's-Island
PinkSwitch 261ce07
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch fc467d0
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 87561c4
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4e2a714
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 1c48cea
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch b86249a
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 7afd3fe
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a6f9583
Add files via upload
PinkSwitch c9cc106
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch cc476da
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 59f08b1
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 57e386e
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch ac1300d
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch e333f67
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 2a3ccfc
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch ee522de
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch eba2520
Add files via upload
PinkSwitch 6c804cc
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 89c0b92
Add files via upload
PinkSwitch a9062a9
Add files via upload
PinkSwitch 7aa8ba3
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch d033ba4
Add files via upload
PinkSwitch b6d3314
Add files via upload
PinkSwitch cc996a1
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 2e3b82a
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch cb7287e
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4a9e2d5
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch ae9c7aa
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 9bf47c3
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a16868c
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch b0ffc1b
Add files via upload
PinkSwitch c0bbbea
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 155ae2f
Add files via upload
PinkSwitch fce3d7b
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch d02db0f
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 0bb14fc
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 11e2e95
Add files via upload
PinkSwitch a906993
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 9c5baad
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch da2bee2
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 3f37178
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 064bd99
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch bc5ad06
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch c043144
Add files via upload
PinkSwitch cea107f
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 141caea
Delete worlds/yoshisisland/LevelLogic.py
PinkSwitch 7988fb0
Delete worlds/yoshisisland/SetupGame.py
PinkSwitch 121a642
Delete worlds/yoshisisland/SetupBosses.py
PinkSwitch b9b06fe
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4b24f72
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a801453
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch c9a1376
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 582d984
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch dcc0cc9
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch ee19d20
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 1246aff
Add files via upload
PinkSwitch f759500
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch aa0bd63
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 9912811
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch a8c049d
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch ae21d43
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch f4ac39e
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch bc4f156
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 21602db
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 4c6a7a1
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 52c39e5
Add files via upload
PinkSwitch e1f94e3
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 5871af1
Update worlds/yoshisisland/Rules.py
PinkSwitch 879c096
Merge branch 'ArchipelagoMW:main' into Yoshi's-Island
PinkSwitch 732183d
Add files via upload
PinkSwitch 775adfc
Add files via upload
PinkSwitch 3b814a7
Merge branch 'main' into Yoshi's-Island
PinkSwitch 3835939
Add files via upload
PinkSwitch 83dfa82
Add files via upload
PinkSwitch c9095c5
Add files via upload
PinkSwitch a8e9381
Merge branch 'main' into Yoshi's-Island
PinkSwitch a48bc97
Add files via upload
PinkSwitch 022419d
Merge branch 'main' into Yoshi's-Island
PinkSwitch 3ba025b
Add files via upload
PinkSwitch a233bf3
Add files via upload
PinkSwitch dca6ce2
Merge branch 'main' into Yoshi's-Island
PinkSwitch 49801fe
Add files via upload
PinkSwitch 7eecfe1
Addressed reviews, slight code cleanup
PinkSwitch c8e6c18
Delete docs/en_Yoshi's Island.md
PinkSwitch e14635a
Delete docs/setup_en.md
PinkSwitch d4e29a7
Delete Items.py
PinkSwitch c6e84f2
Delete setup_game.py
PinkSwitch bd01cda
Delete setup_bosses.py
PinkSwitch 766403c
Delete level_logic.py
PinkSwitch 4f77344
Delete Options.py
PinkSwitch 45ad948
Delete Locations.py
PinkSwitch b1b5881
Delete Client.py
PinkSwitch ce135a3
Delete Regions.py
PinkSwitch af3554a
Delete Rules.py
PinkSwitch 5642266
Delete Rom.py
PinkSwitch bf6326b
Delete __init__.py
PinkSwitch 4a83a85
Merge branch 'main' into Yoshi's-Island
PinkSwitch e65316e
Add files via upload
PinkSwitch 2bda963
Update Options.py
PinkSwitch b345b6e
Merge branch 'main' into Yoshi's-Island
PinkSwitch 0af8e80
change how item classification is assigned
PinkSwitch 8f031ee
fixed shenanigans going on in locations
PinkSwitch 227d875
fixed some stuff, perhaps even things
PinkSwitch 59b3657
added to codeowners
PinkSwitch 2f3b3db
Add files via upload
PinkSwitch a291dfd
Merge branch 'main' into Yoshi's-Island
PinkSwitch 11fbb8c
Update inno_setup.iss
PinkSwitch f024717
Update README.md
PinkSwitch 29801a2
Update CODEOWNERS
PinkSwitch 880d02b
Update CODEOWNERS
PinkSwitch 3f238a1
fixed reviews
PinkSwitch 0b591db
Add files via upload
PinkSwitch 6ea243d
type hint is silly and unclean
PinkSwitch 720b3a5
fixed type hint again
PinkSwitch 4bf99a0
Add files via upload
PinkSwitch a0360c1
Delete worlds/setup_game.py
PinkSwitch f2dd14f
Delete worlds/setup_bosses.py
PinkSwitch e75e0a4
Delete worlds/Locations.py
PinkSwitch d78577e
Delete worlds/Rules.py
PinkSwitch 3a373a2
Delete worlds/level_logic.py
PinkSwitch c44b237
Update Options.py
PinkSwitch 7a6e74b
Delete worlds/Client.py
PinkSwitch e134260
Update __init__.py
PinkSwitch fb6f34b
Delete worlds/Items.py
PinkSwitch 24daead
Delete worlds/docs directory
PinkSwitch 8a78ac1
Delete worlds/Regions.py
PinkSwitch d529843
Delete worlds/Options.py
PinkSwitch c0e63a2
Delete worlds/Rom.py
PinkSwitch 39a4678
Add files via upload
PinkSwitch 3070c8b
Add files via upload
PinkSwitch 970afe7
Addressed comments and updated setup documents
PinkSwitch 4701de0
Merge branch 'main' into Yoshi's-Island
PinkSwitch f9ffe45
Addressed comments
PinkSwitch 59abdd4
Fixed typo in client
PinkSwitch 1b403d6
Fixed rules being set incorrectly
PinkSwitch c71bf1d
Massive Yoshi's Island style refactor
NewSoupVi 0bdbe6e
Remove a few #
NewSoupVi 0fa9173
trailing comma
NewSoupVi 9cb8590
make option comparisons look better
NewSoupVi 4d0bf30
Fix bad relative import
NewSoupVi 5d4dbfa
I broke it lol
NewSoupVi d00cfde
Double quotes everywhere
NewSoupVi 001a953
Removed some trailing whitespace
NewSoupVi 56e411c
Fixed trap classification
PinkSwitch 5b9bc11
Fixed crash related to car morph
PinkSwitch 2f4f2d6
Fix Medic's suggestions
NewSoupVi b5fc388
Merge remote-tracking branch 'pinkswitch/Yoshi's-Island' into yoshis_…
NewSoupVi a41b9dd
Merge pull request #2 from NewSoupVi/yoshis_island_refactor
PinkSwitch 229cdb0
Merge branch 'main' into Yoshi's-Island
PinkSwitch cfbe754
Remove unused player limit
PinkSwitch e9c2194
Remove unused rom name check
PinkSwitch 6fbae6c
Merge branch 'main' into Yoshi's-Island
PinkSwitch 22cca7c
Change settings to options
PinkSwitch dc13850
Small formatting fix
PinkSwitch b87ecee
Update worlds/yoshisisland/docs/en_Yoshi's Island.md
PinkSwitch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
import logging | ||
import struct | ||
import typing | ||
import time | ||
from struct import pack | ||
|
||
from NetUtils import ClientStatus, color | ||
from worlds.AutoSNIClient import SNIClient | ||
|
||
if typing.TYPE_CHECKING: | ||
from SNIClient import SNIContext | ||
|
||
snes_logger = logging.getLogger("SNES") | ||
|
||
ROM_START = 0x000000 | ||
WRAM_START = 0xF50000 | ||
WRAM_SIZE = 0x20000 | ||
SRAM_START = 0xE00000 | ||
|
||
YOSHISISLAND_ROMHASH_START = 0x007FC0 | ||
ROMHASH_SIZE = 0x15 | ||
|
||
ITEMQUEUE_HIGH = WRAM_START + 0x1465 | ||
ITEM_RECEIVED = WRAM_START + 0x1467 | ||
DEATH_RECEIVED = WRAM_START + 0x7E23B0 | ||
GAME_MODE = WRAM_START + 0x0118 | ||
YOSHI_STATE = SRAM_START + 0x00AC | ||
DEATHLINK_ADDR = ROM_START + 0x06FC8C | ||
DEATHMUSIC_FLAG = WRAM_START + 0x004F | ||
DEATHFLAG = WRAM_START + 0x00DB | ||
DEATHLINKRECV = WRAM_START + 0x00E0 | ||
GOALFLAG = WRAM_START + 0x14B6 | ||
|
||
VALID_GAME_STATES = [0x0F, 0x10, 0x2C] | ||
|
||
|
||
class YoshisIslandSNIClient(SNIClient): | ||
game = "Yoshi's Island" | ||
|
||
async def deathlink_kill_player(self, ctx: "SNIContext") -> None: | ||
from SNIClient import DeathState, snes_buffered_write, snes_flush_writes, snes_read | ||
game_state = await snes_read(ctx, GAME_MODE, 0x1) | ||
if game_state[0] != 0x0F: | ||
return | ||
|
||
yoshi_state = await snes_read(ctx, YOSHI_STATE, 0x1) | ||
if yoshi_state[0] != 0x00: | ||
return | ||
|
||
snes_buffered_write(ctx, WRAM_START + 0x026A, bytes([0x01])) | ||
snes_buffered_write(ctx, WRAM_START + 0x00E0, bytes([0x01])) | ||
await snes_flush_writes(ctx) | ||
ctx.death_state = DeathState.dead | ||
ctx.last_death_link = time.time() | ||
|
||
async def validate_rom(self, ctx: "SNIContext") -> bool: | ||
from SNIClient import snes_read | ||
|
||
rom_name = await snes_read(ctx, YOSHISISLAND_ROMHASH_START, ROMHASH_SIZE) | ||
if rom_name is None or rom_name[:7] != b"YOSHIAP": | ||
return False | ||
|
||
ctx.game = self.game | ||
ctx.items_handling = 0b111 # remote items | ||
ctx.rom = rom_name | ||
|
||
death_link = await snes_read(ctx, DEATHLINK_ADDR, 1) | ||
if death_link: | ||
await ctx.update_death_link(bool(death_link[0] & 0b1)) | ||
return True | ||
|
||
async def game_watcher(self, ctx: "SNIContext") -> None: | ||
from SNIClient import snes_buffered_write, snes_flush_writes, snes_read | ||
|
||
game_mode = await snes_read(ctx, GAME_MODE, 0x1) | ||
item_received = await snes_read(ctx, ITEM_RECEIVED, 0x1) | ||
game_music = await snes_read(ctx, DEATHMUSIC_FLAG, 0x1) | ||
goal_flag = await snes_read(ctx, GOALFLAG, 0x1) | ||
|
||
if "DeathLink" in ctx.tags and ctx.last_death_link + 1 < time.time(): | ||
death_flag = await snes_read(ctx, DEATHFLAG, 0x1) | ||
deathlink_death = await snes_read(ctx, DEATHLINKRECV, 0x1) | ||
currently_dead = (game_music[0] == 0x07 or game_mode[0] == 0x12 or | ||
(death_flag[0] == 0x00 and game_mode[0] == 0x11)) and deathlink_death[0] == 0x00 | ||
await ctx.handle_deathlink_state(currently_dead) | ||
|
||
if game_mode is None: | ||
return | ||
elif goal_flag[0] != 0x00: | ||
await ctx.send_msgs([{"cmd": "StatusUpdate", "status": ClientStatus.CLIENT_GOAL}]) | ||
ctx.finished_game = True | ||
elif game_mode[0] not in VALID_GAME_STATES: | ||
return | ||
elif item_received[0] > 0x00: | ||
return | ||
|
||
from .Rom import item_values | ||
rom = await snes_read(ctx, YOSHISISLAND_ROMHASH_START, ROMHASH_SIZE) | ||
if rom != ctx.rom: | ||
ctx.rom = None | ||
return | ||
|
||
new_checks = [] | ||
from .Rom import location_table | ||
|
||
location_ram_data = await snes_read(ctx, WRAM_START + 0x1440, 0x80) | ||
for loc_id, loc_data in location_table.items(): | ||
if loc_id not in ctx.locations_checked: | ||
data = location_ram_data[loc_data[0] - 0x1440] | ||
masked_data = data & (1 << loc_data[1]) | ||
bit_set = masked_data != 0 | ||
invert_bit = ((len(loc_data) >= 3) and loc_data[2]) | ||
if bit_set != invert_bit: | ||
new_checks.append(loc_id) | ||
|
||
for new_check_id in new_checks: | ||
ctx.locations_checked.add(new_check_id) | ||
location = ctx.location_names[new_check_id] | ||
total_locations = len(ctx.missing_locations) + len(ctx.checked_locations) | ||
snes_logger.info(f"New Check: {location} ({len(ctx.locations_checked)}/{total_locations})") | ||
await ctx.send_msgs([{"cmd": "LocationChecks", "locations": [new_check_id]}]) | ||
|
||
recv_count = await snes_read(ctx, ITEMQUEUE_HIGH, 2) | ||
recv_index = struct.unpack("H", recv_count)[0] | ||
if recv_index < len(ctx.items_received): | ||
item = ctx.items_received[recv_index] | ||
recv_index += 1 | ||
logging.info("Received %s from %s (%s) (%d/%d in list)" % ( | ||
color(ctx.item_names[item.item], "red", "bold"), | ||
color(ctx.player_names[item.player], "yellow"), | ||
ctx.location_names[item.location], recv_index, len(ctx.items_received))) | ||
|
||
snes_buffered_write(ctx, ITEMQUEUE_HIGH, pack("H", recv_index)) | ||
if item.item in item_values: | ||
item_count = await snes_read(ctx, WRAM_START + item_values[item.item][0], 0x1) | ||
increment = item_values[item.item][1] | ||
new_item_count = item_count[0] | ||
if increment > 1: | ||
new_item_count = increment | ||
else: | ||
new_item_count += increment | ||
|
||
snes_buffered_write(ctx, WRAM_START + item_values[item.item][0], bytes([new_item_count])) | ||
await snes_flush_writes(ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
from typing import Dict, Set, Tuple, NamedTuple, Optional | ||
from BaseClasses import ItemClassification | ||
|
||
class ItemData(NamedTuple): | ||
category: str | ||
code: Optional[int] | ||
classification: ItemClassification | ||
amount: Optional[int] = 1 | ||
|
||
item_table: Dict[str, ItemData] = { | ||
"! Switch": ItemData("Items", 0x302050, ItemClassification.progression), | ||
"Dashed Platform": ItemData("Items", 0x302051, ItemClassification.progression), | ||
"Dashed Stairs": ItemData("Items", 0x302052, ItemClassification.progression), | ||
"Beanstalk": ItemData("Items", 0x302053, ItemClassification.progression), | ||
"Helicopter Morph": ItemData("Morphs", 0x302054, ItemClassification.progression), | ||
"Spring Ball": ItemData("Items", 0x302055, ItemClassification.progression), | ||
"Large Spring Ball": ItemData("Items", 0x302056, ItemClassification.progression), | ||
"Arrow Wheel": ItemData("Items", 0x302057, ItemClassification.progression), | ||
"Vanishing Arrow Wheel": ItemData("Items", 0x302058, ItemClassification.progression), | ||
"Mole Tank Morph": ItemData("Morphs", 0x302059, ItemClassification.progression), | ||
"Watermelon": ItemData("Items", 0x30205A, ItemClassification.progression), | ||
"Ice Melon": ItemData("Items", 0x30205B, ItemClassification.progression), | ||
"Fire Melon": ItemData("Items", 0x30205C, ItemClassification.progression), | ||
"Super Star": ItemData("Items", 0x30205D, ItemClassification.progression), | ||
"Car Morph": ItemData("Morphs", 0x30205E, ItemClassification.progression), | ||
"Flashing Eggs": ItemData("Items", 0x30205F, ItemClassification.progression), | ||
"Giant Eggs": ItemData("Items", 0x302060, ItemClassification.progression), | ||
"Egg Launcher": ItemData("Items", 0x302061, ItemClassification.progression), | ||
"Egg Plant": ItemData("Items", 0x302062, ItemClassification.progression), | ||
"Submarine Morph": ItemData("Morphs", 0x302063, ItemClassification.progression), | ||
"Chomp Rock": ItemData("Items", 0x302064, ItemClassification.progression), | ||
"Poochy": ItemData("Items", 0x302065, ItemClassification.progression), | ||
"Platform Ghost": ItemData("Items", 0x302066, ItemClassification.progression), | ||
"Skis": ItemData("Items", 0x302067, ItemClassification.progression), | ||
"Train Morph": ItemData("Morphs", 0x302068, ItemClassification.progression), | ||
"Key": ItemData("Items", 0x302069, ItemClassification.progression), | ||
"Middle Ring": ItemData("Items", 0x30206A, ItemClassification.progression), | ||
"Bucket": ItemData("Items", 0x30206B, ItemClassification.progression), | ||
"Tulip": ItemData("Items", 0x30206C, ItemClassification.progression), | ||
"Egg Capacity Upgrade": ItemData("Items", 0x30206D, ItemClassification.progression, 5), | ||
"Secret Lens": ItemData("Items", 0x302081, ItemClassification.progression), | ||
|
||
"World 1 Gate": ItemData("Gates", 0x30206E, ItemClassification.progression), | ||
"World 2 Gate": ItemData("Gates", 0x30206F, ItemClassification.progression), | ||
"World 3 Gate": ItemData("Gates", 0x302070, ItemClassification.progression), | ||
"World 4 Gate": ItemData("Gates", 0x302071, ItemClassification.progression), | ||
"World 5 Gate": ItemData("Gates", 0x302072, ItemClassification.progression), | ||
"World 6 Gate": ItemData("Gates", 0x302073, ItemClassification.progression), | ||
|
||
"Extra 1": ItemData("Panels", 0x302074, ItemClassification.progression), | ||
"Extra 2": ItemData("Panels", 0x302075, ItemClassification.progression), | ||
"Extra 3": ItemData("Panels", 0x302076, ItemClassification.progression), | ||
"Extra 4": ItemData("Panels", 0x302077, ItemClassification.progression), | ||
"Extra 5": ItemData("Panels", 0x302078, ItemClassification.progression), | ||
"Extra 6": ItemData("Panels", 0x302079, ItemClassification.progression), | ||
"Extra Panels": ItemData("Panels", 0x30207A, ItemClassification.progression), | ||
|
||
"Bonus 1": ItemData("Panels", 0x30207B, ItemClassification.progression), | ||
"Bonus 2": ItemData("Panels", 0x30207C, ItemClassification.progression), | ||
"Bonus 3": ItemData("Panels", 0x30207D, ItemClassification.progression), | ||
"Bonus 4": ItemData("Panels", 0x30207E, ItemClassification.progression), | ||
"Bonus 5": ItemData("Panels", 0x30207F, ItemClassification.progression), | ||
"Bonus 6": ItemData("Panels", 0x302080, ItemClassification.progression), | ||
"Bonus Panels": ItemData("Panels", 0x302082, ItemClassification.progression), | ||
|
||
"Anytime Egg": ItemData("Consumable", 0x302083, ItemClassification.useful, 0), | ||
"Anywhere Pow": ItemData("Consumable", 0x302084, ItemClassification.filler, 0), | ||
"Winged Cloud Maker": ItemData("Consumable", 0x302085, ItemClassification.filler, 0), | ||
"Pocket Melon": ItemData("Consumable", 0x302086, ItemClassification.filler, 0), | ||
"Pocket Fire Melon": ItemData("Consumable", 0x302087, ItemClassification.filler, 0), | ||
"Pocket Ice Melon": ItemData("Consumable", 0x302088, ItemClassification.filler, 0), | ||
"Magnifying Glass": ItemData("Consumable", 0x302089, ItemClassification.filler, 0), | ||
"+10 Stars": ItemData("Consumable", 0x30208A, ItemClassification.useful, 0), | ||
"+20 Stars": ItemData("Consumable", 0x30208B, ItemClassification.useful, 0), | ||
"1-Up": ItemData("Lives", 0x30208C, ItemClassification.filler, 0), | ||
"2-Up": ItemData("Lives", 0x30208D, ItemClassification.filler, 0), | ||
"3-Up": ItemData("Lives", 0x30208E, ItemClassification.filler, 0), | ||
"10-Up": ItemData("Lives", 0x30208F, ItemClassification.filler, 5), | ||
"Bonus Consumables": ItemData("Events", None, ItemClassification.progression, 0), | ||
"Bandit Consumables": ItemData("Events", None, ItemClassification.progression, 0), | ||
"Bandit Watermelons": ItemData("Events", None, ItemClassification.progression, 0), | ||
|
||
"Fuzzy Trap": ItemData("Traps", 0x302090, ItemClassification.trap, 0), | ||
"Reversal Trap": ItemData("Traps", 0x302091, ItemClassification.trap, 0), | ||
"Darkness Trap": ItemData("Traps", 0x302092, ItemClassification.trap, 0), | ||
"Freeze Trap": ItemData("Traps", 0x302093, ItemClassification.trap, 0), | ||
|
||
"Boss Clear": ItemData("Events", None, ItemClassification.progression, 0), | ||
"Piece of Luigi": ItemData("Items", 0x302095, ItemClassification.progression, 0), | ||
"Saved Baby Luigi": ItemData("Events", None, ItemClassification.progression, 0) | ||
} | ||
|
||
filler_items: Tuple[str, ...] = ( | ||
"Anytime Egg", | ||
"Anywhere Pow", | ||
"Winged Cloud Maker", | ||
"Pocket Melon", | ||
"Pocket Fire Melon", | ||
"Pocket Ice Melon", | ||
"Magnifying Glass", | ||
"+10 Stars", | ||
"+20 Stars", | ||
"1-Up", | ||
"2-Up", | ||
"3-Up" | ||
) | ||
|
||
trap_items: Tuple[str, ...] = ( | ||
"Fuzzy Trap", | ||
"Reversal Trap", | ||
"Darkness Trap", | ||
"Freeze Trap" | ||
) | ||
|
||
def get_item_names_per_category() -> Dict[str, Set[str]]: | ||
categories: Dict[str, Set[str]] = {} | ||
|
||
for name, data in item_table.items(): | ||
if data.category != "Events": | ||
categories.setdefault(data.category, set()).add(name) | ||
|
||
return categories |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should ask these in the discord instead, not on the merged PR