From a9336ee1e61aa98061789e0febe3f0beb7498218 Mon Sep 17 00:00:00 2001 From: Die4Ever Date: Mon, 2 Oct 2023 17:08:33 -0500 Subject: [PATCH] Ion Fury Aftershock support --- .github/release_template.md | 2 ++ .github/run-tests/action.yml | 2 +- BuildGames/IonFury.py | 63 ++++++++++++++++++++++++++---------- BuildGames/__init__.py | 5 ++- BuildLibs/__init__.py | 2 +- BuildLibs/buildmapbase.py | 20 ++++++++---- GUI/gui.py | 8 ++--- README.md | 2 ++ tests.py | 11 +++++-- 9 files changed, 83 insertions(+), 32 deletions(-) diff --git a/.github/release_template.md b/.github/release_template.md index 233fb45..181d3e2 100644 --- a/.github/release_template.md +++ b/.github/release_template.md @@ -25,3 +25,5 @@ Randomizes enemies and items. For games that use CON files (Duke Nukem 3D and Io * [Join our Discord here!](https://discord.gg/QwjnYWhKsY) + +Also check out [our new website, Mods4Ever.com](https://Mods4Ever.com/) diff --git a/.github/run-tests/action.yml b/.github/run-tests/action.yml index d9c5489..c7df2fb 100644 --- a/.github/run-tests/action.yml +++ b/.github/run-tests/action.yml @@ -3,7 +3,7 @@ runs: steps: - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' cache: 'pip' # caching pip dependencies - run: pip3 install -r requirements.txt 2>&1 diff --git a/BuildGames/IonFury.py b/BuildGames/IonFury.py index 4354659..0d3458d 100644 --- a/BuildGames/IonFury.py +++ b/BuildGames/IonFury.py @@ -2,8 +2,9 @@ AddGame('Ion Fury', 'Ion Fury', 92644120, '960B3686', 'd834055f0c9a60f8f23163b67d086546', '2cec5ab769ae27c6685d517defa766191c5e66c1', canUseRandomizerFolder=False, canUseGrpFile=True) # Steam version +AddGame('Ion Fury Aftershock', 'Ion Fury Aftershock', 163939122, '2D7CAC72', 'a326052d456a9c9a80ca13cb90270d5b', '720b17e4110448e33129504918feea3dc23fe900', canUseRandomizerFolder=False, canUseGrpFile=True) # Steam Aftershock version -AddMapSettings('Ion Fury', minMapVersion=7, maxMapVersion=9, +ion_fury_map_settings = dict(minMapVersion=7, maxMapVersion=9, swappableItems = { 209: SpriteInfo('I_BATON'), 210: SpriteInfo('I_LOVERBOY'), @@ -45,6 +46,24 @@ 9003: SpriteInfo('I_SODA'), 9002: SpriteInfo('I_SODA_STAND'), 320: SpriteInfo('I_AMMOCRATE'), + + # Aftershock + # define I_BANSHEE 16083 + # define I_COLLECTIBLE 17200 + 17201: SpriteInfo('I_WRECKER'), + 17202: SpriteInfo('I_GRENADELAUNCHER_GAS'), + 17203: SpriteInfo('I_SHOTGUN_CLUSTER'), + 17204: SpriteInfo('I_GASGRENADE_AMMO'), + 17205: SpriteInfo('I_CLUSTER_AMMO'), + 17211: SpriteInfo('I_WRECKER_AMMO'), + 17212: SpriteInfo('I_WRECKER_AMMO_SIXPACK'), + 17206: SpriteInfo('I_BOOM_BAG'), + 17207: SpriteInfo('I_INVULNERABILITY'), + 17208: SpriteInfo('I_POCKET_PARASITE'), + 17209: SpriteInfo('I_AGILITY_SURGE'), + 17210: SpriteInfo('I_GOLDEN_GUN'), + 17213: SpriteInfo('I_FLAMETRAP'), + 17214: SpriteInfo('I_INFLATABLE_CHAIR'), }, swappableEnemies = { # 7259: SpriteInfo('A_TURRET_BOTTOM'), @@ -106,21 +125,31 @@ triggers={} ) -AddGameSettings('Ion Fury', mainScript='scripts/main.con', defName='fury.def', flags=128, -commands = dict(# https://voidpoint.io/terminx/eduke32/-/blob/master/source/duke3d/src/cmdline.cpp#L39 - grp=OrderedDict(eduke32='-nosetup -g', fury='-nosetup -g'), - folder=OrderedDict(eduke32='-nosetup -j '), - simple={} -), -conFiles = { - 'scripts/customize.con': [ - ConVar('.*\wHEALTH', -1, range=0.5), - ConVar('MEDKIT_HEALTHAMOUNT', -1, range=0.5), - ConVar('.*MAXAMMO', -1), - ConVar('.*AMOUNT', -1), +AddMapSettings('Ion Fury', **ion_fury_map_settings) +AddMapSettings('Ion Fury Aftershock', **ion_fury_map_settings) + +ion_fury_game_settings = dict( + mainScript='scripts/main.con', defName='fury.def', flags=128, + commands = dict(# https://voidpoint.io/terminx/eduke32/-/blob/master/source/duke3d/src/cmdline.cpp#L39 + grp=OrderedDict(eduke32='-nosetup -g', fury='-nosetup -g'), + folder=OrderedDict(eduke32='-nosetup -j '), + simple={} + ), + conFiles = { + 'scripts/customize.con': [ + ConVar('.*\wHEALTH', -1, range=0.5), + ConVar('MEDKIT_HEALTHAMOUNT', -1, range=0.5), + ConVar('.*MAXAMMO', -1), + ConVar('.*AMOUNT', -1), + + ConVar('.*_DMG', 0), # not sure if this affects enemies too or just the player? + + ConVar('.*_HEALTH', 1), + ] + } +) - ConVar('.*_DMG', 0), # not sure if this affects enemies too or just the player? +aftershock_game_settings = {**ion_fury_game_settings, 'defName':'ashock.def'} - ConVar('.*_HEALTH', 1), - ] -}) +AddGameSettings('Ion Fury', **ion_fury_game_settings) +AddGameSettings('Ion Fury Aftershock', **aftershock_game_settings) diff --git a/BuildGames/__init__.py b/BuildGames/__init__.py index 196ad91..f2ae389 100644 --- a/BuildGames/__init__.py +++ b/BuildGames/__init__.py @@ -33,6 +33,9 @@ def copy(self) -> 'GameInfo': def AddGame(*args, **kargs) -> GameInfo: + """ + def __init__(self, name='', type='', size:int=0, crc:str='', md5:str='', sha1:str='', externalFiles:bool=False, canUseRandomizerFolder=True, canUseGrpFile=False, **kargs): + """ """ https://wiki.eduke32.com/wiki/Frequently_Asked_Questions ^(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)$ @@ -130,7 +133,7 @@ def GetGame(grppath:Path) -> GameInfo: size = os.path.getsize(grppath) with open(grppath) as file, mmap(file.fileno(), 0, access=ACCESS_READ) as file: crc:int = binascii.crc32(file) - g:GameInfo = gamesList.get(crc) + g:Union[GameInfo,None] = gamesList.get(crc) if g: if not g.size: g.size = size diff --git a/BuildLibs/__init__.py b/BuildLibs/__init__.py index c682e78..04dd562 100644 --- a/BuildLibs/__init__.py +++ b/BuildLibs/__init__.py @@ -16,7 +16,7 @@ import re def GetVersion() -> str: - return 'v0.9.3 Beta' + return 'v0.9.4 Beta' packLengthRegex = re.compile('^(.*?)(\d+)(\w)(.*?)$') class FancyPacker: diff --git a/BuildLibs/buildmapbase.py b/BuildLibs/buildmapbase.py index 1338e96..227b3df 100644 --- a/BuildLibs/buildmapbase.py +++ b/BuildLibs/buildmapbase.py @@ -396,6 +396,7 @@ def AddSprite(self, rng: random.Random, add: dict) -> None: spritetype = self.GetSpriteType(sprite) self.spoilerlog.AddSprite(spritetype, sprite) + def MirrorMap(self): # TODO, need to figure out re-ordering of walls, they need to be counterclockwise # probably need to compare coordinates and do some sorting @@ -421,8 +422,9 @@ def MirrorMap(self): shapes.append([]) for shape in shapes: - rev = shape.copy() - rev.reverse() + #rev = shape.copy() + #rev.reverse() + rev = MirrorList(shape) for a, b in zip(shape, rev): if a >= b: break @@ -438,16 +440,18 @@ def MirrorMap(self): next_sector_b = wallb.next_sector walla.next_wall = next_wall_b - #walla.next_sector_wall = next_sector_wall_b - #walla.next_sector = next_sector_b + walla.next_sector_wall = next_sector_wall_b + walla.next_sector = next_sector_b wallb.next_wall = next_wall_a - #wallb.next_sector_wall = next_sector_wall_a - #wallb.next_sector = next_sector_a + wallb.next_sector_wall = next_sector_wall_a + wallb.next_sector = next_sector_a self.walls[a] = wallb self.walls[b] = walla + # need to fix all the references to these points... + for s in self.sprites: s.pos[0] *= x s.pos[1] *= y @@ -775,3 +779,7 @@ def MapCrypt(data:bytearray, key:int) -> bytearray: data[i] = data[i] ^ (key & 0xff) key += 1 return data + +def MirrorList(l): + # ensure proper vertex order + return l[0:1] + l[-1:0:-1] diff --git a/GUI/gui.py b/GUI/gui.py index adec920..01db701 100644 --- a/GUI/gui.py +++ b/GUI/gui.py @@ -255,10 +255,10 @@ def initWindow(self): #self.progressbar.grid(column=0,row=row,columnspan=2) #row+=1 - discordLink = Label(self.win,text='discord.gg/QwjnYWhKsY',width=22,height=2,font=self.linkfont, fg="Blue", cursor="hand2") - discordLink.bind('', lambda *args: webbrowser.open_new('https://discord.gg/QwjnYWhKsY')) - discordLink.grid(column=0,row=100) - myTip = Hovertip(discordLink, 'Join our Discord!') + link = Label(self.win,text='Mods4Ever.com',width=22,height=2,font=self.linkfont, fg="Blue", cursor="hand2") + link.bind('', lambda *args: webbrowser.open_new('https://Mods4Ever.com')) + link.grid(column=0,row=100) + myTip = Hovertip(link, 'Check out our website and join our Discord!') self.randoButton = Button(self.win,text='Randomize!',width=18,height=2,font=self.font, command=self.Randomize) self.randoButton.grid(column=1,row=100, sticky='SE') diff --git a/README.md b/README.md index c169516..a15d0d3 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,5 @@ For info on where to get the games and how to run them, [check out our wiki here Randomizes enemies and items. For games that use CON files (Duke Nukem 3D and Ion Fury so far) it also randomizes values like maximum health and ammo values, and enemy strengths. Also supports randomizing the map order. Be warned that putting every setting to maximum will make the game nearly impossible. I suggest you start with the default settings. Also check out the Randomizer.html file that gets created in the output directory to see what's changed. [Join our Discord here!](https://discord.gg/QwjnYWhKsY) + +Also check out [our new website, Mods4Ever.com](https://Mods4Ever.com/) diff --git a/tests.py b/tests.py index d30599a..1133081 100644 --- a/tests.py +++ b/tests.py @@ -18,7 +18,7 @@ install_import_hook('BuildLibs') install_import_hook('BuildGames') install_import_hook('GUI') -from BuildLibs import buildmapbase, buildmap, crc32, trace, setVerbose, GetVersion +from BuildLibs import buildmapbase, buildmap, crc32, trace, setVerbose, GetVersion, warning from BuildLibs.grpbase import GrpBase from BuildLibs.grp import GrpZipFile, LoadGrpFile, RffCrypt, GrpOutput import BuildGames @@ -203,7 +203,7 @@ def CheckGame(self, game: BuildGames.GameInfo): try: mapSettings: BuildGames.GameMapSettings = BuildGames.GetGameMapSettings(game) except Exception as e: - trace(e) + warning(e) return for e in mapSettings.addableEnemies: self.assertIn(e, mapSettings.swappableEnemies) @@ -325,6 +325,13 @@ def test_blood_crypt(self): d2 = RffCrypt(d2, 451) self.assertEqual(data, d2) + def test_mirror(self): + orig = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] # verticies are counter-clockwise, right? + desired = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + result = buildmapbase.MirrorList(orig) + self.assertListEqual(result, desired, 'mirror') + + def CreateGrpFile(frompath: Path, outpath: Path, filenames: list) -> None: with GrpOutput(outpath, 'test', len(filenames), '', 'GAME.CON', None, 0, 0) as out: