Skip to content

Commit

Permalink
Ion Fury Aftershock support
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Oct 2, 2023
1 parent a46a0b4 commit a9336ee
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .github/release_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
2 changes: 1 addition & 1 deletion .github/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
63 changes: 46 additions & 17 deletions BuildGames/IonFury.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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)
5 changes: 4 additions & 1 deletion BuildGames/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(.*?)$
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion BuildLibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 14 additions & 6 deletions BuildLibs/buildmapbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]
8 changes: 4 additions & 4 deletions GUI/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('<Button-1>', 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('<Button-1>', 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')
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
11 changes: 9 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a9336ee

Please sign in to comment.